| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 11 matching lines...) Expand all Loading... |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_CODEGEN_IA32_H_ | 28 #ifndef V8_CODEGEN_IA32_H_ |
| 29 #define V8_CODEGEN_IA32_H_ | 29 #define V8_CODEGEN_IA32_H_ |
| 30 | 30 |
| 31 #include "scopes.h" | 31 #include "scopes.h" |
| 32 #include "register-allocator.h" |
| 32 | 33 |
| 33 namespace v8 { namespace internal { | 34 namespace v8 { namespace internal { |
| 34 | 35 |
| 35 // Forward declarations | 36 // Forward declarations |
| 36 class DeferredCode; | 37 class DeferredCode; |
| 37 | 38 |
| 38 // Mode to overwrite BinaryExpression values. | 39 // Mode to overwrite BinaryExpression values. |
| 39 enum OverwriteMode { NO_OVERWRITE, OVERWRITE_LEFT, OVERWRITE_RIGHT }; | 40 enum OverwriteMode { NO_OVERWRITE, OVERWRITE_LEFT, OVERWRITE_RIGHT }; |
| 40 | 41 |
| 41 enum InitState { CONST_INIT, NOT_CONST_INIT }; | 42 enum InitState { CONST_INIT, NOT_CONST_INIT }; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 int start_position, | 167 int start_position, |
| 167 int end_position, | 168 int end_position, |
| 168 bool is_expression, | 169 bool is_expression, |
| 169 bool is_toplevel, | 170 bool is_toplevel, |
| 170 Handle<Script> script); | 171 Handle<Script> script); |
| 171 | 172 |
| 172 // Accessors | 173 // Accessors |
| 173 MacroAssembler* masm() { return masm_; } | 174 MacroAssembler* masm() { return masm_; } |
| 174 | 175 |
| 175 VirtualFrame* frame() const { return frame_; } | 176 VirtualFrame* frame() const { return frame_; } |
| 176 | |
| 177 void set_frame(VirtualFrame* frame) { frame_ = frame; } | 177 void set_frame(VirtualFrame* frame) { frame_ = frame; } |
| 178 | |
| 179 void delete_frame() { | 178 void delete_frame() { |
| 180 delete frame_; | 179 delete frame_; |
| 181 frame_ = NULL; | 180 frame_ = NULL; |
| 182 } | 181 } |
| 183 | 182 |
| 183 RegisterAllocator* allocator() const { return allocator_; } |
| 184 |
| 184 CodeGenState* state() { return state_; } | 185 CodeGenState* state() { return state_; } |
| 185 void set_state(CodeGenState* state) { state_ = state; } | 186 void set_state(CodeGenState* state) { state_ = state; } |
| 186 | 187 |
| 187 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } | 188 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } |
| 188 | 189 |
| 189 private: | 190 private: |
| 190 // Construction/Destruction | 191 // Construction/Destruction |
| 191 CodeGenerator(int buffer_size, Handle<Script> script, bool is_eval); | 192 CodeGenerator(int buffer_size, Handle<Script> script, bool is_eval); |
| 192 virtual ~CodeGenerator() { delete masm_; } | 193 virtual ~CodeGenerator() { delete masm_; } |
| 193 | 194 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 bool is_eval_; // Tells whether code is generated for eval. | 383 bool is_eval_; // Tells whether code is generated for eval. |
| 383 Handle<Script> script_; | 384 Handle<Script> script_; |
| 384 List<DeferredCode*> deferred_; | 385 List<DeferredCode*> deferred_; |
| 385 | 386 |
| 386 // Assembler | 387 // Assembler |
| 387 MacroAssembler* masm_; // to generate code | 388 MacroAssembler* masm_; // to generate code |
| 388 | 389 |
| 389 // Code generation state | 390 // Code generation state |
| 390 Scope* scope_; | 391 Scope* scope_; |
| 391 VirtualFrame* frame_; | 392 VirtualFrame* frame_; |
| 393 RegisterAllocator* allocator_; |
| 392 Condition cc_reg_; | 394 Condition cc_reg_; |
| 393 CodeGenState* state_; | 395 CodeGenState* state_; |
| 394 bool is_inside_try_; | 396 bool is_inside_try_; |
| 395 int break_stack_height_; | 397 int break_stack_height_; |
| 396 int loop_nesting_; | 398 int loop_nesting_; |
| 397 | 399 |
| 398 // Jump targets. | 400 // Jump targets. |
| 399 // The target of the return from the function. | 401 // The target of the return from the function. |
| 400 JumpTarget function_return_; | 402 JumpTarget function_return_; |
| 401 | 403 |
| 402 // True if the function return is shadowed (ie, jumping to the target | 404 // True if the function return is shadowed (ie, jumping to the target |
| 403 // function_return_ does not jump to the true function return, but rather | 405 // function_return_ does not jump to the true function return, but rather |
| 404 // to some unlinking code). | 406 // to some unlinking code). |
| 405 bool function_return_is_shadowed_; | 407 bool function_return_is_shadowed_; |
| 406 | 408 |
| 407 friend class VirtualFrame; | 409 friend class VirtualFrame; |
| 408 friend class JumpTarget; | 410 friend class JumpTarget; |
| 409 friend class Reference; | 411 friend class Reference; |
| 410 | 412 |
| 411 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); | 413 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); |
| 412 }; | 414 }; |
| 413 | 415 |
| 414 | 416 |
| 415 } } // namespace v8::internal | 417 } } // namespace v8::internal |
| 416 | 418 |
| 417 #endif // V8_CODEGEN_IA32_H_ | 419 #endif // V8_CODEGEN_IA32_H_ |
| OLD | NEW |