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

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: port to other architectures Created 3 years, 10 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)
rmacnak 2017/02/23 17:50:56 if (FLAG_support_debugger)
Cutch 2017/02/24 20:19:21 Done.
547 ZoneGrowableArray<TokenPosition>* await_token_positions =
548 flow_graph->await_token_positions();
549 if (await_token_positions != NULL) {
550 Smi& token_pos_value = Smi::Handle(zone);
551 if (await_token_positions->length() > 0) {
552 const Array& await_to_token_map = Array::Handle(
553 zone, Array::New(await_token_positions->length(), Heap::kOld));
554 ASSERT(!await_to_token_map.IsNull());
555 for (intptr_t i = 0; i < await_token_positions->length(); i++) {
556 TokenPosition token_pos = await_token_positions->At(i).FromSynthetic();
557 if (!token_pos.IsReal()) {
558 // Some async machinary uses sentinel values. Map them to
559 // no source position.
560 token_pos_value = Smi::New(TokenPosition::kNoSourcePos);
561 } else {
562 token_pos_value = Smi::New(token_pos.value());
563 }
564 await_to_token_map.SetAt(i, token_pos_value);
565 }
566 code.SetAwaitTokenPositions(await_to_token_map);
567 }
568 }
569 #endif // !defined(PRODUCT)
570
546 if (!function.IsOptimizable()) { 571 if (!function.IsOptimizable()) {
547 // A function with huge unoptimized code can become non-optimizable 572 // A function with huge unoptimized code can become non-optimizable
548 // after generating unoptimized code. 573 // after generating unoptimized code.
549 function.set_usage_counter(INT_MIN); 574 function.set_usage_counter(INT_MIN);
550 } 575 }
551 576
552 graph_compiler->FinalizePcDescriptors(code); 577 graph_compiler->FinalizePcDescriptors(code);
553 code.set_deopt_info_array(deopt_info_array); 578 code.set_deopt_info_array(deopt_info_array);
554 579
555 graph_compiler->FinalizeStackMaps(code); 580 graph_compiler->FinalizeStackMaps(code);
(...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after
2265 2290
2266 2291
2267 bool BackgroundCompiler::IsDisabled() { 2292 bool BackgroundCompiler::IsDisabled() {
2268 UNREACHABLE(); 2293 UNREACHABLE();
2269 return true; 2294 return true;
2270 } 2295 }
2271 2296
2272 #endif // DART_PRECOMPILED_RUNTIME 2297 #endif // DART_PRECOMPILED_RUNTIME
2273 2298
2274 } // namespace dart 2299 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698