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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 // - Code aging of the BytecodeArray object. | 590 // - Code aging of the BytecodeArray object. |
591 | 591 |
592 // Load accumulator, register file, bytecode offset, dispatch table into | 592 // Load accumulator, register file, bytecode offset, dispatch table into |
593 // registers. | 593 // registers. |
594 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 594 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
595 __ mov(kInterpreterRegisterFileRegister, ebp); | 595 __ mov(kInterpreterRegisterFileRegister, ebp); |
596 __ add(kInterpreterRegisterFileRegister, | 596 __ add(kInterpreterRegisterFileRegister, |
597 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | 597 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); |
598 __ mov(kInterpreterBytecodeOffsetRegister, | 598 __ mov(kInterpreterBytecodeOffsetRegister, |
599 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 599 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
600 __ mov(ebx, Immediate(ExternalReference::interpreter_dispatch_table_address( | 600 __ mov(kInterpreterDispatchTableRegister, |
601 masm->isolate()))); | 601 Immediate(ExternalReference::interpreter_dispatch_table_address( |
602 | 602 masm->isolate()))); |
603 // Push dispatch table as a stack located parameter to the bytecode handler. | |
604 DCHECK_EQ(-1, kInterpreterDispatchTableSpillSlot); | |
605 __ push(ebx); | |
606 | 603 |
607 // Dispatch to the first bytecode handler for the function. | 604 // Dispatch to the first bytecode handler for the function. |
608 __ movzx_b(eax, Operand(kInterpreterBytecodeArrayRegister, | 605 __ movzx_b(ebx, Operand(kInterpreterBytecodeArrayRegister, |
609 kInterpreterBytecodeOffsetRegister, times_1, 0)); | 606 kInterpreterBytecodeOffsetRegister, times_1, 0)); |
610 __ mov(ebx, Operand(ebx, eax, times_pointer_size, 0)); | 607 __ mov(ebx, Operand(kInterpreterDispatchTableRegister, ebx, |
611 // Restore undefined_value in accumulator (eax) | 608 times_pointer_size, 0)); |
612 // TODO(rmcilroy): Remove this once we move the dispatch table back into a | |
613 // register. | |
614 __ mov(eax, Immediate(masm->isolate()->factory()->undefined_value())); | |
615 __ call(ebx); | 609 __ call(ebx); |
616 | 610 |
617 // Even though the first bytecode handler was called, we will never return. | 611 // Even though the first bytecode handler was called, we will never return. |
618 __ Abort(kUnexpectedReturnFromBytecodeHandler); | 612 __ Abort(kUnexpectedReturnFromBytecodeHandler); |
619 | 613 |
620 // Load debug copy of the bytecode array. | 614 // Load debug copy of the bytecode array. |
621 __ bind(&load_debug_bytecode_array); | 615 __ bind(&load_debug_bytecode_array); |
622 Register debug_info = kInterpreterBytecodeArrayRegister; | 616 Register debug_info = kInterpreterBytecodeArrayRegister; |
623 __ mov(debug_info, FieldOperand(eax, SharedFunctionInfo::kDebugInfoOffset)); | 617 __ mov(debug_info, FieldOperand(eax, SharedFunctionInfo::kDebugInfoOffset)); |
624 __ mov(kInterpreterBytecodeArrayRegister, | 618 __ mov(kInterpreterBytecodeArrayRegister, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 | 724 |
731 // Re-push return address. | 725 // Re-push return address. |
732 __ Push(ecx); | 726 __ Push(ecx); |
733 | 727 |
734 // Call the constructor with unmodified eax, edi, ebi values. | 728 // Call the constructor with unmodified eax, edi, ebi values. |
735 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 729 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
736 } | 730 } |
737 | 731 |
738 | 732 |
739 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { | 733 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { |
740 // Initialize register file register. | 734 // Initialize register file register and dispatch table register. |
741 __ mov(kInterpreterRegisterFileRegister, ebp); | 735 __ mov(kInterpreterRegisterFileRegister, ebp); |
742 __ add(kInterpreterRegisterFileRegister, | 736 __ add(kInterpreterRegisterFileRegister, |
743 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | 737 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); |
| 738 __ mov(kInterpreterDispatchTableRegister, |
| 739 Immediate(ExternalReference::interpreter_dispatch_table_address( |
| 740 masm->isolate()))); |
744 | 741 |
745 // Get the bytecode array pointer from the frame. | 742 // Get the bytecode array pointer from the frame. |
746 __ mov(kInterpreterBytecodeArrayRegister, | 743 __ mov(kInterpreterBytecodeArrayRegister, |
747 Operand(kInterpreterRegisterFileRegister, | 744 Operand(kInterpreterRegisterFileRegister, |
748 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer)); | 745 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer)); |
749 | 746 |
750 if (FLAG_debug_code) { | 747 if (FLAG_debug_code) { |
751 // Check function data field is actually a BytecodeArray object. | 748 // Check function data field is actually a BytecodeArray object. |
752 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); | 749 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); |
753 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, | 750 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, |
754 ebx); | 751 ebx); |
755 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 752 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
756 } | 753 } |
757 | 754 |
758 // Get the target bytecode offset from the frame. | 755 // Get the target bytecode offset from the frame. |
759 __ mov( | 756 __ mov( |
760 kInterpreterBytecodeOffsetRegister, | 757 kInterpreterBytecodeOffsetRegister, |
761 Operand(kInterpreterRegisterFileRegister, | 758 Operand(kInterpreterRegisterFileRegister, |
762 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer)); | 759 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer)); |
763 __ SmiUntag(kInterpreterBytecodeOffsetRegister); | 760 __ SmiUntag(kInterpreterBytecodeOffsetRegister); |
764 | 761 |
765 // Push dispatch table as a stack located parameter to the bytecode handler. | |
766 __ mov(ebx, Immediate(ExternalReference::interpreter_dispatch_table_address( | |
767 masm->isolate()))); | |
768 DCHECK_EQ(-1, kInterpreterDispatchTableSpillSlot); | |
769 __ Pop(esi); | |
770 __ Push(ebx); | |
771 __ Push(esi); | |
772 | |
773 // Dispatch to the target bytecode. | 762 // Dispatch to the target bytecode. |
774 __ movzx_b(esi, Operand(kInterpreterBytecodeArrayRegister, | 763 __ movzx_b(ebx, Operand(kInterpreterBytecodeArrayRegister, |
775 kInterpreterBytecodeOffsetRegister, times_1, 0)); | 764 kInterpreterBytecodeOffsetRegister, times_1, 0)); |
776 __ mov(ebx, Operand(ebx, esi, times_pointer_size, 0)); | 765 __ mov(ebx, Operand(kInterpreterDispatchTableRegister, ebx, |
777 | 766 times_pointer_size, 0)); |
778 // Get the context from the frame. | |
779 __ mov(kContextRegister, | |
780 Operand(kInterpreterRegisterFileRegister, | |
781 InterpreterFrameConstants::kContextFromRegisterPointer)); | |
782 __ jmp(ebx); | 767 __ jmp(ebx); |
783 } | 768 } |
784 | 769 |
785 | 770 |
786 static void Generate_InterpreterNotifyDeoptimizedHelper( | 771 static void Generate_InterpreterNotifyDeoptimizedHelper( |
787 MacroAssembler* masm, Deoptimizer::BailoutType type) { | 772 MacroAssembler* masm, Deoptimizer::BailoutType type) { |
788 // Enter an internal frame. | 773 // Enter an internal frame. |
789 { | 774 { |
790 FrameScope scope(masm, StackFrame::INTERNAL); | 775 FrameScope scope(masm, StackFrame::INTERNAL); |
791 | 776 |
(...skipping 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2715 // And "return" to the OSR entry point of the function. | 2700 // And "return" to the OSR entry point of the function. |
2716 __ ret(0); | 2701 __ ret(0); |
2717 } | 2702 } |
2718 | 2703 |
2719 | 2704 |
2720 #undef __ | 2705 #undef __ |
2721 } // namespace internal | 2706 } // namespace internal |
2722 } // namespace v8 | 2707 } // namespace v8 |
2723 | 2708 |
2724 #endif // V8_TARGET_ARCH_IA32 | 2709 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |