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

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

Issue 1670813005: Revert of Type Feedback Vector lives in the closure (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | src/arm/macro-assembler-arm.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_ARM 5 #if V8_TARGET_ARCH_ARM
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 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 // This simulates the initial call to bytecode handlers in interpreter entry 1241 // This simulates the initial call to bytecode handlers in interpreter entry
1242 // trampoline. The return will never actually be taken, but our stack walker 1242 // trampoline. The return will never actually be taken, but our stack walker
1243 // uses this address to determine whether a frame is interpreted. 1243 // uses this address to determine whether a frame is interpreted.
1244 __ Move(lr, masm->isolate()->builtins()->InterpreterEntryTrampoline()); 1244 __ Move(lr, masm->isolate()->builtins()->InterpreterEntryTrampoline());
1245 1245
1246 Generate_EnterBytecodeDispatch(masm); 1246 Generate_EnterBytecodeDispatch(masm);
1247 } 1247 }
1248 1248
1249 1249
1250 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 1250 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
1251 // ----------- S t a t e -------------
1252 // -- r3 : new target (preserved for callee)
1253 // -- r1 : target function (preserved for callee)
1254 // -----------------------------------
1255 // First lookup code, maybe we don't need to compile!
1256 Label gotta_call_runtime, gotta_call_runtime_no_stack;
1257 Label maybe_call_runtime;
1258 Label try_shared;
1259 Label loop_top, loop_bottom;
1260
1261 Register closure = r1;
1262 Register new_target = r3;
1263 __ push(new_target);
1264 __ push(closure);
1265
1266 Register map = r0;
1267 Register index = r2;
1268 __ ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1269 __ ldr(map,
1270 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1271 __ ldr(index, FieldMemOperand(map, FixedArray::kLengthOffset));
1272 __ cmp(index, Operand(Smi::FromInt(2)));
1273 __ b(lt, &gotta_call_runtime);
1274
1275 // Find literals.
1276 // r3 : native context
1277 // r2 : length / index
1278 // r0 : optimized code map
1279 // stack[0] : new target
1280 // stack[4] : closure
1281 Register native_context = r3;
1282 __ ldr(native_context, NativeContextMemOperand());
1283
1284 __ bind(&loop_top);
1285 Register temp = r1;
1286 Register array_pointer = r5;
1287
1288 // Does the native context match?
1289 __ add(array_pointer, map, Operand::PointerOffsetFromSmiKey(index));
1290 __ ldr(temp, FieldMemOperand(array_pointer,
1291 SharedFunctionInfo::OffsetToPreviousContext()));
1292 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1293 __ cmp(temp, native_context);
1294 __ b(ne, &loop_bottom);
1295 // OSR id set to none?
1296 __ ldr(temp, FieldMemOperand(array_pointer,
1297 SharedFunctionInfo::OffsetToPreviousOsrAstId()));
1298 const int bailout_id = BailoutId::None().ToInt();
1299 __ cmp(temp, Operand(Smi::FromInt(bailout_id)));
1300 __ b(ne, &loop_bottom);
1301 // Literals available?
1302 __ ldr(temp, FieldMemOperand(array_pointer,
1303 SharedFunctionInfo::OffsetToPreviousLiterals()));
1304 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1305 __ JumpIfSmi(temp, &gotta_call_runtime);
1306
1307 // Save the literals in the closure.
1308 __ ldr(r4, MemOperand(sp, 0));
1309 __ str(temp, FieldMemOperand(r4, JSFunction::kLiteralsOffset));
1310 __ push(index);
1311 __ RecordWriteField(r4, JSFunction::kLiteralsOffset, temp, index,
1312 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1313 OMIT_SMI_CHECK);
1314 __ pop(index);
1315
1316 // Code available?
1317 Register entry = r4;
1318 __ ldr(entry,
1319 FieldMemOperand(array_pointer,
1320 SharedFunctionInfo::OffsetToPreviousCachedCode()));
1321 __ ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1322 __ JumpIfSmi(entry, &maybe_call_runtime);
1323
1324 // Found literals and code. Get them into the closure and return.
1325 __ pop(closure);
1326 // Store code entry in the closure.
1327 __ add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1328
1329 Label install_optimized_code_and_tailcall;
1330 __ bind(&install_optimized_code_and_tailcall);
1331 __ str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1332 __ RecordWriteCodeEntryField(closure, entry, r5);
1333
1334 // Link the closure into the optimized function list.
1335 // r4 : code entry
1336 // r3 : native context
1337 // r1 : closure
1338 __ ldr(r5,
1339 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1340 __ str(r5, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset));
1341 __ RecordWriteField(closure, JSFunction::kNextFunctionLinkOffset, r5, r0,
1342 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1343 OMIT_SMI_CHECK);
1344 const int function_list_offset =
1345 Context::SlotOffset(Context::OPTIMIZED_FUNCTIONS_LIST);
1346 __ str(closure,
1347 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1348 // Save closure before the write barrier.
1349 __ mov(r5, closure);
1350 __ RecordWriteContextSlot(native_context, function_list_offset, closure, r0,
1351 kLRHasNotBeenSaved, kDontSaveFPRegs);
1352 __ mov(closure, r5);
1353 __ pop(new_target);
1354 __ Jump(entry);
1355
1356 __ bind(&loop_bottom);
1357 __ sub(index, index, Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength)));
1358 __ cmp(index, Operand(Smi::FromInt(1)));
1359 __ b(gt, &loop_top);
1360
1361 // We found neither literals nor code.
1362 __ jmp(&gotta_call_runtime);
1363
1364 __ bind(&maybe_call_runtime);
1365 __ pop(closure);
1366
1367 // Last possibility. Check the context free optimized code map entry.
1368 __ ldr(entry, FieldMemOperand(map, FixedArray::kHeaderSize +
1369 SharedFunctionInfo::kSharedCodeIndex));
1370 __ ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1371 __ JumpIfSmi(entry, &try_shared);
1372
1373 // Store code entry in the closure.
1374 __ add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1375 __ jmp(&install_optimized_code_and_tailcall);
1376
1377 __ bind(&try_shared);
1378 __ pop(new_target);
1379 // Is the full code valid?
1380 __ ldr(entry,
1381 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1382 __ ldr(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset));
1383 __ ldr(r5, FieldMemOperand(entry, Code::kFlagsOffset));
1384 __ and_(r5, r5, Operand(Code::KindField::kMask));
1385 __ mov(r5, Operand(r5, LSR, Code::KindField::kShift));
1386 __ cmp(r5, Operand(Code::BUILTIN));
1387 __ b(eq, &gotta_call_runtime_no_stack);
1388 // Yes, install the full code.
1389 __ add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1390 __ str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1391 __ RecordWriteCodeEntryField(closure, entry, r5);
1392 __ Jump(entry);
1393
1394 __ bind(&gotta_call_runtime);
1395 __ pop(closure);
1396 __ pop(new_target);
1397 __ bind(&gotta_call_runtime_no_stack);
1398 CallRuntimePassFunction(masm, Runtime::kCompileLazy); 1251 CallRuntimePassFunction(masm, Runtime::kCompileLazy);
1399 GenerateTailCallToReturnedCode(masm); 1252 GenerateTailCallToReturnedCode(masm);
1400 } 1253 }
1401 1254
1402 1255
1403 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { 1256 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) {
1404 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); 1257 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent);
1405 GenerateTailCallToReturnedCode(masm); 1258 GenerateTailCallToReturnedCode(masm);
1406 } 1259 }
1407 1260
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
2835 } 2688 }
2836 } 2689 }
2837 2690
2838 2691
2839 #undef __ 2692 #undef __
2840 2693
2841 } // namespace internal 2694 } // namespace internal
2842 } // namespace v8 2695 } // namespace v8
2843 2696
2844 #endif // V8_TARGET_ARCH_ARM 2697 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698