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

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

Issue 1400193003: Don't assume at least one closure function is encountered before tree-shaking. Allow… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | runtime/vm/object.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/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 2512 matching lines...) Expand 10 before | Expand all | Expand 10 after
2523 new(Z) StringInterpolateInstr(for_argument.value(), node->token_pos()); 2523 new(Z) StringInterpolateInstr(for_argument.value(), node->token_pos());
2524 ReturnDefinition(instr); 2524 ReturnDefinition(instr);
2525 } 2525 }
2526 2526
2527 2527
2528 // TODO(rmacnak): De-dup closures in inlined-finally and track down other 2528 // TODO(rmacnak): De-dup closures in inlined-finally and track down other
2529 // stragglers to use Class::closures instead. 2529 // stragglers to use Class::closures instead.
2530 static void CollectClosureFunction(const Function& function) { 2530 static void CollectClosureFunction(const Function& function) {
2531 if (function.HasCode()) return; 2531 if (function.HasCode()) return;
2532 2532
2533 // Although this is only called when precompiling, this can happen before
2534 // Dart_Precompile as part of loading code, so check for a non-null work
2535 // list.
2533 Thread* thread = Thread::Current(); 2536 Thread* thread = Thread::Current();
2534 Isolate* isolate = thread->isolate(); 2537 Isolate* isolate = thread->isolate();
2535 if (isolate->collected_closures() == GrowableObjectArray::null()) { 2538 if (isolate->collected_closures() != GrowableObjectArray::null()) {
2536 isolate->set_collected_closures( 2539 const GrowableObjectArray& functions =
2537 GrowableObjectArray::Handle(GrowableObjectArray::New())); 2540 GrowableObjectArray::Handle(thread->zone(),
2541 isolate->collected_closures());
2542 functions.Add(function);
2538 } 2543 }
2539 const GrowableObjectArray& functions =
2540 GrowableObjectArray::Handle(thread->zone(),
2541 isolate->collected_closures());
2542 functions.Add(function);
2543 } 2544 }
2544 2545
2545 2546
2546 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { 2547 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) {
2547 const Function& function = node->function(); 2548 const Function& function = node->function();
2548 if (FLAG_precompile_collect_closures) { 2549 if (FLAG_precompile_collect_closures) {
2549 CollectClosureFunction(function); 2550 CollectClosureFunction(function);
2550 } 2551 }
2551 2552
2552 if (function.IsImplicitStaticClosureFunction()) { 2553 if (function.IsImplicitStaticClosureFunction()) {
(...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after
4696 Report::MessageF(Report::kBailout, 4697 Report::MessageF(Report::kBailout,
4697 Script::Handle(function.script()), 4698 Script::Handle(function.script()),
4698 function.token_pos(), 4699 function.token_pos(),
4699 "FlowGraphBuilder Bailout: %s %s", 4700 "FlowGraphBuilder Bailout: %s %s",
4700 String::Handle(function.name()).ToCString(), 4701 String::Handle(function.name()).ToCString(),
4701 reason); 4702 reason);
4702 UNREACHABLE(); 4703 UNREACHABLE();
4703 } 4704 }
4704 4705
4705 } // namespace dart 4706 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698