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

Side by Side Diff: src/ia32/virtual-frame-ia32.cc

Issue 555162: StoreIC interface changed on ia32 to take receiver in edx, not on stack. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 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
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 // Key and receiver are on top of the frame. The IC expects them on 892 // Key and receiver are on top of the frame. The IC expects them on
893 // the stack. It does not drop them. 893 // the stack. It does not drop them.
894 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); 894 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
895 PrepareForCall(2, 0); // Two stack args, neither callee-dropped. 895 PrepareForCall(2, 0); // Two stack args, neither callee-dropped.
896 return RawCallCodeObject(ic, mode); 896 return RawCallCodeObject(ic, mode);
897 } 897 }
898 898
899 899
900 Result VirtualFrame::CallStoreIC() { 900 Result VirtualFrame::CallStoreIC() {
901 // Name, value, and receiver are on top of the frame. The IC 901 // Name, value, and receiver are on top of the frame. The IC
902 // expects name in ecx, value in eax, and receiver on the stack. It 902 // expects name in ecx, value in eax, and receiver in edx.
903 // does not drop the receiver.
904 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); 903 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
905 Result name = Pop(); 904 Result name = Pop();
906 Result value = Pop(); 905 Result value = Pop();
907 PrepareForCall(1, 0); // One stack arg, not callee-dropped. 906 Result receiver = Pop();
907 PrepareForCall(0, 0);
908 908
909 if (value.is_register() && value.reg().is(ecx)) { 909 // Optimized for case in which name is a constant value.
910 if (name.is_register() && name.reg().is(eax)) { 910 if (name.is_register() && (name.reg().is(edx) || name.reg().is(eax))) {
911 if (!is_used(ecx)) {
912 name.ToRegister(ecx);
913 } else if (!is_used(ebx)) {
914 name.ToRegister(ebx);
915 } else {
916 ASSERT(!is_used(edi)); // Only three results are live, so edi is free.
917 name.ToRegister(edi);
918 }
919 }
920 // Now name is not in edx or eax, so we can fix them, then move name to ecx.
921 if (value.is_register() && value.reg().is(edx)) {
922 if (receiver.is_register() && receiver.reg().is(eax)) {
911 // Wrong registers. 923 // Wrong registers.
912 __ xchg(eax, ecx); 924 __ xchg(eax, edx);
913 } else { 925 } else {
914 // Register eax is free for value, which frees ecx for name. 926 // Register eax is free for value, which frees edx for receiver.
915 value.ToRegister(eax); 927 value.ToRegister(eax);
916 name.ToRegister(ecx); 928 receiver.ToRegister(edx);
917 } 929 }
918 } else { 930 } else {
919 // Register ecx is free for name, which guarantees eax is free for 931 // Register edx is free for receiver, which guarantees eax is free for
920 // value. 932 // value.
921 name.ToRegister(ecx); 933 receiver.ToRegister(edx);
922 value.ToRegister(eax); 934 value.ToRegister(eax);
923 } 935 }
924 936 // Receiver and value are in the right place, so ecx is free for name.
937 name.ToRegister(ecx);
925 name.Unuse(); 938 name.Unuse();
926 value.Unuse(); 939 value.Unuse();
940 receiver.Unuse();
927 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); 941 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET);
928 } 942 }
929 943
930 944
931 Result VirtualFrame::CallKeyedStoreIC() { 945 Result VirtualFrame::CallKeyedStoreIC() {
932 // Value, key, and receiver are on the top of the frame. The IC 946 // Value, key, and receiver are on the top of the frame. The IC
933 // expects value in eax and key and receiver on the stack. It does 947 // expects value in eax and key and receiver on the stack. It does
934 // not drop the key and receiver. 948 // not drop the key and receiver.
935 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); 949 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize));
936 // TODO(1222589): Make the IC grab the values from the stack. 950 // TODO(1222589): Make the IC grab the values from the stack.
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 ASSERT(stack_pointer_ == element_count() - 1); 1110 ASSERT(stack_pointer_ == element_count() - 1);
1097 elements_.Add(FrameElement::MemoryElement()); 1111 elements_.Add(FrameElement::MemoryElement());
1098 stack_pointer_++; 1112 stack_pointer_++;
1099 __ push(immediate); 1113 __ push(immediate);
1100 } 1114 }
1101 1115
1102 1116
1103 #undef __ 1117 #undef __
1104 1118
1105 } } // namespace v8::internal 1119 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698