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

Unified Diff: runtime/vm/parser.cc

Issue 330243003: Record field initializer stores with simple literals at compile-time. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 37262)
+++ runtime/vm/parser.cc (working copy)
@@ -3545,7 +3545,7 @@
// value is not assignable (assuming checked mode and disregarding actual
// mode), the field value is reset and a kImplicitStaticFinalGetter is
// created at finalization time.
- if (field->has_static && (LookaheadToken(1) == Token::kSEMICOLON)) {
+ if (LookaheadToken(1) == Token::kSEMICOLON) {
has_simple_literal = IsSimpleLiteral(*field->type, &init_value);
}
SkipExpr();
@@ -3575,6 +3575,13 @@
library_.AddFieldMetadata(class_field, field->metadata_pos);
}
+ // Start tracking types for fields with simple initializers in their
+ // definition. This avoids some of the overhead to track this at runtime
+ // and rules out many fields from being unnecessary unboxing candidates.
+ if (!field->has_static && has_initializer && has_simple_literal) {
+ class_field.RecordStore(init_value);
+ }
+
// For static final fields (this includes static const fields), set value to
// "uninitialized" and create a kImplicitStaticFinalGetter getter method.
if (field->has_static && has_initializer) {
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698