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

Unified Diff: src/hydrogen.cc

Issue 1042843002: [Crankshaft] Don't add an instruction twice for %_StringGetLength. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 | « src/hydrogen.h ('k') | 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 4389bfe78ab391c44a24a8ab36874e57968046cf..389a943ee66f274c60a112769b60a9a521e16e39 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -6840,13 +6840,18 @@ HInstruction* HGraphBuilder::AddLoadStringInstanceType(HValue* string) {
HInstruction* HGraphBuilder::AddLoadStringLength(HValue* string) {
+ return AddInstruction(BuildLoadStringLength(string));
+}
+
+
+HInstruction* HGraphBuilder::BuildLoadStringLength(HValue* string) {
if (string->IsConstant()) {
HConstant* c_string = HConstant::cast(string);
if (c_string->HasStringValue()) {
- return Add<HConstant>(c_string->StringValue()->length());
+ return New<HConstant>(c_string->StringValue()->length());
}
}
- return Add<HLoadNamedField>(string, nullptr,
+ return New<HLoadNamedField>(string, nullptr,
HObjectAccess::ForStringLength());
}
@@ -11879,7 +11884,7 @@ void HOptimizedGraphBuilder::GenerateStringGetLength(CallRuntime* call) {
DCHECK(call->arguments()->length() == 1);
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* string = Pop();
- HInstruction* result = AddLoadStringLength(string);
+ HInstruction* result = BuildLoadStringLength(string);
return ast_context()->ReturnInstruction(result, call->id());
}
« no previous file with comments | « src/hydrogen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698