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 19 matching lines...) Expand all Loading... |
30 #include "codegen-inl.h" | 30 #include "codegen-inl.h" |
31 #include "register-allocator-inl.h" | 31 #include "register-allocator-inl.h" |
32 #include "virtual-frame-inl.h" | 32 #include "virtual-frame-inl.h" |
33 | 33 |
34 namespace v8 { | 34 namespace v8 { |
35 namespace internal { | 35 namespace internal { |
36 | 36 |
37 // ------------------------------------------------------------------------- | 37 // ------------------------------------------------------------------------- |
38 // VirtualFrame implementation. | 38 // VirtualFrame implementation. |
39 | 39 |
40 // If there are any registers referenced only by the frame, spill one. | |
41 Register VirtualFrame::SpillAnyRegister() { | |
42 // Find the leftmost (ordered by register number) register whose only | |
43 // reference is in the frame. | |
44 for (int i = 0; i < RegisterAllocator::kNumRegisters; i++) { | |
45 if (is_used(i) && cgen()->allocator()->count(i) == 1) { | |
46 SpillElementAt(register_location(i)); | |
47 ASSERT(!cgen()->allocator()->is_used(i)); | |
48 return RegisterAllocator::ToRegister(i); | |
49 } | |
50 } | |
51 return no_reg; | |
52 } | |
53 | |
54 | |
55 // Specialization of List::ResizeAdd to non-inlined version for FrameElements. | 40 // Specialization of List::ResizeAdd to non-inlined version for FrameElements. |
56 // The function ResizeAdd becomes a real function, whose implementation is the | 41 // The function ResizeAdd becomes a real function, whose implementation is the |
57 // inlined ResizeAddInternal. | 42 // inlined ResizeAddInternal. |
58 template <> | 43 template <> |
59 void List<FrameElement, | 44 void List<FrameElement, |
60 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element) { | 45 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element) { |
61 ResizeAddInternal(element); | 46 ResizeAddInternal(element); |
62 } | 47 } |
63 | 48 |
64 } } // namespace v8::internal | 49 } } // namespace v8::internal |
OLD | NEW |