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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 FrameElement::NOT_SYNCED); | 265 FrameElement::NOT_SYNCED); |
266 } | 266 } |
267 } else { | 267 } else { |
268 // The element is already determined. | 268 // The element is already determined. |
269 entry_frame_->elements_[i] = *elements[i]; | 269 entry_frame_->elements_[i] = *elements[i]; |
270 } | 270 } |
271 } | 271 } |
272 | 272 |
273 // Set the copied flags in the frame to be exact. This assumes that | 273 // Set the copied flags in the frame to be exact. This assumes that |
274 // the backing store of copies is always lower in the frame. | 274 // the backing store of copies is always lower in the frame. |
| 275 // Set the register counts and indices. |
275 for (int i = 0; i < length; i++) { | 276 for (int i = 0; i < length; i++) { |
| 277 FrameElement current = entry_frame_->elements_[i]; |
276 entry_frame_->elements_[i].clear_copied(); | 278 entry_frame_->elements_[i].clear_copied(); |
277 if (entry_frame_->elements_[i].is_copy()) { | 279 if (current.is_copy()) { |
278 int index = entry_frame_->elements_[i].index(); | 280 entry_frame_->elements_[current.index()].set_copied(); |
279 entry_frame_->elements_[index].set_copied(); | 281 } else if (current.is_register()) { |
| 282 entry_frame_->frame_registers_.Use(current.reg()); |
| 283 entry_frame_->register_locations_[current.reg().code()] = i; |
280 } | 284 } |
281 } | 285 } |
282 | 286 |
283 // Fill in the other fields of the entry frame. | 287 // Fill in the other fields of the entry frame. |
284 entry_frame_->local_count_ = initial_frame->local_count_; | 288 entry_frame_->local_count_ = initial_frame->local_count_; |
285 entry_frame_->frame_pointer_ = initial_frame->frame_pointer_; | 289 entry_frame_->frame_pointer_ = initial_frame->frame_pointer_; |
286 | 290 |
287 // The stack pointer is at the highest synced element or the base of | 291 // The stack pointer is at the highest synced element or the base of |
288 // the expression stack. | 292 // the expression stack. |
289 int stack_pointer = length - 1; | 293 int stack_pointer = length - 1; |
290 while (stack_pointer >= entry_frame_->expression_base_index() && | 294 while (stack_pointer >= entry_frame_->expression_base_index() && |
291 !entry_frame_->elements_[stack_pointer].is_synced()) { | 295 !entry_frame_->elements_[stack_pointer].is_synced()) { |
292 stack_pointer--; | 296 stack_pointer--; |
293 } | 297 } |
294 entry_frame_->stack_pointer_ = stack_pointer; | 298 entry_frame_->stack_pointer_ = stack_pointer; |
295 | |
296 // Unuse the reserved registers---they do not actually appear in | |
297 // the entry frame. | |
298 RegisterAllocator::UnuseReserved(&frame_registers); | |
299 entry_frame_->frame_registers_ = frame_registers; | |
300 } | 299 } |
301 | 300 |
302 | 301 |
303 void JumpTarget::Jump(Result* arg) { | 302 void JumpTarget::Jump(Result* arg) { |
304 ASSERT(cgen_ != NULL); | 303 ASSERT(cgen_ != NULL); |
305 ASSERT(cgen_->has_valid_frame()); | 304 ASSERT(cgen_->has_valid_frame()); |
306 | 305 |
307 cgen_->frame()->Push(arg); | 306 cgen_->frame()->Push(arg); |
308 Jump(); | 307 Jump(); |
309 } | 308 } |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 temp.CopyTo(this); | 642 temp.CopyTo(this); |
644 temp.Reset(); // So the destructor does not deallocate virtual frames. | 643 temp.Reset(); // So the destructor does not deallocate virtual frames. |
645 | 644 |
646 #ifdef DEBUG | 645 #ifdef DEBUG |
647 is_shadowing_ = false; | 646 is_shadowing_ = false; |
648 #endif | 647 #endif |
649 } | 648 } |
650 | 649 |
651 | 650 |
652 } } // namespace v8::internal | 651 } } // namespace v8::internal |
OLD | NEW |