Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Side by Side Diff: runtime/vm/flow_graph_builder.cc

Issue 2010283004: Fix capturing variables in optimized compilations (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix skipping closurization Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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);
2414 const ContextScope& context_scope = ContextScope::ZoneHandle( 2415 const ContextScope& context_scope = ContextScope::ZoneHandle(
2415 Z, node->scope()->PreserveOuterScope(owner()->context_level())); 2416 Z, node->scope()->PreserveOuterScope(owner()->context_level()));
2416 ASSERT(!function.HasCode()); 2417 ASSERT(!function.HasCode());
2417 ASSERT(function.context_scope() == ContextScope::null()); 2418 ASSERT(function.context_scope() == ContextScope::null());
2418 function.set_context_scope(context_scope); 2419 function.set_context_scope(context_scope);
2419 2420
2420 // The closure is now properly setup, add it to the lookup table. 2421 // The closure is now properly setup, add it to the lookup table.
2421 // It is possible that the compiler creates more than one function 2422 // It is possible that the compiler creates more than one function
2422 // object for the same closure, e.g. when inlining nodes from 2423 // object for the same closure, e.g. when inlining nodes from
2423 // finally clauses. If we already have a function object for the 2424 // finally clauses. If we already have a function object for the
(...skipping 2167 matching lines...) Expand 10 before | Expand all | Expand 10 after
4591 block_marks); 4592 block_marks);
4592 ASSERT(found); 4593 ASSERT(found);
4593 } 4594 }
4594 4595
4595 4596
4596 void FlowGraphBuilder::Bailout(const char* reason) const { 4597 void FlowGraphBuilder::Bailout(const char* reason) const {
4597 parsed_function_.Bailout("FlowGraphBuilder", reason); 4598 parsed_function_.Bailout("FlowGraphBuilder", reason);
4598 } 4599 }
4599 4600
4600 } // namespace dart 4601 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698