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

Side by Side Diff: src/crankshaft/x87/lithium-codegen-x87.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/x64/lithium-x64.cc ('k') | src/crankshaft/x87/lithium-x87.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 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_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/crankshaft/x87/lithium-codegen-x87.h" 7 #include "src/crankshaft/x87/lithium-codegen-x87.h"
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 5401 matching lines...) Expand 10 before | Expand all | Expand 10 after
5412 // Allocate memory for the object. 5412 // Allocate memory for the object.
5413 AllocationFlags flags = NO_ALLOCATION_FLAGS; 5413 AllocationFlags flags = NO_ALLOCATION_FLAGS;
5414 if (instr->hydrogen()->MustAllocateDoubleAligned()) { 5414 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
5415 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); 5415 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
5416 } 5416 }
5417 if (instr->hydrogen()->IsOldSpaceAllocation()) { 5417 if (instr->hydrogen()->IsOldSpaceAllocation()) {
5418 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); 5418 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5419 flags = static_cast<AllocationFlags>(flags | PRETENURE); 5419 flags = static_cast<AllocationFlags>(flags | PRETENURE);
5420 } 5420 }
5421 5421
5422 if (instr->hydrogen()->IsAllocationFoldingDominator()) {
5423 flags = static_cast<AllocationFlags>(flags | ALLOCATION_FOLDING_DOMINATOR);
5424 }
5425
5426 if (instr->hydrogen()->IsAllocationFolded()) {
5427 flags = static_cast<AllocationFlags>(flags | ALLOCATION_FOLDED);
5428 }
5429
5422 if (instr->size()->IsConstantOperand()) { 5430 if (instr->size()->IsConstantOperand()) {
5423 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); 5431 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5424 CHECK(size <= Page::kMaxRegularHeapObjectSize); 5432 CHECK(size <= Page::kMaxRegularHeapObjectSize);
5425 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags); 5433 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags);
5426 } else { 5434 } else {
5427 Register size = ToRegister(instr->size()); 5435 Register size = ToRegister(instr->size());
5428 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags); 5436 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags);
5429 } 5437 }
5430 5438
5431 __ bind(deferred->exit()); 5439 __ bind(deferred->exit());
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
5480 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); 5488 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5481 flags = AllocateTargetSpace::update(flags, OLD_SPACE); 5489 flags = AllocateTargetSpace::update(flags, OLD_SPACE);
5482 } else { 5490 } else {
5483 flags = AllocateTargetSpace::update(flags, NEW_SPACE); 5491 flags = AllocateTargetSpace::update(flags, NEW_SPACE);
5484 } 5492 }
5485 __ push(Immediate(Smi::FromInt(flags))); 5493 __ push(Immediate(Smi::FromInt(flags)));
5486 5494
5487 CallRuntimeFromDeferred( 5495 CallRuntimeFromDeferred(
5488 Runtime::kAllocateInTargetSpace, 2, instr, instr->context()); 5496 Runtime::kAllocateInTargetSpace, 2, instr, instr->context());
5489 __ StoreToSafepointRegisterSlot(result, eax); 5497 __ StoreToSafepointRegisterSlot(result, eax);
5498
5499 if (instr->hydrogen()->IsAllocationFoldingDominator()) {
5500 AllocationFlags allocation_flags = NO_ALLOCATION_FLAGS;
5501 if (instr->hydrogen()->IsOldSpaceAllocation()) {
5502 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5503 allocation_flags = static_cast<AllocationFlags>(flags | PRETENURE);
5504 }
5505 // If the allocation folding dominator allocate triggered a GC, allocation
5506 // happend in the runtime. We have to reset the top pointer to virtually
5507 // undo the allocation.
5508 ExternalReference allocation_top =
5509 AllocationUtils::GetAllocationTopReference(isolate(), allocation_flags);
5510 __ sub(eax, Immediate(kHeapObjectTag));
5511 __ mov(Operand::StaticVariable(allocation_top), eax);
5512 __ add(eax, Immediate(kHeapObjectTag));
5513 }
5514 }
5515
5516 void LCodeGen::DoFastAllocate(LFastAllocate* instr) {
5517 DCHECK(instr->hydrogen()->IsAllocationFolded());
5518 Register result = ToRegister(instr->result());
5519 Register temp = ToRegister(instr->temp());
5520
5521 AllocationFlags flags = NO_ALLOCATION_FLAGS;
5522 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
5523 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
5524 }
5525 if (instr->hydrogen()->IsOldSpaceAllocation()) {
5526 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5527 flags = static_cast<AllocationFlags>(flags | PRETENURE);
5528 }
5529 if (!instr->hydrogen()->IsAllocationFoldingDominator()) {
5530 if (instr->size()->IsConstantOperand()) {
5531 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5532 CHECK(size <= Page::kMaxRegularHeapObjectSize);
5533 __ FastAllocate(size, result, temp, flags);
5534 } else {
5535 Register size = ToRegister(instr->size());
5536 __ FastAllocate(size, result, temp, flags);
5537 }
5538 }
5490 } 5539 }
5491 5540
5492 5541
5493 void LCodeGen::DoTypeof(LTypeof* instr) { 5542 void LCodeGen::DoTypeof(LTypeof* instr) {
5494 DCHECK(ToRegister(instr->context()).is(esi)); 5543 DCHECK(ToRegister(instr->context()).is(esi));
5495 DCHECK(ToRegister(instr->value()).is(ebx)); 5544 DCHECK(ToRegister(instr->value()).is(ebx));
5496 Label end, do_call; 5545 Label end, do_call;
5497 Register value_register = ToRegister(instr->value()); 5546 Register value_register = ToRegister(instr->value());
5498 __ JumpIfNotSmi(value_register, &do_call); 5547 __ JumpIfNotSmi(value_register, &do_call);
5499 __ mov(eax, Immediate(isolate()->factory()->number_string())); 5548 __ mov(eax, Immediate(isolate()->factory()->number_string()));
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
5840 __ bind(deferred->exit()); 5889 __ bind(deferred->exit());
5841 __ bind(&done); 5890 __ bind(&done);
5842 } 5891 }
5843 5892
5844 #undef __ 5893 #undef __
5845 5894
5846 } // namespace internal 5895 } // namespace internal
5847 } // namespace v8 5896 } // namespace v8
5848 5897
5849 #endif // V8_TARGET_ARCH_X87 5898 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/crankshaft/x64/lithium-x64.cc ('k') | src/crankshaft/x87/lithium-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698