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 22 matching lines...) Expand all Loading... |
33 namespace v8 { | 33 namespace v8 { |
34 namespace internal { | 34 namespace internal { |
35 | 35 |
36 | 36 |
37 // On entry to a function, the virtual frame already contains the receiver, | 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. | 38 // the parameters, and a return address. All frame elements are in memory. |
39 VirtualFrame::VirtualFrame() | 39 VirtualFrame::VirtualFrame() |
40 : elements_(parameter_count() + local_count() + kPreallocatedElements), | 40 : elements_(parameter_count() + local_count() + kPreallocatedElements), |
41 stack_pointer_(parameter_count() + 1) { // 0-based index of TOS. | 41 stack_pointer_(parameter_count() + 1) { // 0-based index of TOS. |
42 for (int i = 0; i <= stack_pointer_; i++) { | 42 for (int i = 0; i <= stack_pointer_; i++) { |
43 elements_.Add(FrameElement::MemoryElement(NumberInfo::Unknown())); | 43 elements_.Add(FrameElement::MemoryElement(TypeInfo::Unknown())); |
44 } | 44 } |
45 for (int i = 0; i < RegisterAllocator::kNumRegisters; i++) { | 45 for (int i = 0; i < RegisterAllocator::kNumRegisters; i++) { |
46 register_locations_[i] = kIllegalIndex; | 46 register_locations_[i] = kIllegalIndex; |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 | 50 |
51 // When cloned, a frame is a deep copy of the original. | 51 // When cloned, a frame is a deep copy of the original. |
52 VirtualFrame::VirtualFrame(VirtualFrame* original) | 52 VirtualFrame::VirtualFrame(VirtualFrame* original) |
53 : elements_(original->element_count()), | 53 : elements_(original->element_count()), |
54 stack_pointer_(original->stack_pointer_) { | 54 stack_pointer_(original->stack_pointer_) { |
55 elements_.AddAll(original->elements_); | 55 elements_.AddAll(original->elements_); |
56 // Copy register locations from original. | 56 // Copy register locations from original. |
57 memcpy(®ister_locations_, | 57 memcpy(®ister_locations_, |
58 original->register_locations_, | 58 original->register_locations_, |
59 sizeof(register_locations_)); | 59 sizeof(register_locations_)); |
60 } | 60 } |
61 | 61 |
62 | 62 |
63 void VirtualFrame::PushFrameSlotAt(int index) { | 63 void VirtualFrame::PushFrameSlotAt(int index) { |
64 elements_.Add(CopyElementAt(index)); | 64 elements_.Add(CopyElementAt(index)); |
65 } | 65 } |
66 | 66 |
67 | 67 |
68 void VirtualFrame::Push(Register reg, NumberInfo info) { | 68 void VirtualFrame::Push(Register reg, TypeInfo info) { |
69 if (is_used(reg)) { | 69 if (is_used(reg)) { |
70 int index = register_location(reg); | 70 int index = register_location(reg); |
71 FrameElement element = CopyElementAt(index, info); | 71 FrameElement element = CopyElementAt(index, info); |
72 elements_.Add(element); | 72 elements_.Add(element); |
73 } else { | 73 } else { |
74 Use(reg, element_count()); | 74 Use(reg, element_count()); |
75 FrameElement element = | 75 FrameElement element = |
76 FrameElement::RegisterElement(reg, FrameElement::NOT_SYNCED, info); | 76 FrameElement::RegisterElement(reg, FrameElement::NOT_SYNCED, info); |
77 elements_.Add(element); | 77 elements_.Add(element); |
78 } | 78 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 #endif | 113 #endif |
114 if (stack_pointer_ != other->stack_pointer_) return false; | 114 if (stack_pointer_ != other->stack_pointer_) return false; |
115 for (int i = 0; i < element_count(); i++) { | 115 for (int i = 0; i < element_count(); i++) { |
116 if (!elements_[i].Equals(other->elements_[i])) return false; | 116 if (!elements_[i].Equals(other->elements_[i])) return false; |
117 } | 117 } |
118 | 118 |
119 return true; | 119 return true; |
120 } | 120 } |
121 | 121 |
122 | 122 |
123 void VirtualFrame::SetTypeForLocalAt(int index, NumberInfo info) { | 123 void VirtualFrame::SetTypeForLocalAt(int index, TypeInfo info) { |
124 elements_[local0_index() + index].set_number_info(info); | 124 elements_[local0_index() + index].set_type_info(info); |
125 } | 125 } |
126 | 126 |
127 | 127 |
128 void VirtualFrame::SetTypeForParamAt(int index, NumberInfo info) { | 128 void VirtualFrame::SetTypeForParamAt(int index, TypeInfo info) { |
129 elements_[param0_index() + index].set_number_info(info); | 129 elements_[param0_index() + index].set_type_info(info); |
130 } | 130 } |
131 | 131 |
132 | 132 |
133 } } // namespace v8::internal | 133 } } // namespace v8::internal |
134 | 134 |
135 #endif // V8_VIRTUAL_FRAME_INL_H_ | 135 #endif // V8_VIRTUAL_FRAME_INL_H_ |
OLD | NEW |