OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_FULL_CODEGEN_FULL_CODEGEN_H_ | 5 #ifndef V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
6 #define V8_FULL_CODEGEN_FULL_CODEGEN_H_ | 6 #define V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
10 #include "src/ast/ast.h" | 10 #include "src/ast/ast.h" |
11 #include "src/ast/scopes.h" | 11 #include "src/ast/scopes.h" |
12 #include "src/bit-vector.h" | 12 #include "src/bit-vector.h" |
13 #include "src/code-factory.h" | 13 #include "src/code-factory.h" |
14 #include "src/code-stubs.h" | 14 #include "src/code-stubs.h" |
15 #include "src/codegen.h" | 15 #include "src/codegen.h" |
16 #include "src/deoptimizer.h" | 16 #include "src/deoptimizer.h" |
17 #include "src/globals.h" | 17 #include "src/globals.h" |
18 #include "src/objects.h" | 18 #include "src/objects.h" |
19 | 19 |
20 namespace v8 { | 20 namespace v8 { |
21 namespace internal { | 21 namespace internal { |
22 | 22 |
23 // Forward declarations. | 23 // Forward declarations. |
24 class CompilationInfo; | 24 class CompilationInfo; |
25 class CompilationJob; | 25 class CompilationJob; |
26 class JumpPatchSite; | 26 class JumpPatchSite; |
27 class Scope; | 27 class Scope; |
| 28 enum class LazyCompilationMode; |
28 | 29 |
29 // ----------------------------------------------------------------------------- | 30 // ----------------------------------------------------------------------------- |
30 // Full code generator. | 31 // Full code generator. |
31 | 32 |
32 class FullCodeGenerator final : public AstVisitor<FullCodeGenerator> { | 33 class FullCodeGenerator final : public AstVisitor<FullCodeGenerator> { |
33 public: | 34 public: |
34 FullCodeGenerator(MacroAssembler* masm, CompilationInfo* info, | 35 FullCodeGenerator(MacroAssembler* masm, CompilationInfo* info, |
35 uintptr_t stack_limit); | 36 uintptr_t stack_limit, LazyCompilationMode mode); |
36 | 37 |
37 void Initialize(uintptr_t stack_limit); | 38 void Initialize(uintptr_t stack_limit); |
38 | 39 |
39 static CompilationJob* NewCompilationJob(CompilationInfo* info); | 40 static CompilationJob* NewCompilationJob(CompilationInfo* info, |
| 41 LazyCompilationMode mode); |
40 | 42 |
41 static bool MakeCode(CompilationInfo* info, uintptr_t stack_limit); | 43 static bool MakeCode(CompilationInfo* info, uintptr_t stack_limit, |
| 44 LazyCompilationMode mode); |
42 static bool MakeCode(CompilationInfo* info); | 45 static bool MakeCode(CompilationInfo* info); |
43 | 46 |
44 // Encode bailout state and pc-offset as a BitField<type, start, size>. | 47 // Encode bailout state and pc-offset as a BitField<type, start, size>. |
45 // Only use 30 bits because we encode the result as a smi. | 48 // Only use 30 bits because we encode the result as a smi. |
46 class BailoutStateField : public BitField<Deoptimizer::BailoutState, 0, 1> {}; | 49 class BailoutStateField : public BitField<Deoptimizer::BailoutState, 0, 1> {}; |
47 class PcField : public BitField<unsigned, 1, 30 - 1> {}; | 50 class PcField : public BitField<unsigned, 1, 30 - 1> {}; |
48 | 51 |
49 static const int kMaxBackEdgeWeight = 127; | 52 static const int kMaxBackEdgeWeight = 127; |
50 | 53 |
51 // Platform-specific code size multiplier. | 54 // Platform-specific code size multiplier. |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 | 800 |
798 FullCodeGenerator* codegen_; | 801 FullCodeGenerator* codegen_; |
799 Scope* saved_scope_; | 802 Scope* saved_scope_; |
800 BailoutId exit_id_; | 803 BailoutId exit_id_; |
801 bool needs_block_context_; | 804 bool needs_block_context_; |
802 }; | 805 }; |
803 | 806 |
804 MacroAssembler* masm_; | 807 MacroAssembler* masm_; |
805 CompilationInfo* info_; | 808 CompilationInfo* info_; |
806 Isolate* isolate_; | 809 Isolate* isolate_; |
| 810 LazyCompilationMode compilation_mode_; |
807 Zone* zone_; | 811 Zone* zone_; |
808 Scope* scope_; | 812 Scope* scope_; |
809 Label return_label_; | 813 Label return_label_; |
810 NestedStatement* nesting_stack_; | 814 NestedStatement* nesting_stack_; |
811 int loop_depth_; | 815 int loop_depth_; |
812 int operand_stack_depth_; | 816 int operand_stack_depth_; |
813 ZoneList<Handle<Object> >* globals_; | 817 ZoneList<Handle<Object> >* globals_; |
814 const ExpressionContext* context_; | 818 const ExpressionContext* context_; |
815 ZoneList<BailoutEntry> bailout_entries_; | 819 ZoneList<BailoutEntry> bailout_entries_; |
816 ZoneList<BackEdgeEntry> back_edges_; | 820 ZoneList<BackEdgeEntry> back_edges_; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 Address start_; | 898 Address start_; |
895 Address instruction_start_; | 899 Address instruction_start_; |
896 uint32_t length_; | 900 uint32_t length_; |
897 }; | 901 }; |
898 | 902 |
899 | 903 |
900 } // namespace internal | 904 } // namespace internal |
901 } // namespace v8 | 905 } // namespace v8 |
902 | 906 |
903 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ | 907 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
OLD | NEW |