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

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

Issue 1642613002: Reland of Type Feedback Vector lives in the closure (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: %SetCode failed to install literals in cache. 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/macro-assembler-arm.cc ('k') | src/arm64/macro-assembler-arm64.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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 // This simulates the initial call to bytecode handlers in interpreter entry 1109 // This simulates the initial call to bytecode handlers in interpreter entry
1110 // trampoline. The return will never actually be taken, but our stack walker 1110 // trampoline. The return will never actually be taken, but our stack walker
1111 // uses this address to determine whether a frame is interpreted. 1111 // uses this address to determine whether a frame is interpreted.
1112 __ LoadObject(lr, masm->isolate()->builtins()->InterpreterEntryTrampoline()); 1112 __ LoadObject(lr, masm->isolate()->builtins()->InterpreterEntryTrampoline());
1113 1113
1114 Generate_EnterBytecodeDispatch(masm); 1114 Generate_EnterBytecodeDispatch(masm);
1115 } 1115 }
1116 1116
1117 1117
1118 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 1118 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
1119 // ----------- S t a t e -------------
1120 // -- x3 : new target (preserved for callee)
1121 // -- x1 : target function (preserved for callee)
1122 // -----------------------------------
1123 // First lookup code, maybe we don't need to compile!
1124 Label gotta_call_runtime;
1125 Label maybe_call_runtime;
1126 Label try_shared;
1127 Label loop_top, loop_bottom;
1128
1129 Register closure = x1;
1130 Register new_target = x3;
1131 Register map = x0;
1132 Register index = x2;
1133 __ Ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1134 __ Ldr(map,
1135 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1136 __ Ldrsw(index, UntagSmiFieldMemOperand(map, FixedArray::kLengthOffset));
1137 __ Cmp(index, Operand(2));
1138 __ B(lt, &gotta_call_runtime);
1139
1140 // Find literals.
1141 // x3 : native context
1142 // x2 : length / index
1143 // x0 : optimized code map
1144 // stack[0] : new target
1145 // stack[4] : closure
1146 Register native_context = x4;
1147 __ Ldr(native_context, NativeContextMemOperand());
1148
1149 __ Bind(&loop_top);
1150 Register temp = x5;
1151 Register array_pointer = x6;
1152
1153 // Does the native context match?
1154 __ Add(array_pointer, map, Operand(index, LSL, kPointerSizeLog2));
1155 __ Ldr(temp, FieldMemOperand(array_pointer,
1156 SharedFunctionInfo::OffsetToPreviousContext()));
1157 __ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1158 __ Cmp(temp, native_context);
1159 __ B(ne, &loop_bottom);
1160 // OSR id set to none?
1161 __ Ldr(temp, FieldMemOperand(array_pointer,
1162 SharedFunctionInfo::OffsetToPreviousOsrAstId()));
1163 const int bailout_id = BailoutId::None().ToInt();
1164 __ Cmp(temp, Operand(Smi::FromInt(bailout_id)));
1165 __ B(ne, &loop_bottom);
1166 // Literals available?
1167 __ Ldr(temp, FieldMemOperand(array_pointer,
1168 SharedFunctionInfo::OffsetToPreviousLiterals()));
1169 __ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1170 __ JumpIfSmi(temp, &gotta_call_runtime);
1171
1172 // Save the literals in the closure.
1173 __ Str(temp, FieldMemOperand(closure, JSFunction::kLiteralsOffset));
1174 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, x7,
1175 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1176 OMIT_SMI_CHECK);
1177
1178 // Code available?
1179 Register entry = x7;
1180 __ Ldr(entry,
1181 FieldMemOperand(array_pointer,
1182 SharedFunctionInfo::OffsetToPreviousCachedCode()));
1183 __ Ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1184 __ JumpIfSmi(entry, &maybe_call_runtime);
1185
1186 // Found literals and code. Get them into the closure and return.
1187 __ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1188
1189 Label install_optimized_code_and_tailcall;
1190 __ Bind(&install_optimized_code_and_tailcall);
1191 __ Str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1192
1193 // Link the closure into the optimized function list.
1194 // x7 : code entry
1195 // x4 : native context
1196 // x1 : closure
1197 __ Ldr(x8,
1198 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1199 __ Str(x8, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset));
1200 __ RecordWriteField(closure, JSFunction::kNextFunctionLinkOffset, x8, x0,
1201 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1202 OMIT_SMI_CHECK);
1203 const int function_list_offset =
1204 Context::SlotOffset(Context::OPTIMIZED_FUNCTIONS_LIST);
1205 __ Str(closure,
1206 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1207 __ Mov(x5, closure);
1208 __ RecordWriteContextSlot(native_context, function_list_offset, x5, x0,
1209 kLRHasNotBeenSaved, kDontSaveFPRegs);
1210 __ Jump(entry);
1211
1212 __ Bind(&loop_bottom);
1213 __ Sub(index, index, Operand(SharedFunctionInfo::kEntryLength));
1214 __ Cmp(index, Operand(1));
1215 __ B(gt, &loop_top);
1216
1217 // We found neither literals nor code.
1218 __ B(&gotta_call_runtime);
1219
1220 __ Bind(&maybe_call_runtime);
1221
1222 // Last possibility. Check the context free optimized code map entry.
1223 __ Ldr(entry, FieldMemOperand(map, FixedArray::kHeaderSize +
1224 SharedFunctionInfo::kSharedCodeIndex));
1225 __ Ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1226 __ JumpIfSmi(entry, &try_shared);
1227
1228 // Store code entry in the closure.
1229 __ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1230 __ B(&install_optimized_code_and_tailcall);
1231
1232 __ Bind(&try_shared);
1233 // Is the full code valid?
1234 __ Ldr(entry,
1235 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1236 __ Ldr(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset));
1237 __ Ldr(x5, FieldMemOperand(entry, Code::kFlagsOffset));
1238 __ and_(x5, x5, Operand(Code::KindField::kMask));
1239 __ Mov(x5, Operand(x5, LSR, Code::KindField::kShift));
1240 __ Cmp(x5, Operand(Code::BUILTIN));
1241 __ B(eq, &gotta_call_runtime);
1242 // Yes, install the full code.
1243 __ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1244 __ Str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1245 __ Jump(entry);
1246
1247 __ Bind(&gotta_call_runtime);
1119 CallRuntimePassFunction(masm, Runtime::kCompileLazy); 1248 CallRuntimePassFunction(masm, Runtime::kCompileLazy);
1120 GenerateTailCallToReturnedCode(masm); 1249 GenerateTailCallToReturnedCode(masm);
1121 } 1250 }
1122 1251
1123 1252
1124 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { 1253 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) {
1125 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); 1254 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent);
1126 GenerateTailCallToReturnedCode(masm); 1255 GenerateTailCallToReturnedCode(masm);
1127 } 1256 }
1128 1257
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2744 } 2873 }
2745 } 2874 }
2746 2875
2747 2876
2748 #undef __ 2877 #undef __
2749 2878
2750 } // namespace internal 2879 } // namespace internal
2751 } // namespace v8 2880 } // namespace v8
2752 2881
2753 #endif // V8_TARGET_ARCH_ARM 2882 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/arm64/macro-assembler-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698