V8 Project
lithium-codegen.h
Go to the documentation of this file.
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_LITHIUM_CODEGEN_H_
6 #define V8_LITHIUM_CODEGEN_H_
7 
8 #include "src/v8.h"
9 
10 #include "src/bailout-reason.h"
11 #include "src/compiler.h"
12 #include "src/deoptimizer.h"
13 
14 namespace v8 {
15 namespace internal {
16 
17 class LInstruction;
18 class LPlatformChunk;
19 
21  public:
23  MacroAssembler* assembler,
24  CompilationInfo* info);
25  virtual ~LCodeGenBase() {}
26 
27  // Simple accessors.
28  MacroAssembler* masm() const { return masm_; }
29  CompilationInfo* info() const { return info_; }
30  Isolate* isolate() const { return info_->isolate(); }
31  Factory* factory() const { return isolate()->factory(); }
32  Heap* heap() const { return isolate()->heap(); }
33  Zone* zone() const { return zone_; }
34  LPlatformChunk* chunk() const { return chunk_; }
35  HGraph* graph() const;
36 
37  void FPRINTF_CHECKING Comment(const char* format, ...);
38  void DeoptComment(const Deoptimizer::Reason& reason);
39 
40  bool GenerateBody();
41  virtual void GenerateBodyInstructionPre(LInstruction* instr) {}
42  virtual void GenerateBodyInstructionPost(LInstruction* instr) {}
43 
44  virtual void EnsureSpaceForLazyDeopt(int space_needed) = 0;
45  virtual void RecordAndWritePosition(int position) = 0;
46 
47  int GetNextEmittedBlock() const;
48 
50 
51  // Check that an environment assigned via AssignEnvironment is actually being
52  // used. Redundant assignments keep things alive longer than necessary, and
53  // consequently lead to worse code, so it's important to minimize this.
55 
56  protected:
57  enum Status {
61  ABORTED
62  };
63 
64  LPlatformChunk* const chunk_;
67  Zone* zone_;
73 
74  bool is_unused() const { return status_ == UNUSED; }
75  bool is_generating() const { return status_ == GENERATING; }
76  bool is_done() const { return status_ == DONE; }
77  bool is_aborted() const { return status_ == ABORTED; }
78 
79  void Abort(BailoutReason reason);
80  void Retry(BailoutReason reason);
81 
82  // Methods for code dependencies.
85 };
86 
87 
88 } } // namespace v8::internal
89 
90 #endif // V8_LITHIUM_CODEGEN_H_
#define BASE_EMBEDDED
Definition: allocation.h:45
MacroAssembler * masm() const
void AddStabilityDependency(Handle< Map > map)
void AddDeprecationDependency(Handle< Map > map)
LPlatformChunk * chunk() const
virtual void EnsureSpaceForLazyDeopt(int space_needed)=0
CompilationInfo *const info_
LPlatformChunk *const chunk_
CompilationInfo * info() const
void FPRINTF_CHECKING Comment(const char *format,...)
LCodeGenBase(LChunk *chunk, MacroAssembler *assembler, CompilationInfo *info)
void Abort(BailoutReason reason)
virtual void GenerateBodyInstructionPre(LInstruction *instr)
void Retry(BailoutReason reason)
void RegisterWeakObjectsInOptimizedCode(Handle< Code > code)
void DeoptComment(const Deoptimizer::Reason &reason)
MacroAssembler *const masm_
virtual void GenerateBodyInstructionPost(LInstruction *instr)
const ZoneList< LInstruction * > * instructions_
virtual void RecordAndWritePosition(int position)=0
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf map
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20
#define FPRINTF_CHECKING
Definition: utils.h:1026