OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 __ CallExternalReference( | 415 __ CallExternalReference( |
416 ExternalReference(IC_Utility(id), masm->isolate()), | 416 ExternalReference(IC_Utility(id), masm->isolate()), |
417 StubCache::kInterceptorArgsLength); | 417 StubCache::kInterceptorArgsLength); |
418 } | 418 } |
419 | 419 |
420 | 420 |
421 // Generate call to api function. | 421 // Generate call to api function. |
422 // This function uses push() to generate smaller, faster code than | 422 // This function uses push() to generate smaller, faster code than |
423 // the version above. It is an optimization that should will be removed | 423 // the version above. It is an optimization that should will be removed |
424 // when api call ICs are generated in hydrogen. | 424 // when api call ICs are generated in hydrogen. |
425 static void GenerateFastApiCall(MacroAssembler* masm, | 425 void StubCompiler::GenerateFastApiCall(MacroAssembler* masm, |
426 const CallOptimization& optimization, | 426 const CallOptimization& optimization, |
427 Handle<Map> receiver_map, | 427 Handle<Map> receiver_map, |
428 Register receiver, | 428 Register receiver, |
429 Register scratch_in, | 429 Register scratch_in, |
430 bool is_store, | 430 bool is_store, |
431 int argc, | 431 int argc, |
432 Register* values) { | 432 Register* values) { |
433 // Copy return value. | 433 // Copy return value. |
434 __ pop(scratch_in); | 434 __ pop(scratch_in); |
435 // receiver | 435 // receiver |
436 __ push(receiver); | 436 __ push(receiver); |
437 // Write the arguments to stack frame. | 437 // Write the arguments to stack frame. |
438 for (int i = 0; i < argc; i++) { | 438 for (int i = 0; i < argc; i++) { |
439 Register arg = values[argc-1-i]; | 439 Register arg = values[argc-1-i]; |
440 ASSERT(!receiver.is(arg)); | 440 ASSERT(!receiver.is(arg)); |
441 ASSERT(!scratch_in.is(arg)); | 441 ASSERT(!scratch_in.is(arg)); |
442 __ push(arg); | 442 __ push(arg); |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 } else { | 1060 } else { |
1061 KeyedLoadFieldStub stub(field.is_inobject(holder), | 1061 KeyedLoadFieldStub stub(field.is_inobject(holder), |
1062 field.translate(holder), | 1062 field.translate(holder), |
1063 representation); | 1063 representation); |
1064 GenerateTailCall(masm(), stub.GetCode(isolate())); | 1064 GenerateTailCall(masm(), stub.GetCode(isolate())); |
1065 } | 1065 } |
1066 } | 1066 } |
1067 | 1067 |
1068 | 1068 |
1069 void LoadStubCompiler::GenerateLoadCallback( | 1069 void LoadStubCompiler::GenerateLoadCallback( |
1070 const CallOptimization& call_optimization, | |
1071 Handle<Map> receiver_map) { | |
1072 GenerateFastApiCall( | |
1073 masm(), call_optimization, receiver_map, | |
1074 receiver(), scratch1(), false, 0, NULL); | |
1075 } | |
1076 | |
1077 | |
1078 void LoadStubCompiler::GenerateLoadCallback( | |
1079 Register reg, | 1070 Register reg, |
1080 Handle<ExecutableAccessorInfo> callback) { | 1071 Handle<ExecutableAccessorInfo> callback) { |
1081 // Insert additional parameters into the stack frame above return address. | 1072 // Insert additional parameters into the stack frame above return address. |
1082 ASSERT(!scratch3().is(reg)); | 1073 ASSERT(!scratch3().is(reg)); |
1083 __ pop(scratch3()); // Get return address to place it below. | 1074 __ pop(scratch3()); // Get return address to place it below. |
1084 | 1075 |
1085 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); | 1076 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); |
1086 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); | 1077 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); |
1087 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); | 1078 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); |
1088 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); | 1079 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 // Do tail-call to the runtime system. | 1248 // Do tail-call to the runtime system. |
1258 ExternalReference store_callback_property = | 1249 ExternalReference store_callback_property = |
1259 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 1250 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
1260 __ TailCallExternalReference(store_callback_property, 5, 1); | 1251 __ TailCallExternalReference(store_callback_property, 5, 1); |
1261 | 1252 |
1262 // Return the generated code. | 1253 // Return the generated code. |
1263 return GetCode(kind(), Code::FAST, name); | 1254 return GetCode(kind(), Code::FAST, name); |
1264 } | 1255 } |
1265 | 1256 |
1266 | 1257 |
1267 Handle<Code> StoreStubCompiler::CompileStoreCallback( | |
1268 Handle<JSObject> object, | |
1269 Handle<JSObject> holder, | |
1270 Handle<Name> name, | |
1271 const CallOptimization& call_optimization) { | |
1272 HandlerFrontend(IC::CurrentTypeOf(object, isolate()), | |
1273 receiver(), holder, name); | |
1274 | |
1275 Register values[] = { value() }; | |
1276 GenerateFastApiCall( | |
1277 masm(), call_optimization, handle(object->map()), | |
1278 receiver(), scratch1(), true, 1, values); | |
1279 | |
1280 // Return the generated code. | |
1281 return GetCode(kind(), Code::FAST, name); | |
1282 } | |
1283 | |
1284 | |
1285 #undef __ | 1258 #undef __ |
1286 #define __ ACCESS_MASM(masm) | 1259 #define __ ACCESS_MASM(masm) |
1287 | 1260 |
1288 | 1261 |
1289 void StoreStubCompiler::GenerateStoreViaSetter( | 1262 void StoreStubCompiler::GenerateStoreViaSetter( |
1290 MacroAssembler* masm, | 1263 MacroAssembler* masm, |
1291 Handle<HeapType> type, | 1264 Handle<HeapType> type, |
1292 Handle<JSFunction> setter) { | 1265 Handle<JSFunction> setter) { |
1293 // ----------- S t a t e ------------- | 1266 // ----------- S t a t e ------------- |
1294 // -- eax : value | 1267 // -- eax : value |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 // ----------------------------------- | 1571 // ----------------------------------- |
1599 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1572 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
1600 } | 1573 } |
1601 | 1574 |
1602 | 1575 |
1603 #undef __ | 1576 #undef __ |
1604 | 1577 |
1605 } } // namespace v8::internal | 1578 } } // namespace v8::internal |
1606 | 1579 |
1607 #endif // V8_TARGET_ARCH_IA32 | 1580 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |