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

Unified Diff: runtime/vm/compiler.cc

Issue 1970363002: Add timeline events for compiling static initializers and writing full snapshots. Remove timeline e… (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/compiler.cc
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
index e084f1606dc6a3e64f38c5aee33a163dc219ad5a..b67e37462e5b9dc8d167d413d35a6c188670395c 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -1568,19 +1568,31 @@ RawObject* Compiler::EvaluateStaticInitializer(const Field& field) {
// it now, but don't bother remembering it because it won't be used again.
ASSERT(!field.HasPrecompiledInitializer());
Thread* const thread = Thread::Current();
- StackZone zone(thread);
- ParsedFunction* parsed_function =
- Parser::ParseStaticFieldInitializer(field);
-
- parsed_function->AllocateVariables();
- // Non-optimized code generator.
- DartCompilationPipeline pipeline;
- CompileParsedFunctionHelper helper(parsed_function, false, kNoOSRDeoptId);
- helper.Compile(&pipeline);
- const Function& initializer =
- Function::Handle(parsed_function->function().raw());
- Code::Handle(initializer.unoptimized_code()).set_var_descriptors(
- Object::empty_var_descriptors());
+ Function& initializer = Function::Handle(thread->zone());
+ {
+#ifndef PRODUCT
Cutch 2016/05/13 20:23:27 could use NOT_IN_PRODUCT()
rmacnak 2016/05/16 16:28:49 Done.
+ VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId);
+ TimelineDurationScope tds(thread, Timeline::GetCompilerStream(),
+ "CompileStaticInitializer");
+ if (tds.enabled()) {
+ tds.SetNumArguments(1);
+ tds.CopyArgument(0, "field", field.ToCString());
+ }
+#endif // !PRODUCT
+
+ StackZone zone(thread);
+ ParsedFunction* parsed_function =
+ Parser::ParseStaticFieldInitializer(field);
+
+ parsed_function->AllocateVariables();
+ // Non-optimized code generator.
+ DartCompilationPipeline pipeline;
+ CompileParsedFunctionHelper helper(parsed_function, false, kNoOSRDeoptId);
+ helper.Compile(&pipeline);
+ initializer = parsed_function->function().raw();
+ Code::Handle(initializer.unoptimized_code()).set_var_descriptors(
+ Object::empty_var_descriptors());
+ }
// Invoke the function to evaluate the expression.
return DartEntry::InvokeFunction(initializer, Object::empty_array());
} else {
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698