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

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

Issue 113400: Bypass an expensive computation of a basic block's entry frame for a... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 7 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
« src/ia32/virtual-frame-ia32.h ('K') | « 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 stack_pointer_ = end; 173 stack_pointer_ = end;
174 __ sub(Operand(esp), Immediate(delta * kPointerSize)); 174 __ sub(Operand(esp), Immediate(delta * kPointerSize));
175 } 175 }
176 176
177 for (int i = start; i <= end; i++) { 177 for (int i = start; i <= end; i++) {
178 if (!elements_[i].is_synced()) SyncElementBelowStackPointer(i); 178 if (!elements_[i].is_synced()) SyncElementBelowStackPointer(i);
179 } 179 }
180 } 180 }
181 181
182 182
183 void VirtualFrame::MakeMergable(int mergable_elements) {
184 if (mergable_elements == JumpTarget::kAllElements) {
185 mergable_elements = elements_.length();
186 }
187 ASSERT(mergable_elements <= elements_.length());
188
189 int start_index = elements_.length() - mergable_elements;
190
191 // The is_copied flags on entry frame elements are expected to be
192 // exact. Set them for the elements below the water mark.
193 for (int i = 0; i < start_index; i++) {
194 elements_[i].clear_copied();
Kasper Lund 2009/05/15 06:26:51 Can't you add support for coping the is_copied fla
William Hesse 2009/05/15 07:45:51 I recall that when we tried any sort of list or co
Kevin Millikin (Chromium) 2009/05/15 08:12:25 It's annoying because we have to see the copy (lat
195 if (elements_[i].is_copy()) {
196 elements_[elements_[i].index()].set_copied();
197 }
198 }
199
200 for (int i = start_index; i < elements_.length(); i++) {
201 FrameElement element = elements_[i];
202
203 if (element.is_constant() || element.is_copy()) {
204 if (element.is_synced()) {
205 // Just spill.
206 elements_[i] = FrameElement::MemoryElement();
207 } else {
208 // Allocate to a register.
209 FrameElement backing_element; // Invalid if not a copy.
210 if (element.is_copy()) {
211 backing_element = elements_[element.index()];
212 }
213 Result fresh = cgen_->allocator()->Allocate();
William Hesse 2009/05/15 07:45:51 If there is a preference to allocate slots at the
214 ASSERT(fresh.is_valid());
215 elements_[i] =
216 FrameElement::RegisterElement(fresh.reg(),
217 FrameElement::NOT_SYNCED);
218 Use(fresh.reg(), i);
219
220 // Emit a move.
221 if (element.is_constant()) {
222 if (cgen_->IsUnsafeSmi(element.handle())) {
223 cgen_->LoadUnsafeSmi(fresh.reg(), element.handle());
224 } else {
225 __ Set(fresh.reg(), Immediate(element.handle()));
226 }
227 } else {
228 ASSERT(element.is_copy());
229 // Copies are only backed by register or memory locations.
230 if (backing_element.is_register()) {
231 // The backing store may have been spilled by allocating,
232 // but that's OK. If it was, the value is right where we
233 // want it.
234 if (!fresh.reg().is(backing_element.reg())) {
235 __ mov(fresh.reg(), backing_element.reg());
236 }
237 } else {
238 ASSERT(backing_element.is_memory());
239 __ mov(fresh.reg(), Operand(ebp, fp_relative(element.index())));
240 }
241 }
242 }
243 // No need to set the copied flag---there are no copies of
244 // copies or constants so the original was not copied.
245 elements_[i].set_static_type(element.static_type());
246 } else {
247 // Clear the copy flag of non-constant, non-copy elements above
248 // the high water mark. They cannot be copied because copes are
249 // always higher than their backing store and copies are not
250 // allowed above the water mark.
251 elements_[i].clear_copied();
252 }
253 }
254 }
255
256
183 void VirtualFrame::MergeTo(VirtualFrame* expected) { 257 void VirtualFrame::MergeTo(VirtualFrame* expected) {
184 Comment cmnt(masm_, "[ Merge frame"); 258 Comment cmnt(masm_, "[ Merge frame");
185 // We should always be merging the code generator's current frame to an 259 // We should always be merging the code generator's current frame to an
186 // expected frame. 260 // expected frame.
187 ASSERT(cgen_->frame() == this); 261 ASSERT(cgen_->frame() == this);
188 262
189 // Adjust the stack pointer upward (toward the top of the virtual 263 // Adjust the stack pointer upward (toward the top of the virtual
190 // frame) if necessary. 264 // frame) if necessary.
191 if (stack_pointer_ < expected->stack_pointer_) { 265 if (stack_pointer_ < expected->stack_pointer_) {
192 int difference = expected->stack_pointer_ - stack_pointer_; 266 int difference = expected->stack_pointer_ - stack_pointer_;
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 ASSERT(stack_pointer_ == elements_.length() - 1); 1119 ASSERT(stack_pointer_ == elements_.length() - 1);
1046 elements_.Add(FrameElement::MemoryElement()); 1120 elements_.Add(FrameElement::MemoryElement());
1047 stack_pointer_++; 1121 stack_pointer_++;
1048 __ push(immediate); 1122 __ push(immediate);
1049 } 1123 }
1050 1124
1051 1125
1052 #undef __ 1126 #undef __
1053 1127
1054 } } // namespace v8::internal 1128 } } // namespace v8::internal
OLDNEW
« src/ia32/virtual-frame-ia32.h ('K') | « src/ia32/virtual-frame-ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698