[cleanup] Remove obsolete StringAdd with TENURED.
Since the removal of Crankshaft there's no use for StringAdd with pretenuring anymore, so we can remove the extra code and builtins. Bug: v8:8015 Change-Id: If178c6f1d08841428f42b1baece231268cdae2ad Reviewed-on: https://chromium-review.googlesource.com/1213206 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Georg Neis <neis@chromium.org> Cr-Commit-Position: refs/heads/master@{#55843}
This commit is contained in:
parent
6020cd5b54
commit
07412dc620
@ -1313,10 +1313,9 @@ namespace internal {
|
||||
ASM(CEntry_Return2_SaveFPRegs_ArgvOnStack_BuiltinExit) \
|
||||
\
|
||||
/* String helpers */ \
|
||||
TFS(StringAdd_CheckNone_NotTenured, kLeft, kRight) \
|
||||
TFS(StringAdd_CheckNone_Tenured, kLeft, kRight) \
|
||||
TFS(StringAdd_ConvertLeft_NotTenured, kLeft, kRight) \
|
||||
TFS(StringAdd_ConvertRight_NotTenured, kLeft, kRight) \
|
||||
TFS(StringAdd_CheckNone, kLeft, kRight) \
|
||||
TFS(StringAdd_ConvertLeft, kLeft, kRight) \
|
||||
TFS(StringAdd_ConvertRight, kLeft, kRight) \
|
||||
TFS(SubString, kString, kFrom, kTo) \
|
||||
\
|
||||
/* Miscellaneous */ \
|
||||
|
@ -525,17 +525,15 @@ TF_BUILTIN(Add, AddStubAssembler) {
|
||||
BIND(&string_add_convert_left);
|
||||
{
|
||||
// Convert {left} to a String and concatenate it with the String {right}.
|
||||
Callable callable =
|
||||
CodeFactory::StringAdd(isolate(), STRING_ADD_CONVERT_LEFT, NOT_TENURED);
|
||||
Return(CallStub(callable, context, var_left.value(), var_right.value()));
|
||||
TailCallBuiltin(Builtins::kStringAdd_ConvertLeft, context, var_left.value(),
|
||||
var_right.value());
|
||||
}
|
||||
|
||||
BIND(&string_add_convert_right);
|
||||
{
|
||||
// Convert {right} to a String and concatenate it with the String {left}.
|
||||
Callable callable = CodeFactory::StringAdd(
|
||||
isolate(), STRING_ADD_CONVERT_RIGHT, NOT_TENURED);
|
||||
Return(CallStub(callable, context, var_left.value(), var_right.value()));
|
||||
TailCallBuiltin(Builtins::kStringAdd_ConvertRight, context,
|
||||
var_left.value(), var_right.value());
|
||||
}
|
||||
|
||||
BIND(&do_bigint_add);
|
||||
|
@ -91,8 +91,7 @@ void ObjectBuiltinsAssembler::ReturnToStringFormat(Node* context,
|
||||
Node* lhs = StringConstant("[object ");
|
||||
Node* rhs = StringConstant("]");
|
||||
|
||||
Callable callable =
|
||||
CodeFactory::StringAdd(isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
|
||||
Callable callable = CodeFactory::StringAdd(isolate(), STRING_ADD_CHECK_NONE);
|
||||
|
||||
Return(CallStub(callable, context, CallStub(callable, context, lhs, string),
|
||||
rhs));
|
||||
|
@ -2903,14 +2903,13 @@ Node* RegExpBuiltinsAssembler::ReplaceSimpleStringFastPath(
|
||||
TNode<String> first_part =
|
||||
CAST(CallBuiltin(Builtins::kSubString, context, string,
|
||||
var_last_match_end.value(), match_start));
|
||||
var_result = CAST(CallBuiltin(Builtins::kStringAdd_CheckNone_NotTenured,
|
||||
context, var_result.value(), first_part));
|
||||
var_result = CAST(CallBuiltin(Builtins::kStringAdd_CheckNone, context,
|
||||
var_result.value(), first_part));
|
||||
|
||||
GotoIf(SmiEqual(replace_length, SmiZero()), &loop_end);
|
||||
|
||||
var_result =
|
||||
CAST(CallBuiltin(Builtins::kStringAdd_CheckNone_NotTenured, context,
|
||||
var_result.value(), replace_string));
|
||||
var_result = CAST(CallBuiltin(Builtins::kStringAdd_CheckNone, context,
|
||||
var_result.value(), replace_string));
|
||||
Goto(&loop_end);
|
||||
|
||||
BIND(&loop_end);
|
||||
@ -2936,8 +2935,8 @@ Node* RegExpBuiltinsAssembler::ReplaceSimpleStringFastPath(
|
||||
TNode<String> last_part =
|
||||
CAST(CallBuiltin(Builtins::kSubString, context, string,
|
||||
var_last_match_end.value(), string_length));
|
||||
var_result = CAST(CallBuiltin(Builtins::kStringAdd_CheckNone_NotTenured,
|
||||
context, var_result.value(), last_part));
|
||||
var_result = CAST(CallBuiltin(Builtins::kStringAdd_CheckNone, context,
|
||||
var_result.value(), last_part));
|
||||
Goto(&out);
|
||||
}
|
||||
|
||||
|
@ -284,67 +284,31 @@ void StringBuiltinsAssembler::StringEqual_Loop(
|
||||
}
|
||||
}
|
||||
|
||||
void StringBuiltinsAssembler::Generate_StringAdd(StringAddFlags flags,
|
||||
PretenureFlag pretenure_flag,
|
||||
Node* context, Node* left,
|
||||
Node* right) {
|
||||
switch (flags) {
|
||||
case STRING_ADD_CONVERT_LEFT: {
|
||||
// TODO(danno): The ToString and JSReceiverToPrimitive below could be
|
||||
// combined to avoid duplicate smi and instance type checks.
|
||||
left = ToString(context, JSReceiverToPrimitive(context, left));
|
||||
Callable callable = CodeFactory::StringAdd(
|
||||
isolate(), STRING_ADD_CHECK_NONE, pretenure_flag);
|
||||
TailCallStub(callable, context, left, right);
|
||||
break;
|
||||
}
|
||||
case STRING_ADD_CONVERT_RIGHT: {
|
||||
// TODO(danno): The ToString and JSReceiverToPrimitive below could be
|
||||
// combined to avoid duplicate smi and instance type checks.
|
||||
right = ToString(context, JSReceiverToPrimitive(context, right));
|
||||
Callable callable = CodeFactory::StringAdd(
|
||||
isolate(), STRING_ADD_CHECK_NONE, pretenure_flag);
|
||||
TailCallStub(callable, context, left, right);
|
||||
break;
|
||||
}
|
||||
case STRING_ADD_CHECK_NONE: {
|
||||
CodeStubAssembler::AllocationFlag allocation_flags =
|
||||
(pretenure_flag == TENURED) ? CodeStubAssembler::kPretenured
|
||||
: CodeStubAssembler::kNone;
|
||||
Return(StringAdd(context, CAST(left), CAST(right), allocation_flags));
|
||||
break;
|
||||
}
|
||||
}
|
||||
TF_BUILTIN(StringAdd_CheckNone, StringBuiltinsAssembler) {
|
||||
TNode<String> left = CAST(Parameter(Descriptor::kLeft));
|
||||
TNode<String> right = CAST(Parameter(Descriptor::kRight));
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Return(StringAdd(context, left, right));
|
||||
}
|
||||
|
||||
TF_BUILTIN(StringAdd_CheckNone_NotTenured, StringBuiltinsAssembler) {
|
||||
Node* left = Parameter(Descriptor::kLeft);
|
||||
Node* right = Parameter(Descriptor::kRight);
|
||||
TF_BUILTIN(StringAdd_ConvertLeft, StringBuiltinsAssembler) {
|
||||
TNode<Object> left = CAST(Parameter(Descriptor::kLeft));
|
||||
TNode<String> right = CAST(Parameter(Descriptor::kRight));
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Generate_StringAdd(STRING_ADD_CHECK_NONE, NOT_TENURED, context, left, right);
|
||||
// TODO(danno): The ToString and JSReceiverToPrimitive below could be
|
||||
// combined to avoid duplicate smi and instance type checks.
|
||||
left = ToString(context, JSReceiverToPrimitive(context, left));
|
||||
TailCallBuiltin(Builtins::kStringAdd_CheckNone, context, left, right);
|
||||
}
|
||||
|
||||
TF_BUILTIN(StringAdd_CheckNone_Tenured, StringBuiltinsAssembler) {
|
||||
Node* left = Parameter(Descriptor::kLeft);
|
||||
Node* right = Parameter(Descriptor::kRight);
|
||||
TF_BUILTIN(StringAdd_ConvertRight, StringBuiltinsAssembler) {
|
||||
TNode<String> left = CAST(Parameter(Descriptor::kLeft));
|
||||
TNode<Object> right = CAST(Parameter(Descriptor::kRight));
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Generate_StringAdd(STRING_ADD_CHECK_NONE, TENURED, context, left, right);
|
||||
}
|
||||
|
||||
TF_BUILTIN(StringAdd_ConvertLeft_NotTenured, StringBuiltinsAssembler) {
|
||||
Node* left = Parameter(Descriptor::kLeft);
|
||||
Node* right = Parameter(Descriptor::kRight);
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Generate_StringAdd(STRING_ADD_CONVERT_LEFT, NOT_TENURED, context, left,
|
||||
right);
|
||||
}
|
||||
|
||||
TF_BUILTIN(StringAdd_ConvertRight_NotTenured, StringBuiltinsAssembler) {
|
||||
Node* left = Parameter(Descriptor::kLeft);
|
||||
Node* right = Parameter(Descriptor::kRight);
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Generate_StringAdd(STRING_ADD_CONVERT_RIGHT, NOT_TENURED, context, left,
|
||||
right);
|
||||
// TODO(danno): The ToString and JSReceiverToPrimitive below could be
|
||||
// combined to avoid duplicate smi and instance type checks.
|
||||
right = ToString(context, JSReceiverToPrimitive(context, right));
|
||||
TailCallBuiltin(Builtins::kStringAdd_CheckNone, context, left, right);
|
||||
}
|
||||
|
||||
TF_BUILTIN(SubString, StringBuiltinsAssembler) {
|
||||
@ -1309,9 +1273,6 @@ TF_BUILTIN(StringRepeat, StringBuiltinsAssembler) {
|
||||
VARIABLE(var_temp, MachineRepresentation::kTagged, string);
|
||||
TVARIABLE(Smi, var_count, count);
|
||||
|
||||
Callable stringadd_callable =
|
||||
CodeFactory::StringAdd(isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
|
||||
|
||||
Label loop(this, {&var_count, &var_result, &var_temp}), return_result(this);
|
||||
Goto(&loop);
|
||||
BIND(&loop);
|
||||
@ -1319,16 +1280,16 @@ TF_BUILTIN(StringRepeat, StringBuiltinsAssembler) {
|
||||
{
|
||||
Label next(this);
|
||||
GotoIfNot(SmiToInt32(SmiAnd(var_count.value(), SmiConstant(1))), &next);
|
||||
var_result.Bind(CallStub(stringadd_callable, context, var_result.value(),
|
||||
var_temp.value()));
|
||||
var_result.Bind(CallBuiltin(Builtins::kStringAdd_CheckNone, context,
|
||||
var_result.value(), var_temp.value()));
|
||||
Goto(&next);
|
||||
BIND(&next);
|
||||
}
|
||||
|
||||
var_count = SmiShr(var_count.value(), 1);
|
||||
GotoIf(SmiEqual(var_count.value(), SmiConstant(0)), &return_result);
|
||||
var_temp.Bind(CallStub(stringadd_callable, context, var_temp.value(),
|
||||
var_temp.value()));
|
||||
var_temp.Bind(CallBuiltin(Builtins::kStringAdd_CheckNone, context,
|
||||
var_temp.value(), var_temp.value()));
|
||||
Goto(&loop);
|
||||
}
|
||||
|
||||
@ -1430,9 +1391,6 @@ TF_BUILTIN(StringPrototypeReplace, StringBuiltinsAssembler) {
|
||||
|
||||
TNode<Smi> const match_end_index = SmiAdd(match_start_index, search_length);
|
||||
|
||||
Callable stringadd_callable =
|
||||
CodeFactory::StringAdd(isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
|
||||
|
||||
VARIABLE(var_result, MachineRepresentation::kTagged, EmptyStringConstant());
|
||||
|
||||
// Compute the prefix.
|
||||
@ -1463,8 +1421,8 @@ TF_BUILTIN(StringPrototypeReplace, StringBuiltinsAssembler) {
|
||||
CallJS(call_callable, context, replace, UndefinedConstant(),
|
||||
search_string, match_start_index, subject_string);
|
||||
Node* const replacement_string = ToString_Inline(context, replacement);
|
||||
var_result.Bind(CallStub(stringadd_callable, context, var_result.value(),
|
||||
replacement_string));
|
||||
var_result.Bind(CallBuiltin(Builtins::kStringAdd_CheckNone, context,
|
||||
var_result.value(), replacement_string));
|
||||
Goto(&out);
|
||||
}
|
||||
|
||||
@ -1474,8 +1432,8 @@ TF_BUILTIN(StringPrototypeReplace, StringBuiltinsAssembler) {
|
||||
Node* const replacement =
|
||||
GetSubstitution(context, subject_string, match_start_index,
|
||||
match_end_index, replace_string);
|
||||
var_result.Bind(
|
||||
CallStub(stringadd_callable, context, var_result.value(), replacement));
|
||||
var_result.Bind(CallBuiltin(Builtins::kStringAdd_CheckNone, context,
|
||||
var_result.value(), replacement));
|
||||
Goto(&out);
|
||||
}
|
||||
|
||||
@ -1484,8 +1442,8 @@ TF_BUILTIN(StringPrototypeReplace, StringBuiltinsAssembler) {
|
||||
Node* const suffix =
|
||||
CallBuiltin(Builtins::kStringSubstring, context, subject_string,
|
||||
SmiUntag(match_end_index), SmiUntag(subject_length));
|
||||
Node* const result =
|
||||
CallStub(stringadd_callable, context, var_result.value(), suffix);
|
||||
Node* const result = CallBuiltin(Builtins::kStringAdd_CheckNone, context,
|
||||
var_result.value(), suffix);
|
||||
Return(result);
|
||||
}
|
||||
}
|
||||
@ -1677,8 +1635,6 @@ class StringPadAssembler : public StringBuiltinsAssembler {
|
||||
SmiLessThanOrEqual(smi_max_length, SmiConstant(String::kMaxLength)),
|
||||
&invalid_string_length);
|
||||
|
||||
Callable stringadd_callable =
|
||||
CodeFactory::StringAdd(isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
|
||||
CSA_ASSERT(this, SmiGreaterThan(smi_max_length, string_length));
|
||||
TNode<Smi> const pad_length = SmiSub(smi_max_length, string_length);
|
||||
|
||||
@ -1715,19 +1671,20 @@ class StringPadAssembler : public StringBuiltinsAssembler {
|
||||
Node* const remainder_string = CallBuiltin(
|
||||
Builtins::kStringSubstring, context, var_fill_string.value(),
|
||||
IntPtrConstant(0), ChangeInt32ToIntPtr(remaining_word32));
|
||||
var_pad.Bind(CallStub(stringadd_callable, context, var_pad.value(),
|
||||
remainder_string));
|
||||
var_pad.Bind(CallBuiltin(Builtins::kStringAdd_CheckNone, context,
|
||||
var_pad.value(), remainder_string));
|
||||
Goto(&return_result);
|
||||
}
|
||||
}
|
||||
BIND(&return_result);
|
||||
CSA_ASSERT(this,
|
||||
SmiEqual(pad_length, LoadStringLengthAsSmi(var_pad.value())));
|
||||
arguments.PopAndReturn(variant == kStart
|
||||
? CallStub(stringadd_callable, context,
|
||||
var_pad.value(), receiver_string)
|
||||
: CallStub(stringadd_callable, context,
|
||||
receiver_string, var_pad.value()));
|
||||
arguments.PopAndReturn(
|
||||
variant == kStart
|
||||
? CallBuiltin(Builtins::kStringAdd_CheckNone, context,
|
||||
var_pad.value(), receiver_string)
|
||||
: CallBuiltin(Builtins::kStringAdd_CheckNone, context,
|
||||
receiver_string, var_pad.value()));
|
||||
}
|
||||
BIND(&dont_pad);
|
||||
arguments.PopAndReturn(receiver_string);
|
||||
|
@ -108,9 +108,6 @@ class StringBuiltinsAssembler : public CodeStubAssembler {
|
||||
Handle<Symbol> symbol,
|
||||
const NodeFunction0& regexp_call,
|
||||
const NodeFunction1& generic_call);
|
||||
|
||||
void Generate_StringAdd(StringAddFlags flags, PretenureFlag pretenure_flag,
|
||||
Node* context, Node* left, Node* right);
|
||||
};
|
||||
|
||||
class StringIncludesIndexOfAssembler : public StringBuiltinsAssembler {
|
||||
|
@ -166,27 +166,15 @@ Callable CodeFactory::OrdinaryToPrimitive(Isolate* isolate,
|
||||
}
|
||||
|
||||
// static
|
||||
Callable CodeFactory::StringAdd(Isolate* isolate, StringAddFlags flags,
|
||||
PretenureFlag pretenure_flag) {
|
||||
if (pretenure_flag == NOT_TENURED) {
|
||||
switch (flags) {
|
||||
case STRING_ADD_CHECK_NONE:
|
||||
return Builtins::CallableFor(isolate,
|
||||
Builtins::kStringAdd_CheckNone_NotTenured);
|
||||
case STRING_ADD_CONVERT_LEFT:
|
||||
return Builtins::CallableFor(
|
||||
isolate, Builtins::kStringAdd_ConvertLeft_NotTenured);
|
||||
case STRING_ADD_CONVERT_RIGHT:
|
||||
return Builtins::CallableFor(
|
||||
isolate, Builtins::kStringAdd_ConvertRight_NotTenured);
|
||||
}
|
||||
} else {
|
||||
CHECK_EQ(TENURED, pretenure_flag);
|
||||
CHECK_EQ(STRING_ADD_CHECK_NONE, flags);
|
||||
return Builtins::CallableFor(isolate,
|
||||
Builtins::kStringAdd_CheckNone_Tenured);
|
||||
Callable CodeFactory::StringAdd(Isolate* isolate, StringAddFlags flags) {
|
||||
switch (flags) {
|
||||
case STRING_ADD_CHECK_NONE:
|
||||
return Builtins::CallableFor(isolate, Builtins::kStringAdd_CheckNone);
|
||||
case STRING_ADD_CONVERT_LEFT:
|
||||
return Builtins::CallableFor(isolate, Builtins::kStringAdd_ConvertLeft);
|
||||
case STRING_ADD_CONVERT_RIGHT:
|
||||
return Builtins::CallableFor(isolate, Builtins::kStringAdd_ConvertRight);
|
||||
}
|
||||
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
|
@ -59,8 +59,7 @@ class V8_EXPORT_PRIVATE CodeFactory final {
|
||||
OrdinaryToPrimitiveHint hint);
|
||||
|
||||
static Callable StringAdd(Isolate* isolate,
|
||||
StringAddFlags flags = STRING_ADD_CHECK_NONE,
|
||||
PretenureFlag pretenure_flag = NOT_TENURED);
|
||||
StringAddFlags flags = STRING_ADD_CHECK_NONE);
|
||||
|
||||
static Callable FastNewFunctionContext(Isolate* isolate,
|
||||
ScopeType scope_type);
|
||||
|
@ -1552,7 +1552,7 @@ Node* EffectControlLinearizer::LowerStringConcat(Node* node) {
|
||||
Node* rhs = node->InputAt(2);
|
||||
|
||||
Callable const callable =
|
||||
CodeFactory::StringAdd(isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
|
||||
CodeFactory::StringAdd(isolate(), STRING_ADD_CHECK_NONE);
|
||||
auto call_descriptor = Linkage::GetStubCallDescriptor(
|
||||
graph()->zone(), callable.descriptor(),
|
||||
callable.descriptor().GetStackParameterCount(), CallDescriptor::kNoFlags,
|
||||
|
@ -1149,10 +1149,9 @@ void JSHeapBroker::SerializeStandardObjects() {
|
||||
Builtins::kForInFilter,
|
||||
Builtins::kJSBuiltinsConstructStub,
|
||||
Builtins::kJSConstructStubGeneric,
|
||||
Builtins::kStringAdd_CheckNone_NotTenured,
|
||||
Builtins::kStringAdd_CheckNone_Tenured,
|
||||
Builtins::kStringAdd_ConvertLeft_NotTenured,
|
||||
Builtins::kStringAdd_ConvertRight_NotTenured,
|
||||
Builtins::kStringAdd_CheckNone,
|
||||
Builtins::kStringAdd_ConvertLeft,
|
||||
Builtins::kStringAdd_ConvertRight,
|
||||
Builtins::kToNumber,
|
||||
Builtins::kToObject,
|
||||
};
|
||||
|
@ -647,8 +647,7 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) {
|
||||
|
||||
// JSAdd(x:string, y) => CallStub[StringAdd](x, y)
|
||||
// JSAdd(x, y:string) => CallStub[StringAdd](x, y)
|
||||
Callable const callable =
|
||||
CodeFactory::StringAdd(isolate(), flags, NOT_TENURED);
|
||||
Callable const callable = CodeFactory::StringAdd(isolate(), flags);
|
||||
auto call_descriptor = Linkage::GetStubCallDescriptor(
|
||||
graph()->zone(), callable.descriptor(),
|
||||
callable.descriptor().GetStackParameterCount(),
|
||||
|
@ -162,9 +162,8 @@ Node* BinaryOpAssembler::Generate_AddWithFeedback(Node* context, Node* lhs,
|
||||
&call_with_any_feedback);
|
||||
|
||||
var_type_feedback.Bind(SmiConstant(BinaryOperationFeedback::kString));
|
||||
Callable callable =
|
||||
CodeFactory::StringAdd(isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
|
||||
var_result.Bind(CallStub(callable, context, lhs, rhs));
|
||||
var_result.Bind(
|
||||
CallBuiltin(Builtins::kStringAdd_CheckNone, context, lhs, rhs));
|
||||
|
||||
Goto(&end);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user