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

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

Issue 1318803002: Toward precompiled snapshots. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/vm/dart_entry.h ('k') | runtime/vm/object.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_native_api.h" 5 #include "include/dart_native_api.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/dart_api_message.h" 9 #include "vm/dart_api_message.h"
10 #include "vm/dart_api_state.h" 10 #include "vm/dart_api_state.h"
11 #include "vm/message.h" 11 #include "vm/message.h"
12 #include "vm/native_message_handler.h" 12 #include "vm/native_message_handler.h"
13 #include "vm/port.h" 13 #include "vm/port.h"
14 #include "vm/precompiler.h"
15 14
16 namespace dart { 15 namespace dart {
17 16
18 // --- Message sending/receiving from native code --- 17 // --- Message sending/receiving from native code ---
19 18
20 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { 19 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
21 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); 20 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
22 return reinterpret_cast<uint8_t*>(new_ptr); 21 return reinterpret_cast<uint8_t*>(new_ptr);
23 } 22 }
24 23
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 static void CompileAll(Isolate* isolate, Dart_Handle* result) { 72 static void CompileAll(Isolate* isolate, Dart_Handle* result) {
74 ASSERT(isolate != NULL); 73 ASSERT(isolate != NULL);
75 const Error& error = Error::Handle(isolate, Library::CompileAll()); 74 const Error& error = Error::Handle(isolate, Library::CompileAll());
76 if (error.IsNull()) { 75 if (error.IsNull()) {
77 *result = Api::Success(); 76 *result = Api::Success();
78 } else { 77 } else {
79 *result = Api::NewHandle(isolate, error.raw()); 78 *result = Api::NewHandle(isolate, error.raw());
80 } 79 }
81 } 80 }
82 81
83 static void Precompile(Isolate* isolate, Dart_Handle* result) {
84 ASSERT(isolate != NULL);
85 const Error& error = Error::Handle(isolate, Precompiler::CompileAll());
86 if (error.IsNull()) {
87 *result = Api::Success();
88 } else {
89 *result = Api::NewHandle(isolate, error.raw());
90 }
91 }
92
93 82
94 DART_EXPORT Dart_Handle Dart_CompileAll() { 83 DART_EXPORT Dart_Handle Dart_CompileAll() {
95 DARTSCOPE(Thread::Current()); 84 DARTSCOPE(Thread::Current());
96 Dart_Handle result = Api::CheckAndFinalizePendingClasses(I); 85 Dart_Handle result = Api::CheckAndFinalizePendingClasses(I);
97 if (::Dart_IsError(result)) { 86 if (::Dart_IsError(result)) {
98 return result; 87 return result;
99 } 88 }
100 CHECK_CALLBACK_STATE(I); 89 CHECK_CALLBACK_STATE(I);
101 CompileAll(I, &result); 90 CompileAll(I, &result);
102 return result; 91 return result;
103 } 92 }
104 93
105
106 DART_EXPORT Dart_Handle Dart_Precompile() {
107 DARTSCOPE(Thread::Current());
108 Dart_Handle result = Api::CheckAndFinalizePendingClasses(I);
109 if (::Dart_IsError(result)) {
110 return result;
111 }
112 CHECK_CALLBACK_STATE(I);
113 Precompile(I, &result);
114 return result;
115 }
116
117 } // namespace dart 94 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_entry.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698