OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #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/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
(...skipping 5666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5677 | 5677 |
5678 Register result = ToRegister(instr->result()); | 5678 Register result = ToRegister(instr->result()); |
5679 Register scratch = ToRegister(instr->temp1()); | 5679 Register scratch = ToRegister(instr->temp1()); |
5680 Register scratch2 = ToRegister(instr->temp2()); | 5680 Register scratch2 = ToRegister(instr->temp2()); |
5681 | 5681 |
5682 // Allocate memory for the object. | 5682 // Allocate memory for the object. |
5683 AllocationFlags flags = TAG_OBJECT; | 5683 AllocationFlags flags = TAG_OBJECT; |
5684 if (instr->hydrogen()->MustAllocateDoubleAligned()) { | 5684 if (instr->hydrogen()->MustAllocateDoubleAligned()) { |
5685 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); | 5685 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); |
5686 } | 5686 } |
5687 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) { | 5687 if (instr->hydrogen()->IsOldSpaceAllocation()) { |
5688 DCHECK(!instr->hydrogen()->IsOldDataSpaceAllocation()); | |
5689 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | 5688 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); |
5690 flags = static_cast<AllocationFlags>(flags | PRETENURE_OLD_POINTER_SPACE); | 5689 flags = static_cast<AllocationFlags>(flags | PRETENURE); |
5691 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) { | |
5692 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | |
5693 flags = static_cast<AllocationFlags>(flags | PRETENURE_OLD_DATA_SPACE); | |
5694 } | 5690 } |
5695 | 5691 |
5696 if (instr->size()->IsConstantOperand()) { | 5692 if (instr->size()->IsConstantOperand()) { |
5697 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); | 5693 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
5698 if (size <= Page::kMaxRegularHeapObjectSize) { | 5694 if (size <= Page::kMaxRegularHeapObjectSize) { |
5699 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags); | 5695 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags); |
5700 } else { | 5696 } else { |
5701 __ b(deferred->entry()); | 5697 __ b(deferred->entry()); |
5702 } | 5698 } |
5703 } else { | 5699 } else { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5749 } else { | 5745 } else { |
5750 // We should never get here at runtime => abort | 5746 // We should never get here at runtime => abort |
5751 __ stop("invalid allocation size"); | 5747 __ stop("invalid allocation size"); |
5752 return; | 5748 return; |
5753 } | 5749 } |
5754 #endif | 5750 #endif |
5755 } | 5751 } |
5756 | 5752 |
5757 int flags = AllocateDoubleAlignFlag::encode( | 5753 int flags = AllocateDoubleAlignFlag::encode( |
5758 instr->hydrogen()->MustAllocateDoubleAligned()); | 5754 instr->hydrogen()->MustAllocateDoubleAligned()); |
5759 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) { | 5755 if (instr->hydrogen()->IsOldSpaceAllocation()) { |
5760 DCHECK(!instr->hydrogen()->IsOldDataSpaceAllocation()); | |
5761 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | 5756 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); |
5762 flags = AllocateTargetSpace::update(flags, OLD_POINTER_SPACE); | 5757 flags = AllocateTargetSpace::update(flags, OLD_SPACE); |
5763 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) { | |
5764 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | |
5765 flags = AllocateTargetSpace::update(flags, OLD_DATA_SPACE); | |
5766 } else { | 5758 } else { |
5767 flags = AllocateTargetSpace::update(flags, NEW_SPACE); | 5759 flags = AllocateTargetSpace::update(flags, NEW_SPACE); |
5768 } | 5760 } |
5769 __ Push(Smi::FromInt(flags)); | 5761 __ Push(Smi::FromInt(flags)); |
5770 | 5762 |
5771 CallRuntimeFromDeferred(Runtime::kAllocateInTargetSpace, 2, instr, | 5763 CallRuntimeFromDeferred(Runtime::kAllocateInTargetSpace, 2, instr, |
5772 instr->context()); | 5764 instr->context()); |
5773 __ StoreToSafepointRegisterSlot(r3, result); | 5765 __ StoreToSafepointRegisterSlot(r3, result); |
5774 } | 5766 } |
5775 | 5767 |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6235 __ Push(scope_info); | 6227 __ Push(scope_info); |
6236 __ push(ToRegister(instr->function())); | 6228 __ push(ToRegister(instr->function())); |
6237 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6229 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6238 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6230 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6239 } | 6231 } |
6240 | 6232 |
6241 | 6233 |
6242 #undef __ | 6234 #undef __ |
6243 } | 6235 } |
6244 } // namespace v8::internal | 6236 } // namespace v8::internal |
OLD | NEW |