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_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 3257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3268 __ Ret(); | 3268 __ Ret(); |
3269 __ bind(¬_oddball); | 3269 __ bind(¬_oddball); |
3270 | 3270 |
3271 __ pop(ecx); // Pop return address. | 3271 __ pop(ecx); // Pop return address. |
3272 __ push(eax); // Push argument. | 3272 __ push(eax); // Push argument. |
3273 __ push(ecx); // Push return address. | 3273 __ push(ecx); // Push return address. |
3274 __ TailCallRuntime(Runtime::kToNumber, 1, 1); | 3274 __ TailCallRuntime(Runtime::kToNumber, 1, 1); |
3275 } | 3275 } |
3276 | 3276 |
3277 | 3277 |
| 3278 void ToStringStub::Generate(MacroAssembler* masm) { |
| 3279 // The ToString stub takes one argument in eax. |
| 3280 Label is_number; |
| 3281 __ JumpIfSmi(eax, &is_number, Label::kNear); |
| 3282 |
| 3283 Label not_string; |
| 3284 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); |
| 3285 // eax: receiver |
| 3286 // edi: receiver map |
| 3287 __ j(above_equal, ¬_string, Label::kNear); |
| 3288 __ Ret(); |
| 3289 __ bind(¬_string); |
| 3290 |
| 3291 Label not_heap_number; |
| 3292 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); |
| 3293 __ j(not_equal, ¬_heap_number, Label::kNear); |
| 3294 __ bind(&is_number); |
| 3295 NumberToStringStub stub(isolate()); |
| 3296 __ TailCallStub(&stub); |
| 3297 __ bind(¬_heap_number); |
| 3298 |
| 3299 Label not_oddball; |
| 3300 __ CmpInstanceType(edi, ODDBALL_TYPE); |
| 3301 __ j(not_equal, ¬_oddball, Label::kNear); |
| 3302 __ mov(eax, FieldOperand(eax, Oddball::kToStringOffset)); |
| 3303 __ Ret(); |
| 3304 __ bind(¬_oddball); |
| 3305 |
| 3306 __ pop(ecx); // Pop return address. |
| 3307 __ push(eax); // Push argument. |
| 3308 __ push(ecx); // Push return address. |
| 3309 __ TailCallRuntime(Runtime::kToString, 1, 1); |
| 3310 } |
| 3311 |
| 3312 |
3278 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 3313 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
3279 Register left, | 3314 Register left, |
3280 Register right, | 3315 Register right, |
3281 Register scratch1, | 3316 Register scratch1, |
3282 Register scratch2) { | 3317 Register scratch2) { |
3283 Register length = scratch1; | 3318 Register length = scratch1; |
3284 | 3319 |
3285 // Compare lengths. | 3320 // Compare lengths. |
3286 Label strings_not_equal, check_zero_length; | 3321 Label strings_not_equal, check_zero_length; |
3287 __ mov(length, FieldOperand(left, String::kLengthOffset)); | 3322 __ mov(length, FieldOperand(left, String::kLengthOffset)); |
(...skipping 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5536 Operand(ebp, 7 * kPointerSize), NULL); | 5571 Operand(ebp, 7 * kPointerSize), NULL); |
5537 } | 5572 } |
5538 | 5573 |
5539 | 5574 |
5540 #undef __ | 5575 #undef __ |
5541 | 5576 |
5542 } // namespace internal | 5577 } // namespace internal |
5543 } // namespace v8 | 5578 } // namespace v8 |
5544 | 5579 |
5545 #endif // V8_TARGET_ARCH_IA32 | 5580 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |