Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 22da9477e53608ce1b4df08357bfce25960e2e53..276243b212d5d20c37428e75b2e24baf982aade7 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -1541,6 +1541,13 @@ HValue* HGraphBuilder::BuildNumberToString(HValue* object, |
Handle<Type> type) { |
NoObservableSideEffectsScope scope(this); |
+ // Convert constant numbers at compile time. |
+ if (object->IsConstant() && HConstant::cast(object)->HasNumberValue()) { |
+ Handle<Object> number = HConstant::cast(object)->handle(isolate()); |
+ Handle<String> result = isolate()->factory()->NumberToString(number); |
+ return Add<HConstant>(result); |
+ } |
+ |
// Create a joinable continuation. |
HIfContinuation found(graph()->CreateBasicBlock(), |
graph()->CreateBasicBlock()); |