Index: src/compiler/js-typed-lowering.cc |
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc |
index 35283e4137402386a71413ee8ca72965e1852531..74849af8a8734bffa39eca783b3c39f2ef2a5209 100644 |
--- a/src/compiler/js-typed-lowering.cc |
+++ b/src/compiler/js-typed-lowering.cc |
@@ -444,7 +444,11 @@ Reduction JSTypedLowering::ReduceJSToNumberInput(Node* input) { |
// JSToNumber(null) => #0 |
return ReplaceWith(jsgraph()->ZeroConstant()); |
} |
- // TODO(turbofan): js-typed-lowering of ToNumber(x:boolean) |
+ if (input_type->Is(Type::Boolean())) { |
+ // JSToNumber(x:boolean) => BooleanToNumber(x) |
+ return ReplaceWith( |
+ graph()->NewNode(simplified()->BooleanToNumber(), input)); |
+ } |
// TODO(turbofan): js-typed-lowering of ToNumber(x:string) |
return NoChange(); |
} |