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 2629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2640 // Handle store cache miss. | 2640 // Handle store cache miss. |
2641 __ bind(&miss); | 2641 __ bind(&miss); |
2642 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); | 2642 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); |
2643 __ jmp(ic, RelocInfo::CODE_TARGET); | 2643 __ jmp(ic, RelocInfo::CODE_TARGET); |
2644 | 2644 |
2645 // Return the generated code. | 2645 // Return the generated code. |
2646 return GetCode(Code::CALLBACKS, name); | 2646 return GetCode(Code::CALLBACKS, name); |
2647 } | 2647 } |
2648 | 2648 |
2649 | 2649 |
2650 Handle<Code> StoreStubCompiler::CompileStoreViaSetter( | 2650 #undef __ |
2651 Handle<String> name, | 2651 #define __ ACCESS_MASM(masm) |
2652 Handle<JSObject> receiver, | 2652 |
2653 Handle<JSObject> holder, | 2653 |
2654 void StoreStubCompiler::GenerateStoreViaSetter( | |
2655 MacroAssembler* masm, | |
2654 Handle<JSFunction> setter) { | 2656 Handle<JSFunction> setter) { |
2655 // ----------- S t a t e ------------- | 2657 // ----------- S t a t e ------------- |
2656 // -- eax : value | 2658 // -- eax : value |
2657 // -- ecx : name | 2659 // -- ecx : name |
2658 // -- edx : receiver | 2660 // -- edx : receiver |
2659 // -- esp[0] : return address | 2661 // -- esp[0] : return address |
2660 // ----------------------------------- | 2662 // ----------------------------------- |
2661 Label miss; | |
2662 | |
2663 // Check that the maps haven't changed, preserving the name register. | |
2664 __ push(ecx); | |
2665 __ JumpIfSmi(edx, &miss); | |
2666 CheckPrototypes(receiver, edx, holder, ebx, ecx, edi, name, &miss); | |
2667 __ pop(ecx); | |
2668 | |
2669 { | 2663 { |
2670 FrameScope scope(masm(), StackFrame::INTERNAL); | 2664 FrameScope scope(masm, StackFrame::INTERNAL); |
2671 | 2665 |
2672 // Save value register, so we can restore it later. | 2666 // Save value register, so we can restore it later. |
2673 __ push(eax); | 2667 __ push(eax); |
2674 | 2668 |
2675 // Call the JavaScript setter with the receiver and the value on the stack. | 2669 if (setter.is_null()) { |
Michael Starzinger
2012/08/16 17:20:04
Can we flip the condition, thereby the return poin
Sven Panne
2012/08/17 07:27:26
Good point. Done here and on other platforms.
| |
2676 __ push(edx); | 2670 // If we generate a global code snippet for deoptimization only, remember |
2677 __ push(eax); | 2671 // the place to continue after deoptimization. |
2678 ParameterCount actual(1); | 2672 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
2679 __ InvokeFunction(setter, actual, CALL_FUNCTION, NullCallWrapper(), | 2673 } else { |
2680 CALL_AS_METHOD); | 2674 // Call the JavaScript setter with receiver and value on the stack. |
2675 __ push(edx); | |
2676 __ push(eax); | |
2677 ParameterCount actual(1); | |
2678 __ InvokeFunction(setter, actual, CALL_FUNCTION, NullCallWrapper(), | |
2679 CALL_AS_METHOD); | |
2680 } | |
2681 | 2681 |
2682 // We have to return the passed value, not the return value of the setter. | 2682 // We have to return the passed value, not the return value of the setter. |
2683 __ pop(eax); | 2683 __ pop(eax); |
2684 | 2684 |
2685 // Restore context register. | 2685 // Restore context register. |
2686 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2686 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
2687 } | 2687 } |
2688 __ ret(0); | 2688 __ ret(0); |
2689 } | |
2690 | |
2691 | |
2692 #undef __ | |
2693 #define __ ACCESS_MASM(masm()) | |
2694 | |
2695 | |
2696 Handle<Code> StoreStubCompiler::CompileStoreViaSetter( | |
2697 Handle<String> name, | |
2698 Handle<JSObject> receiver, | |
2699 Handle<JSObject> holder, | |
2700 Handle<JSFunction> setter) { | |
2701 // ----------- S t a t e ------------- | |
2702 // -- eax : value | |
2703 // -- ecx : name | |
2704 // -- edx : receiver | |
2705 // -- esp[0] : return address | |
2706 // ----------------------------------- | |
2707 Label miss; | |
2708 | |
2709 // Check that the maps haven't changed, preserving the name register. | |
2710 __ push(ecx); | |
2711 __ JumpIfSmi(edx, &miss); | |
2712 CheckPrototypes(receiver, edx, holder, ebx, ecx, edi, name, &miss); | |
2713 __ pop(ecx); | |
2714 | |
2715 GenerateStoreViaSetter(masm(), setter); | |
2689 | 2716 |
2690 __ bind(&miss); | 2717 __ bind(&miss); |
2691 __ pop(ecx); | 2718 __ pop(ecx); |
2692 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); | 2719 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); |
2693 __ jmp(ic, RelocInfo::CODE_TARGET); | 2720 __ jmp(ic, RelocInfo::CODE_TARGET); |
2694 | 2721 |
2695 // Return the generated code. | 2722 // Return the generated code. |
2696 return GetCode(Code::CALLBACKS, name); | 2723 return GetCode(Code::CALLBACKS, name); |
2697 } | 2724 } |
2698 | 2725 |
(...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4304 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 4331 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
4305 } | 4332 } |
4306 } | 4333 } |
4307 | 4334 |
4308 | 4335 |
4309 #undef __ | 4336 #undef __ |
4310 | 4337 |
4311 } } // namespace v8::internal | 4338 } } // namespace v8::internal |
4312 | 4339 |
4313 #endif // V8_TARGET_ARCH_IA32 | 4340 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |