| 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 #ifndef VM_RAW_OBJECT_H_ | 5 #ifndef VM_RAW_OBJECT_H_ |
| 6 #define VM_RAW_OBJECT_H_ | 6 #define VM_RAW_OBJECT_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #include "vm/token.h" |
| 10 #include "vm/snapshot.h" | 11 #include "vm/snapshot.h" |
| 11 | 12 |
| 12 #include "include/dart_api.h" | 13 #include "include/dart_api.h" |
| 13 | 14 |
| 14 namespace dart { | 15 namespace dart { |
| 15 | 16 |
| 16 // Macrobatics to define the Object hierarchy of VM implementation classes. | 17 // Macrobatics to define the Object hierarchy of VM implementation classes. |
| 17 #define CLASS_LIST_NO_OBJECT(V) \ | 18 #define CLASS_LIST_NO_OBJECT(V) \ |
| 18 V(Class) \ | 19 V(Class) \ |
| 19 V(UnresolvedClass) \ | 20 V(UnresolvedClass) \ |
| 20 V(AbstractType) \ | 21 V(AbstractType) \ |
| 21 V(Type) \ | 22 V(Type) \ |
| 22 V(TypeParameter) \ | 23 V(TypeParameter) \ |
| 23 V(InstantiatedType) \ | 24 V(InstantiatedType) \ |
| 24 V(AbstractTypeArguments) \ | 25 V(AbstractTypeArguments) \ |
| 25 V(TypeArguments) \ | 26 V(TypeArguments) \ |
| 26 V(InstantiatedTypeArguments) \ | 27 V(InstantiatedTypeArguments) \ |
| 27 V(Function) \ | 28 V(Function) \ |
| 28 V(Field) \ | 29 V(Field) \ |
| 30 V(LiteralToken) \ |
| 29 V(TokenStream) \ | 31 V(TokenStream) \ |
| 30 V(Script) \ | 32 V(Script) \ |
| 31 V(Library) \ | 33 V(Library) \ |
| 32 V(LibraryPrefix) \ | 34 V(LibraryPrefix) \ |
| 33 V(Code) \ | 35 V(Code) \ |
| 34 V(Instructions) \ | 36 V(Instructions) \ |
| 35 V(PcDescriptors) \ | 37 V(PcDescriptors) \ |
| 36 V(LocalVarDescriptors) \ | 38 V(LocalVarDescriptors) \ |
| 37 V(ExceptionHandlers) \ | 39 V(ExceptionHandlers) \ |
| 38 V(Context) \ | 40 V(Context) \ |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 RawInstance* value_; // Offset for instance and value for static fields. | 522 RawInstance* value_; // Offset for instance and value for static fields. |
| 521 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); } | 523 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); } |
| 522 | 524 |
| 523 intptr_t token_index_; | 525 intptr_t token_index_; |
| 524 bool is_static_; | 526 bool is_static_; |
| 525 bool is_final_; | 527 bool is_final_; |
| 526 bool has_initializer_; | 528 bool has_initializer_; |
| 527 }; | 529 }; |
| 528 | 530 |
| 529 | 531 |
| 532 class RawLiteralToken : public RawObject { |
| 533 RAW_HEAP_OBJECT_IMPLEMENTATION(LiteralToken); |
| 534 |
| 535 RawObject** from() { |
| 536 return reinterpret_cast<RawObject**>(&ptr()->literal_); |
| 537 } |
| 538 RawString* literal_; // Literal characters as they appear in source text. |
| 539 RawObject* value_; // The actual object corresponding to the token. |
| 540 RawObject** to() { |
| 541 return reinterpret_cast<RawObject**>(&ptr()->value_); |
| 542 } |
| 543 Token::Kind kind_; // The literal kind (string, integer, double). |
| 544 |
| 545 friend class SnapshotReader; |
| 546 }; |
| 547 |
| 548 |
| 530 class RawTokenStream : public RawObject { | 549 class RawTokenStream : public RawObject { |
| 531 RAW_HEAP_OBJECT_IMPLEMENTATION(TokenStream); | 550 RAW_HEAP_OBJECT_IMPLEMENTATION(TokenStream); |
| 532 | 551 |
| 533 enum { | |
| 534 kKindEntry = 0, | |
| 535 kLiteralEntry, | |
| 536 kNumberOfEntries | |
| 537 }; | |
| 538 | |
| 539 RawObject** from() { | 552 RawObject** from() { |
| 540 return reinterpret_cast<RawObject**>(&ptr()->private_key_); | 553 return reinterpret_cast<RawObject**>(&ptr()->private_key_); |
| 541 } | 554 } |
| 542 RawString* private_key_; // Key used for private identifiers. | 555 RawString* private_key_; // Key used for private identifiers. |
| 543 RawSmi* length_; // Number of tokens. | 556 RawSmi* length_; // Number of tokens. |
| 544 | 557 |
| 545 // Variable length data follows here. | 558 // Variable length data follows here. |
| 546 RawObject* data_[0]; | 559 RawObject* data_[0]; |
| 547 RawObject** to(intptr_t length) { | 560 RawObject** to(intptr_t length) { |
| 548 return reinterpret_cast<RawObject**>( | 561 return reinterpret_cast<RawObject**>(&ptr()->data_[length - 1]); |
| 549 &ptr()->data_[length * kNumberOfEntries - 1]); | |
| 550 } | 562 } |
| 551 | 563 |
| 552 friend class SnapshotReader; | 564 friend class SnapshotReader; |
| 553 }; | 565 }; |
| 554 | 566 |
| 555 | 567 |
| 556 class RawScript : public RawObject { | 568 class RawScript : public RawObject { |
| 557 public: | 569 public: |
| 558 enum Kind { | 570 enum Kind { |
| 559 kScript = 0, | 571 kScript = 0, |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 RawString* target_name_; // Name of target function. | 1117 RawString* target_name_; // Name of target function. |
| 1106 RawArray* ic_data_; // Contains test classes and target function. | 1118 RawArray* ic_data_; // Contains test classes and target function. |
| 1107 intptr_t id_; // Parser node id corresponding to this IC. | 1119 intptr_t id_; // Parser node id corresponding to this IC. |
| 1108 intptr_t num_args_tested_; // Number of arguments tested in IC. | 1120 intptr_t num_args_tested_; // Number of arguments tested in IC. |
| 1109 }; | 1121 }; |
| 1110 | 1122 |
| 1111 | 1123 |
| 1112 } // namespace dart | 1124 } // namespace dart |
| 1113 | 1125 |
| 1114 #endif // VM_RAW_OBJECT_H_ | 1126 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |