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());
}
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());
}
HInstruction* AddLoadStringInstanceType(HValue* string);
HInstruction* AddLoadStringLength(HValue* string);
+ HInstruction* BuildLoadStringLength(HValue* string);
HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map> map) {
return Add<HStoreNamedField>(object, HObjectAccess::ForMap(),
Add<HConstant>(map));