Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: src/builtins/builtins-string-gen.cc

Issue 2874423003: [csa] Add ToLength and ToString variants with inlined fast checks (Closed)
Patch Set: ToString Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins/builtins-regexp-gen.cc ('k') | src/code-stub-assembler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-string-gen.cc
diff --git a/src/builtins/builtins-string-gen.cc b/src/builtins/builtins-string-gen.cc
index 5b457b7083b27fc469ff67dbf9a965da05fab93d..97665a6390558803374c91ceae5cbc495924359a 100644
--- a/src/builtins/builtins-string-gen.cc
+++ b/src/builtins/builtins-string-gen.cc
@@ -732,7 +732,7 @@ TF_BUILTIN(StringPrototypeConcat, CodeStubAssembler) {
arguments.ForEach(
CodeStubAssembler::VariableList({&var_result}, zone()),
[this, context, &var_result](Node* arg) {
- arg = CallStub(CodeFactory::ToString(isolate()), context, arg);
+ arg = ToString_Inline(context, arg);
var_result.Bind(CallStub(CodeFactory::StringAdd(isolate()), context,
var_result.value(), arg));
});
@@ -1149,9 +1149,7 @@ TF_BUILTIN(StringPrototypeReplace, StringBuiltinsAssembler) {
MaybeCallFunctionAtSymbol(
context, search, isolate()->factory()->replace_symbol(),
[=]() {
- Callable tostring_callable = CodeFactory::ToString(isolate());
- Node* const subject_string =
- CallStub(tostring_callable, context, receiver);
+ Node* const subject_string = ToString_Inline(context, receiver);
Callable replace_callable = CodeFactory::RegExpReplace(isolate());
return CallStub(replace_callable, context, search, subject_string,
@@ -1164,11 +1162,10 @@ TF_BUILTIN(StringPrototypeReplace, StringBuiltinsAssembler) {
// Convert {receiver} and {search} to strings.
- Callable tostring_callable = CodeFactory::ToString(isolate());
Callable indexof_callable = CodeFactory::StringIndexOf(isolate());
- Node* const subject_string = CallStub(tostring_callable, context, receiver);
- Node* const search_string = CallStub(tostring_callable, context, search);
+ Node* const subject_string = ToString_Inline(context, receiver);
+ Node* const search_string = ToString_Inline(context, search);
Node* const subject_length = LoadStringLength(subject_string);
Node* const search_length = LoadStringLength(search_string);
@@ -1222,7 +1219,7 @@ TF_BUILTIN(StringPrototypeReplace, StringBuiltinsAssembler) {
// TODO(jgruber): Could introduce ToStringSideeffectsStub which only
// performs observable parts of ToString.
- CallStub(tostring_callable, context, replace);
+ ToString_Inline(context, replace);
Goto(&return_subject);
BIND(&return_subject);
@@ -1265,8 +1262,7 @@ TF_BUILTIN(StringPrototypeReplace, StringBuiltinsAssembler) {
Node* const replacement =
CallJS(call_callable, context, replace, UndefinedConstant(),
search_string, match_start_index, subject_string);
- Node* const replacement_string =
- CallStub(tostring_callable, context, replacement);
+ Node* const replacement_string = ToString_Inline(context, replacement);
var_result.Bind(CallStub(stringadd_callable, context, var_result.value(),
replacement_string));
Goto(&out);
@@ -1274,7 +1270,7 @@ TF_BUILTIN(StringPrototypeReplace, StringBuiltinsAssembler) {
BIND(&if_notcallablereplace);
{
- Node* const replace_string = CallStub(tostring_callable, context, replace);
+ Node* const replace_string = ToString_Inline(context, replace);
Node* const replacement =
GetSubstitution(context, subject_string, match_start_index,
match_end_index, replace_string);
@@ -1311,9 +1307,7 @@ TF_BUILTIN(StringPrototypeSplit, StringBuiltinsAssembler) {
MaybeCallFunctionAtSymbol(
context, separator, isolate()->factory()->split_symbol(),
[=]() {
- Callable tostring_callable = CodeFactory::ToString(isolate());
- Node* const subject_string =
- CallStub(tostring_callable, context, receiver);
+ Node* const subject_string = ToString_Inline(context, receiver);
Callable split_callable = CodeFactory::RegExpSplit(isolate());
return CallStub(split_callable, context, separator, subject_string,
@@ -1329,14 +1323,12 @@ TF_BUILTIN(StringPrototypeSplit, StringBuiltinsAssembler) {
// but AFAIK there should not be a difference since arrays are capped at Smi
// lengths.
- Callable tostring_callable = CodeFactory::ToString(isolate());
- Node* const subject_string = CallStub(tostring_callable, context, receiver);
+ Node* const subject_string = ToString_Inline(context, receiver);
Node* const limit_number =
Select(IsUndefined(limit), [=]() { return SmiConstant(Smi::kMaxValue); },
[=]() { return ToUint32(context, limit); },
MachineRepresentation::kTagged);
- Node* const separator_string =
- CallStub(tostring_callable, context, separator);
+ Node* const separator_string = ToString_Inline(context, separator);
// Shortcut for {limit} == 0.
{
« no previous file with comments | « src/builtins/builtins-regexp-gen.cc ('k') | src/code-stub-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698