| 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 RawObject* Isolate::StandardRunLoop() { | 361 RawError* Isolate::StandardRunLoop() { |
| 362 ASSERT(long_jump_base() != NULL); | |
| 363 ASSERT(message_notify_callback() == NULL); | 362 ASSERT(message_notify_callback() == NULL); |
| 364 ASSERT(message_handler() != NULL); | 363 ASSERT(message_handler() != NULL); |
| 365 | 364 |
| 366 while (message_handler()->HasLivePorts()) { | 365 while (message_handler()->HasLivePorts()) { |
| 367 ASSERT(this == Isolate::Current()); | 366 ASSERT(this == Isolate::Current()); |
| 368 Zone zone(this); | 367 Zone zone(this); |
| 369 HandleScope handle_scope(this); | 368 HandleScope handle_scope(this); |
| 370 | 369 |
| 371 Message* message = message_handler()->queue()->Dequeue(0); | 370 Message* message = message_handler()->queue()->Dequeue(0); |
| 372 if (message != NULL) { | 371 if (message != NULL) { |
| 373 if (message->priority() >= Message::kOOBPriority) { | 372 if (message->priority() >= Message::kOOBPriority) { |
| 374 // TODO(turnidge): Out of band messages will not go through the | 373 // TODO(turnidge): Out of band messages will not go through the |
| 375 // regular message handler. Instead they will be dispatched to | 374 // regular message handler. Instead they will be dispatched to |
| 376 // special vm code. Implement. | 375 // special vm code. Implement. |
| 377 UNIMPLEMENTED(); | 376 UNIMPLEMENTED(); |
| 378 } | 377 } |
| 379 const Instance& msg = | 378 const Instance& msg = |
| 380 Instance::Handle(DeserializeMessage(message->data())); | 379 Instance::Handle(DeserializeMessage(message->data())); |
| 381 const Object& result = Object::Handle( | 380 const Object& result = Object::Handle( |
| 382 DartLibraryCalls::HandleMessage( | 381 DartLibraryCalls::HandleMessage( |
| 383 message->dest_port(), message->reply_port(), msg)); | 382 message->dest_port(), message->reply_port(), msg)); |
| 384 delete message; | 383 delete message; |
| 385 if (result.IsError()) { | 384 if (result.IsError()) { |
| 386 return result.raw(); | 385 Error& error = Error::Handle(); |
| 386 error ^= result.raw(); |
| 387 return error.raw(); |
| 387 } | 388 } |
| 388 ASSERT(result.IsNull()); | 389 ASSERT(result.IsNull()); |
| 389 } | 390 } |
| 390 } | 391 } |
| 391 | 392 |
| 392 // Indicates success. | 393 // Indicates success. |
| 393 return Object::null(); | 394 return Error::null(); |
| 394 } | 395 } |
| 395 | 396 |
| 396 | 397 |
| 397 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, | 398 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, |
| 398 bool validate_frames) { | 399 bool validate_frames) { |
| 399 ASSERT(visitor != NULL); | 400 ASSERT(visitor != NULL); |
| 400 | 401 |
| 401 // Visit objects in the object store. | 402 // Visit objects in the object store. |
| 402 object_store()->VisitObjectPointers(visitor); | 403 object_store()->VisitObjectPointers(visitor); |
| 403 | 404 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 433 } | 434 } |
| 434 | 435 |
| 435 | 436 |
| 436 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) { | 437 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) { |
| 437 if (api_state() != NULL) { | 438 if (api_state() != NULL) { |
| 438 api_state()->VisitWeakHandles(visitor); | 439 api_state()->VisitWeakHandles(visitor); |
| 439 } | 440 } |
| 440 } | 441 } |
| 441 | 442 |
| 442 } // namespace dart | 443 } // namespace dart |
| OLD | NEW |