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

Unified Diff: runtime/vm/parser.cc

Issue 1934733002: Don’t cache constants in initializer expressions (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Review comments Created 4 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
« no previous file with comments | « runtime/vm/code_generator.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 6404df4bee3b3fa0947912b8d93a6fe28930b167..80c6021f622e178a22ea9446e9fca67e761272ab 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -12012,6 +12012,11 @@ typedef UnorderedHashMap<ConstMapKeyEqualsTraits> ConstantsMap;
void Parser::CacheConstantValue(TokenPosition token_pos,
const Instance& value) {
+ if (current_function().kind() == RawFunction::kImplicitStaticFinalGetter) {
+ // Don't cache constants in initializer expressions. They get
+ // evaluated only once.
+ return;
+ }
ConstantPosKey key(String::Handle(Z, script_.url()), token_pos);
if (isolate()->object_store()->compile_time_constants() == Array::null()) {
const intptr_t kInitialConstMapSize = 16;
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698