| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include <map> | 5 #include <map> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "vm/kernel_to_il.h" | 9 #include "vm/kernel_to_il.h" |
| 10 | 10 |
| (...skipping 5582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5593 fragment_ = loop; | 5593 fragment_ = loop; |
| 5594 } | 5594 } |
| 5595 | 5595 |
| 5596 | 5596 |
| 5597 void FlowGraphBuilder::VisitForInStatement(ForInStatement* node) { | 5597 void FlowGraphBuilder::VisitForInStatement(ForInStatement* node) { |
| 5598 Fragment instructions = TranslateExpression(node->iterable()); | 5598 Fragment instructions = TranslateExpression(node->iterable()); |
| 5599 instructions += PushArgument(); | 5599 instructions += PushArgument(); |
| 5600 | 5600 |
| 5601 const dart::String& iterator_getter = dart::String::ZoneHandle( | 5601 const dart::String& iterator_getter = dart::String::ZoneHandle( |
| 5602 Z, dart::Field::GetterSymbol(Symbols::Iterator())); | 5602 Z, dart::Field::GetterSymbol(Symbols::Iterator())); |
| 5603 instructions += | 5603 instructions += InstanceCall(node->iterable()->position(), iterator_getter, |
| 5604 InstanceCall(TokenPosition::kNoSource, iterator_getter, Token::kGET, 1); | 5604 Token::kGET, 1); |
| 5605 LocalVariable* iterator = scopes_->iterator_variables[for_in_depth_]; | 5605 LocalVariable* iterator = scopes_->iterator_variables[for_in_depth_]; |
| 5606 instructions += StoreLocal(TokenPosition::kNoSource, iterator); | 5606 instructions += StoreLocal(TokenPosition::kNoSource, iterator); |
| 5607 instructions += Drop(); | 5607 instructions += Drop(); |
| 5608 | 5608 |
| 5609 ++for_in_depth_; | 5609 ++for_in_depth_; |
| 5610 ++loop_depth_; | 5610 ++loop_depth_; |
| 5611 Fragment condition = LoadLocal(iterator); | 5611 Fragment condition = LoadLocal(iterator); |
| 5612 condition += PushArgument(); | 5612 condition += PushArgument(); |
| 5613 condition += InstanceCall(TokenPosition::kNoSource, Symbols::MoveNext(), | 5613 condition += InstanceCall(node->iterable()->position(), Symbols::MoveNext(), |
| 5614 Token::kILLEGAL, 1); | 5614 Token::kILLEGAL, 1); |
| 5615 TargetEntryInstr* body_entry; | 5615 TargetEntryInstr* body_entry; |
| 5616 TargetEntryInstr* loop_exit; | 5616 TargetEntryInstr* loop_exit; |
| 5617 condition += BranchIfTrue(&body_entry, &loop_exit); | 5617 condition += BranchIfTrue(&body_entry, &loop_exit); |
| 5618 | 5618 |
| 5619 Fragment body(body_entry); | 5619 Fragment body(body_entry); |
| 5620 body += EnterScope(node); | 5620 body += EnterScope(node); |
| 5621 body += LoadLocal(iterator); | 5621 body += LoadLocal(iterator); |
| 5622 body += PushArgument(); | 5622 body += PushArgument(); |
| 5623 const dart::String& current_getter = dart::String::ZoneHandle( | 5623 const dart::String& current_getter = dart::String::ZoneHandle( |
| 5624 Z, dart::Field::GetterSymbol(Symbols::Current())); | 5624 Z, dart::Field::GetterSymbol(Symbols::Current())); |
| 5625 body += | 5625 body += InstanceCall(node->position(), current_getter, Token::kGET, 1); |
| 5626 InstanceCall(TokenPosition::kNoSource, current_getter, Token::kGET, 1); | |
| 5627 body += | 5626 body += |
| 5628 StoreLocal(TokenPosition::kNoSource, LookupVariable(node->variable())); | 5627 StoreLocal(TokenPosition::kNoSource, LookupVariable(node->variable())); |
| 5629 body += Drop(); | 5628 body += Drop(); |
| 5630 body += TranslateStatement(node->body()); | 5629 body += TranslateStatement(node->body()); |
| 5631 body += ExitScope(node); | 5630 body += ExitScope(node); |
| 5632 | 5631 |
| 5633 if (body.is_open()) { | 5632 if (body.is_open()) { |
| 5634 JoinEntryInstr* join = BuildJoinEntry(); | 5633 JoinEntryInstr* join = BuildJoinEntry(); |
| 5635 instructions += Goto(join); | 5634 instructions += Goto(join); |
| 5636 body += Goto(join); | 5635 body += Goto(join); |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6444 thread->clear_sticky_error(); | 6443 thread->clear_sticky_error(); |
| 6445 return error.raw(); | 6444 return error.raw(); |
| 6446 } | 6445 } |
| 6447 } | 6446 } |
| 6448 | 6447 |
| 6449 | 6448 |
| 6450 } // namespace kernel | 6449 } // namespace kernel |
| 6451 } // namespace dart | 6450 } // namespace dart |
| 6452 | 6451 |
| 6453 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 6452 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |