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

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

Issue 1469313002: [interpreter] Switch passing of new.target to register. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 } 572 }
573 573
574 574
575 // Generate code for entering a JS function with the interpreter. 575 // Generate code for entering a JS function with the interpreter.
576 // On entry to the function the receiver and arguments have been pushed on the 576 // On entry to the function the receiver and arguments have been pushed on the
577 // stack left to right. The actual argument count matches the formal parameter 577 // stack left to right. The actual argument count matches the formal parameter
578 // count expected by the function. 578 // count expected by the function.
579 // 579 //
580 // The live registers are: 580 // The live registers are:
581 // o rdi: the JS function object being called 581 // o rdi: the JS function object being called
582 // o rdx: the new target
582 // o rsi: our context 583 // o rsi: our context
583 // o rbp: the caller's frame pointer 584 // o rbp: the caller's frame pointer
584 // o rsp: stack pointer (pointing to return address) 585 // o rsp: stack pointer (pointing to return address)
585 // 586 //
586 // The function builds a JS frame. Please see JavaScriptFrameConstants in 587 // The function builds a JS frame. Please see JavaScriptFrameConstants in
587 // frames-x64.h for its layout. 588 // frames-x64.h for its layout.
588 // TODO(rmcilroy): We will need to include the current bytecode pointer in the 589 // TODO(rmcilroy): We will need to include the current bytecode pointer in the
589 // frame. 590 // frame.
590 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { 591 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
591 // Open a frame scope to indicate that there is a frame on the stack. The 592 // Open a frame scope to indicate that there is a frame on the stack. The
592 // MANUAL indicates that the scope shouldn't actually generate code to set up 593 // MANUAL indicates that the scope shouldn't actually generate code to set up
593 // the frame (that is done below). 594 // the frame (that is done below).
594 FrameScope frame_scope(masm, StackFrame::MANUAL); 595 FrameScope frame_scope(masm, StackFrame::MANUAL);
595 __ pushq(rbp); // Caller's frame pointer. 596 __ pushq(rbp); // Caller's frame pointer.
596 __ movp(rbp, rsp); 597 __ movp(rbp, rsp);
597 __ Push(rsi); // Callee's context. 598 __ Push(rsi); // Callee's context.
598 __ Push(rdi); // Callee's JS function. 599 __ Push(rdi); // Callee's JS function.
600 __ Push(rdx); // Callee's new target.
599 601
600 // Get the bytecode array from the function object and load the pointer to the 602 // Get the bytecode array from the function object and load the pointer to the
601 // first entry into edi (InterpreterBytecodeRegister). 603 // first entry into edi (InterpreterBytecodeRegister).
602 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); 604 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
603 __ movp(kInterpreterBytecodeArrayRegister, 605 __ movp(kInterpreterBytecodeArrayRegister,
604 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset)); 606 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset));
605 607
606 if (FLAG_debug_code) { 608 if (FLAG_debug_code) {
607 // Check function data field is actually a BytecodeArray object. 609 // Check function data field is actually a BytecodeArray object.
608 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); 610 __ AssertNotSmi(kInterpreterBytecodeArrayRegister);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 __ Push(kInterpreterBytecodeArrayRegister); 657 __ Push(kInterpreterBytecodeArrayRegister);
656 __ CallRuntime(Runtime::kStackGuard, 0); 658 __ CallRuntime(Runtime::kStackGuard, 0);
657 __ Pop(kInterpreterBytecodeArrayRegister); 659 __ Pop(kInterpreterBytecodeArrayRegister);
658 __ bind(&ok); 660 __ bind(&ok);
659 } 661 }
660 662
661 // Load accumulator, register file, bytecode offset, dispatch table into 663 // Load accumulator, register file, bytecode offset, dispatch table into
662 // registers. 664 // registers.
663 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); 665 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
664 __ movp(kInterpreterRegisterFileRegister, rbp); 666 __ movp(kInterpreterRegisterFileRegister, rbp);
665 __ subp( 667 __ subp(kInterpreterRegisterFileRegister,
666 kInterpreterRegisterFileRegister, 668 Immediate(2 * kPointerSize +
667 Immediate(kPointerSize + StandardFrameConstants::kFixedFrameSizeFromFp)); 669 StandardFrameConstants::kFixedFrameSizeFromFp));
668 __ movp(kInterpreterBytecodeOffsetRegister, 670 __ movp(kInterpreterBytecodeOffsetRegister,
669 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); 671 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag));
670 __ LoadRoot(kInterpreterDispatchTableRegister, 672 __ LoadRoot(kInterpreterDispatchTableRegister,
671 Heap::kInterpreterTableRootIndex); 673 Heap::kInterpreterTableRootIndex);
672 __ addp(kInterpreterDispatchTableRegister, 674 __ addp(kInterpreterDispatchTableRegister,
673 Immediate(FixedArray::kHeaderSize - kHeapObjectTag)); 675 Immediate(FixedArray::kHeaderSize - kHeapObjectTag));
674 676
675 // Dispatch to the first bytecode handler for the function. 677 // Dispatch to the first bytecode handler for the function.
676 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister, 678 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister,
677 kInterpreterBytecodeOffsetRegister, times_1, 0)); 679 kInterpreterBytecodeOffsetRegister, times_1, 0));
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 __ ret(0); 1919 __ ret(0);
1918 } 1920 }
1919 1921
1920 1922
1921 #undef __ 1923 #undef __
1922 1924
1923 } // namespace internal 1925 } // namespace internal
1924 } // namespace v8 1926 } // namespace v8
1925 1927
1926 #endif // V8_TARGET_ARCH_X64 1928 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698