OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 13 matching lines...) Expand all Loading... |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_VIRTUAL_FRAME_HEAVY_INL_H_ | 28 #ifndef V8_VIRTUAL_FRAME_HEAVY_INL_H_ |
29 #define V8_VIRTUAL_FRAME_HEAVY_INL_H_ | 29 #define V8_VIRTUAL_FRAME_HEAVY_INL_H_ |
30 | 30 |
31 #include "type-info.h" | 31 #include "type-info.h" |
32 #include "register-allocator.h" | 32 #include "register-allocator.h" |
33 #include "scopes.h" | 33 #include "scopes.h" |
| 34 #include "register-allocator-inl.h" |
| 35 #include "codegen-inl.h" |
34 | 36 |
35 namespace v8 { | 37 namespace v8 { |
36 namespace internal { | 38 namespace internal { |
37 | 39 |
38 // On entry to a function, the virtual frame already contains the receiver, | 40 // 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. | 41 // the parameters, and a return address. All frame elements are in memory. |
40 VirtualFrame::VirtualFrame() | 42 VirtualFrame::VirtualFrame() |
41 : elements_(parameter_count() + local_count() + kPreallocatedElements), | 43 : elements_(parameter_count() + local_count() + kPreallocatedElements), |
42 stack_pointer_(parameter_count() + 1) { // 0-based index of TOS. | 44 stack_pointer_(parameter_count() + 1) { // 0-based index of TOS. |
43 for (int i = 0; i <= stack_pointer_; i++) { | 45 for (int i = 0; i <= stack_pointer_; i++) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 Drop(num_dropped - 1); | 142 Drop(num_dropped - 1); |
141 } | 143 } |
142 SetElementAt(0, &tos); | 144 SetElementAt(0, &tos); |
143 } | 145 } |
144 | 146 |
145 | 147 |
146 void VirtualFrame::Push(Smi* value) { | 148 void VirtualFrame::Push(Smi* value) { |
147 Push(Handle<Object> (value)); | 149 Push(Handle<Object> (value)); |
148 } | 150 } |
149 | 151 |
| 152 |
| 153 int VirtualFrame::register_location(Register reg) { |
| 154 return register_locations_[RegisterAllocator::ToNumber(reg)]; |
| 155 } |
| 156 |
| 157 |
| 158 void VirtualFrame::set_register_location(Register reg, int index) { |
| 159 register_locations_[RegisterAllocator::ToNumber(reg)] = index; |
| 160 } |
| 161 |
| 162 |
| 163 bool VirtualFrame::is_used(Register reg) { |
| 164 return register_locations_[RegisterAllocator::ToNumber(reg)] |
| 165 != kIllegalIndex; |
| 166 } |
| 167 |
| 168 |
| 169 void VirtualFrame::SetElementAt(int index, Handle<Object> value) { |
| 170 Result temp(value); |
| 171 SetElementAt(index, &temp); |
| 172 } |
| 173 |
| 174 |
| 175 Result VirtualFrame::CallStub(CodeStub* stub, int arg_count) { |
| 176 PrepareForCall(arg_count, arg_count); |
| 177 return RawCallStub(stub); |
| 178 } |
| 179 |
| 180 |
| 181 int VirtualFrame::parameter_count() { |
| 182 return cgen()->scope()->num_parameters(); |
| 183 } |
| 184 |
| 185 |
| 186 int VirtualFrame::local_count() { |
| 187 return cgen()->scope()->num_stack_slots(); |
| 188 } |
| 189 |
150 } } // namespace v8::internal | 190 } } // namespace v8::internal |
151 | 191 |
152 #endif // V8_VIRTUAL_FRAME_HEAVY_INL_H_ | 192 #endif // V8_VIRTUAL_FRAME_HEAVY_INL_H_ |
OLD | NEW |