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

Side by Side Diff: lib/isolate.cc

Issue 8334031: - Fix the snapshot generation python script to return an error code when snapshot generation fail... (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
« no previous file with comments | « no previous file | tools/create_snapshot_file.py » ('j') | vm/dart_api_impl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "vm/assert.h" 7 #include "vm/assert.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/dart.h" 9 #include "vm/dart.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 249
250 250
251 DEFINE_NATIVE_ENTRY(IsolateNatives_start, 2) { 251 DEFINE_NATIVE_ENTRY(IsolateNatives_start, 2) {
252 Isolate* preserved_isolate = Isolate::Current(); 252 Isolate* preserved_isolate = Isolate::Current();
253 const Instance& runnable = Instance::CheckedHandle(arguments->At(0)); 253 const Instance& runnable = Instance::CheckedHandle(arguments->At(0));
254 const Class& runnable_class = Class::Handle(runnable.clazz()); 254 const Class& runnable_class = Class::Handle(runnable.clazz());
255 const char* class_name = String::Handle(runnable_class.Name()).ToCString(); 255 const char* class_name = String::Handle(runnable_class.Name()).ToCString();
256 const Library& library = Library::Handle(runnable_class.library()); 256 const Library& library = Library::Handle(runnable_class.library());
257 ASSERT(!library.IsNull()); 257 ASSERT(!library.IsNull());
258 const char* library_url = String::Handle(library.url()).ToCString(); 258 const char* library_url = String::Handle(library.url()).ToCString();
259
260 intptr_t port_id = 0; 259 intptr_t port_id = 0;
261 const char* error_msg = NULL; 260 const char* error_msg = NULL;
261 LongJump jump;
262 bool init_successful = true;
262 263
263 Isolate* spawned_isolate = 264 Isolate* spawned_isolate = Dart::CreateIsolate();
264 Dart::CreateIsolate(NULL, preserved_isolate->init_callback_data());
265 if (spawned_isolate != NULL) { 265 if (spawned_isolate != NULL) {
266 // First initialize the spawned isolate.
267 spawned_isolate->set_long_jump_base(&jump);
268 if (setjmp(*jump.Set()) == 0) {
269 Dart::InitializeIsolate(NULL, preserved_isolate->init_callback_data());
270 } else {
271 init_successful = false;
272 }
273 spawned_isolate->set_long_jump_base(NULL);
Ivan Posva 2011/11/04 17:24:42 Why not resetting it to the original value here? I
siva 2011/11/04 22:01:57 Done.
266 // Check arguments to see if the specified library and classes are 274 // Check arguments to see if the specified library and classes are
267 // loaded, this check will throw an exception if they are not loaded. 275 // loaded, this check will throw an exception if they are not loaded.
268 if (CheckArguments(library_url, class_name)) { 276 if (init_successful && CheckArguments(library_url, class_name)) {
269 port_id = PortMap::CreatePort(); 277 port_id = PortMap::CreatePort();
270 uword data = reinterpret_cast<uword>( 278 uword data = reinterpret_cast<uword>(
271 new IsolateStartData(spawned_isolate, 279 new IsolateStartData(spawned_isolate,
272 strdup(library_url), 280 strdup(library_url),
273 strdup(class_name), 281 strdup(class_name),
274 port_id)); 282 port_id));
275 new Thread(RunIsolate, data); 283 new Thread(RunIsolate, data);
276 } else { 284 } else {
277 // Error loading application into spawned isolate, shut it down and 285 // Error spawning the isolate maybe due to initialization errors or
278 // report error. 286 // errors while loading the application into spawned isolate, shut
287 // it down and report error.
279 // Make sure to grab the error message out of the isolate before it has 288 // Make sure to grab the error message out of the isolate before it has
280 // been shutdown and to allocate it in the preserved isolates zone. 289 // been shutdown and to allocate it in the preserved isolates zone.
281 { 290 {
282 Zone zone; 291 Zone zone;
283 HandleScope scope; 292 HandleScope scope;
284 const String& error = String::Handle( 293 const String& error = String::Handle(
285 spawned_isolate->object_store()->sticky_error()); 294 spawned_isolate->object_store()->sticky_error());
286 const char* temp_error_msg = error.ToCString(); 295 const char* temp_error_msg = error.ToCString();
287 intptr_t err_len = strlen(temp_error_msg) + 1; 296 intptr_t err_len = strlen(temp_error_msg) + 1;
288 Zone* preserved_zone = preserved_isolate->current_zone(); 297 Zone* preserved_zone = preserved_isolate->current_zone();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 intptr_t send_id = Smi::CheckedHandle(arguments->At(0)).Value(); 345 intptr_t send_id = Smi::CheckedHandle(arguments->At(0)).Value();
337 intptr_t reply_id = Smi::CheckedHandle(arguments->At(1)).Value(); 346 intptr_t reply_id = Smi::CheckedHandle(arguments->At(1)).Value();
338 // TODO(iposva): Allow for arbitrary messages to be sent. 347 // TODO(iposva): Allow for arbitrary messages to be sent.
339 void* data = SerializeObject(Instance::CheckedHandle(arguments->At(2))); 348 void* data = SerializeObject(Instance::CheckedHandle(arguments->At(2)));
340 349
341 // TODO(turnidge): Throw an exception when the return value is false? 350 // TODO(turnidge): Throw an exception when the return value is false?
342 PortMap::PostMessage(send_id, reply_id, data); 351 PortMap::PostMessage(send_id, reply_id, data);
343 } 352 }
344 353
345 } // namespace dart 354 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tools/create_snapshot_file.py » ('j') | vm/dart_api_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698