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

Side by Side Diff: src/builtins/ia32/builtins-ia32.cc

Issue 2235983003: [builtins] Migrate StringToNumber to TurboFan builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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/builtins/builtins-conversion.cc ('k') | src/builtins/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-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 2696 matching lines...) Expand 10 before | Expand all | Expand 10 after
2707 // -- esp[0] : return address 2707 // -- esp[0] : return address
2708 // ----------------------------------- 2708 // -----------------------------------
2709 __ PopReturnAddressTo(ecx); 2709 __ PopReturnAddressTo(ecx);
2710 __ Push(edx); 2710 __ Push(edx);
2711 __ PushReturnAddressFrom(ecx); 2711 __ PushReturnAddressFrom(ecx);
2712 __ Move(esi, Smi::FromInt(0)); 2712 __ Move(esi, Smi::FromInt(0));
2713 __ TailCallRuntime(Runtime::kAbort); 2713 __ TailCallRuntime(Runtime::kAbort);
2714 } 2714 }
2715 2715
2716 // static 2716 // static
2717 void Builtins::Generate_StringToNumber(MacroAssembler* masm) {
2718 // The StringToNumber stub takes one argument in eax.
2719 __ AssertString(eax);
2720
2721 // Check if string has a cached array index.
2722 Label runtime;
2723 __ test(FieldOperand(eax, String::kHashFieldOffset),
2724 Immediate(String::kContainsCachedArrayIndexMask));
2725 __ j(not_zero, &runtime, Label::kNear);
2726 __ mov(eax, FieldOperand(eax, String::kHashFieldOffset));
2727 __ IndexFromHash(eax, eax);
2728 __ Ret();
2729
2730 __ bind(&runtime);
2731 {
2732 FrameScope frame(masm, StackFrame::INTERNAL);
2733 // Push argument.
2734 __ push(eax);
2735 // We cannot use a tail call here because this builtin can also be called
2736 // from wasm.
2737 __ CallRuntime(Runtime::kStringToNumber);
2738 }
2739 __ Ret();
2740 }
2741
2742 // static
2743 void Builtins::Generate_ToNumber(MacroAssembler* masm) { 2717 void Builtins::Generate_ToNumber(MacroAssembler* masm) {
2744 // The ToNumber stub takes one argument in eax. 2718 // The ToNumber stub takes one argument in eax.
2745 Label not_smi; 2719 Label not_smi;
2746 __ JumpIfNotSmi(eax, &not_smi, Label::kNear); 2720 __ JumpIfNotSmi(eax, &not_smi, Label::kNear);
2747 __ Ret(); 2721 __ Ret();
2748 __ bind(&not_smi); 2722 __ bind(&not_smi);
2749 2723
2750 Label not_heap_number; 2724 Label not_heap_number;
2751 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); 2725 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map());
2752 __ j(not_equal, &not_heap_number, Label::kNear); 2726 __ j(not_equal, &not_heap_number, Label::kNear);
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
3026 3000
3027 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { 3001 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
3028 Generate_OnStackReplacementHelper(masm, true); 3002 Generate_OnStackReplacementHelper(masm, true);
3029 } 3003 }
3030 3004
3031 #undef __ 3005 #undef __
3032 } // namespace internal 3006 } // namespace internal
3033 } // namespace v8 3007 } // namespace v8
3034 3008
3035 #endif // V8_TARGET_ARCH_IA32 3009 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/builtins/builtins-conversion.cc ('k') | src/builtins/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698