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

Side by Side Diff: src/full-codegen/x64/full-codegen-x64.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/ppc/full-codegen-ppc.cc ('k') | src/full-codegen/x87/full-codegen-x87.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_X64 7 #if V8_TARGET_ARCH_X64
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 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 __ j(equal, &exit); 1032 __ j(equal, &exit);
1033 Register null_value = rdi; 1033 Register null_value = rdi;
1034 __ LoadRoot(null_value, Heap::kNullValueRootIndex); 1034 __ LoadRoot(null_value, Heap::kNullValueRootIndex);
1035 __ cmpp(rax, null_value); 1035 __ cmpp(rax, null_value);
1036 __ j(equal, &exit); 1036 __ j(equal, &exit);
1037 1037
1038 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); 1038 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG);
1039 1039
1040 // Convert the object to a JS object. 1040 // Convert the object to a JS object.
1041 Label convert, done_convert; 1041 Label convert, done_convert;
1042 __ JumpIfSmi(rax, &convert); 1042 __ JumpIfSmi(rax, &convert, Label::kNear);
1043 __ CmpObjectType(rax, FIRST_SPEC_OBJECT_TYPE, rcx); 1043 __ CmpObjectType(rax, FIRST_SPEC_OBJECT_TYPE, rcx);
1044 __ j(above_equal, &done_convert); 1044 __ j(above_equal, &done_convert, Label::kNear);
1045 __ bind(&convert); 1045 __ bind(&convert);
1046 __ Push(rax); 1046 ToObjectStub stub(isolate());
1047 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 1047 __ CallStub(&stub);
1048 __ bind(&done_convert); 1048 __ bind(&done_convert);
1049 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG); 1049 PrepareForBailoutForId(stmt->ToObjectId(), TOS_REG);
1050 __ Push(rax); 1050 __ Push(rax);
1051 1051
1052 // Check for proxies. 1052 // Check for proxies.
1053 Label call_runtime; 1053 Label call_runtime;
1054 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); 1054 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE);
1055 __ CmpObjectType(rax, LAST_JS_PROXY_TYPE, rcx); 1055 __ CmpObjectType(rax, LAST_JS_PROXY_TYPE, rcx);
1056 __ j(below_equal, &call_runtime); 1056 __ j(below_equal, &call_runtime);
1057 1057
(...skipping 2847 matching lines...) Expand 10 before | Expand all | Expand 10 after
3905 3905
3906 // Load the argument into rax and call the stub. 3906 // Load the argument into rax 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(rax); 3911 context()->Plug(rax);
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 rax and convert it.
3920 VisitForAccumulatorValue(args->at(0));
3921
3922 ToObjectStub stub(isolate());
3923 __ CallStub(&stub);
3924 context()->Plug(rax);
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(rax, rbx); 3935 StringCharFromCodeGenerator generator(rax, rbx);
3923 generator.GenerateFast(masm_); 3936 generator.GenerateFast(masm_);
3924 __ jmp(&done); 3937 __ jmp(&done);
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after
5349 Assembler::target_address_at(call_target_address, 5362 Assembler::target_address_at(call_target_address,
5350 unoptimized_code)); 5363 unoptimized_code));
5351 return OSR_AFTER_STACK_CHECK; 5364 return OSR_AFTER_STACK_CHECK;
5352 } 5365 }
5353 5366
5354 5367
5355 } // namespace internal 5368 } // namespace internal
5356 } // namespace v8 5369 } // namespace v8
5357 5370
5358 #endif // V8_TARGET_ARCH_X64 5371 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/full-codegen/ppc/full-codegen-ppc.cc ('k') | src/full-codegen/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698