OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #include "src/crankshaft/s390/lithium-codegen-s390.h" | 6 #include "src/crankshaft/s390/lithium-codegen-s390.h" |
7 | 7 |
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 5242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5253 // Allocate memory for the object. | 5253 // Allocate memory for the object. |
5254 AllocationFlags flags = NO_ALLOCATION_FLAGS; | 5254 AllocationFlags flags = NO_ALLOCATION_FLAGS; |
5255 if (instr->hydrogen()->MustAllocateDoubleAligned()) { | 5255 if (instr->hydrogen()->MustAllocateDoubleAligned()) { |
5256 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); | 5256 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); |
5257 } | 5257 } |
5258 if (instr->hydrogen()->IsOldSpaceAllocation()) { | 5258 if (instr->hydrogen()->IsOldSpaceAllocation()) { |
5259 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | 5259 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); |
5260 flags = static_cast<AllocationFlags>(flags | PRETENURE); | 5260 flags = static_cast<AllocationFlags>(flags | PRETENURE); |
5261 } | 5261 } |
5262 | 5262 |
| 5263 if (instr->hydrogen()->IsAllocationFoldingDominator()) { |
| 5264 flags = static_cast<AllocationFlags>(flags | ALLOCATION_FOLDING_DOMINATOR); |
| 5265 } |
| 5266 |
| 5267 DCHECK(!instr->hydrogen()->IsAllocationFolded()); |
| 5268 |
5263 if (instr->size()->IsConstantOperand()) { | 5269 if (instr->size()->IsConstantOperand()) { |
5264 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); | 5270 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
5265 CHECK(size <= Page::kMaxRegularHeapObjectSize); | 5271 CHECK(size <= Page::kMaxRegularHeapObjectSize); |
5266 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags); | 5272 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags); |
5267 } else { | 5273 } else { |
5268 Register size = ToRegister(instr->size()); | 5274 Register size = ToRegister(instr->size()); |
5269 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags); | 5275 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags); |
5270 } | 5276 } |
5271 | 5277 |
5272 __ bind(deferred->exit()); | 5278 __ bind(deferred->exit()); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5331 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | 5337 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); |
5332 flags = AllocateTargetSpace::update(flags, OLD_SPACE); | 5338 flags = AllocateTargetSpace::update(flags, OLD_SPACE); |
5333 } else { | 5339 } else { |
5334 flags = AllocateTargetSpace::update(flags, NEW_SPACE); | 5340 flags = AllocateTargetSpace::update(flags, NEW_SPACE); |
5335 } | 5341 } |
5336 __ Push(Smi::FromInt(flags)); | 5342 __ Push(Smi::FromInt(flags)); |
5337 | 5343 |
5338 CallRuntimeFromDeferred(Runtime::kAllocateInTargetSpace, 2, instr, | 5344 CallRuntimeFromDeferred(Runtime::kAllocateInTargetSpace, 2, instr, |
5339 instr->context()); | 5345 instr->context()); |
5340 __ StoreToSafepointRegisterSlot(r2, result); | 5346 __ StoreToSafepointRegisterSlot(r2, result); |
| 5347 |
| 5348 if (instr->hydrogen()->IsAllocationFoldingDominator()) { |
| 5349 AllocationFlags allocation_flags = NO_ALLOCATION_FLAGS; |
| 5350 if (instr->hydrogen()->IsOldSpaceAllocation()) { |
| 5351 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); |
| 5352 allocation_flags = static_cast<AllocationFlags>(flags | PRETENURE); |
| 5353 } |
| 5354 // If the allocation folding dominator allocate triggered a GC, allocation |
| 5355 // happend in the runtime. We have to reset the top pointer to virtually |
| 5356 // undo the allocation. |
| 5357 ExternalReference allocation_top = |
| 5358 AllocationUtils::GetAllocationTopReference(isolate(), allocation_flags); |
| 5359 Register top_address = scratch0(); |
| 5360 __ SubP(r2, r2, Operand(kHeapObjectTag)); |
| 5361 __ mov(top_address, Operand(allocation_top)); |
| 5362 __ StoreP(r2, MemOperand(top_address)); |
| 5363 __ AddP(r2, r2, Operand(kHeapObjectTag)); |
| 5364 } |
| 5365 } |
| 5366 |
| 5367 void LCodeGen::DoFastAllocate(LFastAllocate* instr) { |
| 5368 DCHECK(instr->hydrogen()->IsAllocationFolded()); |
| 5369 DCHECK(!instr->hydrogen()->IsAllocationFoldingDominator()); |
| 5370 Register result = ToRegister(instr->result()); |
| 5371 Register scratch1 = ToRegister(instr->temp1()); |
| 5372 Register scratch2 = ToRegister(instr->temp2()); |
| 5373 |
| 5374 AllocationFlags flags = ALLOCATION_FOLDED; |
| 5375 if (instr->hydrogen()->MustAllocateDoubleAligned()) { |
| 5376 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); |
| 5377 } |
| 5378 if (instr->hydrogen()->IsOldSpaceAllocation()) { |
| 5379 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); |
| 5380 flags = static_cast<AllocationFlags>(flags | PRETENURE); |
| 5381 } |
| 5382 if (instr->size()->IsConstantOperand()) { |
| 5383 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
| 5384 CHECK(size <= Page::kMaxRegularHeapObjectSize); |
| 5385 __ FastAllocate(size, result, scratch1, scratch2, flags); |
| 5386 } else { |
| 5387 Register size = ToRegister(instr->size()); |
| 5388 __ FastAllocate(size, result, scratch1, scratch2, flags); |
| 5389 } |
5341 } | 5390 } |
5342 | 5391 |
5343 void LCodeGen::DoTypeof(LTypeof* instr) { | 5392 void LCodeGen::DoTypeof(LTypeof* instr) { |
5344 DCHECK(ToRegister(instr->value()).is(r5)); | 5393 DCHECK(ToRegister(instr->value()).is(r5)); |
5345 DCHECK(ToRegister(instr->result()).is(r2)); | 5394 DCHECK(ToRegister(instr->result()).is(r2)); |
5346 Label end, do_call; | 5395 Label end, do_call; |
5347 Register value_register = ToRegister(instr->value()); | 5396 Register value_register = ToRegister(instr->value()); |
5348 __ JumpIfNotSmi(value_register, &do_call); | 5397 __ JumpIfNotSmi(value_register, &do_call); |
5349 __ mov(r2, Operand(isolate()->factory()->number_string())); | 5398 __ mov(r2, Operand(isolate()->factory()->number_string())); |
5350 __ b(&end); | 5399 __ b(&end); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5666 __ LoadP(result, | 5715 __ LoadP(result, |
5667 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); | 5716 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); |
5668 __ bind(deferred->exit()); | 5717 __ bind(deferred->exit()); |
5669 __ bind(&done); | 5718 __ bind(&done); |
5670 } | 5719 } |
5671 | 5720 |
5672 #undef __ | 5721 #undef __ |
5673 | 5722 |
5674 } // namespace internal | 5723 } // namespace internal |
5675 } // namespace v8 | 5724 } // namespace v8 |
OLD | NEW |