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

Side by Side Diff: src/ic.cc

Issue 10873057: Added IC support for native setters on the prototype chain. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 3 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/mips/stub-cache-mips.cc » ('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 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 1317
1318 static bool LookupForWrite(Handle<JSObject> receiver, 1318 static bool LookupForWrite(Handle<JSObject> receiver,
1319 Handle<String> name, 1319 Handle<String> name,
1320 LookupResult* lookup) { 1320 LookupResult* lookup) {
1321 receiver->LocalLookup(*name, lookup); 1321 receiver->LocalLookup(*name, lookup);
1322 if (!lookup->IsFound()) { 1322 if (!lookup->IsFound()) {
1323 receiver->map()->LookupTransition(*receiver, *name, lookup); 1323 receiver->map()->LookupTransition(*receiver, *name, lookup);
1324 } 1324 }
1325 if (!StoreICableLookup(lookup)) { 1325 if (!StoreICableLookup(lookup)) {
1326 // 2nd chance: There can be accessors somewhere in the prototype chain. Note 1326 // 2nd chance: There can be accessors somewhere in the prototype chain. Note
1327 // that we explicitly exclude native accessors for now, because the stubs 1327 // that we explicitly exclude native accessors for now, because the stubs
Erik Corry 2012/08/29 10:46:48 This comment is still valid?
Sven Panne 2012/08/30 06:38:47 Ooops, of course not, I'll submit a tiny CL to fix
1328 // are not yet prepared for this scenario. 1328 // are not yet prepared for this scenario.
1329 receiver->Lookup(*name, lookup); 1329 receiver->Lookup(*name, lookup);
1330 if (!lookup->IsPropertyCallbacks()) { 1330 if (!lookup->IsPropertyCallbacks()) {
1331 return false; 1331 return false;
1332 } 1332 }
1333 Handle<Object> callback(lookup->GetCallbackObject()); 1333 Handle<Object> callback(lookup->GetCallbackObject());
1334 return callback->IsAccessorPair() && StoreICableLookup(lookup); 1334 return StoreICableLookup(lookup);
1335 } 1335 }
1336 1336
1337 if (lookup->IsInterceptor() && 1337 if (lookup->IsInterceptor() &&
1338 receiver->GetNamedInterceptor()->setter()->IsUndefined()) { 1338 receiver->GetNamedInterceptor()->setter()->IsUndefined()) {
1339 receiver->LocalLookupRealNamedProperty(*name, lookup); 1339 receiver->LocalLookupRealNamedProperty(*name, lookup);
1340 return StoreICableLookup(lookup); 1340 return StoreICableLookup(lookup);
1341 } 1341 }
1342 1342
1343 return true; 1343 return true;
1344 } 1344 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 code = isolate()->stub_cache()->ComputeStoreGlobal( 1484 code = isolate()->stub_cache()->ComputeStoreGlobal(
1485 name, global, cell, strict_mode); 1485 name, global, cell, strict_mode);
1486 } else { 1486 } else {
1487 if (!holder.is_identical_to(receiver)) return; 1487 if (!holder.is_identical_to(receiver)) return;
1488 code = isolate()->stub_cache()->ComputeStoreNormal(strict_mode); 1488 code = isolate()->stub_cache()->ComputeStoreNormal(strict_mode);
1489 } 1489 }
1490 break; 1490 break;
1491 case CALLBACKS: { 1491 case CALLBACKS: {
1492 Handle<Object> callback(lookup->GetCallbackObject()); 1492 Handle<Object> callback(lookup->GetCallbackObject());
1493 if (callback->IsAccessorInfo()) { 1493 if (callback->IsAccessorInfo()) {
1494 ASSERT(*holder == *receiver); // LookupForWrite checks this.
1495 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(callback); 1494 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(callback);
1496 if (v8::ToCData<Address>(info->setter()) == 0) return; 1495 if (v8::ToCData<Address>(info->setter()) == 0) return;
1497 if (!holder->HasFastProperties()) return; 1496 if (!holder->HasFastProperties()) return;
1498 ASSERT(info->IsCompatibleReceiver(*receiver)); 1497 if (!info->IsCompatibleReceiver(*receiver)) return;
1499 code = isolate()->stub_cache()->ComputeStoreCallback( 1498 code = isolate()->stub_cache()->ComputeStoreCallback(
1500 name, receiver, info, strict_mode); 1499 name, receiver, holder, info, strict_mode);
1501 } else if (callback->IsAccessorPair()) { 1500 } else if (callback->IsAccessorPair()) {
1502 Handle<Object> setter(Handle<AccessorPair>::cast(callback)->setter()); 1501 Handle<Object> setter(Handle<AccessorPair>::cast(callback)->setter());
1503 if (!setter->IsJSFunction()) return; 1502 if (!setter->IsJSFunction()) return;
1504 if (holder->IsGlobalObject()) return; 1503 if (holder->IsGlobalObject()) return;
1505 if (!holder->HasFastProperties()) return; 1504 if (!holder->HasFastProperties()) return;
1506 code = isolate()->stub_cache()->ComputeStoreViaSetter( 1505 code = isolate()->stub_cache()->ComputeStoreViaSetter(
1507 name, receiver, holder, Handle<JSFunction>::cast(setter), 1506 name, receiver, holder, Handle<JSFunction>::cast(setter),
1508 strict_mode); 1507 strict_mode);
1509 } else { 1508 } else {
1510 ASSERT(callback->IsForeign()); 1509 ASSERT(callback->IsForeign());
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2701 #undef ADDR 2700 #undef ADDR
2702 }; 2701 };
2703 2702
2704 2703
2705 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2704 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2706 return IC_utilities[id]; 2705 return IC_utilities[id];
2707 } 2706 }
2708 2707
2709 2708
2710 } } // namespace v8::internal 2709 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698