| Index: src/compiler/js-typed-lowering.cc
|
| diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
|
| index 4eb89ccbec234be3d7725a4b60e6909b1a4b66d6..a4a59ce723bab50b0431219175090f90f80b8692 100644
|
| --- a/src/compiler/js-typed-lowering.cc
|
| +++ b/src/compiler/js-typed-lowering.cc
|
| @@ -780,8 +780,18 @@ Reduction JSTypedLowering::ReduceJSToNumberInput(Node* input) {
|
| }
|
| }
|
| }
|
| - // Check if we have a cached conversion.
|
| + // Try constant-folding of JSToNumber with constant inputs.
|
| Type* input_type = NodeProperties::GetType(input);
|
| + if (input_type->IsConstant()) {
|
| + Handle<Object> input_value = input_type->AsConstant()->Value();
|
| + if (input_value->IsString()) {
|
| + return Replace(jsgraph()->Constant(
|
| + String::ToNumber(Handle<String>::cast(input_value))));
|
| + } else if (input_value->IsOddball()) {
|
| + return Replace(jsgraph()->Constant(
|
| + Oddball::ToNumber(Handle<Oddball>::cast(input_value))));
|
| + }
|
| + }
|
| if (input_type->Is(Type::Number())) {
|
| // JSToNumber(x:number) => x
|
| return Changed(input);
|
|
|