| OLD | NEW |
| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 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 5362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5373 new(zone()) DeferredAllocate(this, instr); | 5373 new(zone()) DeferredAllocate(this, instr); |
| 5374 | 5374 |
| 5375 Register result = ToRegister(instr->result()); | 5375 Register result = ToRegister(instr->result()); |
| 5376 Register temp = ToRegister(instr->temp()); | 5376 Register temp = ToRegister(instr->temp()); |
| 5377 | 5377 |
| 5378 // Allocate memory for the object. | 5378 // Allocate memory for the object. |
| 5379 AllocationFlags flags = TAG_OBJECT; | 5379 AllocationFlags flags = TAG_OBJECT; |
| 5380 if (instr->hydrogen()->MustAllocateDoubleAligned()) { | 5380 if (instr->hydrogen()->MustAllocateDoubleAligned()) { |
| 5381 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); | 5381 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); |
| 5382 } | 5382 } |
| 5383 if (instr->hydrogen()->IsOldSpaceAllocation()) { | 5383 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) { |
| 5384 DCHECK(!instr->hydrogen()->IsOldDataSpaceAllocation()); |
| 5384 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | 5385 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); |
| 5385 flags = static_cast<AllocationFlags>(flags | PRETENURE); | 5386 flags = static_cast<AllocationFlags>(flags | PRETENURE_OLD_POINTER_SPACE); |
| 5387 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) { |
| 5388 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); |
| 5389 flags = static_cast<AllocationFlags>(flags | PRETENURE_OLD_DATA_SPACE); |
| 5386 } | 5390 } |
| 5387 | 5391 |
| 5388 if (instr->size()->IsConstantOperand()) { | 5392 if (instr->size()->IsConstantOperand()) { |
| 5389 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); | 5393 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
| 5390 if (size <= Page::kMaxRegularHeapObjectSize) { | 5394 if (size <= Page::kMaxRegularHeapObjectSize) { |
| 5391 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags); | 5395 __ Allocate(size, result, temp, no_reg, deferred->entry(), flags); |
| 5392 } else { | 5396 } else { |
| 5393 __ jmp(deferred->entry()); | 5397 __ jmp(deferred->entry()); |
| 5394 } | 5398 } |
| 5395 } else { | 5399 } else { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5431 Register size = ToRegister(instr->size()); | 5435 Register size = ToRegister(instr->size()); |
| 5432 DCHECK(!size.is(result)); | 5436 DCHECK(!size.is(result)); |
| 5433 __ Integer32ToSmi(size, size); | 5437 __ Integer32ToSmi(size, size); |
| 5434 __ Push(size); | 5438 __ Push(size); |
| 5435 } else { | 5439 } else { |
| 5436 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); | 5440 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
| 5437 __ Push(Smi::FromInt(size)); | 5441 __ Push(Smi::FromInt(size)); |
| 5438 } | 5442 } |
| 5439 | 5443 |
| 5440 int flags = 0; | 5444 int flags = 0; |
| 5441 if (instr->hydrogen()->IsOldSpaceAllocation()) { | 5445 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) { |
| 5446 DCHECK(!instr->hydrogen()->IsOldDataSpaceAllocation()); |
| 5442 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | 5447 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); |
| 5443 flags = AllocateTargetSpace::update(flags, OLD_SPACE); | 5448 flags = AllocateTargetSpace::update(flags, OLD_POINTER_SPACE); |
| 5449 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) { |
| 5450 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); |
| 5451 flags = AllocateTargetSpace::update(flags, OLD_DATA_SPACE); |
| 5444 } else { | 5452 } else { |
| 5445 flags = AllocateTargetSpace::update(flags, NEW_SPACE); | 5453 flags = AllocateTargetSpace::update(flags, NEW_SPACE); |
| 5446 } | 5454 } |
| 5447 __ Push(Smi::FromInt(flags)); | 5455 __ Push(Smi::FromInt(flags)); |
| 5448 | 5456 |
| 5449 CallRuntimeFromDeferred( | 5457 CallRuntimeFromDeferred( |
| 5450 Runtime::kAllocateInTargetSpace, 2, instr, instr->context()); | 5458 Runtime::kAllocateInTargetSpace, 2, instr, instr->context()); |
| 5451 __ StoreToSafepointRegisterSlot(result, rax); | 5459 __ StoreToSafepointRegisterSlot(result, rax); |
| 5452 } | 5460 } |
| 5453 | 5461 |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5931 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5939 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5932 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5940 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5933 } | 5941 } |
| 5934 | 5942 |
| 5935 | 5943 |
| 5936 #undef __ | 5944 #undef __ |
| 5937 | 5945 |
| 5938 } } // namespace v8::internal | 5946 } } // namespace v8::internal |
| 5939 | 5947 |
| 5940 #endif // V8_TARGET_ARCH_X64 | 5948 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |