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

Side by Side Diff: src/x87/builtins-x87.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/x64/builtins-x64.cc ('k') | test/mjsunit/mjsunit.status » ('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_X87 5 #if V8_TARGET_ARCH_X87
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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 // Open a frame scope to indicate that there is a frame on the stack. The 541 // Open a frame scope to indicate that there is a frame on the stack. The
542 // MANUAL indicates that the scope shouldn't actually generate code to set up 542 // MANUAL indicates that the scope shouldn't actually generate code to set up
543 // the frame (that is done below). 543 // the frame (that is done below).
544 FrameScope frame_scope(masm, StackFrame::MANUAL); 544 FrameScope frame_scope(masm, StackFrame::MANUAL);
545 __ push(ebp); // Caller's frame pointer. 545 __ push(ebp); // Caller's frame pointer.
546 __ mov(ebp, esp); 546 __ mov(ebp, esp);
547 __ push(esi); // Callee's context. 547 __ push(esi); // Callee's context.
548 __ push(edi); // Callee's JS function. 548 __ push(edi); // Callee's JS function.
549 __ push(edx); // Callee's new target. 549 __ push(edx); // Callee's new target.
550 550
551 // Push dispatch table pointer.
552 __ mov(eax, Immediate(ExternalReference::interpreter_dispatch_table_address(
553 masm->isolate())));
554 __ push(eax);
555 // Push zero for bytecode array offset.
556 __ push(Immediate(0));
557
558 // Get the bytecode array from the function object and load the pointer to the 551 // Get the bytecode array from the function object and load the pointer to the
559 // first entry into edi (InterpreterBytecodeRegister). 552 // first entry into edi (InterpreterBytecodeRegister).
560 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 553 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
561 __ mov(kInterpreterBytecodeArrayRegister, 554 __ mov(kInterpreterBytecodeArrayRegister,
562 FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset)); 555 FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset));
563 556
564 if (FLAG_debug_code) { 557 if (FLAG_debug_code) {
565 // Check function data field is actually a BytecodeArray object. 558 // Check function data field is actually a BytecodeArray object.
566 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); 559 __ AssertNotSmi(kInterpreterBytecodeArrayRegister);
567 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, 560 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE,
568 eax); 561 eax);
569 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 562 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
570 } 563 }
571 564
565 // Push bytecode array.
566 __ push(kInterpreterBytecodeArrayRegister);
567 // Push zero for bytecode array offset.
568 __ push(Immediate(0));
569
572 // Allocate the local and temporary register file on the stack. 570 // Allocate the local and temporary register file on the stack.
573 { 571 {
574 // Load frame size from the BytecodeArray object. 572 // Load frame size from the BytecodeArray object.
575 __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister, 573 __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister,
576 BytecodeArray::kFrameSizeOffset)); 574 BytecodeArray::kFrameSizeOffset));
577 575
578 // Do a stack check to ensure we don't go over the limit. 576 // Do a stack check to ensure we don't go over the limit.
579 Label ok; 577 Label ok;
580 __ mov(ecx, esp); 578 __ mov(ecx, esp);
581 __ sub(ecx, ebx); 579 __ sub(ecx, ebx);
(...skipping 25 matching lines...) Expand all
607 // - Code aging of the BytecodeArray object. 605 // - Code aging of the BytecodeArray object.
608 606
609 // Load accumulator, register file, bytecode offset, dispatch table into 607 // Load accumulator, register file, bytecode offset, dispatch table into
610 // registers. 608 // registers.
611 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); 609 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
612 __ mov(kInterpreterRegisterFileRegister, ebp); 610 __ mov(kInterpreterRegisterFileRegister, ebp);
613 __ add(kInterpreterRegisterFileRegister, 611 __ add(kInterpreterRegisterFileRegister,
614 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); 612 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp));
615 __ mov(kInterpreterBytecodeOffsetRegister, 613 __ mov(kInterpreterBytecodeOffsetRegister,
616 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); 614 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag));
617 __ mov(ebx, Operand(ebp, InterpreterFrameConstants::kDispatchTableFromFp)); 615 __ mov(ebx, Immediate(ExternalReference::interpreter_dispatch_table_address(
616 masm->isolate())));
618 617
619 // Push dispatch table as a stack located parameter to the bytecode handler. 618 // Push dispatch table as a stack located parameter to the bytecode handler.
620 DCHECK_EQ(-1, kInterpreterDispatchTableSpillSlot); 619 DCHECK_EQ(-1, kInterpreterDispatchTableSpillSlot);
621 __ push(ebx); 620 __ push(ebx);
622 621
623 // Dispatch to the first bytecode handler for the function. 622 // Dispatch to the first bytecode handler for the function.
624 __ movzx_b(eax, Operand(kInterpreterBytecodeArrayRegister, 623 __ movzx_b(eax, Operand(kInterpreterBytecodeArrayRegister,
625 kInterpreterBytecodeOffsetRegister, times_1, 0)); 624 kInterpreterBytecodeOffsetRegister, times_1, 0));
626 __ mov(ebx, Operand(ebx, eax, times_pointer_size, 0)); 625 __ mov(ebx, Operand(ebx, eax, times_pointer_size, 0));
627 // Restore undefined_value in accumulator (eax) 626 // Restore undefined_value in accumulator (eax)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 } 746 }
748 747
749 748
750 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { 749 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
751 // Initialize register file register. 750 // Initialize register file register.
752 __ mov(kInterpreterRegisterFileRegister, ebp); 751 __ mov(kInterpreterRegisterFileRegister, ebp);
753 __ add(kInterpreterRegisterFileRegister, 752 __ add(kInterpreterRegisterFileRegister,
754 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); 753 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp));
755 754
756 // Get the bytecode array pointer from the frame. 755 // Get the bytecode array pointer from the frame.
757 __ mov(ebx, Operand(kInterpreterRegisterFileRegister,
758 InterpreterFrameConstants::kFunctionFromRegisterPointer));
759 __ mov(ebx, FieldOperand(ebx, JSFunction::kSharedFunctionInfoOffset));
760 __ mov(kInterpreterBytecodeArrayRegister, 756 __ mov(kInterpreterBytecodeArrayRegister,
761 FieldOperand(ebx, SharedFunctionInfo::kFunctionDataOffset)); 757 Operand(kInterpreterRegisterFileRegister,
758 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer));
762 759
763 if (FLAG_debug_code) { 760 if (FLAG_debug_code) {
764 // Check function data field is actually a BytecodeArray object. 761 // Check function data field is actually a BytecodeArray object.
765 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); 762 __ AssertNotSmi(kInterpreterBytecodeArrayRegister);
766 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, 763 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE,
767 ebx); 764 ebx);
768 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 765 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
769 } 766 }
770 767
771 // Get the target bytecode offset from the frame. 768 // Get the target bytecode offset from the frame.
(...skipping 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after
2801 2798
2802 __ bind(&ok); 2799 __ bind(&ok);
2803 __ ret(0); 2800 __ ret(0);
2804 } 2801 }
2805 2802
2806 #undef __ 2803 #undef __
2807 } // namespace internal 2804 } // namespace internal
2808 } // namespace v8 2805 } // namespace v8
2809 2806
2810 #endif // V8_TARGET_ARCH_X87 2807 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698