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

Unified Diff: vm/dart_api_impl.cc

Issue 8970004: Changes to create an application snapshot which can be layered on top (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years 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 | « tests/vm/vm.status ('k') | vm/raw_object_snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/dart_api_impl.cc
===================================================================
--- vm/dart_api_impl.cc (revision 2601)
+++ vm/dart_api_impl.cc (working copy)
@@ -613,6 +613,7 @@
intptr_t* size) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ TIMERSCOPE(time_creating_snapshot);
if (buffer == NULL) {
return Api::Error("%s expects argument 'buffer' to be non-null.",
CURRENT_FUNC);
@@ -635,11 +636,11 @@
}
-DART_EXPORT Dart_Handle Dart_CreateScriptSnapshot(Dart_Handle library,
- uint8_t** buffer,
+DART_EXPORT Dart_Handle Dart_CreateScriptSnapshot(uint8_t** buffer,
intptr_t* size) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ TIMERSCOPE(time_creating_snapshot);
if (buffer == NULL) {
return Api::Error("%s expects argument 'buffer' to be non-null.",
CURRENT_FUNC);
@@ -648,16 +649,17 @@
return Api::Error("%s expects argument 'size' to be non-null.",
CURRENT_FUNC);
}
- const Library& root_lib = Api::UnwrapLibraryHandle(library);
- if (root_lib.IsNull()) {
- RETURN_TYPE_ERROR(library, Library);
- }
const char* msg = CheckIsolateState(isolate);
if (msg != NULL) {
return Api::Error(msg);
}
- ScriptSnapshotWriter writer(root_lib, buffer, ApiAllocator);
- writer.WriteScriptSnapshot();
+ Library& library = Library::Handle(isolate->object_store()->root_library());
+ if (library.IsNull()) {
+ return Api::Error("%s expects the isolate to have a script loaded in it.",
+ CURRENT_FUNC);
+ }
+ ScriptSnapshotWriter writer(buffer, ApiAllocator);
+ writer.WriteScriptSnapshot(library);
*size = writer.Size();
return Api::Success();
}
@@ -2287,6 +2289,7 @@
DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
+ TIMERSCOPE(time_script_loading);
if (buffer == NULL) {
return Api::Error("%s expects argument 'buffer' to be non-null.",
CURRENT_FUNC);
@@ -2309,6 +2312,7 @@
CURRENT_FUNC);
}
library ^= tmp.raw();
+ library.Register();
isolate->object_store()->set_root_library(library);
return Api::NewLocalHandle(library);
}
« no previous file with comments | « tests/vm/vm.status ('k') | vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698