| 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 4898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4909 void FlowGraphBuilder::VisitEmptyStatement(EmptyStatement* node) { | 4909 void FlowGraphBuilder::VisitEmptyStatement(EmptyStatement* node) { |
| 4910 fragment_ = Fragment(); | 4910 fragment_ = Fragment(); |
| 4911 } | 4911 } |
| 4912 | 4912 |
| 4913 | 4913 |
| 4914 void FlowGraphBuilder::VisitBlock(Block* node) { | 4914 void FlowGraphBuilder::VisitBlock(Block* node) { |
| 4915 Fragment instructions; | 4915 Fragment instructions; |
| 4916 | 4916 |
| 4917 instructions += EnterScope(node); | 4917 instructions += EnterScope(node); |
| 4918 List<Statement>& statements = node->statements(); | 4918 List<Statement>& statements = node->statements(); |
| 4919 for (intptr_t i = 0; i < statements.length(); ++i) { | 4919 for (intptr_t i = 0; (i < statements.length()) && instructions.is_open(); |
| 4920 ++i) { |
| 4920 instructions += TranslateStatement(statements[i]); | 4921 instructions += TranslateStatement(statements[i]); |
| 4921 } | 4922 } |
| 4922 instructions += ExitScope(node); | 4923 instructions += ExitScope(node); |
| 4923 | 4924 |
| 4924 fragment_ = instructions; | 4925 fragment_ = instructions; |
| 4925 } | 4926 } |
| 4926 | 4927 |
| 4927 | 4928 |
| 4928 void FlowGraphBuilder::VisitReturnStatement(ReturnStatement* node) { | 4929 void FlowGraphBuilder::VisitReturnStatement(ReturnStatement* node) { |
| 4929 bool inside_try_finally = try_finally_block_ != NULL; | 4930 bool inside_try_finally = try_finally_block_ != NULL; |
| 4930 | 4931 |
| 4931 Fragment instructions = node->expression() == NULL | 4932 Fragment instructions = node->expression() == NULL |
| 4932 ? NullConstant() | 4933 ? NullConstant() |
| 4933 : TranslateExpression(node->expression()); | 4934 : TranslateExpression(node->expression()); |
| 4934 if (inside_try_finally) { | 4935 if (instructions.is_open()) { |
| 4935 ASSERT(scopes_->finally_return_variable != NULL); | 4936 if (inside_try_finally) { |
| 4936 instructions += StoreLocal(scopes_->finally_return_variable); | 4937 ASSERT(scopes_->finally_return_variable != NULL); |
| 4937 instructions += Drop(); | 4938 instructions += StoreLocal(scopes_->finally_return_variable); |
| 4938 instructions += TranslateFinallyFinalizers(NULL, -1); | 4939 instructions += Drop(); |
| 4939 if (instructions.is_open()) { | 4940 instructions += TranslateFinallyFinalizers(NULL, -1); |
| 4940 instructions += LoadLocal(scopes_->finally_return_variable); | 4941 if (instructions.is_open()) { |
| 4942 instructions += LoadLocal(scopes_->finally_return_variable); |
| 4943 instructions += Return(); |
| 4944 } |
| 4945 } else { |
| 4941 instructions += Return(); | 4946 instructions += Return(); |
| 4942 } | 4947 } |
| 4943 } else { | |
| 4944 instructions += Return(); | |
| 4945 } | 4948 } |
| 4946 fragment_ = instructions; | 4949 fragment_ = instructions; |
| 4947 } | 4950 } |
| 4948 | 4951 |
| 4949 | 4952 |
| 4950 void FlowGraphBuilder::VisitExpressionStatement(ExpressionStatement* node) { | 4953 void FlowGraphBuilder::VisitExpressionStatement(ExpressionStatement* node) { |
| 4951 Fragment instructions = TranslateExpression(node->expression()); | 4954 Fragment instructions = TranslateExpression(node->expression()); |
| 4952 instructions += Drop(); | 4955 instructions += Drop(); |
| 4953 fragment_ = instructions; | 4956 fragment_ = instructions; |
| 4954 } | 4957 } |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5802 instructions += LoadLocal(parsed_function_->current_context_var()); | 5805 instructions += LoadLocal(parsed_function_->current_context_var()); |
| 5803 instructions += StoreInstanceField(Closure::context_offset()); | 5806 instructions += StoreInstanceField(Closure::context_offset()); |
| 5804 | 5807 |
| 5805 return instructions; | 5808 return instructions; |
| 5806 } | 5809 } |
| 5807 | 5810 |
| 5808 | 5811 |
| 5809 } // namespace kernel | 5812 } // namespace kernel |
| 5810 } // namespace dart | 5813 } // namespace dart |
| 5811 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 5814 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |