OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3633 } | 3633 } |
3634 } | 3634 } |
3635 | 3635 |
3636 | 3636 |
3637 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 3637 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
3638 DCHECK(ToRegister(instr->context()).is(cp)); | 3638 DCHECK(ToRegister(instr->context()).is(cp)); |
3639 DCHECK(ToRegister(instr->constructor()).is(a1)); | 3639 DCHECK(ToRegister(instr->constructor()).is(a1)); |
3640 DCHECK(ToRegister(instr->result()).is(v0)); | 3640 DCHECK(ToRegister(instr->result()).is(v0)); |
3641 | 3641 |
3642 __ li(a0, Operand(instr->arity())); | 3642 __ li(a0, Operand(instr->arity())); |
3643 if (instr->arity() == 1) { | 3643 __ li(a2, instr->hydrogen()->site()); |
3644 // We only need the allocation site for the case we have a length argument. | 3644 |
3645 // The case may bail out to the runtime, which will determine the correct | |
3646 // elements kind with the site. | |
3647 __ li(a2, instr->hydrogen()->site()); | |
3648 } else { | |
3649 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | |
3650 } | |
3651 ElementsKind kind = instr->hydrogen()->elements_kind(); | 3645 ElementsKind kind = instr->hydrogen()->elements_kind(); |
3652 AllocationSiteOverrideMode override_mode = | 3646 AllocationSiteOverrideMode override_mode = |
3653 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) | 3647 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) |
3654 ? DISABLE_ALLOCATION_SITES | 3648 ? DISABLE_ALLOCATION_SITES |
3655 : DONT_OVERRIDE; | 3649 : DONT_OVERRIDE; |
3656 | 3650 |
3657 if (instr->arity() == 0) { | 3651 if (instr->arity() == 0) { |
3658 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); | 3652 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); |
3659 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3653 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
3660 } else if (instr->arity() == 1) { | 3654 } else if (instr->arity() == 1) { |
(...skipping 11 matching lines...) Expand all Loading... |
3672 override_mode); | 3666 override_mode); |
3673 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3667 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
3674 __ jmp(&done); | 3668 __ jmp(&done); |
3675 __ bind(&packed_case); | 3669 __ bind(&packed_case); |
3676 } | 3670 } |
3677 | 3671 |
3678 ArraySingleArgumentConstructorStub stub(isolate(), kind, override_mode); | 3672 ArraySingleArgumentConstructorStub stub(isolate(), kind, override_mode); |
3679 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3673 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
3680 __ bind(&done); | 3674 __ bind(&done); |
3681 } else { | 3675 } else { |
3682 ArrayNArgumentsConstructorStub stub(isolate(), kind, override_mode); | 3676 ArrayNArgumentsConstructorStub stub(isolate()); |
3683 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3677 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
3684 } | 3678 } |
3685 } | 3679 } |
3686 | 3680 |
3687 | 3681 |
3688 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { | 3682 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { |
3689 CallRuntime(instr->function(), instr->arity(), instr); | 3683 CallRuntime(instr->function(), instr->arity(), instr); |
3690 } | 3684 } |
3691 | 3685 |
3692 | 3686 |
(...skipping 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5556 __ lw(result, FieldMemOperand(scratch, | 5550 __ lw(result, FieldMemOperand(scratch, |
5557 FixedArray::kHeaderSize - kPointerSize)); | 5551 FixedArray::kHeaderSize - kPointerSize)); |
5558 __ bind(deferred->exit()); | 5552 __ bind(deferred->exit()); |
5559 __ bind(&done); | 5553 __ bind(&done); |
5560 } | 5554 } |
5561 | 5555 |
5562 #undef __ | 5556 #undef __ |
5563 | 5557 |
5564 } // namespace internal | 5558 } // namespace internal |
5565 } // namespace v8 | 5559 } // namespace v8 |
OLD | NEW |