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 4111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4122 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); | 4122 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); |
4123 } | 4123 } |
4124 | 4124 |
4125 | 4125 |
4126 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 4126 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
4127 DCHECK(ToRegister(instr->context()).is(cp)); | 4127 DCHECK(ToRegister(instr->context()).is(cp)); |
4128 DCHECK(ToRegister(instr->constructor()).is(a1)); | 4128 DCHECK(ToRegister(instr->constructor()).is(a1)); |
4129 DCHECK(ToRegister(instr->result()).is(v0)); | 4129 DCHECK(ToRegister(instr->result()).is(v0)); |
4130 | 4130 |
4131 __ li(a0, Operand(instr->arity())); | 4131 __ li(a0, Operand(instr->arity())); |
4132 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 4132 if (instr->arity() == 1) { |
| 4133 // We only need the allocation site for the case we have a length argument. |
| 4134 // The case may bail out to the runtime, which will determine the correct |
| 4135 // elements kind with the site. |
| 4136 __ li(a2, instr->hydrogen()->site()); |
| 4137 } else { |
| 4138 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
| 4139 } |
4133 ElementsKind kind = instr->hydrogen()->elements_kind(); | 4140 ElementsKind kind = instr->hydrogen()->elements_kind(); |
4134 AllocationSiteOverrideMode override_mode = | 4141 AllocationSiteOverrideMode override_mode = |
4135 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) | 4142 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) |
4136 ? DISABLE_ALLOCATION_SITES | 4143 ? DISABLE_ALLOCATION_SITES |
4137 : DONT_OVERRIDE; | 4144 : DONT_OVERRIDE; |
4138 | 4145 |
4139 if (instr->arity() == 0) { | 4146 if (instr->arity() == 0) { |
4140 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); | 4147 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); |
4141 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); | 4148 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); |
4142 } else if (instr->arity() == 1) { | 4149 } else if (instr->arity() == 1) { |
(...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6022 __ li(at, scope_info); | 6029 __ li(at, scope_info); |
6023 __ Push(at, ToRegister(instr->function())); | 6030 __ Push(at, ToRegister(instr->function())); |
6024 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6031 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6025 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6032 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6026 } | 6033 } |
6027 | 6034 |
6028 | 6035 |
6029 #undef __ | 6036 #undef __ |
6030 | 6037 |
6031 } } // namespace v8::internal | 6038 } } // namespace v8::internal |
OLD | NEW |