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()); |
} |