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

Unified Diff: runtime/vm/dart_entry.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.h ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_entry.cc
diff --git a/runtime/vm/dart_entry.cc b/runtime/vm/dart_entry.cc
index a82ba9d596c95ffc072cb9dc2ec133c6efa0b7d1..efe422b705e917cdc7124fd630899c7b1ed74d95 100644
--- a/runtime/vm/dart_entry.cc
+++ b/runtime/vm/dart_entry.cc
@@ -371,7 +371,39 @@ RawObject* DartLibraryCalls::Equals(const Instance& left,
}
-RawObject* DartLibraryCalls::HandleMessage(Dart_Port dest_port_id,
+RawObject* DartLibraryCalls::LookupReceivePort(Dart_Port port_id) {
+ Isolate* isolate = Isolate::Current();
+ Function& function =
+ Function::Handle(isolate,
+ isolate->object_store()->lookup_receive_port_function());
+ const int kNumArguments = 1;
+ if (function.IsNull()) {
+ Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
+ ASSERT(!isolate_lib.IsNull());
+ const String& public_class_name =
+ String::Handle(Symbols::New("_ReceivePortImpl"));
+ const String& class_name =
+ String::Handle(isolate_lib.PrivateName(public_class_name));
+ const String& function_name =
+ String::Handle(Symbols::New("_lookupReceivePort"));
+ const Array& kNoArgumentNames = Array::Handle();
+ function = Resolver::ResolveStatic(isolate_lib,
+ class_name,
+ function_name,
+ kNumArguments,
+ kNoArgumentNames,
+ Resolver::kIsQualified);
+ isolate->object_store()->set_lookup_receive_port_function(function);
+ }
+ const Array& args = Array::Handle(Array::New(kNumArguments));
+ args.SetAt(0, Integer::Handle(Integer::New(port_id)));
+ const Object& result =
+ Object::Handle(DartEntry::InvokeStatic(function, args));
+ return result.raw();
+}
+
+
+RawObject* DartLibraryCalls::HandleMessage(const Object& receive_port,
Dart_Port reply_port_id,
const Instance& message) {
Isolate* isolate = Isolate::Current();
@@ -398,7 +430,7 @@ RawObject* DartLibraryCalls::HandleMessage(Dart_Port dest_port_id,
isolate->object_store()->set_handle_message_function(function);
}
const Array& args = Array::Handle(isolate, Array::New(kNumArguments));
- args.SetAt(0, Integer::Handle(isolate, Integer::New(dest_port_id)));
+ args.SetAt(0, receive_port);
args.SetAt(1, Integer::Handle(isolate, Integer::New(reply_port_id)));
args.SetAt(2, message);
const Object& result =
« no previous file with comments | « runtime/vm/dart_entry.h ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698