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

Side by Side Diff: runtime/vm/parser.cc

Issue 1958913003: VM precompiler: Allow optimizing static initializers. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/parser.h" 5 #include "vm/parser.h"
6 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED_RUNTIME 8 #ifndef DART_PRECOMPILED_RUNTIME
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 RawFunction::kImplicitStaticFinalGetter, 1249 RawFunction::kImplicitStaticFinalGetter,
1250 true, // static 1250 true, // static
1251 false, // !const 1251 false, // !const
1252 false, // !abstract 1252 false, // !abstract
1253 false, // !external 1253 false, // !external
1254 false, // !native 1254 false, // !native
1255 initializer_owner, 1255 initializer_owner,
1256 field.token_pos())); 1256 field.token_pos()));
1257 initializer.set_result_type(AbstractType::Handle(zone, field.type())); 1257 initializer.set_result_type(AbstractType::Handle(zone, field.type()));
1258 // Static initializer functions are hidden from the user. 1258 // Static initializer functions are hidden from the user.
1259 // Since they are only executed once, we avoid optimizing 1259 // Since they are only executed once, we avoid inlining them.
1260 // and inlining them. After the field is initialized, the 1260 // After the field is initialized, the compiler can eliminate
1261 // compiler can eliminate the call to the static initializer. 1261 // the call to the static initializer.
1262 initializer.set_is_reflectable(false); 1262 initializer.set_is_reflectable(false);
1263 initializer.set_is_debuggable(false); 1263 initializer.set_is_debuggable(false);
1264 initializer.SetIsOptimizable(false);
1265 initializer.set_is_inlinable(false); 1264 initializer.set_is_inlinable(false);
1266 1265
1267 ParsedFunction* parsed_function = new ParsedFunction(thread, initializer); 1266 ParsedFunction* parsed_function = new ParsedFunction(thread, initializer);
1268 Parser parser(script, parsed_function, field.token_pos()); 1267 Parser parser(script, parsed_function, field.token_pos());
1269 1268
1270 SequenceNode* body = parser.ParseStaticInitializer(); 1269 SequenceNode* body = parser.ParseStaticInitializer();
1271 parsed_function->SetNodeSequence(body); 1270 parsed_function->SetNodeSequence(body);
1272 1271
1273 if (parsed_function->has_expression_temp_var()) { 1272 if (parsed_function->has_expression_temp_var()) {
1274 body->scope()->AddVariable(parsed_function->expression_temp_var()); 1273 body->scope()->AddVariable(parsed_function->expression_temp_var());
(...skipping 13210 matching lines...) Expand 10 before | Expand all | Expand 10 after
14485 const ArgumentListNode& function_args, 14484 const ArgumentListNode& function_args,
14486 const LocalVariable* temp_for_last_arg, 14485 const LocalVariable* temp_for_last_arg,
14487 bool is_super_invocation) { 14486 bool is_super_invocation) {
14488 UNREACHABLE(); 14487 UNREACHABLE();
14489 return NULL; 14488 return NULL;
14490 } 14489 }
14491 14490
14492 } // namespace dart 14491 } // namespace dart
14493 14492
14494 #endif // DART_PRECOMPILED_RUNTIME 14493 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698