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 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 // applicable. | 982 // applicable. |
983 if (!holder.is_identical_to(receiver)) return; | 983 if (!holder.is_identical_to(receiver)) return; |
984 code = isolate()->stub_cache()->ComputeLoadNormal(); | 984 code = isolate()->stub_cache()->ComputeLoadNormal(); |
985 } | 985 } |
986 break; | 986 break; |
987 case CALLBACKS: { | 987 case CALLBACKS: { |
988 Handle<Object> callback(lookup->GetCallbackObject()); | 988 Handle<Object> callback(lookup->GetCallbackObject()); |
989 if (callback->IsAccessorInfo()) { | 989 if (callback->IsAccessorInfo()) { |
990 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(callback); | 990 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(callback); |
991 if (v8::ToCData<Address>(info->getter()) == 0) return; | 991 if (v8::ToCData<Address>(info->getter()) == 0) return; |
992 if (!receiver->HasFastProperties()) return; | 992 if (!holder->HasFastProperties()) return; |
993 if (!info->IsCompatibleReceiver(*receiver)) return; | 993 if (!info->IsCompatibleReceiver(*receiver)) return; |
994 code = isolate()->stub_cache()->ComputeLoadCallback( | 994 code = isolate()->stub_cache()->ComputeLoadCallback( |
995 name, receiver, holder, info); | 995 name, receiver, holder, info); |
996 } else if (callback->IsAccessorPair()) { | 996 } else if (callback->IsAccessorPair()) { |
997 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter()); | 997 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter()); |
998 if (!getter->IsJSFunction()) return; | 998 if (!getter->IsJSFunction()) return; |
999 if (holder->IsGlobalObject()) return; | 999 if (holder->IsGlobalObject()) return; |
1000 if (!receiver->HasFastProperties()) return; | 1000 if (!holder->HasFastProperties()) return; |
1001 code = isolate()->stub_cache()->ComputeLoadViaGetter( | 1001 code = isolate()->stub_cache()->ComputeLoadViaGetter( |
1002 name, receiver, holder, Handle<JSFunction>::cast(getter)); | 1002 name, receiver, holder, Handle<JSFunction>::cast(getter)); |
1003 } else { | 1003 } else { |
1004 ASSERT(callback->IsForeign()); | 1004 ASSERT(callback->IsForeign()); |
1005 // No IC support for old-style native accessors. | 1005 // No IC support for old-style native accessors. |
1006 return; | 1006 return; |
1007 } | 1007 } |
1008 break; | 1008 break; |
1009 } | 1009 } |
1010 case INTERCEPTOR: | 1010 case INTERCEPTOR: |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 code = isolate()->stub_cache()->ComputeKeyedLoadConstant( | 1259 code = isolate()->stub_cache()->ComputeKeyedLoadConstant( |
1260 name, receiver, holder, constant); | 1260 name, receiver, holder, constant); |
1261 break; | 1261 break; |
1262 } | 1262 } |
1263 case CALLBACKS: { | 1263 case CALLBACKS: { |
1264 Handle<Object> callback_object(lookup->GetCallbackObject()); | 1264 Handle<Object> callback_object(lookup->GetCallbackObject()); |
1265 if (!callback_object->IsAccessorInfo()) return; | 1265 if (!callback_object->IsAccessorInfo()) return; |
1266 Handle<AccessorInfo> callback = | 1266 Handle<AccessorInfo> callback = |
1267 Handle<AccessorInfo>::cast(callback_object); | 1267 Handle<AccessorInfo>::cast(callback_object); |
1268 if (v8::ToCData<Address>(callback->getter()) == 0) return; | 1268 if (v8::ToCData<Address>(callback->getter()) == 0) return; |
1269 if (!receiver->HasFastProperties()) return; | 1269 if (!holder->HasFastProperties()) return; |
1270 if (!callback->IsCompatibleReceiver(*receiver)) return; | 1270 if (!callback->IsCompatibleReceiver(*receiver)) return; |
1271 code = isolate()->stub_cache()->ComputeKeyedLoadCallback( | 1271 code = isolate()->stub_cache()->ComputeKeyedLoadCallback( |
1272 name, receiver, holder, callback); | 1272 name, receiver, holder, callback); |
1273 break; | 1273 break; |
1274 } | 1274 } |
1275 case INTERCEPTOR: | 1275 case INTERCEPTOR: |
1276 ASSERT(HasInterceptorGetter(lookup->holder())); | 1276 ASSERT(HasInterceptorGetter(lookup->holder())); |
1277 code = isolate()->stub_cache()->ComputeKeyedLoadInterceptor( | 1277 code = isolate()->stub_cache()->ComputeKeyedLoadInterceptor( |
1278 name, receiver, holder); | 1278 name, receiver, holder); |
1279 break; | 1279 break; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 LookupResult* lookup) { | 1318 LookupResult* lookup) { |
1319 receiver->LocalLookup(*name, lookup); | 1319 receiver->LocalLookup(*name, lookup); |
1320 if (!lookup->IsFound()) { | 1320 if (!lookup->IsFound()) { |
1321 receiver->map()->LookupTransition(*receiver, *name, lookup); | 1321 receiver->map()->LookupTransition(*receiver, *name, lookup); |
1322 } | 1322 } |
1323 if (!StoreICableLookup(lookup)) { | 1323 if (!StoreICableLookup(lookup)) { |
1324 // 2nd chance: There can be accessors somewhere in the prototype chain. Note | 1324 // 2nd chance: There can be accessors somewhere in the prototype chain. Note |
1325 // that we explicitly exclude native accessors for now, because the stubs | 1325 // that we explicitly exclude native accessors for now, because the stubs |
1326 // are not yet prepared for this scenario. | 1326 // are not yet prepared for this scenario. |
1327 receiver->Lookup(*name, lookup); | 1327 receiver->Lookup(*name, lookup); |
1328 if (!lookup->IsPropertyCallbacks()) return false; | 1328 if (!lookup->IsPropertyCallbacks()) { |
| 1329 return false; |
| 1330 } |
1329 Handle<Object> callback(lookup->GetCallbackObject()); | 1331 Handle<Object> callback(lookup->GetCallbackObject()); |
1330 return callback->IsAccessorPair() && StoreICableLookup(lookup); | 1332 return callback->IsAccessorPair() && StoreICableLookup(lookup); |
1331 } | 1333 } |
1332 | 1334 |
1333 if (lookup->IsInterceptor() && | 1335 if (lookup->IsInterceptor() && |
1334 receiver->GetNamedInterceptor()->setter()->IsUndefined()) { | 1336 receiver->GetNamedInterceptor()->setter()->IsUndefined()) { |
1335 receiver->LocalLookupRealNamedProperty(*name, lookup); | 1337 receiver->LocalLookupRealNamedProperty(*name, lookup); |
1336 return StoreICableLookup(lookup); | 1338 return StoreICableLookup(lookup); |
1337 } | 1339 } |
1338 | 1340 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1480 code = isolate()->stub_cache()->ComputeStoreGlobal( | 1482 code = isolate()->stub_cache()->ComputeStoreGlobal( |
1481 name, global, cell, strict_mode); | 1483 name, global, cell, strict_mode); |
1482 } else { | 1484 } else { |
1483 if (!holder.is_identical_to(receiver)) return; | 1485 if (!holder.is_identical_to(receiver)) return; |
1484 code = isolate()->stub_cache()->ComputeStoreNormal(strict_mode); | 1486 code = isolate()->stub_cache()->ComputeStoreNormal(strict_mode); |
1485 } | 1487 } |
1486 break; | 1488 break; |
1487 case CALLBACKS: { | 1489 case CALLBACKS: { |
1488 Handle<Object> callback(lookup->GetCallbackObject()); | 1490 Handle<Object> callback(lookup->GetCallbackObject()); |
1489 if (callback->IsAccessorInfo()) { | 1491 if (callback->IsAccessorInfo()) { |
| 1492 ASSERT(*holder == *receiver); // LookupForWrite checks this. |
1490 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(callback); | 1493 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(callback); |
1491 if (v8::ToCData<Address>(info->setter()) == 0) return; | 1494 if (v8::ToCData<Address>(info->setter()) == 0) return; |
1492 if (!receiver->HasFastProperties()) return; | 1495 if (!holder->HasFastProperties()) return; |
1493 ASSERT(info->IsCompatibleReceiver(*receiver)); | 1496 ASSERT(info->IsCompatibleReceiver(*receiver)); |
1494 code = isolate()->stub_cache()->ComputeStoreCallback( | 1497 code = isolate()->stub_cache()->ComputeStoreCallback( |
1495 name, receiver, info, strict_mode); | 1498 name, receiver, info, strict_mode); |
1496 } else if (callback->IsAccessorPair()) { | 1499 } else if (callback->IsAccessorPair()) { |
1497 Handle<Object> setter(Handle<AccessorPair>::cast(callback)->setter()); | 1500 Handle<Object> setter(Handle<AccessorPair>::cast(callback)->setter()); |
1498 if (!setter->IsJSFunction()) return; | 1501 if (!setter->IsJSFunction()) return; |
1499 if (holder->IsGlobalObject()) return; | 1502 if (holder->IsGlobalObject()) return; |
1500 if (!receiver->HasFastProperties()) return; | 1503 if (!holder->HasFastProperties()) return; |
1501 code = isolate()->stub_cache()->ComputeStoreViaSetter( | 1504 code = isolate()->stub_cache()->ComputeStoreViaSetter( |
1502 name, receiver, holder, Handle<JSFunction>::cast(setter), | 1505 name, receiver, holder, Handle<JSFunction>::cast(setter), |
1503 strict_mode); | 1506 strict_mode); |
1504 } else { | 1507 } else { |
1505 ASSERT(callback->IsForeign()); | 1508 ASSERT(callback->IsForeign()); |
1506 // No IC support for old-style native accessors. | 1509 // No IC support for old-style native accessors. |
1507 return; | 1510 return; |
1508 } | 1511 } |
1509 break; | 1512 break; |
1510 } | 1513 } |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2696 #undef ADDR | 2699 #undef ADDR |
2697 }; | 2700 }; |
2698 | 2701 |
2699 | 2702 |
2700 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2703 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2701 return IC_utilities[id]; | 2704 return IC_utilities[id]; |
2702 } | 2705 } |
2703 | 2706 |
2704 | 2707 |
2705 } } // namespace v8::internal | 2708 } } // namespace v8::internal |
OLD | NEW |