OLD | NEW |
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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 if (!elements_[i].is_memory()) { | 297 if (!elements_[i].is_memory()) { |
298 SpillElementAt(i); | 298 SpillElementAt(i); |
299 } | 299 } |
300 } | 300 } |
301 | 301 |
302 // Forget the frame elements that will be popped by the call. | 302 // Forget the frame elements that will be popped by the call. |
303 Forget(dropped_args); | 303 Forget(dropped_args); |
304 } | 304 } |
305 | 305 |
306 | 306 |
307 void VirtualFrame::DetachFromCodeGenerator() { | |
308 // Tell the global register allocator that it is free to reallocate all | |
309 // register references contained in this frame. The frame elements remain | |
310 // register references, so the frame-internal reference count is not | |
311 // decremented. | |
312 for (int i = 0; i < elements_.length(); i++) { | |
313 if (elements_[i].is_register()) { | |
314 cgen_->allocator()->Unuse(elements_[i].reg()); | |
315 } | |
316 } | |
317 } | |
318 | |
319 | |
320 void VirtualFrame::AttachToCodeGenerator() { | |
321 // Tell the global register allocator that the frame-internal register | |
322 // references are live again. | |
323 for (int i = 0; i < elements_.length(); i++) { | |
324 if (elements_[i].is_register()) { | |
325 cgen_->allocator()->Use(elements_[i].reg()); | |
326 } | |
327 } | |
328 } | |
329 | |
330 | |
331 void VirtualFrame::PrepareForReturn() { | 307 void VirtualFrame::PrepareForReturn() { |
332 // Spill all locals. This is necessary to make sure all locals have | 308 // Spill all locals. This is necessary to make sure all locals have |
333 // the right value when breaking at the return site in the debugger. | 309 // the right value when breaking at the return site in the debugger. |
334 // | 310 // |
335 // TODO(203): It is also necessary to ensure that merging at the | 311 // TODO(203): It is also necessary to ensure that merging at the |
336 // return site does not generate code to overwrite eax, where the | 312 // return site does not generate code to overwrite eax, where the |
337 // return value is kept in a non-refcounted register reference. | 313 // return value is kept in a non-refcounted register reference. |
338 for (int i = 0; i < expression_base_index(); i++) SpillElementAt(i); | 314 for (int i = 0; i < expression_base_index(); i++) SpillElementAt(i); |
339 } | 315 } |
340 | 316 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 // Specialization of List::ResizeAdd to non-inlined version for FrameElements. | 470 // Specialization of List::ResizeAdd to non-inlined version for FrameElements. |
495 // The function ResizeAdd becomes a real function, whose implementation is the | 471 // The function ResizeAdd becomes a real function, whose implementation is the |
496 // inlined ResizeAddInternal. | 472 // inlined ResizeAddInternal. |
497 template <> | 473 template <> |
498 void List<FrameElement, | 474 void List<FrameElement, |
499 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element) { | 475 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element) { |
500 ResizeAddInternal(element); | 476 ResizeAddInternal(element); |
501 } | 477 } |
502 | 478 |
503 } } // namespace v8::internal | 479 } } // namespace v8::internal |
OLD | NEW |