OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 25 matching lines...) Expand all Loading... |
36 namespace internal { | 36 namespace internal { |
37 | 37 |
38 | 38 |
39 class FastCodeGenerator: public AstVisitor { | 39 class FastCodeGenerator: public AstVisitor { |
40 public: | 40 public: |
41 FastCodeGenerator(MacroAssembler* masm, Handle<Script> script, bool is_eval) | 41 FastCodeGenerator(MacroAssembler* masm, Handle<Script> script, bool is_eval) |
42 : masm_(masm), | 42 : masm_(masm), |
43 function_(NULL), | 43 function_(NULL), |
44 script_(script), | 44 script_(script), |
45 is_eval_(is_eval), | 45 is_eval_(is_eval), |
| 46 function_return_(), |
| 47 return_label_(NULL), |
46 loop_depth_(0), | 48 loop_depth_(0), |
47 true_label_(NULL), | 49 true_label_(NULL), |
48 false_label_(NULL) { | 50 false_label_(NULL) { |
49 } | 51 } |
50 | 52 |
51 static Handle<Code> MakeCode(FunctionLiteral* fun, | 53 static Handle<Code> MakeCode(FunctionLiteral* fun, |
52 Handle<Script> script, | 54 Handle<Script> script, |
53 bool is_eval); | 55 bool is_eval); |
54 | 56 |
55 void Generate(FunctionLiteral* fun); | 57 void Generate(FunctionLiteral* fun); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 AST_NODE_LIST(DECLARE_VISIT) | 112 AST_NODE_LIST(DECLARE_VISIT) |
111 #undef DECLARE_VISIT | 113 #undef DECLARE_VISIT |
112 | 114 |
113 // Handles the shortcutted logical binary operations in VisitBinaryOperation. | 115 // Handles the shortcutted logical binary operations in VisitBinaryOperation. |
114 void EmitLogicalOperation(BinaryOperation* expr); | 116 void EmitLogicalOperation(BinaryOperation* expr); |
115 | 117 |
116 MacroAssembler* masm_; | 118 MacroAssembler* masm_; |
117 FunctionLiteral* function_; | 119 FunctionLiteral* function_; |
118 Handle<Script> script_; | 120 Handle<Script> script_; |
119 bool is_eval_; | 121 bool is_eval_; |
120 Label return_label_; | 122 Label function_return_;// Label of the actual return sequence. |
| 123 Label* return_label_; // Label to jump to from a return statement. |
| 124 // If there are finally blocks from try..finally that must be executed, |
| 125 // this is the entry point of a finally block, shadowing the real return. |
| 126 int return_stack_height_; // The height of the stack at return_label_. |
| 127 int scope_stack_height_; // The number of elements above the frame pointer |
| 128 // that are on the stack due to enclosing scopes. Does not include the |
| 129 // expression stack, but does include elements pushed by with and for..in. |
121 int loop_depth_; | 130 int loop_depth_; |
122 | 131 |
123 Label* true_label_; | 132 Label* true_label_; |
124 Label* false_label_; | 133 Label* false_label_; |
125 | 134 |
126 DISALLOW_COPY_AND_ASSIGN(FastCodeGenerator); | 135 DISALLOW_COPY_AND_ASSIGN(FastCodeGenerator); |
127 }; | 136 }; |
128 | 137 |
129 | 138 |
130 } } // namespace v8::internal | 139 } } // namespace v8::internal |
131 | 140 |
132 #endif // V8_FAST_CODEGEN_H_ | 141 #endif // V8_FAST_CODEGEN_H_ |
OLD | NEW |