| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 15 matching lines...) Expand all Loading... |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_VIRTUAL_FRAME_INL_H_ | 28 #ifndef V8_VIRTUAL_FRAME_INL_H_ |
| 29 #define V8_VIRTUAL_FRAME_INL_H_ | 29 #define V8_VIRTUAL_FRAME_INL_H_ |
| 30 | 30 |
| 31 #include "virtual-frame.h" | 31 #include "virtual-frame.h" |
| 32 | 32 |
| 33 namespace v8 { | 33 namespace v8 { |
| 34 namespace internal { | 34 namespace internal { |
| 35 | 35 |
| 36 |
| 37 // On entry to a function, the virtual frame already contains the receiver, |
| 38 // the parameters, and a return address. All frame elements are in memory. |
| 39 VirtualFrame::VirtualFrame() |
| 40 : elements_(parameter_count() + local_count() + kPreallocatedElements), |
| 41 stack_pointer_(parameter_count() + 1) { // 0-based index of TOS. |
| 42 for (int i = 0; i <= stack_pointer_; i++) { |
| 43 elements_.Add(FrameElement::MemoryElement(NumberInfo::kUnknown)); |
| 44 } |
| 45 for (int i = 0; i < RegisterAllocator::kNumRegisters; i++) { |
| 46 register_locations_[i] = kIllegalIndex; |
| 47 } |
| 48 } |
| 49 |
| 50 |
| 36 // When cloned, a frame is a deep copy of the original. | 51 // When cloned, a frame is a deep copy of the original. |
| 37 VirtualFrame::VirtualFrame(VirtualFrame* original) | 52 VirtualFrame::VirtualFrame(VirtualFrame* original) |
| 38 : elements_(original->element_count()), | 53 : elements_(original->element_count()), |
| 39 stack_pointer_(original->stack_pointer_) { | 54 stack_pointer_(original->stack_pointer_) { |
| 40 elements_.AddAll(original->elements_); | 55 elements_.AddAll(original->elements_); |
| 41 // Copy register locations from original. | 56 // Copy register locations from original. |
| 42 memcpy(®ister_locations_, | 57 memcpy(®ister_locations_, |
| 43 original->register_locations_, | 58 original->register_locations_, |
| 44 sizeof(register_locations_)); | 59 sizeof(register_locations_)); |
| 45 } | 60 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 for (int i = 0; i < element_count(); i++) { | 115 for (int i = 0; i < element_count(); i++) { |
| 101 if (!elements_[i].Equals(other->elements_[i])) return false; | 116 if (!elements_[i].Equals(other->elements_[i])) return false; |
| 102 } | 117 } |
| 103 | 118 |
| 104 return true; | 119 return true; |
| 105 } | 120 } |
| 106 | 121 |
| 107 } } // namespace v8::internal | 122 } } // namespace v8::internal |
| 108 | 123 |
| 109 #endif // V8_VIRTUAL_FRAME_INL_H_ | 124 #endif // V8_VIRTUAL_FRAME_INL_H_ |
| OLD | NEW |