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

Side by Side Diff: src/mips/builtins-mips.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/interpreter/interpreter-assembler.cc ('k') | src/mips64/builtins-mips64.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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 // frames.h for its layout. 968 // frames.h for its layout.
969 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { 969 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
970 // Open a frame scope to indicate that there is a frame on the stack. The 970 // Open a frame scope to indicate that there is a frame on the stack. The
971 // MANUAL indicates that the scope shouldn't actually generate code to set up 971 // MANUAL indicates that the scope shouldn't actually generate code to set up
972 // the frame (that is done below). 972 // the frame (that is done below).
973 FrameScope frame_scope(masm, StackFrame::MANUAL); 973 FrameScope frame_scope(masm, StackFrame::MANUAL);
974 974
975 __ Push(ra, fp, cp, a1); 975 __ Push(ra, fp, cp, a1);
976 __ Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); 976 __ Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
977 977
978 // Push new.target, dispatch table pointer and zero for bytecode array offset.
979 __ li(a0, Operand(ExternalReference::interpreter_dispatch_table_address(
980 masm->isolate())));
981 __ Push(a3, a0, zero_reg);
982
983 // Get the bytecode array from the function object and load the pointer to the 978 // Get the bytecode array from the function object and load the pointer to the
984 // first entry into kInterpreterBytecodeRegister. 979 // first entry into kInterpreterBytecodeRegister.
985 __ lw(a0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 980 __ lw(a0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
986 __ lw(kInterpreterBytecodeArrayRegister, 981 __ lw(kInterpreterBytecodeArrayRegister,
987 FieldMemOperand(a0, SharedFunctionInfo::kFunctionDataOffset)); 982 FieldMemOperand(a0, SharedFunctionInfo::kFunctionDataOffset));
988 983
989 if (FLAG_debug_code) { 984 if (FLAG_debug_code) {
990 // Check function data field is actually a BytecodeArray object. 985 // Check function data field is actually a BytecodeArray object.
991 __ SmiTst(kInterpreterBytecodeArrayRegister, t0); 986 __ SmiTst(kInterpreterBytecodeArrayRegister, t0);
992 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, t0, 987 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, t0,
993 Operand(zero_reg)); 988 Operand(zero_reg));
994 __ GetObjectType(kInterpreterBytecodeArrayRegister, t0, t0); 989 __ GetObjectType(kInterpreterBytecodeArrayRegister, t0, t0);
995 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, t0, 990 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, t0,
996 Operand(BYTECODE_ARRAY_TYPE)); 991 Operand(BYTECODE_ARRAY_TYPE));
997 } 992 }
998 993
994 // Push new.target, bytecode array and zero for bytecode array offset.
995 __ Push(a3, kInterpreterBytecodeArrayRegister, zero_reg);
996
999 // Allocate the local and temporary register file on the stack. 997 // Allocate the local and temporary register file on the stack.
1000 { 998 {
1001 // Load frame size from the BytecodeArray object. 999 // Load frame size from the BytecodeArray object.
1002 __ lw(t0, FieldMemOperand(kInterpreterBytecodeArrayRegister, 1000 __ lw(t0, FieldMemOperand(kInterpreterBytecodeArrayRegister,
1003 BytecodeArray::kFrameSizeOffset)); 1001 BytecodeArray::kFrameSizeOffset));
1004 1002
1005 // Do a stack check to ensure we don't go over the limit. 1003 // Do a stack check to ensure we don't go over the limit.
1006 Label ok; 1004 Label ok;
1007 __ Subu(t1, sp, Operand(t0)); 1005 __ Subu(t1, sp, Operand(t0));
1008 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex); 1006 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex);
(...skipping 20 matching lines...) Expand all
1029 // - Support profiler (specifically profiling_counter). 1027 // - Support profiler (specifically profiling_counter).
1030 // - Call ProfileEntryHookStub when isolate has a function_entry_hook. 1028 // - Call ProfileEntryHookStub when isolate has a function_entry_hook.
1031 // - Code aging of the BytecodeArray object. 1029 // - Code aging of the BytecodeArray object.
1032 1030
1033 // Load bytecode offset and dispatch table into registers. 1031 // Load bytecode offset and dispatch table into registers.
1034 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); 1032 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
1035 __ Addu(kInterpreterRegisterFileRegister, fp, 1033 __ Addu(kInterpreterRegisterFileRegister, fp,
1036 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); 1034 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp));
1037 __ li(kInterpreterBytecodeOffsetRegister, 1035 __ li(kInterpreterBytecodeOffsetRegister,
1038 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); 1036 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
1039 __ lw(kInterpreterDispatchTableRegister, 1037 __ li(kInterpreterDispatchTableRegister,
1040 MemOperand(fp, InterpreterFrameConstants::kDispatchTableFromFp)); 1038 Operand(ExternalReference::interpreter_dispatch_table_address(
1039 masm->isolate())));
1041 1040
1042 // Dispatch to the first bytecode handler for the function. 1041 // Dispatch to the first bytecode handler for the function.
1043 __ Addu(a0, kInterpreterBytecodeArrayRegister, 1042 __ Addu(a0, kInterpreterBytecodeArrayRegister,
1044 kInterpreterBytecodeOffsetRegister); 1043 kInterpreterBytecodeOffsetRegister);
1045 __ lbu(a0, MemOperand(a0)); 1044 __ lbu(a0, MemOperand(a0));
1046 __ Lsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2); 1045 __ Lsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2);
1047 __ lw(at, MemOperand(at)); 1046 __ lw(at, MemOperand(at));
1048 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging 1047 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging
1049 // and header removal. 1048 // and header removal.
1050 __ Addu(at, at, Operand(Code::kHeaderSize - kHeapObjectTag)); 1049 __ Addu(at, at, Operand(Code::kHeaderSize - kHeapObjectTag));
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 __ li(kInterpreterDispatchTableRegister, 1142 __ li(kInterpreterDispatchTableRegister,
1144 Operand(ExternalReference::interpreter_dispatch_table_address( 1143 Operand(ExternalReference::interpreter_dispatch_table_address(
1145 masm->isolate()))); 1144 masm->isolate())));
1146 1145
1147 // Get the context from the frame. 1146 // Get the context from the frame.
1148 __ lw(kContextRegister, 1147 __ lw(kContextRegister,
1149 MemOperand(kInterpreterRegisterFileRegister, 1148 MemOperand(kInterpreterRegisterFileRegister,
1150 InterpreterFrameConstants::kContextFromRegisterPointer)); 1149 InterpreterFrameConstants::kContextFromRegisterPointer));
1151 1150
1152 // Get the bytecode array pointer from the frame. 1151 // Get the bytecode array pointer from the frame.
1153 __ lw(a1, 1152 __ lw(
1154 MemOperand(kInterpreterRegisterFileRegister, 1153 kInterpreterBytecodeArrayRegister,
1155 InterpreterFrameConstants::kFunctionFromRegisterPointer)); 1154 MemOperand(kInterpreterRegisterFileRegister,
1156 __ lw(a1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 1155 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer));
1157 __ lw(kInterpreterBytecodeArrayRegister,
1158 FieldMemOperand(a1, SharedFunctionInfo::kFunctionDataOffset));
1159 1156
1160 if (FLAG_debug_code) { 1157 if (FLAG_debug_code) {
1161 // Check function data field is actually a BytecodeArray object. 1158 // Check function data field is actually a BytecodeArray object.
1162 __ SmiTst(kInterpreterBytecodeArrayRegister, at); 1159 __ SmiTst(kInterpreterBytecodeArrayRegister, at);
1163 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, at, 1160 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, at,
1164 Operand(zero_reg)); 1161 Operand(zero_reg));
1165 __ GetObjectType(kInterpreterBytecodeArrayRegister, a1, a1); 1162 __ GetObjectType(kInterpreterBytecodeArrayRegister, a1, a1);
1166 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a1, 1163 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a1,
1167 Operand(BYTECODE_ARRAY_TYPE)); 1164 Operand(BYTECODE_ARRAY_TYPE));
1168 } 1165 }
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after
2756 } 2753 }
2757 } 2754 }
2758 2755
2759 2756
2760 #undef __ 2757 #undef __
2761 2758
2762 } // namespace internal 2759 } // namespace internal
2763 } // namespace v8 2760 } // namespace v8
2764 2761
2765 #endif // V8_TARGET_ARCH_MIPS 2762 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/interpreter/interpreter-assembler.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698