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

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: 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
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 2151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2850 __ ret(0); 2849 __ ret(0);
2851 } 2850 }
2852 2851
2853 2852
2854 #undef __ 2853 #undef __
2855 2854
2856 } // namespace internal 2855 } // namespace internal
2857 } // namespace v8 2856 } // namespace v8
2858 2857
2859 #endif // V8_TARGET_ARCH_X64 2858 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ppc/builtins-ppc.cc ('k') | src/x87/builtins-x87.cc » ('j') | test/mjsunit/mjsunit.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698