OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/ic/ic.h" | 5 #include "src/ic/ic.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/api-arguments.h" | 9 #include "src/api-arguments.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 Object::SetProperty(object, name, value, language_mode()), Object); | 1406 Object::SetProperty(object, name, value, language_mode()), Object); |
1407 return result; | 1407 return result; |
1408 } | 1408 } |
1409 | 1409 |
1410 // If the object is undefined or null it's illegal to try to set any | 1410 // If the object is undefined or null it's illegal to try to set any |
1411 // properties on it; throw a TypeError in that case. | 1411 // properties on it; throw a TypeError in that case. |
1412 if (object->IsUndefined() || object->IsNull()) { | 1412 if (object->IsUndefined() || object->IsNull()) { |
1413 return TypeError(MessageTemplate::kNonObjectPropertyStore, object, name); | 1413 return TypeError(MessageTemplate::kNonObjectPropertyStore, object, name); |
1414 } | 1414 } |
1415 | 1415 |
1416 // Observed objects are always modified through the runtime. | |
1417 if (object->IsHeapObject() && | |
1418 Handle<HeapObject>::cast(object)->map()->is_observed()) { | |
1419 Handle<Object> result; | |
1420 ASSIGN_RETURN_ON_EXCEPTION( | |
1421 isolate(), result, | |
1422 Object::SetProperty(object, name, value, language_mode(), store_mode), | |
1423 Object); | |
1424 return result; | |
1425 } | |
1426 | |
1427 LookupIterator it(object, name); | 1416 LookupIterator it(object, name); |
1428 if (FLAG_use_ic) UpdateCaches(&it, value, store_mode); | 1417 if (FLAG_use_ic) UpdateCaches(&it, value, store_mode); |
1429 | 1418 |
1430 MAYBE_RETURN_NULL( | 1419 MAYBE_RETURN_NULL( |
1431 Object::SetProperty(&it, value, language_mode(), store_mode)); | 1420 Object::SetProperty(&it, value, language_mode(), store_mode)); |
1432 return value; | 1421 return value; |
1433 } | 1422 } |
1434 | 1423 |
1435 Handle<Code> CallIC::initialize_stub_in_optimized_code( | 1424 Handle<Code> CallIC::initialize_stub_in_optimized_code( |
1436 Isolate* isolate, int argc, ConvertReceiverMode mode, | 1425 Isolate* isolate, int argc, ConvertReceiverMode mode, |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1887 Object); | 1876 Object); |
1888 if (!is_vector_set()) { | 1877 if (!is_vector_set()) { |
1889 ConfigureVectorState(MEGAMORPHIC, key); | 1878 ConfigureVectorState(MEGAMORPHIC, key); |
1890 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", | 1879 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", |
1891 "unhandled internalized string key"); | 1880 "unhandled internalized string key"); |
1892 TRACE_IC("StoreIC", key); | 1881 TRACE_IC("StoreIC", key); |
1893 } | 1882 } |
1894 return store_handle; | 1883 return store_handle; |
1895 } | 1884 } |
1896 | 1885 |
1897 bool use_ic = | 1886 bool use_ic = FLAG_use_ic && !object->IsStringWrapper() && |
1898 FLAG_use_ic && !object->IsStringWrapper() && | 1887 !object->IsAccessCheckNeeded() && !object->IsJSGlobalProxy(); |
1899 !object->IsAccessCheckNeeded() && !object->IsJSGlobalProxy() && | |
1900 !(object->IsJSObject() && JSObject::cast(*object)->map()->is_observed()); | |
1901 if (use_ic && !object->IsSmi()) { | 1888 if (use_ic && !object->IsSmi()) { |
1902 // Don't use ICs for maps of the objects in Array's prototype chain. We | 1889 // Don't use ICs for maps of the objects in Array's prototype chain. We |
1903 // expect to be able to trap element sets to objects with those maps in | 1890 // expect to be able to trap element sets to objects with those maps in |
1904 // the runtime to enable optimization of element hole access. | 1891 // the runtime to enable optimization of element hole access. |
1905 Handle<HeapObject> heap_object = Handle<HeapObject>::cast(object); | 1892 Handle<HeapObject> heap_object = Handle<HeapObject>::cast(object); |
1906 if (heap_object->map()->IsMapInArrayPrototypeChain()) { | 1893 if (heap_object->map()->IsMapInArrayPrototypeChain()) { |
1907 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "map in array prototype"); | 1894 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "map in array prototype"); |
1908 use_ic = false; | 1895 use_ic = false; |
1909 } | 1896 } |
1910 } | 1897 } |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2757 KeyedLoadICNexus nexus(vector, vector_slot); | 2744 KeyedLoadICNexus nexus(vector, vector_slot); |
2758 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 2745 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
2759 ic.UpdateState(receiver, key); | 2746 ic.UpdateState(receiver, key); |
2760 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 2747 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
2761 } | 2748 } |
2762 | 2749 |
2763 return *result; | 2750 return *result; |
2764 } | 2751 } |
2765 } // namespace internal | 2752 } // namespace internal |
2766 } // namespace v8 | 2753 } // namespace v8 |
OLD | NEW |