| 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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 // Open a frame scope to indicate that there is a frame on the stack. The | 539 // Open a frame scope to indicate that there is a frame on the stack. The |
| 540 // MANUAL indicates that the scope shouldn't actually generate code to set up | 540 // MANUAL indicates that the scope shouldn't actually generate code to set up |
| 541 // the frame (that is done below). | 541 // the frame (that is done below). |
| 542 FrameScope frame_scope(masm, StackFrame::MANUAL); | 542 FrameScope frame_scope(masm, StackFrame::MANUAL); |
| 543 __ push(ebp); // Caller's frame pointer. | 543 __ push(ebp); // Caller's frame pointer. |
| 544 __ mov(ebp, esp); | 544 __ mov(ebp, esp); |
| 545 __ push(esi); // Callee's context. | 545 __ push(esi); // Callee's context. |
| 546 __ push(edi); // Callee's JS function. | 546 __ push(edi); // Callee's JS function. |
| 547 __ push(edx); // Callee's new target. | 547 __ push(edx); // Callee's new target. |
| 548 | 548 |
| 549 // Push dispatch table pointer. | |
| 550 __ mov(eax, Immediate(ExternalReference::interpreter_dispatch_table_address( | |
| 551 masm->isolate()))); | |
| 552 __ push(eax); | |
| 553 // Push zero for bytecode array offset. | |
| 554 __ push(Immediate(0)); | |
| 555 | |
| 556 // Get the bytecode array from the function object and load the pointer to the | 549 // Get the bytecode array from the function object and load the pointer to the |
| 557 // first entry into edi (InterpreterBytecodeRegister). | 550 // first entry into edi (InterpreterBytecodeRegister). |
| 558 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 551 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 559 __ mov(kInterpreterBytecodeArrayRegister, | 552 __ mov(kInterpreterBytecodeArrayRegister, |
| 560 FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset)); | 553 FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset)); |
| 561 | 554 |
| 562 if (FLAG_debug_code) { | 555 if (FLAG_debug_code) { |
| 563 // Check function data field is actually a BytecodeArray object. | 556 // Check function data field is actually a BytecodeArray object. |
| 564 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); | 557 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); |
| 565 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, | 558 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, |
| 566 eax); | 559 eax); |
| 567 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 560 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
| 568 } | 561 } |
| 569 | 562 |
| 563 // Push bytecode array. |
| 564 __ push(kInterpreterBytecodeArrayRegister); |
| 565 // Push zero for bytecode array offset. |
| 566 __ push(Immediate(0)); |
| 567 |
| 570 // Allocate the local and temporary register file on the stack. | 568 // Allocate the local and temporary register file on the stack. |
| 571 { | 569 { |
| 572 // Load frame size from the BytecodeArray object. | 570 // Load frame size from the BytecodeArray object. |
| 573 __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister, | 571 __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister, |
| 574 BytecodeArray::kFrameSizeOffset)); | 572 BytecodeArray::kFrameSizeOffset)); |
| 575 | 573 |
| 576 // Do a stack check to ensure we don't go over the limit. | 574 // Do a stack check to ensure we don't go over the limit. |
| 577 Label ok; | 575 Label ok; |
| 578 __ mov(ecx, esp); | 576 __ mov(ecx, esp); |
| 579 __ sub(ecx, ebx); | 577 __ sub(ecx, ebx); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 605 // - Code aging of the BytecodeArray object. | 603 // - Code aging of the BytecodeArray object. |
| 606 | 604 |
| 607 // Load accumulator, register file, bytecode offset, dispatch table into | 605 // Load accumulator, register file, bytecode offset, dispatch table into |
| 608 // registers. | 606 // registers. |
| 609 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 607 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
| 610 __ mov(kInterpreterRegisterFileRegister, ebp); | 608 __ mov(kInterpreterRegisterFileRegister, ebp); |
| 611 __ add(kInterpreterRegisterFileRegister, | 609 __ add(kInterpreterRegisterFileRegister, |
| 612 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | 610 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); |
| 613 __ mov(kInterpreterBytecodeOffsetRegister, | 611 __ mov(kInterpreterBytecodeOffsetRegister, |
| 614 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 612 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
| 615 __ mov(ebx, Operand(ebp, InterpreterFrameConstants::kDispatchTableFromFp)); | 613 __ mov(ebx, Immediate(ExternalReference::interpreter_dispatch_table_address( |
| 614 masm->isolate()))); |
| 616 | 615 |
| 617 // Push dispatch table as a stack located parameter to the bytecode handler. | 616 // Push dispatch table as a stack located parameter to the bytecode handler. |
| 618 DCHECK_EQ(-1, kInterpreterDispatchTableSpillSlot); | 617 DCHECK_EQ(-1, kInterpreterDispatchTableSpillSlot); |
| 619 __ push(ebx); | 618 __ push(ebx); |
| 620 | 619 |
| 621 // Dispatch to the first bytecode handler for the function. | 620 // Dispatch to the first bytecode handler for the function. |
| 622 __ movzx_b(eax, Operand(kInterpreterBytecodeArrayRegister, | 621 __ movzx_b(eax, Operand(kInterpreterBytecodeArrayRegister, |
| 623 kInterpreterBytecodeOffsetRegister, times_1, 0)); | 622 kInterpreterBytecodeOffsetRegister, times_1, 0)); |
| 624 __ mov(ebx, Operand(ebx, eax, times_pointer_size, 0)); | 623 __ mov(ebx, Operand(ebx, eax, times_pointer_size, 0)); |
| 625 // Restore undefined_value in accumulator (eax) | 624 // Restore undefined_value in accumulator (eax) |
| (...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2772 | 2771 |
| 2773 __ bind(&ok); | 2772 __ bind(&ok); |
| 2774 __ ret(0); | 2773 __ ret(0); |
| 2775 } | 2774 } |
| 2776 | 2775 |
| 2777 #undef __ | 2776 #undef __ |
| 2778 } // namespace internal | 2777 } // namespace internal |
| 2779 } // namespace v8 | 2778 } // namespace v8 |
| 2780 | 2779 |
| 2781 #endif // V8_TARGET_ARCH_IA32 | 2780 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |