[cleanup] Remove ToString intrinsic

The ToString intrinsic isn't used anymore, since there is now a ToString
bytecode, so we can remove it.

Change-Id: I5ed121ae4d117660e1ee8a64a2b30e1fb054a886
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2848465
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74151}
This commit is contained in:
Leszek Swirski 2021-04-23 16:09:12 +02:00 committed by Commit Bot
parent fbe432212a
commit b164fe240b
8 changed files with 1 additions and 38 deletions

View File

@ -1344,10 +1344,6 @@ void BaselineCompiler::VisitIntrinsicHasProperty(
CallBuiltin<Builtins::kHasProperty>(args);
}
void BaselineCompiler::VisitIntrinsicToString(interpreter::RegisterList args) {
CallBuiltin<Builtins::kToString>(args);
}
void BaselineCompiler::VisitIntrinsicToLength(interpreter::RegisterList args) {
CallBuiltin<Builtins::kToLength>(args);
}

View File

@ -80,8 +80,6 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
return ReduceToLength(node);
case Runtime::kInlineToObject:
return ReduceToObject(node);
case Runtime::kInlineToString:
return ReduceToString(node);
case Runtime::kInlineCall:
return ReduceCall(node);
case Runtime::kInlineIncBlockCounter:

View File

@ -1839,8 +1839,6 @@ Type Typer::Visitor::TypeJSCallRuntime(Node* node) {
return TypeUnaryOp(node, ToNumber);
case Runtime::kInlineToObject:
return TypeUnaryOp(node, ToObject);
case Runtime::kInlineToString:
return TypeUnaryOp(node, ToString);
case Runtime::kHasInPrototypeChain:
return Type::Boolean();
default:

View File

@ -213,12 +213,6 @@ TNode<Object> IntrinsicsGenerator::HasProperty(
arg_count);
}
TNode<Object> IntrinsicsGenerator::ToString(
const InterpreterAssembler::RegListNodePair& args, TNode<Context> context,
int arg_count) {
return IntrinsicAsBuiltinCall(args, context, Builtins::kToString, arg_count);
}
TNode<Object> IntrinsicsGenerator::ToLength(
const InterpreterAssembler::RegListNodePair& args, TNode<Context> context,
int arg_count) {

View File

@ -36,7 +36,6 @@ namespace interpreter {
V(IsArray, is_array, 1) \
V(IsJSReceiver, is_js_receiver, 1) \
V(IsSmi, is_smi, 1) \
V(ToString, to_string, 1) \
V(ToLength, to_length, 1) \
V(ToObject, to_object, 1)

View File

@ -654,15 +654,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
}
}
// A shortcut for performing a ToString operation
V8_INLINE Expression* ToString(Expression* expr) {
if (expr->IsStringLiteral()) return expr;
ScopedPtrList<Expression> args(pointer_buffer());
args.Add(expr);
return factory()->NewCallRuntime(Runtime::kInlineToString, args,
expr->position());
}
// Returns true if we have a binary expression between two numeric
// literals. In that case, *x will be changed to an expression which is the
// computed value.

View File

@ -342,7 +342,7 @@ namespace internal {
I(ToNumber, 1, 1) \
F(ToNumeric, 1, 1) \
I(ToObject, 1, 1) \
I(ToString, 1, 1) \
F(ToString, 1, 1) \
F(TryMigrateInstance, 1, 1) \
F(SwissTableAdd, 4, 1) \
F(SwissTableAllocate, 1, 1) \

View File

@ -5,50 +5,37 @@
// Flags: --allow-natives-syntax
assertEquals("1", %ToString(1));
assertEquals("1", %_ToString(1));
assertEquals("0.5", %ToString(.5));
assertEquals("0.5", %_ToString(.5));
assertEquals("null", %ToString(null));
assertEquals("null", %_ToString(null));
assertEquals("true", %ToString(true));
assertEquals("true", %_ToString(true));
assertEquals("false", %ToString(false));
assertEquals("false", %_ToString(false));
assertEquals("undefined", %ToString(undefined));
assertEquals("undefined", %_ToString(undefined));
assertEquals("random text", %ToString("random text"));
assertEquals("random text", %_ToString("random text"));
assertThrows(function() { %ToString(Symbol.toPrimitive) }, TypeError);
assertThrows(function() { %_ToString(Symbol.toPrimitive) }, TypeError);
var a = { toString: function() { return "xyz" }};
assertEquals("xyz", %ToString(a));
assertEquals("xyz", %_ToString(a));
var b = { valueOf: function() { return 42 }};
assertEquals("[object Object]", %ToString(b));
assertEquals("[object Object]", %_ToString(b));
var c = {
toString: function() { return "x"},
valueOf: function() { return 123 }
};
assertEquals("x", %ToString(c));
assertEquals("x", %_ToString(c));
var d = {
[Symbol.toPrimitive]: function(hint) { return hint }
};
assertEquals("string", %ToString(d));
assertEquals("string", %_ToString(d));
var e = new Date(0);
assertEquals(e.toString(), %ToString(e));
assertEquals(e.toString(), %_ToString(e));