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

Unified Diff: runtime/vm/parser.cc

Issue 189583003: Eliminate more implicit getters (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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/compiler_stats.cc ('k') | runtime/vm/service_test.cc » ('j') | 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 33404)
+++ runtime/vm/parser.cc (working copy)
@@ -761,6 +761,7 @@
void Parser::ParseFunction(ParsedFunction* parsed_function) {
TimerScope timer(FLAG_compiler_stats, &CompilerStats::parser_timer);
+ CompilerStats::num_functions_compiled++;
Isolate* isolate = Isolate::Current();
ASSERT(isolate->long_jump_base()->IsSafeToJump());
ASSERT(parsed_function != NULL);
@@ -792,9 +793,11 @@
break;
case RawFunction::kImplicitStaticFinalGetter:
node_sequence = parser.ParseStaticFinalGetter(func);
+ CompilerStats::num_implicit_final_getters++;
break;
case RawFunction::kStaticInitializer:
node_sequence = parser.ParseStaticInitializer(func);
+ CompilerStats::num_static_initializer_funcs++;
break;
case RawFunction::kMethodExtractor:
node_sequence = parser.ParseMethodExtractor(func);
@@ -3405,22 +3408,19 @@
if (has_initializer) {
ConsumeToken();
init_value = Object::sentinel().raw();
- // For static const fields and static final non-const fields, the
- // initialization expression will be parsed through the
- // kImplicitStaticFinalGetter method invocation/compilation.
+ // For static fields, the initialization expression will be parsed
+ // through the kImplicitStaticFinalGetter method invocation/compilation.
// For instance fields, the expression is parsed when a constructor
// is compiled.
- // For static const fields and static final non-const fields with very
- // simple initializer expressions (e.g. a literal number or string), we
- // optimize away the kImplicitStaticFinalGetter and initialize the field
- // here. However, the class finalizer will check the value type for
+ // For static fields with very simple initializer expressions
+ // (e.g. a literal number or string), we optimize away the
+ // kImplicitStaticFinalGetter and initialize the field here.
+ // However, the class finalizer will check the value type for
// assignability once the declared field type can be resolved. If the
// 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 && (field->has_const || field->has_final) &&
- (LookaheadToken(1) == Token::kSEMICOLON)) {
+ if (field->has_static && (LookaheadToken(1) == Token::kSEMICOLON)) {
has_simple_literal = IsSimpleLiteral(*field->type, &init_value);
}
SkipExpr();
@@ -3966,6 +3966,7 @@
void Parser::ParseClassDefinition(const Class& cls) {
TRACE_PARSER("ParseClassDefinition");
+ CompilerStats::num_classes_compiled++;
set_current_class(cls);
is_top_level_ = true;
String& class_name = String::Handle(cls.Name());
@@ -4580,7 +4581,7 @@
ConsumeToken();
Instance& field_value = Instance::Handle(Object::sentinel().raw());
bool has_simple_literal = false;
- if ((is_const || is_final) && (LookaheadToken(1) == Token::kSEMICOLON)) {
+ if (LookaheadToken(1) == Token::kSEMICOLON) {
has_simple_literal = IsSimpleLiteral(type, &field_value);
}
SkipExpr();
« no previous file with comments | « runtime/vm/compiler_stats.cc ('k') | runtime/vm/service_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698