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 4283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4294 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); | 4294 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); |
4295 } | 4295 } |
4296 | 4296 |
4297 | 4297 |
4298 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 4298 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
4299 DCHECK(ToRegister(instr->context()).is(cp)); | 4299 DCHECK(ToRegister(instr->context()).is(cp)); |
4300 DCHECK(ToRegister(instr->constructor()).is(r4)); | 4300 DCHECK(ToRegister(instr->constructor()).is(r4)); |
4301 DCHECK(ToRegister(instr->result()).is(r3)); | 4301 DCHECK(ToRegister(instr->result()).is(r3)); |
4302 | 4302 |
4303 __ mov(r3, Operand(instr->arity())); | 4303 __ mov(r3, Operand(instr->arity())); |
4304 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); | 4304 if (instr->arity() == 1) { |
| 4305 // We only need the allocation site for the case we have a length argument. |
| 4306 // The case may bail out to the runtime, which will determine the correct |
| 4307 // elements kind with the site. |
| 4308 __ Move(r5, instr->hydrogen()->site()); |
| 4309 } else { |
| 4310 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); |
| 4311 } |
4305 ElementsKind kind = instr->hydrogen()->elements_kind(); | 4312 ElementsKind kind = instr->hydrogen()->elements_kind(); |
4306 AllocationSiteOverrideMode override_mode = | 4313 AllocationSiteOverrideMode override_mode = |
4307 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) | 4314 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) |
4308 ? DISABLE_ALLOCATION_SITES | 4315 ? DISABLE_ALLOCATION_SITES |
4309 : DONT_OVERRIDE; | 4316 : DONT_OVERRIDE; |
4310 | 4317 |
4311 if (instr->arity() == 0) { | 4318 if (instr->arity() == 0) { |
4312 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); | 4319 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); |
4313 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); | 4320 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); |
4314 } else if (instr->arity() == 1) { | 4321 } else if (instr->arity() == 1) { |
(...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6175 __ Push(scope_info); | 6182 __ Push(scope_info); |
6176 __ push(ToRegister(instr->function())); | 6183 __ push(ToRegister(instr->function())); |
6177 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6184 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6178 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6185 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6179 } | 6186 } |
6180 | 6187 |
6181 | 6188 |
6182 #undef __ | 6189 #undef __ |
6183 } | 6190 } |
6184 } // namespace v8::internal | 6191 } // namespace v8::internal |
OLD | NEW |