OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2711 // Handle store cache miss. | 2711 // Handle store cache miss. |
2712 __ bind(&miss); | 2712 __ bind(&miss); |
2713 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); | 2713 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); |
2714 __ Jump(ic, RelocInfo::CODE_TARGET); | 2714 __ Jump(ic, RelocInfo::CODE_TARGET); |
2715 | 2715 |
2716 // Return the generated code. | 2716 // Return the generated code. |
2717 return GetCode(Code::CALLBACKS, name); | 2717 return GetCode(Code::CALLBACKS, name); |
2718 } | 2718 } |
2719 | 2719 |
2720 | 2720 |
2721 Handle<Code> StoreStubCompiler::CompileStoreViaSetter( | 2721 #undef __ |
2722 Handle<String> name, | 2722 #define __ ACCESS_MASM(masm) |
2723 Handle<JSObject> receiver, | 2723 |
2724 Handle<JSObject> holder, | 2724 |
| 2725 void StoreStubCompiler::GenerateStoreViaSetter( |
| 2726 MacroAssembler* masm, |
2725 Handle<JSFunction> setter) { | 2727 Handle<JSFunction> setter) { |
2726 // ----------- S t a t e ------------- | 2728 // ----------- S t a t e ------------- |
2727 // -- a0 : value | 2729 // -- a0 : value |
2728 // -- a1 : receiver | 2730 // -- a1 : receiver |
2729 // -- a2 : name | 2731 // -- a2 : name |
2730 // -- ra : return address | 2732 // -- ra : return address |
2731 // ----------------------------------- | 2733 // ----------------------------------- |
2732 Label miss; | |
2733 | |
2734 // Check that the maps haven't changed. | |
2735 __ JumpIfSmi(a1, &miss); | |
2736 CheckPrototypes(receiver, a1, holder, a3, t0, t1, name, &miss); | |
2737 | |
2738 { | 2734 { |
2739 FrameScope scope(masm(), StackFrame::INTERNAL); | 2735 FrameScope scope(masm, StackFrame::INTERNAL); |
2740 | 2736 |
2741 // Save value register, so we can restore it later. | 2737 // Save value register, so we can restore it later. |
2742 __ push(a0); | 2738 __ push(a0); |
2743 | 2739 |
2744 // Call the JavaScript setter with the receiver and the value on the stack. | 2740 if (!setter.is_null()) { |
2745 __ push(a1); | 2741 // Call the JavaScript setter with receiver and value on the stack. |
2746 __ push(a0); | 2742 __ push(a1); |
2747 ParameterCount actual(1); | 2743 __ push(a0); |
2748 __ InvokeFunction(setter, actual, CALL_FUNCTION, NullCallWrapper(), | 2744 ParameterCount actual(1); |
2749 CALL_AS_METHOD); | 2745 __ InvokeFunction(setter, actual, CALL_FUNCTION, NullCallWrapper(), |
| 2746 CALL_AS_METHOD); |
| 2747 } else { |
| 2748 // If we generate a global code snippet for deoptimization only, remember |
| 2749 // the place to continue after deoptimization. |
| 2750 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
| 2751 } |
2750 | 2752 |
2751 // We have to return the passed value, not the return value of the setter. | 2753 // We have to return the passed value, not the return value of the setter. |
2752 __ pop(v0); | 2754 __ pop(v0); |
2753 | 2755 |
2754 // Restore context register. | 2756 // Restore context register. |
2755 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2757 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2756 } | 2758 } |
2757 __ Ret(); | 2759 __ Ret(); |
| 2760 } |
| 2761 |
| 2762 |
| 2763 #undef __ |
| 2764 #define __ ACCESS_MASM(masm()) |
| 2765 |
| 2766 |
| 2767 Handle<Code> StoreStubCompiler::CompileStoreViaSetter( |
| 2768 Handle<String> name, |
| 2769 Handle<JSObject> receiver, |
| 2770 Handle<JSObject> holder, |
| 2771 Handle<JSFunction> setter) { |
| 2772 // ----------- S t a t e ------------- |
| 2773 // -- a0 : value |
| 2774 // -- a1 : receiver |
| 2775 // -- a2 : name |
| 2776 // -- ra : return address |
| 2777 // ----------------------------------- |
| 2778 Label miss; |
| 2779 |
| 2780 // Check that the maps haven't changed. |
| 2781 __ JumpIfSmi(a1, &miss); |
| 2782 CheckPrototypes(receiver, a1, holder, a3, t0, t1, name, &miss); |
| 2783 |
| 2784 GenerateStoreViaSetter(masm(), setter); |
2758 | 2785 |
2759 __ bind(&miss); | 2786 __ bind(&miss); |
2760 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); | 2787 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); |
2761 __ Jump(ic, RelocInfo::CODE_TARGET); | 2788 __ Jump(ic, RelocInfo::CODE_TARGET); |
2762 | 2789 |
2763 // Return the generated code. | 2790 // Return the generated code. |
2764 return GetCode(Code::CALLBACKS, name); | 2791 return GetCode(Code::CALLBACKS, name); |
2765 } | 2792 } |
2766 | 2793 |
2767 | 2794 |
(...skipping 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4786 __ Jump(ic_slow, RelocInfo::CODE_TARGET); | 4813 __ Jump(ic_slow, RelocInfo::CODE_TARGET); |
4787 } | 4814 } |
4788 } | 4815 } |
4789 | 4816 |
4790 | 4817 |
4791 #undef __ | 4818 #undef __ |
4792 | 4819 |
4793 } } // namespace v8::internal | 4820 } } // namespace v8::internal |
4794 | 4821 |
4795 #endif // V8_TARGET_ARCH_MIPS | 4822 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |