| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 ASSERT(cgen_ == NULL); | 65 ASSERT(cgen_ == NULL); |
| 66 cgen_ = cgen; | 66 cgen_ = cgen; |
| 67 masm_ = cgen->masm(); | 67 masm_ = cgen->masm(); |
| 68 direction_ = direction; | 68 direction_ = direction; |
| 69 } | 69 } |
| 70 | 70 |
| 71 | 71 |
| 72 void JumpTarget::Unuse() { | 72 void JumpTarget::Unuse() { |
| 73 // We should not deallocate jump targets that have unresolved jumps | 73 // We should not deallocate jump targets that have unresolved jumps |
| 74 // to them. In the event of a compile-time stack overflow or an | 74 // to them. In the event of a compile-time stack overflow or an |
| 75 // unitialized jump target, we don't care. | 75 // uninitialized jump target, we don't care. |
| 76 ASSERT(!is_linked() || cgen_ == NULL || cgen_->HasStackOverflow()); | 76 ASSERT(!is_linked() || cgen_ == NULL || cgen_->HasStackOverflow()); |
| 77 for (int i = 0; i < reaching_frames_.length(); i++) { | 77 for (int i = 0; i < reaching_frames_.length(); i++) { |
| 78 delete reaching_frames_[i]; | 78 delete reaching_frames_[i]; |
| 79 } | 79 } |
| 80 delete entry_frame_; | 80 delete entry_frame_; |
| 81 Reset(); | 81 Reset(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 | 84 |
| 85 void JumpTarget::Reset() { | 85 void JumpTarget::Reset() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 96 // Given a pair of non-null frame element pointers, return one of | 96 // Given a pair of non-null frame element pointers, return one of |
| 97 // them as an entry frame candidate or null if they are | 97 // them as an entry frame candidate or null if they are |
| 98 // incompatible. | 98 // incompatible. |
| 99 | 99 |
| 100 // If either is invalid, the result is. | 100 // If either is invalid, the result is. |
| 101 if (!left->is_valid()) return left; | 101 if (!left->is_valid()) return left; |
| 102 if (!right->is_valid()) return right; | 102 if (!right->is_valid()) return right; |
| 103 | 103 |
| 104 // If they have the same value, the result is the same. If either | 104 // If they have the same value, the result is the same. If either |
| 105 // is unsynced, the result is. | 105 // is unsynced, the result is. |
| 106 |
| 106 if (left->is_memory() && right->is_memory()) return left; | 107 if (left->is_memory() && right->is_memory()) return left; |
| 107 | 108 |
| 108 if (left->is_register() && right->is_register() && | 109 if (left->is_register() && right->is_register() && |
| 109 left->reg().is(right->reg())) { | 110 left->reg().is(right->reg())) { |
| 110 if (!left->is_synced()) { | 111 if (!left->is_synced()) { |
| 111 return left; | 112 return left; |
| 112 } else { | 113 } else { |
| 113 return right; | 114 return right; |
| 114 } | 115 } |
| 115 } | 116 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // entry frames for bidirectional jump targets. | 159 // entry frames for bidirectional jump targets. |
| 159 int high_water_mark = (mergable_elements == kAllElements) | 160 int high_water_mark = (mergable_elements == kAllElements) |
| 160 ? VirtualFrame::kIllegalIndex // All frame indices are above this. | 161 ? VirtualFrame::kIllegalIndex // All frame indices are above this. |
| 161 : length - mergable_elements - 1; // Top index if m_e == 0. | 162 : length - mergable_elements - 1; // Top index if m_e == 0. |
| 162 | 163 |
| 163 // Initially populate the list of elements based on the initial | 164 // Initially populate the list of elements based on the initial |
| 164 // frame. | 165 // frame. |
| 165 for (int i = 0; i < length; i++) { | 166 for (int i = 0; i < length; i++) { |
| 166 FrameElement element = initial_frame->elements_[i]; | 167 FrameElement element = initial_frame->elements_[i]; |
| 167 // We do not allow copies or constants in bidirectional frames. | 168 // We do not allow copies or constants in bidirectional frames. |
| 168 if (direction_ == BIDIRECTIONAL && | 169 if (direction_ == BIDIRECTIONAL && i > high_water_mark && |
| 169 i > high_water_mark && | |
| 170 (element.is_constant() || element.is_copy())) { | 170 (element.is_constant() || element.is_copy())) { |
| 171 elements.Add(NULL); | 171 elements.Add(NULL); |
| 172 } else { | 172 } else { |
| 173 elements.Add(&initial_frame->elements_[i]); | 173 elements.Add(&initial_frame->elements_[i]); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 // Compute elements based on the other reaching frames. | 177 // Compute elements based on the other reaching frames. |
| 178 if (reaching_frames_.length() > 1) { | 178 if (reaching_frames_.length() > 1) { |
| 179 for (int i = 0; i < length; i++) { | 179 for (int i = 0; i < length; i++) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 } else { | 264 } else { |
| 265 // The element is already determined. | 265 // The element is already determined. |
| 266 entry_frame_->elements_[i] = *elements[i]; | 266 entry_frame_->elements_[i] = *elements[i]; |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 | 269 |
| 270 // Set the copied flags in the frame to be exact. This assumes that | 270 // Set the copied flags in the frame to be exact. This assumes that |
| 271 // the backing store of copies is always lower in the frame. | 271 // the backing store of copies is always lower in the frame. |
| 272 // Set the register locations to their index in the frame. | 272 // Set the register locations to their index in the frame. |
| 273 for (int i = 0; i < length; i++) { | 273 for (int i = 0; i < length; i++) { |
| 274 FrameElement current = entry_frame_->elements_[i]; | 274 FrameElement* current = &entry_frame_->elements_[i]; |
| 275 entry_frame_->elements_[i].clear_copied(); | 275 current->clear_copied(); |
| 276 if (current.is_copy()) { | 276 if (current->is_copy()) { |
| 277 entry_frame_->elements_[current.index()].set_copied(); | 277 entry_frame_->elements_[current->index()].set_copied(); |
| 278 } else if (current.is_register()) { | 278 } else if (current->is_register()) { |
| 279 entry_frame_->register_locations_[current.reg().code()] = i; | 279 entry_frame_->register_locations_[current->reg().code()] = i; |
| 280 } |
| 281 |
| 282 if (direction_ == BIDIRECTIONAL && i >= high_water_mark) { |
| 283 current->set_static_type(StaticType::unknown()); |
| 284 } else { |
| 285 StaticType merged_type = reaching_frames_[0]->elements_[i].static_type(); |
| 286 for (int j = 1, n = reaching_frames_.length(); |
| 287 !merged_type.is_unknown() && j < n; |
| 288 j++) { |
| 289 merged_type = |
| 290 merged_type.merge(reaching_frames_[j]->elements_[i].static_type()); |
| 291 } |
| 292 current->set_static_type(merged_type); |
| 280 } | 293 } |
| 281 } | 294 } |
| 282 | 295 |
| 283 // Fill in the other fields of the entry frame. | 296 // Fill in the other fields of the entry frame. |
| 284 entry_frame_->local_count_ = initial_frame->local_count_; | 297 entry_frame_->local_count_ = initial_frame->local_count_; |
| 285 entry_frame_->frame_pointer_ = initial_frame->frame_pointer_; | 298 entry_frame_->frame_pointer_ = initial_frame->frame_pointer_; |
| 286 | 299 |
| 287 // The stack pointer is at the highest synced element or the base of | 300 // The stack pointer is at the highest synced element or the base of |
| 288 // the expression stack. | 301 // the expression stack. |
| 289 int stack_pointer = length - 1; | 302 int stack_pointer = length - 1; |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 temp.CopyTo(this); | 722 temp.CopyTo(this); |
| 710 temp.Reset(); // So the destructor does not deallocate virtual frames. | 723 temp.Reset(); // So the destructor does not deallocate virtual frames. |
| 711 | 724 |
| 712 #ifdef DEBUG | 725 #ifdef DEBUG |
| 713 is_shadowing_ = false; | 726 is_shadowing_ = false; |
| 714 #endif | 727 #endif |
| 715 } | 728 } |
| 716 | 729 |
| 717 | 730 |
| 718 } } // namespace v8::internal | 731 } } // namespace v8::internal |
| OLD | NEW |