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

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: 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
Index: runtime/vm/dart_entry.cc
diff --git a/runtime/vm/dart_entry.cc b/runtime/vm/dart_entry.cc
index 493af6ccdd6168447edc24eb8844dc32d6c39f3f..db4ecb02a1e2bfab9289f9a1f6bdf566404198bc 100644
--- a/runtime/vm/dart_entry.cc
+++ b/runtime/vm/dart_entry.cc
@@ -283,7 +283,33 @@ RawObject* DartLibraryCalls::Equals(const Instance& left,
}
-RawObject* DartLibraryCalls::HandleMessage(Dart_Port dest_port_id,
+RawObject* DartLibraryCalls::LookupReceivePort(Dart_Port port_id) {
+ 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 int kNumArguments = 1;
+ const Array& kNoArgumentNames = Array::Handle();
+ const Function& function = Function::Handle(
+ Resolver::ResolveStatic(isolate_lib,
+ class_name,
+ function_name,
+ kNumArguments,
+ kNoArgumentNames,
+ Resolver::kIsQualified));
+ GrowableArray<const Object*> arguments(kNumArguments);
+ arguments.Add(&Integer::Handle(Integer::New(port_id)));
+ const Object& result = Object::Handle(
+ DartEntry::InvokeStatic(function, arguments, kNoArgumentNames));
+ return result.raw();
+}
+
+
+RawObject* DartLibraryCalls::HandleMessage(const Object& receive_port,
Dart_Port reply_port_id,
const Instance& message) {
Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
@@ -304,7 +330,7 @@ RawObject* DartLibraryCalls::HandleMessage(Dart_Port dest_port_id,
kNoArgumentNames,
Resolver::kIsQualified));
GrowableArray<const Object*> arguments(kNumArguments);
- arguments.Add(&Integer::Handle(Integer::New(dest_port_id)));
+ arguments.Add(&receive_port);
arguments.Add(&Integer::Handle(Integer::New(reply_port_id)));
arguments.Add(&message);
const Object& result = Object::Handle(
« no previous file with comments | « runtime/vm/dart_entry.h ('k') | runtime/vm/isolate.cc » ('j') | runtime/vm/isolate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698