| 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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/crankshaft/x64/lithium-codegen-x64.h" | 7 #include "src/crankshaft/x64/lithium-codegen-x64.h" |
| 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 3711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3722 } | 3722 } |
| 3723 } | 3723 } |
| 3724 | 3724 |
| 3725 | 3725 |
| 3726 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 3726 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
| 3727 DCHECK(ToRegister(instr->context()).is(rsi)); | 3727 DCHECK(ToRegister(instr->context()).is(rsi)); |
| 3728 DCHECK(ToRegister(instr->constructor()).is(rdi)); | 3728 DCHECK(ToRegister(instr->constructor()).is(rdi)); |
| 3729 DCHECK(ToRegister(instr->result()).is(rax)); | 3729 DCHECK(ToRegister(instr->result()).is(rax)); |
| 3730 | 3730 |
| 3731 __ Set(rax, instr->arity()); | 3731 __ Set(rax, instr->arity()); |
| 3732 if (instr->arity() == 1) { | 3732 __ Move(rbx, instr->hydrogen()->site()); |
| 3733 // We only need the allocation site for the case we have a length argument. | |
| 3734 // The case may bail out to the runtime, which will determine the correct | |
| 3735 // elements kind with the site. | |
| 3736 __ Move(rbx, instr->hydrogen()->site()); | |
| 3737 } else { | |
| 3738 __ LoadRoot(rbx, Heap::kUndefinedValueRootIndex); | |
| 3739 } | |
| 3740 | 3733 |
| 3741 ElementsKind kind = instr->hydrogen()->elements_kind(); | 3734 ElementsKind kind = instr->hydrogen()->elements_kind(); |
| 3742 AllocationSiteOverrideMode override_mode = | 3735 AllocationSiteOverrideMode override_mode = |
| 3743 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) | 3736 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) |
| 3744 ? DISABLE_ALLOCATION_SITES | 3737 ? DISABLE_ALLOCATION_SITES |
| 3745 : DONT_OVERRIDE; | 3738 : DONT_OVERRIDE; |
| 3746 | 3739 |
| 3747 if (instr->arity() == 0) { | 3740 if (instr->arity() == 0) { |
| 3748 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); | 3741 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); |
| 3749 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3742 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3763 override_mode); | 3756 override_mode); |
| 3764 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3757 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 3765 __ jmp(&done, Label::kNear); | 3758 __ jmp(&done, Label::kNear); |
| 3766 __ bind(&packed_case); | 3759 __ bind(&packed_case); |
| 3767 } | 3760 } |
| 3768 | 3761 |
| 3769 ArraySingleArgumentConstructorStub stub(isolate(), kind, override_mode); | 3762 ArraySingleArgumentConstructorStub stub(isolate(), kind, override_mode); |
| 3770 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3763 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 3771 __ bind(&done); | 3764 __ bind(&done); |
| 3772 } else { | 3765 } else { |
| 3773 ArrayNArgumentsConstructorStub stub(isolate(), kind, override_mode); | 3766 ArrayNArgumentsConstructorStub stub(isolate()); |
| 3774 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3767 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 3775 } | 3768 } |
| 3776 } | 3769 } |
| 3777 | 3770 |
| 3778 | 3771 |
| 3779 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { | 3772 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { |
| 3780 DCHECK(ToRegister(instr->context()).is(rsi)); | 3773 DCHECK(ToRegister(instr->context()).is(rsi)); |
| 3781 CallRuntime(instr->function(), instr->arity(), instr, instr->save_doubles()); | 3774 CallRuntime(instr->function(), instr->arity(), instr, instr->save_doubles()); |
| 3782 } | 3775 } |
| 3783 | 3776 |
| (...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5623 __ bind(deferred->exit()); | 5616 __ bind(deferred->exit()); |
| 5624 __ bind(&done); | 5617 __ bind(&done); |
| 5625 } | 5618 } |
| 5626 | 5619 |
| 5627 #undef __ | 5620 #undef __ |
| 5628 | 5621 |
| 5629 } // namespace internal | 5622 } // namespace internal |
| 5630 } // namespace v8 | 5623 } // namespace v8 |
| 5631 | 5624 |
| 5632 #endif // V8_TARGET_ARCH_X64 | 5625 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |