| 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_LITHIUM_CODEGEN_H_ | 5 #ifndef V8_LITHIUM_CODEGEN_H_ |
| 6 #define V8_LITHIUM_CODEGEN_H_ | 6 #define V8_LITHIUM_CODEGEN_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| 11 #include "src/compiler.h" | 11 #include "src/compiler.h" |
| 12 #include "src/deoptimizer.h" | 12 #include "src/deoptimizer.h" |
| 13 | 13 |
| 14 namespace v8 { | 14 namespace v8 { |
| 15 namespace internal { | 15 namespace internal { |
| 16 | 16 |
| 17 class LEnvironment; |
| 17 class LInstruction; | 18 class LInstruction; |
| 18 class LPlatformChunk; | 19 class LPlatformChunk; |
| 19 | 20 |
| 20 class LCodeGenBase BASE_EMBEDDED { | 21 class LCodeGenBase BASE_EMBEDDED { |
| 21 public: | 22 public: |
| 22 LCodeGenBase(LChunk* chunk, | 23 LCodeGenBase(LChunk* chunk, |
| 23 MacroAssembler* assembler, | 24 MacroAssembler* assembler, |
| 24 CompilationInfo* info); | 25 CompilationInfo* info); |
| 25 virtual ~LCodeGenBase() {} | 26 virtual ~LCodeGenBase() {} |
| 26 | 27 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 43 virtual void GenerateBodyInstructionPre(LInstruction* instr) {} | 44 virtual void GenerateBodyInstructionPre(LInstruction* instr) {} |
| 44 virtual void GenerateBodyInstructionPost(LInstruction* instr) {} | 45 virtual void GenerateBodyInstructionPost(LInstruction* instr) {} |
| 45 | 46 |
| 46 virtual void EnsureSpaceForLazyDeopt(int space_needed) = 0; | 47 virtual void EnsureSpaceForLazyDeopt(int space_needed) = 0; |
| 47 virtual void RecordAndWritePosition(int position) = 0; | 48 virtual void RecordAndWritePosition(int position) = 0; |
| 48 | 49 |
| 49 int GetNextEmittedBlock() const; | 50 int GetNextEmittedBlock() const; |
| 50 | 51 |
| 51 void RegisterWeakObjectsInOptimizedCode(Handle<Code> code); | 52 void RegisterWeakObjectsInOptimizedCode(Handle<Code> code); |
| 52 | 53 |
| 54 void WriteTranslationFrame(LEnvironment* environment, |
| 55 Translation* translation); |
| 56 int DefineDeoptimizationLiteral(Handle<Object> literal); |
| 57 |
| 53 // Check that an environment assigned via AssignEnvironment is actually being | 58 // Check that an environment assigned via AssignEnvironment is actually being |
| 54 // used. Redundant assignments keep things alive longer than necessary, and | 59 // used. Redundant assignments keep things alive longer than necessary, and |
| 55 // consequently lead to worse code, so it's important to minimize this. | 60 // consequently lead to worse code, so it's important to minimize this. |
| 56 void CheckEnvironmentUsage(); | 61 void CheckEnvironmentUsage(); |
| 57 | 62 |
| 58 protected: | 63 protected: |
| 59 enum Status { | 64 enum Status { |
| 60 UNUSED, | 65 UNUSED, |
| 61 GENERATING, | 66 GENERATING, |
| 62 DONE, | 67 DONE, |
| 63 ABORTED | 68 ABORTED |
| 64 }; | 69 }; |
| 65 | 70 |
| 66 LPlatformChunk* const chunk_; | 71 LPlatformChunk* const chunk_; |
| 67 MacroAssembler* const masm_; | 72 MacroAssembler* const masm_; |
| 68 CompilationInfo* const info_; | 73 CompilationInfo* const info_; |
| 69 Zone* zone_; | 74 Zone* zone_; |
| 70 Status status_; | 75 Status status_; |
| 71 int current_block_; | 76 int current_block_; |
| 72 int current_instruction_; | 77 int current_instruction_; |
| 73 const ZoneList<LInstruction*>* instructions_; | 78 const ZoneList<LInstruction*>* instructions_; |
| 79 ZoneList<Handle<Object> > deoptimization_literals_; |
| 74 int last_lazy_deopt_pc_; | 80 int last_lazy_deopt_pc_; |
| 75 | 81 |
| 76 bool is_unused() const { return status_ == UNUSED; } | 82 bool is_unused() const { return status_ == UNUSED; } |
| 77 bool is_generating() const { return status_ == GENERATING; } | 83 bool is_generating() const { return status_ == GENERATING; } |
| 78 bool is_done() const { return status_ == DONE; } | 84 bool is_done() const { return status_ == DONE; } |
| 79 bool is_aborted() const { return status_ == ABORTED; } | 85 bool is_aborted() const { return status_ == ABORTED; } |
| 80 | 86 |
| 81 void Abort(BailoutReason reason); | 87 void Abort(BailoutReason reason); |
| 82 void Retry(BailoutReason reason); | 88 void Retry(BailoutReason reason); |
| 83 | 89 |
| 84 // Methods for code dependencies. | 90 // Methods for code dependencies. |
| 85 void AddDeprecationDependency(Handle<Map> map); | 91 void AddDeprecationDependency(Handle<Map> map); |
| 86 void AddStabilityDependency(Handle<Map> map); | 92 void AddStabilityDependency(Handle<Map> map); |
| 87 }; | 93 }; |
| 88 | 94 |
| 89 | 95 |
| 90 } } // namespace v8::internal | 96 } } // namespace v8::internal |
| 91 | 97 |
| 92 #endif // V8_LITHIUM_CODEGEN_H_ | 98 #endif // V8_LITHIUM_CODEGEN_H_ |
| OLD | NEW |