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

Side by Side Diff: src/crankshaft/mips64/lithium-codegen-mips64.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/mips/lithium-mips.cc ('k') | src/crankshaft/mips64/lithium-mips64.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/mips64/lithium-codegen-mips64.h" 5 #include "src/crankshaft/mips64/lithium-codegen-mips64.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/crankshaft/hydrogen-osr.h" 9 #include "src/crankshaft/hydrogen-osr.h"
10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" 10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h"
(...skipping 5262 matching lines...) Expand 10 before | Expand all | Expand 10 after
5273 5273
5274 // Allocate memory for the object. 5274 // Allocate memory for the object.
5275 AllocationFlags flags = NO_ALLOCATION_FLAGS; 5275 AllocationFlags flags = NO_ALLOCATION_FLAGS;
5276 if (instr->hydrogen()->MustAllocateDoubleAligned()) { 5276 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
5277 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); 5277 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
5278 } 5278 }
5279 if (instr->hydrogen()->IsOldSpaceAllocation()) { 5279 if (instr->hydrogen()->IsOldSpaceAllocation()) {
5280 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); 5280 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5281 flags = static_cast<AllocationFlags>(flags | PRETENURE); 5281 flags = static_cast<AllocationFlags>(flags | PRETENURE);
5282 } 5282 }
5283
5284 if (instr->hydrogen()->IsAllocationFoldingDominator()) {
5285 flags = static_cast<AllocationFlags>(flags | ALLOCATION_FOLDING_DOMINATOR);
5286 }
5287
5288 if (instr->hydrogen()->IsAllocationFolded()) {
5289 flags = static_cast<AllocationFlags>(flags | ALLOCATION_FOLDED);
5290 }
5291
5283 if (instr->size()->IsConstantOperand()) { 5292 if (instr->size()->IsConstantOperand()) {
5284 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); 5293 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5285 CHECK(size <= Page::kMaxRegularHeapObjectSize); 5294 CHECK(size <= Page::kMaxRegularHeapObjectSize);
5286 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags); 5295 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags);
5287 } else { 5296 } else {
5288 Register size = ToRegister(instr->size()); 5297 Register size = ToRegister(instr->size());
5289 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags); 5298 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags);
5290 } 5299 }
5291 5300
5292 __ bind(deferred->exit()); 5301 __ bind(deferred->exit());
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
5343 flags = AllocateTargetSpace::update(flags, OLD_SPACE); 5352 flags = AllocateTargetSpace::update(flags, OLD_SPACE);
5344 } else { 5353 } else {
5345 flags = AllocateTargetSpace::update(flags, NEW_SPACE); 5354 flags = AllocateTargetSpace::update(flags, NEW_SPACE);
5346 } 5355 }
5347 __ li(v0, Operand(Smi::FromInt(flags))); 5356 __ li(v0, Operand(Smi::FromInt(flags)));
5348 __ Push(v0); 5357 __ Push(v0);
5349 5358
5350 CallRuntimeFromDeferred( 5359 CallRuntimeFromDeferred(
5351 Runtime::kAllocateInTargetSpace, 2, instr, instr->context()); 5360 Runtime::kAllocateInTargetSpace, 2, instr, instr->context());
5352 __ StoreToSafepointRegisterSlot(v0, result); 5361 __ StoreToSafepointRegisterSlot(v0, result);
5362
5363 if (instr->hydrogen()->IsAllocationFoldingDominator()) {
5364 AllocationFlags allocation_flags = NO_ALLOCATION_FLAGS;
5365 if (instr->hydrogen()->IsOldSpaceAllocation()) {
5366 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5367 allocation_flags = static_cast<AllocationFlags>(flags | PRETENURE);
5368 }
5369 // If the allocation folding dominator allocate triggered a GC, allocation
5370 // happend in the runtime. We have to reset the top pointer to virtually
5371 // undo the allocation.
5372 ExternalReference allocation_top =
5373 AllocationUtils::GetAllocationTopReference(isolate(), allocation_flags);
5374 Register top_address = scratch0();
5375 __ Dsubu(v0, v0, Operand(kHeapObjectTag));
5376 __ li(top_address, Operand(allocation_top));
5377 __ sd(v0, MemOperand(top_address));
5378 __ Daddu(v0, v0, Operand(kHeapObjectTag));
5379 }
5380 }
5381
5382 void LCodeGen::DoFastAllocate(LFastAllocate* instr) {
5383 DCHECK(instr->hydrogen()->IsAllocationFolded());
5384 Register result = ToRegister(instr->result());
5385 Register scratch1 = ToRegister(instr->temp1());
5386 Register scratch2 = ToRegister(instr->temp2());
5387
5388 AllocationFlags flags = NO_ALLOCATION_FLAGS;
5389 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
5390 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
5391 }
5392 if (instr->hydrogen()->IsOldSpaceAllocation()) {
5393 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5394 flags = static_cast<AllocationFlags>(flags | PRETENURE);
5395 }
5396 if (!instr->hydrogen()->IsAllocationFoldingDominator()) {
5397 if (instr->size()->IsConstantOperand()) {
5398 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5399 CHECK(size <= Page::kMaxRegularHeapObjectSize);
5400 __ FastAllocate(size, result, scratch1, scratch2, flags);
5401 } else {
5402 Register size = ToRegister(instr->size());
5403 __ FastAllocate(size, result, scratch1, scratch2, flags);
5404 }
5405 }
5353 } 5406 }
5354 5407
5355 5408
5356 void LCodeGen::DoTypeof(LTypeof* instr) { 5409 void LCodeGen::DoTypeof(LTypeof* instr) {
5357 DCHECK(ToRegister(instr->value()).is(a3)); 5410 DCHECK(ToRegister(instr->value()).is(a3));
5358 DCHECK(ToRegister(instr->result()).is(v0)); 5411 DCHECK(ToRegister(instr->result()).is(v0));
5359 Label end, do_call; 5412 Label end, do_call;
5360 Register value_register = ToRegister(instr->value()); 5413 Register value_register = ToRegister(instr->value());
5361 __ JumpIfNotSmi(value_register, &do_call); 5414 __ JumpIfNotSmi(value_register, &do_call);
5362 __ li(v0, Operand(isolate()->factory()->number_string())); 5415 __ li(v0, Operand(isolate()->factory()->number_string()));
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
5736 __ ld(result, FieldMemOperand(scratch, 5789 __ ld(result, FieldMemOperand(scratch,
5737 FixedArray::kHeaderSize - kPointerSize)); 5790 FixedArray::kHeaderSize - kPointerSize));
5738 __ bind(deferred->exit()); 5791 __ bind(deferred->exit());
5739 __ bind(&done); 5792 __ bind(&done);
5740 } 5793 }
5741 5794
5742 #undef __ 5795 #undef __
5743 5796
5744 } // namespace internal 5797 } // namespace internal
5745 } // namespace v8 5798 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/mips/lithium-mips.cc ('k') | src/crankshaft/mips64/lithium-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698