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

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

Issue 2692803006: Track the 'awaiter return' call stack use it to detect uncaught exceptions in async functions (Closed)
Patch Set: rmacnak review Created 3 years, 9 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
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/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
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
546 if (!function.IsOptimizable()) { 574 if (!function.IsOptimizable()) {
547 // A function with huge unoptimized code can become non-optimizable 575 // A function with huge unoptimized code can become non-optimizable
548 // after generating unoptimized code. 576 // after generating unoptimized code.
549 function.set_usage_counter(INT_MIN); 577 function.set_usage_counter(INT_MIN);
550 } 578 }
551 579
552 graph_compiler->FinalizePcDescriptors(code); 580 graph_compiler->FinalizePcDescriptors(code);
553 code.set_deopt_info_array(deopt_info_array); 581 code.set_deopt_info_array(deopt_info_array);
554 582
555 graph_compiler->FinalizeStackMaps(code); 583 graph_compiler->FinalizeStackMaps(code);
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after
2267 2295
2268 2296
2269 bool BackgroundCompiler::IsDisabled() { 2297 bool BackgroundCompiler::IsDisabled() {
2270 UNREACHABLE(); 2298 UNREACHABLE();
2271 return true; 2299 return true;
2272 } 2300 }
2273 2301
2274 #endif // DART_PRECOMPILED_RUNTIME 2302 #endif // DART_PRECOMPILED_RUNTIME
2275 2303
2276 } // namespace dart 2304 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698