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