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

Side by Side Diff: src/mips64/builtins-mips64.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/mips/builtins-mips.cc ('k') | src/ppc/builtins-ppc.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 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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 // frames.h for its layout. 960 // frames.h for its layout.
961 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { 961 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
962 // Open a frame scope to indicate that there is a frame on the stack. The 962 // Open a frame scope to indicate that there is a frame on the stack. The
963 // MANUAL indicates that the scope shouldn't actually generate code to set up 963 // MANUAL indicates that the scope shouldn't actually generate code to set up
964 // the frame (that is done below). 964 // the frame (that is done below).
965 FrameScope frame_scope(masm, StackFrame::MANUAL); 965 FrameScope frame_scope(masm, StackFrame::MANUAL);
966 966
967 __ Push(ra, fp, cp, a1); 967 __ Push(ra, fp, cp, a1);
968 __ Daddu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); 968 __ Daddu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
969 969
970 // Push new.target, dispatch table pointer and zero for bytecode array offset.
971 __ li(a0, Operand(ExternalReference::interpreter_dispatch_table_address(
972 masm->isolate())));
973 __ Push(a3, a0, zero_reg);
974
975 // Get the bytecode array from the function object and load the pointer to the 970 // Get the bytecode array from the function object and load the pointer to the
976 // first entry into kInterpreterBytecodeRegister. 971 // first entry into kInterpreterBytecodeRegister.
977 __ ld(a0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 972 __ ld(a0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
978 __ ld(kInterpreterBytecodeArrayRegister, 973 __ ld(kInterpreterBytecodeArrayRegister,
979 FieldMemOperand(a0, SharedFunctionInfo::kFunctionDataOffset)); 974 FieldMemOperand(a0, SharedFunctionInfo::kFunctionDataOffset));
980 975
981 if (FLAG_debug_code) { 976 if (FLAG_debug_code) {
982 // Check function data field is actually a BytecodeArray object. 977 // Check function data field is actually a BytecodeArray object.
983 __ SmiTst(kInterpreterBytecodeArrayRegister, a4); 978 __ SmiTst(kInterpreterBytecodeArrayRegister, a4);
984 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a4, 979 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a4,
985 Operand(zero_reg)); 980 Operand(zero_reg));
986 __ GetObjectType(kInterpreterBytecodeArrayRegister, a4, a4); 981 __ GetObjectType(kInterpreterBytecodeArrayRegister, a4, a4);
987 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a4, 982 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a4,
988 Operand(BYTECODE_ARRAY_TYPE)); 983 Operand(BYTECODE_ARRAY_TYPE));
989 } 984 }
990 985
986 // Push new.target, bytecode array and zero for bytecode array offset.
987 __ Push(a3, kInterpreterBytecodeArrayRegister, zero_reg);
988
991 // Allocate the local and temporary register file on the stack. 989 // Allocate the local and temporary register file on the stack.
992 { 990 {
993 // Load frame size (word) from the BytecodeArray object. 991 // Load frame size (word) from the BytecodeArray object.
994 __ lw(a4, FieldMemOperand(kInterpreterBytecodeArrayRegister, 992 __ lw(a4, FieldMemOperand(kInterpreterBytecodeArrayRegister,
995 BytecodeArray::kFrameSizeOffset)); 993 BytecodeArray::kFrameSizeOffset));
996 994
997 // Do a stack check to ensure we don't go over the limit. 995 // Do a stack check to ensure we don't go over the limit.
998 Label ok; 996 Label ok;
999 __ Dsubu(a5, sp, Operand(a4)); 997 __ Dsubu(a5, sp, Operand(a4));
1000 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex); 998 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex);
(...skipping 20 matching lines...) Expand all
1021 // - Support profiler (specifically profiling_counter). 1019 // - Support profiler (specifically profiling_counter).
1022 // - Call ProfileEntryHookStub when isolate has a function_entry_hook. 1020 // - Call ProfileEntryHookStub when isolate has a function_entry_hook.
1023 // - Code aging of the BytecodeArray object. 1021 // - Code aging of the BytecodeArray object.
1024 1022
1025 // Load bytecode offset and dispatch table into registers. 1023 // Load bytecode offset and dispatch table into registers.
1026 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); 1024 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
1027 __ Daddu(kInterpreterRegisterFileRegister, fp, 1025 __ Daddu(kInterpreterRegisterFileRegister, fp,
1028 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); 1026 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp));
1029 __ li(kInterpreterBytecodeOffsetRegister, 1027 __ li(kInterpreterBytecodeOffsetRegister,
1030 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); 1028 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
1031 __ lw(kInterpreterDispatchTableRegister, 1029 __ li(kInterpreterDispatchTableRegister,
1032 MemOperand(fp, InterpreterFrameConstants::kDispatchTableFromFp)); 1030 Operand(ExternalReference::interpreter_dispatch_table_address(
1031 masm->isolate())));
1033 1032
1034 // Dispatch to the first bytecode handler for the function. 1033 // Dispatch to the first bytecode handler for the function.
1035 __ Daddu(a0, kInterpreterBytecodeArrayRegister, 1034 __ Daddu(a0, kInterpreterBytecodeArrayRegister,
1036 kInterpreterBytecodeOffsetRegister); 1035 kInterpreterBytecodeOffsetRegister);
1037 __ lbu(a0, MemOperand(a0)); 1036 __ lbu(a0, MemOperand(a0));
1038 __ Dlsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2); 1037 __ Dlsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2);
1039 __ ld(at, MemOperand(at)); 1038 __ ld(at, MemOperand(at));
1040 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging 1039 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging
1041 // and header removal. 1040 // and header removal.
1042 __ Daddu(at, at, Operand(Code::kHeaderSize - kHeapObjectTag)); 1041 __ Daddu(at, at, Operand(Code::kHeaderSize - kHeapObjectTag));
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 __ li(kInterpreterDispatchTableRegister, 1134 __ li(kInterpreterDispatchTableRegister,
1136 Operand(ExternalReference::interpreter_dispatch_table_address( 1135 Operand(ExternalReference::interpreter_dispatch_table_address(
1137 masm->isolate()))); 1136 masm->isolate())));
1138 1137
1139 // Get the context from the frame. 1138 // Get the context from the frame.
1140 __ ld(kContextRegister, 1139 __ ld(kContextRegister,
1141 MemOperand(kInterpreterRegisterFileRegister, 1140 MemOperand(kInterpreterRegisterFileRegister,
1142 InterpreterFrameConstants::kContextFromRegisterPointer)); 1141 InterpreterFrameConstants::kContextFromRegisterPointer));
1143 1142
1144 // Get the bytecode array pointer from the frame. 1143 // Get the bytecode array pointer from the frame.
1145 __ ld(a1, 1144 __ ld(
1146 MemOperand(kInterpreterRegisterFileRegister, 1145 kInterpreterBytecodeArrayRegister,
1147 InterpreterFrameConstants::kFunctionFromRegisterPointer)); 1146 MemOperand(kInterpreterRegisterFileRegister,
1148 __ ld(a1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 1147 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer));
1149 __ ld(kInterpreterBytecodeArrayRegister,
1150 FieldMemOperand(a1, SharedFunctionInfo::kFunctionDataOffset));
1151 1148
1152 if (FLAG_debug_code) { 1149 if (FLAG_debug_code) {
1153 // Check function data field is actually a BytecodeArray object. 1150 // Check function data field is actually a BytecodeArray object.
1154 __ SmiTst(kInterpreterBytecodeArrayRegister, at); 1151 __ SmiTst(kInterpreterBytecodeArrayRegister, at);
1155 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, at, 1152 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, at,
1156 Operand(zero_reg)); 1153 Operand(zero_reg));
1157 __ GetObjectType(kInterpreterBytecodeArrayRegister, a1, a1); 1154 __ GetObjectType(kInterpreterBytecodeArrayRegister, a1, a1);
1158 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a1, 1155 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a1,
1159 Operand(BYTECODE_ARRAY_TYPE)); 1156 Operand(BYTECODE_ARRAY_TYPE));
1160 } 1157 }
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after
2750 } 2747 }
2751 } 2748 }
2752 2749
2753 2750
2754 #undef __ 2751 #undef __
2755 2752
2756 } // namespace internal 2753 } // namespace internal
2757 } // namespace v8 2754 } // namespace v8
2758 2755
2759 #endif // V8_TARGET_ARCH_MIPS64 2756 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/ppc/builtins-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698