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/compiler.h" | 5 #include "vm/compiler.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 | 8 |
9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
10 #include "vm/block_scheduler.h" | 10 #include "vm/block_scheduler.h" |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 const Code& code = | 542 const Code& code = |
543 Code::Handle(Code::FinalizeCode(function, assembler, optimized())); | 543 Code::Handle(Code::FinalizeCode(function, assembler, optimized())); |
544 code.set_is_optimized(optimized()); | 544 code.set_is_optimized(optimized()); |
545 code.set_owner(function); | 545 code.set_owner(function); |
546 if (!function.IsOptimizable()) { | 546 if (!function.IsOptimizable()) { |
547 // A function with huge unoptimized code can become non-optimizable | 547 // A function with huge unoptimized code can become non-optimizable |
548 // after generating unoptimized code. | 548 // after generating unoptimized code. |
549 function.set_usage_counter(INT_MIN); | 549 function.set_usage_counter(INT_MIN); |
550 } | 550 } |
551 | 551 |
| 552 #if !defined(PRODUCT) |
| 553 ZoneGrowableArray<TokenPosition>* await_token_positions = |
| 554 flow_graph->await_token_positions(); |
| 555 if (await_token_positions != NULL) { |
| 556 Smi& token_pos_value = Smi::Handle(zone); |
| 557 if (await_token_positions->length() > 0) { |
| 558 const Array& await_to_token_map = Array::Handle( |
| 559 zone, Array::New(await_token_positions->length(), Heap::kOld)); |
| 560 ASSERT(!await_to_token_map.IsNull()); |
| 561 for (intptr_t i = 0; i < await_token_positions->length(); i++) { |
| 562 TokenPosition token_pos = await_token_positions->At(i).FromSynthetic(); |
| 563 if (!token_pos.IsReal()) { |
| 564 // Some async machinary uses kNoSourcePos. Skip these. |
| 565 continue; |
| 566 } |
| 567 ASSERT(token_pos.IsReal()); |
| 568 token_pos_value = Smi::New(token_pos.value()); |
| 569 await_to_token_map.SetAt(i, token_pos_value); |
| 570 } |
| 571 code.SetAwaitTokenPositions(await_to_token_map); |
| 572 } |
| 573 } |
| 574 #endif // !defined(PRODUCT) |
| 575 |
552 const Array& intervals = graph_compiler->inlined_code_intervals(); | 576 const Array& intervals = graph_compiler->inlined_code_intervals(); |
553 INC_STAT(thread(), total_code_size, intervals.Length() * sizeof(uword)); | 577 INC_STAT(thread(), total_code_size, intervals.Length() * sizeof(uword)); |
554 code.SetInlinedIntervals(intervals); | 578 code.SetInlinedIntervals(intervals); |
555 | 579 |
556 const Array& inlined_id_array = | 580 const Array& inlined_id_array = |
557 Array::Handle(zone, graph_compiler->InliningIdToFunction()); | 581 Array::Handle(zone, graph_compiler->InliningIdToFunction()); |
558 INC_STAT(thread(), total_code_size, | 582 INC_STAT(thread(), total_code_size, |
559 inlined_id_array.Length() * sizeof(uword)); | 583 inlined_id_array.Length() * sizeof(uword)); |
560 code.SetInlinedIdToFunction(inlined_id_array); | 584 code.SetInlinedIdToFunction(inlined_id_array); |
561 | 585 |
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2318 | 2342 |
2319 | 2343 |
2320 bool BackgroundCompiler::IsDisabled() { | 2344 bool BackgroundCompiler::IsDisabled() { |
2321 UNREACHABLE(); | 2345 UNREACHABLE(); |
2322 return true; | 2346 return true; |
2323 } | 2347 } |
2324 | 2348 |
2325 #endif // DART_PRECOMPILED_RUNTIME | 2349 #endif // DART_PRECOMPILED_RUNTIME |
2326 | 2350 |
2327 } // namespace dart | 2351 } // namespace dart |
OLD | NEW |