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

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

Issue 1841073003: VM: Fix receiver type propagation in presence of try-catch. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comments, added test Created 4 years, 8 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/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/compiler.h" 10 #include "vm/compiler.h"
(...skipping 4318 matching lines...) Expand 10 before | Expand all | Expand 10 after
4329 4329
4330 // NOTE: The implicit variables ':saved_try_context_var', ':exception_var' 4330 // NOTE: The implicit variables ':saved_try_context_var', ':exception_var'
4331 // and ':stack_trace_var' can never be captured variables. 4331 // and ':stack_trace_var' can never be captured variables.
4332 ASSERT(!catch_block->context_var().is_captured()); 4332 ASSERT(!catch_block->context_var().is_captured());
4333 ASSERT(!catch_block->exception_var().is_captured()); 4333 ASSERT(!catch_block->exception_var().is_captured());
4334 ASSERT(!catch_block->stacktrace_var().is_captured()); 4334 ASSERT(!catch_block->stacktrace_var().is_captured());
4335 4335
4336 CatchBlockEntryInstr* catch_entry = 4336 CatchBlockEntryInstr* catch_entry =
4337 new(Z) CatchBlockEntryInstr(owner()->AllocateBlockId(), 4337 new(Z) CatchBlockEntryInstr(owner()->AllocateBlockId(),
4338 catch_handler_index, 4338 catch_handler_index,
4339 owner()->graph_entry(),
4339 catch_block->handler_types(), 4340 catch_block->handler_types(),
4340 try_handler_index, 4341 try_handler_index,
4341 catch_block->exception_var(), 4342 catch_block->exception_var(),
4342 catch_block->stacktrace_var(), 4343 catch_block->stacktrace_var(),
4343 catch_block->needs_stacktrace()); 4344 catch_block->needs_stacktrace());
4344 owner()->AddCatchEntry(catch_entry); 4345 owner()->AddCatchEntry(catch_entry);
4345 AppendFragment(catch_entry, for_catch); 4346 AppendFragment(catch_entry, for_catch);
4346 4347
4347 if (for_catch.is_open()) { 4348 if (for_catch.is_open()) {
4348 JoinEntryInstr* join = new(Z) JoinEntryInstr(owner()->AllocateBlockId(), 4349 JoinEntryInstr* join = new(Z) JoinEntryInstr(owner()->AllocateBlockId(),
(...skipping 25 matching lines...) Expand all
4374 new(Z) ReThrowInstr(catch_block->token_pos(), catch_handler_index)); 4375 new(Z) ReThrowInstr(catch_block->token_pos(), catch_handler_index));
4375 for_finally.CloseFragment(); 4376 for_finally.CloseFragment();
4376 } 4377 }
4377 ASSERT(!for_finally.is_open()); 4378 ASSERT(!for_finally.is_open());
4378 4379
4379 const Array& types = Array::ZoneHandle(Z, Array::New(1, Heap::kOld)); 4380 const Array& types = Array::ZoneHandle(Z, Array::New(1, Heap::kOld));
4380 types.SetAt(0, Object::dynamic_type()); 4381 types.SetAt(0, Object::dynamic_type());
4381 CatchBlockEntryInstr* finally_entry = 4382 CatchBlockEntryInstr* finally_entry =
4382 new(Z) CatchBlockEntryInstr(owner()->AllocateBlockId(), 4383 new(Z) CatchBlockEntryInstr(owner()->AllocateBlockId(),
4383 original_handler_index, 4384 original_handler_index,
4385 owner()->graph_entry(),
4384 types, 4386 types,
4385 catch_handler_index, 4387 catch_handler_index,
4386 catch_block->exception_var(), 4388 catch_block->exception_var(),
4387 catch_block->stacktrace_var(), 4389 catch_block->stacktrace_var(),
4388 catch_block->needs_stacktrace()); 4390 catch_block->needs_stacktrace());
4389 owner()->AddCatchEntry(finally_entry); 4391 owner()->AddCatchEntry(finally_entry);
4390 AppendFragment(finally_entry, for_finally); 4392 AppendFragment(finally_entry, for_finally);
4391 } 4393 }
4392 4394
4393 // Generate code for the finally block if one exists. 4395 // Generate code for the finally block if one exists.
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
4660 Script::Handle(function.script()), 4662 Script::Handle(function.script()),
4661 function.token_pos(), 4663 function.token_pos(),
4662 Report::AtLocation, 4664 Report::AtLocation,
4663 "FlowGraphBuilder Bailout: %s %s", 4665 "FlowGraphBuilder Bailout: %s %s",
4664 String::Handle(function.name()).ToCString(), 4666 String::Handle(function.name()).ToCString(),
4665 reason); 4667 reason);
4666 UNREACHABLE(); 4668 UNREACHABLE();
4667 } 4669 }
4668 4670
4669 } // namespace dart 4671 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698