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

Side by Side Diff: src/full-codegen/x87/full-codegen-x87.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/x64/full-codegen-x64.cc ('k') | src/harmony-array.js » ('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_X87 7 #if V8_TARGET_ARCH_X87
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 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 __ j(equal, &exit); 1011 __ j(equal, &exit);
1012 1012
1013 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); 1013 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG);
1014 1014
1015 // Convert the object to a JS object. 1015 // Convert the object to a JS object.
1016 Label convert, done_convert; 1016 Label convert, done_convert;
1017 __ JumpIfSmi(eax, &convert, Label::kNear); 1017 __ JumpIfSmi(eax, &convert, Label::kNear);
1018 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); 1018 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx);
1019 __ j(above_equal, &done_convert, Label::kNear); 1019 __ j(above_equal, &done_convert, Label::kNear);
1020 __ bind(&convert); 1020 __ bind(&convert);
1021 __ push(eax); 1021 ToObjectStub stub(isolate());
1022 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 1022 __ CallStub(&stub);
1023 __ bind(&done_convert); 1023 __ bind(&done_convert);
1024 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); 1024 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG);
1025 __ push(eax); 1025 __ push(eax);
1026 1026
1027 // Check for proxies. 1027 // Check for proxies.
1028 Label call_runtime, use_cache, fixed_array; 1028 Label call_runtime, use_cache, fixed_array;
1029 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); 1029 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE);
1030 __ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx); 1030 __ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx);
1031 __ j(below_equal, &call_runtime); 1031 __ j(below_equal, &call_runtime);
1032 1032
(...skipping 2872 matching lines...) Expand 10 before | Expand all | Expand 10 after
3905 3905
3906 // Load the argument into eax and call the stub. 3906 // Load the argument into eax and call the stub.
3907 VisitForAccumulatorValue(args->at(0)); 3907 VisitForAccumulatorValue(args->at(0));
3908 3908
3909 NumberToStringStub stub(isolate()); 3909 NumberToStringStub stub(isolate());
3910 __ CallStub(&stub); 3910 __ CallStub(&stub);
3911 context()->Plug(eax); 3911 context()->Plug(eax);
3912 } 3912 }
3913 3913
3914 3914
3915 void FullCodeGenerator::EmitToObject(CallRuntime* expr) {
3916 ZoneList<Expression*>* args = expr->arguments();
3917 DCHECK_EQ(1, args->length());
3918
3919 // Load the argument into eax and convert it.
3920 VisitForAccumulatorValue(args->at(0));
3921
3922 ToObjectStub stub(isolate());
3923 __ CallStub(&stub);
3924 context()->Plug(eax);
3925 }
3926
3927
3915 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { 3928 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) {
3916 ZoneList<Expression*>* args = expr->arguments(); 3929 ZoneList<Expression*>* args = expr->arguments();
3917 DCHECK(args->length() == 1); 3930 DCHECK(args->length() == 1);
3918 3931
3919 VisitForAccumulatorValue(args->at(0)); 3932 VisitForAccumulatorValue(args->at(0));
3920 3933
3921 Label done; 3934 Label done;
3922 StringCharFromCodeGenerator generator(eax, ebx); 3935 StringCharFromCodeGenerator generator(eax, ebx);
3923 generator.GenerateFast(masm_); 3936 generator.GenerateFast(masm_);
3924 __ jmp(&done); 3937 __ jmp(&done);
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
5321 Assembler::target_address_at(call_target_address, 5334 Assembler::target_address_at(call_target_address,
5322 unoptimized_code)); 5335 unoptimized_code));
5323 return OSR_AFTER_STACK_CHECK; 5336 return OSR_AFTER_STACK_CHECK;
5324 } 5337 }
5325 5338
5326 5339
5327 } // namespace internal 5340 } // namespace internal
5328 } // namespace v8 5341 } // namespace v8
5329 5342
5330 #endif // V8_TARGET_ARCH_X87 5343 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/harmony-array.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698