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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 Handle<JSObject> holder_obj, | 386 Handle<JSObject> holder_obj, |
387 IC::UtilityId id) { | 387 IC::UtilityId id) { |
388 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 388 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
389 __ CallExternalReference( | 389 __ CallExternalReference( |
390 ExternalReference(IC_Utility(id), masm->isolate()), | 390 ExternalReference(IC_Utility(id), masm->isolate()), |
391 StubCache::kInterceptorArgsLength); | 391 StubCache::kInterceptorArgsLength); |
392 } | 392 } |
393 | 393 |
394 | 394 |
395 // Generate call to api function. | 395 // Generate call to api function. |
396 static void GenerateFastApiCall(MacroAssembler* masm, | 396 void StubCompiler::GenerateFastApiCall(MacroAssembler* masm, |
397 const CallOptimization& optimization, | 397 const CallOptimization& optimization, |
398 Handle<Map> receiver_map, | 398 Handle<Map> receiver_map, |
399 Register receiver, | 399 Register receiver, |
400 Register scratch_in, | 400 Register scratch_in, |
401 bool is_store, | 401 bool is_store, |
402 int argc, | 402 int argc, |
403 Register* values) { | 403 Register* values) { |
404 ASSERT(optimization.is_simple_api_call()); | 404 ASSERT(optimization.is_simple_api_call()); |
405 | 405 |
406 __ PopReturnAddressTo(scratch_in); | 406 __ PopReturnAddressTo(scratch_in); |
407 // receiver | 407 // receiver |
408 __ push(receiver); | 408 __ push(receiver); |
409 // Write the arguments to stack frame. | 409 // Write the arguments to stack frame. |
410 for (int i = 0; i < argc; i++) { | 410 for (int i = 0; i < argc; i++) { |
411 Register arg = values[argc-1-i]; | 411 Register arg = values[argc-1-i]; |
412 ASSERT(!receiver.is(arg)); | 412 ASSERT(!receiver.is(arg)); |
413 ASSERT(!scratch_in.is(arg)); | 413 ASSERT(!scratch_in.is(arg)); |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 } else { | 964 } else { |
965 KeyedLoadFieldStub stub(field.is_inobject(holder), | 965 KeyedLoadFieldStub stub(field.is_inobject(holder), |
966 field.translate(holder), | 966 field.translate(holder), |
967 representation); | 967 representation); |
968 GenerateTailCall(masm(), stub.GetCode(isolate())); | 968 GenerateTailCall(masm(), stub.GetCode(isolate())); |
969 } | 969 } |
970 } | 970 } |
971 | 971 |
972 | 972 |
973 void LoadStubCompiler::GenerateLoadCallback( | 973 void LoadStubCompiler::GenerateLoadCallback( |
974 const CallOptimization& call_optimization, | |
975 Handle<Map> receiver_map) { | |
976 GenerateFastApiCall( | |
977 masm(), call_optimization, receiver_map, | |
978 receiver(), scratch1(), false, 0, NULL); | |
979 } | |
980 | |
981 | |
982 void LoadStubCompiler::GenerateLoadCallback( | |
983 Register reg, | 974 Register reg, |
984 Handle<ExecutableAccessorInfo> callback) { | 975 Handle<ExecutableAccessorInfo> callback) { |
985 // Insert additional parameters into the stack frame above return address. | 976 // Insert additional parameters into the stack frame above return address. |
986 ASSERT(!scratch4().is(reg)); | 977 ASSERT(!scratch4().is(reg)); |
987 __ PopReturnAddressTo(scratch4()); | 978 __ PopReturnAddressTo(scratch4()); |
988 | 979 |
989 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); | 980 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); |
990 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); | 981 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); |
991 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); | 982 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); |
992 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); | 983 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 // Do tail-call to the runtime system. | 1143 // Do tail-call to the runtime system. |
1153 ExternalReference store_callback_property = | 1144 ExternalReference store_callback_property = |
1154 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 1145 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
1155 __ TailCallExternalReference(store_callback_property, 5, 1); | 1146 __ TailCallExternalReference(store_callback_property, 5, 1); |
1156 | 1147 |
1157 // Return the generated code. | 1148 // Return the generated code. |
1158 return GetCode(kind(), Code::FAST, name); | 1149 return GetCode(kind(), Code::FAST, name); |
1159 } | 1150 } |
1160 | 1151 |
1161 | 1152 |
1162 Handle<Code> StoreStubCompiler::CompileStoreCallback( | |
1163 Handle<JSObject> object, | |
1164 Handle<JSObject> holder, | |
1165 Handle<Name> name, | |
1166 const CallOptimization& call_optimization) { | |
1167 HandlerFrontend(IC::CurrentTypeOf(object, isolate()), | |
1168 receiver(), holder, name); | |
1169 | |
1170 Register values[] = { value() }; | |
1171 GenerateFastApiCall( | |
1172 masm(), call_optimization, handle(object->map()), | |
1173 receiver(), scratch1(), true, 1, values); | |
1174 | |
1175 // Return the generated code. | |
1176 return GetCode(kind(), Code::FAST, name); | |
1177 } | |
1178 | |
1179 | |
1180 #undef __ | 1153 #undef __ |
1181 #define __ ACCESS_MASM(masm) | 1154 #define __ ACCESS_MASM(masm) |
1182 | 1155 |
1183 | 1156 |
1184 void StoreStubCompiler::GenerateStoreViaSetter( | 1157 void StoreStubCompiler::GenerateStoreViaSetter( |
1185 MacroAssembler* masm, | 1158 MacroAssembler* masm, |
1186 Handle<HeapType> type, | 1159 Handle<HeapType> type, |
1187 Handle<JSFunction> setter) { | 1160 Handle<JSFunction> setter) { |
1188 // ----------- S t a t e ------------- | 1161 // ----------- S t a t e ------------- |
1189 // -- rax : value | 1162 // -- rax : value |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 // ----------------------------------- | 1476 // ----------------------------------- |
1504 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1477 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
1505 } | 1478 } |
1506 | 1479 |
1507 | 1480 |
1508 #undef __ | 1481 #undef __ |
1509 | 1482 |
1510 } } // namespace v8::internal | 1483 } } // namespace v8::internal |
1511 | 1484 |
1512 #endif // V8_TARGET_ARCH_X64 | 1485 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |