OLD | NEW |
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/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
8 #include "vm/code_generator.h" | 8 #include "vm/code_generator.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/debugger.h" | 10 #include "vm/debugger.h" |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 String::Handle(isolate_lib.PrivateName( | 486 String::Handle(isolate_lib.PrivateName( |
487 String::Handle(Field::GetterName(Symbols::_id())))); | 487 String::Handle(Field::GetterName(Symbols::_id())))); |
488 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name)); | 488 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name)); |
489 ASSERT(!func.IsNull()); | 489 ASSERT(!func.IsNull()); |
490 const Array& args = Array::Handle(Array::New(1)); | 490 const Array& args = Array::Handle(Array::New(1)); |
491 args.SetAt(0, port); | 491 args.SetAt(0, port); |
492 return DartEntry::InvokeFunction(func, args); | 492 return DartEntry::InvokeFunction(func, args); |
493 } | 493 } |
494 | 494 |
495 | 495 |
| 496 bool DartLibraryCalls::IsSendPort(const Instance& send_port) { |
| 497 // Get instance class. |
| 498 const Class& cls = Class::Handle(send_port.clazz()); |
| 499 // Get send port class from isolate library. |
| 500 const Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); |
| 501 const Class& send_port_cls = Class::Handle( |
| 502 isolate_lib.LookupClassAllowPrivate(Symbols::_SendPortImpl())); |
| 503 // Check for the same class id. |
| 504 ASSERT(!send_port_cls.IsNull()); |
| 505 return cls.id() == send_port_cls.id(); |
| 506 } |
| 507 |
496 } // namespace dart | 508 } // namespace dart |
OLD | NEW |