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

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

Issue 2051113002: [stubs] ToNumberStub --> ToNumber builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix full-code on non-x64 platforms Created 4 years, 6 months 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 | « src/ia32/builtins-ia32.cc ('k') | src/mips/builtins-mips.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_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
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, &not_smi, Label::kNear);
2457 __ Ret();
2458 __ bind(&not_smi);
2459
2460 Label not_heap_number;
2461 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map());
2462 __ j(not_equal, &not_heap_number, Label::kNear);
2463 __ Ret();
2464 __ bind(&not_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, &not_string, Label::kNear);
2479 __ Jump(isolate()->builtins()->StringToNumber(), RelocInfo::CODE_TARGET);
2480 __ bind(&not_string);
2481
2482 Label not_oddball;
2483 __ CmpInstanceType(edi, ODDBALL_TYPE);
2484 __ j(not_equal, &not_oddball, Label::kNear);
2485 __ mov(eax, FieldOperand(eax, Oddball::kToNumberOffset));
2486 __ Ret();
2487 __ bind(&not_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, &not_string, Label::kNear); 2461 __ j(above_equal, &not_string, Label::kNear);
(...skipping 3197 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698