OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 bool HBasicBlock::Dominates(HBasicBlock* other) const { | 295 bool HBasicBlock::Dominates(HBasicBlock* other) const { |
296 HBasicBlock* current = other->dominator(); | 296 HBasicBlock* current = other->dominator(); |
297 while (current != NULL) { | 297 while (current != NULL) { |
298 if (current == this) return true; | 298 if (current == this) return true; |
299 current = current->dominator(); | 299 current = current->dominator(); |
300 } | 300 } |
301 return false; | 301 return false; |
302 } | 302 } |
303 | 303 |
304 | 304 |
| 305 bool HBasicBlock::EqualToOrDominates(HBasicBlock* other) const { |
| 306 if (this == other) return true; |
| 307 return Dominates(other); |
| 308 } |
| 309 |
| 310 |
305 int HBasicBlock::LoopNestingDepth() const { | 311 int HBasicBlock::LoopNestingDepth() const { |
306 const HBasicBlock* current = this; | 312 const HBasicBlock* current = this; |
307 int result = (current->IsLoopHeader()) ? 1 : 0; | 313 int result = (current->IsLoopHeader()) ? 1 : 0; |
308 while (current->parent_loop_header() != NULL) { | 314 while (current->parent_loop_header() != NULL) { |
309 current = current->parent_loop_header(); | 315 current = current->parent_loop_header(); |
310 result++; | 316 result++; |
311 } | 317 } |
312 return result; | 318 return result; |
313 } | 319 } |
314 | 320 |
(...skipping 3593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3908 | 3914 |
3909 #ifdef DEBUG | 3915 #ifdef DEBUG |
3910 for (int i = 0; i < block->phis()->length(); i++) { | 3916 for (int i = 0; i < block->phis()->length(); i++) { |
3911 HPhi* phi = block->phis()->at(i); | 3917 HPhi* phi = block->phis()->at(i); |
3912 ASSERT(phi->ActualValue() == phi); | 3918 ASSERT(phi->ActualValue() == phi); |
3913 } | 3919 } |
3914 #endif | 3920 #endif |
3915 | 3921 |
3916 for (HInstructionIterator it(block); !it.Done(); it.Advance()) { | 3922 for (HInstructionIterator it(block); !it.Done(); it.Advance()) { |
3917 HInstruction* instruction = it.Current(); | 3923 HInstruction* instruction = it.Current(); |
3918 if (instruction->ActualValue() != instruction) { | 3924 if (instruction->CheckFlag(HValue::kIsDead)) { |
| 3925 // The instruction was marked as deleted but left in the graph |
| 3926 // as a control flow dependency point for subsequent |
| 3927 // instructions. |
| 3928 instruction->DeleteAndReplaceWith(instruction->ActualValue()); |
| 3929 |
| 3930 } else if (instruction->ActualValue() != instruction) { |
3919 ASSERT(instruction->IsInformativeDefinition()); | 3931 ASSERT(instruction->IsInformativeDefinition()); |
3920 if (instruction->IsPurelyInformativeDefinition()) { | 3932 if (instruction->IsPurelyInformativeDefinition()) { |
3921 instruction->DeleteAndReplaceWith(instruction->RedefinedOperand()); | 3933 instruction->DeleteAndReplaceWith(instruction->RedefinedOperand()); |
3922 } else { | 3934 } else { |
3923 instruction->ReplaceAllUsesWith(instruction->ActualValue()); | 3935 instruction->ReplaceAllUsesWith(instruction->ActualValue()); |
3924 } | 3936 } |
3925 } | 3937 } |
3926 } | 3938 } |
3927 } | 3939 } |
3928 } | 3940 } |
(...skipping 7077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11006 if (ShouldProduceTraceOutput()) { | 11018 if (ShouldProduceTraceOutput()) { |
11007 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11019 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11008 } | 11020 } |
11009 | 11021 |
11010 #ifdef DEBUG | 11022 #ifdef DEBUG |
11011 graph_->Verify(false); // No full verify. | 11023 graph_->Verify(false); // No full verify. |
11012 #endif | 11024 #endif |
11013 } | 11025 } |
11014 | 11026 |
11015 } } // namespace v8::internal | 11027 } } // namespace v8::internal |
OLD | NEW |