Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: src/x64/builtins-x64.cc

Issue 1699013002: [Interpreter] Push BytecodeArray onto interpreted stack frames. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Modify EnterBytecodeDispatch too Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ppc/builtins-ppc.cc ('k') | src/x87/builtins-x87.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_X64 5 #if V8_TARGET_ARCH_X64
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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 // Open a frame scope to indicate that there is a frame on the stack. The 613 // Open a frame scope to indicate that there is a frame on the stack. The
614 // MANUAL indicates that the scope shouldn't actually generate code to set up 614 // MANUAL indicates that the scope shouldn't actually generate code to set up
615 // the frame (that is done below). 615 // the frame (that is done below).
616 FrameScope frame_scope(masm, StackFrame::MANUAL); 616 FrameScope frame_scope(masm, StackFrame::MANUAL);
617 __ pushq(rbp); // Caller's frame pointer. 617 __ pushq(rbp); // Caller's frame pointer.
618 __ movp(rbp, rsp); 618 __ movp(rbp, rsp);
619 __ Push(rsi); // Callee's context. 619 __ Push(rsi); // Callee's context.
620 __ Push(rdi); // Callee's JS function. 620 __ Push(rdi); // Callee's JS function.
621 __ Push(rdx); // Callee's new target. 621 __ Push(rdx); // Callee's new target.
622 622
623 // Push dispatch table pointer.
624 __ Move(rax, ExternalReference::interpreter_dispatch_table_address(
625 masm->isolate()));
626 __ Push(rax);
627 // Push zero for bytecode array offset.
628 __ Push(Immediate(0));
629
630 // Get the bytecode array from the function object and load the pointer to the 623 // Get the bytecode array from the function object and load the pointer to the
631 // first entry into edi (InterpreterBytecodeRegister). 624 // first entry into edi (InterpreterBytecodeRegister).
632 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); 625 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
633 __ movp(kInterpreterBytecodeArrayRegister, 626 __ movp(kInterpreterBytecodeArrayRegister,
634 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset)); 627 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset));
635 628
636 if (FLAG_debug_code) { 629 if (FLAG_debug_code) {
637 // Check function data field is actually a BytecodeArray object. 630 // Check function data field is actually a BytecodeArray object.
638 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); 631 __ AssertNotSmi(kInterpreterBytecodeArrayRegister);
639 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, 632 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE,
640 rax); 633 rax);
641 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 634 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
642 } 635 }
643 636
637 // Push bytecode array.
638 __ Push(kInterpreterBytecodeArrayRegister);
639 // Push zero for bytecode array offset.
640 __ Push(Immediate(0));
641
644 // Allocate the local and temporary register file on the stack. 642 // Allocate the local and temporary register file on the stack.
645 { 643 {
646 // Load frame size from the BytecodeArray object. 644 // Load frame size from the BytecodeArray object.
647 __ movl(rcx, FieldOperand(kInterpreterBytecodeArrayRegister, 645 __ movl(rcx, FieldOperand(kInterpreterBytecodeArrayRegister,
648 BytecodeArray::kFrameSizeOffset)); 646 BytecodeArray::kFrameSizeOffset));
649 647
650 // Do a stack check to ensure we don't go over the limit. 648 // Do a stack check to ensure we don't go over the limit.
651 Label ok; 649 Label ok;
652 __ movp(rdx, rsp); 650 __ movp(rdx, rsp);
653 __ subp(rdx, rcx); 651 __ subp(rdx, rcx);
(...skipping 23 matching lines...) Expand all
677 // - Code aging of the BytecodeArray object. 675 // - Code aging of the BytecodeArray object.
678 676
679 // Load accumulator, register file, bytecode offset, dispatch table into 677 // Load accumulator, register file, bytecode offset, dispatch table into
680 // registers. 678 // registers.
681 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); 679 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
682 __ movp(kInterpreterRegisterFileRegister, rbp); 680 __ movp(kInterpreterRegisterFileRegister, rbp);
683 __ addp(kInterpreterRegisterFileRegister, 681 __ addp(kInterpreterRegisterFileRegister,
684 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); 682 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp));
685 __ movp(kInterpreterBytecodeOffsetRegister, 683 __ movp(kInterpreterBytecodeOffsetRegister,
686 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); 684 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag));
687 __ movp(kInterpreterDispatchTableRegister, 685 __ Move(
688 Operand(rbp, InterpreterFrameConstants::kDispatchTableFromFp)); 686 kInterpreterDispatchTableRegister,
687 ExternalReference::interpreter_dispatch_table_address(masm->isolate()));
689 688
690 // Dispatch to the first bytecode handler for the function. 689 // Dispatch to the first bytecode handler for the function.
691 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister, 690 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister,
692 kInterpreterBytecodeOffsetRegister, times_1, 0)); 691 kInterpreterBytecodeOffsetRegister, times_1, 0));
693 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx, 692 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx,
694 times_pointer_size, 0)); 693 times_pointer_size, 0));
695 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging 694 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging
696 // and header removal. 695 // and header removal.
697 __ addp(rbx, Immediate(Code::kHeaderSize - kHeapObjectTag)); 696 __ addp(rbx, Immediate(Code::kHeaderSize - kHeapObjectTag));
698 __ call(rbx); 697 __ call(rbx);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 __ Move( 811 __ Move(
813 kInterpreterDispatchTableRegister, 812 kInterpreterDispatchTableRegister,
814 ExternalReference::interpreter_dispatch_table_address(masm->isolate())); 813 ExternalReference::interpreter_dispatch_table_address(masm->isolate()));
815 814
816 // Get the context from the frame. 815 // Get the context from the frame.
817 __ movp(kContextRegister, 816 __ movp(kContextRegister,
818 Operand(kInterpreterRegisterFileRegister, 817 Operand(kInterpreterRegisterFileRegister,
819 InterpreterFrameConstants::kContextFromRegisterPointer)); 818 InterpreterFrameConstants::kContextFromRegisterPointer));
820 819
821 // Get the bytecode array pointer from the frame. 820 // Get the bytecode array pointer from the frame.
822 __ movp(rbx, 821 __ movp(
823 Operand(kInterpreterRegisterFileRegister, 822 kInterpreterBytecodeArrayRegister,
824 InterpreterFrameConstants::kFunctionFromRegisterPointer)); 823 Operand(kInterpreterRegisterFileRegister,
825 __ movp(rbx, FieldOperand(rbx, JSFunction::kSharedFunctionInfoOffset)); 824 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer));
826 __ movp(kInterpreterBytecodeArrayRegister,
827 FieldOperand(rbx, SharedFunctionInfo::kFunctionDataOffset));
828 825
829 if (FLAG_debug_code) { 826 if (FLAG_debug_code) {
830 // Check function data field is actually a BytecodeArray object. 827 // Check function data field is actually a BytecodeArray object.
831 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); 828 __ AssertNotSmi(kInterpreterBytecodeArrayRegister);
832 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, 829 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE,
833 rbx); 830 rbx);
834 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 831 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
835 } 832 }
836 833
837 // Get the target bytecode offset from the frame. 834 // Get the target bytecode offset from the frame.
(...skipping 2012 matching lines...) Expand 10 before | Expand all | Expand 10 after
2850 __ ret(0); 2847 __ ret(0);
2851 } 2848 }
2852 2849
2853 2850
2854 #undef __ 2851 #undef __
2855 2852
2856 } // namespace internal 2853 } // namespace internal
2857 } // namespace v8 2854 } // namespace v8
2858 2855
2859 #endif // V8_TARGET_ARCH_X64 2856 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ppc/builtins-ppc.cc ('k') | src/x87/builtins-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698