Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index eb7a73ee6334110231cc0e3b7c2be069588ecbf0..c17c5f1d9c9e9edf37bb433f3c868fd9736e621e 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -6977,16 +6977,23 @@ HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric( |
LoadKeyedHoleMode HOptimizedGraphBuilder::BuildKeyedHoleMode(Handle<Map> map) { |
// Loads from a "stock" fast holey double arrays can elide the hole check. |
+ // Loads from a "stock" fast holey array can convert the hole to undefined |
+ // with impunity. |
LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE; |
- if (*map == isolate()->get_initial_js_array_map(FAST_HOLEY_DOUBLE_ELEMENTS) && |
+ bool holey_double_elements = |
+ *map == isolate()->get_initial_js_array_map(FAST_HOLEY_DOUBLE_ELEMENTS); |
+ bool holey_elements = |
+ *map == isolate()->get_initial_js_array_map(FAST_HOLEY_ELEMENTS); |
+ if ((holey_double_elements || holey_elements) && |
isolate()->IsFastArrayConstructorPrototypeChainIntact()) { |
+ load_mode = |
+ holey_double_elements ? ALLOW_RETURN_HOLE : CONVERT_HOLE_TO_UNDEFINED; |
+ |
Handle<JSObject> prototype(JSObject::cast(map->prototype()), isolate()); |
Handle<JSObject> object_prototype = isolate()->initial_object_prototype(); |
BuildCheckPrototypeMaps(prototype, object_prototype); |
- load_mode = ALLOW_RETURN_HOLE; |
graph()->MarkDependsOnEmptyArrayProtoElements(); |
} |
- |
return load_mode; |
} |