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

Side by Side Diff: src/builtins/mips/builtins-mips.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/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 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 } 1364 }
1365 1365
1366 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 1366 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
1367 // ----------- S t a t e ------------- 1367 // ----------- S t a t e -------------
1368 // -- a0 : argument count (preserved for callee) 1368 // -- a0 : argument count (preserved for callee)
1369 // -- a3 : new target (preserved for callee) 1369 // -- a3 : new target (preserved for callee)
1370 // -- a1 : target function (preserved for callee) 1370 // -- a1 : target function (preserved for callee)
1371 // ----------------------------------- 1371 // -----------------------------------
1372 // First lookup code, maybe we don't need to compile! 1372 // First lookup code, maybe we don't need to compile!
1373 Label gotta_call_runtime, gotta_call_runtime_no_stack; 1373 Label gotta_call_runtime, gotta_call_runtime_no_stack;
1374 Label maybe_call_runtime;
1375 Label try_shared; 1374 Label try_shared;
1376 Label loop_top, loop_bottom; 1375 Label loop_top, loop_bottom;
1377 1376
1378 Register argument_count = a0; 1377 Register argument_count = a0;
1379 Register closure = a1; 1378 Register closure = a1;
1380 Register new_target = a3; 1379 Register new_target = a3;
1381 __ push(argument_count); 1380 __ push(argument_count);
1382 __ push(new_target); 1381 __ push(new_target);
1383 __ push(closure); 1382 __ push(closure);
1384 1383
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, 1427 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1429 OMIT_SMI_CHECK); 1428 OMIT_SMI_CHECK);
1430 __ pop(index); 1429 __ pop(index);
1431 1430
1432 // Code available? 1431 // Code available?
1433 Register entry = t0; 1432 Register entry = t0;
1434 __ lw(entry, 1433 __ lw(entry,
1435 FieldMemOperand(array_pointer, 1434 FieldMemOperand(array_pointer,
1436 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1435 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1437 __ lw(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); 1436 __ lw(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1438 __ JumpIfSmi(entry, &maybe_call_runtime); 1437 __ JumpIfSmi(entry, &try_shared);
1439 1438
1440 // Found literals and code. Get them into the closure and return. 1439 // Found literals and code. Get them into the closure and return.
1441 __ pop(closure); 1440 __ pop(closure);
1442 // Store code entry in the closure. 1441 // Store code entry in the closure.
1443 __ Addu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); 1442 __ Addu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1444
1445 Label install_optimized_code_and_tailcall;
1446 __ bind(&install_optimized_code_and_tailcall);
1447 __ sw(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); 1443 __ sw(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1448 __ RecordWriteCodeEntryField(closure, entry, t1); 1444 __ RecordWriteCodeEntryField(closure, entry, t1);
1449 1445
1450 // Link the closure into the optimized function list. 1446 // Link the closure into the optimized function list.
1451 // t0 : code entry 1447 // t0 : code entry
1452 // a3 : native context 1448 // a3 : native context
1453 // a1 : closure 1449 // a1 : closure
1454 __ lw(t1, 1450 __ lw(t1,
1455 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); 1451 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1456 __ sw(t1, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset)); 1452 __ sw(t1, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset));
(...skipping 14 matching lines...) Expand all
1471 __ Jump(entry); 1467 __ Jump(entry);
1472 1468
1473 __ bind(&loop_bottom); 1469 __ bind(&loop_bottom);
1474 __ Subu(index, index, 1470 __ Subu(index, index,
1475 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); 1471 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength)));
1476 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); 1472 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1)));
1477 1473
1478 // We found neither literals nor code. 1474 // We found neither literals nor code.
1479 __ jmp(&gotta_call_runtime); 1475 __ jmp(&gotta_call_runtime);
1480 1476
1481 __ bind(&maybe_call_runtime); 1477 __ bind(&try_shared);
1482 __ pop(closure); 1478 __ pop(closure);
1483
1484 // Last possibility. Check the context free optimized code map entry.
1485 __ lw(entry, FieldMemOperand(map, FixedArray::kHeaderSize +
1486 SharedFunctionInfo::kSharedCodeIndex));
1487 __ lw(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1488 __ JumpIfSmi(entry, &try_shared);
1489
1490 // Store code entry in the closure.
1491 __ Addu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1492 __ jmp(&install_optimized_code_and_tailcall);
1493
1494 __ bind(&try_shared);
1495 __ pop(new_target); 1479 __ pop(new_target);
1496 __ pop(argument_count); 1480 __ pop(argument_count);
1497 // Is the full code valid? 1481 // Is the full code valid?
1498 __ lw(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1482 __ lw(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1499 __ lw(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset)); 1483 __ lw(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset));
1500 __ lw(t1, FieldMemOperand(entry, Code::kFlagsOffset)); 1484 __ lw(t1, FieldMemOperand(entry, Code::kFlagsOffset));
1501 __ And(t1, t1, Operand(Code::KindField::kMask)); 1485 __ And(t1, t1, Operand(Code::KindField::kMask));
1502 __ srl(t1, t1, Code::KindField::kShift); 1486 __ srl(t1, t1, Code::KindField::kShift);
1503 __ Branch(&gotta_call_runtime_no_stack, eq, t1, Operand(Code::BUILTIN)); 1487 __ Branch(&gotta_call_runtime_no_stack, eq, t1, Operand(Code::BUILTIN));
1504 // Yes, install the full code. 1488 // Yes, install the full code.
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
2997 __ break_(0xCC); 2981 __ break_(0xCC);
2998 } 2982 }
2999 } 2983 }
3000 2984
3001 #undef __ 2985 #undef __
3002 2986
3003 } // namespace internal 2987 } // namespace internal
3004 } // namespace v8 2988 } // namespace v8
3005 2989
3006 #endif // V8_TARGET_ARCH_MIPS 2990 #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