| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 allocator_(NULL), | 83 allocator_(NULL), |
| 84 cc_reg_(no_condition), | 84 cc_reg_(no_condition), |
| 85 state_(NULL), | 85 state_(NULL), |
| 86 break_stack_height_(0), | 86 break_stack_height_(0), |
| 87 loop_nesting_(0), | 87 loop_nesting_(0), |
| 88 function_return_is_shadowed_(false), | 88 function_return_is_shadowed_(false), |
| 89 in_spilled_code_(false) { | 89 in_spilled_code_(false) { |
| 90 } | 90 } |
| 91 | 91 |
| 92 | 92 |
| 93 void CodeGenerator::SetFrame(VirtualFrame* new_frame) { | 93 void CodeGenerator::SetFrame(VirtualFrame* new_frame, |
| 94 RegisterFile* non_frame_registers) { |
| 95 RegisterFile saved_counts; |
| 94 if (has_valid_frame()) { | 96 if (has_valid_frame()) { |
| 95 frame_->DetachFromCodeGenerator(); | 97 frame_->DetachFromCodeGenerator(); |
| 98 // The remaining register reference counts are the non-frame ones. |
| 99 allocator_->SaveTo(&saved_counts); |
| 96 } | 100 } |
| 101 |
| 97 if (new_frame != NULL) { | 102 if (new_frame != NULL) { |
| 103 // Restore the non-frame register references that go with the new frame. |
| 104 allocator_->RestoreFrom(non_frame_registers); |
| 98 new_frame->AttachToCodeGenerator(); | 105 new_frame->AttachToCodeGenerator(); |
| 99 } | 106 } |
| 107 |
| 100 frame_ = new_frame; | 108 frame_ = new_frame; |
| 109 saved_counts.CopyTo(non_frame_registers); |
| 101 } | 110 } |
| 102 | 111 |
| 103 | 112 |
| 104 void CodeGenerator::DeleteFrame() { | 113 void CodeGenerator::DeleteFrame() { |
| 105 if (has_valid_frame()) { | 114 if (has_valid_frame()) { |
| 106 frame_->DetachFromCodeGenerator(); | 115 frame_->DetachFromCodeGenerator(); |
| 107 delete frame_; | 116 delete frame_; |
| 108 frame_ = NULL; | 117 frame_ = NULL; |
| 109 } | 118 } |
| 110 } | 119 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 122 | 131 |
| 123 ZoneList<Statement*>* body = fun->body(); | 132 ZoneList<Statement*>* body = fun->body(); |
| 124 | 133 |
| 125 // Initialize state. | 134 // Initialize state. |
| 126 ASSERT(scope_ == NULL); | 135 ASSERT(scope_ == NULL); |
| 127 scope_ = fun->scope(); | 136 scope_ = fun->scope(); |
| 128 ASSERT(allocator_ == NULL); | 137 ASSERT(allocator_ == NULL); |
| 129 RegisterAllocator register_allocator(this); | 138 RegisterAllocator register_allocator(this); |
| 130 allocator_ = ®ister_allocator; | 139 allocator_ = ®ister_allocator; |
| 131 ASSERT(frame_ == NULL); | 140 ASSERT(frame_ == NULL); |
| 132 SetFrame(new VirtualFrame(this)); | 141 frame_ = new VirtualFrame(this); |
| 133 cc_reg_ = no_condition; | 142 cc_reg_ = no_condition; |
| 134 function_return_.set_code_generator(this); | 143 function_return_.set_code_generator(this); |
| 135 function_return_is_shadowed_ = false; | 144 function_return_is_shadowed_ = false; |
| 136 set_in_spilled_code(false); | 145 set_in_spilled_code(false); |
| 137 | 146 |
| 138 // Adjust for function-level loop nesting. | 147 // Adjust for function-level loop nesting. |
| 139 loop_nesting_ += fun->loop_nesting(); | 148 loop_nesting_ += fun->loop_nesting(); |
| 140 | 149 |
| 141 { | 150 { |
| 142 CodeGenState state(this); | 151 CodeGenState state(this); |
| (...skipping 5849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5992 | 6001 |
| 5993 // Slow-case: Go through the JavaScript implementation. | 6002 // Slow-case: Go through the JavaScript implementation. |
| 5994 __ bind(&slow); | 6003 __ bind(&slow); |
| 5995 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 6004 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 5996 } | 6005 } |
| 5997 | 6006 |
| 5998 | 6007 |
| 5999 #undef __ | 6008 #undef __ |
| 6000 | 6009 |
| 6001 } } // namespace v8::internal | 6010 } } // namespace v8::internal |
| OLD | NEW |