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

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

Issue 1904093002: [interpreter] Heal closures when bytecode array is gone. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ported to most architectures. Created 4 years, 8 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/x64/builtins-x64.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 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 // frames.h for its layout. 965 // frames.h for its layout.
966 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { 966 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
967 ProfileEntryHookStub::MaybeCallEntryHook(masm); 967 ProfileEntryHookStub::MaybeCallEntryHook(masm);
968 968
969 // Open a frame scope to indicate that there is a frame on the stack. The 969 // Open a frame scope to indicate that there is a frame on the stack. The
970 // MANUAL indicates that the scope shouldn't actually generate code to set up 970 // MANUAL indicates that the scope shouldn't actually generate code to set up
971 // the frame (that is done below). 971 // the frame (that is done below).
972 FrameScope frame_scope(masm, StackFrame::MANUAL); 972 FrameScope frame_scope(masm, StackFrame::MANUAL);
973 __ PushStandardFrame(a1); 973 __ PushStandardFrame(a1);
974 974
975 // Get the bytecode array from the function object and load the pointer to the 975 // Get the bytecode array from the function object (or from the DebugInfo if
976 // first entry into kInterpreterBytecodeRegister. 976 // it is present) and load it into kInterpreterBytecodeArrayRegister.
977 __ ld(a0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 977 __ ld(a0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
978 Label load_debug_bytecode_array, bytecode_array_loaded; 978 Label load_debug_bytecode_array, bytecode_array_loaded;
979 Register debug_info = kInterpreterBytecodeArrayRegister; 979 Register debug_info = kInterpreterBytecodeArrayRegister;
980 DCHECK(!debug_info.is(a0)); 980 DCHECK(!debug_info.is(a0));
981 __ ld(debug_info, FieldMemOperand(a0, SharedFunctionInfo::kDebugInfoOffset)); 981 __ ld(debug_info, FieldMemOperand(a0, SharedFunctionInfo::kDebugInfoOffset));
982 __ Branch(&load_debug_bytecode_array, ne, debug_info, 982 __ Branch(&load_debug_bytecode_array, ne, debug_info,
983 Operand(DebugInfo::uninitialized())); 983 Operand(DebugInfo::uninitialized()));
984 __ ld(kInterpreterBytecodeArrayRegister, 984 __ ld(kInterpreterBytecodeArrayRegister,
985 FieldMemOperand(a0, SharedFunctionInfo::kFunctionDataOffset)); 985 FieldMemOperand(a0, SharedFunctionInfo::kFunctionDataOffset));
986 __ bind(&bytecode_array_loaded); 986 __ bind(&bytecode_array_loaded);
987 987
988 // Check function data field is actually a BytecodeArray object.
989 Label bytecode_array_not_present;
990 __ JumpIfRoot(kInterpreterBytecodeArrayRegister,
991 Heap::kUndefinedValueRootIndex, &bytecode_array_not_present);
988 if (FLAG_debug_code) { 992 if (FLAG_debug_code) {
989 // Check function data field is actually a BytecodeArray object.
990 __ SmiTst(kInterpreterBytecodeArrayRegister, a4); 993 __ SmiTst(kInterpreterBytecodeArrayRegister, a4);
991 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a4, 994 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a4,
992 Operand(zero_reg)); 995 Operand(zero_reg));
993 __ GetObjectType(kInterpreterBytecodeArrayRegister, a4, a4); 996 __ GetObjectType(kInterpreterBytecodeArrayRegister, a4, a4);
994 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a4, 997 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a4,
995 Operand(BYTECODE_ARRAY_TYPE)); 998 Operand(BYTECODE_ARRAY_TYPE));
996 } 999 }
997 1000
998 // Push new.target, bytecode array and zero for bytecode array offset. 1001 // Push new.target, bytecode array and zero for bytecode array offset.
999 __ Push(a3, kInterpreterBytecodeArrayRegister, zero_reg); 1002 __ Push(a3, kInterpreterBytecodeArrayRegister, zero_reg);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 __ Call(at); 1047 __ Call(at);
1045 1048
1046 // Even though the first bytecode handler was called, we will never return. 1049 // Even though the first bytecode handler was called, we will never return.
1047 __ Abort(kUnexpectedReturnFromBytecodeHandler); 1050 __ Abort(kUnexpectedReturnFromBytecodeHandler);
1048 1051
1049 // Load debug copy of the bytecode array. 1052 // Load debug copy of the bytecode array.
1050 __ bind(&load_debug_bytecode_array); 1053 __ bind(&load_debug_bytecode_array);
1051 __ ld(kInterpreterBytecodeArrayRegister, 1054 __ ld(kInterpreterBytecodeArrayRegister,
1052 FieldMemOperand(debug_info, DebugInfo::kAbstractCodeIndex)); 1055 FieldMemOperand(debug_info, DebugInfo::kAbstractCodeIndex));
1053 __ Branch(&bytecode_array_loaded); 1056 __ Branch(&bytecode_array_loaded);
1057
1058 // If the bytecode array is no longer present, then the underlying function
1059 // has been switched to a different kind of code and we heal the closure by
1060 // switching the code entry field over to the new code object as well.
1061 __ bind(&bytecode_array_not_present);
1062 __ LeaveFrame(StackFrame::JAVA_SCRIPT);
1063 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
1064 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kCodeOffset));
1065 __ Daddu(a4, a4, Operand(Code::kHeaderSize - kHeapObjectTag));
1066 __ sd(a4, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
1067 __ RecordWriteCodeEntryField(a1, a4, a5);
1068 __ Jump(a4);
1054 } 1069 }
1055 1070
1056 1071
1057 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { 1072 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
1058 // The return value is in accumulator, which is already in v0. 1073 // The return value is in accumulator, which is already in v0.
1059 1074
1060 // Leave the frame (also dropping the register file). 1075 // Leave the frame (also dropping the register file).
1061 __ LeaveFrame(StackFrame::JAVA_SCRIPT); 1076 __ LeaveFrame(StackFrame::JAVA_SCRIPT);
1062 1077
1063 // Drop receiver + arguments and return. 1078 // Drop receiver + arguments and return.
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
2847 } 2862 }
2848 } 2863 }
2849 2864
2850 2865
2851 #undef __ 2866 #undef __
2852 2867
2853 } // namespace internal 2868 } // namespace internal
2854 } // namespace v8 2869 } // namespace v8
2855 2870
2856 #endif // V8_TARGET_ARCH_MIPS64 2871 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698