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

Side by Side Diff: src/crankshaft/arm64/lithium-codegen-arm64.cc

Issue 1899813003: [crankshaft] Fragmentation-free allocation folding. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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/crankshaft/arm64/lithium-arm64.cc ('k') | src/crankshaft/hydrogen.h » ('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 #include "src/crankshaft/arm64/lithium-codegen-arm64.h" 5 #include "src/crankshaft/arm64/lithium-codegen-arm64.h"
6 6
7 #include "src/arm64/frames-arm64.h" 7 #include "src/arm64/frames-arm64.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 AllocationFlags flags = NO_ALLOCATION_FLAGS; 1419 AllocationFlags flags = NO_ALLOCATION_FLAGS;
1420 if (instr->hydrogen()->MustAllocateDoubleAligned()) { 1420 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
1421 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); 1421 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
1422 } 1422 }
1423 1423
1424 if (instr->hydrogen()->IsOldSpaceAllocation()) { 1424 if (instr->hydrogen()->IsOldSpaceAllocation()) {
1425 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); 1425 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
1426 flags = static_cast<AllocationFlags>(flags | PRETENURE); 1426 flags = static_cast<AllocationFlags>(flags | PRETENURE);
1427 } 1427 }
1428 1428
1429 if (instr->hydrogen()->IsAllocationFoldingDominator()) {
1430 flags = static_cast<AllocationFlags>(flags | ALLOCATION_FOLDING_DOMINATOR);
1431 }
1432
1433 if (instr->hydrogen()->IsAllocationFolded()) {
1434 flags = static_cast<AllocationFlags>(flags | ALLOCATION_FOLDED);
1435 }
1436
1429 if (instr->size()->IsConstantOperand()) { 1437 if (instr->size()->IsConstantOperand()) {
1430 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); 1438 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
1431 CHECK(size <= Page::kMaxRegularHeapObjectSize); 1439 CHECK(size <= Page::kMaxRegularHeapObjectSize);
1432 __ Allocate(size, result, temp1, temp2, deferred->entry(), flags); 1440 __ Allocate(size, result, temp1, temp2, deferred->entry(), flags);
1433 } else { 1441 } else {
1434 Register size = ToRegister32(instr->size()); 1442 Register size = ToRegister32(instr->size());
1435 __ Sxtw(size.X(), size); 1443 __ Sxtw(size.X(), size);
1436 __ Allocate(size.X(), result, temp1, temp2, deferred->entry(), flags); 1444 __ Allocate(size.X(), result, temp1, temp2, deferred->entry(), flags);
1437 } 1445 }
1438 1446
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 flags = AllocateTargetSpace::update(flags, OLD_SPACE); 1488 flags = AllocateTargetSpace::update(flags, OLD_SPACE);
1481 } else { 1489 } else {
1482 flags = AllocateTargetSpace::update(flags, NEW_SPACE); 1490 flags = AllocateTargetSpace::update(flags, NEW_SPACE);
1483 } 1491 }
1484 __ Mov(x10, Smi::FromInt(flags)); 1492 __ Mov(x10, Smi::FromInt(flags));
1485 __ Push(size, x10); 1493 __ Push(size, x10);
1486 1494
1487 CallRuntimeFromDeferred( 1495 CallRuntimeFromDeferred(
1488 Runtime::kAllocateInTargetSpace, 2, instr, instr->context()); 1496 Runtime::kAllocateInTargetSpace, 2, instr, instr->context());
1489 __ StoreToSafepointRegisterSlot(x0, ToRegister(instr->result())); 1497 __ StoreToSafepointRegisterSlot(x0, ToRegister(instr->result()));
1498
1499 if (instr->hydrogen()->IsAllocationFoldingDominator()) {
1500 AllocationFlags allocation_flags = NO_ALLOCATION_FLAGS;
1501 if (instr->hydrogen()->IsOldSpaceAllocation()) {
1502 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
1503 allocation_flags = static_cast<AllocationFlags>(flags | PRETENURE);
1504 }
1505 // If the allocation folding dominator allocate triggered a GC, allocation
1506 // happend in the runtime. We have to reset the top pointer to virtually
1507 // undo the allocation.
1508 ExternalReference allocation_top =
1509 AllocationUtils::GetAllocationTopReference(isolate(), allocation_flags);
1510 Register top_address = x10;
1511 __ Sub(x0, x0, Operand(kHeapObjectTag));
1512 __ Mov(top_address, Operand(allocation_top));
1513 __ Str(x0, MemOperand(top_address));
1514 __ Add(x0, x0, Operand(kHeapObjectTag));
1515 }
1516 }
1517
1518 void LCodeGen::DoFastAllocate(LFastAllocate* instr) {
1519 DCHECK(instr->hydrogen()->IsAllocationFolded());
1520 Register result = ToRegister(instr->result());
1521 Register scratch1 = ToRegister(instr->temp1());
1522 Register scratch2 = ToRegister(instr->temp2());
1523
1524 AllocationFlags flags = NO_ALLOCATION_FLAGS;
1525 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
1526 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
1527 }
1528 if (instr->hydrogen()->IsOldSpaceAllocation()) {
1529 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
1530 flags = static_cast<AllocationFlags>(flags | PRETENURE);
1531 }
1532 if (!instr->hydrogen()->IsAllocationFoldingDominator()) {
1533 if (instr->size()->IsConstantOperand()) {
1534 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
1535 CHECK(size <= Page::kMaxRegularHeapObjectSize);
1536 __ FastAllocate(size, result, scratch1, scratch2, flags);
1537 } else {
1538 Register size = ToRegister(instr->size());
1539 __ FastAllocate(size, result, scratch1, scratch2, flags);
1540 }
1541 }
1490 } 1542 }
1491 1543
1492 1544
1493 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { 1545 void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
1494 Register receiver = ToRegister(instr->receiver()); 1546 Register receiver = ToRegister(instr->receiver());
1495 Register function = ToRegister(instr->function()); 1547 Register function = ToRegister(instr->function());
1496 Register length = ToRegister32(instr->length()); 1548 Register length = ToRegister32(instr->length());
1497 1549
1498 Register elements = ToRegister(instr->elements()); 1550 Register elements = ToRegister(instr->elements());
1499 Register scratch = x5; 1551 Register scratch = x5;
(...skipping 4225 matching lines...) Expand 10 before | Expand all | Expand 10 after
5725 // Index is equal to negated out of object property index plus 1. 5777 // Index is equal to negated out of object property index plus 1.
5726 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); 5778 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2));
5727 __ Ldr(result, FieldMemOperand(result, 5779 __ Ldr(result, FieldMemOperand(result,
5728 FixedArray::kHeaderSize - kPointerSize)); 5780 FixedArray::kHeaderSize - kPointerSize));
5729 __ Bind(deferred->exit()); 5781 __ Bind(deferred->exit());
5730 __ Bind(&done); 5782 __ Bind(&done);
5731 } 5783 }
5732 5784
5733 } // namespace internal 5785 } // namespace internal
5734 } // namespace v8 5786 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/arm64/lithium-arm64.cc ('k') | src/crankshaft/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698