OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CRANKSHAFT_LITHIUM_CODEGEN_H_ | 5 #ifndef V8_CRANKSHAFT_LITHIUM_CODEGEN_H_ |
6 #define V8_CRANKSHAFT_LITHIUM_CODEGEN_H_ | 6 #define V8_CRANKSHAFT_LITHIUM_CODEGEN_H_ |
7 | 7 |
8 #include "src/bailout-reason.h" | 8 #include "src/bailout-reason.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| 11 #include "src/source-position-table.h" |
11 | 12 |
12 namespace v8 { | 13 namespace v8 { |
13 namespace internal { | 14 namespace internal { |
14 | 15 |
15 class HGraph; | 16 class HGraph; |
16 class LChunk; | 17 class LChunk; |
17 class LEnvironment; | 18 class LEnvironment; |
18 class LInstruction; | 19 class LInstruction; |
19 class LPlatformChunk; | 20 class LPlatformChunk; |
20 | 21 |
21 class LCodeGenBase BASE_EMBEDDED { | 22 class LCodeGenBase BASE_EMBEDDED { |
22 public: | 23 public: |
23 LCodeGenBase(LChunk* chunk, | 24 LCodeGenBase(LChunk* chunk, |
24 MacroAssembler* assembler, | 25 MacroAssembler* assembler, |
25 CompilationInfo* info); | 26 CompilationInfo* info); |
26 virtual ~LCodeGenBase() {} | 27 virtual ~LCodeGenBase() {} |
27 | 28 |
28 // Simple accessors. | 29 // Simple accessors. |
29 MacroAssembler* masm() const { return masm_; } | 30 MacroAssembler* masm() const { return masm_; } |
30 CompilationInfo* info() const { return info_; } | 31 CompilationInfo* info() const { return info_; } |
31 Isolate* isolate() const { return info_->isolate(); } | 32 Isolate* isolate() const { return info_->isolate(); } |
32 Factory* factory() const { return isolate()->factory(); } | 33 Factory* factory() const { return isolate()->factory(); } |
33 Heap* heap() const { return isolate()->heap(); } | 34 Heap* heap() const { return isolate()->heap(); } |
34 Zone* zone() const { return zone_; } | 35 Zone* zone() const { return zone_; } |
35 LPlatformChunk* chunk() const { return chunk_; } | 36 LPlatformChunk* chunk() const { return chunk_; } |
36 HGraph* graph() const; | 37 HGraph* graph() const; |
| 38 SourcePositionTableBuilder* source_position_table_builder() { |
| 39 return &source_position_table_builder_; |
| 40 } |
37 | 41 |
38 void PRINTF_FORMAT(2, 3) Comment(const char* format, ...); | 42 void PRINTF_FORMAT(2, 3) Comment(const char* format, ...); |
39 void DeoptComment(const Deoptimizer::DeoptInfo& deopt_info); | 43 void DeoptComment(const Deoptimizer::DeoptInfo& deopt_info); |
40 static Deoptimizer::DeoptInfo MakeDeoptInfo( | 44 static Deoptimizer::DeoptInfo MakeDeoptInfo( |
41 LInstruction* instr, Deoptimizer::DeoptReason deopt_reason, int deopt_id); | 45 LInstruction* instr, Deoptimizer::DeoptReason deopt_reason, int deopt_id); |
42 | 46 |
43 bool GenerateBody(); | 47 bool GenerateBody(); |
44 virtual void GenerateBodyInstructionPre(LInstruction* instr) {} | 48 virtual void GenerateBodyInstructionPre(LInstruction* instr) {} |
45 virtual void GenerateBodyInstructionPost(LInstruction* instr) {} | 49 virtual void GenerateBodyInstructionPost(LInstruction* instr) {} |
46 | 50 |
47 virtual void EnsureSpaceForLazyDeopt(int space_needed) = 0; | 51 virtual void EnsureSpaceForLazyDeopt(int space_needed) = 0; |
48 virtual void RecordAndWritePosition(int position) = 0; | 52 void RecordAndWritePosition(int position); |
49 | 53 |
50 int GetNextEmittedBlock() const; | 54 int GetNextEmittedBlock() const; |
51 | 55 |
52 void RegisterWeakObjectsInOptimizedCode(Handle<Code> code); | 56 void RegisterWeakObjectsInOptimizedCode(Handle<Code> code); |
53 | 57 |
54 void WriteTranslationFrame(LEnvironment* environment, | 58 void WriteTranslationFrame(LEnvironment* environment, |
55 Translation* translation); | 59 Translation* translation); |
56 int DefineDeoptimizationLiteral(Handle<Object> literal); | 60 int DefineDeoptimizationLiteral(Handle<Object> literal); |
57 | 61 |
58 void PopulateDeoptimizationData(Handle<Code> code); | 62 void PopulateDeoptimizationData(Handle<Code> code); |
(...skipping 19 matching lines...) Expand all Loading... |
78 Status status_; | 82 Status status_; |
79 int current_block_; | 83 int current_block_; |
80 int current_instruction_; | 84 int current_instruction_; |
81 const ZoneList<LInstruction*>* instructions_; | 85 const ZoneList<LInstruction*>* instructions_; |
82 ZoneList<LEnvironment*> deoptimizations_; | 86 ZoneList<LEnvironment*> deoptimizations_; |
83 ZoneList<Handle<Object> > deoptimization_literals_; | 87 ZoneList<Handle<Object> > deoptimization_literals_; |
84 TranslationBuffer translations_; | 88 TranslationBuffer translations_; |
85 int inlined_function_count_; | 89 int inlined_function_count_; |
86 int last_lazy_deopt_pc_; | 90 int last_lazy_deopt_pc_; |
87 int osr_pc_offset_; | 91 int osr_pc_offset_; |
| 92 SourcePositionTableBuilder source_position_table_builder_; |
88 | 93 |
89 bool is_unused() const { return status_ == UNUSED; } | 94 bool is_unused() const { return status_ == UNUSED; } |
90 bool is_generating() const { return status_ == GENERATING; } | 95 bool is_generating() const { return status_ == GENERATING; } |
91 bool is_done() const { return status_ == DONE; } | 96 bool is_done() const { return status_ == DONE; } |
92 bool is_aborted() const { return status_ == ABORTED; } | 97 bool is_aborted() const { return status_ == ABORTED; } |
93 | 98 |
94 void Abort(BailoutReason reason); | 99 void Abort(BailoutReason reason); |
95 void Retry(BailoutReason reason); | 100 void Retry(BailoutReason reason); |
96 | 101 |
97 // Methods for code dependencies. | 102 // Methods for code dependencies. |
98 void AddDeprecationDependency(Handle<Map> map); | 103 void AddDeprecationDependency(Handle<Map> map); |
99 void AddStabilityDependency(Handle<Map> map); | 104 void AddStabilityDependency(Handle<Map> map); |
100 }; | 105 }; |
101 | 106 |
102 | 107 |
103 } // namespace internal | 108 } // namespace internal |
104 } // namespace v8 | 109 } // namespace v8 |
105 | 110 |
106 #endif // V8_CRANKSHAFT_LITHIUM_CODEGEN_H_ | 111 #endif // V8_CRANKSHAFT_LITHIUM_CODEGEN_H_ |
OLD | NEW |