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-register-allocator.h" | 10 #include "src/interpreter/bytecode-register-allocator.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 explicit ControlScopeForTopLevel(BytecodeGenerator* generator) | 207 explicit ControlScopeForTopLevel(BytecodeGenerator* generator) |
208 : ControlScope(generator) {} | 208 : ControlScope(generator) {} |
209 | 209 |
210 protected: | 210 protected: |
211 bool Execute(Command command, Statement* statement) override { | 211 bool Execute(Command command, Statement* statement) override { |
212 switch (command) { | 212 switch (command) { |
213 case CMD_BREAK: // We should never see break/continue in top-level. | 213 case CMD_BREAK: // We should never see break/continue in top-level. |
214 case CMD_CONTINUE: | 214 case CMD_CONTINUE: |
215 UNREACHABLE(); | 215 UNREACHABLE(); |
216 case CMD_RETURN: | 216 case CMD_RETURN: |
217 generator()->builder()->SetReturnPosition(); | |
218 generator()->builder()->Return(); | 217 generator()->builder()->Return(); |
219 return true; | 218 return true; |
220 case CMD_RETHROW: | 219 case CMD_RETHROW: |
221 generator()->builder()->ReThrow(); | 220 generator()->builder()->ReThrow(); |
222 return true; | 221 return true; |
223 } | 222 } |
224 return false; | 223 return false; |
225 } | 224 } |
226 }; | 225 }; |
227 | 226 |
(...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2282 Register done = register_allocator()->NextConsecutiveRegister(); | 2281 Register done = register_allocator()->NextConsecutiveRegister(); |
2283 builder() | 2282 builder() |
2284 ->MoveRegister(input, value) | 2283 ->MoveRegister(input, value) |
2285 .LoadTrue() | 2284 .LoadTrue() |
2286 .StoreAccumulatorInRegister(done) | 2285 .StoreAccumulatorInRegister(done) |
2287 .CallRuntime(Runtime::kInlineCreateIterResultObject, value, 2); | 2286 .CallRuntime(Runtime::kInlineCreateIterResultObject, value, 2); |
2288 execution_control()->ReturnAccumulator(); | 2287 execution_control()->ReturnAccumulator(); |
2289 } | 2288 } |
2290 | 2289 |
2291 builder()->Bind(&resume_with_throw); | 2290 builder()->Bind(&resume_with_throw); |
| 2291 builder()->SetExpressionPosition(expr); |
2292 builder()->LoadAccumulatorWithRegister(input).Throw(); | 2292 builder()->LoadAccumulatorWithRegister(input).Throw(); |
2293 | 2293 |
2294 builder()->Bind(&resume_with_next); | 2294 builder()->Bind(&resume_with_next); |
2295 builder()->LoadAccumulatorWithRegister(input); | 2295 builder()->LoadAccumulatorWithRegister(input); |
2296 } | 2296 } |
2297 execution_result()->SetResultInAccumulator(); | 2297 execution_result()->SetResultInAccumulator(); |
2298 } | 2298 } |
2299 | 2299 |
2300 void BytecodeGenerator::VisitThrow(Throw* expr) { | 2300 void BytecodeGenerator::VisitThrow(Throw* expr) { |
2301 VisitForAccumulatorValue(expr->exception()); | 2301 VisitForAccumulatorValue(expr->exception()); |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3196 return execution_context()->scope()->language_mode(); | 3196 return execution_context()->scope()->language_mode(); |
3197 } | 3197 } |
3198 | 3198 |
3199 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3199 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
3200 return TypeFeedbackVector::GetIndex(slot); | 3200 return TypeFeedbackVector::GetIndex(slot); |
3201 } | 3201 } |
3202 | 3202 |
3203 } // namespace interpreter | 3203 } // namespace interpreter |
3204 } // namespace internal | 3204 } // namespace internal |
3205 } // namespace v8 | 3205 } // namespace v8 |
OLD | NEW |