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/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 2431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2442 // ebx: instance type | 2442 // ebx: instance type |
2443 // ecx: sub string length (smi) | 2443 // ecx: sub string length (smi) |
2444 // edx: from index (smi) | 2444 // edx: from index (smi) |
2445 StringCharAtGenerator generator(eax, edx, ecx, eax, &runtime, &runtime, | 2445 StringCharAtGenerator generator(eax, edx, ecx, eax, &runtime, &runtime, |
2446 &runtime, RECEIVER_IS_STRING); | 2446 &runtime, RECEIVER_IS_STRING); |
2447 generator.GenerateFast(masm); | 2447 generator.GenerateFast(masm); |
2448 __ ret(3 * kPointerSize); | 2448 __ ret(3 * kPointerSize); |
2449 generator.SkipSlow(masm, &runtime); | 2449 generator.SkipSlow(masm, &runtime); |
2450 } | 2450 } |
2451 | 2451 |
2452 | |
2453 void ToNumberStub::Generate(MacroAssembler* masm) { | |
2454 // The ToNumber stub takes one argument in eax. | |
2455 Label not_smi; | |
2456 __ JumpIfNotSmi(eax, ¬_smi, Label::kNear); | |
2457 __ Ret(); | |
2458 __ bind(¬_smi); | |
2459 | |
2460 Label not_heap_number; | |
2461 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); | |
2462 __ j(not_equal, ¬_heap_number, Label::kNear); | |
2463 __ Ret(); | |
2464 __ bind(¬_heap_number); | |
2465 | |
2466 NonNumberToNumberStub stub(masm->isolate()); | |
2467 __ TailCallStub(&stub); | |
2468 } | |
2469 | |
2470 void NonNumberToNumberStub::Generate(MacroAssembler* masm) { | |
2471 // The NonNumberToNumber stub takes one argument in eax. | |
2472 __ AssertNotNumber(eax); | |
2473 | |
2474 Label not_string; | |
2475 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); | |
2476 // eax: object | |
2477 // edi: object map | |
2478 __ j(above_equal, ¬_string, Label::kNear); | |
2479 __ Jump(isolate()->builtins()->StringToNumber(), RelocInfo::CODE_TARGET); | |
2480 __ bind(¬_string); | |
2481 | |
2482 Label not_oddball; | |
2483 __ CmpInstanceType(edi, ODDBALL_TYPE); | |
2484 __ j(not_equal, ¬_oddball, Label::kNear); | |
2485 __ mov(eax, FieldOperand(eax, Oddball::kToNumberOffset)); | |
2486 __ Ret(); | |
2487 __ bind(¬_oddball); | |
2488 | |
2489 __ pop(ecx); // Pop return address. | |
2490 __ push(eax); // Push argument. | |
2491 __ push(ecx); // Push return address. | |
2492 __ TailCallRuntime(Runtime::kToNumber); | |
2493 } | |
2494 | |
2495 void ToStringStub::Generate(MacroAssembler* masm) { | 2452 void ToStringStub::Generate(MacroAssembler* masm) { |
2496 // The ToString stub takes one argument in eax. | 2453 // The ToString stub takes one argument in eax. |
2497 Label is_number; | 2454 Label is_number; |
2498 __ JumpIfSmi(eax, &is_number, Label::kNear); | 2455 __ JumpIfSmi(eax, &is_number, Label::kNear); |
2499 | 2456 |
2500 Label not_string; | 2457 Label not_string; |
2501 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); | 2458 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); |
2502 // eax: receiver | 2459 // eax: receiver |
2503 // edi: receiver map | 2460 // edi: receiver map |
2504 __ j(above_equal, ¬_string, Label::kNear); | 2461 __ j(above_equal, ¬_string, Label::kNear); |
(...skipping 3197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5702 kStackUnwindSpace, nullptr, return_value_operand, | 5659 kStackUnwindSpace, nullptr, return_value_operand, |
5703 NULL); | 5660 NULL); |
5704 } | 5661 } |
5705 | 5662 |
5706 #undef __ | 5663 #undef __ |
5707 | 5664 |
5708 } // namespace internal | 5665 } // namespace internal |
5709 } // namespace v8 | 5666 } // namespace v8 |
5710 | 5667 |
5711 #endif // V8_TARGET_ARCH_IA32 | 5668 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |