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

Unified Diff: runtime/vm/dart_entry.cc

Issue 11636017: Cache resolution of two static functions frequently used in I/O. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
===================================================================
--- runtime/vm/dart_entry.cc (revision 16317)
+++ runtime/vm/dart_entry.cc (working copy)
@@ -321,29 +321,35 @@
RawObject* DartLibraryCalls::HandleMessage(Dart_Port dest_port_id,
Dart_Port reply_port_id,
const Instance& message) {
- 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("_handleMessage"));
+ Isolate* isolate = Isolate::Current();
+ Function& function = Function::Handle(isolate);
Ivan Posva 2012/12/19 19:11:31 ditto
Florian Schneider 2012/12/20 12:42:25 Done.
const int kNumArguments = 3;
- const Array& kNoArgumentNames = Array::Handle();
- const Function& function = Function::Handle(
- Resolver::ResolveStatic(isolate_lib,
- class_name,
- function_name,
- kNumArguments,
- kNoArgumentNames,
- Resolver::kIsQualified));
- const Array& args = Array::Handle(Array::New(kNumArguments));
- args.SetAt(0, Integer::Handle(Integer::New(dest_port_id)));
- args.SetAt(1, Integer::Handle(Integer::New(reply_port_id)));
+ if (isolate->object_store()->handle_message_function() != Function::null()) {
+ function = isolate->object_store()->handle_message_function();
+ } else {
+ 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("_handleMessage"));
+ const Array& kNoArgumentNames = Array::Handle();
+ function = Resolver::ResolveStatic(isolate_lib,
+ class_name,
+ function_name,
+ kNumArguments,
+ kNoArgumentNames,
+ Resolver::kIsQualified);
+ 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(1, Integer::Handle(isolate, Integer::New(reply_port_id)));
args.SetAt(2, message);
- const Object& result = Object::Handle(DartEntry::InvokeStatic(function,
- args));
+ const Object& result =
+ Object::Handle(isolate, DartEntry::InvokeStatic(function, args));
ASSERT(result.IsNull() || result.IsError());
return result.raw();
}
« runtime/lib/isolate.cc ('K') | « runtime/lib/isolate.cc ('k') | runtime/vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698