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_H_ | 5 #ifndef V8_FULL_CODEGEN_H_ |
6 #define V8_FULL_CODEGEN_H_ | 6 #define V8_FULL_CODEGEN_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 59 matching lines...) Loading... |
70 nesting_stack_(NULL), | 70 nesting_stack_(NULL), |
71 loop_depth_(0), | 71 loop_depth_(0), |
72 try_catch_depth_(0), | 72 try_catch_depth_(0), |
73 globals_(NULL), | 73 globals_(NULL), |
74 context_(NULL), | 74 context_(NULL), |
75 bailout_entries_(info->HasDeoptimizationSupport() | 75 bailout_entries_(info->HasDeoptimizationSupport() |
76 ? info->function()->ast_node_count() | 76 ? info->function()->ast_node_count() |
77 : 0, | 77 : 0, |
78 info->zone()), | 78 info->zone()), |
79 back_edges_(2, info->zone()), | 79 back_edges_(2, info->zone()), |
| 80 handler_table_(info->zone()), |
80 ic_total_count_(0) { | 81 ic_total_count_(0) { |
81 DCHECK(!info->IsStub()); | 82 DCHECK(!info->IsStub()); |
82 Initialize(); | 83 Initialize(); |
83 } | 84 } |
84 | 85 |
85 void Initialize(); | 86 void Initialize(); |
86 | 87 |
87 static bool MakeCode(CompilationInfo* info); | 88 static bool MakeCode(CompilationInfo* info); |
88 | 89 |
89 // Encode state and pc-offset as a BitField<type, start, size>. | 90 // Encode state and pc-offset as a BitField<type, start, size>. |
(...skipping 653 matching lines...) Loading... |
743 | 744 |
744 void VisitComma(BinaryOperation* expr); | 745 void VisitComma(BinaryOperation* expr); |
745 void VisitLogicalExpression(BinaryOperation* expr); | 746 void VisitLogicalExpression(BinaryOperation* expr); |
746 void VisitArithmeticExpression(BinaryOperation* expr); | 747 void VisitArithmeticExpression(BinaryOperation* expr); |
747 | 748 |
748 void VisitForTypeofValue(Expression* expr); | 749 void VisitForTypeofValue(Expression* expr); |
749 | 750 |
750 void Generate(); | 751 void Generate(); |
751 void PopulateDeoptimizationData(Handle<Code> code); | 752 void PopulateDeoptimizationData(Handle<Code> code); |
752 void PopulateTypeFeedbackInfo(Handle<Code> code); | 753 void PopulateTypeFeedbackInfo(Handle<Code> code); |
| 754 void PopulateHandlerTable(Handle<Code> code); |
753 | 755 |
754 bool MustCreateObjectLiteralWithRuntime(ObjectLiteral* expr) const; | 756 bool MustCreateObjectLiteralWithRuntime(ObjectLiteral* expr) const; |
755 bool MustCreateArrayLiteralWithRuntime(ArrayLiteral* expr) const; | 757 bool MustCreateArrayLiteralWithRuntime(ArrayLiteral* expr) const; |
756 | 758 |
757 void EmitLoadStoreICSlot(FeedbackVectorICSlot slot); | 759 void EmitLoadStoreICSlot(FeedbackVectorICSlot slot); |
758 | 760 |
759 Handle<HandlerTable> handler_table() { return handler_table_; } | 761 int NewHandlerTableEntry(); |
760 | 762 |
761 struct BailoutEntry { | 763 struct BailoutEntry { |
762 BailoutId id; | 764 BailoutId id; |
763 unsigned pc_and_state; | 765 unsigned pc_and_state; |
764 }; | 766 }; |
765 | 767 |
766 struct BackEdgeEntry { | 768 struct BackEdgeEntry { |
767 BailoutId id; | 769 BailoutId id; |
768 unsigned pc; | 770 unsigned pc; |
769 uint32_t loop_depth; | 771 uint32_t loop_depth; |
770 }; | 772 }; |
771 | 773 |
| 774 struct HandlerTableEntry { |
| 775 unsigned range_start; |
| 776 unsigned range_end; |
| 777 unsigned pc_offset; |
| 778 int stack_depth; |
| 779 int try_catch_depth; |
| 780 }; |
| 781 |
772 class ExpressionContext BASE_EMBEDDED { | 782 class ExpressionContext BASE_EMBEDDED { |
773 public: | 783 public: |
774 explicit ExpressionContext(FullCodeGenerator* codegen) | 784 explicit ExpressionContext(FullCodeGenerator* codegen) |
775 : masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) { | 785 : masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) { |
776 codegen->set_new_context(this); | 786 codegen->set_new_context(this); |
777 } | 787 } |
778 | 788 |
779 virtual ~ExpressionContext() { | 789 virtual ~ExpressionContext() { |
780 codegen_->set_new_context(old_); | 790 codegen_->set_new_context(old_); |
781 } | 791 } |
(...skipping 185 matching lines...) Loading... |
967 Label return_label_; | 977 Label return_label_; |
968 NestedStatement* nesting_stack_; | 978 NestedStatement* nesting_stack_; |
969 int loop_depth_; | 979 int loop_depth_; |
970 int try_catch_depth_; | 980 int try_catch_depth_; |
971 ZoneList<Handle<Object> >* globals_; | 981 ZoneList<Handle<Object> >* globals_; |
972 Handle<FixedArray> modules_; | 982 Handle<FixedArray> modules_; |
973 int module_index_; | 983 int module_index_; |
974 const ExpressionContext* context_; | 984 const ExpressionContext* context_; |
975 ZoneList<BailoutEntry> bailout_entries_; | 985 ZoneList<BailoutEntry> bailout_entries_; |
976 ZoneList<BackEdgeEntry> back_edges_; | 986 ZoneList<BackEdgeEntry> back_edges_; |
| 987 ZoneVector<HandlerTableEntry> handler_table_; |
977 int ic_total_count_; | 988 int ic_total_count_; |
978 Handle<HandlerTable> handler_table_; | |
979 Handle<Cell> profiling_counter_; | 989 Handle<Cell> profiling_counter_; |
980 bool generate_debug_code_; | 990 bool generate_debug_code_; |
981 | 991 |
982 friend class NestedStatement; | 992 friend class NestedStatement; |
983 | 993 |
984 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 994 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
985 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); | 995 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); |
986 }; | 996 }; |
987 | 997 |
988 | 998 |
(...skipping 98 matching lines...) Loading... |
1087 | 1097 |
1088 Address start_; | 1098 Address start_; |
1089 Address instruction_start_; | 1099 Address instruction_start_; |
1090 uint32_t length_; | 1100 uint32_t length_; |
1091 }; | 1101 }; |
1092 | 1102 |
1093 | 1103 |
1094 } } // namespace v8::internal | 1104 } } // namespace v8::internal |
1095 | 1105 |
1096 #endif // V8_FULL_CODEGEN_H_ | 1106 #endif // V8_FULL_CODEGEN_H_ |
OLD | NEW |