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 |
512 RawObject* DartLibraryCalls::LookupHandler(Dart_Port port_id) { | 530 RawObject* DartLibraryCalls::LookupHandler(Dart_Port port_id) { |
513 Thread* thread = Thread::Current(); | 531 Thread* thread = Thread::Current(); |
514 Zone* zone = thread->zone(); | 532 Zone* zone = thread->zone(); |
515 Function& function = Function::Handle( | 533 Function& function = Function::Handle( |
516 zone, thread->isolate()->object_store()->lookup_port_handler()); | 534 zone, thread->isolate()->object_store()->lookup_port_handler()); |
517 const int kTypeArgsLen = 0; | 535 const int kTypeArgsLen = 0; |
518 const int kNumArguments = 1; | 536 const int kNumArguments = 1; |
519 if (function.IsNull()) { | 537 if (function.IsNull()) { |
520 Library& isolate_lib = Library::Handle(zone, Library::IsolateLibrary()); | 538 Library& isolate_lib = Library::Handle(zone, Library::IsolateLibrary()); |
521 ASSERT(!isolate_lib.IsNull()); | 539 ASSERT(!isolate_lib.IsNull()); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 const Array& args = Array::Handle(Array::New(kNumArguments)); | 617 const Array& args = Array::Handle(Array::New(kNumArguments)); |
600 args.SetAt(0, map); | 618 args.SetAt(0, map); |
601 args.SetAt(1, key); | 619 args.SetAt(1, key); |
602 args.SetAt(2, value); | 620 args.SetAt(2, value); |
603 const Object& result = | 621 const Object& result = |
604 Object::Handle(DartEntry::InvokeFunction(function, args)); | 622 Object::Handle(DartEntry::InvokeFunction(function, args)); |
605 return result.raw(); | 623 return result.raw(); |
606 } | 624 } |
607 | 625 |
608 } // namespace dart | 626 } // namespace dart |
OLD | NEW |