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/compiler.h" | 8 #include "vm/compiler.h" |
9 #include "vm/debugger.h" | 9 #include "vm/debugger.h" |
10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 | 502 |
503 const Array& args = Array::Handle(Array::New(kNumArguments)); | 503 const Array& args = Array::Handle(Array::New(kNumArguments)); |
504 args.SetAt(0, left); | 504 args.SetAt(0, left); |
505 args.SetAt(1, right); | 505 args.SetAt(1, right); |
506 const Object& result = | 506 const Object& result = |
507 Object::Handle(DartEntry::InvokeFunction(function, args)); | 507 Object::Handle(DartEntry::InvokeFunction(function, args)); |
508 ASSERT(result.IsInstance() || result.IsError()); | 508 ASSERT(result.IsInstance() || result.IsError()); |
509 return result.raw(); | 509 return result.raw(); |
510 } | 510 } |
511 | 511 |
512 // On success, returns a RawInstance. On failure, a RawError. | |
513 RawObject* DartLibraryCalls::IdentityHashCode(const Instance& object) { | |
514 const int kNumArguments = 1; | |
515 Thread* thread = Thread::Current(); | |
516 Zone* zone = thread->zone(); | |
517 const Library& libcore = Library::Handle(zone, Library::CoreLibrary()); | |
518 ASSERT(!libcore.IsNull()); | |
519 const Function& function = Function::Handle( | |
520 zone, libcore.LookupFunctionAllowPrivate(Symbols::identityHashCode())); | |
521 ASSERT(!function.IsNull()); | |
522 const Array& args = Array::Handle(zone, Array::New(kNumArguments)); | |
523 args.SetAt(0, object); | |
524 const Object& result = | |
525 Object::Handle(zone, DartEntry::InvokeFunction(function, args)); | |
526 ASSERT(result.IsInstance() || result.IsError()); | |
527 return result.raw(); | |
528 } | |
529 | |
530 RawObject* DartLibraryCalls::LookupHandler(Dart_Port port_id) { | 512 RawObject* DartLibraryCalls::LookupHandler(Dart_Port port_id) { |
531 Thread* thread = Thread::Current(); | 513 Thread* thread = Thread::Current(); |
532 Zone* zone = thread->zone(); | 514 Zone* zone = thread->zone(); |
533 Function& function = Function::Handle( | 515 Function& function = Function::Handle( |
534 zone, thread->isolate()->object_store()->lookup_port_handler()); | 516 zone, thread->isolate()->object_store()->lookup_port_handler()); |
535 const int kTypeArgsLen = 0; | 517 const int kTypeArgsLen = 0; |
536 const int kNumArguments = 1; | 518 const int kNumArguments = 1; |
537 if (function.IsNull()) { | 519 if (function.IsNull()) { |
538 Library& isolate_lib = Library::Handle(zone, Library::IsolateLibrary()); | 520 Library& isolate_lib = Library::Handle(zone, Library::IsolateLibrary()); |
539 ASSERT(!isolate_lib.IsNull()); | 521 ASSERT(!isolate_lib.IsNull()); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 const Array& args = Array::Handle(Array::New(kNumArguments)); | 601 const Array& args = Array::Handle(Array::New(kNumArguments)); |
620 args.SetAt(0, map); | 602 args.SetAt(0, map); |
621 args.SetAt(1, key); | 603 args.SetAt(1, key); |
622 args.SetAt(2, value); | 604 args.SetAt(2, value); |
623 const Object& result = | 605 const Object& result = |
624 Object::Handle(DartEntry::InvokeFunction(function, args)); | 606 Object::Handle(DartEntry::InvokeFunction(function, args)); |
625 return result.raw(); | 607 return result.raw(); |
626 } | 608 } |
627 | 609 |
628 } // namespace dart | 610 } // namespace dart |
OLD | NEW |