| 40 | } |
| 41 | |
| 42 | const ExpressionStep* ExecutionFrame::Next() { |
| 43 | while (true) { |
| 44 | const size_t end_pos = execution_path_.size(); |
| 45 | |
| 46 | if (ABSL_PREDICT_TRUE(pc_ < end_pos)) { |
| 47 | const auto* step = execution_path_[pc_++].get(); |
| 48 | ABSL_ASSUME(step != nullptr); |
| 49 | return step; |
| 50 | } |
| 51 | if (ABSL_PREDICT_TRUE(pc_ == end_pos)) { |
| 52 | if (!call_stack_.empty()) { |
| 53 | SubFrame& subframe = call_stack_.back(); |
| 54 | pc_ = subframe.return_pc; |
| 55 | execution_path_ = subframe.return_expression; |
| 56 | ABSL_DCHECK_EQ(value_stack().size(), subframe.expected_stack_size); |
| 57 | comprehension_slots().Set(subframe.slot_index, value_stack().Peek(), |
| 58 | value_stack().PeekAttribute()); |
| 59 | call_stack_.pop_back(); |
| 60 | continue; |
| 61 | } |
| 62 | } else { |
| 63 | ABSL_LOG(ERROR) << "Attempting to step beyond the end of execution path."; |
| 64 | } |
| 65 | return nullptr; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | namespace { |
| 70 | |