Chromium Code Reviews| 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/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 2513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 Isolate* isolate = Isolate::Current(); | 2533 Isolate* isolate = Isolate::Current(); |
| 2534 if (isolate->collected_closures() == GrowableObjectArray::null()) { | 2534 if (isolate->collected_closures() != GrowableObjectArray::null()) { |
|
srdjan
2015/10/13 21:30:12
Please add a comment why the check is necessary, e
rmacnak
2015/10/13 21:55:01
Done.
| |
| 2535 isolate->set_collected_closures( | 2535 const GrowableObjectArray& functions = |
| 2536 GrowableObjectArray::Handle(GrowableObjectArray::New())); | 2536 GrowableObjectArray::Handle(isolate, isolate->collected_closures()); |
| 2537 functions.Add(function); | |
| 2537 } | 2538 } |
| 2538 const GrowableObjectArray& functions = | |
| 2539 GrowableObjectArray::Handle(isolate, isolate->collected_closures()); | |
| 2540 functions.Add(function); | |
| 2541 } | 2539 } |
| 2542 | 2540 |
| 2543 | 2541 |
| 2544 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { | 2542 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { |
| 2545 const Function& function = node->function(); | 2543 const Function& function = node->function(); |
| 2546 if (FLAG_precompile_collect_closures) { | 2544 if (FLAG_precompile_collect_closures) { |
| 2547 CollectClosureFunction(function); | 2545 CollectClosureFunction(function); |
| 2548 } | 2546 } |
| 2549 | 2547 |
| 2550 if (function.IsImplicitStaticClosureFunction()) { | 2548 if (function.IsImplicitStaticClosureFunction()) { |
| (...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4694 Report::MessageF(Report::kBailout, | 4692 Report::MessageF(Report::kBailout, |
| 4695 Script::Handle(function.script()), | 4693 Script::Handle(function.script()), |
| 4696 function.token_pos(), | 4694 function.token_pos(), |
| 4697 "FlowGraphBuilder Bailout: %s %s", | 4695 "FlowGraphBuilder Bailout: %s %s", |
| 4698 String::Handle(function.name()).ToCString(), | 4696 String::Handle(function.name()).ToCString(), |
| 4699 reason); | 4697 reason); |
| 4700 UNREACHABLE(); | 4698 UNREACHABLE(); |
| 4701 } | 4699 } |
| 4702 | 4700 |
| 4703 } // namespace dart | 4701 } // namespace dart |
| OLD | NEW |