OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/interpreter/bytecode-generator.h" | 5 #include "src/interpreter/bytecode-generator.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/interpreter/control-flow-builders.h" | 8 #include "src/interpreter/control-flow-builders.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 #include "src/parser.h" | 10 #include "src/parser.h" |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 loop_builder.SetContinueTarget(condition_label); | 651 loop_builder.SetContinueTarget(condition_label); |
652 } | 652 } |
653 | 653 |
654 | 654 |
655 void BytecodeGenerator::VisitWhileStatement(WhileStatement* stmt) { | 655 void BytecodeGenerator::VisitWhileStatement(WhileStatement* stmt) { |
656 LoopBuilder loop_builder(builder()); | 656 LoopBuilder loop_builder(builder()); |
657 ControlScopeForIteration execution_control(this, stmt, &loop_builder); | 657 ControlScopeForIteration execution_control(this, stmt, &loop_builder); |
658 | 658 |
659 BytecodeLabel body_label, condition_label, done_label; | 659 BytecodeLabel body_label, condition_label, done_label; |
660 if (stmt->cond()->ToBooleanIsFalse()) { | 660 if (stmt->cond()->ToBooleanIsFalse()) { |
661 // If the condition is false there is no need to generating the loop. | 661 // If the condition is false there is no need to generate the loop. |
662 return; | 662 return; |
663 } | 663 } |
664 | 664 |
665 if (!stmt->cond()->ToBooleanIsTrue()) { | 665 if (!stmt->cond()->ToBooleanIsTrue()) { |
666 builder()->Jump(&condition_label); | 666 builder()->Jump(&condition_label); |
667 } | 667 } |
668 builder()->Bind(&body_label); | 668 builder()->Bind(&body_label); |
669 Visit(stmt->body()); | 669 Visit(stmt->body()); |
670 | 670 |
671 builder()->Bind(&condition_label); | 671 builder()->Bind(&condition_label); |
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2160 } | 2160 } |
2161 | 2161 |
2162 | 2162 |
2163 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 2163 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
2164 return info()->feedback_vector()->GetIndex(slot); | 2164 return info()->feedback_vector()->GetIndex(slot); |
2165 } | 2165 } |
2166 | 2166 |
2167 } // namespace interpreter | 2167 } // namespace interpreter |
2168 } // namespace internal | 2168 } // namespace internal |
2169 } // namespace v8 | 2169 } // namespace v8 |
OLD | NEW |