OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/ic/call-optimization.h" | 9 #include "src/ic/call-optimization.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 // Restore context register. | 53 // Restore context register. |
54 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 54 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
55 } | 55 } |
56 __ Ret(); | 56 __ Ret(); |
57 } | 57 } |
58 | 58 |
59 | 59 |
60 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( | 60 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( |
61 MacroAssembler* masm, Handle<HeapType> type, Register receiver, | 61 MacroAssembler* masm, Handle<HeapType> type, Register receiver, |
62 Handle<JSFunction> setter) { | 62 Register holder, int accessor_index, int expected_arguments) { |
63 // ----------- S t a t e ------------- | 63 // ----------- S t a t e ------------- |
64 // -- lr : return address | 64 // -- lr : return address |
65 // ----------------------------------- | 65 // ----------------------------------- |
66 { | 66 { |
67 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 67 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
68 | 68 |
69 // Save value register, so we can restore it later. | 69 // Save value register, so we can restore it later. |
70 __ push(value()); | 70 __ push(value()); |
71 | 71 |
72 if (!setter.is_null()) { | 72 if (accessor_index >= 0) { |
73 // Call the JavaScript setter with receiver and value on the stack. | 73 // Call the JavaScript setter with receiver and value on the stack. |
74 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 74 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
75 // Swap in the global receiver. | 75 // Swap in the global receiver. |
76 __ ldr(receiver, | 76 __ ldr(receiver, |
77 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | 77 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
78 } | 78 } |
79 __ Push(receiver, value()); | 79 __ Push(receiver, value()); |
80 ParameterCount actual(1); | 80 ParameterCount actual(1); |
81 ParameterCount expected(setter); | 81 ParameterCount expected(expected_arguments); |
82 __ InvokeFunction(setter, expected, actual, CALL_FUNCTION, | 82 Register scratch = holder; |
83 NullCallWrapper()); | 83 __ ldr(scratch, FieldMemOperand(holder, HeapObject::kMapOffset)); |
| 84 __ LoadInstanceDescriptors(scratch, scratch); |
| 85 __ ldr(scratch, FieldMemOperand(scratch, DescriptorArray::GetValueOffset( |
| 86 accessor_index))); |
| 87 __ ldr(r1, FieldMemOperand(scratch, AccessorPair::kSetterOffset)); |
| 88 __ InvokeFunction(r1, expected, actual, CALL_FUNCTION, NullCallWrapper()); |
84 } else { | 89 } else { |
85 // If we generate a global code snippet for deoptimization only, remember | 90 // If we generate a global code snippet for deoptimization only, remember |
86 // the place to continue after deoptimization. | 91 // the place to continue after deoptimization. |
87 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); | 92 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
88 } | 93 } |
89 | 94 |
90 // We have to return the passed value, not the return value of the setter. | 95 // We have to return the passed value, not the return value of the setter. |
91 __ pop(r0); | 96 __ pop(r0); |
92 | 97 |
93 // Restore context register. | 98 // Restore context register. |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 // Return the generated code. | 740 // Return the generated code. |
736 return GetCode(kind(), Code::NORMAL, name); | 741 return GetCode(kind(), Code::NORMAL, name); |
737 } | 742 } |
738 | 743 |
739 | 744 |
740 #undef __ | 745 #undef __ |
741 } | 746 } |
742 } // namespace v8::internal | 747 } // namespace v8::internal |
743 | 748 |
744 #endif // V8_TARGET_ARCH_ARM | 749 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |