OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 #ifndef RUNTIME_VM_KERNEL_READER_H_ | 5 #ifndef RUNTIME_VM_KERNEL_READER_H_ |
6 #define RUNTIME_VM_KERNEL_READER_H_ | 6 #define RUNTIME_VM_KERNEL_READER_H_ |
7 | 7 |
8 #if !defined(DART_PRECOMPILED_RUNTIME) | 8 #if !defined(DART_PRECOMPILED_RUNTIME) |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // Returns the library containing the main procedure, null if there | 59 // Returns the library containing the main procedure, null if there |
60 // was no main procedure, or a failure object if there was an error. | 60 // was no main procedure, or a failure object if there was an error. |
61 dart::Object& ReadProgram(); | 61 dart::Object& ReadProgram(); |
62 | 62 |
63 void ReadLibrary(intptr_t kernel_offset); | 63 void ReadLibrary(intptr_t kernel_offset); |
64 | 64 |
65 const dart::String& DartSymbol(StringIndex index) { | 65 const dart::String& DartSymbol(StringIndex index) { |
66 return translation_helper_.DartSymbol(index); | 66 return translation_helper_.DartSymbol(index); |
67 } | 67 } |
68 | 68 |
| 69 const dart::String& LibraryUri(intptr_t library_index) { |
| 70 return translation_helper_.DartSymbol( |
| 71 translation_helper_.CanonicalNameString( |
| 72 library_canonical_name(library_index))); |
| 73 } |
| 74 |
| 75 intptr_t library_offset(intptr_t index) { |
| 76 kernel::Reader reader(program_->kernel_data(), |
| 77 program_->kernel_data_size()); |
| 78 reader.set_offset(reader.size() - 4 - |
| 79 (program_->library_count() - index) * 4); |
| 80 return reader.ReadUInt32(); |
| 81 } |
| 82 |
| 83 NameIndex library_canonical_name(intptr_t index) { |
| 84 kernel::Reader reader(program_->kernel_data(), |
| 85 program_->kernel_data_size()); |
| 86 reader.set_offset(reader.size() - 4 - |
| 87 (program_->library_count() - index) * 4); |
| 88 reader.set_offset(reader.ReadUInt32()); |
| 89 |
| 90 // Start reading library. |
| 91 reader.ReadFlags(); // read flags. |
| 92 return reader.ReadCanonicalNameReference(); |
| 93 } |
| 94 |
69 uint8_t CharacterAt(StringIndex string_index, intptr_t index); | 95 uint8_t CharacterAt(StringIndex string_index, intptr_t index); |
70 | 96 |
71 private: | 97 private: |
72 friend class BuildingTranslationHelper; | 98 friend class BuildingTranslationHelper; |
73 | 99 |
74 void ReadPreliminaryClass(dart::Class* klass, | 100 void ReadPreliminaryClass(dart::Class* klass, |
75 ClassHelper* class_helper, | 101 ClassHelper* class_helper, |
76 intptr_t type_parameter_count); | 102 intptr_t type_parameter_count); |
77 dart::Class& ReadClass(const dart::Library& library, | 103 dart::Class& ReadClass(const dart::Library& library, |
78 const dart::Class& toplevel_class); | 104 const dart::Class& toplevel_class); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 145 |
120 GrowableArray<const dart::Function*> functions_; | 146 GrowableArray<const dart::Function*> functions_; |
121 GrowableArray<const dart::Field*> fields_; | 147 GrowableArray<const dart::Field*> fields_; |
122 }; | 148 }; |
123 | 149 |
124 } // namespace kernel | 150 } // namespace kernel |
125 } // namespace dart | 151 } // namespace dart |
126 | 152 |
127 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 153 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
128 #endif // RUNTIME_VM_KERNEL_READER_H_ | 154 #endif // RUNTIME_VM_KERNEL_READER_H_ |
OLD | NEW |