Index: src/compiler/js-builtin-reducer.cc |
diff --git a/src/compiler/js-builtin-reducer.cc b/src/compiler/js-builtin-reducer.cc |
index 0d69a8921913f43151a206e268e4ca2018072024..2f4e2feed27b39eeff4c2204948af6ebb0327135 100644 |
--- a/src/compiler/js-builtin-reducer.cc |
+++ b/src/compiler/js-builtin-reducer.cc |
@@ -216,6 +216,18 @@ Reduction JSBuiltinReducer::ReduceMathTrunc(Node* node) { |
return NoChange(); |
} |
+// ES6 section 21.1.2.1 String.fromCharCode ( ...codeUnits ) |
+Reduction JSBuiltinReducer::ReduceStringFromCharCode(Node* node) { |
+ JSCallReduction r(node); |
+ if (r.InputsMatchOne(Type::Number())) { |
+ // String.fromCharCode(a:number) -> StringFromCharCode(a) |
+ Node* value = |
+ graph()->NewNode(simplified()->StringFromCharCode(), r.left()); |
+ return Replace(value); |
+ } |
+ return NoChange(); |
+} |
+ |
Reduction JSBuiltinReducer::Reduce(Node* node) { |
Reduction reduction = NoChange(); |
JSCallReduction r(node); |
@@ -250,6 +262,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) { |
case kMathTrunc: |
reduction = ReduceMathTrunc(node); |
break; |
+ case kStringFromCharCode: |
+ reduction = ReduceStringFromCharCode(node); |
+ break; |
default: |
break; |
} |