OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
6 | 6 |
7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 2393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2404 ReturnDefinition(new(Z) ConstantInstr(closure)); | 2404 ReturnDefinition(new(Z) ConstantInstr(closure)); |
2405 return; | 2405 return; |
2406 } | 2406 } |
2407 | 2407 |
2408 const bool is_implicit = function.IsImplicitInstanceClosureFunction(); | 2408 const bool is_implicit = function.IsImplicitInstanceClosureFunction(); |
2409 ASSERT(is_implicit || function.IsNonImplicitClosureFunction()); | 2409 ASSERT(is_implicit || function.IsNonImplicitClosureFunction()); |
2410 // The context scope may have already been set by the non-optimizing | 2410 // The context scope may have already been set by the non-optimizing |
2411 // compiler. If it was not, set it here. | 2411 // compiler. If it was not, set it here. |
2412 if (function.context_scope() == ContextScope::null()) { | 2412 if (function.context_scope() == ContextScope::null()) { |
2413 ASSERT(!is_implicit); | 2413 ASSERT(!is_implicit); |
2414 ASSERT(node->scope() != NULL); | |
2415 const ContextScope& context_scope = ContextScope::ZoneHandle( | 2414 const ContextScope& context_scope = ContextScope::ZoneHandle( |
2416 Z, node->scope()->PreserveOuterScope(owner()->context_level())); | 2415 Z, node->scope()->PreserveOuterScope(owner()->context_level())); |
2417 ASSERT(!function.HasCode()); | 2416 ASSERT(!function.HasCode()); |
2418 ASSERT(function.context_scope() == ContextScope::null()); | 2417 ASSERT(function.context_scope() == ContextScope::null()); |
2419 function.set_context_scope(context_scope); | 2418 function.set_context_scope(context_scope); |
2420 | 2419 |
2421 // The closure is now properly setup, add it to the lookup table. | 2420 // The closure is now properly setup, add it to the lookup table. |
2422 // It is possible that the compiler creates more than one function | 2421 // It is possible that the compiler creates more than one function |
2423 // object for the same closure, e.g. when inlining nodes from | 2422 // object for the same closure, e.g. when inlining nodes from |
2424 // finally clauses. If we already have a function object for the | 2423 // finally clauses. If we already have a function object for the |
(...skipping 2167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4592 block_marks); | 4591 block_marks); |
4593 ASSERT(found); | 4592 ASSERT(found); |
4594 } | 4593 } |
4595 | 4594 |
4596 | 4595 |
4597 void FlowGraphBuilder::Bailout(const char* reason) const { | 4596 void FlowGraphBuilder::Bailout(const char* reason) const { |
4598 parsed_function_.Bailout("FlowGraphBuilder", reason); | 4597 parsed_function_.Bailout("FlowGraphBuilder", reason); |
4599 } | 4598 } |
4600 | 4599 |
4601 } // namespace dart | 4600 } // namespace dart |
OLD | NEW |