OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "lib/mirrors.h" | 5 #include "lib/mirrors.h" |
6 | 6 |
7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "vm/bootstrap_natives.h" | 8 #include "vm/bootstrap_natives.h" |
9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 AbstractType& actual_type = | 573 AbstractType& actual_type = |
574 AbstractType::Handle(BoundedType::Cast(type).type()); | 574 AbstractType::Handle(BoundedType::Cast(type).type()); |
575 return CreateTypeMirror(actual_type); | 575 return CreateTypeMirror(actual_type); |
576 } | 576 } |
577 UNREACHABLE(); | 577 UNREACHABLE(); |
578 return Instance::null(); | 578 return Instance::null(); |
579 } | 579 } |
580 | 580 |
581 | 581 |
582 static RawInstance* CreateIsolateMirror() { | 582 static RawInstance* CreateIsolateMirror() { |
583 Isolate* isolate = Isolate::Current(); | 583 Thread* thread = Thread::Current(); |
| 584 Isolate* isolate = thread->isolate(); |
584 const String& debug_name = String::Handle(String::New(isolate->name())); | 585 const String& debug_name = String::Handle(String::New(isolate->name())); |
585 const Library& root_library = | 586 const Library& root_library = Library::Handle(thread->zone(), |
586 Library::Handle(isolate, isolate->object_store()->root_library()); | 587 isolate->object_store()->root_library()); |
587 const Instance& root_library_mirror = | 588 const Instance& root_library_mirror = |
588 Instance::Handle(CreateLibraryMirror(root_library)); | 589 Instance::Handle(CreateLibraryMirror(root_library)); |
589 | 590 |
590 const Array& args = Array::Handle(Array::New(2)); | 591 const Array& args = Array::Handle(Array::New(2)); |
591 args.SetAt(0, debug_name); | 592 args.SetAt(0, debug_name); |
592 args.SetAt(1, root_library_mirror); | 593 args.SetAt(1, root_library_mirror); |
593 return CreateMirror(Symbols::_LocalIsolateMirror(), args); | 594 return CreateMirror(Symbols::_LocalIsolateMirror(), args); |
594 } | 595 } |
595 | 596 |
596 | 597 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 Exceptions::PropagateError(bound_error); | 790 Exceptions::PropagateError(bound_error); |
790 UNREACHABLE(); | 791 UNREACHABLE(); |
791 } | 792 } |
792 ASSERT(result.IsFinalized()); | 793 ASSERT(result.IsFinalized()); |
793 return result.Canonicalize(); | 794 return result.Canonicalize(); |
794 } | 795 } |
795 | 796 |
796 | 797 |
797 DEFINE_NATIVE_ENTRY(MirrorSystem_libraries, 0) { | 798 DEFINE_NATIVE_ENTRY(MirrorSystem_libraries, 0) { |
798 const GrowableObjectArray& libraries = GrowableObjectArray::Handle( | 799 const GrowableObjectArray& libraries = GrowableObjectArray::Handle( |
799 isolate, isolate->object_store()->libraries()); | 800 zone, isolate->object_store()->libraries()); |
800 | 801 |
801 const intptr_t num_libraries = libraries.Length(); | 802 const intptr_t num_libraries = libraries.Length(); |
802 const GrowableObjectArray& library_mirrors = GrowableObjectArray::Handle( | 803 const GrowableObjectArray& library_mirrors = GrowableObjectArray::Handle( |
803 isolate, GrowableObjectArray::New(num_libraries)); | 804 zone, GrowableObjectArray::New(num_libraries)); |
804 Library& library = Library::Handle(isolate); | 805 Library& library = Library::Handle(zone); |
805 Instance& library_mirror = Instance::Handle(isolate); | 806 Instance& library_mirror = Instance::Handle(zone); |
806 | 807 |
807 for (int i = 0; i < num_libraries; i++) { | 808 for (int i = 0; i < num_libraries; i++) { |
808 library ^= libraries.At(i); | 809 library ^= libraries.At(i); |
809 library_mirror = CreateLibraryMirror(library); | 810 library_mirror = CreateLibraryMirror(library); |
810 if (!library_mirror.IsNull() && library.Loaded()) { | 811 if (!library_mirror.IsNull() && library.Loaded()) { |
811 library_mirrors.Add(library_mirror); | 812 library_mirrors.Add(library_mirror); |
812 } | 813 } |
813 } | 814 } |
814 return library_mirrors.raw(); | 815 return library_mirrors.raw(); |
815 } | 816 } |
(...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2105 } | 2106 } |
2106 | 2107 |
2107 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { | 2108 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { |
2108 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); | 2109 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); |
2109 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); | 2110 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); |
2110 return Bool::Get(a.IsSubtypeOf(b, NULL)).raw(); | 2111 return Bool::Get(a.IsSubtypeOf(b, NULL)).raw(); |
2111 } | 2112 } |
2112 | 2113 |
2113 | 2114 |
2114 } // namespace dart | 2115 } // namespace dart |
OLD | NEW |