OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/isolate.h" | 5 #include "vm/isolate.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/bigint_store.h" | 9 #include "vm/bigint_store.h" |
10 #include "vm/code_index_table.h" | 10 #include "vm/code_index_table.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 | 351 |
352 // Read object back from the snapshot. | 352 // Read object back from the snapshot. |
353 SnapshotReader reader(snapshot, Isolate::Current()); | 353 SnapshotReader reader(snapshot, Isolate::Current()); |
354 Instance& instance = Instance::Handle(); | 354 Instance& instance = Instance::Handle(); |
355 instance ^= reader.ReadObject(); | 355 instance ^= reader.ReadObject(); |
356 return instance.raw(); | 356 return instance.raw(); |
357 } | 357 } |
358 | 358 |
359 | 359 |
360 | 360 |
361 RawError* Isolate::StandardRunLoop() { | 361 RawObject* Isolate::StandardRunLoop() { |
| 362 ASSERT(long_jump_base() != NULL); |
362 ASSERT(message_notify_callback() == NULL); | 363 ASSERT(message_notify_callback() == NULL); |
363 ASSERT(message_handler() != NULL); | 364 ASSERT(message_handler() != NULL); |
364 | 365 |
365 while (message_handler()->HasLivePorts()) { | 366 while (message_handler()->HasLivePorts()) { |
366 ASSERT(this == Isolate::Current()); | 367 ASSERT(this == Isolate::Current()); |
367 Zone zone(this); | 368 Zone zone(this); |
368 HandleScope handle_scope(this); | 369 HandleScope handle_scope(this); |
369 | 370 |
370 Message* message = message_handler()->queue()->Dequeue(0); | 371 Message* message = message_handler()->queue()->Dequeue(0); |
371 if (message != NULL) { | 372 if (message != NULL) { |
372 if (message->priority() >= Message::kOOBPriority) { | 373 if (message->priority() >= Message::kOOBPriority) { |
373 // TODO(turnidge): Out of band messages will not go through the | 374 // TODO(turnidge): Out of band messages will not go through the |
374 // regular message handler. Instead they will be dispatched to | 375 // regular message handler. Instead they will be dispatched to |
375 // special vm code. Implement. | 376 // special vm code. Implement. |
376 UNIMPLEMENTED(); | 377 UNIMPLEMENTED(); |
377 } | 378 } |
378 const Instance& msg = | 379 const Instance& msg = |
379 Instance::Handle(DeserializeMessage(message->data())); | 380 Instance::Handle(DeserializeMessage(message->data())); |
380 const Object& result = Object::Handle( | 381 const Object& result = Object::Handle( |
381 DartLibraryCalls::HandleMessage( | 382 DartLibraryCalls::HandleMessage( |
382 message->dest_port(), message->reply_port(), msg)); | 383 message->dest_port(), message->reply_port(), msg)); |
383 delete message; | 384 delete message; |
384 if (result.IsError()) { | 385 if (result.IsError()) { |
385 Error& error = Error::Handle(); | 386 return result.raw(); |
386 error ^= result.raw(); | |
387 return error.raw(); | |
388 } | 387 } |
389 ASSERT(result.IsNull()); | 388 ASSERT(result.IsNull()); |
390 } | 389 } |
391 } | 390 } |
392 | 391 |
393 // Indicates success. | 392 // Indicates success. |
394 return Error::null(); | 393 return Object::null(); |
395 } | 394 } |
396 | 395 |
397 | 396 |
398 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, | 397 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, |
399 bool validate_frames) { | 398 bool validate_frames) { |
400 ASSERT(visitor != NULL); | 399 ASSERT(visitor != NULL); |
401 | 400 |
402 // Visit objects in the object store. | 401 // Visit objects in the object store. |
403 object_store()->VisitObjectPointers(visitor); | 402 object_store()->VisitObjectPointers(visitor); |
404 | 403 |
(...skipping 29 matching lines...) Expand all Loading... |
434 } | 433 } |
435 | 434 |
436 | 435 |
437 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) { | 436 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) { |
438 if (api_state() != NULL) { | 437 if (api_state() != NULL) { |
439 api_state()->VisitWeakHandles(visitor); | 438 api_state()->VisitWeakHandles(visitor); |
440 } | 439 } |
441 } | 440 } |
442 | 441 |
443 } // namespace dart | 442 } // namespace dart |
OLD | NEW |