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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), | 143 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), |
144 NamedLoadHandlerCompiler::kInterceptorArgsLength); | 144 NamedLoadHandlerCompiler::kInterceptorArgsLength); |
145 } | 145 } |
146 | 146 |
147 | 147 |
148 // Generate call to api function. | 148 // Generate call to api function. |
149 void PropertyHandlerCompiler::GenerateApiAccessorCall( | 149 void PropertyHandlerCompiler::GenerateApiAccessorCall( |
150 MacroAssembler* masm, const CallOptimization& optimization, | 150 MacroAssembler* masm, const CallOptimization& optimization, |
151 Handle<Map> receiver_map, Register receiver, Register scratch, | 151 Handle<Map> receiver_map, Register receiver, Register scratch, |
152 bool is_store, Register store_parameter) { | 152 bool is_store, Register store_parameter, Register accessor_holder, |
| 153 int accessor_index) { |
| 154 DCHECK(!AreAliased(accessor_holder, scratch)); |
153 DCHECK(!AreAliased(receiver, scratch)); | 155 DCHECK(!AreAliased(receiver, scratch)); |
154 | 156 |
155 MacroAssembler::PushPopQueue queue(masm); | 157 MacroAssembler::PushPopQueue queue(masm); |
156 queue.Queue(receiver); | 158 queue.Queue(receiver); |
157 // Write the arguments to the stack frame. | 159 // Write the arguments to the stack frame. |
158 if (is_store) { | 160 if (is_store) { |
159 DCHECK(!receiver.is(store_parameter)); | 161 DCHECK(!receiver.is(store_parameter)); |
160 DCHECK(!scratch.is(store_parameter)); | 162 DCHECK(!scratch.is(store_parameter)); |
161 queue.Queue(store_parameter); | 163 queue.Queue(store_parameter); |
162 } | 164 } |
163 queue.PushQueued(); | 165 queue.PushQueued(); |
164 | 166 |
165 DCHECK(optimization.is_simple_api_call()); | 167 DCHECK(optimization.is_simple_api_call()); |
166 | 168 |
167 // Abi for CallApiFunctionStub. | 169 // Abi for CallApiFunctionStub. |
168 Register callee = x0; | 170 Register callee = x0; |
169 Register call_data = x4; | 171 Register call_data = x4; |
170 Register holder = x2; | 172 Register holder = x2; |
171 Register api_function_address = x1; | 173 Register api_function_address = x1; |
172 | 174 |
| 175 // Put callee in place. |
| 176 __ LoadAccessor(callee, accessor_holder, accessor_index, |
| 177 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); |
| 178 |
173 // Put holder in place. | 179 // Put holder in place. |
174 CallOptimization::HolderLookup holder_lookup; | 180 CallOptimization::HolderLookup holder_lookup; |
175 Handle<JSObject> api_holder = | 181 Handle<JSObject> api_holder = |
176 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup); | 182 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup); |
177 switch (holder_lookup) { | 183 switch (holder_lookup) { |
178 case CallOptimization::kHolderIsReceiver: | 184 case CallOptimization::kHolderIsReceiver: |
179 __ Mov(holder, receiver); | 185 __ Mov(holder, receiver); |
180 break; | 186 break; |
181 case CallOptimization::kHolderFound: | 187 case CallOptimization::kHolderFound: |
182 __ LoadObject(holder, api_holder); | 188 __ LoadObject(holder, api_holder); |
183 break; | 189 break; |
184 case CallOptimization::kHolderNotFound: | 190 case CallOptimization::kHolderNotFound: |
185 UNREACHABLE(); | 191 UNREACHABLE(); |
186 break; | 192 break; |
187 } | 193 } |
188 | 194 |
189 Isolate* isolate = masm->isolate(); | 195 Isolate* isolate = masm->isolate(); |
190 Handle<JSFunction> function = optimization.constant_function(); | |
191 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 196 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
192 Handle<Object> call_data_obj(api_call_info->data(), isolate); | 197 Handle<Object> call_data_obj(api_call_info->data(), isolate); |
193 | 198 |
194 // Put callee in place. | |
195 __ LoadObject(callee, function); | |
196 | |
197 bool call_data_undefined = false; | 199 bool call_data_undefined = false; |
198 // Put call_data in place. | 200 // Put call_data in place. |
199 if (isolate->heap()->InNewSpace(*call_data_obj)) { | 201 if (isolate->heap()->InNewSpace(*call_data_obj)) { |
200 __ LoadObject(call_data, api_call_info); | 202 __ LoadObject(call_data, api_call_info); |
201 __ Ldr(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset)); | 203 __ Ldr(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset)); |
202 } else if (call_data_obj->IsUndefined()) { | 204 } else if (call_data_obj->IsUndefined()) { |
203 call_data_undefined = true; | 205 call_data_undefined = true; |
204 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex); | 206 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex); |
205 } else { | 207 } else { |
206 __ LoadObject(call_data, call_data_obj); | 208 __ LoadObject(call_data, call_data_obj); |
(...skipping 12 matching lines...) Expand all Loading... |
219 } | 221 } |
220 | 222 |
221 | 223 |
222 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( | 224 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( |
223 MacroAssembler* masm, Handle<HeapType> type, Register receiver, | 225 MacroAssembler* masm, Handle<HeapType> type, Register receiver, |
224 Register holder, int accessor_index, int expected_arguments) { | 226 Register holder, int accessor_index, int expected_arguments) { |
225 // ----------- S t a t e ------------- | 227 // ----------- S t a t e ------------- |
226 // -- lr : return address | 228 // -- lr : return address |
227 // ----------------------------------- | 229 // ----------------------------------- |
228 Label miss; | 230 Label miss; |
229 | |
230 { | 231 { |
231 FrameScope scope(masm, StackFrame::INTERNAL); | 232 FrameScope scope(masm, StackFrame::INTERNAL); |
232 | 233 |
233 // Save value register, so we can restore it later. | 234 // Save value register, so we can restore it later. |
234 __ Push(value()); | 235 __ Push(value()); |
235 | 236 |
236 if (accessor_index >= 0) { | 237 if (accessor_index >= 0) { |
237 // Call the JavaScript setter with receiver and value on the stack. | 238 // Call the JavaScript setter with receiver and value on the stack. |
238 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 239 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
239 // Swap in the global receiver. | 240 // Swap in the global receiver. |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 // Return the generated code. | 747 // Return the generated code. |
747 return GetCode(kind(), Code::FAST, name); | 748 return GetCode(kind(), Code::FAST, name); |
748 } | 749 } |
749 | 750 |
750 | 751 |
751 #undef __ | 752 #undef __ |
752 } | 753 } |
753 } // namespace v8::internal | 754 } // namespace v8::internal |
754 | 755 |
755 #endif // V8_TARGET_ARCH_IA32 | 756 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |