Index: src/compiler/js-builtin-reducer.cc |
diff --git a/src/compiler/js-builtin-reducer.cc b/src/compiler/js-builtin-reducer.cc |
index a1c83ce1b639b733205909e760f79e672e49b081..f812a2cf0483d7fdd7745998132dc5a23475fc00 100644 |
--- a/src/compiler/js-builtin-reducer.cc |
+++ b/src/compiler/js-builtin-reducer.cc |
@@ -733,11 +733,23 @@ Reduction JSBuiltinReducer::ReduceArrayIsArray(Node* node) { |
return Replace(value); |
} |
Node* value = NodeProperties::GetValueInput(node, 2); |
+ Type* value_type = NodeProperties::GetType(value); |
Node* context = NodeProperties::GetContextInput(node); |
Node* frame_state = NodeProperties::GetFrameStateInput(node); |
Node* effect = NodeProperties::GetEffectInput(node); |
Node* control = NodeProperties::GetControlInput(node); |
+ // Constant-fold based on {value} type. |
+ if (value_type->Is(Type::Array())) { |
+ Node* value = jsgraph()->TrueConstant(); |
+ ReplaceWithValue(node, value); |
+ return Replace(value); |
+ } else if (!value_type->Maybe(Type::ArrayOrProxy())) { |
+ Node* value = jsgraph()->FalseConstant(); |
+ ReplaceWithValue(node, value); |
+ return Replace(value); |
+ } |
+ |
int count = 0; |
Node* values[5]; |
Node* effects[5]; |