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 4301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4312 ASSERT(current_block() != NULL); | 4312 ASSERT(current_block() != NULL); |
4313 HBasicBlock* loop_entry = BuildLoopEntry(stmt); | 4313 HBasicBlock* loop_entry = BuildLoopEntry(stmt); |
4314 | 4314 |
4315 BreakAndContinueInfo break_info(stmt); | 4315 BreakAndContinueInfo break_info(stmt); |
4316 CHECK_BAILOUT(VisitLoopBody(stmt, loop_entry, &break_info)); | 4316 CHECK_BAILOUT(VisitLoopBody(stmt, loop_entry, &break_info)); |
4317 HBasicBlock* body_exit = | 4317 HBasicBlock* body_exit = |
4318 JoinContinue(stmt, current_block(), break_info.continue_block()); | 4318 JoinContinue(stmt, current_block(), break_info.continue_block()); |
4319 HBasicBlock* loop_successor = NULL; | 4319 HBasicBlock* loop_successor = NULL; |
4320 if (body_exit != NULL && !stmt->cond()->ToBooleanIsTrue()) { | 4320 if (body_exit != NULL && !stmt->cond()->ToBooleanIsTrue()) { |
4321 set_current_block(body_exit); | 4321 set_current_block(body_exit); |
4322 // The block for a true condition, the actual predecessor block of the | |
4323 // back edge. | |
4324 body_exit = graph()->CreateBasicBlock(); | |
4325 loop_successor = graph()->CreateBasicBlock(); | 4322 loop_successor = graph()->CreateBasicBlock(); |
4326 CHECK_BAILOUT(VisitForControl(stmt->cond(), body_exit, loop_successor)); | 4323 if (stmt->cond()->ToBooleanIsFalse()) { |
4327 if (body_exit->HasPredecessor()) { | 4324 Goto(loop_successor); |
| 4325 body_exit = NULL; |
| 4326 } else { |
| 4327 // The block for a true condition, the actual predecessor block of the |
| 4328 // back edge. |
| 4329 body_exit = graph()->CreateBasicBlock(); |
| 4330 CHECK_BAILOUT(VisitForControl(stmt->cond(), body_exit, loop_successor)); |
| 4331 } |
| 4332 if (body_exit != NULL && body_exit->HasPredecessor()) { |
4328 body_exit->SetJoinId(stmt->BackEdgeId()); | 4333 body_exit->SetJoinId(stmt->BackEdgeId()); |
4329 } else { | 4334 } else { |
4330 body_exit = NULL; | 4335 body_exit = NULL; |
4331 } | 4336 } |
4332 if (loop_successor->HasPredecessor()) { | 4337 if (loop_successor->HasPredecessor()) { |
4333 loop_successor->SetJoinId(stmt->ExitId()); | 4338 loop_successor->SetJoinId(stmt->ExitId()); |
4334 } else { | 4339 } else { |
4335 loop_successor = NULL; | 4340 loop_successor = NULL; |
4336 } | 4341 } |
4337 } | 4342 } |
(...skipping 6606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10944 if (ShouldProduceTraceOutput()) { | 10949 if (ShouldProduceTraceOutput()) { |
10945 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10950 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
10946 } | 10951 } |
10947 | 10952 |
10948 #ifdef DEBUG | 10953 #ifdef DEBUG |
10949 graph_->Verify(false); // No full verify. | 10954 graph_->Verify(false); // No full verify. |
10950 #endif | 10955 #endif |
10951 } | 10956 } |
10952 | 10957 |
10953 } } // namespace v8::internal | 10958 } } // namespace v8::internal |
OLD | NEW |