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_TO_IL_H_ | 5 #ifndef RUNTIME_VM_KERNEL_TO_IL_H_ |
6 #define RUNTIME_VM_KERNEL_TO_IL_H_ | 6 #define RUNTIME_VM_KERNEL_TO_IL_H_ |
7 | 7 |
8 #if !defined(DART_PRECOMPILED_RUNTIME) | 8 #if !defined(DART_PRECOMPILED_RUNTIME) |
9 | 9 |
10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 Thread* thread() { return thread_; } | 275 Thread* thread() { return thread_; } |
276 | 276 |
277 Zone* zone() { return zone_; } | 277 Zone* zone() { return zone_; } |
278 | 278 |
279 Isolate* isolate() { return isolate_; } | 279 Isolate* isolate() { return isolate_; } |
280 | 280 |
281 Heap::Space allocation_space() { return allocation_space_; } | 281 Heap::Space allocation_space() { return allocation_space_; } |
282 | 282 |
283 // Access to strings. | 283 // Access to strings. |
| 284 const TypedData& string_offsets() { return string_offsets_; } |
| 285 void SetStringOffsets(const TypedData& string_data); |
| 286 |
284 const TypedData& string_data() { return string_data_; } | 287 const TypedData& string_data() { return string_data_; } |
285 void SetStringData(const TypedData& string_data); | 288 void SetStringData(const TypedData& string_data); |
286 uint8_t CharacterAt(String* str, intptr_t index); | 289 |
287 bool StringEquals(String* str, const char* other); | 290 intptr_t StringOffset(intptr_t string_index) const; |
| 291 intptr_t StringSize(intptr_t string_index) const; |
| 292 uint8_t CharacterAt(intptr_t string_index, intptr_t index); |
| 293 bool StringEquals(intptr_t string_index, const char* other); |
288 | 294 |
289 // Predicates on CanonicalNames. | 295 // Predicates on CanonicalNames. |
290 bool IsAdministrative(CanonicalName* name); | 296 bool IsAdministrative(CanonicalName* name); |
291 bool IsPrivate(CanonicalName* name); | 297 bool IsPrivate(CanonicalName* name); |
292 bool IsRoot(CanonicalName* name); | 298 bool IsRoot(CanonicalName* name); |
293 bool IsLibrary(CanonicalName* name); | 299 bool IsLibrary(CanonicalName* name); |
294 bool IsClass(CanonicalName* name); | 300 bool IsClass(CanonicalName* name); |
295 bool IsMember(CanonicalName* name); | 301 bool IsMember(CanonicalName* name); |
296 bool IsField(CanonicalName* name); | 302 bool IsField(CanonicalName* name); |
297 bool IsConstructor(CanonicalName* name); | 303 bool IsConstructor(CanonicalName* name); |
298 bool IsProcedure(CanonicalName* name); | 304 bool IsProcedure(CanonicalName* name); |
299 bool IsMethod(CanonicalName* name); | 305 bool IsMethod(CanonicalName* name); |
300 bool IsGetter(CanonicalName* name); | 306 bool IsGetter(CanonicalName* name); |
301 bool IsSetter(CanonicalName* name); | 307 bool IsSetter(CanonicalName* name); |
302 bool IsFactory(CanonicalName* name); | 308 bool IsFactory(CanonicalName* name); |
303 | 309 |
304 // For a member (field, constructor, or procedure) return the canonical name | 310 // For a member (field, constructor, or procedure) return the canonical name |
305 // of the enclosing class or library. | 311 // of the enclosing class or library. |
306 CanonicalName* EnclosingName(CanonicalName* name); | 312 CanonicalName* EnclosingName(CanonicalName* name); |
307 | 313 |
308 RawInstance* Canonicalize(const Instance& instance); | 314 RawInstance* Canonicalize(const Instance& instance); |
309 | 315 |
310 const dart::String& DartString(const char* content) { | 316 const dart::String& DartString(const char* content) { |
311 return DartString(content, allocation_space_); | 317 return DartString(content, allocation_space_); |
312 } | 318 } |
313 const dart::String& DartString(const char* content, Heap::Space space); | 319 const dart::String& DartString(const char* content, Heap::Space space); |
314 | 320 |
315 dart::String& DartString(String* content) { | 321 dart::String& DartString(intptr_t string_index) { |
316 return DartString(content, allocation_space_); | 322 return DartString(string_index, allocation_space_); |
317 } | 323 } |
318 dart::String& DartString(String* content, Heap::Space space); | 324 dart::String& DartString(intptr_t string_index, Heap::Space space); |
319 | 325 |
320 dart::String& DartString(const uint8_t* utf8_array, intptr_t len) { | 326 dart::String& DartString(const uint8_t* utf8_array, intptr_t len) { |
321 return DartString(utf8_array, len, allocation_space_); | 327 return DartString(utf8_array, len, allocation_space_); |
322 } | 328 } |
323 dart::String& DartString(const uint8_t* utf8_array, | 329 dart::String& DartString(const uint8_t* utf8_array, |
324 intptr_t len, | 330 intptr_t len, |
325 Heap::Space space); | 331 Heap::Space space); |
326 | 332 |
327 const dart::String& DartSymbol(const char* content) const; | 333 const dart::String& DartSymbol(const char* content) const; |
328 dart::String& DartSymbol(String* content) const; | 334 dart::String& DartSymbol(intptr_t string_index) const; |
329 dart::String& DartSymbol(const uint8_t* utf8_array, intptr_t len) const; | 335 dart::String& DartSymbol(const uint8_t* utf8_array, intptr_t len) const; |
330 | 336 |
331 const dart::String& DartClassName(CanonicalName* kernel_class); | 337 const dart::String& DartClassName(CanonicalName* kernel_class); |
332 | 338 |
333 const dart::String& DartConstructorName(CanonicalName* constructor); | 339 const dart::String& DartConstructorName(CanonicalName* constructor); |
334 | 340 |
335 const dart::String& DartProcedureName(CanonicalName* procedure); | 341 const dart::String& DartProcedureName(CanonicalName* procedure); |
336 | 342 |
337 const dart::String& DartSetterName(CanonicalName* setter); | 343 const dart::String& DartSetterName(CanonicalName* setter); |
338 const dart::String& DartSetterName(Name* setter_name); | 344 const dart::String& DartSetterName(Name* setter_name); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 377 |
372 private: | 378 private: |
373 // This will mangle [name_to_modify] if necessary and make the result a symbol | 379 // This will mangle [name_to_modify] if necessary and make the result a symbol |
374 // if asked. The result will be available in [name_to_modify] and it is also | 380 // if asked. The result will be available in [name_to_modify] and it is also |
375 // returned. If the name is private, the canonical name [parent] will be used | 381 // returned. If the name is private, the canonical name [parent] will be used |
376 // to get the import URI of the library where the name is visible. | 382 // to get the import URI of the library where the name is visible. |
377 dart::String& ManglePrivateName(CanonicalName* parent, | 383 dart::String& ManglePrivateName(CanonicalName* parent, |
378 dart::String* name_to_modify, | 384 dart::String* name_to_modify, |
379 bool symbolize = true); | 385 bool symbolize = true); |
380 | 386 |
381 const dart::String& DartSetterName(CanonicalName* parent, String* setter); | 387 const dart::String& DartSetterName(CanonicalName* parent, intptr_t setter); |
382 const dart::String& DartGetterName(CanonicalName* parent, String* getter); | 388 const dart::String& DartGetterName(CanonicalName* parent, intptr_t getter); |
383 const dart::String& DartMethodName(CanonicalName* parent, String* method); | 389 const dart::String& DartMethodName(CanonicalName* parent, intptr_t method); |
384 | 390 |
385 Thread* thread_; | 391 Thread* thread_; |
386 Zone* zone_; | 392 Zone* zone_; |
387 Isolate* isolate_; | 393 Isolate* isolate_; |
388 Heap::Space allocation_space_; | 394 Heap::Space allocation_space_; |
389 | 395 |
| 396 TypedData& string_offsets_; |
390 TypedData& string_data_; | 397 TypedData& string_data_; |
391 }; | 398 }; |
392 | 399 |
393 // Regarding malformed types: | 400 // Regarding malformed types: |
394 // The spec says in section "19.1 Static Types" roughly: | 401 // The spec says in section "19.1 Static Types" roughly: |
395 // | 402 // |
396 // A type T is malformed iff: | 403 // A type T is malformed iff: |
397 // * T does not denote a type in scope | 404 // * T does not denote a type in scope |
398 // * T refers to a type parameter in a static member | 405 // * T refers to a type parameter in a static member |
399 // * T is a parametrized Type G<T1, ...> and G is malformed | 406 // * T is a parametrized Type G<T1, ...> and G is malformed |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 namespace kernel { | 1155 namespace kernel { |
1149 | 1156 |
1150 RawObject* EvaluateMetadata(const dart::Field& metadata_field); | 1157 RawObject* EvaluateMetadata(const dart::Field& metadata_field); |
1151 RawObject* BuildParameterDescriptor(TreeNode* const kernel_node); | 1158 RawObject* BuildParameterDescriptor(TreeNode* const kernel_node); |
1152 | 1159 |
1153 } // namespace kernel | 1160 } // namespace kernel |
1154 } // namespace dart | 1161 } // namespace dart |
1155 | 1162 |
1156 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 1163 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
1157 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ | 1164 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ |
OLD | NEW |