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

Side by Side Diff: src/x87/code-stubs-x87.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/x87/builtins-x87.cc ('k') | test/cctest/compiler/test-linkage.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_X87 5 #if V8_TARGET_ARCH_X87
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 2153 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 // ebx: instance type 2164 // ebx: instance type
2165 // ecx: sub string length (smi) 2165 // ecx: sub string length (smi)
2166 // edx: from index (smi) 2166 // edx: from index (smi)
2167 StringCharAtGenerator generator(eax, edx, ecx, eax, &runtime, &runtime, 2167 StringCharAtGenerator generator(eax, edx, ecx, eax, &runtime, &runtime,
2168 &runtime, RECEIVER_IS_STRING); 2168 &runtime, RECEIVER_IS_STRING);
2169 generator.GenerateFast(masm); 2169 generator.GenerateFast(masm);
2170 __ ret(3 * kPointerSize); 2170 __ ret(3 * kPointerSize);
2171 generator.SkipSlow(masm, &runtime); 2171 generator.SkipSlow(masm, &runtime);
2172 } 2172 }
2173 2173
2174
2175 void ToNumberStub::Generate(MacroAssembler* masm) {
2176 // The ToNumber stub takes one argument in eax.
2177 Label not_smi;
2178 __ JumpIfNotSmi(eax, &not_smi, Label::kNear);
2179 __ Ret();
2180 __ bind(&not_smi);
2181
2182 Label not_heap_number;
2183 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map());
2184 __ j(not_equal, &not_heap_number, Label::kNear);
2185 __ Ret();
2186 __ bind(&not_heap_number);
2187
2188 NonNumberToNumberStub stub(masm->isolate());
2189 __ TailCallStub(&stub);
2190 }
2191
2192 void NonNumberToNumberStub::Generate(MacroAssembler* masm) {
2193 // The NonNumberToNumber stub takes one argument in eax.
2194 __ AssertNotNumber(eax);
2195
2196 Label not_string;
2197 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi);
2198 // eax: object
2199 // edi: object map
2200 __ j(above_equal, &not_string, Label::kNear);
2201 __ Jump(isolate()->builtins()->StringToNumber(), RelocInfo::CODE_TARGET);
2202 __ bind(&not_string);
2203
2204 Label not_oddball;
2205 __ CmpInstanceType(edi, ODDBALL_TYPE);
2206 __ j(not_equal, &not_oddball, Label::kNear);
2207 __ mov(eax, FieldOperand(eax, Oddball::kToNumberOffset));
2208 __ Ret();
2209 __ bind(&not_oddball);
2210
2211 __ pop(ecx); // Pop return address.
2212 __ push(eax); // Push argument.
2213 __ push(ecx); // Push return address.
2214 __ TailCallRuntime(Runtime::kToNumber);
2215 }
2216
2217 void ToStringStub::Generate(MacroAssembler* masm) { 2174 void ToStringStub::Generate(MacroAssembler* masm) {
2218 // The ToString stub takes one argument in eax. 2175 // The ToString stub takes one argument in eax.
2219 Label is_number; 2176 Label is_number;
2220 __ JumpIfSmi(eax, &is_number, Label::kNear); 2177 __ JumpIfSmi(eax, &is_number, Label::kNear);
2221 2178
2222 Label not_string; 2179 Label not_string;
2223 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); 2180 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi);
2224 // eax: receiver 2181 // eax: receiver
2225 // edi: receiver map 2182 // edi: receiver map
2226 __ j(above_equal, &not_string, Label::kNear); 2183 __ j(above_equal, &not_string, Label::kNear);
(...skipping 3143 matching lines...) Expand 10 before | Expand all | Expand 10 after
5370 kStackUnwindSpace, nullptr, return_value_operand, 5327 kStackUnwindSpace, nullptr, return_value_operand,
5371 NULL); 5328 NULL);
5372 } 5329 }
5373 5330
5374 #undef __ 5331 #undef __
5375 5332
5376 } // namespace internal 5333 } // namespace internal
5377 } // namespace v8 5334 } // namespace v8
5378 5335
5379 #endif // V8_TARGET_ARCH_X87 5336 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/builtins-x87.cc ('k') | test/cctest/compiler/test-linkage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698