Updates:
        Cc: [email protected]

Comment #2 on issue 3325 by [email protected]: Context allocated values are not constant folded.
http://code.google.com/p/v8/issues/detail?id=3325

@yangguo: the issue is actually the other way around, if you look at the results for Chrome >=34 then you will notice that situation is weird test case of concatenation of literals inside the function is *slower* then concatenating context variables.

The benchmark is obviously flawed, but it reveals a problem in V8:

outsideScope function is inlined into the benchmarking loop after which concatenation is hoisted out of the loop with LICM leading to an empty loop measurement

insideScope function is also inlined but then V8 goes highwire: it emits expanded ConsString allocation instead of constant folding concatenation due to wrong order of conditions in the graph builder. Expanded allocation can't be hoisted out by LICM - hence the loop is actually doing the concat which is slower compared to not doing a concat in the loop. The fix is below:

--- src/hydrogen.cc (revision 21348)
+++ src/hydrogen.cc (working copy)
@@ -9639,6 +9639,14 @@
       return left;
     }

+    if (FLAG_fold_constants &&
+        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()) {
       ASSERT(!graph()->info()->IsStub());

[I was under impression that I have filed a bug on this before, but somehow it fell through]

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
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