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

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

Issue 668151: Make more use of the NumberInfo data.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 9 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 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 void VirtualFrame::MakeMergable() { 156 void VirtualFrame::MakeMergable() {
157 for (int i = 0; i < element_count(); i++) { 157 for (int i = 0; i < element_count(); i++) {
158 FrameElement element = elements_[i]; 158 FrameElement element = elements_[i];
159 159
160 // All number type information is reset to unknown for a mergable frame 160 // All number type information is reset to unknown for a mergable frame
161 // because of incoming back edges. 161 // because of incoming back edges.
162 if (element.is_constant() || element.is_copy()) { 162 if (element.is_constant() || element.is_copy()) {
163 if (element.is_synced()) { 163 if (element.is_synced()) {
164 // Just spill. 164 // Just spill.
165 elements_[i] = FrameElement::MemoryElement(NumberInfo::kUnknown); 165 elements_[i] = FrameElement::MemoryElement(NumberInfo::Unknown());
166 } else { 166 } else {
167 // Allocate to a register. 167 // Allocate to a register.
168 FrameElement backing_element; // Invalid if not a copy. 168 FrameElement backing_element; // Invalid if not a copy.
169 if (element.is_copy()) { 169 if (element.is_copy()) {
170 backing_element = elements_[element.index()]; 170 backing_element = elements_[element.index()];
171 } 171 }
172 Result fresh = cgen()->allocator()->Allocate(); 172 Result fresh = cgen()->allocator()->Allocate();
173 ASSERT(fresh.is_valid()); // A register was spilled if all were in use. 173 ASSERT(fresh.is_valid()); // A register was spilled if all were in use.
174 elements_[i] = 174 elements_[i] =
175 FrameElement::RegisterElement(fresh.reg(), 175 FrameElement::RegisterElement(fresh.reg(),
176 FrameElement::NOT_SYNCED, 176 FrameElement::NOT_SYNCED,
177 NumberInfo::kUnknown); 177 NumberInfo::Unknown());
178 Use(fresh.reg(), i); 178 Use(fresh.reg(), i);
179 179
180 // Emit a move. 180 // Emit a move.
181 if (element.is_constant()) { 181 if (element.is_constant()) {
182 if (cgen()->IsUnsafeSmi(element.handle())) { 182 if (cgen()->IsUnsafeSmi(element.handle())) {
183 cgen()->MoveUnsafeSmi(fresh.reg(), element.handle()); 183 cgen()->MoveUnsafeSmi(fresh.reg(), element.handle());
184 } else { 184 } else {
185 __ Set(fresh.reg(), Immediate(element.handle())); 185 __ Set(fresh.reg(), Immediate(element.handle()));
186 } 186 }
187 } else { 187 } else {
(...skipping 12 matching lines...) Expand all
200 } 200 }
201 } 201 }
202 } 202 }
203 // No need to set the copied flag --- there are no copies. 203 // No need to set the copied flag --- there are no copies.
204 } else { 204 } else {
205 // Clear the copy flag of non-constant, non-copy elements. 205 // Clear the copy flag of non-constant, non-copy elements.
206 // They cannot be copied because copies are not allowed. 206 // They cannot be copied because copies are not allowed.
207 // The copy flag is not relied on before the end of this loop, 207 // The copy flag is not relied on before the end of this loop,
208 // including when registers are spilled. 208 // including when registers are spilled.
209 elements_[i].clear_copied(); 209 elements_[i].clear_copied();
210 elements_[i].set_number_info(NumberInfo::kUnknown); 210 elements_[i].set_number_info(NumberInfo::Unknown());
211 } 211 }
212 } 212 }
213 } 213 }
214 214
215 215
216 void VirtualFrame::MergeTo(VirtualFrame* expected) { 216 void VirtualFrame::MergeTo(VirtualFrame* expected) {
217 Comment cmnt(masm(), "[ Merge frame"); 217 Comment cmnt(masm(), "[ Merge frame");
218 // We should always be merging the code generator's current frame to an 218 // We should always be merging the code generator's current frame to an
219 // expected frame. 219 // expected frame.
220 ASSERT(cgen()->frame() == this); 220 ASSERT(cgen()->frame() == this);
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 } 1055 }
1056 } 1056 }
1057 1057
1058 1058
1059 Result VirtualFrame::Pop() { 1059 Result VirtualFrame::Pop() {
1060 FrameElement element = elements_.RemoveLast(); 1060 FrameElement element = elements_.RemoveLast();
1061 int index = element_count(); 1061 int index = element_count();
1062 ASSERT(element.is_valid()); 1062 ASSERT(element.is_valid());
1063 1063
1064 // Get number type information of the result. 1064 // Get number type information of the result.
1065 NumberInfo::Type info; 1065 NumberInfo info;
1066 if (!element.is_copy()) { 1066 if (!element.is_copy()) {
1067 info = element.number_info(); 1067 info = element.number_info();
1068 } else { 1068 } else {
1069 info = elements_[element.index()].number_info(); 1069 info = elements_[element.index()].number_info();
1070 } 1070 }
1071 1071
1072 bool pop_needed = (stack_pointer_ == index); 1072 bool pop_needed = (stack_pointer_ == index);
1073 if (pop_needed) { 1073 if (pop_needed) {
1074 stack_pointer_--; 1074 stack_pointer_--;
1075 if (element.is_memory()) { 1075 if (element.is_memory()) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 1130
1131 1131
1132 void VirtualFrame::EmitPop(Operand operand) { 1132 void VirtualFrame::EmitPop(Operand operand) {
1133 ASSERT(stack_pointer_ == element_count() - 1); 1133 ASSERT(stack_pointer_ == element_count() - 1);
1134 stack_pointer_--; 1134 stack_pointer_--;
1135 elements_.RemoveLast(); 1135 elements_.RemoveLast();
1136 __ pop(operand); 1136 __ pop(operand);
1137 } 1137 }
1138 1138
1139 1139
1140 void VirtualFrame::EmitPush(Register reg, NumberInfo::Type info) { 1140 void VirtualFrame::EmitPush(Register reg, NumberInfo info) {
1141 ASSERT(stack_pointer_ == element_count() - 1); 1141 ASSERT(stack_pointer_ == element_count() - 1);
1142 elements_.Add(FrameElement::MemoryElement(info)); 1142 elements_.Add(FrameElement::MemoryElement(info));
1143 stack_pointer_++; 1143 stack_pointer_++;
1144 __ push(reg); 1144 __ push(reg);
1145 } 1145 }
1146 1146
1147 1147
1148 void VirtualFrame::EmitPush(Operand operand, NumberInfo::Type info) { 1148 void VirtualFrame::EmitPush(Operand operand, NumberInfo info) {
1149 ASSERT(stack_pointer_ == element_count() - 1); 1149 ASSERT(stack_pointer_ == element_count() - 1);
1150 elements_.Add(FrameElement::MemoryElement(info)); 1150 elements_.Add(FrameElement::MemoryElement(info));
1151 stack_pointer_++; 1151 stack_pointer_++;
1152 __ push(operand); 1152 __ push(operand);
1153 } 1153 }
1154 1154
1155 1155
1156 void VirtualFrame::EmitPush(Immediate immediate, NumberInfo::Type info) { 1156 void VirtualFrame::EmitPush(Immediate immediate, NumberInfo info) {
1157 ASSERT(stack_pointer_ == element_count() - 1); 1157 ASSERT(stack_pointer_ == element_count() - 1);
1158 elements_.Add(FrameElement::MemoryElement(info)); 1158 elements_.Add(FrameElement::MemoryElement(info));
1159 stack_pointer_++; 1159 stack_pointer_++;
1160 __ push(immediate); 1160 __ push(immediate);
1161 } 1161 }
1162 1162
1163 1163
1164 void VirtualFrame::Push(Expression* expr) { 1164 void VirtualFrame::Push(Expression* expr) {
1165 ASSERT(expr->IsTrivial()); 1165 ASSERT(expr->IsTrivial());
1166 1166
1167 Literal* lit = expr->AsLiteral(); 1167 Literal* lit = expr->AsLiteral();
1168 if (lit != NULL) { 1168 if (lit != NULL) {
1169 Push(lit->handle()); 1169 Push(lit->handle());
1170 return; 1170 return;
1171 } 1171 }
1172 1172
1173 VariableProxy* proxy = expr->AsVariableProxy(); 1173 VariableProxy* proxy = expr->AsVariableProxy();
1174 if (proxy != NULL && proxy->is_this()) { 1174 if (proxy != NULL && proxy->is_this()) {
1175 PushParameterAt(-1); 1175 PushParameterAt(-1);
1176 return; 1176 return;
1177 } 1177 }
1178 1178
1179 UNREACHABLE(); 1179 UNREACHABLE();
1180 } 1180 }
1181 1181
1182 1182
1183 #undef __ 1183 #undef __
1184 1184
1185 } } // namespace v8::internal 1185 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698