Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Unified Diff: src/hydrogen.cc

Issue 935393002: Constant-fold strings in HGraphBuilder::BuildBinaryOperation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() &&
Vyacheslav Egorov (Google) 2015/02/19 15:14:10 Maybe have Handle<String> left_string = left->Is
+ 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()) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698