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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 225 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
226 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), | 226 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), |
227 NamedLoadHandlerCompiler::kInterceptorArgsLength); | 227 NamedLoadHandlerCompiler::kInterceptorArgsLength); |
228 } | 228 } |
229 | 229 |
230 | 230 |
231 // Generate call to api function. | 231 // Generate call to api function. |
232 void PropertyHandlerCompiler::GenerateApiAccessorCall( | 232 void PropertyHandlerCompiler::GenerateApiAccessorCall( |
233 MacroAssembler* masm, const CallOptimization& optimization, | 233 MacroAssembler* masm, const CallOptimization& optimization, |
234 Handle<Map> receiver_map, Register receiver, Register scratch_in, | 234 Handle<Map> receiver_map, Register receiver, Register scratch_in, |
235 bool is_store, Register store_parameter) { | 235 bool is_store, Register store_parameter, Register accessor_holder, |
| 236 int accessor_index) { |
| 237 DCHECK(!accessor_holder.is(scratch_in)); |
236 DCHECK(!receiver.is(scratch_in)); | 238 DCHECK(!receiver.is(scratch_in)); |
237 __ push(receiver); | 239 __ push(receiver); |
238 // Write the arguments to stack frame. | 240 // Write the arguments to stack frame. |
239 if (is_store) { | 241 if (is_store) { |
240 DCHECK(!receiver.is(store_parameter)); | 242 DCHECK(!receiver.is(store_parameter)); |
241 DCHECK(!scratch_in.is(store_parameter)); | 243 DCHECK(!scratch_in.is(store_parameter)); |
242 __ push(store_parameter); | 244 __ push(store_parameter); |
243 } | 245 } |
244 DCHECK(optimization.is_simple_api_call()); | 246 DCHECK(optimization.is_simple_api_call()); |
245 | 247 |
246 // Abi for CallApiFunctionStub. | 248 // Abi for CallApiFunctionStub. |
247 Register callee = r0; | 249 Register callee = r0; |
248 Register call_data = r4; | 250 Register call_data = r4; |
249 Register holder = r2; | 251 Register holder = r2; |
250 Register api_function_address = r1; | 252 Register api_function_address = r1; |
251 | 253 |
| 254 // Put callee in place. |
| 255 __ LoadAccessor(callee, accessor_holder, accessor_index, |
| 256 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); |
| 257 |
252 // Put holder in place. | 258 // Put holder in place. |
253 CallOptimization::HolderLookup holder_lookup; | 259 CallOptimization::HolderLookup holder_lookup; |
254 Handle<JSObject> api_holder = | 260 Handle<JSObject> api_holder = |
255 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup); | 261 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup); |
256 switch (holder_lookup) { | 262 switch (holder_lookup) { |
257 case CallOptimization::kHolderIsReceiver: | 263 case CallOptimization::kHolderIsReceiver: |
258 __ Move(holder, receiver); | 264 __ Move(holder, receiver); |
259 break; | 265 break; |
260 case CallOptimization::kHolderFound: | 266 case CallOptimization::kHolderFound: |
261 __ Move(holder, api_holder); | 267 __ Move(holder, api_holder); |
262 break; | 268 break; |
263 case CallOptimization::kHolderNotFound: | 269 case CallOptimization::kHolderNotFound: |
264 UNREACHABLE(); | 270 UNREACHABLE(); |
265 break; | 271 break; |
266 } | 272 } |
267 | 273 |
268 Isolate* isolate = masm->isolate(); | 274 Isolate* isolate = masm->isolate(); |
269 Handle<JSFunction> function = optimization.constant_function(); | |
270 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 275 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
271 Handle<Object> call_data_obj(api_call_info->data(), isolate); | 276 Handle<Object> call_data_obj(api_call_info->data(), isolate); |
272 | 277 |
273 // Put callee in place. | |
274 __ Move(callee, function); | |
275 | |
276 bool call_data_undefined = false; | 278 bool call_data_undefined = false; |
277 // Put call_data in place. | 279 // Put call_data in place. |
278 if (isolate->heap()->InNewSpace(*call_data_obj)) { | 280 if (isolate->heap()->InNewSpace(*call_data_obj)) { |
279 __ Move(call_data, api_call_info); | 281 __ Move(call_data, api_call_info); |
280 __ ldr(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset)); | 282 __ ldr(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset)); |
281 } else if (call_data_obj->IsUndefined()) { | 283 } else if (call_data_obj->IsUndefined()) { |
282 call_data_undefined = true; | 284 call_data_undefined = true; |
283 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex); | 285 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex); |
284 } else { | 286 } else { |
285 __ Move(call_data, call_data_obj); | 287 __ Move(call_data, call_data_obj); |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 // Return the generated code. | 732 // Return the generated code. |
731 return GetCode(kind(), Code::NORMAL, name); | 733 return GetCode(kind(), Code::NORMAL, name); |
732 } | 734 } |
733 | 735 |
734 | 736 |
735 #undef __ | 737 #undef __ |
736 } | 738 } |
737 } // namespace v8::internal | 739 } // namespace v8::internal |
738 | 740 |
739 #endif // V8_TARGET_ARCH_ARM | 741 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |