Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: src/ic.cc

Issue 10827220: Fix handling of accessors on trunk. This is a combination of (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
993 if (!info->IsCompatibleReceiver(*receiver)) return; 992 if (!info->IsCompatibleReceiver(*receiver)) return;
994 code = isolate()->stub_cache()->ComputeLoadCallback( 993 code = isolate()->stub_cache()->ComputeLoadCallback(
995 name, receiver, holder, info); 994 name, receiver, holder, info);
996 } else if (callback->IsAccessorPair()) { 995 } else if (callback->IsAccessorPair()) {
997 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter()); 996 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter());
998 if (!getter->IsJSFunction()) return; 997 if (!getter->IsJSFunction()) return;
999 if (holder->IsGlobalObject()) return; 998 if (holder->IsGlobalObject()) return;
1000 if (!receiver->HasFastProperties()) return;
1001 code = isolate()->stub_cache()->ComputeLoadViaGetter( 999 code = isolate()->stub_cache()->ComputeLoadViaGetter(
1002 name, receiver, holder, Handle<JSFunction>::cast(getter)); 1000 name, receiver, holder, Handle<JSFunction>::cast(getter));
1003 } else { 1001 } else {
1004 ASSERT(callback->IsForeign()); 1002 ASSERT(callback->IsForeign());
1005 // No IC support for old-style native accessors. 1003 // No IC support for old-style native accessors.
1006 return; 1004 return;
1007 } 1005 }
1008 break; 1006 break;
1009 } 1007 }
1010 case INTERCEPTOR: 1008 case INTERCEPTOR:
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 code = isolate()->stub_cache()->ComputeKeyedLoadConstant( 1257 code = isolate()->stub_cache()->ComputeKeyedLoadConstant(
1260 name, receiver, holder, constant); 1258 name, receiver, holder, constant);
1261 break; 1259 break;
1262 } 1260 }
1263 case CALLBACKS: { 1261 case CALLBACKS: {
1264 Handle<Object> callback_object(lookup->GetCallbackObject()); 1262 Handle<Object> callback_object(lookup->GetCallbackObject());
1265 if (!callback_object->IsAccessorInfo()) return; 1263 if (!callback_object->IsAccessorInfo()) return;
1266 Handle<AccessorInfo> callback = 1264 Handle<AccessorInfo> callback =
1267 Handle<AccessorInfo>::cast(callback_object); 1265 Handle<AccessorInfo>::cast(callback_object);
1268 if (v8::ToCData<Address>(callback->getter()) == 0) return; 1266 if (v8::ToCData<Address>(callback->getter()) == 0) return;
1269 if (!receiver->HasFastProperties()) return; 1267 if (!holder->HasFastProperties()) return;
1270 if (!callback->IsCompatibleReceiver(*receiver)) return; 1268 if (!callback->IsCompatibleReceiver(*receiver)) return;
1271 code = isolate()->stub_cache()->ComputeKeyedLoadCallback( 1269 code = isolate()->stub_cache()->ComputeKeyedLoadCallback(
1272 name, receiver, holder, callback); 1270 name, receiver, holder, callback);
1273 break; 1271 break;
1274 } 1272 }
1275 case INTERCEPTOR: 1273 case INTERCEPTOR:
1276 ASSERT(HasInterceptorGetter(lookup->holder())); 1274 ASSERT(HasInterceptorGetter(lookup->holder()));
1277 code = isolate()->stub_cache()->ComputeKeyedLoadInterceptor( 1275 code = isolate()->stub_cache()->ComputeKeyedLoadInterceptor(
1278 name, receiver, holder); 1276 name, receiver, holder);
1279 break; 1277 break;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 LookupResult* lookup) { 1316 LookupResult* lookup) {
1319 receiver->LocalLookup(*name, lookup); 1317 receiver->LocalLookup(*name, lookup);
1320 if (!lookup->IsFound()) { 1318 if (!lookup->IsFound()) {
1321 receiver->map()->LookupTransition(*receiver, *name, lookup); 1319 receiver->map()->LookupTransition(*receiver, *name, lookup);
1322 } 1320 }
1323 if (!StoreICableLookup(lookup)) { 1321 if (!StoreICableLookup(lookup)) {
1324 // 2nd chance: There can be accessors somewhere in the prototype chain. Note 1322 // 2nd chance: There can be accessors somewhere in the prototype chain. Note
1325 // that we explicitly exclude native accessors for now, because the stubs 1323 // that we explicitly exclude native accessors for now, because the stubs
1326 // are not yet prepared for this scenario. 1324 // are not yet prepared for this scenario.
1327 receiver->Lookup(*name, lookup); 1325 receiver->Lookup(*name, lookup);
1328 if (!lookup->IsPropertyCallbacks()) return false; 1326 if (!lookup->IsPropertyCallbacks()) {
1327 return false;
1328 }
1329 Handle<Object> callback(lookup->GetCallbackObject()); 1329 Handle<Object> callback(lookup->GetCallbackObject());
1330 return callback->IsAccessorPair() && StoreICableLookup(lookup); 1330 return callback->IsAccessorPair() && StoreICableLookup(lookup);
1331 } 1331 }
1332 1332
1333 if (lookup->IsInterceptor() && 1333 if (lookup->IsInterceptor() &&
1334 receiver->GetNamedInterceptor()->setter()->IsUndefined()) { 1334 receiver->GetNamedInterceptor()->setter()->IsUndefined()) {
1335 receiver->LocalLookupRealNamedProperty(*name, lookup); 1335 receiver->LocalLookupRealNamedProperty(*name, lookup);
1336 return StoreICableLookup(lookup); 1336 return StoreICableLookup(lookup);
1337 } 1337 }
1338 1338
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 code = isolate()->stub_cache()->ComputeStoreGlobal( 1480 code = isolate()->stub_cache()->ComputeStoreGlobal(
1481 name, global, cell, strict_mode); 1481 name, global, cell, strict_mode);
1482 } else { 1482 } else {
1483 if (!holder.is_identical_to(receiver)) return; 1483 if (!holder.is_identical_to(receiver)) return;
1484 code = isolate()->stub_cache()->ComputeStoreNormal(strict_mode); 1484 code = isolate()->stub_cache()->ComputeStoreNormal(strict_mode);
1485 } 1485 }
1486 break; 1486 break;
1487 case CALLBACKS: { 1487 case CALLBACKS: {
1488 Handle<Object> callback(lookup->GetCallbackObject()); 1488 Handle<Object> callback(lookup->GetCallbackObject());
1489 if (callback->IsAccessorInfo()) { 1489 if (callback->IsAccessorInfo()) {
1490 ASSERT(*holder == *receiver); // LookupForWrite checks this.
1490 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(callback); 1491 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(callback);
1491 if (v8::ToCData<Address>(info->setter()) == 0) return; 1492 if (v8::ToCData<Address>(info->setter()) == 0) return;
1492 if (!receiver->HasFastProperties()) return; 1493 if (!holder->HasFastProperties()) return;
1493 ASSERT(info->IsCompatibleReceiver(*receiver)); 1494 ASSERT(info->IsCompatibleReceiver(*receiver));
1494 code = isolate()->stub_cache()->ComputeStoreCallback( 1495 code = isolate()->stub_cache()->ComputeStoreCallback(
1495 name, receiver, info, strict_mode); 1496 name, receiver, info, strict_mode);
1496 } else if (callback->IsAccessorPair()) { 1497 } else if (callback->IsAccessorPair()) {
1497 Handle<Object> setter(Handle<AccessorPair>::cast(callback)->setter()); 1498 Handle<Object> setter(Handle<AccessorPair>::cast(callback)->setter());
1498 if (!setter->IsJSFunction()) return; 1499 if (!setter->IsJSFunction()) return;
1499 if (holder->IsGlobalObject()) return; 1500 if (holder->IsGlobalObject()) return;
1500 if (!receiver->HasFastProperties()) return; 1501 if (!holder->HasFastProperties()) return;
1501 code = isolate()->stub_cache()->ComputeStoreViaSetter( 1502 code = isolate()->stub_cache()->ComputeStoreViaSetter(
1502 name, receiver, holder, Handle<JSFunction>::cast(setter), 1503 name, receiver, holder, Handle<JSFunction>::cast(setter),
1503 strict_mode); 1504 strict_mode);
1504 } else { 1505 } else {
1505 ASSERT(callback->IsForeign()); 1506 ASSERT(callback->IsForeign());
1506 // No IC support for old-style native accessors. 1507 // No IC support for old-style native accessors.
1507 return; 1508 return;
1508 } 1509 }
1509 break; 1510 break;
1510 } 1511 }
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after
2696 #undef ADDR 2697 #undef ADDR
2697 }; 2698 };
2698 2699
2699 2700
2700 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2701 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2701 return IC_utilities[id]; 2702 return IC_utilities[id];
2702 } 2703 }
2703 2704
2704 2705
2705 } } // namespace v8::internal 2706 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698