Commit 89658816 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Benedikt Meurer

[cleanup] Migrate the NumberToStringStub to a builtin.

Bug: v8:5267
Change-Id: I2338702ef69298bc95c47dcfedf7ef7632a2bf7f
Reviewed-on: https://chromium-review.googlesource.com/778842Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49478}
parent 3bedee68
...@@ -143,6 +143,15 @@ TF_BUILTIN(ToNumber, CodeStubAssembler) { ...@@ -143,6 +143,15 @@ TF_BUILTIN(ToNumber, CodeStubAssembler) {
Return(ToNumber(context, input)); Return(ToNumber(context, input));
} }
// ES section #sec-tostring-applied-to-the-number-type
TF_BUILTIN(NumberToString, CodeStubAssembler) {
Node* context = Parameter(Descriptor::kContext);
Node* input = Parameter(Descriptor::kArgument);
Return(NumberToString(context, input));
}
// ES section #sec-tostring
TF_BUILTIN(ToString, CodeStubAssembler) { TF_BUILTIN(ToString, CodeStubAssembler) {
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
Node* input = Parameter(Descriptor::kArgument); Node* input = Parameter(Descriptor::kArgument);
......
...@@ -187,6 +187,7 @@ namespace internal { ...@@ -187,6 +187,7 @@ namespace internal {
TFC(NonNumberToNumeric, TypeConversion, 1) \ TFC(NonNumberToNumeric, TypeConversion, 1) \
TFC(ToNumber, TypeConversion, 1) \ TFC(ToNumber, TypeConversion, 1) \
TFC(ToNumeric, TypeConversion, 1) \ TFC(ToNumeric, TypeConversion, 1) \
TFC(NumberToString, TypeConversion, 1) \
TFC(ToString, TypeConversion, 1) \ TFC(ToString, TypeConversion, 1) \
TFC(ToInteger, TypeConversion, 1) \ TFC(ToInteger, TypeConversion, 1) \
TFC(ToLength, TypeConversion, 1) \ TFC(ToLength, TypeConversion, 1) \
......
...@@ -150,12 +150,6 @@ Callable CodeFactory::OrdinaryToPrimitive(Isolate* isolate, ...@@ -150,12 +150,6 @@ Callable CodeFactory::OrdinaryToPrimitive(Isolate* isolate,
TypeConversionDescriptor(isolate)); TypeConversionDescriptor(isolate));
} }
// static
Callable CodeFactory::NumberToString(Isolate* isolate) {
NumberToStringStub stub(isolate);
return make_callable(stub);
}
// static // static
Callable CodeFactory::StringAdd(Isolate* isolate, StringAddFlags flags, Callable CodeFactory::StringAdd(Isolate* isolate, StringAddFlags flags,
PretenureFlag pretenure_flag) { PretenureFlag pretenure_flag) {
......
...@@ -52,7 +52,6 @@ class V8_EXPORT_PRIVATE CodeFactory final { ...@@ -52,7 +52,6 @@ class V8_EXPORT_PRIVATE CodeFactory final {
Isolate* isolate, ToPrimitiveHint hint = ToPrimitiveHint::kDefault); Isolate* isolate, ToPrimitiveHint hint = ToPrimitiveHint::kDefault);
static Callable OrdinaryToPrimitive(Isolate* isolate, static Callable OrdinaryToPrimitive(Isolate* isolate,
OrdinaryToPrimitiveHint hint); OrdinaryToPrimitiveHint hint);
static Callable NumberToString(Isolate* isolate);
static Callable StringAdd(Isolate* isolate, static Callable StringAdd(Isolate* isolate,
StringAddFlags flags = STRING_ADD_CHECK_NONE, StringAddFlags flags = STRING_ADD_CHECK_NONE,
......
...@@ -3797,8 +3797,7 @@ TNode<String> CodeStubAssembler::ToThisString(Node* context, Node* value, ...@@ -3797,8 +3797,7 @@ TNode<String> CodeStubAssembler::ToThisString(Node* context, Node* value,
BIND(&if_valueissmi); BIND(&if_valueissmi);
{ {
// The {value} is a Smi, convert it to a String. // The {value} is a Smi, convert it to a String.
Callable callable = CodeFactory::NumberToString(isolate()); var_value.Bind(CallBuiltin(Builtins::kNumberToString, context, value));
var_value.Bind(CallStub(callable, context, value));
Goto(&if_valueisstring); Goto(&if_valueisstring);
} }
BIND(&if_valueisstring); BIND(&if_valueisstring);
...@@ -5313,8 +5312,7 @@ Node* CodeStubAssembler::ToName(Node* context, Node* value) { ...@@ -5313,8 +5312,7 @@ Node* CodeStubAssembler::ToName(Node* context, Node* value) {
BIND(&is_number); BIND(&is_number);
{ {
Callable callable = CodeFactory::NumberToString(isolate()); var_result.Bind(CallBuiltin(Builtins::kNumberToString, context, value));
var_result.Bind(CallStub(callable, context, value));
Goto(&end); Goto(&end);
} }
......
...@@ -361,13 +361,6 @@ TF_STUB(TransitionElementsKindStub, CodeStubAssembler) { ...@@ -361,13 +361,6 @@ TF_STUB(TransitionElementsKindStub, CodeStubAssembler) {
} }
} }
// TODO(ishell): move to builtins.
TF_STUB(NumberToStringStub, CodeStubAssembler) {
Node* context = Parameter(Descriptor::kContext);
Node* argument = Parameter(Descriptor::kArgument);
Return(NumberToString(context, argument));
}
// TODO(ishell): move to builtins-handler-gen. // TODO(ishell): move to builtins-handler-gen.
TF_STUB(KeyedLoadSloppyArgumentsStub, CodeStubAssembler) { TF_STUB(KeyedLoadSloppyArgumentsStub, CodeStubAssembler) {
Node* receiver = Parameter(Descriptor::kReceiver); Node* receiver = Parameter(Descriptor::kReceiver);
......
...@@ -49,7 +49,6 @@ class Node; ...@@ -49,7 +49,6 @@ class Node;
V(KeyedStoreSloppyArguments) \ V(KeyedStoreSloppyArguments) \
V(LoadScriptContextField) \ V(LoadScriptContextField) \
V(StoreScriptContextField) \ V(StoreScriptContextField) \
V(NumberToString) \
V(StringAdd) \ V(StringAdd) \
V(GetProperty) \ V(GetProperty) \
V(StoreFastElement) \ V(StoreFastElement) \
...@@ -494,14 +493,6 @@ class GetPropertyStub : public TurboFanCodeStub { ...@@ -494,14 +493,6 @@ class GetPropertyStub : public TurboFanCodeStub {
DEFINE_TURBOFAN_CODE_STUB(GetProperty, TurboFanCodeStub); DEFINE_TURBOFAN_CODE_STUB(GetProperty, TurboFanCodeStub);
}; };
class NumberToStringStub final : public TurboFanCodeStub {
public:
explicit NumberToStringStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion);
DEFINE_TURBOFAN_CODE_STUB(NumberToString, TurboFanCodeStub);
};
class GrowArrayElementsStub : public TurboFanCodeStub { class GrowArrayElementsStub : public TurboFanCodeStub {
public: public:
GrowArrayElementsStub(Isolate* isolate, ElementsKind kind) GrowArrayElementsStub(Isolate* isolate, ElementsKind kind)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment