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

Unified Diff: runtime/vm/dart_api_impl.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
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index e980f0930b44c520818725eea6c0eb708d5dde17..1faa4eda50f0a5ec60f9ee2ad7652fc62be3dcba 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -1463,10 +1463,13 @@ DART_EXPORT Dart_Handle Dart_CreateSnapshot(
intptr_t* vm_isolate_snapshot_size,
uint8_t** isolate_snapshot_buffer,
intptr_t* isolate_snapshot_size) {
- ASSERT(FLAG_load_deferred_eagerly);
DARTSCOPE(Thread::Current());
API_TIMELINE_DURATION;
Isolate* I = T->isolate();
+ if (!FLAG_load_deferred_eagerly) {
+ return Dart_NewApiError(
+ "Creating full snapshots requires --load_deferred_eagerly");
+ }
if (vm_isolate_snapshot_buffer != NULL &&
vm_isolate_snapshot_size == NULL) {
RETURN_NULL_ERROR(vm_isolate_snapshot_size);
@@ -5239,7 +5242,7 @@ DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer,
return Api::NewError("%s expects parameter 'buffer' to be a script type"
" snapshot with a valid length.", CURRENT_FUNC);
}
- if (!snapshot->IsScriptSnapshot()) {
+ if (snapshot->kind() != Snapshot::kScript) {
return Api::NewError("%s expects parameter 'buffer' to be a script type"
" snapshot.", CURRENT_FUNC);
}
@@ -6156,7 +6159,6 @@ DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly(
intptr_t* isolate_snapshot_size,
uint8_t** assembly_buffer,
intptr_t* assembly_size) {
- ASSERT(FLAG_load_deferred_eagerly);
API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
Isolate* I = T->isolate();
@@ -6164,6 +6166,7 @@ DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly(
return Dart_NewApiError("Isolate is not precompiled. "
"Did you forget to call Dart_Precompile?");
}
+ ASSERT(FLAG_load_deferred_eagerly);
if (vm_isolate_snapshot_buffer == NULL) {
RETURN_NULL_ERROR(vm_isolate_snapshot_buffer);
}
@@ -6182,6 +6185,9 @@ DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly(
if (assembly_size == NULL) {
RETURN_NULL_ERROR(assembly_size);
}
+
+ NOT_IN_PRODUCT(TimelineDurationScope tds2(T, Timeline::GetIsolateStream(),
+ "WriteAppAOTSnapshot"));
AssemblyInstructionsWriter instructions_writer(assembly_buffer,
ApiReallocate,
2 * MB /* initial_size */);
@@ -6209,7 +6215,6 @@ DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob(
intptr_t* instructions_blob_size,
uint8_t** rodata_blob_buffer,
intptr_t* rodata_blob_size) {
- ASSERT(FLAG_load_deferred_eagerly);
API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
Isolate* I = T->isolate();
@@ -6217,6 +6222,7 @@ DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob(
return Dart_NewApiError("Isolate is not precompiled. "
"Did you forget to call Dart_Precompile?");
}
+ ASSERT(FLAG_load_deferred_eagerly);
if (vm_isolate_snapshot_buffer == NULL) {
RETURN_NULL_ERROR(vm_isolate_snapshot_buffer);
}
@@ -6241,6 +6247,9 @@ DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob(
if (rodata_blob_size == NULL) {
RETURN_NULL_ERROR(instructions_blob_size);
}
+
+ NOT_IN_PRODUCT(TimelineDurationScope tds2(T, Timeline::GetIsolateStream(),
+ "WriteAppAOTSnapshot"));
BlobInstructionsWriter instructions_writer(instructions_blob_buffer,
rodata_blob_buffer,
ApiReallocate,
@@ -6303,10 +6312,13 @@ DART_EXPORT Dart_Handle Dart_CreatePrecompiledJITSnapshotBlob(
intptr_t* instructions_blob_size,
uint8_t** rodata_blob_buffer,
intptr_t* rodata_blob_size) {
- ASSERT(FLAG_load_deferred_eagerly);
API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
Isolate* I = T->isolate();
+ if (!FLAG_load_deferred_eagerly) {
+ return Dart_NewApiError(
+ "Creating full snapshots requires --load_deferred_eagerly");
+ }
if (vm_isolate_snapshot_buffer == NULL) {
RETURN_NULL_ERROR(vm_isolate_snapshot_buffer);
}
@@ -6338,6 +6350,8 @@ DART_EXPORT Dart_Handle Dart_CreatePrecompiledJITSnapshotBlob(
}
I->StopBackgroundCompiler();
+ NOT_IN_PRODUCT(TimelineDurationScope tds2(T, Timeline::GetIsolateStream(),
+ "WriteAppJITSnapshot"));
BlobInstructionsWriter instructions_writer(instructions_blob_buffer,
rodata_blob_buffer,
ApiReallocate,

Powered by Google App Engine
This is Rietveld 408576698