| 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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // Write the arguments to stack frame. | 243 // Write the arguments to stack frame. |
| 244 if (is_store) { | 244 if (is_store) { |
| 245 DCHECK(!receiver.is(store_parameter)); | 245 DCHECK(!receiver.is(store_parameter)); |
| 246 DCHECK(!scratch_in.is(store_parameter)); | 246 DCHECK(!scratch_in.is(store_parameter)); |
| 247 __ push(store_parameter); | 247 __ push(store_parameter); |
| 248 } | 248 } |
| 249 DCHECK(optimization.is_simple_api_call()); | 249 DCHECK(optimization.is_simple_api_call()); |
| 250 | 250 |
| 251 // Abi for CallApiFunctionStub. | 251 // Abi for CallApiFunctionStub. |
| 252 Register callee = a0; | 252 Register callee = a0; |
| 253 Register call_data = a4; | 253 Register data = a4; |
| 254 Register holder = a2; | 254 Register holder = a2; |
| 255 Register api_function_address = a1; | 255 Register api_function_address = a1; |
| 256 | 256 |
| 257 // Put callee in place. | 257 // Put callee in place. |
| 258 __ LoadAccessor(callee, holder, accessor_index, | 258 __ LoadAccessor(callee, holder, accessor_index, |
| 259 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); | 259 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); |
| 260 | 260 |
| 261 // Put holder in place. | 261 // Put holder in place. |
| 262 CallOptimization::HolderLookup holder_lookup; | 262 CallOptimization::HolderLookup holder_lookup; |
| 263 Handle<JSObject> api_holder = | 263 Handle<JSObject> api_holder = |
| 264 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup); | 264 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup); |
| 265 switch (holder_lookup) { | 265 switch (holder_lookup) { |
| 266 case CallOptimization::kHolderIsReceiver: | 266 case CallOptimization::kHolderIsReceiver: |
| 267 __ Move(holder, receiver); | 267 __ Move(holder, receiver); |
| 268 break; | 268 break; |
| 269 case CallOptimization::kHolderFound: | 269 case CallOptimization::kHolderFound: |
| 270 __ li(holder, api_holder); | 270 __ li(holder, api_holder); |
| 271 break; | 271 break; |
| 272 case CallOptimization::kHolderNotFound: | 272 case CallOptimization::kHolderNotFound: |
| 273 UNREACHABLE(); | 273 UNREACHABLE(); |
| 274 break; | 274 break; |
| 275 } | 275 } |
| 276 | 276 |
| 277 Isolate* isolate = masm->isolate(); | 277 Isolate* isolate = masm->isolate(); |
| 278 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 278 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
| 279 Handle<Object> call_data_obj(api_call_info->data(), isolate); | |
| 280 | |
| 281 bool call_data_undefined = false; | 279 bool call_data_undefined = false; |
| 282 // Put call_data in place. | 280 // Put call data in place. |
| 283 if (isolate->heap()->InNewSpace(*call_data_obj)) { | 281 if (api_call_info->data()->IsUndefined()) { |
| 284 __ li(call_data, api_call_info); | |
| 285 __ ld(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset)); | |
| 286 } else if (call_data_obj->IsUndefined()) { | |
| 287 call_data_undefined = true; | 282 call_data_undefined = true; |
| 288 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex); | 283 __ LoadRoot(data, Heap::kUndefinedValueRootIndex); |
| 289 } else { | 284 } else { |
| 290 __ li(call_data, call_data_obj); | 285 __ ld(data, FieldMemOperand(callee, JSFunction::kSharedFunctionInfoOffset)); |
| 286 __ ld(data, FieldMemOperand(data, SharedFunctionInfo::kFunctionDataOffset)); |
| 287 __ ld(data, FieldMemOperand(data, FunctionTemplateInfo::kCallCodeOffset)); |
| 288 __ ld(data, FieldMemOperand(data, CallHandlerInfo::kDataOffset)); |
| 291 } | 289 } |
| 292 // Put api_function_address in place. | 290 // Put api_function_address in place. |
| 293 Address function_address = v8::ToCData<Address>(api_call_info->callback()); | 291 Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
| 294 ApiFunction fun(function_address); | 292 ApiFunction fun(function_address); |
| 295 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL; | 293 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL; |
| 296 ExternalReference ref = ExternalReference(&fun, type, masm->isolate()); | 294 ExternalReference ref = ExternalReference(&fun, type, masm->isolate()); |
| 297 __ li(api_function_address, Operand(ref)); | 295 __ li(api_function_address, Operand(ref)); |
| 298 | 296 |
| 299 // Jump to stub. | 297 // Jump to stub. |
| 300 CallApiAccessorStub stub(isolate, is_store, call_data_undefined); | 298 CallApiAccessorStub stub(isolate, is_store, call_data_undefined); |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 // Return the generated code. | 734 // Return the generated code. |
| 737 return GetCode(kind(), Code::NORMAL, name); | 735 return GetCode(kind(), Code::NORMAL, name); |
| 738 } | 736 } |
| 739 | 737 |
| 740 | 738 |
| 741 #undef __ | 739 #undef __ |
| 742 } | 740 } |
| 743 } // namespace v8::internal | 741 } // namespace v8::internal |
| 744 | 742 |
| 745 #endif // V8_TARGET_ARCH_MIPS64 | 743 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |