| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 "vm/ast_transformer.h" | 5 #include "vm/ast_transformer.h" |
| 6 | 6 |
| 7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
| 8 #include "vm/parser.h" | 8 #include "vm/parser.h" |
| 9 #include "vm/thread.h" | 9 #include "vm/thread.h" |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 #define DEFINE_UNREACHABLE(BaseName) \ | 39 #define DEFINE_UNREACHABLE(BaseName) \ |
| 40 void AwaitTransformer::Visit##BaseName##Node(BaseName##Node* node) { \ | 40 void AwaitTransformer::Visit##BaseName##Node(BaseName##Node* node) { \ |
| 41 UNREACHABLE(); \ | 41 UNREACHABLE(); \ |
| 42 } | 42 } |
| 43 | 43 |
| 44 FOR_EACH_UNREACHABLE_NODE(DEFINE_UNREACHABLE) | 44 FOR_EACH_UNREACHABLE_NODE(DEFINE_UNREACHABLE) |
| 45 #undef DEFINE_UNREACHABLE | 45 #undef DEFINE_UNREACHABLE |
| 46 | 46 |
| 47 AwaitTransformer::AwaitTransformer(SequenceNode* preamble, | 47 AwaitTransformer::AwaitTransformer(SequenceNode* preamble, |
| 48 ParsedFunction* const parsed_function, | 48 const ParsedFunction& parsed_function, |
| 49 LocalScope* function_top) | 49 LocalScope* function_top) |
| 50 : preamble_(preamble), | 50 : preamble_(preamble), |
| 51 temp_cnt_(0), | 51 temp_cnt_(0), |
| 52 parsed_function_(parsed_function), | 52 parsed_function_(parsed_function), |
| 53 function_top_(function_top), | 53 function_top_(function_top), |
| 54 thread_(Thread::Current()) { | 54 thread_(Thread::Current()) { |
| 55 ASSERT(function_top_ != NULL); | 55 ASSERT(function_top_ != NULL); |
| 56 } | 56 } |
| 57 | 57 |
| 58 | 58 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 Scanner::kNoSourcePos, | 205 Scanner::kNoSourcePos, |
| 206 async_catch_helper, | 206 async_catch_helper, |
| 207 catch_helper_args)); | 207 catch_helper_args)); |
| 208 ReturnNode* continuation_return = new(Z) ReturnNode(Scanner::kNoSourcePos); | 208 ReturnNode* continuation_return = new(Z) ReturnNode(Scanner::kNoSourcePos); |
| 209 continuation_return->set_return_type(ReturnNode::kContinuationTarget); | 209 continuation_return->set_return_type(ReturnNode::kContinuationTarget); |
| 210 preamble_->Add(continuation_return); | 210 preamble_->Add(continuation_return); |
| 211 | 211 |
| 212 // If this expression is part of a try block, also append the code for | 212 // If this expression is part of a try block, also append the code for |
| 213 // restoring the saved try context that lives on the stack. | 213 // restoring the saved try context that lives on the stack. |
| 214 const String& async_saved_try_ctx_name = | 214 const String& async_saved_try_ctx_name = |
| 215 String::Handle(Z, parsed_function_->async_saved_try_ctx_name()); | 215 String::Handle(Z, parsed_function_.async_saved_try_ctx_name()); |
| 216 if (!async_saved_try_ctx_name.IsNull()) { | 216 if (!async_saved_try_ctx_name.IsNull()) { |
| 217 LocalVariable* async_saved_try_ctx = | 217 LocalVariable* async_saved_try_ctx = |
| 218 GetVariableInScope(preamble_->scope(), async_saved_try_ctx_name); | 218 GetVariableInScope(preamble_->scope(), async_saved_try_ctx_name); |
| 219 preamble_->Add(new (Z) StoreLocalNode( | 219 preamble_->Add(new (Z) StoreLocalNode( |
| 220 Scanner::kNoSourcePos, | 220 Scanner::kNoSourcePos, |
| 221 parsed_function_->saved_try_ctx(), | 221 parsed_function_.saved_try_ctx(), |
| 222 new (Z) LoadLocalNode(Scanner::kNoSourcePos, async_saved_try_ctx))); | 222 new (Z) LoadLocalNode(Scanner::kNoSourcePos, async_saved_try_ctx))); |
| 223 } | 223 } |
| 224 | 224 |
| 225 LoadLocalNode* load_error_param = new (Z) LoadLocalNode( | 225 LoadLocalNode* load_error_param = new (Z) LoadLocalNode( |
| 226 Scanner::kNoSourcePos, error_param); | 226 Scanner::kNoSourcePos, error_param); |
| 227 SequenceNode* error_ne_null_branch = new (Z) SequenceNode( | 227 SequenceNode* error_ne_null_branch = new (Z) SequenceNode( |
| 228 Scanner::kNoSourcePos, ChainNewScope(preamble_->scope())); | 228 Scanner::kNoSourcePos, ChainNewScope(preamble_->scope())); |
| 229 error_ne_null_branch->Add(new (Z) ThrowNode( | 229 error_ne_null_branch->Add(new (Z) ThrowNode( |
| 230 Scanner::kNoSourcePos, | 230 Scanner::kNoSourcePos, |
| 231 load_error_param, | 231 load_error_param, |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 void AwaitTransformer::VisitThrowNode(ThrowNode* node) { | 595 void AwaitTransformer::VisitThrowNode(ThrowNode* node) { |
| 596 // TODO(mlippautz): Check if relevant. | 596 // TODO(mlippautz): Check if relevant. |
| 597 AstNode* new_exception = Transform(node->exception()); | 597 AstNode* new_exception = Transform(node->exception()); |
| 598 AstNode* new_stacktrace = Transform(node->stacktrace()); | 598 AstNode* new_stacktrace = Transform(node->stacktrace()); |
| 599 result_ = new(Z) ThrowNode(node->token_pos(), | 599 result_ = new(Z) ThrowNode(node->token_pos(), |
| 600 new_exception, | 600 new_exception, |
| 601 new_stacktrace); | 601 new_stacktrace); |
| 602 } | 602 } |
| 603 | 603 |
| 604 } // namespace dart | 604 } // namespace dart |
| OLD | NEW |