Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 54007c524a6cd376a357770eaeaaa28b6e04af8f..41845746c2fcacccb3bad2cfa839d6c3712271a1 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -8225,6 +8225,18 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr) { |
} |
+// static |
+bool HOptimizedGraphBuilder::CanInlineArrayResizeOperation( |
+ Handle<Map> receiver_map) { |
+ return !receiver_map.is_null() && |
+ receiver_map->instance_type() == JS_ARRAY_TYPE && |
+ IsFastElementsKind(receiver_map->elements_kind()) && |
+ !receiver_map->is_dictionary_map() && |
+ !JSArray::IsReadOnlyLengthDescriptor(receiver_map) && |
+ !receiver_map->is_observed() && receiver_map->is_extensible(); |
+} |
+ |
+ |
bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall( |
Call* expr, Handle<JSFunction> function, Handle<Map> receiver_map, |
int args_count_no_receiver) { |
@@ -8344,13 +8356,8 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall( |
} |
break; |
case kArrayPop: { |
- if (receiver_map.is_null()) return false; |
- if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false; |
+ if (!CanInlineArrayResizeOperation(receiver_map)) return false; |
ElementsKind elements_kind = receiver_map->elements_kind(); |
- if (JSArray::IsReadOnlyLengthDescriptor(receiver_map)) return false; |
- if (!IsFastElementsKind(elements_kind)) return false; |
- if (receiver_map->is_observed()) return false; |
- if (!receiver_map->is_extensible()) return false; |
Drop(args_count_no_receiver); |
HValue* result; |
@@ -8407,13 +8414,8 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall( |
return true; |
} |
case kArrayPush: { |
- if (receiver_map.is_null()) return false; |
- if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false; |
+ if (!CanInlineArrayResizeOperation(receiver_map)) return false; |
ElementsKind elements_kind = receiver_map->elements_kind(); |
- if (!IsFastElementsKind(elements_kind)) return false; |
- if (receiver_map->is_observed()) return false; |
- if (JSArray::IsReadOnlyLengthDescriptor(receiver_map)) return false; |
- if (!receiver_map->is_extensible()) return false; |
// If there may be elements accessors in the prototype chain, the fast |
// inlined version can't be used. |
@@ -8460,13 +8462,8 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall( |
return true; |
} |
case kArrayShift: { |
- if (receiver_map.is_null()) return false; |
- if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false; |
+ if (!CanInlineArrayResizeOperation(receiver_map)) return false; |
ElementsKind kind = receiver_map->elements_kind(); |
- if (JSArray::IsReadOnlyLengthDescriptor(receiver_map)) return false; |
- if (!IsFastElementsKind(kind)) return false; |
- if (receiver_map->is_observed()) return false; |
- if (!receiver_map->is_extensible()) return false; |
// If there may be elements accessors in the prototype chain, the fast |
// inlined version can't be used. |