OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 NO_REGISTERS, | 76 NO_REGISTERS, |
77 TOS_REG | 77 TOS_REG |
78 }; | 78 }; |
79 | 79 |
80 FullCodeGenerator(MacroAssembler* masm, CompilationInfo* info) | 80 FullCodeGenerator(MacroAssembler* masm, CompilationInfo* info) |
81 : masm_(masm), | 81 : masm_(masm), |
82 info_(info), | 82 info_(info), |
83 scope_(info->scope()), | 83 scope_(info->scope()), |
84 nesting_stack_(NULL), | 84 nesting_stack_(NULL), |
85 loop_depth_(0), | 85 loop_depth_(0), |
86 globals_(10), | 86 globals_(NULL), |
87 context_(NULL), | 87 context_(NULL), |
88 bailout_entries_(info->HasDeoptimizationSupport() | 88 bailout_entries_(info->HasDeoptimizationSupport() |
89 ? info->function()->ast_node_count() : 0), | 89 ? info->function()->ast_node_count() : 0), |
90 stack_checks_(2), // There's always at least one. | 90 stack_checks_(2), // There's always at least one. |
91 type_feedback_cells_(info->HasDeoptimizationSupport() | 91 type_feedback_cells_(info->HasDeoptimizationSupport() |
92 ? info->function()->ast_node_count() : 0), | 92 ? info->function()->ast_node_count() : 0), |
93 ic_total_count_(0), | 93 ic_total_count_(0), |
94 has_self_optimization_header_(false) { } | 94 has_self_optimization_header_(false) { } |
95 | 95 |
96 static bool MakeCode(CompilationInfo* info); | 96 static bool MakeCode(CompilationInfo* info); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 // A nested block statement. | 201 // A nested block statement. |
202 class NestedBlock : public Breakable { | 202 class NestedBlock : public Breakable { |
203 public: | 203 public: |
204 NestedBlock(FullCodeGenerator* codegen, Block* block) | 204 NestedBlock(FullCodeGenerator* codegen, Block* block) |
205 : Breakable(codegen, block) { | 205 : Breakable(codegen, block) { |
206 } | 206 } |
207 virtual ~NestedBlock() {} | 207 virtual ~NestedBlock() {} |
208 | 208 |
209 virtual NestedStatement* Exit(int* stack_depth, int* context_length) { | 209 virtual NestedStatement* Exit(int* stack_depth, int* context_length) { |
210 if (statement()->AsBlock()->block_scope() != NULL) { | 210 if (statement()->AsBlock()->scope() != NULL) { |
211 ++(*context_length); | 211 ++(*context_length); |
212 } | 212 } |
213 return previous_; | 213 return previous_; |
214 }; | 214 }; |
215 }; | 215 }; |
216 | 216 |
217 // The try block of a try/catch statement. | 217 // The try block of a try/catch statement. |
218 class TryCatch : public NestedStatement { | 218 class TryCatch : public NestedStatement { |
219 public: | 219 public: |
220 explicit TryCatch(FullCodeGenerator* codegen) : NestedStatement(codegen) { | 220 explicit TryCatch(FullCodeGenerator* codegen) : NestedStatement(codegen) { |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 Label** fall_through) const; | 774 Label** fall_through) const; |
775 virtual bool IsEffect() const { return true; } | 775 virtual bool IsEffect() const { return true; } |
776 }; | 776 }; |
777 | 777 |
778 MacroAssembler* masm_; | 778 MacroAssembler* masm_; |
779 CompilationInfo* info_; | 779 CompilationInfo* info_; |
780 Scope* scope_; | 780 Scope* scope_; |
781 Label return_label_; | 781 Label return_label_; |
782 NestedStatement* nesting_stack_; | 782 NestedStatement* nesting_stack_; |
783 int loop_depth_; | 783 int loop_depth_; |
784 ZoneList<Handle<Object> > globals_; | 784 ZoneList<Handle<Object> >* globals_; |
785 const ExpressionContext* context_; | 785 const ExpressionContext* context_; |
786 ZoneList<BailoutEntry> bailout_entries_; | 786 ZoneList<BailoutEntry> bailout_entries_; |
787 ZoneList<BailoutEntry> stack_checks_; | 787 ZoneList<BailoutEntry> stack_checks_; |
788 ZoneList<TypeFeedbackCellEntry> type_feedback_cells_; | 788 ZoneList<TypeFeedbackCellEntry> type_feedback_cells_; |
789 int ic_total_count_; | 789 int ic_total_count_; |
790 bool has_self_optimization_header_; | 790 bool has_self_optimization_header_; |
791 Handle<FixedArray> handler_table_; | 791 Handle<FixedArray> handler_table_; |
792 Handle<JSGlobalPropertyCell> profiling_counter_; | 792 Handle<JSGlobalPropertyCell> profiling_counter_; |
793 | 793 |
794 friend class NestedStatement; | 794 friend class NestedStatement; |
795 | 795 |
796 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); | 796 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); |
797 }; | 797 }; |
798 | 798 |
799 | 799 |
800 } } // namespace v8::internal | 800 } } // namespace v8::internal |
801 | 801 |
802 #endif // V8_FULL_CODEGEN_H_ | 802 #endif // V8_FULL_CODEGEN_H_ |
OLD | NEW |