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

Unified Diff: src/arm64/code-stubs-arm64.cc

Issue 1412963002: [runtime] Implement %_ToLength via ToLengthStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
Index: src/arm64/code-stubs-arm64.cc
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc
index fc75e082baeffe8fc47bb51f9b893156c045f705..0a7b4752656e9c2c589e31d0d338a5d4b9d8c5c3 100644
--- a/src/arm64/code-stubs-arm64.cc
+++ b/src/arm64/code-stubs-arm64.cc
@@ -3914,6 +3914,21 @@ void ToNumberStub::Generate(MacroAssembler* masm) {
}
+void ToLengthStub::Generate(MacroAssembler* masm) {
+ // The ToLength stub takes one argument in x0.
+ Label not_smi;
+ __ JumpIfNotSmi(x0, &not_smi);
+ STATIC_ASSERT(kSmiTag == 0);
+ __ Tst(x0, x0);
+ __ Csel(x0, x0, Operand(0), ge);
+ __ Ret();
+ __ Bind(&not_smi);
+
+ __ Push(x0); // Push argument.
+ __ TailCallRuntime(Runtime::kToLength, 1, 1);
+}
+
+
void ToStringStub::Generate(MacroAssembler* masm) {
// The ToString stub takes one argument in x0.
Label is_number;

Powered by Google App Engine
This is Rietveld 408576698