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

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

Issue 801333002: [turbofan] Remove the no-context hack for JSToNumber. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Improve ARM Created 6 years 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/compiler/js-generic-lowering.cc ('k') | src/x64/code-stubs-x64.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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 3209 matching lines...) Expand 10 before | Expand all | Expand 10 after
3220 &runtime, STRING_INDEX_IS_NUMBER, 3220 &runtime, STRING_INDEX_IS_NUMBER,
3221 RECEIVER_IS_STRING); 3221 RECEIVER_IS_STRING);
3222 generator.GenerateFast(masm); 3222 generator.GenerateFast(masm);
3223 __ ret(3 * kPointerSize); 3223 __ ret(3 * kPointerSize);
3224 generator.SkipSlow(masm, &runtime); 3224 generator.SkipSlow(masm, &runtime);
3225 } 3225 }
3226 3226
3227 3227
3228 void ToNumberStub::Generate(MacroAssembler* masm) { 3228 void ToNumberStub::Generate(MacroAssembler* masm) {
3229 // The ToNumber stub takes one argument in eax. 3229 // The ToNumber stub takes one argument in eax.
3230 Label check_heap_number, call_builtin; 3230 Label not_smi;
3231 __ JumpIfNotSmi(eax, &check_heap_number, Label::kNear); 3231 __ JumpIfNotSmi(eax, &not_smi, Label::kNear);
3232 __ Ret(); 3232 __ Ret();
3233 __ bind(&not_smi);
3233 3234
3234 __ bind(&check_heap_number); 3235 Label not_heap_number;
3235 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); 3236 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map());
3236 __ j(not_equal, &call_builtin, Label::kNear); 3237 __ j(not_equal, &not_heap_number, Label::kNear);
3237 __ Ret(); 3238 __ Ret();
3239 __ bind(&not_heap_number);
3238 3240
3239 __ bind(&call_builtin); 3241 Label not_string, slow_string;
3240 __ pop(ecx); // Pop return address. 3242 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi);
3241 __ push(eax); 3243 // eax: object
3244 // edi: object map
3245 __ j(above_equal, &not_string, Label::kNear);
3246 // Check if string has a cached array index.
3247 __ test(FieldOperand(eax, String::kHashFieldOffset),
3248 Immediate(String::kContainsCachedArrayIndexMask));
3249 __ j(not_zero, &slow_string, Label::kNear);
3250 __ mov(eax, FieldOperand(eax, String::kHashFieldOffset));
3251 __ IndexFromHash(eax, eax);
3252 __ Ret();
3253 __ bind(&slow_string);
3254 __ pop(ecx); // Pop return address.
3255 __ push(eax); // Push argument.
3256 __ push(ecx); // Push return address.
3257 __ TailCallRuntime(Runtime::kStringToNumber, 1, 1);
3258 __ bind(&not_string);
3259
3260 Label not_oddball;
3261 __ CmpInstanceType(edi, ODDBALL_TYPE);
3262 __ j(not_equal, &not_oddball, Label::kNear);
3263 __ mov(eax, FieldOperand(eax, Oddball::kToNumberOffset));
3264 __ Ret();
3265 __ bind(&not_oddball);
3266
3267 __ pop(ecx); // Pop return address.
3268 __ push(eax); // Push argument.
3242 __ push(ecx); // Push return address. 3269 __ push(ecx); // Push return address.
3243 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); 3270 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION);
3244 } 3271 }
3245 3272
3246 3273
3247 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, 3274 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm,
3248 Register left, 3275 Register left,
3249 Register right, 3276 Register right,
3250 Register scratch1, 3277 Register scratch1,
3251 Register scratch2) { 3278 Register scratch2) {
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after
4812 Operand(ebp, 7 * kPointerSize), 4839 Operand(ebp, 7 * kPointerSize),
4813 NULL); 4840 NULL);
4814 } 4841 }
4815 4842
4816 4843
4817 #undef __ 4844 #undef __
4818 4845
4819 } } // namespace v8::internal 4846 } } // namespace v8::internal
4820 4847
4821 #endif // V8_TARGET_ARCH_IA32 4848 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/compiler/js-generic-lowering.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698