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

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

Issue 2402663002: Reland "[turbofan] Discard the shared code entry in the optimized code map." (Closed)
Patch Set: Patch failure(?) Created 4 years, 2 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/arm/builtins-arm.cc ('k') | src/builtins/ia32/builtins-ia32.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 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 } 1374 }
1375 1375
1376 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 1376 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
1377 // ----------- S t a t e ------------- 1377 // ----------- S t a t e -------------
1378 // -- x0 : argument count (preserved for callee) 1378 // -- x0 : argument count (preserved for callee)
1379 // -- x3 : new target (preserved for callee) 1379 // -- x3 : new target (preserved for callee)
1380 // -- x1 : target function (preserved for callee) 1380 // -- x1 : target function (preserved for callee)
1381 // ----------------------------------- 1381 // -----------------------------------
1382 // First lookup code, maybe we don't need to compile! 1382 // First lookup code, maybe we don't need to compile!
1383 Label gotta_call_runtime; 1383 Label gotta_call_runtime;
1384 Label maybe_call_runtime;
1385 Label try_shared; 1384 Label try_shared;
1386 Label loop_top, loop_bottom; 1385 Label loop_top, loop_bottom;
1387 1386
1388 Register closure = x1; 1387 Register closure = x1;
1389 Register map = x13; 1388 Register map = x13;
1390 Register index = x2; 1389 Register index = x2;
1391 __ Ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1390 __ Ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1392 __ Ldr(map, 1391 __ Ldr(map,
1393 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1392 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1394 __ Ldrsw(index, UntagSmiFieldMemOperand(map, FixedArray::kLengthOffset)); 1393 __ Ldrsw(index, UntagSmiFieldMemOperand(map, FixedArray::kLengthOffset));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, x7, 1431 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, x7,
1433 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, 1432 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1434 OMIT_SMI_CHECK); 1433 OMIT_SMI_CHECK);
1435 1434
1436 // Code available? 1435 // Code available?
1437 Register entry = x7; 1436 Register entry = x7;
1438 __ Ldr(entry, 1437 __ Ldr(entry,
1439 FieldMemOperand(array_pointer, 1438 FieldMemOperand(array_pointer,
1440 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1439 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1441 __ Ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); 1440 __ Ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1442 __ JumpIfSmi(entry, &maybe_call_runtime); 1441 __ JumpIfSmi(entry, &try_shared);
1443 1442
1444 // Found literals and code. Get them into the closure and return. 1443 // Found literals and code. Get them into the closure and return.
1445 __ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); 1444 __ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1446
1447 Label install_optimized_code_and_tailcall;
1448 __ Bind(&install_optimized_code_and_tailcall);
1449 __ Str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); 1445 __ Str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1450 __ RecordWriteCodeEntryField(closure, entry, x5); 1446 __ RecordWriteCodeEntryField(closure, entry, x5);
1451 1447
1452 // Link the closure into the optimized function list. 1448 // Link the closure into the optimized function list.
1453 // x7 : code entry 1449 // x7 : code entry
1454 // x4 : native context 1450 // x4 : native context
1455 // x1 : closure 1451 // x1 : closure
1456 __ Ldr(x8, 1452 __ Ldr(x8,
1457 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); 1453 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1458 __ Str(x8, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset)); 1454 __ Str(x8, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset));
(...skipping 10 matching lines...) Expand all
1469 __ Jump(entry); 1465 __ Jump(entry);
1470 1466
1471 __ Bind(&loop_bottom); 1467 __ Bind(&loop_bottom);
1472 __ Sub(index, index, Operand(SharedFunctionInfo::kEntryLength)); 1468 __ Sub(index, index, Operand(SharedFunctionInfo::kEntryLength));
1473 __ Cmp(index, Operand(1)); 1469 __ Cmp(index, Operand(1));
1474 __ B(gt, &loop_top); 1470 __ B(gt, &loop_top);
1475 1471
1476 // We found neither literals nor code. 1472 // We found neither literals nor code.
1477 __ B(&gotta_call_runtime); 1473 __ B(&gotta_call_runtime);
1478 1474
1479 __ Bind(&maybe_call_runtime);
1480
1481 // Last possibility. Check the context free optimized code map entry.
1482 __ Ldr(entry, FieldMemOperand(map, FixedArray::kHeaderSize +
1483 SharedFunctionInfo::kSharedCodeIndex));
1484 __ Ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1485 __ JumpIfSmi(entry, &try_shared);
1486
1487 // Store code entry in the closure.
1488 __ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1489 __ B(&install_optimized_code_and_tailcall);
1490
1491 __ Bind(&try_shared); 1475 __ Bind(&try_shared);
1492 // Is the full code valid? 1476 // Is the full code valid?
1493 __ Ldr(entry, 1477 __ Ldr(entry,
1494 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1478 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1495 __ Ldr(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset)); 1479 __ Ldr(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset));
1496 __ Ldr(x5, FieldMemOperand(entry, Code::kFlagsOffset)); 1480 __ Ldr(x5, FieldMemOperand(entry, Code::kFlagsOffset));
1497 __ and_(x5, x5, Operand(Code::KindField::kMask)); 1481 __ and_(x5, x5, Operand(Code::KindField::kMask));
1498 __ Mov(x5, Operand(x5, LSR, Code::KindField::kShift)); 1482 __ Mov(x5, Operand(x5, LSR, Code::KindField::kShift));
1499 __ Cmp(x5, Operand(Code::BUILTIN)); 1483 __ Cmp(x5, Operand(Code::BUILTIN));
1500 __ B(eq, &gotta_call_runtime); 1484 __ B(eq, &gotta_call_runtime);
(...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after
3022 __ Unreachable(); 3006 __ Unreachable();
3023 } 3007 }
3024 } 3008 }
3025 3009
3026 #undef __ 3010 #undef __
3027 3011
3028 } // namespace internal 3012 } // namespace internal
3029 } // namespace v8 3013 } // namespace v8
3030 3014
3031 #endif // V8_TARGET_ARCH_ARM 3015 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/builtins/arm/builtins-arm.cc ('k') | src/builtins/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698