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

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

Issue 2401653002: [turbofan] Discard the shared code entry in the optimized code map. (Closed)
Patch Set: Comments and REBASE. 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/mips/builtins-mips.cc ('k') | src/builtins/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 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 } 1356 }
1357 1357
1358 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 1358 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
1359 // ----------- S t a t e ------------- 1359 // ----------- S t a t e -------------
1360 // -- a0 : argument count (preserved for callee) 1360 // -- a0 : argument count (preserved for callee)
1361 // -- a3 : new target (preserved for callee) 1361 // -- a3 : new target (preserved for callee)
1362 // -- a1 : target function (preserved for callee) 1362 // -- a1 : target function (preserved for callee)
1363 // ----------------------------------- 1363 // -----------------------------------
1364 // First lookup code, maybe we don't need to compile! 1364 // First lookup code, maybe we don't need to compile!
1365 Label gotta_call_runtime, gotta_call_runtime_no_stack; 1365 Label gotta_call_runtime, gotta_call_runtime_no_stack;
1366 Label maybe_call_runtime;
1367 Label try_shared; 1366 Label try_shared;
1368 Label loop_top, loop_bottom; 1367 Label loop_top, loop_bottom;
1369 1368
1370 Register argument_count = a0; 1369 Register argument_count = a0;
1371 Register closure = a1; 1370 Register closure = a1;
1372 Register new_target = a3; 1371 Register new_target = a3;
1373 __ push(argument_count); 1372 __ push(argument_count);
1374 __ push(new_target); 1373 __ push(new_target);
1375 __ push(closure); 1374 __ push(closure);
1376 1375
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, 1419 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1421 OMIT_SMI_CHECK); 1420 OMIT_SMI_CHECK);
1422 __ pop(index); 1421 __ pop(index);
1423 1422
1424 // Code available? 1423 // Code available?
1425 Register entry = a4; 1424 Register entry = a4;
1426 __ ld(entry, 1425 __ ld(entry,
1427 FieldMemOperand(array_pointer, 1426 FieldMemOperand(array_pointer,
1428 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1427 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1429 __ ld(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); 1428 __ ld(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1430 __ JumpIfSmi(entry, &maybe_call_runtime); 1429 __ JumpIfSmi(entry, &try_shared);
1431 1430
1432 // Found literals and code. Get them into the closure and return. 1431 // Found literals and code. Get them into the closure and return.
1433 __ pop(closure); 1432 __ pop(closure);
1434 // Store code entry in the closure. 1433 // Store code entry in the closure.
1435 __ Daddu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); 1434 __ Daddu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1436
1437 Label install_optimized_code_and_tailcall;
1438 __ bind(&install_optimized_code_and_tailcall);
1439 __ sd(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); 1435 __ sd(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1440 __ RecordWriteCodeEntryField(closure, entry, a5); 1436 __ RecordWriteCodeEntryField(closure, entry, a5);
1441 1437
1442 // Link the closure into the optimized function list. 1438 // Link the closure into the optimized function list.
1443 // a4 : code entry 1439 // a4 : code entry
1444 // a3 : native context 1440 // a3 : native context
1445 // a1 : closure 1441 // a1 : closure
1446 __ ld(a5, 1442 __ ld(a5,
1447 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); 1443 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1448 __ sd(a5, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset)); 1444 __ sd(a5, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset));
(...skipping 14 matching lines...) Expand all
1463 __ Jump(entry); 1459 __ Jump(entry);
1464 1460
1465 __ bind(&loop_bottom); 1461 __ bind(&loop_bottom);
1466 __ Dsubu(index, index, 1462 __ Dsubu(index, index,
1467 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); 1463 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength)));
1468 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); 1464 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1)));
1469 1465
1470 // We found neither literals nor code. 1466 // We found neither literals nor code.
1471 __ jmp(&gotta_call_runtime); 1467 __ jmp(&gotta_call_runtime);
1472 1468
1473 __ bind(&maybe_call_runtime); 1469 __ bind(&try_shared);
1474 __ pop(closure); 1470 __ pop(closure);
1475
1476 // Last possibility. Check the context free optimized code map entry.
1477 __ ld(entry, FieldMemOperand(map, FixedArray::kHeaderSize +
1478 SharedFunctionInfo::kSharedCodeIndex));
1479 __ ld(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1480 __ JumpIfSmi(entry, &try_shared);
1481
1482 // Store code entry in the closure.
1483 __ Daddu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1484 __ jmp(&install_optimized_code_and_tailcall);
1485
1486 __ bind(&try_shared);
1487 __ pop(new_target); 1471 __ pop(new_target);
1488 __ pop(argument_count); 1472 __ pop(argument_count);
1489 // Is the full code valid? 1473 // Is the full code valid?
1490 __ ld(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1474 __ ld(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1491 __ ld(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset)); 1475 __ ld(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset));
1492 __ lw(a5, FieldMemOperand(entry, Code::kFlagsOffset)); 1476 __ lw(a5, FieldMemOperand(entry, Code::kFlagsOffset));
1493 __ And(a5, a5, Operand(Code::KindField::kMask)); 1477 __ And(a5, a5, Operand(Code::KindField::kMask));
1494 __ dsrl(a5, a5, Code::KindField::kShift); 1478 __ dsrl(a5, a5, Code::KindField::kShift);
1495 __ Branch(&gotta_call_runtime_no_stack, eq, a5, Operand(Code::BUILTIN)); 1479 __ Branch(&gotta_call_runtime_no_stack, eq, a5, Operand(Code::BUILTIN));
1496 // Yes, install the full code. 1480 // Yes, install the full code.
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after
2992 __ break_(0xCC); 2976 __ break_(0xCC);
2993 } 2977 }
2994 } 2978 }
2995 2979
2996 #undef __ 2980 #undef __
2997 2981
2998 } // namespace internal 2982 } // namespace internal
2999 } // namespace v8 2983 } // namespace v8
3000 2984
3001 #endif // V8_TARGET_ARCH_MIPS64 2985 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/builtins/mips/builtins-mips.cc ('k') | src/builtins/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698