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

Unified Diff: runtime/vm/parser.cc

Issue 17288005: Try to avoid checks for lazy initialization when recompiling. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 0aec272e276bfb9b23e6e32090410d14bb0cd336..286a058d41a1b3eed9e11f0dd18e26ba091504b5 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -920,6 +920,21 @@ SequenceNode* Parser::ParseStaticConstGetter(const Function& func) {
const Field& field =
Field::ZoneHandle(field_class.LookupStaticField(field_name));
+ if (!field.is_const() &&
+ (field.value() != Object::transition_sentinel().raw()) &&
+ (field.value() != Object::sentinel().raw())) {
+ // The field has already been initialized at compile time (this can
+ // happen, e.g., if we are recompiling for optimization). There is no
+ // need to check for initialization and compile the potentially very
+ // large initialization code. By skipping this code, the deoptimization
+ // ids will not line up with the original code, but this is safe because
+ // LoadStaticField does not deoptimize.
+ LoadStaticFieldNode* load_node = new LoadStaticFieldNode(ident_pos, field);
+ ReturnNode* return_node = new ReturnNode(ident_pos, load_node);
+ current_block_->statements->Add(return_node);
+ return CloseBlock();
+ }
+
// Static const fields must have an initializer.
ExpectToken(Token::kASSIGN);
« 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