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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 1359963002: Let the embedder provide entry points to Dart_Precompile. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/precompiler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 5912 matching lines...) Expand 10 before | Expand all | Expand 10 after
5923 ASSERT(stream != NULL); 5923 ASSERT(stream != NULL);
5924 TimelineEvent* event = stream->StartEvent(); 5924 TimelineEvent* event = stream->StartEvent();
5925 if (event != NULL) { 5925 if (event != NULL) {
5926 event->AsyncEnd(label, async_id); 5926 event->AsyncEnd(label, async_id);
5927 event->Complete(); 5927 event->Complete();
5928 } 5928 }
5929 return Api::Success(); 5929 return Api::Success();
5930 } 5930 }
5931 5931
5932 5932
5933 static void Precompile(Isolate* isolate, Dart_Handle* result) { 5933 DART_EXPORT Dart_Handle Dart_Precompile(
5934 ASSERT(isolate != NULL); 5934 Dart_QualifiedFunctionName entry_points[]) {
5935 const Error& error = Error::Handle(isolate, Precompiler::CompileAll());
5936 if (error.IsNull()) {
5937 *result = Api::Success();
5938 } else {
5939 *result = Api::NewHandle(isolate, error.raw());
5940 }
5941 }
5942
5943
5944 DART_EXPORT Dart_Handle Dart_Precompile() {
5945 DARTSCOPE(Thread::Current()); 5935 DARTSCOPE(Thread::Current());
5946 Dart_Handle result = Api::CheckAndFinalizePendingClasses(I); 5936 Dart_Handle result = Api::CheckAndFinalizePendingClasses(I);
5947 if (::Dart_IsError(result)) { 5937 if (::Dart_IsError(result)) {
5948 return result; 5938 return result;
5949 } 5939 }
5950 CHECK_CALLBACK_STATE(I); 5940 CHECK_CALLBACK_STATE(I);
5951 Precompile(I, &result); 5941 const Error& error = Error::Handle(Precompiler::CompileAll(entry_points));
5952 return result; 5942 if (!error.IsNull()) {
5943 return Api::NewHandle(I, error.raw());
5944 }
5945 return Api::Success();
5953 } 5946 }
5954 5947
5955 5948
5956 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshot( 5949 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshot(
5957 uint8_t** vm_isolate_snapshot_buffer, 5950 uint8_t** vm_isolate_snapshot_buffer,
5958 intptr_t* vm_isolate_snapshot_size, 5951 intptr_t* vm_isolate_snapshot_size,
5959 uint8_t** isolate_snapshot_buffer, 5952 uint8_t** isolate_snapshot_buffer,
5960 intptr_t* isolate_snapshot_size, 5953 intptr_t* isolate_snapshot_size,
5961 uint8_t** instructions_snapshot_buffer, 5954 uint8_t** instructions_snapshot_buffer,
5962 intptr_t* instructions_snapshot_size) { 5955 intptr_t* instructions_snapshot_size) {
(...skipping 29 matching lines...) Expand all
5992 ApiReallocate); 5985 ApiReallocate);
5993 writer.WriteFullSnapshot(); 5986 writer.WriteFullSnapshot();
5994 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); 5987 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize();
5995 *isolate_snapshot_size = writer.IsolateSnapshotSize(); 5988 *isolate_snapshot_size = writer.IsolateSnapshotSize();
5996 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); 5989 *instructions_snapshot_size = writer.InstructionsSnapshotSize();
5997 5990
5998 return Api::Success(); 5991 return Api::Success();
5999 } 5992 }
6000 5993
6001 } // namespace dart 5994 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/precompiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698