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

Side by Side Diff: src/crankshaft/arm/lithium-codegen-arm.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/arm/lithium-arm.cc ('k') | src/crankshaft/arm64/lithium-arm64.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 #include "src/crankshaft/arm/lithium-codegen-arm.h" 5 #include "src/crankshaft/arm/lithium-codegen-arm.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/crankshaft/arm/lithium-gap-resolver-arm.h" 10 #include "src/crankshaft/arm/lithium-gap-resolver-arm.h"
(...skipping 5091 matching lines...) Expand 10 before | Expand all | Expand 10 after
5102 // Allocate memory for the object. 5102 // Allocate memory for the object.
5103 AllocationFlags flags = NO_ALLOCATION_FLAGS; 5103 AllocationFlags flags = NO_ALLOCATION_FLAGS;
5104 if (instr->hydrogen()->MustAllocateDoubleAligned()) { 5104 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
5105 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); 5105 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
5106 } 5106 }
5107 if (instr->hydrogen()->IsOldSpaceAllocation()) { 5107 if (instr->hydrogen()->IsOldSpaceAllocation()) {
5108 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); 5108 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5109 flags = static_cast<AllocationFlags>(flags | PRETENURE); 5109 flags = static_cast<AllocationFlags>(flags | PRETENURE);
5110 } 5110 }
5111 5111
5112 if (instr->hydrogen()->IsAllocationFoldingDominator()) {
5113 flags = static_cast<AllocationFlags>(flags | ALLOCATION_FOLDING_DOMINATOR);
5114 }
5115
5116 if (instr->hydrogen()->IsAllocationFolded()) {
5117 flags = static_cast<AllocationFlags>(flags | ALLOCATION_FOLDED);
5118 }
5119
5112 if (instr->size()->IsConstantOperand()) { 5120 if (instr->size()->IsConstantOperand()) {
5113 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); 5121 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5114 CHECK(size <= Page::kMaxRegularHeapObjectSize); 5122 CHECK(size <= Page::kMaxRegularHeapObjectSize);
5115 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags); 5123 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags);
5116 } else { 5124 } else {
5117 Register size = ToRegister(instr->size()); 5125 Register size = ToRegister(instr->size());
5118 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags); 5126 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags);
5119 } 5127 }
5120 5128
5121 __ bind(deferred->exit()); 5129 __ bind(deferred->exit());
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
5169 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); 5177 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5170 flags = AllocateTargetSpace::update(flags, OLD_SPACE); 5178 flags = AllocateTargetSpace::update(flags, OLD_SPACE);
5171 } else { 5179 } else {
5172 flags = AllocateTargetSpace::update(flags, NEW_SPACE); 5180 flags = AllocateTargetSpace::update(flags, NEW_SPACE);
5173 } 5181 }
5174 __ Push(Smi::FromInt(flags)); 5182 __ Push(Smi::FromInt(flags));
5175 5183
5176 CallRuntimeFromDeferred( 5184 CallRuntimeFromDeferred(
5177 Runtime::kAllocateInTargetSpace, 2, instr, instr->context()); 5185 Runtime::kAllocateInTargetSpace, 2, instr, instr->context());
5178 __ StoreToSafepointRegisterSlot(r0, result); 5186 __ StoreToSafepointRegisterSlot(r0, result);
5187
5188 if (instr->hydrogen()->IsAllocationFoldingDominator()) {
5189 AllocationFlags allocation_flags = NO_ALLOCATION_FLAGS;
5190 if (instr->hydrogen()->IsOldSpaceAllocation()) {
5191 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5192 allocation_flags = static_cast<AllocationFlags>(flags | PRETENURE);
5193 }
5194 // If the allocation folding dominator allocate triggered a GC, allocation
5195 // happend in the runtime. We have to reset the top pointer to virtually
5196 // undo the allocation.
5197 ExternalReference allocation_top =
5198 AllocationUtils::GetAllocationTopReference(isolate(), allocation_flags);
5199 Register top_address = scratch0();
5200 __ sub(r0, r0, Operand(kHeapObjectTag));
5201 __ mov(top_address, Operand(allocation_top));
5202 __ str(r0, MemOperand(top_address));
5203 __ add(r0, r0, Operand(kHeapObjectTag));
5204 }
5205 }
5206
5207 void LCodeGen::DoFastAllocate(LFastAllocate* instr) {
5208 DCHECK(instr->hydrogen()->IsAllocationFolded());
5209 Register result = ToRegister(instr->result());
5210 Register scratch1 = ToRegister(instr->temp1());
5211 Register scratch2 = ToRegister(instr->temp2());
5212
5213 AllocationFlags flags = NO_ALLOCATION_FLAGS;
5214 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
5215 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
5216 }
5217 if (instr->hydrogen()->IsOldSpaceAllocation()) {
5218 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5219 flags = static_cast<AllocationFlags>(flags | PRETENURE);
5220 }
5221 if (!instr->hydrogen()->IsAllocationFoldingDominator()) {
5222 if (instr->size()->IsConstantOperand()) {
5223 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5224 CHECK(size <= Page::kMaxRegularHeapObjectSize);
5225 __ FastAllocate(size, result, scratch1, scratch2, flags);
5226 } else {
5227 Register size = ToRegister(instr->size());
5228 __ FastAllocate(size, result, scratch1, scratch2, flags);
5229 }
5230 }
5179 } 5231 }
5180 5232
5181 5233
5182 void LCodeGen::DoTypeof(LTypeof* instr) { 5234 void LCodeGen::DoTypeof(LTypeof* instr) {
5183 DCHECK(ToRegister(instr->value()).is(r3)); 5235 DCHECK(ToRegister(instr->value()).is(r3));
5184 DCHECK(ToRegister(instr->result()).is(r0)); 5236 DCHECK(ToRegister(instr->result()).is(r0));
5185 Label end, do_call; 5237 Label end, do_call;
5186 Register value_register = ToRegister(instr->value()); 5238 Register value_register = ToRegister(instr->value());
5187 __ JumpIfNotSmi(value_register, &do_call); 5239 __ JumpIfNotSmi(value_register, &do_call);
5188 __ mov(r0, Operand(isolate()->factory()->number_string())); 5240 __ mov(r0, Operand(isolate()->factory()->number_string()));
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
5534 __ ldr(result, FieldMemOperand(scratch, 5586 __ ldr(result, FieldMemOperand(scratch,
5535 FixedArray::kHeaderSize - kPointerSize)); 5587 FixedArray::kHeaderSize - kPointerSize));
5536 __ bind(deferred->exit()); 5588 __ bind(deferred->exit());
5537 __ bind(&done); 5589 __ bind(&done);
5538 } 5590 }
5539 5591
5540 #undef __ 5592 #undef __
5541 5593
5542 } // namespace internal 5594 } // namespace internal
5543 } // namespace v8 5595 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/arm/lithium-arm.cc ('k') | src/crankshaft/arm64/lithium-arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698