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

Side by Side Diff: bin/main.cc

Issue 8537023: Implement automatic loading of dart:core_native_fields library (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 <stdlib.h> 5 #include <stdlib.h>
6 #include <string.h> 6 #include <string.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "include/dart_api.h" 9 #include "include/dart_api.h"
10 10
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 Dart_EnterScope(); 163 Dart_EnterScope();
164 164
165 // Load the specified script. 165 // Load the specified script.
166 library = LoadScript(script_name); 166 library = LoadScript(script_name);
167 if (!Dart_IsValid(library)) { 167 if (!Dart_IsValid(library)) {
168 const char* err_msg = Dart_GetError(library); 168 const char* err_msg = Dart_GetError(library);
169 fprintf(stderr, "Errors encountered while loading script: %s\n", err_msg); 169 fprintf(stderr, "Errors encountered while loading script: %s\n", err_msg);
170 Dart_ExitScope(); 170 Dart_ExitScope();
171 exit(255); 171 exit(255);
172 } 172 }
173
174 if (!Dart_IsLibrary(library)) { 173 if (!Dart_IsLibrary(library)) {
175 fprintf(stderr, 174 fprintf(stderr,
176 "Expected a library when loading script: %s", 175 "Expected a library when loading script: %s",
177 script_name); 176 script_name);
178 Dart_ExitScope(); 177 Dart_ExitScope();
179 exit(255); 178 exit(255);
180 } 179 }
181 Builtin_ImportLibrary(library); 180 Builtin_ImportLibrary(library);
182 // Setup the native resolver for built in library functions.
183 Builtin_SetNativeResolver();
Anton Muhin 2011/11/13 16:19:32 why it is removed?
siva 2011/11/15 02:16:52 It is not removed, it has been moved into Builtin_
184 181
185 Dart_ExitScope(); 182 Dart_ExitScope();
186 return data; 183 return data;
187 } 184 }
188 185
189 186
190 static void PrintUsage() { 187 static void PrintUsage() {
191 fprintf(stderr, 188 fprintf(stderr,
192 "dart [<vm-flags>] <dart-script-file> [<dart-options>]\n"); 189 "dart [<vm-flags>] <dart-script-file> [<dart-options>]\n");
193 } 190 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 return 255; // Indicates we encountered an error. 238 return 255; // Indicates we encountered an error.
242 } 239 }
243 Dart_Isolate isolate = Dart_CreateIsolate(snapshot_buffer, 240 Dart_Isolate isolate = Dart_CreateIsolate(snapshot_buffer,
244 canonical_script_name); 241 canonical_script_name);
245 if (isolate == NULL) { 242 if (isolate == NULL) {
246 free(canonical_script_name); 243 free(canonical_script_name);
247 return 255; 244 return 255;
248 } 245 }
249 246
250 Dart_EnterScope(); 247 Dart_EnterScope();
248 if (snapshot_buffer != NULL) {
249 // Setup the native resolver as the snapshot does not carry it.
250 Builtin_SetNativeResolver();
Anton Muhin 2011/11/13 16:19:32 why not set builtin native resolver unconditionall
siva 2011/11/15 02:16:52 We don't have to do this for the regular binary as
251 }
251 if (HasCompileAll(vm_options)) { 252 if (HasCompileAll(vm_options)) {
252 Dart_Handle result = Dart_CompileAll(); 253 Dart_Handle result = Dart_CompileAll();
253 if (!Dart_IsValid(result)) { 254 if (!Dart_IsValid(result)) {
254 fprintf(stderr, "%s\n", Dart_GetError(result)); 255 fprintf(stderr, "%s\n", Dart_GetError(result));
255 Dart_ExitScope(); 256 Dart_ExitScope();
256 Dart_ShutdownIsolate(); 257 Dart_ShutdownIsolate();
257 free(canonical_script_name); 258 free(canonical_script_name);
258 return 255; // Indicates we encountered an error. 259 return 255; // Indicates we encountered an error.
259 } 260 }
260 } 261 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 return 255; // Indicates we encountered an error. 319 return 255; // Indicates we encountered an error.
319 } 320 }
320 free(canonical_script_name); 321 free(canonical_script_name);
321 Dart_ExitScope(); 322 Dart_ExitScope();
322 // Dump symbol information for the profiler. 323 // Dump symbol information for the profiler.
323 DumpPprofSymbolInfo(); 324 DumpPprofSymbolInfo();
324 // Shutdown the isolate. 325 // Shutdown the isolate.
325 Dart_ShutdownIsolate(); 326 Dart_ShutdownIsolate();
326 return 0; 327 return 0;
327 } 328 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698