OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
10 #include "src/hydrogen-osr.h" | 10 #include "src/hydrogen-osr.h" |
(...skipping 5406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5417 | 5417 |
5418 Register result = ToRegister(instr->result()); | 5418 Register result = ToRegister(instr->result()); |
5419 Register scratch = ToRegister(instr->temp1()); | 5419 Register scratch = ToRegister(instr->temp1()); |
5420 Register scratch2 = ToRegister(instr->temp2()); | 5420 Register scratch2 = ToRegister(instr->temp2()); |
5421 | 5421 |
5422 // Allocate memory for the object. | 5422 // Allocate memory for the object. |
5423 AllocationFlags flags = TAG_OBJECT; | 5423 AllocationFlags flags = TAG_OBJECT; |
5424 if (instr->hydrogen()->MustAllocateDoubleAligned()) { | 5424 if (instr->hydrogen()->MustAllocateDoubleAligned()) { |
5425 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); | 5425 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); |
5426 } | 5426 } |
5427 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) { | 5427 if (instr->hydrogen()->IsOldSpaceAllocation()) { |
5428 DCHECK(!instr->hydrogen()->IsOldDataSpaceAllocation()); | |
5429 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | 5428 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); |
5430 flags = static_cast<AllocationFlags>(flags | PRETENURE_OLD_POINTER_SPACE); | 5429 flags = static_cast<AllocationFlags>(flags | PRETENURE); |
5431 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) { | |
5432 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | |
5433 flags = static_cast<AllocationFlags>(flags | PRETENURE_OLD_DATA_SPACE); | |
5434 } | 5430 } |
5435 if (instr->size()->IsConstantOperand()) { | 5431 if (instr->size()->IsConstantOperand()) { |
5436 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); | 5432 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
5437 if (size <= Page::kMaxRegularHeapObjectSize) { | 5433 if (size <= Page::kMaxRegularHeapObjectSize) { |
5438 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags); | 5434 __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags); |
5439 } else { | 5435 } else { |
5440 __ jmp(deferred->entry()); | 5436 __ jmp(deferred->entry()); |
5441 } | 5437 } |
5442 } else { | 5438 } else { |
5443 Register size = ToRegister(instr->size()); | 5439 Register size = ToRegister(instr->size()); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5486 __ Push(v0); | 5482 __ Push(v0); |
5487 } else { | 5483 } else { |
5488 // We should never get here at runtime => abort | 5484 // We should never get here at runtime => abort |
5489 __ stop("invalid allocation size"); | 5485 __ stop("invalid allocation size"); |
5490 return; | 5486 return; |
5491 } | 5487 } |
5492 } | 5488 } |
5493 | 5489 |
5494 int flags = AllocateDoubleAlignFlag::encode( | 5490 int flags = AllocateDoubleAlignFlag::encode( |
5495 instr->hydrogen()->MustAllocateDoubleAligned()); | 5491 instr->hydrogen()->MustAllocateDoubleAligned()); |
5496 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) { | 5492 if (instr->hydrogen()->IsOldSpaceAllocation()) { |
5497 DCHECK(!instr->hydrogen()->IsOldDataSpaceAllocation()); | |
5498 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | 5493 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); |
5499 flags = AllocateTargetSpace::update(flags, OLD_POINTER_SPACE); | 5494 flags = AllocateTargetSpace::update(flags, OLD_SPACE); |
5500 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) { | |
5501 DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); | |
5502 flags = AllocateTargetSpace::update(flags, OLD_DATA_SPACE); | |
5503 } else { | 5495 } else { |
5504 flags = AllocateTargetSpace::update(flags, NEW_SPACE); | 5496 flags = AllocateTargetSpace::update(flags, NEW_SPACE); |
5505 } | 5497 } |
5506 __ li(v0, Operand(Smi::FromInt(flags))); | 5498 __ li(v0, Operand(Smi::FromInt(flags))); |
5507 __ Push(v0); | 5499 __ Push(v0); |
5508 | 5500 |
5509 CallRuntimeFromDeferred( | 5501 CallRuntimeFromDeferred( |
5510 Runtime::kAllocateInTargetSpace, 2, instr, instr->context()); | 5502 Runtime::kAllocateInTargetSpace, 2, instr, instr->context()); |
5511 __ StoreToSafepointRegisterSlot(v0, result); | 5503 __ StoreToSafepointRegisterSlot(v0, result); |
5512 } | 5504 } |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6025 __ li(at, scope_info); | 6017 __ li(at, scope_info); |
6026 __ Push(at, ToRegister(instr->function())); | 6018 __ Push(at, ToRegister(instr->function())); |
6027 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6019 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6028 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6020 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6029 } | 6021 } |
6030 | 6022 |
6031 | 6023 |
6032 #undef __ | 6024 #undef __ |
6033 | 6025 |
6034 } } // namespace v8::internal | 6026 } } // namespace v8::internal |
OLD | NEW |