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

Unified Diff: src/mips64/code-stubs-mips64.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/mips64/code-stubs-mips64.cc
diff --git a/src/mips64/code-stubs-mips64.cc b/src/mips64/code-stubs-mips64.cc
index d1bdd7d901b7063beb3407d1a3cb7d407df66d37..bb6deb92c2443d508c53546f00df5daf691dbe11 100644
--- a/src/mips64/code-stubs-mips64.cc
+++ b/src/mips64/code-stubs-mips64.cc
@@ -3348,6 +3348,23 @@ void ToNumberStub::Generate(MacroAssembler* masm) {
}
+void ToLengthStub::Generate(MacroAssembler* masm) {
+ // The ToLength stub takes on argument in a0.
+ Label not_smi, positive_smi;
+ __ JumpIfNotSmi(a0, &not_smi);
+ STATIC_ASSERT(kSmiTag == 0);
+ __ Branch(&positive_smi, ge, a0, Operand(zero_reg));
+ __ mov(a0, zero_reg);
+ __ bind(&positive_smi);
+ __ Ret(USE_DELAY_SLOT);
+ __ mov(v0, a0);
+ __ bind(&not_smi);
+
+ __ push(a0); // Push argument.
+ __ TailCallRuntime(Runtime::kToLength, 1, 1);
+}
+
+
void ToStringStub::Generate(MacroAssembler* masm) {
// The ToString stub takes on argument in a0.
Label is_number;

Powered by Google App Engine
This is Rietveld 408576698