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

Side by Side 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: Moved clearing to MessageQueue destructor 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_entry.h ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/dart_entry.h" 5 #include "vm/dart_entry.h"
6 6
7 #include "vm/code_generator.h" 7 #include "vm/code_generator.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/object_store.h" 9 #include "vm/object_store.h"
10 #include "vm/resolver.h" 10 #include "vm/resolver.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 const Array& args = Array::Handle(Array::New(kNumArguments)); 311 const Array& args = Array::Handle(Array::New(kNumArguments));
312 args.SetAt(0, left); 312 args.SetAt(0, left);
313 args.SetAt(1, right); 313 args.SetAt(1, right);
314 const Object& result = Object::Handle(DartEntry::InvokeDynamic(function, 314 const Object& result = Object::Handle(DartEntry::InvokeDynamic(function,
315 args)); 315 args));
316 ASSERT(result.IsInstance() || result.IsError()); 316 ASSERT(result.IsInstance() || result.IsError());
317 return result.raw(); 317 return result.raw();
318 } 318 }
319 319
320 320
321 RawObject* DartLibraryCalls::HandleMessage(Dart_Port dest_port_id, 321 RawObject* DartLibraryCalls::LookupReceivePort(Dart_Port port_id) {
Ivan Posva 2012/12/20 17:19:43 Please coordinate with +fschneider as he has relev
322 Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
323 ASSERT(!isolate_lib.IsNull());
324 const String& public_class_name =
325 String::Handle(Symbols::New("_ReceivePortImpl"));
326 const String& class_name =
327 String::Handle(isolate_lib.PrivateName(public_class_name));
328 const String& function_name =
329 String::Handle(Symbols::New("_lookupReceivePort"));
330 const int kNumArguments = 1;
331 const Array& kNoArgumentNames = Array::Handle();
332 const Function& function = Function::Handle(
333 Resolver::ResolveStatic(isolate_lib,
334 class_name,
335 function_name,
336 kNumArguments,
337 kNoArgumentNames,
338 Resolver::kIsQualified));
339 const Array& args = Array::Handle(Array::New(kNumArguments));
340 args.SetAt(0, Integer::Handle(Integer::New(port_id)));
341 const Object& result =
342 Object::Handle(DartEntry::InvokeStatic(function, args));
343 return result.raw();
344 }
345
346
347 RawObject* DartLibraryCalls::HandleMessage(const Object& receive_port,
322 Dart_Port reply_port_id, 348 Dart_Port reply_port_id,
323 const Instance& message) { 349 const Instance& message) {
324 Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); 350 Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
325 ASSERT(!isolate_lib.IsNull()); 351 ASSERT(!isolate_lib.IsNull());
326 const String& public_class_name = 352 const String& public_class_name =
327 String::Handle(Symbols::New("_ReceivePortImpl")); 353 String::Handle(Symbols::New("_ReceivePortImpl"));
328 const String& class_name = 354 const String& class_name =
329 String::Handle(isolate_lib.PrivateName(public_class_name)); 355 String::Handle(isolate_lib.PrivateName(public_class_name));
330 const String& function_name = 356 const String& function_name =
331 String::Handle(Symbols::New("_handleMessage")); 357 String::Handle(Symbols::New("_handleMessage"));
332 const int kNumArguments = 3; 358 const int kNumArguments = 3;
333 const Array& kNoArgumentNames = Array::Handle(); 359 const Array& kNoArgumentNames = Array::Handle();
334 const Function& function = Function::Handle( 360 const Function& function = Function::Handle(
335 Resolver::ResolveStatic(isolate_lib, 361 Resolver::ResolveStatic(isolate_lib,
336 class_name, 362 class_name,
337 function_name, 363 function_name,
338 kNumArguments, 364 kNumArguments,
339 kNoArgumentNames, 365 kNoArgumentNames,
340 Resolver::kIsQualified)); 366 Resolver::kIsQualified));
341 const Array& args = Array::Handle(Array::New(kNumArguments)); 367 const Array& args = Array::Handle(Array::New(kNumArguments));
342 args.SetAt(0, Integer::Handle(Integer::New(dest_port_id))); 368 args.SetAt(0, receive_port);
343 args.SetAt(1, Integer::Handle(Integer::New(reply_port_id))); 369 args.SetAt(1, Integer::Handle(Integer::New(reply_port_id)));
344 args.SetAt(2, message); 370 args.SetAt(2, message);
345 const Object& result = Object::Handle(DartEntry::InvokeStatic(function, 371 const Object& result = Object::Handle(
346 args)); 372 DartEntry::InvokeStatic(function, args));
347 ASSERT(result.IsNull() || result.IsError()); 373 ASSERT(result.IsNull() || result.IsError());
348 return result.raw(); 374 return result.raw();
349 } 375 }
350 376
351 377
352 RawObject* DartLibraryCalls::NewSendPort(intptr_t port_id) { 378 RawObject* DartLibraryCalls::NewSendPort(intptr_t port_id) {
353 Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); 379 Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
354 ASSERT(!isolate_lib.IsNull()); 380 ASSERT(!isolate_lib.IsNull());
355 const String& public_class_name = 381 const String& public_class_name =
356 String::Handle(String::New("_SendPortImpl")); 382 String::Handle(String::New("_SendPortImpl"));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 const String& func_name = String::Handle(Field::GetterName(field_name)); 422 const String& func_name = String::Handle(Field::GetterName(field_name));
397 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name)); 423 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name));
398 ASSERT(!func.IsNull()); 424 ASSERT(!func.IsNull());
399 const Array& args = Array::Handle(Array::New(1)); 425 const Array& args = Array::Handle(Array::New(1));
400 args.SetAt(0, port); 426 args.SetAt(0, port);
401 return DartEntry::InvokeDynamic(func, args); 427 return DartEntry::InvokeDynamic(func, args);
402 } 428 }
403 429
404 430
405 } // namespace dart 431 } // namespace dart
OLDNEW
« 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