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

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

Issue 2401043002: PPC/s390: Reland "[turbofan] Discard the shared code entry in the optimized code map." (Closed)
Patch Set: 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 | « no previous file | src/builtins/s390/builtins-s390.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 5 #if V8_TARGET_ARCH_PPC
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 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 } 1391 }
1392 1392
1393 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 1393 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
1394 // ----------- S t a t e ------------- 1394 // ----------- S t a t e -------------
1395 // -- r3 : argument count (preserved for callee) 1395 // -- r3 : argument count (preserved for callee)
1396 // -- r6 : new target (preserved for callee) 1396 // -- r6 : new target (preserved for callee)
1397 // -- r4 : target function (preserved for callee) 1397 // -- r4 : target function (preserved for callee)
1398 // ----------------------------------- 1398 // -----------------------------------
1399 // First lookup code, maybe we don't need to compile! 1399 // First lookup code, maybe we don't need to compile!
1400 Label gotta_call_runtime; 1400 Label gotta_call_runtime;
1401 Label maybe_call_runtime;
1402 Label try_shared; 1401 Label try_shared;
1403 Label loop_top, loop_bottom; 1402 Label loop_top, loop_bottom;
1404 1403
1405 Register closure = r4; 1404 Register closure = r4;
1406 Register map = r9; 1405 Register map = r9;
1407 Register index = r5; 1406 Register index = r5;
1408 __ LoadP(map, 1407 __ LoadP(map,
1409 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1408 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1410 __ LoadP(map, 1409 __ LoadP(map,
1411 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1410 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r7, 1452 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r7,
1454 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, 1453 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1455 OMIT_SMI_CHECK); 1454 OMIT_SMI_CHECK);
1456 1455
1457 // Code available? 1456 // Code available?
1458 Register entry = r7; 1457 Register entry = r7;
1459 __ LoadP(entry, 1458 __ LoadP(entry,
1460 FieldMemOperand(array_pointer, 1459 FieldMemOperand(array_pointer,
1461 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1460 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1462 __ LoadP(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); 1461 __ LoadP(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1463 __ JumpIfSmi(entry, &maybe_call_runtime); 1462 __ JumpIfSmi(entry, &try_shared);
1464 1463
1465 // Found literals and code. Get them into the closure and return. 1464 // Found literals and code. Get them into the closure and return.
1466 // Store code entry in the closure. 1465 // Store code entry in the closure.
1467 __ addi(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); 1466 __ addi(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1468
1469 Label install_optimized_code_and_tailcall;
1470 __ bind(&install_optimized_code_and_tailcall);
1471 __ StoreP(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset), r0); 1467 __ StoreP(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset), r0);
1472 __ RecordWriteCodeEntryField(closure, entry, r8); 1468 __ RecordWriteCodeEntryField(closure, entry, r8);
1473 1469
1474 // Link the closure into the optimized function list. 1470 // Link the closure into the optimized function list.
1475 // r7 : code entry 1471 // r7 : code entry
1476 // r10: native context 1472 // r10: native context
1477 // r4 : closure 1473 // r4 : closure
1478 __ LoadP( 1474 __ LoadP(
1479 r8, ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); 1475 r8, ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1480 __ StoreP(r8, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset), 1476 __ StoreP(r8, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset),
(...skipping 14 matching lines...) Expand all
1495 1491
1496 __ bind(&loop_bottom); 1492 __ bind(&loop_bottom);
1497 __ SubSmiLiteral(index, index, Smi::FromInt(SharedFunctionInfo::kEntryLength), 1493 __ SubSmiLiteral(index, index, Smi::FromInt(SharedFunctionInfo::kEntryLength),
1498 r0); 1494 r0);
1499 __ CmpSmiLiteral(index, Smi::FromInt(1), r0); 1495 __ CmpSmiLiteral(index, Smi::FromInt(1), r0);
1500 __ bgt(&loop_top); 1496 __ bgt(&loop_top);
1501 1497
1502 // We found neither literals nor code. 1498 // We found neither literals nor code.
1503 __ b(&gotta_call_runtime); 1499 __ b(&gotta_call_runtime);
1504 1500
1505 __ bind(&maybe_call_runtime);
1506
1507 // Last possibility. Check the context free optimized code map entry.
1508 __ LoadP(entry,
1509 FieldMemOperand(map, FixedArray::kHeaderSize +
1510 SharedFunctionInfo::kSharedCodeIndex));
1511 __ LoadP(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1512 __ JumpIfSmi(entry, &try_shared);
1513
1514 // Store code entry in the closure.
1515 __ addi(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1516 __ b(&install_optimized_code_and_tailcall);
1517
1518 __ bind(&try_shared); 1501 __ bind(&try_shared);
1519 // Is the full code valid? 1502 // Is the full code valid?
1520 __ LoadP(entry, 1503 __ LoadP(entry,
1521 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1504 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1522 __ LoadP(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset)); 1505 __ LoadP(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset));
1523 __ lwz(r8, FieldMemOperand(entry, Code::kFlagsOffset)); 1506 __ lwz(r8, FieldMemOperand(entry, Code::kFlagsOffset));
1524 __ DecodeField<Code::KindField>(r8); 1507 __ DecodeField<Code::KindField>(r8);
1525 __ cmpi(r8, Operand(Code::BUILTIN)); 1508 __ cmpi(r8, Operand(Code::BUILTIN));
1526 __ beq(&gotta_call_runtime); 1509 __ beq(&gotta_call_runtime);
1527 // Yes, install the full code. 1510 // Yes, install the full code.
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after
3012 __ CallRuntime(Runtime::kThrowStackOverflow); 2995 __ CallRuntime(Runtime::kThrowStackOverflow);
3013 __ bkpt(0); 2996 __ bkpt(0);
3014 } 2997 }
3015 } 2998 }
3016 2999
3017 #undef __ 3000 #undef __
3018 } // namespace internal 3001 } // namespace internal
3019 } // namespace v8 3002 } // namespace v8
3020 3003
3021 #endif // V8_TARGET_ARCH_PPC 3004 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | src/builtins/s390/builtins-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698