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

Unified Diff: runtime/vm/flow_graph_type_propagator.cc

Issue 1097723002: Type and constant propagator should guard against mutable class ids. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix GuardField handling Created 5 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 side-by-side diff with in-line comments
Download patch
« runtime/vm/dart_api_impl_test.cc ('K') | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | 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 2b7001f656104549b25930aefbf2c9124cc4f30f..9d0829d0dd7416f9d6127b9c42db5007940d3549 100644
--- a/runtime/vm/flow_graph_type_propagator.cc
+++ b/runtime/vm/flow_graph_type_propagator.cc
@@ -318,7 +318,9 @@ void FlowGraphTypePropagator::VisitCheckClassId(CheckClassIdInstr* check) {
void FlowGraphTypePropagator::VisitGuardFieldClass(
GuardFieldClassInstr* guard) {
const intptr_t cid = guard->field().guarded_cid();
- if ((cid == kIllegalCid) || (cid == kDynamicCid)) {
+ if ((cid == kIllegalCid) ||
+ (cid == kDynamicCid) ||
+ !CheckClassInstr::IsImmutableClassId(cid)) {
return;
}
@@ -794,13 +796,17 @@ CompileType ConstantInstr::ComputeType() const {
return CompileType::Null();
}
+ intptr_t cid = value().GetClassId();
+ if (!CheckClassInstr::IsImmutableClassId(cid)) {
+ cid = kDynamicCid;
+ }
+
if (value().IsInstance()) {
- return CompileType::Create(
- value().GetClassId(),
+ return CompileType::Create(cid,
AbstractType::ZoneHandle(Instance::Cast(value()).GetType()));
} else {
// Type info for non-instance objects.
- return CompileType::FromCid(value().GetClassId());
+ return CompileType::FromCid(cid);
}
}
« runtime/vm/dart_api_impl_test.cc ('K') | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698