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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 1953673004: Remove unnecessary full GCs before snapshot creation. (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/snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index a53ede7909ea2035b94d7b2defc00a3f3fb9161e..efefae1eeae4a6f39cd148e20e3feb9a8cc7e7d9 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -1482,13 +1482,13 @@ DART_EXPORT Dart_Handle Dart_CreateSnapshot(
if (::Dart_IsError(state)) {
return state;
}
- I->heap()->CollectAllGarbage();
I->StopBackgroundCompiler();
#if defined(DEBUG)
+ I->heap()->CollectAllGarbage();
FunctionVisitor check_canonical(T);
I->heap()->IterateObjects(&check_canonical);
-#endif // #if defined(DEBUG).
+#endif // #if defined(DEBUG)
FullSnapshotWriter writer(Snapshot::kCore,
vm_isolate_snapshot_buffer,
@@ -1525,11 +1525,13 @@ static Dart_Handle createLibrarySnapshot(Dart_Handle library,
} else {
lib ^= Api::UnwrapHandle(library);
}
- I->heap()->CollectAllGarbage();
+
#if defined(DEBUG)
+ I->heap()->CollectAllGarbage();
FunctionVisitor check_canonical(T);
I->heap()->IterateObjects(&check_canonical);
-#endif // #if defined(DEBUG).
+#endif // #if defined(DEBUG)
+
ScriptSnapshotWriter writer(buffer, ApiReallocate);
writer.WriteScriptSnapshot(lib);
*size = writer.BytesWritten();
@@ -6115,7 +6117,6 @@ DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly(
if (assembly_size == NULL) {
RETURN_NULL_ERROR(assembly_size);
}
- I->heap()->CollectAllGarbage();
AssemblyInstructionsWriter instructions_writer(assembly_buffer,
ApiReallocate,
2 * MB /* initial_size */);
@@ -6176,7 +6177,6 @@ DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob(
if (rodata_blob_size == NULL) {
RETURN_NULL_ERROR(instructions_blob_size);
}
- I->heap()->CollectAllGarbage();
BlobInstructionsWriter instructions_writer(instructions_blob_buffer,
rodata_blob_buffer,
ApiReallocate,
@@ -6273,7 +6273,6 @@ DART_EXPORT Dart_Handle Dart_CreatePrecompiledJITSnapshotBlob(
if (::Dart_IsError(state)) {
return state;
}
- I->heap()->CollectAllGarbage();
I->StopBackgroundCompiler();
BlobInstructionsWriter instructions_writer(instructions_blob_buffer,
« no previous file with comments | « no previous file | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698