Index: runtime/vm/isolate.cc |
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc |
index f8133efa01441bf6c2a1b3e9a705498c4d8cb102..4617be183a556b63309baf6c8d8ddb0e4561c0e5 100644 |
--- a/runtime/vm/isolate.cc |
+++ b/runtime/vm/isolate.cc |
@@ -468,24 +468,29 @@ MessageHandler::MessageStatus IsolateMessageHandler::HandleMessage( |
} |
// Parse the message. |
- MessageSnapshotReader reader(message->data(), message->len(), thread); |
- const Object& msg_obj = Object::Handle(zone, reader.ReadObject()); |
- if (msg_obj.IsError()) { |
- // An error occurred while reading the message. |
- delete message; |
- return ProcessUnhandledException(Error::Cast(msg_obj)); |
- } |
- if (!msg_obj.IsNull() && !msg_obj.IsInstance()) { |
- // TODO(turnidge): We need to decide what an isolate does with |
- // malformed messages. If they (eventually) come from a remote |
- // machine, then it might make sense to drop the message entirely. |
- // In the case that the message originated locally, which is |
- // always true for now, then this should never occur. |
- UNREACHABLE(); |
- } |
- |
Instance& msg = Instance::Handle(zone); |
- msg ^= msg_obj.raw(); // Can't use Instance::Cast because may be null. |
+ if (message->len() > 0) { |
Ivan Posva
2015/12/09 22:45:28
How about turning it around:
if (message->IsRaw())
zra
2015/12/10 00:07:29
Done.
|
+ MessageSnapshotReader reader(message->data(), message->len(), thread); |
+ const Object& msg_obj = Object::Handle(zone, reader.ReadObject()); |
+ if (msg_obj.IsError()) { |
+ // An error occurred while reading the message. |
+ delete message; |
+ return ProcessUnhandledException(Error::Cast(msg_obj)); |
+ } |
+ if (!msg_obj.IsNull() && !msg_obj.IsInstance()) { |
+ // TODO(turnidge): We need to decide what an isolate does with |
+ // malformed messages. If they (eventually) come from a remote |
+ // machine, then it might make sense to drop the message entirely. |
+ // In the case that the message originated locally, which is |
+ // always true for now, then this should never occur. |
+ UNREACHABLE(); |
+ } |
+ msg ^= msg_obj.raw(); // Can't use Instance::Cast because may be null. |
+ } else { |
+ ASSERT(message->len() == 0); |
+ msg ^= message->raw_obj(); |
+ ASSERT(msg.IsSmi() || msg.InVMHeap()); |
+ } |
MessageStatus status = kOK; |
if (message->IsOOB()) { |