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

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

Issue 1899813003: [crankshaft] Fragmentation-free allocation folding. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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
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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/crankshaft/x64/lithium-codegen-x64.h" 7 #include "src/crankshaft/x64/lithium-codegen-x64.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 5152 matching lines...) Expand 10 before | Expand all | Expand 10 after
5163 // Allocate memory for the object. 5163 // Allocate memory for the object.
5164 AllocationFlags flags = TAG_OBJECT; 5164 AllocationFlags flags = TAG_OBJECT;
5165 if (instr->hydrogen()->MustAllocateDoubleAligned()) { 5165 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
5166 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); 5166 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
5167 } 5167 }
5168 if (instr->hydrogen()->IsOldSpaceAllocation()) { 5168 if (instr->hydrogen()->IsOldSpaceAllocation()) {
5169 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); 5169 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5170 flags = static_cast<AllocationFlags>(flags | PRETENURE); 5170 flags = static_cast<AllocationFlags>(flags | PRETENURE);
5171 } 5171 }
5172 5172
5173 if (instr->hydrogen()->IsAllocationFoldingDominator()) {
5174 flags = static_cast<AllocationFlags>(flags | ALLOCATION_FOLDING_DOMINATOR);
5175 }
5176
5177 if (instr->hydrogen()->IsAllocationFoldingDominated()) {
5178 flags = static_cast<AllocationFlags>(flags | ALLOCATION_FOLDING_DOMINATED);
5179 }
5180
5173 if (instr->size()->IsConstantOperand()) { 5181 if (instr->size()->IsConstantOperand()) {
5174 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); 5182 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5175 CHECK(size <= Page::kMaxRegularHeapObjectSize); 5183 CHECK(size <= Page::kMaxRegularHeapObjectSize);
5176 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags); 5184 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags);
5177 } else { 5185 } else {
5178 Register size = ToRegister(instr->size()); 5186 Register size = ToRegister(instr->size());
5179 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags); 5187 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags);
5180 } 5188 }
5181 5189
5182 __ bind(deferred->exit()); 5190 __ bind(deferred->exit());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
5224 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); 5232 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5225 flags = AllocateTargetSpace::update(flags, OLD_SPACE); 5233 flags = AllocateTargetSpace::update(flags, OLD_SPACE);
5226 } else { 5234 } else {
5227 flags = AllocateTargetSpace::update(flags, NEW_SPACE); 5235 flags = AllocateTargetSpace::update(flags, NEW_SPACE);
5228 } 5236 }
5229 __ Push(Smi::FromInt(flags)); 5237 __ Push(Smi::FromInt(flags));
5230 5238
5231 CallRuntimeFromDeferred( 5239 CallRuntimeFromDeferred(
5232 Runtime::kAllocateInTargetSpace, 2, instr, instr->context()); 5240 Runtime::kAllocateInTargetSpace, 2, instr, instr->context());
5233 __ StoreToSafepointRegisterSlot(result, rax); 5241 __ StoreToSafepointRegisterSlot(result, rax);
5242
5243 if (instr->hydrogen()->IsAllocationFoldingDominator()) {
5244 AllocationFlags allocation_flags = TAG_OBJECT;
5245 if (instr->hydrogen()->IsOldSpaceAllocation()) {
5246 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
5247 allocation_flags = static_cast<AllocationFlags>(flags | PRETENURE);
5248 }
5249 // If the allocation folding dominator allocate triggered a GC, allocation
5250 // happend in the runtime. We have to reset the top pointer to virtually
5251 // undo the allocation.
5252 __ SetTop(rax, allocation_flags);
5253 }
5234 } 5254 }
5235 5255
5236 5256
5237 void LCodeGen::DoTypeof(LTypeof* instr) { 5257 void LCodeGen::DoTypeof(LTypeof* instr) {
5238 DCHECK(ToRegister(instr->context()).is(rsi)); 5258 DCHECK(ToRegister(instr->context()).is(rsi));
5239 DCHECK(ToRegister(instr->value()).is(rbx)); 5259 DCHECK(ToRegister(instr->value()).is(rbx));
5240 Label end, do_call; 5260 Label end, do_call;
5241 Register value_register = ToRegister(instr->value()); 5261 Register value_register = ToRegister(instr->value());
5242 __ JumpIfNotSmi(value_register, &do_call); 5262 __ JumpIfNotSmi(value_register, &do_call);
5243 __ Move(rax, isolate()->factory()->number_string()); 5263 __ Move(rax, isolate()->factory()->number_string());
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
5592 __ bind(deferred->exit()); 5612 __ bind(deferred->exit());
5593 __ bind(&done); 5613 __ bind(&done);
5594 } 5614 }
5595 5615
5596 #undef __ 5616 #undef __
5597 5617
5598 } // namespace internal 5618 } // namespace internal
5599 } // namespace v8 5619 } // namespace v8
5600 5620
5601 #endif // V8_TARGET_ARCH_X64 5621 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698