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 2512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Isolate* isolate = Isolate::Current(); | 2533 Thread* thread = Thread::Current(); |
| 2534 Isolate* isolate = thread->isolate(); |
2534 if (isolate->collected_closures() == GrowableObjectArray::null()) { | 2535 if (isolate->collected_closures() == GrowableObjectArray::null()) { |
2535 isolate->set_collected_closures( | 2536 isolate->set_collected_closures( |
2536 GrowableObjectArray::Handle(GrowableObjectArray::New())); | 2537 GrowableObjectArray::Handle(GrowableObjectArray::New())); |
2537 } | 2538 } |
2538 const GrowableObjectArray& functions = | 2539 const GrowableObjectArray& functions = |
2539 GrowableObjectArray::Handle(isolate, isolate->collected_closures()); | 2540 GrowableObjectArray::Handle(thread->zone(), |
| 2541 isolate->collected_closures()); |
2540 functions.Add(function); | 2542 functions.Add(function); |
2541 } | 2543 } |
2542 | 2544 |
2543 | 2545 |
2544 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { | 2546 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { |
2545 const Function& function = node->function(); | 2547 const Function& function = node->function(); |
2546 if (FLAG_precompile_collect_closures) { | 2548 if (FLAG_precompile_collect_closures) { |
2547 CollectClosureFunction(function); | 2549 CollectClosureFunction(function); |
2548 } | 2550 } |
2549 | 2551 |
(...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4694 Report::MessageF(Report::kBailout, | 4696 Report::MessageF(Report::kBailout, |
4695 Script::Handle(function.script()), | 4697 Script::Handle(function.script()), |
4696 function.token_pos(), | 4698 function.token_pos(), |
4697 "FlowGraphBuilder Bailout: %s %s", | 4699 "FlowGraphBuilder Bailout: %s %s", |
4698 String::Handle(function.name()).ToCString(), | 4700 String::Handle(function.name()).ToCString(), |
4699 reason); | 4701 reason); |
4700 UNREACHABLE(); | 4702 UNREACHABLE(); |
4701 } | 4703 } |
4702 | 4704 |
4703 } // namespace dart | 4705 } // namespace dart |
OLD | NEW |