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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 // registers. | 673 // registers. |
674 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 674 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
675 __ mov(kInterpreterRegisterFileRegister, ebp); | 675 __ mov(kInterpreterRegisterFileRegister, ebp); |
676 __ sub( | 676 __ sub( |
677 kInterpreterRegisterFileRegister, | 677 kInterpreterRegisterFileRegister, |
678 Immediate(kPointerSize + StandardFrameConstants::kFixedFrameSizeFromFp)); | 678 Immediate(kPointerSize + StandardFrameConstants::kFixedFrameSizeFromFp)); |
679 __ mov(kInterpreterBytecodeOffsetRegister, | 679 __ mov(kInterpreterBytecodeOffsetRegister, |
680 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 680 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
681 // Since the dispatch table root might be set after builtins are generated, | 681 // Since the dispatch table root might be set after builtins are generated, |
682 // load directly from the roots table. | 682 // load directly from the roots table. |
683 __ LoadRoot(kInterpreterDispatchTableRegister, | 683 __ LoadRoot(ebx, Heap::kInterpreterTableRootIndex); |
684 Heap::kInterpreterTableRootIndex); | 684 __ add(ebx, Immediate(FixedArray::kHeaderSize - kHeapObjectTag)); |
685 __ add(kInterpreterDispatchTableRegister, | |
686 Immediate(FixedArray::kHeaderSize - kHeapObjectTag)); | |
687 | 685 |
688 // Push context as a stack located parameter to the bytecode handler. | 686 // Push context as a stack located parameter to the bytecode handler. |
689 DCHECK_EQ(-1, kInterpreterContextSpillSlot); | 687 DCHECK_EQ(-1, kInterpreterDispatchTableSpillSlot); |
690 __ push(esi); | 688 __ push(ebx); |
691 | 689 |
692 // Dispatch to the first bytecode handler for the function. | 690 // Dispatch to the first bytecode handler for the function. |
693 __ movzx_b(esi, Operand(kInterpreterBytecodeArrayRegister, | 691 __ movzx_b(eax, Operand(kInterpreterBytecodeArrayRegister, |
694 kInterpreterBytecodeOffsetRegister, times_1, 0)); | 692 kInterpreterBytecodeOffsetRegister, times_1, 0)); |
695 __ mov(esi, Operand(kInterpreterDispatchTableRegister, esi, | 693 __ mov(ebx, Operand(ebx, eax, times_pointer_size, 0)); |
696 times_pointer_size, 0)); | 694 // Restore undefined_value in accumulator (eax) |
| 695 // TODO(rmcilroy): Remove this once we move the dispatch table back into a |
| 696 // register. |
| 697 __ mov(eax, Immediate(masm->isolate()->factory()->undefined_value())); |
697 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging | 698 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging |
698 // and header removal. | 699 // and header removal. |
699 __ add(esi, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 700 __ add(ebx, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
700 __ call(esi); | 701 __ call(ebx); |
701 } | 702 } |
702 | 703 |
703 | 704 |
704 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { | 705 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { |
705 // TODO(rmcilroy): List of things not currently dealt with here but done in | 706 // TODO(rmcilroy): List of things not currently dealt with here but done in |
706 // fullcodegen's EmitReturnSequence. | 707 // fullcodegen's EmitReturnSequence. |
707 // - Supporting FLAG_trace for Runtime::TraceExit. | 708 // - Supporting FLAG_trace for Runtime::TraceExit. |
708 // - Support profiler (specifically decrementing profiling_counter | 709 // - Support profiler (specifically decrementing profiling_counter |
709 // appropriately and calling out to HandleInterrupts if necessary). | 710 // appropriately and calling out to HandleInterrupts if necessary). |
710 | 711 |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1857 | 1858 |
1858 __ bind(&ok); | 1859 __ bind(&ok); |
1859 __ ret(0); | 1860 __ ret(0); |
1860 } | 1861 } |
1861 | 1862 |
1862 #undef __ | 1863 #undef __ |
1863 } // namespace internal | 1864 } // namespace internal |
1864 } // namespace v8 | 1865 } // namespace v8 |
1865 | 1866 |
1866 #endif // V8_TARGET_ARCH_IA32 | 1867 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |