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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 // Check if the given name is an array index. | 1234 // Check if the given name is an array index. |
1235 uint32_t index; | 1235 uint32_t index; |
1236 if (name->AsArrayIndex(&index)) { | 1236 if (name->AsArrayIndex(&index)) { |
1237 Handle<Object> result = | 1237 Handle<Object> result = |
1238 JSObject::SetElement(receiver, index, value, NONE, strict_mode()); | 1238 JSObject::SetElement(receiver, index, value, NONE, strict_mode()); |
1239 RETURN_IF_EMPTY_HANDLE(isolate(), result); | 1239 RETURN_IF_EMPTY_HANDLE(isolate(), result); |
1240 return *value; | 1240 return *value; |
1241 } | 1241 } |
1242 | 1242 |
1243 // Observed objects are always modified through the runtime. | 1243 // Observed objects are always modified through the runtime. |
1244 if (FLAG_harmony_observation && receiver->map()->is_observed()) { | 1244 if (receiver->map()->is_observed()) { |
1245 Handle<Object> result = JSReceiver::SetProperty( | 1245 Handle<Object> result = JSReceiver::SetProperty( |
1246 receiver, name, value, NONE, strict_mode(), store_mode); | 1246 receiver, name, value, NONE, strict_mode(), store_mode); |
1247 RETURN_IF_EMPTY_HANDLE(isolate(), result); | 1247 RETURN_IF_EMPTY_HANDLE(isolate(), result); |
1248 return *result; | 1248 return *result; |
1249 } | 1249 } |
1250 | 1250 |
1251 // Use specialized code for setting the length of arrays with fast | 1251 // Use specialized code for setting the length of arrays with fast |
1252 // properties. Slow properties might indicate redefinition of the length | 1252 // properties. Slow properties might indicate redefinition of the length |
1253 // property. Note that when redefined using Object.freeze, it's possible | 1253 // property. Note that when redefined using Object.freeze, it's possible |
1254 // to have fast properties but a read-only length. | 1254 // to have fast properties but a read-only length. |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 Handle<Code> stub = generic_stub(); | 1701 Handle<Code> stub = generic_stub(); |
1702 | 1702 |
1703 if (key->IsInternalizedString()) { | 1703 if (key->IsInternalizedString()) { |
1704 maybe_object = StoreIC::Store(object, | 1704 maybe_object = StoreIC::Store(object, |
1705 Handle<String>::cast(key), | 1705 Handle<String>::cast(key), |
1706 value, | 1706 value, |
1707 JSReceiver::MAY_BE_STORE_FROM_KEYED); | 1707 JSReceiver::MAY_BE_STORE_FROM_KEYED); |
1708 if (maybe_object->IsFailure()) return maybe_object; | 1708 if (maybe_object->IsFailure()) return maybe_object; |
1709 } else { | 1709 } else { |
1710 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded() && | 1710 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded() && |
1711 !(FLAG_harmony_observation && object->IsJSObject() && | 1711 !(object->IsJSObject() && |
1712 JSObject::cast(*object)->map()->is_observed()); | 1712 JSObject::cast(*object)->map()->is_observed()); |
1713 if (use_ic && !object->IsSmi()) { | 1713 if (use_ic && !object->IsSmi()) { |
1714 // Don't use ICs for maps of the objects in Array's prototype chain. We | 1714 // Don't use ICs for maps of the objects in Array's prototype chain. We |
1715 // expect to be able to trap element sets to objects with those maps in | 1715 // expect to be able to trap element sets to objects with those maps in |
1716 // the runtime to enable optimization of element hole access. | 1716 // the runtime to enable optimization of element hole access. |
1717 Handle<HeapObject> heap_object = Handle<HeapObject>::cast(object); | 1717 Handle<HeapObject> heap_object = Handle<HeapObject>::cast(object); |
1718 if (heap_object->map()->IsMapInArrayPrototypeChain()) use_ic = false; | 1718 if (heap_object->map()->IsMapInArrayPrototypeChain()) use_ic = false; |
1719 } | 1719 } |
1720 | 1720 |
1721 if (use_ic) { | 1721 if (use_ic) { |
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2857 #undef ADDR | 2857 #undef ADDR |
2858 }; | 2858 }; |
2859 | 2859 |
2860 | 2860 |
2861 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2861 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2862 return IC_utilities[id]; | 2862 return IC_utilities[id]; |
2863 } | 2863 } |
2864 | 2864 |
2865 | 2865 |
2866 } } // namespace v8::internal | 2866 } } // namespace v8::internal |
OLD | NEW |