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

Side by Side Diff: src/hydrogen.cc

Issue 1329793003: Crankshaft: consolidated element loads always deopted on seeing the hole (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Now with fix. Created 5 years, 3 months 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 | « no previous file | test/mjsunit/regress/regress-4380.js » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/hydrogen.h" 5 #include "src/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/allocation-site-scopes.h" 9 #include "src/allocation-site-scopes.h"
10 #include "src/ast-numbering.h" 10 #include "src/ast-numbering.h"
(...skipping 7415 matching lines...) Expand 10 before | Expand all | Expand 10 after
7426 } 7426 }
7427 } 7427 }
7428 if (!has_double_maps && !has_smi_or_object_maps) return NULL; 7428 if (!has_double_maps && !has_smi_or_object_maps) return NULL;
7429 7429
7430 HCheckMaps* checked_object = Add<HCheckMaps>(object, maps); 7430 HCheckMaps* checked_object = Add<HCheckMaps>(object, maps);
7431 // FAST_ELEMENTS is considered more general than FAST_HOLEY_SMI_ELEMENTS. 7431 // FAST_ELEMENTS is considered more general than FAST_HOLEY_SMI_ELEMENTS.
7432 // If we've seen both, the consolidated load must use FAST_HOLEY_ELEMENTS. 7432 // If we've seen both, the consolidated load must use FAST_HOLEY_ELEMENTS.
7433 ElementsKind consolidated_elements_kind = has_seen_holey_elements 7433 ElementsKind consolidated_elements_kind = has_seen_holey_elements
7434 ? GetHoleyElementsKind(most_general_consolidated_map->elements_kind()) 7434 ? GetHoleyElementsKind(most_general_consolidated_map->elements_kind())
7435 : most_general_consolidated_map->elements_kind(); 7435 : most_general_consolidated_map->elements_kind();
7436 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE;
7437 if (has_seen_holey_elements) {
7438 if (!isolate()->IsFastArrayConstructorPrototypeChainIntact()) {
7439 return NULL;
7440 }
7441
7442 // Make sure that all of the maps we are handling are initial array
7443 // maps, or at least that their prototype is the initial array
7444 // prototype.
7445 for (int i = 0; i < maps->length(); ++i) {
7446 Handle<Map> map = maps->at(i);
7447 if (*map != isolate()->get_initial_js_array_map(map->elements_kind())) {
Jakob Kummerow 2015/09/09 14:12:18 Isn't this condition...
mvstanton 2015/09/09 14:41:56 Acknowledged.
7448 if (map->prototype() != *isolate()->initial_array_prototype()) {
Jakob Kummerow 2015/09/09 14:12:18 ...implied by this one? Seems like you could simpl
mvstanton 2015/09/09 14:41:56 Oh yeah, thanks! :)
7449 // We can't guarantee that loading the hole is safe. The prototype may
7450 // have an element at this position.
7451 return NULL;
7452 }
7453 }
7454 }
7455
7456 Handle<Map> holey_map =
7457 handle(isolate()->get_initial_js_array_map(consolidated_elements_kind));
7458 load_mode = BuildKeyedHoleMode(holey_map);
7459 if (load_mode == NEVER_RETURN_HOLE) {
7460 return NULL;
7461 }
7462
7463 for (int i = 0; i < maps->length(); ++i) {
7464 Handle<Map> map = maps->at(i);
7465 // The prototype check was already done for the holey map in
7466 // BuildKeyedHoleMode.
7467 if (!map.is_identical_to(holey_map)) {
7468 Handle<JSObject> prototype(JSObject::cast(map->prototype()), isolate());
7469 Handle<JSObject> object_prototype =
7470 isolate()->initial_object_prototype();
7471 BuildCheckPrototypeMaps(prototype, object_prototype);
7472 }
7473 }
7474 }
7436 HInstruction* instr = BuildUncheckedMonomorphicElementAccess( 7475 HInstruction* instr = BuildUncheckedMonomorphicElementAccess(
7437 checked_object, key, val, 7476 checked_object, key, val,
7438 most_general_consolidated_map->instance_type() == JS_ARRAY_TYPE, 7477 most_general_consolidated_map->instance_type() == JS_ARRAY_TYPE,
7439 consolidated_elements_kind, 7478 consolidated_elements_kind, LOAD, load_mode, STANDARD_STORE);
7440 LOAD, NEVER_RETURN_HOLE, STANDARD_STORE);
7441 return instr; 7479 return instr;
7442 } 7480 }
7443 7481
7444 7482
7445 HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess( 7483 HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess(
7446 Expression* expr, FeedbackVectorICSlot slot, HValue* object, HValue* key, 7484 Expression* expr, FeedbackVectorICSlot slot, HValue* object, HValue* key,
7447 HValue* val, SmallMapList* maps, PropertyAccessType access_type, 7485 HValue* val, SmallMapList* maps, PropertyAccessType access_type,
7448 KeyedAccessStoreMode store_mode, bool* has_side_effects) { 7486 KeyedAccessStoreMode store_mode, bool* has_side_effects) {
7449 *has_side_effects = false; 7487 *has_side_effects = false;
7450 BuildCheckHeapObject(object); 7488 BuildCheckHeapObject(object);
(...skipping 5993 matching lines...) Expand 10 before | Expand all | Expand 10 after
13444 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13482 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13445 } 13483 }
13446 13484
13447 #ifdef DEBUG 13485 #ifdef DEBUG
13448 graph_->Verify(false); // No full verify. 13486 graph_->Verify(false); // No full verify.
13449 #endif 13487 #endif
13450 } 13488 }
13451 13489
13452 } // namespace internal 13490 } // namespace internal
13453 } // namespace v8 13491 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-4380.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698