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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "api.h" | 8 #include "api.h" |
9 #include "arguments.h" | 9 #include "arguments.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 } | 852 } |
853 | 853 |
854 | 854 |
855 void LoadIC::UpdateCaches(LookupResult* lookup, | 855 void LoadIC::UpdateCaches(LookupResult* lookup, |
856 Handle<Object> object, | 856 Handle<Object> object, |
857 Handle<String> name) { | 857 Handle<String> name) { |
858 if (state() == UNINITIALIZED) { | 858 if (state() == UNINITIALIZED) { |
859 // This is the first time we execute this inline cache. | 859 // This is the first time we execute this inline cache. |
860 // Set the target to the pre monomorphic stub to delay | 860 // Set the target to the pre monomorphic stub to delay |
861 // setting the monomorphic state. | 861 // setting the monomorphic state. |
862 set_target(*pre_monomorphic_stub()); | 862 // No need to flush the icache since the pre_monomorphic_stub will be the |
| 863 // same code as the initialize_stub - it is just used as a marker to |
| 864 // identify when we should move to monomorphic, and will be correctly read |
| 865 // via raw_target() even if the wrong stub was called. |
| 866 set_target(*pre_monomorphic_stub(), SKIP_ICACHE_FLUSH_IF_ATOMIC); |
863 TRACE_IC("LoadIC", name); | 867 TRACE_IC("LoadIC", name); |
864 return; | 868 return; |
865 } | 869 } |
866 | 870 |
867 Handle<HeapType> type = CurrentTypeOf(object, isolate()); | 871 Handle<HeapType> type = CurrentTypeOf(object, isolate()); |
868 Handle<Code> code; | 872 Handle<Code> code; |
869 if (!lookup->IsCacheable()) { | 873 if (!lookup->IsCacheable()) { |
870 // Bail out if the result is not cacheable. | 874 // Bail out if the result is not cacheable. |
871 code = slow_stub(); | 875 code = slow_stub(); |
872 } else if (!lookup->IsProperty()) { | 876 } else if (!lookup->IsProperty()) { |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 if (!can_store && | 1306 if (!can_store && |
1303 strict_mode() == STRICT && | 1307 strict_mode() == STRICT && |
1304 !(lookup.IsProperty() && lookup.IsReadOnly()) && | 1308 !(lookup.IsProperty() && lookup.IsReadOnly()) && |
1305 object->IsGlobalObject()) { | 1309 object->IsGlobalObject()) { |
1306 // Strict mode doesn't allow setting non-existent global property. | 1310 // Strict mode doesn't allow setting non-existent global property. |
1307 return ReferenceError("not_defined", name); | 1311 return ReferenceError("not_defined", name); |
1308 } | 1312 } |
1309 if (FLAG_use_ic) { | 1313 if (FLAG_use_ic) { |
1310 if (state() == UNINITIALIZED) { | 1314 if (state() == UNINITIALIZED) { |
1311 Handle<Code> stub = pre_monomorphic_stub(); | 1315 Handle<Code> stub = pre_monomorphic_stub(); |
1312 set_target(*stub); | 1316 // No need to flush the icache since the pre_monomorphic_stub will be the |
| 1317 // same code as the initialize_stub - it is just used as a marker to |
| 1318 // identify when we should move to monomorphic, and will be correctly read |
| 1319 // via raw_target() even if the wrong stub was called. |
| 1320 set_target(*stub, SKIP_ICACHE_FLUSH_IF_ATOMIC); |
1313 TRACE_IC("StoreIC", name); | 1321 TRACE_IC("StoreIC", name); |
1314 } else if (can_store) { | 1322 } else if (can_store) { |
1315 UpdateCaches(&lookup, receiver, name, value); | 1323 UpdateCaches(&lookup, receiver, name, value); |
1316 } else if (!name->IsCacheable(isolate()) || | 1324 } else if (!name->IsCacheable(isolate()) || |
1317 lookup.IsNormal() || | 1325 lookup.IsNormal() || |
1318 (lookup.IsField() && lookup.CanHoldValue(value))) { | 1326 (lookup.IsField() && lookup.CanHoldValue(value))) { |
1319 Handle<Code> stub = generic_stub(); | 1327 Handle<Code> stub = generic_stub(); |
1320 set_target(*stub); | 1328 set_target(*stub); |
1321 } | 1329 } |
1322 } | 1330 } |
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2985 #undef ADDR | 2993 #undef ADDR |
2986 }; | 2994 }; |
2987 | 2995 |
2988 | 2996 |
2989 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2997 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2990 return IC_utilities[id]; | 2998 return IC_utilities[id]; |
2991 } | 2999 } |
2992 | 3000 |
2993 | 3001 |
2994 } } // namespace v8::internal | 3002 } } // namespace v8::internal |
OLD | NEW |