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

Side by Side Diff: src/x87/code-stubs-x87.cc

Issue 1421803002: X87: [runtime] Implement %_ToLength via ToLengthStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | src/x87/interface-descriptors-x87.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_X87 5 #if V8_TARGET_ARCH_X87
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 2884 matching lines...) Expand 10 before | Expand all | Expand 10 after
2895 __ Ret(); 2895 __ Ret();
2896 __ bind(&not_oddball); 2896 __ bind(&not_oddball);
2897 2897
2898 __ pop(ecx); // Pop return address. 2898 __ pop(ecx); // Pop return address.
2899 __ push(eax); // Push argument. 2899 __ push(eax); // Push argument.
2900 __ push(ecx); // Push return address. 2900 __ push(ecx); // Push return address.
2901 __ TailCallRuntime(Runtime::kToNumber, 1, 1); 2901 __ TailCallRuntime(Runtime::kToNumber, 1, 1);
2902 } 2902 }
2903 2903
2904 2904
2905 void ToLengthStub::Generate(MacroAssembler* masm) {
2906 // The ToLength stub takes on argument in eax.
2907 Label not_smi, positive_smi;
2908 __ JumpIfNotSmi(eax, &not_smi, Label::kNear);
2909 STATIC_ASSERT(kSmiTag == 0);
2910 __ test(eax, eax);
2911 __ j(greater_equal, &positive_smi, Label::kNear);
2912 __ xor_(eax, eax);
2913 __ bind(&positive_smi);
2914 __ Ret();
2915 __ bind(&not_smi);
2916
2917 __ pop(ecx); // Pop return address.
2918 __ push(eax); // Push argument.
2919 __ push(ecx); // Push return address.
2920 __ TailCallRuntime(Runtime::kToLength, 1, 1);
2921 }
2922
2923
2905 void ToStringStub::Generate(MacroAssembler* masm) { 2924 void ToStringStub::Generate(MacroAssembler* masm) {
2906 // The ToString stub takes one argument in eax. 2925 // The ToString stub takes one argument in eax.
2907 Label is_number; 2926 Label is_number;
2908 __ JumpIfSmi(eax, &is_number, Label::kNear); 2927 __ JumpIfSmi(eax, &is_number, Label::kNear);
2909 2928
2910 Label not_string; 2929 Label not_string;
2911 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); 2930 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi);
2912 // eax: receiver 2931 // eax: receiver
2913 // edi: receiver map 2932 // edi: receiver map
2914 __ j(above_equal, &not_string, Label::kNear); 2933 __ j(above_equal, &not_string, Label::kNear);
(...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after
5529 Operand(ebp, 7 * kPointerSize), NULL); 5548 Operand(ebp, 7 * kPointerSize), NULL);
5530 } 5549 }
5531 5550
5532 5551
5533 #undef __ 5552 #undef __
5534 5553
5535 } // namespace internal 5554 } // namespace internal
5536 } // namespace v8 5555 } // namespace v8
5537 5556
5538 #endif // V8_TARGET_ARCH_X87 5557 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | src/x87/interface-descriptors-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698