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

Unified Diff: runtime/vm/flow_graph_type_propagator.cc

Issue 12330113: null value can be the receiver of methods on Object (e.g. hashCode). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/il_printer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 227ef8a435c3f20b1ba5eaf7267961fd6970fb40..839bfe92d6d17337b47070c28552ee3da3ff6ae9 100644
--- a/runtime/vm/flow_graph_type_propagator.cc
+++ b/runtime/vm/flow_graph_type_propagator.cc
@@ -42,9 +42,7 @@ FlowGraphTypePropagator::FlowGraphTypePropagator(FlowGraph* flow_graph)
void FlowGraphTypePropagator::Propagate() {
if (FLAG_trace_type_propagation) {
- OS::Print("Before type propagation:\n");
- FlowGraphPrinter printer(*flow_graph_);
- printer.PrintBlocks();
+ FlowGraphPrinter::PrintGraph("Before type propagation", flow_graph_);
}
// Walk the dominator tree and propagate reaching types to all Values.
@@ -84,9 +82,7 @@ void FlowGraphTypePropagator::Propagate() {
}
if (FLAG_trace_type_propagation) {
- OS::Print("After type propagation:\n");
- FlowGraphPrinter printer(*flow_graph_);
- printer.PrintBlocks();
+ FlowGraphPrinter::PrintGraph("After type propagation", flow_graph_);
}
}
@@ -350,7 +346,7 @@ CompileType CompileType::Create(intptr_t cid, const AbstractType& type) {
CompileType CompileType::FromAbstractType(const AbstractType& type,
- bool is_nullable) {
+ bool is_nullable) {
return CompileType(is_nullable, kIllegalCid, &type);
}
@@ -586,8 +582,13 @@ CompileType ParameterInstr::ComputeType() const {
}
LocalScope* scope = block_->parsed_function().node_sequence()->scope();
- return CompileType::FromAbstractType(scope->VariableAt(index())->type(),
- CompileType::kNonNullable);
+
+ const AbstractType& type = scope->VariableAt(index())->type();
+
+ // Only receiver of methods on Object and Null types can be null.
+ const bool is_nullable = (index() == 0) &&
+ (type.IsObjectType() || type.IsNullType());
+ return CompileType::FromAbstractType(type, is_nullable);
}
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/il_printer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698