Index: src/compiler/js-typed-lowering.cc |
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc |
index 2f9a23a90f926d592456a7c4102d70e591d6f53a..a373c17d7a60fe6c2576752f58502576bed6349d 100644 |
--- a/src/compiler/js-typed-lowering.cc |
+++ b/src/compiler/js-typed-lowering.cc |
@@ -696,9 +696,10 @@ Reduction JSTypedLowering::ReduceJSUnaryNot(Node* node) { |
Reduction JSTypedLowering::ReduceJSToBoolean(Node* node) { |
Node* const input = node->InputAt(0); |
Type* const input_type = NodeProperties::GetType(input); |
+ Node* const effect = NodeProperties::GetEffectInput(node); |
if (input_type->Is(Type::Boolean())) { |
// JSToBoolean(x:boolean) => x |
- ReplaceWithValue(node, input); |
+ ReplaceWithValue(node, input, effect); |
return Replace(input); |
} else if (input_type->Is(Type::OrderedNumber())) { |
// JSToBoolean(x:ordered-number) => BooleanNot(NumberEqual(x,#0)) |
@@ -711,10 +712,8 @@ Reduction JSTypedLowering::ReduceJSToBoolean(Node* node) { |
} else if (input_type->Is(Type::String())) { |
// JSToBoolean(x:string) => NumberLessThan(#0,x.length) |
FieldAccess const access = AccessBuilder::ForStringLength(graph()->zone()); |
- // It is safe for the load to be effect-free (i.e. not linked into effect |
- // chain) because we assume String::length to be immutable. |
Node* length = graph()->NewNode(simplified()->LoadField(access), input, |
- graph()->start(), graph()->start()); |
+ effect, graph()->start()); |
ReplaceWithValue(node, node, length); |
node->ReplaceInput(0, jsgraph()->ZeroConstant()); |
node->ReplaceInput(1, length); |