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

Side by Side Diff: src/ia32/code-stubs-ia32.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_IA32 5 #if V8_TARGET_ARCH_IA32
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 3174 matching lines...) Expand 10 before | Expand all | Expand 10 after
3185 __ Ret(); 3185 __ Ret();
3186 __ bind(&not_oddball); 3186 __ bind(&not_oddball);
3187 3187
3188 __ pop(ecx); // Pop return address. 3188 __ pop(ecx); // Pop return address.
3189 __ push(eax); // Push argument. 3189 __ push(eax); // Push argument.
3190 __ push(ecx); // Push return address. 3190 __ push(ecx); // Push return address.
3191 __ TailCallRuntime(Runtime::kToNumber, 1, 1); 3191 __ TailCallRuntime(Runtime::kToNumber, 1, 1);
3192 } 3192 }
3193 3193
3194 3194
3195 void ToLengthStub::Generate(MacroAssembler* masm) {
3196 // The ToLength stub takes on argument in eax.
3197 Label not_smi, positive_smi;
3198 __ JumpIfNotSmi(eax, &not_smi, Label::kNear);
3199 STATIC_ASSERT(kSmiTag == 0);
3200 __ test(eax, eax);
3201 __ j(greater_equal, &positive_smi, Label::kNear);
3202 __ xor_(eax, eax);
3203 __ bind(&positive_smi);
3204 __ Ret();
3205 __ bind(&not_smi);
3206
3207 __ pop(ecx); // Pop return address.
3208 __ push(eax); // Push argument.
3209 __ push(ecx); // Push return address.
3210 __ TailCallRuntime(Runtime::kToLength, 1, 1);
3211 }
3212
3213
3195 void ToStringStub::Generate(MacroAssembler* masm) { 3214 void ToStringStub::Generate(MacroAssembler* masm) {
3196 // The ToString stub takes one argument in eax. 3215 // The ToString stub takes one argument in eax.
3197 Label is_number; 3216 Label is_number;
3198 __ JumpIfSmi(eax, &is_number, Label::kNear); 3217 __ JumpIfSmi(eax, &is_number, Label::kNear);
3199 3218
3200 Label not_string; 3219 Label not_string;
3201 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); 3220 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi);
3202 // eax: receiver 3221 // eax: receiver
3203 // edi: receiver map 3222 // edi: receiver map
3204 __ j(above_equal, &not_string, Label::kNear); 3223 __ j(above_equal, &not_string, Label::kNear);
(...skipping 2638 matching lines...) Expand 10 before | Expand all | Expand 10 after
5843 Operand(ebp, 7 * kPointerSize), NULL); 5862 Operand(ebp, 7 * kPointerSize), NULL);
5844 } 5863 }
5845 5864
5846 5865
5847 #undef __ 5866 #undef __
5848 5867
5849 } // namespace internal 5868 } // namespace internal
5850 } // namespace v8 5869 } // namespace v8
5851 5870
5852 #endif // V8_TARGET_ARCH_IA32 5871 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698