| 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/code_index_table.h" |    9 #include "vm/code_index_table.h" | 
|   10 #include "vm/compiler_stats.h" |   10 #include "vm/compiler_stats.h" | 
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   59 } |   59 } | 
|   60  |   60  | 
|   61 const char* IsolateMessageHandler::name() const { |   61 const char* IsolateMessageHandler::name() const { | 
|   62   return isolate_->name(); |   62   return isolate_->name(); | 
|   63 } |   63 } | 
|   64  |   64  | 
|   65  |   65  | 
|   66 void IsolateMessageHandler::MessageNotify(Message::Priority priority) { |   66 void IsolateMessageHandler::MessageNotify(Message::Priority priority) { | 
|   67   if (priority >= Message::kOOBPriority) { |   67   if (priority >= Message::kOOBPriority) { | 
|   68     // Handle out of band messages even if the isolate is busy. |   68     // Handle out of band messages even if the isolate is busy. | 
|   69     // isolate_->ScheduleInterrupts(Isolate::kMessageInterrupt); |   69     isolate_->ScheduleInterrupts(Isolate::kMessageInterrupt); | 
|   70     UNIMPLEMENTED(); |  | 
|   71   } |   70   } | 
|   72   Dart_MessageNotifyCallback callback = isolate_->message_notify_callback(); |   71   Dart_MessageNotifyCallback callback = isolate_->message_notify_callback(); | 
|   73   if (callback) { |   72   if (callback) { | 
|   74     // Allow the embedder to handle message notification. |   73     // Allow the embedder to handle message notification. | 
|   75     (*callback)(Api::CastIsolate(isolate_)); |   74     (*callback)(Api::CastIsolate(isolate_)); | 
|   76   } |   75   } | 
|   77 } |   76 } | 
|   78  |   77  | 
|   79  |   78  | 
|   80 #if defined(DEBUG) |   79 #if defined(DEBUG) | 
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  387  |  386  | 
|  388 RawError* Isolate::StandardRunLoop() { |  387 RawError* Isolate::StandardRunLoop() { | 
|  389   ASSERT(message_notify_callback() == NULL); |  388   ASSERT(message_notify_callback() == NULL); | 
|  390   ASSERT(message_handler() != NULL); |  389   ASSERT(message_handler() != NULL); | 
|  391  |  390  | 
|  392   while (message_handler()->HasLivePorts()) { |  391   while (message_handler()->HasLivePorts()) { | 
|  393     ASSERT(this == Isolate::Current()); |  392     ASSERT(this == Isolate::Current()); | 
|  394     Zone zone(this); |  393     Zone zone(this); | 
|  395     HandleScope handle_scope(this); |  394     HandleScope handle_scope(this); | 
|  396  |  395  | 
 |  396     // TODO(turnidge): This code is duplicated elsewhere.  Consolidate. | 
|  397     Message* message = message_handler()->queue()->Dequeue(0); |  397     Message* message = message_handler()->queue()->Dequeue(0); | 
|  398     if (message != NULL) { |  398     if (message != NULL) { | 
|  399       if (message->priority() >= Message::kOOBPriority) { |  | 
|  400         // TODO(turnidge): Out of band messages will not go through the |  | 
|  401         // regular message handler.  Instead they will be dispatched to |  | 
|  402         // special vm code.  Implement. |  | 
|  403         UNIMPLEMENTED(); |  | 
|  404       } |  | 
|  405       const Instance& msg = |  399       const Instance& msg = | 
|  406           Instance::Handle(DeserializeMessage(message->data())); |  400           Instance::Handle(DeserializeMessage(message->data())); | 
|  407       const Object& result = Object::Handle( |  401       if (message->priority() >= Message::kOOBPriority) { | 
|  408           DartLibraryCalls::HandleMessage( |  402         // For now the only OOB messages are Mirrors messages. | 
|  409               message->dest_port(), message->reply_port(), msg)); |  403         const Object& result = Object::Handle( | 
|  410       delete message; |  404             DartLibraryCalls::HandleMirrorsMessage( | 
|  411       if (result.IsError()) { |  405                 message->dest_port(), message->reply_port(), msg)); | 
|  412         Error& error = Error::Handle(); |  406         delete message; | 
|  413         error ^= result.raw(); |  407         if (result.IsError()) { | 
|  414         return error.raw(); |  408           // TODO(turnidge): Propagating the error is probably wrong here. | 
 |  409           Error& error = Error::Handle(); | 
 |  410           error ^= result.raw(); | 
 |  411           return error.raw(); | 
 |  412         } | 
 |  413         ASSERT(result.IsNull()); | 
 |  414       } else { | 
 |  415         const Object& result = Object::Handle( | 
 |  416             DartLibraryCalls::HandleMessage( | 
 |  417                 message->dest_port(), message->reply_port(), msg)); | 
 |  418         delete message; | 
 |  419         if (result.IsError()) { | 
 |  420           Error& error = Error::Handle(); | 
 |  421           error ^= result.raw(); | 
 |  422           return error.raw(); | 
 |  423         } | 
 |  424         ASSERT(result.IsNull()); | 
|  415       } |  425       } | 
|  416       ASSERT(result.IsNull()); |  | 
|  417     } |  426     } | 
|  418   } |  427   } | 
|  419  |  428  | 
|  420   // Indicates success. |  429   // Indicates success. | 
|  421   return Error::null(); |  430   return Error::null(); | 
|  422 } |  431 } | 
|  423  |  432  | 
|  424  |  433  | 
|  425 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, |  434 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, | 
|  426                                   bool validate_frames) { |  435                                   bool validate_frames) { | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  461 } |  470 } | 
|  462  |  471  | 
|  463  |  472  | 
|  464 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) { |  473 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) { | 
|  465   if (api_state() != NULL) { |  474   if (api_state() != NULL) { | 
|  466     api_state()->VisitWeakHandles(visitor); |  475     api_state()->VisitWeakHandles(visitor); | 
|  467   } |  476   } | 
|  468 } |  477 } | 
|  469  |  478  | 
|  470 }  // namespace dart |  479 }  // namespace dart | 
| OLD | NEW |