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

Unified Diff: runtime/vm/isolate.cc

Issue 11440035: Optimize the message queue for many active ports with few messages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge with caching changes. Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_entry.cc ('k') | runtime/vm/message.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index fee9cbb8a331bacdbc54ac56479a4ceea34b69d5..061cf7cbc4a35844b1754e623a7709eb3e914dfc 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -89,6 +89,21 @@ bool IsolateMessageHandler::HandleMessage(Message* message) {
StackZone zone(isolate_);
HandleScope handle_scope(isolate_);
+ // If the message is in band we lookup the receive port to dispatch to. If
+ // the receive port is closed, we drop the message without deserializing it.
+ Object& receive_port = Object::Handle();
+ if (!message->IsOOB()) {
+ receive_port = DartLibraryCalls::LookupReceivePort(message->dest_port());
+ if (receive_port.IsError()) {
+ return ProcessUnhandledException(Instance::Handle(),
+ Error::Cast(receive_port));
+ }
+ if (receive_port.IsNull()) {
+ delete message;
+ return true;
+ }
+ }
+
// Parse the message.
SnapshotReader reader(message->data(), message->len(),
Snapshot::kMessage, Isolate::Current());
@@ -116,7 +131,7 @@ bool IsolateMessageHandler::HandleMessage(Message* message) {
} else {
const Object& result = Object::Handle(
DartLibraryCalls::HandleMessage(
- message->dest_port(), message->reply_port(), msg));
+ receive_port, message->reply_port(), msg));
if (result.IsError()) {
success = ProcessUnhandledException(msg, Error::Cast(result));
} else {
« no previous file with comments | « runtime/vm/dart_entry.cc ('k') | runtime/vm/message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698