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

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

Issue 1512543002: [Interpreter] Save bytecode offset in interpreter stack frames. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Minor tweak 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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 // Open a frame scope to indicate that there is a frame on the stack. The 586 // Open a frame scope to indicate that there is a frame on the stack. The
587 // MANUAL indicates that the scope shouldn't actually generate code to set up 587 // MANUAL indicates that the scope shouldn't actually generate code to set up
588 // the frame (that is done below). 588 // the frame (that is done below).
589 FrameScope frame_scope(masm, StackFrame::MANUAL); 589 FrameScope frame_scope(masm, StackFrame::MANUAL);
590 __ pushq(rbp); // Caller's frame pointer. 590 __ pushq(rbp); // Caller's frame pointer.
591 __ movp(rbp, rsp); 591 __ movp(rbp, rsp);
592 __ Push(rsi); // Callee's context. 592 __ Push(rsi); // Callee's context.
593 __ Push(rdi); // Callee's JS function. 593 __ Push(rdi); // Callee's JS function.
594 __ Push(rdx); // Callee's new target. 594 __ Push(rdx); // Callee's new target.
595 595
596 // Push zero for bytecode array offset.
597 __ movp(rax, Immediate(0));
598 __ Push(rax);
Michael Starzinger 2015/12/09 18:16:22 nit: Here "Push(Immediate(0))" should do the trick
rmcilroy 2015/12/10 14:17:12 Done.
599
596 // Get the bytecode array from the function object and load the pointer to the 600 // Get the bytecode array from the function object and load the pointer to the
597 // first entry into edi (InterpreterBytecodeRegister). 601 // first entry into edi (InterpreterBytecodeRegister).
598 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); 602 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
599 __ movp(kInterpreterBytecodeArrayRegister, 603 __ movp(kInterpreterBytecodeArrayRegister,
600 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset)); 604 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset));
601 605
602 if (FLAG_debug_code) { 606 if (FLAG_debug_code) {
603 // Check function data field is actually a BytecodeArray object. 607 // Check function data field is actually a BytecodeArray object.
604 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); 608 __ AssertNotSmi(kInterpreterBytecodeArrayRegister);
605 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, 609 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE,
(...skipping 10 matching lines...) Expand all
616 // Do a stack check to ensure we don't go over the limit. 620 // Do a stack check to ensure we don't go over the limit.
617 Label ok; 621 Label ok;
618 __ movp(rdx, rsp); 622 __ movp(rdx, rsp);
619 __ subp(rdx, rcx); 623 __ subp(rdx, rcx);
620 __ CompareRoot(rdx, Heap::kRealStackLimitRootIndex); 624 __ CompareRoot(rdx, Heap::kRealStackLimitRootIndex);
621 __ j(above_equal, &ok, Label::kNear); 625 __ j(above_equal, &ok, Label::kNear);
622 __ CallRuntime(Runtime::kThrowStackOverflow, 0); 626 __ CallRuntime(Runtime::kThrowStackOverflow, 0);
623 __ bind(&ok); 627 __ bind(&ok);
624 628
625 // If ok, push undefined as the initial value for all register file entries. 629 // If ok, push undefined as the initial value for all register file entries.
630 // (plus one for the accumulator save slot).
626 Label loop_header; 631 Label loop_header;
627 Label loop_check; 632 Label loop_check;
628 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); 633 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex);
629 __ j(always, &loop_check);
630 __ bind(&loop_header); 634 __ bind(&loop_header);
631 // TODO(rmcilroy): Consider doing more than one push per loop iteration. 635 // TODO(rmcilroy): Consider doing more than one push per loop iteration.
632 __ Push(rdx); 636 __ Push(rdx);
633 // Continue loop if not done. 637 // Continue loop if not done.
634 __ bind(&loop_check); 638 __ bind(&loop_check);
635 __ subp(rcx, Immediate(kPointerSize)); 639 __ subp(rcx, Immediate(kPointerSize));
636 __ j(greater_equal, &loop_header, Label::kNear); 640 __ j(greater_equal, &loop_header, Label::kNear);
637 } 641 }
638 642
639 // TODO(rmcilroy): List of things not currently dealt with here but done in 643 // TODO(rmcilroy): List of things not currently dealt with here but done in
(...skipping 11 matching lines...) Expand all
651 __ Push(kInterpreterBytecodeArrayRegister); 655 __ Push(kInterpreterBytecodeArrayRegister);
652 __ CallRuntime(Runtime::kStackGuard, 0); 656 __ CallRuntime(Runtime::kStackGuard, 0);
653 __ Pop(kInterpreterBytecodeArrayRegister); 657 __ Pop(kInterpreterBytecodeArrayRegister);
654 __ bind(&ok); 658 __ bind(&ok);
655 } 659 }
656 660
657 // Load accumulator, register file, bytecode offset, dispatch table into 661 // Load accumulator, register file, bytecode offset, dispatch table into
658 // registers. 662 // registers.
659 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); 663 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
660 __ movp(kInterpreterRegisterFileRegister, rbp); 664 __ movp(kInterpreterRegisterFileRegister, rbp);
661 __ subp(kInterpreterRegisterFileRegister, 665 __ addp(kInterpreterRegisterFileRegister,
662 Immediate(2 * kPointerSize + 666 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp));
663 StandardFrameConstants::kFixedFrameSizeFromFp));
664 __ movp(kInterpreterBytecodeOffsetRegister, 667 __ movp(kInterpreterBytecodeOffsetRegister,
665 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); 668 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag));
666 __ LoadRoot(kInterpreterDispatchTableRegister, 669 __ LoadRoot(kInterpreterDispatchTableRegister,
667 Heap::kInterpreterTableRootIndex); 670 Heap::kInterpreterTableRootIndex);
668 __ addp(kInterpreterDispatchTableRegister, 671 __ addp(kInterpreterDispatchTableRegister,
669 Immediate(FixedArray::kHeaderSize - kHeapObjectTag)); 672 Immediate(FixedArray::kHeaderSize - kHeapObjectTag));
670 673
671 // Dispatch to the first bytecode handler for the function. 674 // Dispatch to the first bytecode handler for the function.
672 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister, 675 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister,
673 kInterpreterBytecodeOffsetRegister, times_1, 0)); 676 kInterpreterBytecodeOffsetRegister, times_1, 0));
(...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 __ ret(0); 2054 __ ret(0);
2052 } 2055 }
2053 2056
2054 2057
2055 #undef __ 2058 #undef __
2056 2059
2057 } // namespace internal 2060 } // namespace internal
2058 } // namespace v8 2061 } // namespace v8
2059 2062
2060 #endif // V8_TARGET_ARCH_X64 2063 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/interpreter/interpreter.cc ('K') | « src/interpreter/interpreter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698