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

Unified Diff: runtime/vm/parser.cc

Issue 1278003002: Change heuristic to determine which fields contain modifieable double boxes: do it if field was ini… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: s Created 5 years, 4 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/object.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 0e28cc09180b361e78704382f18d1ce0a7ddfa75..116388b328332fb66d9d187994f3784c8c78da03 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -3972,7 +3972,8 @@ void Parser::ParseFieldDefinition(ClassDesc* members, MemberDesc* field) {
// 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 (LookaheadToken(1) == Token::kSEMICOLON) {
+ if ((LookaheadToken(1) == Token::kSEMICOLON) ||
+ (LookaheadToken(1) == Token::kCOMMA)) {
has_simple_literal = IsSimpleLiteral(*field->type, &init_value);
}
SkipExpr();
@@ -4010,6 +4011,9 @@ void Parser::ParseFieldDefinition(ClassDesc* members, MemberDesc* field) {
// and rules out many fields from being unnecessary unboxing candidates.
if (!field->has_static && has_initializer && has_simple_literal) {
class_field.RecordStore(init_value);
+ if (!init_value.IsNull() && init_value.IsDouble()) {
+ class_field.set_is_double_initialized(true);
+ }
}
// For static final fields (this includes static const fields), set value to
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698