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

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

Issue 650028: Improve stores to global variables. (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/virtual-frame-ia32.h ('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 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 __ xchg(edx, eax); 941 __ xchg(edx, eax);
942 } 942 }
943 key.Unuse(); 943 key.Unuse();
944 receiver.Unuse(); 944 receiver.Unuse();
945 945
946 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); 946 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
947 return RawCallCodeObject(ic, mode); 947 return RawCallCodeObject(ic, mode);
948 } 948 }
949 949
950 950
951 Result VirtualFrame::CallStoreIC() { 951 Result VirtualFrame::CallStoreIC(Handle<String> name, bool is_contextual) {
952 // Name, value, and receiver are on top of the frame. The IC 952 // Value and (if not contextual) receiver are on top of the frame.
953 // expects name in ecx, value in eax, and receiver in edx. 953 // The IC expects name in ecx, value in eax, and receiver in edx.
954 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); 954 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
955 Result name = Pop();
956 Result value = Pop(); 955 Result value = Pop();
957 Result receiver = Pop(); 956 if (is_contextual) {
958 PrepareForCall(0, 0); 957 PrepareForCall(0, 0);
958 value.ToRegister(eax);
959 __ mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
960 __ mov(ecx, name);
961 } else {
962 Result receiver = Pop();
963 PrepareForCall(0, 0);
959 964
960 // Optimized for case in which name is a constant value. 965 if (value.is_register() && value.reg().is(edx)) {
961 if (name.is_register() && (name.reg().is(edx) || name.reg().is(eax))) { 966 if (receiver.is_register() && receiver.reg().is(eax)) {
962 if (!is_used(ecx)) { 967 // Wrong registers.
963 name.ToRegister(ecx); 968 __ xchg(eax, edx);
964 } else if (!is_used(ebx)) { 969 } else {
965 name.ToRegister(ebx); 970 // Register eax is free for value, which frees edx for receiver.
971 value.ToRegister(eax);
972 receiver.ToRegister(edx);
973 }
966 } else { 974 } else {
967 ASSERT(!is_used(edi)); // Only three results are live, so edi is free. 975 // Register edx is free for receiver, which guarantees eax is free for
968 name.ToRegister(edi); 976 // value.
977 receiver.ToRegister(edx);
978 value.ToRegister(eax);
969 } 979 }
970 } 980 }
971 // Now name is not in edx or eax, so we can fix them, then move name to ecx. 981 __ mov(ecx, name);
972 if (value.is_register() && value.reg().is(edx)) {
973 if (receiver.is_register() && receiver.reg().is(eax)) {
974 // Wrong registers.
975 __ xchg(eax, edx);
976 } else {
977 // Register eax is free for value, which frees edx for receiver.
978 value.ToRegister(eax);
979 receiver.ToRegister(edx);
980 }
981 } else {
982 // Register edx is free for receiver, which guarantees eax is free for
983 // value.
984 receiver.ToRegister(edx);
985 value.ToRegister(eax);
986 }
987 // Receiver and value are in the right place, so ecx is free for name.
988 name.ToRegister(ecx);
989 name.Unuse();
990 value.Unuse(); 982 value.Unuse();
991 receiver.Unuse();
992 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); 983 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET);
993 } 984 }
994 985
995 986
996 Result VirtualFrame::CallKeyedStoreIC() { 987 Result VirtualFrame::CallKeyedStoreIC() {
997 // Value, key, and receiver are on the top of the frame. The IC 988 // Value, key, and receiver are on the top of the frame. The IC
998 // expects value in eax and key and receiver on the stack. It does 989 // expects value in eax and key and receiver on the stack. It does
999 // not drop the key and receiver. 990 // not drop the key and receiver.
1000 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); 991 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize));
1001 Result value = Pop(); 992 Result value = Pop();
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 return; 1181 return;
1191 } 1182 }
1192 1183
1193 UNREACHABLE(); 1184 UNREACHABLE();
1194 } 1185 }
1195 1186
1196 1187
1197 #undef __ 1188 #undef __
1198 1189
1199 } } // namespace v8::internal 1190 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/virtual-frame-ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698