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" |
(...skipping 19 matching lines...) Expand all Loading... |
30 class FullCodeGenerator: public AstVisitor { | 30 class FullCodeGenerator: public AstVisitor { |
31 public: | 31 public: |
32 FullCodeGenerator(MacroAssembler* masm, CompilationInfo* info) | 32 FullCodeGenerator(MacroAssembler* masm, CompilationInfo* info) |
33 : masm_(masm), | 33 : masm_(masm), |
34 info_(info), | 34 info_(info), |
35 isolate_(info->isolate()), | 35 isolate_(info->isolate()), |
36 zone_(info->zone()), | 36 zone_(info->zone()), |
37 scope_(info->scope()), | 37 scope_(info->scope()), |
38 nesting_stack_(NULL), | 38 nesting_stack_(NULL), |
39 loop_depth_(0), | 39 loop_depth_(0), |
40 try_catch_depth_(0), | |
41 operand_stack_depth_(0), | 40 operand_stack_depth_(0), |
42 globals_(NULL), | 41 globals_(NULL), |
43 context_(NULL), | 42 context_(NULL), |
44 bailout_entries_(info->HasDeoptimizationSupport() | 43 bailout_entries_(info->HasDeoptimizationSupport() |
45 ? info->literal()->ast_node_count() | 44 ? info->literal()->ast_node_count() |
46 : 0, | 45 : 0, |
47 info->zone()), | 46 info->zone()), |
48 back_edges_(2, info->zone()), | 47 back_edges_(2, info->zone()), |
49 handler_table_(info->zone()), | 48 handler_table_(info->zone()), |
50 source_position_table_builder_(info->isolate(), info->zone(), | 49 source_position_table_builder_(info->isolate(), info->zone(), |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 | 679 |
681 void SetConstructCallPosition(Expression* expr) { | 680 void SetConstructCallPosition(Expression* expr) { |
682 // Currently call and construct calls are treated the same wrt debugging. | 681 // Currently call and construct calls are treated the same wrt debugging. |
683 SetCallPosition(expr); | 682 SetCallPosition(expr); |
684 } | 683 } |
685 | 684 |
686 void RecordStatementPosition(int pos); | 685 void RecordStatementPosition(int pos); |
687 void RecordPosition(int pos); | 686 void RecordPosition(int pos); |
688 | 687 |
689 // Non-local control flow support. | 688 // Non-local control flow support. |
690 void EnterTryBlock(int handler_index, Label* handler); | 689 void EnterTryBlock(int handler_index, Label* handler, bool catch_predicted); |
691 void ExitTryBlock(int handler_index); | 690 void ExitTryBlock(int handler_index); |
692 void EnterFinallyBlock(); | 691 void EnterFinallyBlock(); |
693 void ExitFinallyBlock(); | 692 void ExitFinallyBlock(); |
694 void ClearPendingMessage(); | 693 void ClearPendingMessage(); |
695 | 694 |
696 void EmitContinue(Statement* target); | 695 void EmitContinue(Statement* target); |
697 void EmitBreak(Statement* target); | 696 void EmitBreak(Statement* target); |
698 | 697 |
699 // Loop nesting counter. | 698 // Loop nesting counter. |
700 int loop_depth() { return loop_depth_; } | 699 int loop_depth() { return loop_depth_; } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 BailoutId id; | 766 BailoutId id; |
768 unsigned pc; | 767 unsigned pc; |
769 uint32_t loop_depth; | 768 uint32_t loop_depth; |
770 }; | 769 }; |
771 | 770 |
772 struct HandlerTableEntry { | 771 struct HandlerTableEntry { |
773 unsigned range_start; | 772 unsigned range_start; |
774 unsigned range_end; | 773 unsigned range_end; |
775 unsigned handler_offset; | 774 unsigned handler_offset; |
776 int stack_depth; | 775 int stack_depth; |
777 int try_catch_depth; | 776 bool catch_predicted; |
778 }; | 777 }; |
779 | 778 |
780 class ExpressionContext BASE_EMBEDDED { | 779 class ExpressionContext BASE_EMBEDDED { |
781 public: | 780 public: |
782 explicit ExpressionContext(FullCodeGenerator* codegen) | 781 explicit ExpressionContext(FullCodeGenerator* codegen) |
783 : masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) { | 782 : masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) { |
784 codegen->set_new_context(this); | 783 codegen->set_new_context(this); |
785 } | 784 } |
786 | 785 |
787 virtual ~ExpressionContext() { | 786 virtual ~ExpressionContext() { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 }; | 961 }; |
963 | 962 |
964 MacroAssembler* masm_; | 963 MacroAssembler* masm_; |
965 CompilationInfo* info_; | 964 CompilationInfo* info_; |
966 Isolate* isolate_; | 965 Isolate* isolate_; |
967 Zone* zone_; | 966 Zone* zone_; |
968 Scope* scope_; | 967 Scope* scope_; |
969 Label return_label_; | 968 Label return_label_; |
970 NestedStatement* nesting_stack_; | 969 NestedStatement* nesting_stack_; |
971 int loop_depth_; | 970 int loop_depth_; |
972 int try_catch_depth_; | |
973 int operand_stack_depth_; | 971 int operand_stack_depth_; |
974 ZoneList<Handle<Object> >* globals_; | 972 ZoneList<Handle<Object> >* globals_; |
975 const ExpressionContext* context_; | 973 const ExpressionContext* context_; |
976 ZoneList<BailoutEntry> bailout_entries_; | 974 ZoneList<BailoutEntry> bailout_entries_; |
977 ZoneList<BackEdgeEntry> back_edges_; | 975 ZoneList<BackEdgeEntry> back_edges_; |
978 ZoneVector<HandlerTableEntry> handler_table_; | 976 ZoneVector<HandlerTableEntry> handler_table_; |
979 SourcePositionTableBuilder source_position_table_builder_; | 977 SourcePositionTableBuilder source_position_table_builder_; |
980 int ic_total_count_; | 978 int ic_total_count_; |
981 Handle<Cell> profiling_counter_; | 979 Handle<Cell> profiling_counter_; |
982 | 980 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 Address start_; | 1054 Address start_; |
1057 Address instruction_start_; | 1055 Address instruction_start_; |
1058 uint32_t length_; | 1056 uint32_t length_; |
1059 }; | 1057 }; |
1060 | 1058 |
1061 | 1059 |
1062 } // namespace internal | 1060 } // namespace internal |
1063 } // namespace v8 | 1061 } // namespace v8 |
1064 | 1062 |
1065 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ | 1063 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
OLD | NEW |