Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 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 3566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3577 __ ret(0); | 3577 __ ret(0); |
| 3578 | 3578 |
| 3579 __ bind(&miss_force_generic); | 3579 __ bind(&miss_force_generic); |
| 3580 Code* code = masm->isolate()->builtins()->builtin( | 3580 Code* code = masm->isolate()->builtins()->builtin( |
| 3581 Builtins::kKeyedLoadIC_MissForceGeneric); | 3581 Builtins::kKeyedLoadIC_MissForceGeneric); |
| 3582 Handle<Code> ic(code); | 3582 Handle<Code> ic(code); |
| 3583 __ jmp(ic, RelocInfo::CODE_TARGET); | 3583 __ jmp(ic, RelocInfo::CODE_TARGET); |
| 3584 } | 3584 } |
| 3585 | 3585 |
| 3586 | 3586 |
| 3587 void KeyedLoadStubCompiler::GenerateLoadFastDoubleElement( | |
| 3588 MacroAssembler* masm) { | |
| 3589 // ----------- S t a t e ------------- | |
| 3590 // -- rax : key | |
| 3591 // -- rdx : receiver | |
| 3592 // -- rsp[0] : return address | |
| 3593 // ----------------------------------- | |
| 3594 Label miss_force_generic, slow_allocate_heapnumber; | |
| 3595 | |
| 3596 // This stub is meant to be tail-jumped to, the receiver must already | |
| 3597 // have been verified by the caller to not be a smi. | |
| 3598 | |
| 3599 // Check that the key is a smi. | |
| 3600 __ JumpIfNotSmi(rax, &miss_force_generic); | |
| 3601 | |
| 3602 // Get the elements array. | |
| 3603 __ movq(rcx, FieldOperand(rdx, JSObject::kElementsOffset)); | |
| 3604 __ AssertFastElements(rcx); | |
| 3605 | |
| 3606 // Check that the key is within bounds. | |
| 3607 __ SmiCompare(rax, FieldOperand(rcx, FixedArray::kLengthOffset)); | |
| 3608 __ j(above_equal, &miss_force_generic); | |
| 3609 | |
| 3610 // Check for the hole | |
| 3611 __ SmiToInteger32(kScratchRegister, rax); | |
| 3612 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); | |
| 3613 __ cmpl(FieldOperand(rcx, kScratchRegister, times_8, offset), | |
| 3614 Immediate(kHoleNanUpper32)); | |
| 3615 __ j(equal, &miss_force_generic); | |
| 3616 | |
| 3617 // Always allocate a heap number for the result. | |
| 3618 __ fld_d(FieldOperand(rcx, kScratchRegister, times_8, | |
|
Mads Ager (chromium)
2011/07/12 12:03:26
Same as on ia32 this can lead to unbalanced push/p
danno
2011/07/13 08:59:52
Done.
| |
| 3619 FixedDoubleArray::kHeaderSize)); | |
| 3620 __ AllocateHeapNumber(rcx, rbx, &slow_allocate_heapnumber); | |
| 3621 // Set the value. | |
| 3622 __ movq(rax, rcx); | |
| 3623 __ fstp_d(FieldOperand(rcx, HeapNumber::kValueOffset)); | |
| 3624 __ ret(0); | |
| 3625 | |
| 3626 __ bind(&slow_allocate_heapnumber); | |
| 3627 Handle<Code> slow_ic = | |
| 3628 masm->isolate()->builtins()->KeyedLoadIC_Slow(); | |
| 3629 __ jmp(slow_ic, RelocInfo::CODE_TARGET); | |
| 3630 | |
| 3631 __ bind(&miss_force_generic); | |
| 3632 Handle<Code> miss_ic = | |
| 3633 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric(); | |
| 3634 __ jmp(miss_ic, RelocInfo::CODE_TARGET); | |
| 3635 } | |
| 3636 | |
| 3637 | |
| 3587 void KeyedStoreStubCompiler::GenerateStoreFastElement(MacroAssembler* masm, | 3638 void KeyedStoreStubCompiler::GenerateStoreFastElement(MacroAssembler* masm, |
| 3588 bool is_js_array) { | 3639 bool is_js_array) { |
| 3589 // ----------- S t a t e ------------- | 3640 // ----------- S t a t e ------------- |
| 3590 // -- rax : value | 3641 // -- rax : value |
| 3591 // -- rcx : key | 3642 // -- rcx : key |
| 3592 // -- rdx : receiver | 3643 // -- rdx : receiver |
| 3593 // -- rsp[0] : return address | 3644 // -- rsp[0] : return address |
| 3594 // ----------------------------------- | 3645 // ----------------------------------- |
| 3595 Label miss_force_generic; | 3646 Label miss_force_generic; |
| 3596 | 3647 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 3627 __ ret(0); | 3678 __ ret(0); |
| 3628 | 3679 |
| 3629 // Handle store cache miss. | 3680 // Handle store cache miss. |
| 3630 __ bind(&miss_force_generic); | 3681 __ bind(&miss_force_generic); |
| 3631 Handle<Code> ic_force_generic = | 3682 Handle<Code> ic_force_generic = |
| 3632 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 3683 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
| 3633 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | 3684 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); |
| 3634 } | 3685 } |
| 3635 | 3686 |
| 3636 | 3687 |
| 3688 void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement( | |
| 3689 MacroAssembler* masm, | |
| 3690 bool is_js_array) { | |
| 3691 // ----------- S t a t e ------------- | |
| 3692 // -- rax : value | |
| 3693 // -- rcx : key | |
| 3694 // -- rdx : receiver | |
| 3695 // -- rsp[0] : return address | |
| 3696 // ----------------------------------- | |
| 3697 Label miss_force_generic, smi_value, is_nan, have_double_value; | |
| 3698 | |
| 3699 // This stub is meant to be tail-jumped to, the receiver must already | |
| 3700 // have been verified by the caller to not be a smi. | |
| 3701 | |
| 3702 // Check that the key is a smi. | |
| 3703 __ JumpIfNotSmi(rcx, &miss_force_generic); | |
| 3704 | |
| 3705 // Get the elements array. | |
| 3706 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); | |
| 3707 __ AssertFastElements(rdi); | |
| 3708 | |
| 3709 // Check that the key is within bounds. | |
| 3710 if (is_js_array) { | |
| 3711 __ SmiCompare(rcx, FieldOperand(rdx, JSArray::kLengthOffset)); | |
| 3712 __ j(above_equal, &miss_force_generic); | |
|
Mads Ager (chromium)
2011/07/12 12:03:26
Move the branch out of the conditional?
danno
2011/07/13 08:59:52
Done.
| |
| 3713 } else { | |
| 3714 __ SmiCompare(rcx, FieldOperand(rdi, FixedDoubleArray::kLengthOffset)); | |
| 3715 __ j(above_equal, &miss_force_generic); | |
| 3716 } | |
| 3717 | |
| 3718 // Handle smi values specially | |
| 3719 __ JumpIfSmi(rax, &smi_value, Label::kNear); | |
| 3720 | |
| 3721 __ CheckMap(rax, | |
| 3722 masm->isolate()->factory()->heap_number_map(), | |
| 3723 &miss_force_generic, | |
| 3724 DONT_DO_SMI_CHECK); | |
| 3725 | |
| 3726 // Double value, check for any nan and canonicalize. | |
| 3727 uint32_t offset = HeapNumber::kValueOffset + sizeof(kHoleNanLower32); | |
| 3728 __ cmpl(FieldOperand(rax, offset), Immediate(0x7ff00000)); | |
| 3729 __ j(greater, &is_nan, Label::kNear); | |
| 3730 | |
| 3731 ExternalReference canonical_nan_reference = | |
| 3732 ExternalReference::address_of_canonical_non_hole_nan(); | |
| 3733 __ movsd(xmm0, FieldOperand(rax, HeapNumber::kValueOffset)); | |
| 3734 __ bind(&have_double_value); | |
| 3735 | |
| 3736 __ SmiToInteger32(rcx, rcx); | |
| 3737 __ movsd(FieldOperand(rdi, rcx, times_8, FixedDoubleArray::kHeaderSize), | |
| 3738 xmm0); | |
| 3739 __ ret(0); | |
| 3740 | |
| 3741 __ bind(&is_nan); | |
| 3742 // Convert all nans to the same canonical nan value in the double array. | |
| 3743 __ Set(kScratchRegister, kCanonicalNonHoleNanInt64); | |
| 3744 __ movq(xmm0, kScratchRegister); | |
| 3745 __ jmp(&have_double_value, Label::kNear); | |
| 3746 | |
| 3747 __ bind(&smi_value); | |
| 3748 // Value is a smi. convert to a double and store. | |
| 3749 __ SmiToInteger32(rax, rax); | |
| 3750 __ push(rax); | |
| 3751 __ fild_s(Operand(rsp, 0)); | |
| 3752 __ pop(rax); | |
| 3753 __ SmiToInteger32(rcx, rcx); | |
| 3754 __ fstp_d(FieldOperand(rdi, rcx, times_8, FixedDoubleArray::kHeaderSize)); | |
| 3755 __ ret(0); | |
| 3756 | |
| 3757 // Handle store cache miss, replacing the ic with the generic stub. | |
| 3758 __ bind(&miss_force_generic); | |
| 3759 Handle<Code> ic_force_generic = | |
| 3760 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | |
| 3761 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | |
| 3762 } | |
| 3763 | |
| 3764 | |
| 3637 #undef __ | 3765 #undef __ |
| 3638 | 3766 |
| 3639 } } // namespace v8::internal | 3767 } } // namespace v8::internal |
| 3640 | 3768 |
| 3641 #endif // V8_TARGET_ARCH_X64 | 3769 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |