OLD | NEW |
(Empty) | |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are |
| 4 // met: |
| 5 // |
| 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided |
| 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. |
| 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 |
| 28 #ifndef V8_VIRTUAL_FRAME_LIGHT_INL_H_ |
| 29 #define V8_VIRTUAL_FRAME_LIGHT_INL_H_ |
| 30 |
| 31 #include "number-info.h" |
| 32 #include "register-allocator.h" |
| 33 #include "scopes.h" |
| 34 |
| 35 namespace v8 { |
| 36 namespace internal { |
| 37 |
| 38 // On entry to a function, the virtual frame already contains the receiver, |
| 39 // the parameters, and a return address. All frame elements are in memory. |
| 40 VirtualFrame::VirtualFrame() |
| 41 : element_count_(parameter_count() + 2), |
| 42 stack_pointer_(parameter_count() + 1) { |
| 43 for (int i = 0; i < RegisterAllocator::kNumRegisters; i++) { |
| 44 register_locations_[i] = kIllegalIndex; |
| 45 } |
| 46 } |
| 47 |
| 48 |
| 49 // When cloned, a frame is a deep copy of the original. |
| 50 VirtualFrame::VirtualFrame(VirtualFrame* original) |
| 51 : element_count_(original->element_count()), |
| 52 stack_pointer_(original->stack_pointer_) { |
| 53 memcpy(®ister_locations_, |
| 54 original->register_locations_, |
| 55 sizeof(register_locations_)); |
| 56 } |
| 57 |
| 58 |
| 59 void VirtualFrame::Push(Handle<Object> value) { |
| 60 UNIMPLEMENTED(); |
| 61 } |
| 62 |
| 63 |
| 64 bool VirtualFrame::Equals(VirtualFrame* other) { |
| 65 #ifdef DEBUG |
| 66 for (int i = 0; i < RegisterAllocator::kNumRegisters; i++) { |
| 67 if (register_location(i) != other->register_location(i)) { |
| 68 return false; |
| 69 } |
| 70 } |
| 71 if (element_count() != other->element_count()) return false; |
| 72 #endif |
| 73 if (stack_pointer_ != other->stack_pointer_) return false; |
| 74 |
| 75 return true; |
| 76 } |
| 77 |
| 78 |
| 79 void VirtualFrame::SetTypeForLocalAt(int index, NumberInfo info) { |
| 80 UNIMPLEMENTED(); |
| 81 } |
| 82 |
| 83 |
| 84 // Everything is always spilled anyway. |
| 85 void VirtualFrame::SpillAll() { |
| 86 } |
| 87 |
| 88 |
| 89 void VirtualFrame::PrepareForReturn() { |
| 90 } |
| 91 |
| 92 |
| 93 } } // namespace v8::internal |
| 94 |
| 95 #endif // V8_VIRTUAL_FRAME_LIGHT_INL_H_ |
OLD | NEW |