OLD | NEW |
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 Loading... |
2895 __ Ret(); | 2895 __ Ret(); |
2896 __ bind(¬_oddball); | 2896 __ bind(¬_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, ¬_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(¬_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, ¬_string, Label::kNear); | 2933 __ j(above_equal, ¬_string, Label::kNear); |
(...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |