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 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 3959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3970 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); | 3970 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); |
3971 } | 3971 } |
3972 | 3972 |
3973 | 3973 |
3974 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 3974 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
3975 DCHECK(ToRegister(instr->context()).is(esi)); | 3975 DCHECK(ToRegister(instr->context()).is(esi)); |
3976 DCHECK(ToRegister(instr->constructor()).is(edi)); | 3976 DCHECK(ToRegister(instr->constructor()).is(edi)); |
3977 DCHECK(ToRegister(instr->result()).is(eax)); | 3977 DCHECK(ToRegister(instr->result()).is(eax)); |
3978 | 3978 |
3979 __ Move(eax, Immediate(instr->arity())); | 3979 __ Move(eax, Immediate(instr->arity())); |
3980 __ mov(ebx, isolate()->factory()->undefined_value()); | 3980 if (instr->arity() == 1) { |
| 3981 // We only need the allocation site for the case we have a length argument. |
| 3982 // The case may bail out to the runtime, which will determine the correct |
| 3983 // elements kind with the site. |
| 3984 __ mov(ebx, instr->hydrogen()->site()); |
| 3985 } else { |
| 3986 __ mov(ebx, isolate()->factory()->undefined_value()); |
| 3987 } |
| 3988 |
3981 ElementsKind kind = instr->hydrogen()->elements_kind(); | 3989 ElementsKind kind = instr->hydrogen()->elements_kind(); |
3982 AllocationSiteOverrideMode override_mode = | 3990 AllocationSiteOverrideMode override_mode = |
3983 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) | 3991 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) |
3984 ? DISABLE_ALLOCATION_SITES | 3992 ? DISABLE_ALLOCATION_SITES |
3985 : DONT_OVERRIDE; | 3993 : DONT_OVERRIDE; |
3986 | 3994 |
3987 if (instr->arity() == 0) { | 3995 if (instr->arity() == 0) { |
3988 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); | 3996 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); |
3989 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); | 3997 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); |
3990 } else if (instr->arity() == 1) { | 3998 } else if (instr->arity() == 1) { |
(...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5736 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5744 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5737 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5745 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5738 } | 5746 } |
5739 | 5747 |
5740 | 5748 |
5741 #undef __ | 5749 #undef __ |
5742 | 5750 |
5743 } } // namespace v8::internal | 5751 } } // namespace v8::internal |
5744 | 5752 |
5745 #endif // V8_TARGET_ARCH_IA32 | 5753 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |