| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // Open a frame scope to indicate that there is a frame on the stack. The | 154 // Open a frame scope to indicate that there is a frame on the stack. The |
| 155 // MANUAL indicates that the scope shouldn't actually generate code to set up | 155 // MANUAL indicates that the scope shouldn't actually generate code to set up |
| 156 // the frame (that is done below). | 156 // the frame (that is done below). |
| 157 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 157 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
| 158 | 158 |
| 159 info->set_prologue_offset(masm_->pc_offset()); | 159 info->set_prologue_offset(masm_->pc_offset()); |
| 160 __ push(ebp); // Caller's frame pointer. | 160 __ push(ebp); // Caller's frame pointer. |
| 161 __ mov(ebp, esp); | 161 __ mov(ebp, esp); |
| 162 __ push(esi); // Callee's context. | 162 __ push(esi); // Callee's context. |
| 163 __ push(edi); // Callee's JS Function. | 163 __ push(edi); // Callee's JS Function. |
| 164 info->AddNoFrameRange(0, masm_->pc_offset()); |
| 164 | 165 |
| 165 { Comment cmnt(masm_, "[ Allocate locals"); | 166 { Comment cmnt(masm_, "[ Allocate locals"); |
| 166 int locals_count = info->scope()->num_stack_slots(); | 167 int locals_count = info->scope()->num_stack_slots(); |
| 167 // Generators allocate locals, if any, in context slots. | 168 // Generators allocate locals, if any, in context slots. |
| 168 ASSERT(!info->function()->is_generator() || locals_count == 0); | 169 ASSERT(!info->function()->is_generator() || locals_count == 0); |
| 169 if (locals_count == 1) { | 170 if (locals_count == 1) { |
| 170 __ push(Immediate(isolate()->factory()->undefined_value())); | 171 __ push(Immediate(isolate()->factory()->undefined_value())); |
| 171 } else if (locals_count > 1) { | 172 } else if (locals_count > 1) { |
| 172 __ mov(eax, Immediate(isolate()->factory()->undefined_value())); | 173 __ mov(eax, Immediate(isolate()->factory()->undefined_value())); |
| 173 for (int i = 0; i < locals_count; i++) { | 174 for (int i = 0; i < locals_count; i++) { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 #ifdef DEBUG | 404 #ifdef DEBUG |
| 404 // Add a label for checking the size of the code used for returning. | 405 // Add a label for checking the size of the code used for returning. |
| 405 Label check_exit_codesize; | 406 Label check_exit_codesize; |
| 406 masm_->bind(&check_exit_codesize); | 407 masm_->bind(&check_exit_codesize); |
| 407 #endif | 408 #endif |
| 408 SetSourcePosition(function()->end_position() - 1); | 409 SetSourcePosition(function()->end_position() - 1); |
| 409 __ RecordJSReturn(); | 410 __ RecordJSReturn(); |
| 410 // Do not use the leave instruction here because it is too short to | 411 // Do not use the leave instruction here because it is too short to |
| 411 // patch with the code required by the debugger. | 412 // patch with the code required by the debugger. |
| 412 __ mov(esp, ebp); | 413 __ mov(esp, ebp); |
| 414 int no_frame_start = masm_->pc_offset(); |
| 413 __ pop(ebp); | 415 __ pop(ebp); |
| 414 | 416 |
| 415 int arguments_bytes = (info_->scope()->num_parameters() + 1) * kPointerSize; | 417 int arguments_bytes = (info_->scope()->num_parameters() + 1) * kPointerSize; |
| 416 __ Ret(arguments_bytes, ecx); | 418 __ Ret(arguments_bytes, ecx); |
| 417 #ifdef ENABLE_DEBUGGER_SUPPORT | 419 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 418 // Check that the size of the code used for returning is large enough | 420 // Check that the size of the code used for returning is large enough |
| 419 // for the debugger's requirements. | 421 // for the debugger's requirements. |
| 420 ASSERT(Assembler::kJSReturnSequenceLength <= | 422 ASSERT(Assembler::kJSReturnSequenceLength <= |
| 421 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); | 423 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); |
| 422 #endif | 424 #endif |
| 425 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
| 423 } | 426 } |
| 424 } | 427 } |
| 425 | 428 |
| 426 | 429 |
| 427 void FullCodeGenerator::EffectContext::Plug(Variable* var) const { | 430 void FullCodeGenerator::EffectContext::Plug(Variable* var) const { |
| 428 ASSERT(var->IsStackAllocated() || var->IsContextSlot()); | 431 ASSERT(var->IsStackAllocated() || var->IsContextSlot()); |
| 429 } | 432 } |
| 430 | 433 |
| 431 | 434 |
| 432 void FullCodeGenerator::AccumulatorValueContext::Plug(Variable* var) const { | 435 void FullCodeGenerator::AccumulatorValueContext::Plug(Variable* var) const { |
| (...skipping 4386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4819 *stack_depth = 0; | 4822 *stack_depth = 0; |
| 4820 *context_length = 0; | 4823 *context_length = 0; |
| 4821 return previous_; | 4824 return previous_; |
| 4822 } | 4825 } |
| 4823 | 4826 |
| 4824 #undef __ | 4827 #undef __ |
| 4825 | 4828 |
| 4826 } } // namespace v8::internal | 4829 } } // namespace v8::internal |
| 4827 | 4830 |
| 4828 #endif // V8_TARGET_ARCH_IA32 | 4831 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |