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