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

Side by Side Diff: src/ic/ic.cc

Issue 2538693002: Revert of [ic] Use validity cells to protect keyed element stores against object's prototype chain… (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « src/ic/ic.h ('k') | src/ic/ic-compiler.h » ('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 // 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 <iostream> 7 #include <iostream>
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/api-arguments-inl.h" 10 #include "src/api-arguments-inl.h"
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 } else { 596 } else {
597 DCHECK(kind() == Code::KEYED_STORE_IC); 597 DCHECK(kind() == Code::KEYED_STORE_IC);
598 KeyedStoreICNexus* nexus = casted_nexus<KeyedStoreICNexus>(); 598 KeyedStoreICNexus* nexus = casted_nexus<KeyedStoreICNexus>();
599 nexus->ConfigurePolymorphic(name, maps, handlers); 599 nexus->ConfigurePolymorphic(name, maps, handlers);
600 } 600 }
601 601
602 vector_set_ = true; 602 vector_set_ = true;
603 OnTypeFeedbackChanged(isolate(), get_host()); 603 OnTypeFeedbackChanged(isolate(), get_host());
604 } 604 }
605 605
606
606 void IC::ConfigureVectorState(MapHandleList* maps, 607 void IC::ConfigureVectorState(MapHandleList* maps,
607 MapHandleList* transitioned_maps, 608 MapHandleList* transitioned_maps,
608 List<Handle<Object>>* handlers) { 609 CodeHandleList* handlers) {
609 DCHECK(UseVector()); 610 DCHECK(UseVector());
610 DCHECK(kind() == Code::KEYED_STORE_IC); 611 DCHECK(kind() == Code::KEYED_STORE_IC);
611 KeyedStoreICNexus* nexus = casted_nexus<KeyedStoreICNexus>(); 612 KeyedStoreICNexus* nexus = casted_nexus<KeyedStoreICNexus>();
612 nexus->ConfigurePolymorphic(maps, transitioned_maps, handlers); 613 nexus->ConfigurePolymorphic(maps, transitioned_maps, handlers);
613 614
614 vector_set_ = true; 615 vector_set_ = true;
615 OnTypeFeedbackChanged(isolate(), get_host()); 616 OnTypeFeedbackChanged(isolate(), get_host());
616 } 617 }
617 618
618 619
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after
2200 } 2201 }
2201 2202
2202 void KeyedStoreIC::UpdateStoreElement(Handle<Map> receiver_map, 2203 void KeyedStoreIC::UpdateStoreElement(Handle<Map> receiver_map,
2203 KeyedAccessStoreMode store_mode) { 2204 KeyedAccessStoreMode store_mode) {
2204 MapHandleList target_receiver_maps; 2205 MapHandleList target_receiver_maps;
2205 TargetMaps(&target_receiver_maps); 2206 TargetMaps(&target_receiver_maps);
2206 if (target_receiver_maps.length() == 0) { 2207 if (target_receiver_maps.length() == 0) {
2207 Handle<Map> monomorphic_map = 2208 Handle<Map> monomorphic_map =
2208 ComputeTransitionedMap(receiver_map, store_mode); 2209 ComputeTransitionedMap(receiver_map, store_mode);
2209 store_mode = GetNonTransitioningStoreMode(store_mode); 2210 store_mode = GetNonTransitioningStoreMode(store_mode);
2210 Handle<Object> handler = 2211 Handle<Code> handler =
2211 PropertyICCompiler::ComputeKeyedStoreMonomorphicHandler(monomorphic_map, 2212 PropertyICCompiler::ComputeKeyedStoreMonomorphicHandler(monomorphic_map,
2212 store_mode); 2213 store_mode);
2213 return ConfigureVectorState(Handle<Name>(), monomorphic_map, handler); 2214 return ConfigureVectorState(Handle<Name>(), monomorphic_map, handler);
2214 } 2215 }
2215 2216
2216 for (int i = 0; i < target_receiver_maps.length(); i++) { 2217 for (int i = 0; i < target_receiver_maps.length(); i++) {
2217 if (!target_receiver_maps.at(i).is_null() && 2218 if (!target_receiver_maps.at(i).is_null() &&
2218 target_receiver_maps.at(i)->instance_type() == JS_VALUE_TYPE) { 2219 target_receiver_maps.at(i)->instance_type() == JS_VALUE_TYPE) {
2219 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "JSValue"); 2220 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "JSValue");
2220 return; 2221 return;
(...skipping 13 matching lines...) Expand all
2234 ComputeTransitionedMap(receiver_map, store_mode); 2235 ComputeTransitionedMap(receiver_map, store_mode);
2235 } 2236 }
2236 if ((receiver_map.is_identical_to(previous_receiver_map) && 2237 if ((receiver_map.is_identical_to(previous_receiver_map) &&
2237 IsTransitionStoreMode(store_mode)) || 2238 IsTransitionStoreMode(store_mode)) ||
2238 IsTransitionOfMonomorphicTarget(*previous_receiver_map, 2239 IsTransitionOfMonomorphicTarget(*previous_receiver_map,
2239 *transitioned_receiver_map)) { 2240 *transitioned_receiver_map)) {
2240 // If the "old" and "new" maps are in the same elements map family, or 2241 // If the "old" and "new" maps are in the same elements map family, or
2241 // if they at least come from the same origin for a transitioning store, 2242 // if they at least come from the same origin for a transitioning store,
2242 // stay MONOMORPHIC and use the map for the most generic ElementsKind. 2243 // stay MONOMORPHIC and use the map for the most generic ElementsKind.
2243 store_mode = GetNonTransitioningStoreMode(store_mode); 2244 store_mode = GetNonTransitioningStoreMode(store_mode);
2244 Handle<Object> handler = 2245 Handle<Code> handler =
2245 PropertyICCompiler::ComputeKeyedStoreMonomorphicHandler( 2246 PropertyICCompiler::ComputeKeyedStoreMonomorphicHandler(
2246 transitioned_receiver_map, store_mode); 2247 transitioned_receiver_map, store_mode);
2247 ConfigureVectorState(Handle<Name>(), transitioned_receiver_map, handler); 2248 ConfigureVectorState(Handle<Name>(), transitioned_receiver_map, handler);
2248 return; 2249 return;
2249 } 2250 }
2250 if (receiver_map.is_identical_to(previous_receiver_map) && 2251 if (receiver_map.is_identical_to(previous_receiver_map) &&
2251 old_store_mode == STANDARD_STORE && 2252 old_store_mode == STANDARD_STORE &&
2252 (store_mode == STORE_AND_GROW_NO_TRANSITION || 2253 (store_mode == STORE_AND_GROW_NO_TRANSITION ||
2253 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || 2254 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS ||
2254 store_mode == STORE_NO_TRANSITION_HANDLE_COW)) { 2255 store_mode == STORE_NO_TRANSITION_HANDLE_COW)) {
2255 // A "normal" IC that handles stores can switch to a version that can 2256 // A "normal" IC that handles stores can switch to a version that can
2256 // grow at the end of the array, handle OOB accesses or copy COW arrays 2257 // grow at the end of the array, handle OOB accesses or copy COW arrays
2257 // and still stay MONOMORPHIC. 2258 // and still stay MONOMORPHIC.
2258 Handle<Object> handler = 2259 Handle<Code> handler =
2259 PropertyICCompiler::ComputeKeyedStoreMonomorphicHandler(receiver_map, 2260 PropertyICCompiler::ComputeKeyedStoreMonomorphicHandler(receiver_map,
2260 store_mode); 2261 store_mode);
2261 return ConfigureVectorState(Handle<Name>(), receiver_map, handler); 2262 return ConfigureVectorState(Handle<Name>(), receiver_map, handler);
2262 } 2263 }
2263 } 2264 }
2264 2265
2265 DCHECK(state() != GENERIC); 2266 DCHECK(state() != GENERIC);
2266 2267
2267 bool map_added = 2268 bool map_added =
2268 AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map); 2269 AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2309 } 2310 }
2310 if (external_arrays != 0 && 2311 if (external_arrays != 0 &&
2311 external_arrays != target_receiver_maps.length()) { 2312 external_arrays != target_receiver_maps.length()) {
2312 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", 2313 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC",
2313 "unsupported combination of external and normal arrays"); 2314 "unsupported combination of external and normal arrays");
2314 return; 2315 return;
2315 } 2316 }
2316 } 2317 }
2317 2318
2318 MapHandleList transitioned_maps(target_receiver_maps.length()); 2319 MapHandleList transitioned_maps(target_receiver_maps.length());
2319 List<Handle<Object>> handlers(target_receiver_maps.length()); 2320 CodeHandleList handlers(target_receiver_maps.length());
2320 PropertyICCompiler::ComputeKeyedStorePolymorphicHandlers( 2321 PropertyICCompiler::ComputeKeyedStorePolymorphicHandlers(
2321 &target_receiver_maps, &transitioned_maps, &handlers, store_mode); 2322 &target_receiver_maps, &transitioned_maps, &handlers, store_mode);
2322 ConfigureVectorState(&target_receiver_maps, &transitioned_maps, &handlers); 2323 ConfigureVectorState(&target_receiver_maps, &transitioned_maps, &handlers);
2323 } 2324 }
2324 2325
2325 2326
2326 Handle<Map> KeyedStoreIC::ComputeTransitionedMap( 2327 Handle<Map> KeyedStoreIC::ComputeTransitionedMap(
2327 Handle<Map> map, KeyedAccessStoreMode store_mode) { 2328 Handle<Map> map, KeyedAccessStoreMode store_mode) {
2328 switch (store_mode) { 2329 switch (store_mode) {
2329 case STORE_TRANSITION_TO_OBJECT: 2330 case STORE_TRANSITION_TO_OBJECT:
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
3223 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); 3224 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state());
3224 it.Next(); 3225 it.Next();
3225 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 3226 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
3226 Object::GetProperty(&it)); 3227 Object::GetProperty(&it));
3227 } 3228 }
3228 3229
3229 return *result; 3230 return *result;
3230 } 3231 }
3231 } // namespace internal 3232 } // namespace internal
3232 } // namespace v8 3233 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/ic.h ('k') | src/ic/ic-compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698