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

Side by Side Diff: src/mips/code-stubs-mips.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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_MIPS 5 #if V8_TARGET_ARCH_MIPS
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 3296 matching lines...) Expand 10 before | Expand all | Expand 10 after
3307 __ Branch(&not_oddball, ne, a1, Operand(ODDBALL_TYPE)); 3307 __ Branch(&not_oddball, ne, a1, Operand(ODDBALL_TYPE));
3308 __ Ret(USE_DELAY_SLOT); 3308 __ Ret(USE_DELAY_SLOT);
3309 __ lw(v0, FieldMemOperand(a0, Oddball::kToNumberOffset)); 3309 __ lw(v0, FieldMemOperand(a0, Oddball::kToNumberOffset));
3310 __ bind(&not_oddball); 3310 __ bind(&not_oddball);
3311 3311
3312 __ push(a0); // Push argument. 3312 __ push(a0); // Push argument.
3313 __ TailCallRuntime(Runtime::kToNumber, 1, 1); 3313 __ TailCallRuntime(Runtime::kToNumber, 1, 1);
3314 } 3314 }
3315 3315
3316 3316
3317 void ToLengthStub::Generate(MacroAssembler* masm) {
3318 // The ToLength stub takes on argument in a0.
3319 Label not_smi, positive_smi;
3320 __ JumpIfNotSmi(a0, &not_smi);
3321 STATIC_ASSERT(kSmiTag == 0);
3322 __ Branch(&positive_smi, ge, a0, Operand(zero_reg));
3323 __ mov(a0, zero_reg);
3324 __ bind(&positive_smi);
3325 __ Ret(USE_DELAY_SLOT);
3326 __ mov(v0, a0);
3327 __ bind(&not_smi);
3328
3329 __ push(a0); // Push argument.
3330 __ TailCallRuntime(Runtime::kToLength, 1, 1);
3331 }
3332
3333
3317 void ToStringStub::Generate(MacroAssembler* masm) { 3334 void ToStringStub::Generate(MacroAssembler* masm) {
3318 // The ToString stub takes on argument in a0. 3335 // The ToString stub takes on argument in a0.
3319 Label is_number; 3336 Label is_number;
3320 __ JumpIfSmi(a0, &is_number); 3337 __ JumpIfSmi(a0, &is_number);
3321 3338
3322 Label not_string; 3339 Label not_string;
3323 __ GetObjectType(a0, a1, a1); 3340 __ GetObjectType(a0, a1, a1);
3324 // a0: receiver 3341 // a0: receiver
3325 // a1: receiver instance type 3342 // a1: receiver instance type
3326 __ Branch(&not_string, ge, a1, Operand(FIRST_NONSTRING_TYPE)); 3343 __ Branch(&not_string, ge, a1, Operand(FIRST_NONSTRING_TYPE));
(...skipping 2415 matching lines...) Expand 10 before | Expand all | Expand 10 after
5742 MemOperand(fp, 6 * kPointerSize), NULL); 5759 MemOperand(fp, 6 * kPointerSize), NULL);
5743 } 5760 }
5744 5761
5745 5762
5746 #undef __ 5763 #undef __
5747 5764
5748 } // namespace internal 5765 } // namespace internal
5749 } // namespace v8 5766 } // namespace v8
5750 5767
5751 #endif // V8_TARGET_ARCH_MIPS 5768 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698