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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/interpreter/bytecode-flags.h" | 10 #include "src/interpreter/bytecode-flags.h" |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 void BytecodeGenerator::VisitIterationBody(IterationStatement* stmt, | 1045 void BytecodeGenerator::VisitIterationBody(IterationStatement* stmt, |
1046 LoopBuilder* loop_builder) { | 1046 LoopBuilder* loop_builder) { |
1047 ControlScopeForIteration execution_control(this, stmt, loop_builder); | 1047 ControlScopeForIteration execution_control(this, stmt, loop_builder); |
1048 builder()->StackCheck(stmt->position()); | 1048 builder()->StackCheck(stmt->position()); |
1049 Visit(stmt->body()); | 1049 Visit(stmt->body()); |
1050 loop_builder->SetContinueTarget(); | 1050 loop_builder->SetContinueTarget(); |
1051 } | 1051 } |
1052 | 1052 |
1053 void BytecodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) { | 1053 void BytecodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) { |
1054 LoopBuilder loop_builder(builder()); | 1054 LoopBuilder loop_builder(builder()); |
1055 VisitIterationHeader(stmt, &loop_builder); | |
1056 if (stmt->cond()->ToBooleanIsFalse()) { | 1055 if (stmt->cond()->ToBooleanIsFalse()) { |
1057 VisitIterationBody(stmt, &loop_builder); | 1056 VisitIterationBody(stmt, &loop_builder); |
1058 } else if (stmt->cond()->ToBooleanIsTrue()) { | 1057 } else if (stmt->cond()->ToBooleanIsTrue()) { |
| 1058 VisitIterationHeader(stmt, &loop_builder); |
1059 VisitIterationBody(stmt, &loop_builder); | 1059 VisitIterationBody(stmt, &loop_builder); |
1060 loop_builder.JumpToHeader(); | 1060 loop_builder.JumpToHeader(); |
1061 } else { | 1061 } else { |
| 1062 VisitIterationHeader(stmt, &loop_builder); |
1062 VisitIterationBody(stmt, &loop_builder); | 1063 VisitIterationBody(stmt, &loop_builder); |
1063 builder()->SetExpressionAsStatementPosition(stmt->cond()); | 1064 builder()->SetExpressionAsStatementPosition(stmt->cond()); |
1064 VisitForAccumulatorValue(stmt->cond()); | 1065 VisitForAccumulatorValue(stmt->cond()); |
1065 loop_builder.JumpToHeaderIfTrue(); | 1066 loop_builder.JumpToHeaderIfTrue(); |
1066 } | 1067 } |
1067 loop_builder.EndLoop(); | 1068 loop_builder.EndLoop(); |
1068 } | 1069 } |
1069 | 1070 |
1070 void BytecodeGenerator::VisitWhileStatement(WhileStatement* stmt) { | 1071 void BytecodeGenerator::VisitWhileStatement(WhileStatement* stmt) { |
1071 if (stmt->cond()->ToBooleanIsFalse()) { | 1072 if (stmt->cond()->ToBooleanIsFalse()) { |
(...skipping 2164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3236 return execution_context()->scope()->language_mode(); | 3237 return execution_context()->scope()->language_mode(); |
3237 } | 3238 } |
3238 | 3239 |
3239 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3240 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
3240 return TypeFeedbackVector::GetIndex(slot); | 3241 return TypeFeedbackVector::GetIndex(slot); |
3241 } | 3242 } |
3242 | 3243 |
3243 } // namespace interpreter | 3244 } // namespace interpreter |
3244 } // namespace internal | 3245 } // namespace internal |
3245 } // namespace v8 | 3246 } // namespace v8 |
OLD | NEW |