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

Side by Side Diff: src/ia32/builtins-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/i18n.js ('k') | src/ia32/code-stubs-ia32.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/codegen.h" 10 #include "src/codegen.h"
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 __ CmpObjectType(ebx, FIRST_SPEC_OBJECT_TYPE, ecx); 987 __ CmpObjectType(ebx, FIRST_SPEC_OBJECT_TYPE, ecx);
988 __ j(above_equal, &shift_arguments); 988 __ j(above_equal, &shift_arguments);
989 989
990 __ bind(&convert_to_object); 990 __ bind(&convert_to_object);
991 991
992 { // In order to preserve argument count. 992 { // In order to preserve argument count.
993 FrameScope scope(masm, StackFrame::INTERNAL); 993 FrameScope scope(masm, StackFrame::INTERNAL);
994 __ SmiTag(eax); 994 __ SmiTag(eax);
995 __ push(eax); 995 __ push(eax);
996 996
997 __ push(ebx); 997 __ mov(eax, ebx);
998 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 998 ToObjectStub stub(masm->isolate());
999 __ CallStub(&stub);
999 __ mov(ebx, eax); 1000 __ mov(ebx, eax);
1000 __ Move(edx, Immediate(0)); // restore 1001 __ Move(edx, Immediate(0)); // restore
1001 1002
1002 __ pop(eax); 1003 __ pop(eax);
1003 __ SmiUntag(eax); 1004 __ SmiUntag(eax);
1004 } 1005 }
1005 1006
1006 // Restore the function to edi. 1007 // Restore the function to edi.
1007 __ mov(edi, Operand(esp, eax, times_4, 1 * kPointerSize)); 1008 __ mov(edi, Operand(esp, eax, times_4, 1 * kPointerSize));
1008 __ jmp(&patch_receiver); 1009 __ jmp(&patch_receiver);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 __ JumpIfSmi(ebx, &call_to_object); 1209 __ JumpIfSmi(ebx, &call_to_object);
1209 __ cmp(ebx, factory->null_value()); 1210 __ cmp(ebx, factory->null_value());
1210 __ j(equal, &use_global_proxy); 1211 __ j(equal, &use_global_proxy);
1211 __ cmp(ebx, factory->undefined_value()); 1212 __ cmp(ebx, factory->undefined_value());
1212 __ j(equal, &use_global_proxy); 1213 __ j(equal, &use_global_proxy);
1213 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); 1214 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE);
1214 __ CmpObjectType(ebx, FIRST_SPEC_OBJECT_TYPE, ecx); 1215 __ CmpObjectType(ebx, FIRST_SPEC_OBJECT_TYPE, ecx);
1215 __ j(above_equal, &push_receiver); 1216 __ j(above_equal, &push_receiver);
1216 1217
1217 __ bind(&call_to_object); 1218 __ bind(&call_to_object);
1218 __ push(ebx); 1219 __ mov(eax, ebx);
1219 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 1220 ToObjectStub stub(masm->isolate());
1221 __ CallStub(&stub);
1220 __ mov(ebx, eax); 1222 __ mov(ebx, eax);
1221 __ jmp(&push_receiver); 1223 __ jmp(&push_receiver);
1222 1224
1223 __ bind(&use_global_proxy); 1225 __ bind(&use_global_proxy);
1224 __ mov(ebx, 1226 __ mov(ebx,
1225 Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 1227 Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
1226 __ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalProxyOffset)); 1228 __ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalProxyOffset));
1227 1229
1228 // Push the receiver. 1230 // Push the receiver.
1229 __ bind(&push_receiver); 1231 __ bind(&push_receiver);
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 1761
1760 __ bind(&ok); 1762 __ bind(&ok);
1761 __ ret(0); 1763 __ ret(0);
1762 } 1764 }
1763 1765
1764 #undef __ 1766 #undef __
1765 } // namespace internal 1767 } // namespace internal
1766 } // namespace v8 1768 } // namespace v8
1767 1769
1768 #endif // V8_TARGET_ARCH_IA32 1770 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/i18n.js ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698