Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 3f9d32de1c5ee3153026bb218fdf48f1e40e5a8a..a59be065f2f9ae286a507ee79536ee9d323781ee 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -7033,6 +7033,7 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess( |
MapHandleList possible_transitioned_maps(maps->length()); |
for (int i = 0; i < maps->length(); ++i) { |
Handle<Map> map = maps->at(i); |
+ DCHECK(!map->IsStringMap()); |
ElementsKind elements_kind = map->elements_kind(); |
if (IsFastElementsKind(elements_kind) && |
elements_kind != GetInitialFastElementsKind()) { |
@@ -7196,6 +7197,19 @@ HValue* HOptimizedGraphBuilder::HandleKeyedElementAccess( |
break; |
} |
} |
+ } else if (access_type == LOAD && !monomorphic && |
+ (types != NULL && !types->is_empty())) { |
+ // Polymorphic loads have to go generic if any of the maps are strings. |
+ // If some, but not all of the maps are strings, we should go generic |
+ // because polymorphic access wants to key on ElementsKind and isn't |
+ // compatible with strings. |
+ for (int i = 0; i < types->length(); i++) { |
+ Handle<Map> current_map = types->at(i); |
+ if (current_map->IsStringMap()) { |
+ force_generic = true; |
+ break; |
+ } |
+ } |
} |
if (monomorphic) { |