Commit 56eac828 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[cleanup] StringToNumber and NumberToString don't need a context.

These operations don't need to access per-native context data and
cannot throw exceptions.

Bug: v8:5268, v8:5269
Change-Id: Id7fdbee2b39f96717de83b3cef5ab789424f8338
Reviewed-on: https://chromium-review.googlesource.com/779142
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50639}
parent 1f3cdb70
......@@ -99,10 +99,9 @@ TF_BUILTIN(NonPrimitiveToPrimitive_String, ConversionBuiltinsAssembler) {
}
TF_BUILTIN(StringToNumber, CodeStubAssembler) {
Node* context = Parameter(Descriptor::kContext);
Node* input = Parameter(Descriptor::kArgument);
Return(StringToNumber(context, input));
Return(StringToNumber(input));
}
TF_BUILTIN(ToName, CodeStubAssembler) {
......@@ -145,10 +144,9 @@ TF_BUILTIN(ToNumber, CodeStubAssembler) {
// 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));
Return(NumberToString(input));
}
// ES section #sec-tostring
......
......@@ -5187,8 +5187,7 @@ TNode<String> CodeStubAssembler::StringFromCodePoint(TNode<Int32T> codepoint,
return CAST(var_result.value());
}
TNode<Number> CodeStubAssembler::StringToNumber(SloppyTNode<Context> context,
SloppyTNode<String> input) {
TNode<Number> CodeStubAssembler::StringToNumber(SloppyTNode<String> input) {
CSA_SLOW_ASSERT(this, IsString(input));
Label runtime(this, Label::kDeferred);
Label end(this);
......@@ -5206,7 +5205,8 @@ TNode<Number> CodeStubAssembler::StringToNumber(SloppyTNode<Context> context,
BIND(&runtime);
{
var_result = CAST(CallRuntime(Runtime::kStringToNumber, context, input));
var_result =
CAST(CallRuntime(Runtime::kStringToNumber, NoContextConstant(), input));
Goto(&end);
}
......@@ -5214,7 +5214,7 @@ TNode<Number> CodeStubAssembler::StringToNumber(SloppyTNode<Context> context,
return var_result;
}
Node* CodeStubAssembler::NumberToString(Node* context, Node* argument) {
Node* CodeStubAssembler::NumberToString(Node* argument) {
VARIABLE(result, MachineRepresentation::kTagged);
Label runtime(this, Label::kDeferred), smi(this), done(this, &result);
......@@ -5265,8 +5265,8 @@ Node* CodeStubAssembler::NumberToString(Node* context, Node* argument) {
BIND(&runtime);
{
// No cache entry, go to the runtime.
result.Bind(
CallRuntime(Runtime::kNumberToStringSkipCache, context, argument));
result.Bind(CallRuntime(Runtime::kNumberToStringSkipCache,
NoContextConstant(), argument));
}
Goto(&done);
......@@ -5369,7 +5369,7 @@ Node* CodeStubAssembler::NonNumberToNumberOrNumeric(
BIND(&if_inputisstring);
{
// The {input} is a String, use the fast stub to convert it to a Number.
var_result.Bind(StringToNumber(context, input));
var_result.Bind(StringToNumber(input));
Goto(&end);
}
......@@ -5667,7 +5667,7 @@ TNode<String> CodeStubAssembler::ToString(SloppyTNode<Context> context,
Branch(IsHeapNumberMap(input_map), &is_number, &not_heap_number);
BIND(&is_number);
result.Bind(NumberToString(context, input));
result.Bind(NumberToString(input));
Goto(&done);
BIND(&not_heap_number);
......
......@@ -1204,9 +1204,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
// Type conversion helpers.
enum class BigIntHandling { kConvertToNumber, kThrow };
// Convert a String to a Number.
TNode<Number> StringToNumber(SloppyTNode<Context> context,
SloppyTNode<String> input);
Node* NumberToString(Node* context, Node* input);
TNode<Number> StringToNumber(SloppyTNode<String> input);
// Convert a Number to a String.
Node* NumberToString(Node* input);
// Convert an object to a name.
Node* ToName(Node* context, Node* input);
// Convert a Non-Number object to a Number.
......
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