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 "vm/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 6701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6712 if (loaded_scripts() != Array::null()) { | 6712 if (loaded_scripts() != Array::null()) { |
6713 StorePointer(&raw_ptr()->loaded_scripts_, Array::null()); | 6713 StorePointer(&raw_ptr()->loaded_scripts_, Array::null()); |
6714 } | 6714 } |
6715 } | 6715 } |
6716 | 6716 |
6717 | 6717 |
6718 // Lookup a name in the library's export namespace. | 6718 // Lookup a name in the library's export namespace. |
6719 RawObject* Library::LookupExport(const String& name) const { | 6719 RawObject* Library::LookupExport(const String& name) const { |
6720 if (HasExports()) { | 6720 if (HasExports()) { |
6721 const Array& exports = Array::Handle(this->exports()); | 6721 const Array& exports = Array::Handle(this->exports()); |
| 6722 // Break potential export cycle while looking up name. |
| 6723 StorePointer(&raw_ptr()->exports_, Object::empty_array().raw()); |
6722 Namespace& ns = Namespace::Handle(); | 6724 Namespace& ns = Namespace::Handle(); |
6723 Object& obj = Object::Handle(); | 6725 Object& obj = Object::Handle(); |
6724 for (int i = 0; i < exports.Length(); i++) { | 6726 for (int i = 0; i < exports.Length(); i++) { |
6725 ns ^= exports.At(i); | 6727 ns ^= exports.At(i); |
6726 obj = ns.Lookup(name); | 6728 obj = ns.Lookup(name); |
6727 if (!obj.IsNull()) { | 6729 if (!obj.IsNull()) { |
6728 return obj.raw(); | 6730 break; |
6729 } | 6731 } |
6730 } | 6732 } |
| 6733 StorePointer(&raw_ptr()->exports_, exports.raw()); |
| 6734 return obj.raw(); |
6731 } | 6735 } |
6732 return Object::null(); | 6736 return Object::null(); |
6733 } | 6737 } |
6734 | 6738 |
6735 | 6739 |
6736 RawObject* Library::LookupEntry(const String& name, intptr_t *index) const { | 6740 RawObject* Library::LookupEntry(const String& name, intptr_t *index) const { |
6737 Isolate* isolate = Isolate::Current(); | 6741 Isolate* isolate = Isolate::Current(); |
6738 ReusableHandleScope reused_handles(isolate); | 6742 ReusableHandleScope reused_handles(isolate); |
6739 Array& dict = reused_handles.ArrayHandle(); | 6743 Array& dict = reused_handles.ArrayHandle(); |
6740 dict ^= dictionary(); | 6744 dict ^= dictionary(); |
(...skipping 8155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14896 } | 14900 } |
14897 | 14901 |
14898 | 14902 |
14899 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14903 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
14900 stream->OpenObject(); | 14904 stream->OpenObject(); |
14901 stream->CloseObject(); | 14905 stream->CloseObject(); |
14902 } | 14906 } |
14903 | 14907 |
14904 | 14908 |
14905 } // namespace dart | 14909 } // namespace dart |
OLD | NEW |