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

Side by Side Diff: src/arm64/builtins-arm64.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/arm/builtins-arm.cc ('k') | src/deoptimizer.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 5 #if V8_TARGET_ARCH_ARM64
6 6
7 #include "src/arm64/frames-arm64.h" 7 #include "src/arm64/frames-arm64.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 // The function builds an interpreter frame. See InterpreterFrameConstants in 990 // The function builds an interpreter frame. See InterpreterFrameConstants in
991 // frames.h for its layout. 991 // frames.h for its layout.
992 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { 992 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
993 // Open a frame scope to indicate that there is a frame on the stack. The 993 // Open a frame scope to indicate that there is a frame on the stack. The
994 // MANUAL indicates that the scope shouldn't actually generate code to set up 994 // MANUAL indicates that the scope shouldn't actually generate code to set up
995 // the frame (that is done below). 995 // the frame (that is done below).
996 FrameScope frame_scope(masm, StackFrame::MANUAL); 996 FrameScope frame_scope(masm, StackFrame::MANUAL);
997 __ Push(lr, fp, cp, x1); 997 __ Push(lr, fp, cp, x1);
998 __ Add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp); 998 __ Add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp);
999 999
1000 // Push dispatch table pointer.
1001 __ Mov(x0, Operand(0));
1002 __ Mov(x2, Operand(ExternalReference::interpreter_dispatch_table_address(
1003 masm->isolate())));
1004 __ Push(x3, x2, x0);
1005
1006 // Get the bytecode array from the function object and load the pointer to the 1000 // Get the bytecode array from the function object and load the pointer to the
1007 // first entry into kInterpreterBytecodeRegister. 1001 // first entry into kInterpreterBytecodeRegister.
1008 __ Ldr(x0, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); 1002 __ Ldr(x0, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset));
1009 __ Ldr(kInterpreterBytecodeArrayRegister, 1003 __ Ldr(kInterpreterBytecodeArrayRegister,
1010 FieldMemOperand(x0, SharedFunctionInfo::kFunctionDataOffset)); 1004 FieldMemOperand(x0, SharedFunctionInfo::kFunctionDataOffset));
1011 1005
1012 if (FLAG_debug_code) { 1006 if (FLAG_debug_code) {
1013 // Check function data field is actually a BytecodeArray object. 1007 // Check function data field is actually a BytecodeArray object.
1014 __ AssertNotSmi(kInterpreterBytecodeArrayRegister, 1008 __ AssertNotSmi(kInterpreterBytecodeArrayRegister,
1015 kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 1009 kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
1016 __ CompareObjectType(kInterpreterBytecodeArrayRegister, x0, x0, 1010 __ CompareObjectType(kInterpreterBytecodeArrayRegister, x0, x0,
1017 BYTECODE_ARRAY_TYPE); 1011 BYTECODE_ARRAY_TYPE);
1018 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 1012 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
1019 } 1013 }
1020 1014
1015 // Push new.target, bytecode array and zero for bytecode array offset.
1016 __ Mov(x0, Operand(0));
1017 __ Push(x3, kInterpreterBytecodeArrayRegister, x0);
1018
1021 // Allocate the local and temporary register file on the stack. 1019 // Allocate the local and temporary register file on the stack.
1022 { 1020 {
1023 // Load frame size from the BytecodeArray object. 1021 // Load frame size from the BytecodeArray object.
1024 __ Ldr(w11, FieldMemOperand(kInterpreterBytecodeArrayRegister, 1022 __ Ldr(w11, FieldMemOperand(kInterpreterBytecodeArrayRegister,
1025 BytecodeArray::kFrameSizeOffset)); 1023 BytecodeArray::kFrameSizeOffset));
1026 1024
1027 // Do a stack check to ensure we don't go over the limit. 1025 // Do a stack check to ensure we don't go over the limit.
1028 Label ok; 1026 Label ok;
1029 DCHECK(jssp.Is(__ StackPointer())); 1027 DCHECK(jssp.Is(__ StackPointer()));
1030 __ Sub(x10, jssp, Operand(x11)); 1028 __ Sub(x10, jssp, Operand(x11));
(...skipping 20 matching lines...) Expand all
1051 // - Call ProfileEntryHookStub when isolate has a function_entry_hook. 1049 // - Call ProfileEntryHookStub when isolate has a function_entry_hook.
1052 // - Code aging of the BytecodeArray object. 1050 // - Code aging of the BytecodeArray object.
1053 1051
1054 // Load accumulator, register file, bytecode offset, dispatch table into 1052 // Load accumulator, register file, bytecode offset, dispatch table into
1055 // registers. 1053 // registers.
1056 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); 1054 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
1057 __ Add(kInterpreterRegisterFileRegister, fp, 1055 __ Add(kInterpreterRegisterFileRegister, fp,
1058 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); 1056 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp));
1059 __ Mov(kInterpreterBytecodeOffsetRegister, 1057 __ Mov(kInterpreterBytecodeOffsetRegister,
1060 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); 1058 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
1061 __ Ldr(kInterpreterDispatchTableRegister, 1059 __ Mov(kInterpreterDispatchTableRegister,
1062 MemOperand(fp, InterpreterFrameConstants::kDispatchTableFromFp)); 1060 Operand(ExternalReference::interpreter_dispatch_table_address(
1061 masm->isolate())));
1063 1062
1064 // Dispatch to the first bytecode handler for the function. 1063 // Dispatch to the first bytecode handler for the function.
1065 __ Ldrb(x1, MemOperand(kInterpreterBytecodeArrayRegister, 1064 __ Ldrb(x1, MemOperand(kInterpreterBytecodeArrayRegister,
1066 kInterpreterBytecodeOffsetRegister)); 1065 kInterpreterBytecodeOffsetRegister));
1067 __ Mov(x1, Operand(x1, LSL, kPointerSizeLog2)); 1066 __ Mov(x1, Operand(x1, LSL, kPointerSizeLog2));
1068 __ Ldr(ip0, MemOperand(kInterpreterDispatchTableRegister, x1)); 1067 __ Ldr(ip0, MemOperand(kInterpreterDispatchTableRegister, x1));
1069 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging 1068 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging
1070 // and header removal. 1069 // and header removal.
1071 __ Add(ip0, ip0, Operand(Code::kHeaderSize - kHeapObjectTag)); 1070 __ Add(ip0, ip0, Operand(Code::kHeaderSize - kHeapObjectTag));
1072 __ Call(ip0); 1071 __ Call(ip0);
(...skipping 30 matching lines...) Expand all
1103 __ Mov(kInterpreterDispatchTableRegister, 1102 __ Mov(kInterpreterDispatchTableRegister,
1104 Operand(ExternalReference::interpreter_dispatch_table_address( 1103 Operand(ExternalReference::interpreter_dispatch_table_address(
1105 masm->isolate()))); 1104 masm->isolate())));
1106 1105
1107 // Get the context from the frame. 1106 // Get the context from the frame.
1108 __ Ldr(kContextRegister, 1107 __ Ldr(kContextRegister,
1109 MemOperand(kInterpreterRegisterFileRegister, 1108 MemOperand(kInterpreterRegisterFileRegister,
1110 InterpreterFrameConstants::kContextFromRegisterPointer)); 1109 InterpreterFrameConstants::kContextFromRegisterPointer));
1111 1110
1112 // Get the bytecode array pointer from the frame. 1111 // Get the bytecode array pointer from the frame.
1113 __ Ldr(x1, 1112 __ Ldr(
1114 MemOperand(kInterpreterRegisterFileRegister, 1113 kInterpreterBytecodeArrayRegister,
1115 InterpreterFrameConstants::kFunctionFromRegisterPointer)); 1114 MemOperand(kInterpreterRegisterFileRegister,
1116 __ Ldr(x1, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); 1115 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer));
1117 __ Ldr(kInterpreterBytecodeArrayRegister,
1118 FieldMemOperand(x1, SharedFunctionInfo::kFunctionDataOffset));
1119 1116
1120 if (FLAG_debug_code) { 1117 if (FLAG_debug_code) {
1121 // Check function data field is actually a BytecodeArray object. 1118 // Check function data field is actually a BytecodeArray object.
1122 __ AssertNotSmi(kInterpreterBytecodeArrayRegister, 1119 __ AssertNotSmi(kInterpreterBytecodeArrayRegister,
1123 kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 1120 kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
1124 __ CompareObjectType(kInterpreterBytecodeArrayRegister, x1, x1, 1121 __ CompareObjectType(kInterpreterBytecodeArrayRegister, x1, x1,
1125 BYTECODE_ARRAY_TYPE); 1122 BYTECODE_ARRAY_TYPE);
1126 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 1123 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
1127 } 1124 }
1128 1125
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after
2814 } 2811 }
2815 } 2812 }
2816 2813
2817 2814
2818 #undef __ 2815 #undef __
2819 2816
2820 } // namespace internal 2817 } // namespace internal
2821 } // namespace v8 2818 } // namespace v8
2822 2819
2823 #endif // V8_TARGET_ARCH_ARM 2820 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698