Reviewers: Vyacheslav Egorov,

Description:
Constant-fold strings in HGraphBuilder::BuildBinaryOperation.

[email protected]
BUG=v8:3325
LOG=N

Please review this at https://codereview.chromium.org/935393002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+6, -0 lines):
  M src/hydrogen.cc


Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 50e3b2124df60ddc29331f0d9d4feb8f753c6a54..8bbabe4f48accce2e79640f9a505b354dc10bc32 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -10499,6 +10499,12 @@ HValue* HGraphBuilder::BuildBinaryOperation(
         HConstant::cast(right)->StringValue()->length() == 0) {
       return left;
     }
+    if (left->IsConstant() && HConstant::cast(left)->HasStringValue() &&
+        right->IsConstant() && HConstant::cast(right)->HasStringValue()) {
+      return AddUncasted<HStringAdd>(
+          left, right, allocation_mode.GetPretenureMode(),
+          STRING_ADD_CHECK_NONE, allocation_mode.feedback_site());
+    }

     // Register the dependent code with the allocation site.
     if (!allocation_mode.feedback_site().is_null()) {


--
--
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/d/optout.

Reply via email to