Revision: 17917
Author:   [email protected]
Date:     Wed Nov 20 12:35:21 2013 UTC
Log:      Convert constant numbers at compile time.

TEST=mjsunit/number-tostring
[email protected]

Review URL: https://codereview.chromium.org/77553005
http://code.google.com/p/v8/source/detail?r=17917

Modified:
 /branches/bleeding_edge/src/hydrogen.cc

=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Wed Nov 20 12:00:57 2013 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc     Wed Nov 20 12:35:21 2013 UTC
@@ -1554,6 +1554,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(),

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to