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 5632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5643 | 5643 |
5644 Register result = ToRegister(instr->result()); | 5644 Register result = ToRegister(instr->result()); |
5645 Register scratch = ToRegister(instr->temp1()); | 5645 Register scratch = ToRegister(instr->temp1()); |
5646 Register scratch2 = ToRegister(instr->temp2()); | 5646 Register scratch2 = ToRegister(instr->temp2()); |
5647 | 5647 |
5648 // Allocate memory for the object. | 5648 // Allocate memory for the object. |
5649 AllocationFlags flags = TAG_OBJECT; | 5649 AllocationFlags flags = TAG_OBJECT; |
5650 if (instr->hydrogen()->MustAllocateDoubleAligned()) { | 5650 if (instr->hydrogen()->MustAllocateDoubleAligned()) { |
5651 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); | 5651 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); |
5652 } | 5652 } |
5653 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) { | 5653 if (instr->hydrogen()->IsOldSpaceAllocation()) { |
5654 DCHECK(!instr->hydrogen()->IsOldDataSpaceAllocation()); | |
5655 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | 5654 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); |
5656 flags = static_cast<AllocationFlags>(flags | PRETENURE_OLD_POINTER_SPACE); | 5655 flags = static_cast<AllocationFlags>(flags | PRETENURE); |
5657 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) { | |
5658 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | |
5659 flags = static_cast<AllocationFlags>(flags | PRETENURE_OLD_DATA_SPACE); | |
5660 } | 5656 } |
5661 | 5657 |
5662 if (instr->size()->IsConstantOperand()) { | 5658 if (instr->size()->IsConstantOperand()) { |
5663 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); | 5659 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
5664 if (size <= Page::kMaxRegularHeapObjectSize) { | 5660 if (size <= Page::kMaxRegularHeapObjectSize) { |
5665 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags); | 5661 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags); |
5666 } else { | 5662 } else { |
5667 __ b(deferred->entry()); | 5663 __ b(deferred->entry()); |
5668 } | 5664 } |
5669 } else { | 5665 } else { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5715 } else { | 5711 } else { |
5716 // We should never get here at runtime => abort | 5712 // We should never get here at runtime => abort |
5717 __ stop("invalid allocation size"); | 5713 __ stop("invalid allocation size"); |
5718 return; | 5714 return; |
5719 } | 5715 } |
5720 #endif | 5716 #endif |
5721 } | 5717 } |
5722 | 5718 |
5723 int flags = AllocateDoubleAlignFlag::encode( | 5719 int flags = AllocateDoubleAlignFlag::encode( |
5724 instr->hydrogen()->MustAllocateDoubleAligned()); | 5720 instr->hydrogen()->MustAllocateDoubleAligned()); |
5725 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) { | 5721 if (instr->hydrogen()->IsOldSpaceAllocation()) { |
5726 DCHECK(!instr->hydrogen()->IsOldDataSpaceAllocation()); | |
5727 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | 5722 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); |
5728 flags = AllocateTargetSpace::update(flags, OLD_POINTER_SPACE); | 5723 flags = AllocateTargetSpace::update(flags, OLD_SPACE); |
5729 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) { | |
5730 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | |
5731 flags = AllocateTargetSpace::update(flags, OLD_DATA_SPACE); | |
5732 } else { | 5724 } else { |
5733 flags = AllocateTargetSpace::update(flags, NEW_SPACE); | 5725 flags = AllocateTargetSpace::update(flags, NEW_SPACE); |
5734 } | 5726 } |
5735 __ Push(Smi::FromInt(flags)); | 5727 __ Push(Smi::FromInt(flags)); |
5736 | 5728 |
5737 CallRuntimeFromDeferred(Runtime::kAllocateInTargetSpace, 2, instr, | 5729 CallRuntimeFromDeferred(Runtime::kAllocateInTargetSpace, 2, instr, |
5738 instr->context()); | 5730 instr->context()); |
5739 __ StoreToSafepointRegisterSlot(r3, result); | 5731 __ StoreToSafepointRegisterSlot(r3, result); |
5740 } | 5732 } |
5741 | 5733 |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6201 __ Push(scope_info); | 6193 __ Push(scope_info); |
6202 __ push(ToRegister(instr->function())); | 6194 __ push(ToRegister(instr->function())); |
6203 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6195 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6204 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6196 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6205 } | 6197 } |
6206 | 6198 |
6207 | 6199 |
6208 #undef __ | 6200 #undef __ |
6209 } | 6201 } |
6210 } // namespace v8::internal | 6202 } // namespace v8::internal |
OLD | NEW |