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

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

Issue 2257143002: [interpreter] Fix self-healing with preserved bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added ports and test. Created 4 years, 4 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/builtins/ia32/builtins-ia32.cc ('k') | src/builtins/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 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 Label load_debug_bytecode_array, bytecode_array_loaded; 1038 Label load_debug_bytecode_array, bytecode_array_loaded;
1039 Register debug_info = kInterpreterBytecodeArrayRegister; 1039 Register debug_info = kInterpreterBytecodeArrayRegister;
1040 DCHECK(!debug_info.is(a0)); 1040 DCHECK(!debug_info.is(a0));
1041 __ lw(debug_info, FieldMemOperand(a0, SharedFunctionInfo::kDebugInfoOffset)); 1041 __ lw(debug_info, FieldMemOperand(a0, SharedFunctionInfo::kDebugInfoOffset));
1042 __ Branch(&load_debug_bytecode_array, ne, debug_info, 1042 __ Branch(&load_debug_bytecode_array, ne, debug_info,
1043 Operand(DebugInfo::uninitialized())); 1043 Operand(DebugInfo::uninitialized()));
1044 __ lw(kInterpreterBytecodeArrayRegister, 1044 __ lw(kInterpreterBytecodeArrayRegister,
1045 FieldMemOperand(a0, SharedFunctionInfo::kFunctionDataOffset)); 1045 FieldMemOperand(a0, SharedFunctionInfo::kFunctionDataOffset));
1046 __ bind(&bytecode_array_loaded); 1046 __ bind(&bytecode_array_loaded);
1047 1047
1048 // Check whether we should continue to use the interpreter.
1049 Label switch_to_different_code_kind;
1050 __ lw(a0, FieldMemOperand(a0, SharedFunctionInfo::kCodeOffset));
1051 __ Branch(&switch_to_different_code_kind, ne, a0,
1052 Operand(masm->CodeObject())); // Self-reference to this code.
1053
1048 // Check function data field is actually a BytecodeArray object. 1054 // Check function data field is actually a BytecodeArray object.
1049 Label bytecode_array_not_present;
1050 __ JumpIfRoot(kInterpreterBytecodeArrayRegister,
1051 Heap::kUndefinedValueRootIndex, &bytecode_array_not_present);
1052 if (FLAG_debug_code) { 1055 if (FLAG_debug_code) {
1053 __ SmiTst(kInterpreterBytecodeArrayRegister, t0); 1056 __ SmiTst(kInterpreterBytecodeArrayRegister, t0);
1054 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, t0, 1057 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, t0,
1055 Operand(zero_reg)); 1058 Operand(zero_reg));
1056 __ GetObjectType(kInterpreterBytecodeArrayRegister, t0, t0); 1059 __ GetObjectType(kInterpreterBytecodeArrayRegister, t0, t0);
1057 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, t0, 1060 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, t0,
1058 Operand(BYTECODE_ARRAY_TYPE)); 1061 Operand(BYTECODE_ARRAY_TYPE));
1059 } 1062 }
1060 1063
1061 // Load initial bytecode offset. 1064 // Load initial bytecode offset.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 // The return value is in v0. 1115 // The return value is in v0.
1113 LeaveInterpreterFrame(masm, t0); 1116 LeaveInterpreterFrame(masm, t0);
1114 __ Jump(ra); 1117 __ Jump(ra);
1115 1118
1116 // Load debug copy of the bytecode array. 1119 // Load debug copy of the bytecode array.
1117 __ bind(&load_debug_bytecode_array); 1120 __ bind(&load_debug_bytecode_array);
1118 __ lw(kInterpreterBytecodeArrayRegister, 1121 __ lw(kInterpreterBytecodeArrayRegister,
1119 FieldMemOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex)); 1122 FieldMemOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex));
1120 __ Branch(&bytecode_array_loaded); 1123 __ Branch(&bytecode_array_loaded);
1121 1124
1122 // If the bytecode array is no longer present, then the underlying function 1125 // If the shared code is no longer this entry trampoline, then the underlying
1123 // has been switched to a different kind of code and we heal the closure by 1126 // function has been switched to a different kind of code and we heal the
1124 // switching the code entry field over to the new code object as well. 1127 // closure by switching the code entry field over to the new code as well.
1125 __ bind(&bytecode_array_not_present); 1128 __ bind(&switch_to_different_code_kind);
1126 __ LeaveFrame(StackFrame::JAVA_SCRIPT); 1129 __ LeaveFrame(StackFrame::JAVA_SCRIPT);
1127 __ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 1130 __ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
1128 __ lw(t0, FieldMemOperand(t0, SharedFunctionInfo::kCodeOffset)); 1131 __ lw(t0, FieldMemOperand(t0, SharedFunctionInfo::kCodeOffset));
1129 __ Addu(t0, t0, Operand(Code::kHeaderSize - kHeapObjectTag)); 1132 __ Addu(t0, t0, Operand(Code::kHeaderSize - kHeapObjectTag));
1130 __ sw(t0, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); 1133 __ sw(t0, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
1131 __ RecordWriteCodeEntryField(a1, t0, t1); 1134 __ RecordWriteCodeEntryField(a1, t0, t1);
1132 __ Jump(t0); 1135 __ Jump(t0);
1133 } 1136 }
1134 1137
1135 void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) { 1138 void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) {
(...skipping 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after
3002 __ break_(0xCC); 3005 __ break_(0xCC);
3003 } 3006 }
3004 } 3007 }
3005 3008
3006 #undef __ 3009 #undef __
3007 3010
3008 } // namespace internal 3011 } // namespace internal
3009 } // namespace v8 3012 } // namespace v8
3010 3013
3011 #endif // V8_TARGET_ARCH_MIPS 3014 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/builtins/ia32/builtins-ia32.cc ('k') | src/builtins/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698