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

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

Issue 1266013006: [stubs] Unify (and optimize) implementation of ToObject. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add missing support for %_ToObject in TurboFan and Crankshaft. Created 5 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/full-codegen/full-codegen.h ('k') | src/full-codegen/mips/full-codegen-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 #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/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 __ j(equal, &exit); 1018 __ j(equal, &exit);
1019 1019
1020 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); 1020 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG);
1021 1021
1022 // Convert the object to a JS object. 1022 // Convert the object to a JS object.
1023 Label convert, done_convert; 1023 Label convert, done_convert;
1024 __ JumpIfSmi(eax, &convert, Label::kNear); 1024 __ JumpIfSmi(eax, &convert, Label::kNear);
1025 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); 1025 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx);
1026 __ j(above_equal, &done_convert, Label::kNear); 1026 __ j(above_equal, &done_convert, Label::kNear);
1027 __ bind(&convert); 1027 __ bind(&convert);
1028 __ push(eax); 1028 ToObjectStub stub(isolate());
1029 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 1029 __ CallStub(&stub);
1030 __ bind(&done_convert); 1030 __ bind(&done_convert);
1031 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); 1031 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG);
1032 __ push(eax); 1032 __ push(eax);
1033 1033
1034 // Check for proxies. 1034 // Check for proxies.
1035 Label call_runtime, use_cache, fixed_array; 1035 Label call_runtime, use_cache, fixed_array;
1036 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); 1036 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE);
1037 __ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx); 1037 __ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx);
1038 __ j(below_equal, &call_runtime); 1038 __ j(below_equal, &call_runtime);
1039 1039
(...skipping 2874 matching lines...) Expand 10 before | Expand all | Expand 10 after
3914 3914
3915 // Load the argument into eax and call the stub. 3915 // Load the argument into eax and call the stub.
3916 VisitForAccumulatorValue(args->at(0)); 3916 VisitForAccumulatorValue(args->at(0));
3917 3917
3918 NumberToStringStub stub(isolate()); 3918 NumberToStringStub stub(isolate());
3919 __ CallStub(&stub); 3919 __ CallStub(&stub);
3920 context()->Plug(eax); 3920 context()->Plug(eax);
3921 } 3921 }
3922 3922
3923 3923
3924 void FullCodeGenerator::EmitToObject(CallRuntime* expr) {
3925 ZoneList<Expression*>* args = expr->arguments();
3926 DCHECK_EQ(1, args->length());
3927
3928 // Load the argument into eax and convert it.
3929 VisitForAccumulatorValue(args->at(0));
3930
3931 ToObjectStub stub(isolate());
3932 __ CallStub(&stub);
3933 context()->Plug(eax);
3934 }
3935
3936
3924 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { 3937 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) {
3925 ZoneList<Expression*>* args = expr->arguments(); 3938 ZoneList<Expression*>* args = expr->arguments();
3926 DCHECK(args->length() == 1); 3939 DCHECK(args->length() == 1);
3927 3940
3928 VisitForAccumulatorValue(args->at(0)); 3941 VisitForAccumulatorValue(args->at(0));
3929 3942
3930 Label done; 3943 Label done;
3931 StringCharFromCodeGenerator generator(eax, ebx); 3944 StringCharFromCodeGenerator generator(eax, ebx);
3932 generator.GenerateFast(masm_); 3945 generator.GenerateFast(masm_);
3933 __ jmp(&done); 3946 __ jmp(&done);
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
5330 Assembler::target_address_at(call_target_address, 5343 Assembler::target_address_at(call_target_address,
5331 unoptimized_code)); 5344 unoptimized_code));
5332 return OSR_AFTER_STACK_CHECK; 5345 return OSR_AFTER_STACK_CHECK;
5333 } 5346 }
5334 5347
5335 5348
5336 } // namespace internal 5349 } // namespace internal
5337 } // namespace v8 5350 } // namespace v8
5338 5351
5339 #endif // V8_TARGET_ARCH_IA32 5352 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698