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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 } | 744 } |
746 | 745 |
747 | 746 |
748 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { | 747 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { |
749 // Initialize register file register. | 748 // Initialize register file register. |
750 __ mov(kInterpreterRegisterFileRegister, ebp); | 749 __ mov(kInterpreterRegisterFileRegister, ebp); |
751 __ add(kInterpreterRegisterFileRegister, | 750 __ add(kInterpreterRegisterFileRegister, |
752 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | 751 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); |
753 | 752 |
754 // Get the bytecode array pointer from the frame. | 753 // Get the bytecode array pointer from the frame. |
755 __ mov(ebx, Operand(kInterpreterRegisterFileRegister, | |
756 InterpreterFrameConstants::kFunctionFromRegisterPointer)); | |
757 __ mov(ebx, FieldOperand(ebx, JSFunction::kSharedFunctionInfoOffset)); | |
758 __ mov(kInterpreterBytecodeArrayRegister, | 754 __ mov(kInterpreterBytecodeArrayRegister, |
759 FieldOperand(ebx, SharedFunctionInfo::kFunctionDataOffset)); | 755 Operand(kInterpreterRegisterFileRegister, |
| 756 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer)); |
760 | 757 |
761 if (FLAG_debug_code) { | 758 if (FLAG_debug_code) { |
762 // Check function data field is actually a BytecodeArray object. | 759 // Check function data field is actually a BytecodeArray object. |
763 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); | 760 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); |
764 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, | 761 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, |
765 ebx); | 762 ebx); |
766 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 763 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
767 } | 764 } |
768 | 765 |
769 // Get the target bytecode offset from the frame. | 766 // Get the target bytecode offset from the frame. |
(...skipping 2002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2772 | 2769 |
2773 __ bind(&ok); | 2770 __ bind(&ok); |
2774 __ ret(0); | 2771 __ ret(0); |
2775 } | 2772 } |
2776 | 2773 |
2777 #undef __ | 2774 #undef __ |
2778 } // namespace internal | 2775 } // namespace internal |
2779 } // namespace v8 | 2776 } // namespace v8 |
2780 | 2777 |
2781 #endif // V8_TARGET_ARCH_IA32 | 2778 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |