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 = |