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 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1308 | 1308 |
1309 return true; | 1309 return true; |
1310 } | 1310 } |
1311 | 1311 |
1312 | 1312 |
1313 static bool LookupForWrite(Handle<JSObject> receiver, | 1313 static bool LookupForWrite(Handle<JSObject> receiver, |
1314 Handle<String> name, | 1314 Handle<String> name, |
1315 LookupResult* lookup) { | 1315 LookupResult* lookup) { |
1316 receiver->LocalLookup(*name, lookup); | 1316 receiver->LocalLookup(*name, lookup); |
1317 if (!StoreICableLookup(lookup)) { | 1317 if (!StoreICableLookup(lookup)) { |
1318 return false; | 1318 // 2nd chance: There can be accessors somewhere in the prototype chain, but |
1319 // for compatibility reasons we have to hide this behind a flag. Note that | |
1320 // we explicitly exclude native accessors for now, because the stubs are not | |
1321 // yet prepared for this scenario. | |
1322 if (!FLAG_es5_readonly) return false; | |
Vyacheslav Egorov (Google)
2012/07/04 11:48:34
Sorry, I do not understand why es5_readonly semant
rossberg
2012/07/04 13:18:17
Perhaps it isn't necessary, but this patch amends
| |
1323 receiver->Lookup(*name, lookup); | |
1324 if (!lookup->IsCallbacks()) return false; | |
1325 Handle<Object> callback(lookup->GetCallbackObject()); | |
1326 return callback->IsAccessorPair() && StoreICableLookup(lookup); | |
1319 } | 1327 } |
1320 | 1328 |
1321 if (lookup->IsInterceptor() && | 1329 if (lookup->IsInterceptor() && |
1322 receiver->GetNamedInterceptor()->setter()->IsUndefined()) { | 1330 receiver->GetNamedInterceptor()->setter()->IsUndefined()) { |
1323 receiver->LocalLookupRealNamedProperty(*name, lookup); | 1331 receiver->LocalLookupRealNamedProperty(*name, lookup); |
1324 return StoreICableLookup(lookup); | 1332 return StoreICableLookup(lookup); |
1325 } | 1333 } |
1326 | 1334 |
1327 return true; | 1335 return true; |
1328 } | 1336 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1487 if (v8::ToCData<Address>(info->setter()) == 0) return; | 1495 if (v8::ToCData<Address>(info->setter()) == 0) return; |
1488 ASSERT(info->IsCompatibleReceiver(*receiver)); | 1496 ASSERT(info->IsCompatibleReceiver(*receiver)); |
1489 code = isolate()->stub_cache()->ComputeStoreCallback( | 1497 code = isolate()->stub_cache()->ComputeStoreCallback( |
1490 name, receiver, info, strict_mode); | 1498 name, receiver, info, strict_mode); |
1491 } else if (callback->IsAccessorPair()) { | 1499 } else if (callback->IsAccessorPair()) { |
1492 Handle<Object> setter(Handle<AccessorPair>::cast(callback)->setter()); | 1500 Handle<Object> setter(Handle<AccessorPair>::cast(callback)->setter()); |
1493 if (!setter->IsJSFunction()) return; | 1501 if (!setter->IsJSFunction()) return; |
1494 if (holder->IsGlobalObject()) return; | 1502 if (holder->IsGlobalObject()) return; |
1495 if (!receiver->HasFastProperties()) return; | 1503 if (!receiver->HasFastProperties()) return; |
1496 code = isolate()->stub_cache()->ComputeStoreViaSetter( | 1504 code = isolate()->stub_cache()->ComputeStoreViaSetter( |
1497 name, receiver, Handle<JSFunction>::cast(setter), strict_mode); | 1505 name, receiver, holder, Handle<JSFunction>::cast(setter), |
1506 strict_mode); | |
1498 } else { | 1507 } else { |
1499 ASSERT(callback->IsForeign()); | 1508 ASSERT(callback->IsForeign()); |
1500 // No IC support for old-style native accessors. | 1509 // No IC support for old-style native accessors. |
1501 return; | 1510 return; |
1502 } | 1511 } |
1503 break; | 1512 break; |
1504 } | 1513 } |
1505 case INTERCEPTOR: | 1514 case INTERCEPTOR: |
1506 ASSERT(!receiver->GetNamedInterceptor()->setter()->IsUndefined()); | 1515 ASSERT(!receiver->GetNamedInterceptor()->setter()->IsUndefined()); |
1507 code = isolate()->stub_cache()->ComputeStoreInterceptor( | 1516 code = isolate()->stub_cache()->ComputeStoreInterceptor( |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2670 #undef ADDR | 2679 #undef ADDR |
2671 }; | 2680 }; |
2672 | 2681 |
2673 | 2682 |
2674 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2683 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2675 return IC_utilities[id]; | 2684 return IC_utilities[id]; |
2676 } | 2685 } |
2677 | 2686 |
2678 | 2687 |
2679 } } // namespace v8::internal | 2688 } } // namespace v8::internal |
OLD | NEW |