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

Side by Side Diff: src/full-codegen/x87/full-codegen-x87.cc

Issue 1846683006: [stubs] Introduce ToIntegerStub and unify the handling of %_ToInteger. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/full-codegen/x64/full-codegen-x64.cc ('k') | no next file » | 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/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 2977 matching lines...) Expand 10 before | Expand all | Expand 10 after
2988 } 2988 }
2989 2989
2990 __ SmiUntag(value); 2990 __ SmiUntag(value);
2991 // No need to untag a smi for two-byte addressing. 2991 // No need to untag a smi for two-byte addressing.
2992 __ mov_w(FieldOperand(string, index, times_1, SeqTwoByteString::kHeaderSize), 2992 __ mov_w(FieldOperand(string, index, times_1, SeqTwoByteString::kHeaderSize),
2993 value); 2993 value);
2994 context()->Plug(string); 2994 context()->Plug(string);
2995 } 2995 }
2996 2996
2997 2997
2998 void FullCodeGenerator::EmitToInteger(CallRuntime* expr) {
2999 ZoneList<Expression*>* args = expr->arguments();
3000 DCHECK_EQ(1, args->length());
3001
3002 // Load the argument into eax and convert it.
3003 VisitForAccumulatorValue(args->at(0));
3004
3005 // Convert the object to an integer.
3006 Label done_convert;
3007 __ JumpIfSmi(eax, &done_convert, Label::kNear);
3008 __ Push(eax);
3009 __ CallRuntime(Runtime::kToInteger);
3010 __ bind(&done_convert);
3011 context()->Plug(eax);
3012 }
3013
3014
3015 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { 2998 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) {
3016 ZoneList<Expression*>* args = expr->arguments(); 2999 ZoneList<Expression*>* args = expr->arguments();
3017 DCHECK(args->length() == 1); 3000 DCHECK(args->length() == 1);
3018 3001
3019 VisitForAccumulatorValue(args->at(0)); 3002 VisitForAccumulatorValue(args->at(0));
3020 3003
3021 Label done; 3004 Label done;
3022 StringCharFromCodeGenerator generator(eax, ebx); 3005 StringCharFromCodeGenerator generator(eax, ebx);
3023 generator.GenerateFast(masm_); 3006 generator.GenerateFast(masm_);
3024 __ jmp(&done); 3007 __ jmp(&done);
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
3994 isolate->builtins()->OnStackReplacement()->entry(), 3977 isolate->builtins()->OnStackReplacement()->entry(),
3995 Assembler::target_address_at(call_target_address, unoptimized_code)); 3978 Assembler::target_address_at(call_target_address, unoptimized_code));
3996 return ON_STACK_REPLACEMENT; 3979 return ON_STACK_REPLACEMENT;
3997 } 3980 }
3998 3981
3999 3982
4000 } // namespace internal 3983 } // namespace internal
4001 } // namespace v8 3984 } // namespace v8
4002 3985
4003 #endif // V8_TARGET_ARCH_X87 3986 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698