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

Side by Side Diff: src/ia32/builtins-ia32.cc

Issue 338963003: KeyedLoadIC should have same register spec as LoadIC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: A bit more refactoring. Created 6 years, 6 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 | Annotate | Revision Log
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/codegen.h" 9 #include "src/codegen.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 __ mov(ebx, 988 __ mov(ebx,
989 Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 989 Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
990 __ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset)); 990 __ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset));
991 991
992 // Push the receiver. 992 // Push the receiver.
993 __ bind(&push_receiver); 993 __ bind(&push_receiver);
994 __ push(ebx); 994 __ push(ebx);
995 995
996 // Copy all arguments from the array to the stack. 996 // Copy all arguments from the array to the stack.
997 Label entry, loop; 997 Label entry, loop;
998 __ mov(ecx, Operand(ebp, kIndexOffset)); 998 Register receiver = LoadIC::ReceiverRegister();
999 Register key = LoadIC::NameRegister();
1000 __ mov(key, Operand(ebp, kIndexOffset));
999 __ jmp(&entry); 1001 __ jmp(&entry);
1000 __ bind(&loop); 1002 __ bind(&loop);
1001 __ mov(edx, Operand(ebp, kArgumentsOffset)); // load arguments 1003 __ mov(receiver, Operand(ebp, kArgumentsOffset)); // load arguments
1002 1004
1003 // Use inline caching to speed up access to arguments. 1005 // Use inline caching to speed up access to arguments.
1004 Handle<Code> ic = masm->isolate()->builtins()->KeyedLoadIC_Initialize(); 1006 Handle<Code> ic = masm->isolate()->builtins()->KeyedLoadIC_Initialize();
1005 __ call(ic, RelocInfo::CODE_TARGET); 1007 __ call(ic, RelocInfo::CODE_TARGET);
1006 // It is important that we do not have a test instruction after the 1008 // It is important that we do not have a test instruction after the
1007 // call. A test instruction after the call is used to indicate that 1009 // call. A test instruction after the call is used to indicate that
1008 // we have generated an inline version of the keyed load. In this 1010 // we have generated an inline version of the keyed load. In this
1009 // case, we know that we are not generating a test instruction next. 1011 // case, we know that we are not generating a test instruction next.
1010 1012
1011 // Push the nth argument. 1013 // Push the nth argument.
1012 __ push(eax); 1014 __ push(eax);
1013 1015
1014 // Update the index on the stack and in register eax. 1016 // Update the index on the stack and in register eax.
Jakob Kummerow 2014/06/26 16:17:10 nit: s/eax/|key|/
mvstanton 2014/06/30 13:19:09 Done.
1015 __ mov(ecx, Operand(ebp, kIndexOffset)); 1017 __ mov(key, Operand(ebp, kIndexOffset));
1016 __ add(ecx, Immediate(1 << kSmiTagSize)); 1018 __ add(key, Immediate(1 << kSmiTagSize));
1017 __ mov(Operand(ebp, kIndexOffset), ecx); 1019 __ mov(Operand(ebp, kIndexOffset), key);
1018 1020
1019 __ bind(&entry); 1021 __ bind(&entry);
1020 __ cmp(ecx, Operand(ebp, kLimitOffset)); 1022 __ cmp(key, Operand(ebp, kLimitOffset));
1021 __ j(not_equal, &loop); 1023 __ j(not_equal, &loop);
1022 1024
1023 // Call the function. 1025 // Call the function.
1024 Label call_proxy; 1026 Label call_proxy;
1025 __ mov(eax, ecx);
1026 ParameterCount actual(eax); 1027 ParameterCount actual(eax);
1028 ASSERT(!key.is(eax));
Jakob Kummerow 2014/06/26 16:17:10 Here, too, consider using Move() instead.
mvstanton 2014/06/30 13:19:09 Done.
1029 __ mov(eax, key);
1027 __ SmiUntag(eax); 1030 __ SmiUntag(eax);
1028 __ mov(edi, Operand(ebp, kFunctionOffset)); 1031 __ mov(edi, Operand(ebp, kFunctionOffset));
1029 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); 1032 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
1030 __ j(not_equal, &call_proxy); 1033 __ j(not_equal, &call_proxy);
1031 __ InvokeFunction(edi, actual, CALL_FUNCTION, NullCallWrapper()); 1034 __ InvokeFunction(edi, actual, CALL_FUNCTION, NullCallWrapper());
1032 1035
1033 frame_scope.GenerateLeaveFrame(); 1036 frame_scope.GenerateLeaveFrame();
1034 __ ret(3 * kPointerSize); // remove this, receiver, and arguments 1037 __ ret(3 * kPointerSize); // remove this, receiver, and arguments
1035 1038
1036 // Call the function proxy. 1039 // Call the function proxy.
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 1446
1444 __ bind(&ok); 1447 __ bind(&ok);
1445 __ ret(0); 1448 __ ret(0);
1446 } 1449 }
1447 1450
1448 #undef __ 1451 #undef __
1449 } 1452 }
1450 } // namespace v8::internal 1453 } // namespace v8::internal
1451 1454
1452 #endif // V8_TARGET_ARCH_IA32 1455 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/ia32/debug-ia32.cc » ('j') | src/x64/builtins-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698