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

Unified Diff: runtime/vm/flow_graph_type_propagator.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, 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/flow_graph_type_propagator.cc
diff --git a/runtime/vm/flow_graph_type_propagator.cc b/runtime/vm/flow_graph_type_propagator.cc
index bd860d900b489753d79dd220fb9274cb6809d830..20ccd3a12e1351477b370adf1bda8004ef146b0b 100644
--- a/runtime/vm/flow_graph_type_propagator.cc
+++ b/runtime/vm/flow_graph_type_propagator.cc
@@ -697,12 +697,15 @@ CompileType ParameterInstr::ComputeType() const {
// However there are parameters that are known to match their declared type:
// for example receiver.
GraphEntryInstr* graph_entry = block_->AsGraphEntry();
- // Parameters at catch blocks and OSR entries have type dynamic.
+ if (graph_entry == NULL) {
+ graph_entry = block_->AsCatchBlockEntry()->graph_entry();
+ }
+ // Parameters at OSR entries have type dynamic.
//
// TODO(kmillikin): Use the actual type of the parameter at OSR entry.
// The code below is not safe for OSR because it doesn't necessarily use
// the correct scope.
- if ((graph_entry == NULL) || graph_entry->IsCompiledForOsr()) {
+ if (graph_entry->IsCompiledForOsr()) {
return CompileType::Dynamic();
}
@@ -724,12 +727,11 @@ CompileType ParameterInstr::ComputeType() const {
return CompileType::Dynamic();
}
- LocalScope* scope = graph_entry->parsed_function().node_sequence()->scope();
- const AbstractType& type = scope->VariableAt(index())->type();
-
// Parameter is the receiver.
if ((index() == 0) &&
(function.IsDynamicFunction() || function.IsGenerativeConstructor())) {
+ LocalScope* scope = graph_entry->parsed_function().node_sequence()->scope();
+ const AbstractType& type = scope->VariableAt(index())->type();
if (type.IsObjectType() || type.IsNullType()) {
// Receiver can be null.
return CompileType::FromAbstractType(type, CompileType::kNullable);

Powered by Google App Engine
This is Rietveld 408576698