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

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: Lookup ReceivePort in Dart code 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 5ac23bc98348d1bd1939cea33fdf4a573deeda3f..620b47ee29b3297a8eee4f57a05f58dca7238aac 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -87,6 +87,20 @@ 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& receiver = Object::Handle();
Ivan Posva 2012/12/19 07:09:44 I find the name choice of receiver a bit confusing
Mads Ager (google) 2012/12/19 15:47:57 Done.
+ if (!message->IsOOB()) {
+ receiver = DartLibraryCalls::LookupReceivePort(message->dest_port());
+ if (receiver.IsError()) {
+ return ProcessUnhandledException(receiver);
+ }
+ if (receiver.IsNull()) {
+ delete message;
+ return true;
+ }
+ }
+
// Parse the message.
SnapshotReader reader(message->data(), message->len(),
Snapshot::kMessage, Isolate::Current());
@@ -113,8 +127,7 @@ bool IsolateMessageHandler::HandleMessage(Message* message) {
delete message;
} else {
const Object& result = Object::Handle(
- DartLibraryCalls::HandleMessage(
- message->dest_port(), message->reply_port(), msg));
+ DartLibraryCalls::HandleMessage(receiver, message->reply_port(), msg));
delete message;
if (result.IsError()) {
return ProcessUnhandledException(result);
« 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