| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 bool HBasicBlock::Dominates(HBasicBlock* other) const { | 213 bool HBasicBlock::Dominates(HBasicBlock* other) const { |
| 214 HBasicBlock* current = other->dominator(); | 214 HBasicBlock* current = other->dominator(); |
| 215 while (current != NULL) { | 215 while (current != NULL) { |
| 216 if (current == this) return true; | 216 if (current == this) return true; |
| 217 current = current->dominator(); | 217 current = current->dominator(); |
| 218 } | 218 } |
| 219 return false; | 219 return false; |
| 220 } | 220 } |
| 221 | 221 |
| 222 | 222 |
| 223 int HBasicBlock::LoopNestingDepth() const { |
| 224 const HBasicBlock* current = this; |
| 225 int result = (current->IsLoopHeader()) ? 1 : 0; |
| 226 while (current->parent_loop_header() != NULL) { |
| 227 current = current->parent_loop_header(); |
| 228 result++; |
| 229 } |
| 230 return result; |
| 231 } |
| 232 |
| 233 |
| 223 void HBasicBlock::PostProcessLoopHeader(IterationStatement* stmt) { | 234 void HBasicBlock::PostProcessLoopHeader(IterationStatement* stmt) { |
| 224 ASSERT(IsLoopHeader()); | 235 ASSERT(IsLoopHeader()); |
| 225 | 236 |
| 226 SetJoinId(stmt->EntryId()); | 237 SetJoinId(stmt->EntryId()); |
| 227 if (predecessors()->length() == 1) { | 238 if (predecessors()->length() == 1) { |
| 228 // This is a degenerated loop. | 239 // This is a degenerated loop. |
| 229 DetachLoopInformation(); | 240 DetachLoopInformation(); |
| 230 return; | 241 return; |
| 231 } | 242 } |
| 232 | 243 |
| (...skipping 6327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6560 trace_.Add("\n"); | 6571 trace_.Add("\n"); |
| 6561 } | 6572 } |
| 6562 | 6573 |
| 6563 PrintEmptyProperty("xhandlers"); | 6574 PrintEmptyProperty("xhandlers"); |
| 6564 PrintEmptyProperty("flags"); | 6575 PrintEmptyProperty("flags"); |
| 6565 | 6576 |
| 6566 if (current->dominator() != NULL) { | 6577 if (current->dominator() != NULL) { |
| 6567 PrintBlockProperty("dominator", current->dominator()->block_id()); | 6578 PrintBlockProperty("dominator", current->dominator()->block_id()); |
| 6568 } | 6579 } |
| 6569 | 6580 |
| 6581 PrintIntProperty("loop_depth", current->LoopNestingDepth()); |
| 6582 |
| 6570 if (chunk != NULL) { | 6583 if (chunk != NULL) { |
| 6571 int first_index = current->first_instruction_index(); | 6584 int first_index = current->first_instruction_index(); |
| 6572 int last_index = current->last_instruction_index(); | 6585 int last_index = current->last_instruction_index(); |
| 6573 PrintIntProperty( | 6586 PrintIntProperty( |
| 6574 "first_lir_id", | 6587 "first_lir_id", |
| 6575 LifetimePosition::FromInstructionIndex(first_index).Value()); | 6588 LifetimePosition::FromInstructionIndex(first_index).Value()); |
| 6576 PrintIntProperty( | 6589 PrintIntProperty( |
| 6577 "last_lir_id", | 6590 "last_lir_id", |
| 6578 LifetimePosition::FromInstructionIndex(last_index).Value()); | 6591 LifetimePosition::FromInstructionIndex(last_index).Value()); |
| 6579 } | 6592 } |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6810 } | 6823 } |
| 6811 } | 6824 } |
| 6812 | 6825 |
| 6813 #ifdef DEBUG | 6826 #ifdef DEBUG |
| 6814 if (graph_ != NULL) graph_->Verify(); | 6827 if (graph_ != NULL) graph_->Verify(); |
| 6815 if (allocator_ != NULL) allocator_->Verify(); | 6828 if (allocator_ != NULL) allocator_->Verify(); |
| 6816 #endif | 6829 #endif |
| 6817 } | 6830 } |
| 6818 | 6831 |
| 6819 } } // namespace v8::internal | 6832 } } // namespace v8::internal |
| OLD | NEW |