| 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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 const Array& deopt_info_array = | 536 const Array& deopt_info_array = |
| 537 Array::Handle(zone, graph_compiler->CreateDeoptInfo(assembler)); | 537 Array::Handle(zone, graph_compiler->CreateDeoptInfo(assembler)); |
| 538 INC_STAT(thread(), total_code_size, | 538 INC_STAT(thread(), total_code_size, |
| 539 deopt_info_array.Length() * sizeof(uword)); | 539 deopt_info_array.Length() * sizeof(uword)); |
| 540 // Allocates instruction object. Since this occurs only at safepoint, | 540 // Allocates instruction object. Since this occurs only at safepoint, |
| 541 // there can be no concurrent access to the instruction page. | 541 // there can be no concurrent access to the instruction page. |
| 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 !defined(PRODUCT) | |
| 547 if (FLAG_support_debugger) { | |
| 548 ZoneGrowableArray<TokenPosition>* await_token_positions = | |
| 549 flow_graph->await_token_positions(); | |
| 550 if (await_token_positions != NULL) { | |
| 551 Smi& token_pos_value = Smi::Handle(zone); | |
| 552 if (await_token_positions->length() > 0) { | |
| 553 const Array& await_to_token_map = Array::Handle( | |
| 554 zone, Array::New(await_token_positions->length(), Heap::kOld)); | |
| 555 ASSERT(!await_to_token_map.IsNull()); | |
| 556 for (intptr_t i = 0; i < await_token_positions->length(); i++) { | |
| 557 TokenPosition token_pos = | |
| 558 await_token_positions->At(i).FromSynthetic(); | |
| 559 if (!token_pos.IsReal()) { | |
| 560 // Some async machinary uses sentinel values. Map them to | |
| 561 // no source position. | |
| 562 token_pos_value = Smi::New(TokenPosition::kNoSourcePos); | |
| 563 } else { | |
| 564 token_pos_value = Smi::New(token_pos.value()); | |
| 565 } | |
| 566 await_to_token_map.SetAt(i, token_pos_value); | |
| 567 } | |
| 568 code.SetAwaitTokenPositions(await_to_token_map); | |
| 569 } | |
| 570 } | |
| 571 } | |
| 572 #endif // !defined(PRODUCT) | |
| 573 | |
| 574 if (!function.IsOptimizable()) { | 546 if (!function.IsOptimizable()) { |
| 575 // A function with huge unoptimized code can become non-optimizable | 547 // A function with huge unoptimized code can become non-optimizable |
| 576 // after generating unoptimized code. | 548 // after generating unoptimized code. |
| 577 function.set_usage_counter(INT_MIN); | 549 function.set_usage_counter(INT_MIN); |
| 578 } | 550 } |
| 579 | 551 |
| 580 graph_compiler->FinalizePcDescriptors(code); | 552 graph_compiler->FinalizePcDescriptors(code); |
| 581 code.set_deopt_info_array(deopt_info_array); | 553 code.set_deopt_info_array(deopt_info_array); |
| 582 | 554 |
| 583 graph_compiler->FinalizeStackMaps(code); | 555 graph_compiler->FinalizeStackMaps(code); |
| (...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2295 | 2267 |
| 2296 | 2268 |
| 2297 bool BackgroundCompiler::IsDisabled() { | 2269 bool BackgroundCompiler::IsDisabled() { |
| 2298 UNREACHABLE(); | 2270 UNREACHABLE(); |
| 2299 return true; | 2271 return true; |
| 2300 } | 2272 } |
| 2301 | 2273 |
| 2302 #endif // DART_PRECOMPILED_RUNTIME | 2274 #endif // DART_PRECOMPILED_RUNTIME |
| 2303 | 2275 |
| 2304 } // namespace dart | 2276 } // namespace dart |
| OLD | NEW |