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

Unified Diff: src/code-stub-assembler.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/code-stub-assembler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stub-assembler.cc
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc
index 79d2b7324a51e446b8d0a6e32a3a70d3136d45dc..1cfb70d7a5c22340d799b60bd39bdef69441c91e 100644
--- a/src/code-stub-assembler.cc
+++ b/src/code-stub-assembler.cc
@@ -4467,6 +4467,22 @@ Node* CodeStubAssembler::ToString(Node* context, Node* input) {
return result.value();
}
+Node* CodeStubAssembler::ToString_Inline(Node* const context,
+ Node* const input) {
+ VARIABLE(var_result, MachineRepresentation::kTagged, input);
+ Label stub_call(this, Label::kDeferred), out(this);
+
+ GotoIf(TaggedIsSmi(input), &stub_call);
+ Branch(IsString(input), &out, &stub_call);
+
+ BIND(&stub_call);
+ var_result.Bind(CallBuiltin(Builtins::kToString, context, input));
+ Goto(&out);
+
+ BIND(&out);
+ return var_result.value();
+}
+
Node* CodeStubAssembler::JSReceiverToPrimitive(Node* context, Node* input) {
Label if_isreceiver(this, Label::kDeferred), if_isnotreceiver(this);
VARIABLE(result, MachineRepresentation::kTagged);
@@ -4544,6 +4560,15 @@ Node* CodeStubAssembler::ToSmiLength(Node* input, Node* const context,
return result.value();
}
+Node* CodeStubAssembler::ToLength_Inline(Node* const context,
+ Node* const input) {
+ Node* const smi_zero = SmiConstant(0);
+ return Select(
+ TaggedIsSmi(input), [=] { return SmiMax(input, smi_zero); },
+ [=] { return CallBuiltin(Builtins::kToLength, context, input); },
+ MachineRepresentation::kTagged);
+}
+
Node* CodeStubAssembler::ToInteger(Node* context, Node* input,
ToIntegerTruncationMode mode) {
// We might need to loop once for ToNumber conversion.
« no previous file with comments | « src/code-stub-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698