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 2967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2978 __ Ret(); | 2978 __ Ret(); |
2979 __ bind(¬_oddball); | 2979 __ bind(¬_oddball); |
2980 | 2980 |
2981 __ pop(ecx); // Pop return address. | 2981 __ pop(ecx); // Pop return address. |
2982 __ push(eax); // Push argument. | 2982 __ push(eax); // Push argument. |
2983 __ push(ecx); // Push return address. | 2983 __ push(ecx); // Push return address. |
2984 __ TailCallRuntime(Runtime::kToNumber, 1, 1); | 2984 __ TailCallRuntime(Runtime::kToNumber, 1, 1); |
2985 } | 2985 } |
2986 | 2986 |
2987 | 2987 |
| 2988 void ToStringStub::Generate(MacroAssembler* masm) { |
| 2989 // The ToString stub takes one argument in eax. |
| 2990 Label is_number; |
| 2991 __ JumpIfSmi(eax, &is_number, Label::kNear); |
| 2992 |
| 2993 Label not_string; |
| 2994 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); |
| 2995 // eax: receiver |
| 2996 // edi: receiver map |
| 2997 __ j(above_equal, ¬_string, Label::kNear); |
| 2998 __ Ret(); |
| 2999 __ bind(¬_string); |
| 3000 |
| 3001 Label not_heap_number; |
| 3002 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); |
| 3003 __ j(not_equal, ¬_heap_number, Label::kNear); |
| 3004 __ bind(&is_number); |
| 3005 NumberToStringStub stub(isolate()); |
| 3006 __ TailCallStub(&stub); |
| 3007 __ bind(¬_heap_number); |
| 3008 |
| 3009 Label not_oddball; |
| 3010 __ CmpInstanceType(edi, ODDBALL_TYPE); |
| 3011 __ j(not_equal, ¬_oddball, Label::kNear); |
| 3012 __ mov(eax, FieldOperand(eax, Oddball::kToStringOffset)); |
| 3013 __ Ret(); |
| 3014 __ bind(¬_oddball); |
| 3015 |
| 3016 __ pop(ecx); // Pop return address. |
| 3017 __ push(eax); // Push argument. |
| 3018 __ push(ecx); // Push return address. |
| 3019 __ TailCallRuntime(Runtime::kToString, 1, 1); |
| 3020 } |
| 3021 |
| 3022 |
2988 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 3023 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
2989 Register left, | 3024 Register left, |
2990 Register right, | 3025 Register right, |
2991 Register scratch1, | 3026 Register scratch1, |
2992 Register scratch2) { | 3027 Register scratch2) { |
2993 Register length = scratch1; | 3028 Register length = scratch1; |
2994 | 3029 |
2995 // Compare lengths. | 3030 // Compare lengths. |
2996 Label strings_not_equal, check_zero_length; | 3031 Label strings_not_equal, check_zero_length; |
2997 __ mov(length, FieldOperand(left, String::kLengthOffset)); | 3032 __ mov(length, FieldOperand(left, String::kLengthOffset)); |
(...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5216 Operand(ebp, 7 * kPointerSize), NULL); | 5251 Operand(ebp, 7 * kPointerSize), NULL); |
5217 } | 5252 } |
5218 | 5253 |
5219 | 5254 |
5220 #undef __ | 5255 #undef __ |
5221 | 5256 |
5222 } // namespace internal | 5257 } // namespace internal |
5223 } // namespace v8 | 5258 } // namespace v8 |
5224 | 5259 |
5225 #endif // V8_TARGET_ARCH_X87 | 5260 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |