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

Unified Diff: runtime/vm/flow_graph_type_propagator.cc

Issue 1973553003: VM precompiler: Compute and use result type of static initializers of final fields. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: preprocess initializers Created 4 years, 7 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/precompiler.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 d0391dbf81c07e7854b186d95c119445ea8d3b5f..a0a60078010a4a7eb88105fd93585f936e28a1a8 100644
--- a/runtime/vm/flow_graph_type_propagator.cc
+++ b/runtime/vm/flow_graph_type_propagator.cc
@@ -947,13 +947,18 @@ CompileType LoadStaticFieldInstr::ComputeType() const {
abstract_type = &AbstractType::ZoneHandle(field.type());
}
ASSERT(field.is_static());
- if (field.is_final() && !FLAG_fields_may_be_reset) {
- const Instance& obj = Instance::Handle(field.StaticValue());
- if ((obj.raw() != Object::sentinel().raw()) &&
- (obj.raw() != Object::transition_sentinel().raw()) &&
- !obj.IsNull()) {
- is_nullable = CompileType::kNonNullable;
- cid = obj.GetClassId();
+ if (field.is_final()) {
+ if (!FLAG_fields_may_be_reset) {
+ const Instance& obj = Instance::Handle(field.StaticValue());
+ if ((obj.raw() != Object::sentinel().raw()) &&
+ (obj.raw() != Object::transition_sentinel().raw()) &&
+ !obj.IsNull()) {
+ is_nullable = CompileType::kNonNullable;
+ cid = obj.GetClassId();
+ }
+ } else {
+ cid = field.guarded_cid();
+ if (!IsNullableCid(cid)) is_nullable = CompileType::kNonNullable;
}
}
if (Field::IsExternalizableCid(cid)) {
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/precompiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698