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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arm64/lithium-codegen-arm64.h" | 7 #include "src/arm64/lithium-codegen-arm64.h" |
8 #include "src/arm64/lithium-gap-resolver-arm64.h" | 8 #include "src/arm64/lithium-gap-resolver-arm64.h" |
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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 DCHECK(ToRegister(instr->result()).is(x0)); | 453 DCHECK(ToRegister(instr->result()).is(x0)); |
454 } | 454 } |
455 | 455 |
456 | 456 |
457 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 457 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
458 DCHECK(instr->IsMarkedAsCall()); | 458 DCHECK(instr->IsMarkedAsCall()); |
459 DCHECK(ToRegister(instr->context()).is(cp)); | 459 DCHECK(ToRegister(instr->context()).is(cp)); |
460 DCHECK(ToRegister(instr->constructor()).is(x1)); | 460 DCHECK(ToRegister(instr->constructor()).is(x1)); |
461 | 461 |
462 __ Mov(x0, Operand(instr->arity())); | 462 __ Mov(x0, Operand(instr->arity())); |
463 __ LoadRoot(x2, Heap::kUndefinedValueRootIndex); | 463 if (instr->arity() == 1) { |
| 464 // We only need the allocation site for the case we have a length argument. |
| 465 // The case may bail out to the runtime, which will determine the correct |
| 466 // elements kind with the site. |
| 467 __ Mov(x2, instr->hydrogen()->site()); |
| 468 } else { |
| 469 __ LoadRoot(x2, Heap::kUndefinedValueRootIndex); |
| 470 } |
| 471 |
464 | 472 |
465 ElementsKind kind = instr->hydrogen()->elements_kind(); | 473 ElementsKind kind = instr->hydrogen()->elements_kind(); |
466 AllocationSiteOverrideMode override_mode = | 474 AllocationSiteOverrideMode override_mode = |
467 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) | 475 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) |
468 ? DISABLE_ALLOCATION_SITES | 476 ? DISABLE_ALLOCATION_SITES |
469 : DONT_OVERRIDE; | 477 : DONT_OVERRIDE; |
470 | 478 |
471 if (instr->arity() == 0) { | 479 if (instr->arity() == 0) { |
472 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); | 480 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); |
473 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); | 481 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); |
(...skipping 5535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6009 Handle<ScopeInfo> scope_info = instr->scope_info(); | 6017 Handle<ScopeInfo> scope_info = instr->scope_info(); |
6010 __ Push(scope_info); | 6018 __ Push(scope_info); |
6011 __ Push(ToRegister(instr->function())); | 6019 __ Push(ToRegister(instr->function())); |
6012 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6020 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6013 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6021 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6014 } | 6022 } |
6015 | 6023 |
6016 | 6024 |
6017 | 6025 |
6018 } } // namespace v8::internal | 6026 } } // namespace v8::internal |
OLD | NEW |