| 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/token.h" |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 return reinterpret_cast<RawObject**>(&ptr()->allocation_stub_); | 395 return reinterpret_cast<RawObject**>(&ptr()->allocation_stub_); |
| 396 } | 396 } |
| 397 | 397 |
| 398 cpp_vtable handle_vtable_; | 398 cpp_vtable handle_vtable_; |
| 399 intptr_t instance_size_; // Size if fixed length or 0 if variable length. | 399 intptr_t instance_size_; // Size if fixed length or 0 if variable length. |
| 400 ObjectKind instance_kind_; | 400 ObjectKind instance_kind_; |
| 401 intptr_t id_; // Class Id, also index in the class table. | 401 intptr_t id_; // Class Id, also index in the class table. |
| 402 intptr_t type_arguments_instance_field_offset_; // May be kNoTypeArguments. | 402 intptr_t type_arguments_instance_field_offset_; // May be kNoTypeArguments. |
| 403 intptr_t next_field_offset_; // Offset of the next instance field. | 403 intptr_t next_field_offset_; // Offset of the next instance field. |
| 404 intptr_t num_native_fields_; // Number of native fields in class. | 404 intptr_t num_native_fields_; // Number of native fields in class. |
| 405 intptr_t token_index_; | 405 intptr_t token_pos_; |
| 406 int8_t class_state_; // Of type ClassState. | 406 int8_t class_state_; // Of type ClassState. |
| 407 bool is_const_; | 407 bool is_const_; |
| 408 bool is_interface_; | 408 bool is_interface_; |
| 409 | 409 |
| 410 friend class Object; | 410 friend class Object; |
| 411 friend class RawInstance; | 411 friend class RawInstance; |
| 412 friend class RawInstructions; | 412 friend class RawInstructions; |
| 413 friend class SnapshotReader; | 413 friend class SnapshotReader; |
| 414 }; | 414 }; |
| 415 | 415 |
| 416 | 416 |
| 417 class RawUnresolvedClass : public RawObject { | 417 class RawUnresolvedClass : public RawObject { |
| 418 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); | 418 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); |
| 419 | 419 |
| 420 RawObject** from() { | 420 RawObject** from() { |
| 421 return reinterpret_cast<RawObject**>(&ptr()->library_prefix_); | 421 return reinterpret_cast<RawObject**>(&ptr()->library_prefix_); |
| 422 } | 422 } |
| 423 RawLibraryPrefix* library_prefix_; // Library prefix qualifier for the ident. | 423 RawLibraryPrefix* library_prefix_; // Library prefix qualifier for the ident. |
| 424 RawString* ident_; // Name of the unresolved identifier. | 424 RawString* ident_; // Name of the unresolved identifier. |
| 425 RawClass* factory_signature_class_; // Expected type parameters for factory. | 425 RawClass* factory_signature_class_; // Expected type parameters for factory. |
| 426 RawObject** to() { | 426 RawObject** to() { |
| 427 return reinterpret_cast<RawObject**>(&ptr()->factory_signature_class_); | 427 return reinterpret_cast<RawObject**>(&ptr()->factory_signature_class_); |
| 428 } | 428 } |
| 429 intptr_t token_index_; | 429 intptr_t token_pos_; |
| 430 }; | 430 }; |
| 431 | 431 |
| 432 | 432 |
| 433 class RawAbstractType : public RawObject { | 433 class RawAbstractType : public RawObject { |
| 434 protected: | 434 protected: |
| 435 enum TypeState { | 435 enum TypeState { |
| 436 kAllocated, // Initial state. | 436 kAllocated, // Initial state. |
| 437 kBeingFinalized, // In the process of being finalized. | 437 kBeingFinalized, // In the process of being finalized. |
| 438 kFinalizedInstantiated, // Instantiated type ready for use. | 438 kFinalizedInstantiated, // Instantiated type ready for use. |
| 439 kFinalizedUninstantiated, // Uninstantiated type ready for use. | 439 kFinalizedUninstantiated, // Uninstantiated type ready for use. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 452 | 452 |
| 453 RawObject** from() { | 453 RawObject** from() { |
| 454 return reinterpret_cast<RawObject**>(&ptr()->type_class_); | 454 return reinterpret_cast<RawObject**>(&ptr()->type_class_); |
| 455 } | 455 } |
| 456 RawObject* type_class_; // Either resolved class or unresolved class. | 456 RawObject* type_class_; // Either resolved class or unresolved class. |
| 457 RawAbstractTypeArguments* arguments_; | 457 RawAbstractTypeArguments* arguments_; |
| 458 RawError* malformed_error_; // Error object if type is malformed. | 458 RawError* malformed_error_; // Error object if type is malformed. |
| 459 RawObject** to() { | 459 RawObject** to() { |
| 460 return reinterpret_cast<RawObject**>(&ptr()->malformed_error_); | 460 return reinterpret_cast<RawObject**>(&ptr()->malformed_error_); |
| 461 } | 461 } |
| 462 intptr_t token_index_; | 462 intptr_t token_pos_; |
| 463 int8_t type_state_; | 463 int8_t type_state_; |
| 464 }; | 464 }; |
| 465 | 465 |
| 466 | 466 |
| 467 class RawTypeParameter : public RawAbstractType { | 467 class RawTypeParameter : public RawAbstractType { |
| 468 private: | 468 private: |
| 469 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); | 469 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); |
| 470 | 470 |
| 471 RawObject** from() { | 471 RawObject** from() { |
| 472 return reinterpret_cast<RawObject**>(&ptr()->parameterized_class_); | 472 return reinterpret_cast<RawObject**>(&ptr()->parameterized_class_); |
| 473 } | 473 } |
| 474 RawClass* parameterized_class_; | 474 RawClass* parameterized_class_; |
| 475 RawString* name_; | 475 RawString* name_; |
| 476 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 476 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
| 477 intptr_t index_; | 477 intptr_t index_; |
| 478 intptr_t token_index_; | 478 intptr_t token_pos_; |
| 479 int8_t type_state_; | 479 int8_t type_state_; |
| 480 }; | 480 }; |
| 481 | 481 |
| 482 | 482 |
| 483 class RawInstantiatedType : public RawAbstractType { | 483 class RawInstantiatedType : public RawAbstractType { |
| 484 private: | 484 private: |
| 485 RAW_HEAP_OBJECT_IMPLEMENTATION(InstantiatedType); | 485 RAW_HEAP_OBJECT_IMPLEMENTATION(InstantiatedType); |
| 486 | 486 |
| 487 RawObject** from() { | 487 RawObject** from() { |
| 488 return reinterpret_cast<RawObject**>(&ptr()->uninstantiated_type_); | 488 return reinterpret_cast<RawObject**>(&ptr()->uninstantiated_type_); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. | 564 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. |
| 565 RawContextScope* context_scope_; | 565 RawContextScope* context_scope_; |
| 566 RawFunction* parent_function_; // Enclosing function of this local function. | 566 RawFunction* parent_function_; // Enclosing function of this local function. |
| 567 RawClass* signature_class_; // Only for closure or signature function. | 567 RawClass* signature_class_; // Only for closure or signature function. |
| 568 RawCode* closure_allocation_stub_; // Stub code for allocation of closures. | 568 RawCode* closure_allocation_stub_; // Stub code for allocation of closures. |
| 569 RawFunction* implicit_closure_function_; // Implicit closure function. | 569 RawFunction* implicit_closure_function_; // Implicit closure function. |
| 570 RawObject** to() { | 570 RawObject** to() { |
| 571 return reinterpret_cast<RawObject**>(&ptr()->implicit_closure_function_); | 571 return reinterpret_cast<RawObject**>(&ptr()->implicit_closure_function_); |
| 572 } | 572 } |
| 573 | 573 |
| 574 intptr_t token_index_; | 574 intptr_t token_pos_; |
| 575 intptr_t end_token_index_; | 575 intptr_t end_token_pos_; |
| 576 intptr_t num_fixed_parameters_; | 576 intptr_t num_fixed_parameters_; |
| 577 intptr_t num_optional_parameters_; | 577 intptr_t num_optional_parameters_; |
| 578 intptr_t usage_counter_; // Incremented while function is running. | 578 intptr_t usage_counter_; // Incremented while function is running. |
| 579 intptr_t deoptimization_counter_; | 579 intptr_t deoptimization_counter_; |
| 580 Kind kind_; | 580 Kind kind_; |
| 581 bool is_static_; | 581 bool is_static_; |
| 582 bool is_const_; | 582 bool is_const_; |
| 583 bool is_optimizable_; | 583 bool is_optimizable_; |
| 584 bool is_native_; | 584 bool is_native_; |
| 585 }; | 585 }; |
| 586 | 586 |
| 587 | 587 |
| 588 class RawField : public RawObject { | 588 class RawField : public RawObject { |
| 589 RAW_HEAP_OBJECT_IMPLEMENTATION(Field); | 589 RAW_HEAP_OBJECT_IMPLEMENTATION(Field); |
| 590 | 590 |
| 591 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 591 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
| 592 RawString* name_; | 592 RawString* name_; |
| 593 RawClass* owner_; | 593 RawClass* owner_; |
| 594 RawAbstractType* type_; | 594 RawAbstractType* type_; |
| 595 RawInstance* value_; // Offset for instance and value for static fields. | 595 RawInstance* value_; // Offset for instance and value for static fields. |
| 596 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); } | 596 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); } |
| 597 | 597 |
| 598 intptr_t token_index_; | 598 intptr_t token_pos_; |
| 599 bool is_static_; | 599 bool is_static_; |
| 600 bool is_final_; | 600 bool is_final_; |
| 601 bool has_initializer_; | 601 bool has_initializer_; |
| 602 }; | 602 }; |
| 603 | 603 |
| 604 | 604 |
| 605 class RawLiteralToken : public RawObject { | 605 class RawLiteralToken : public RawObject { |
| 606 RAW_HEAP_OBJECT_IMPLEMENTATION(LiteralToken); | 606 RAW_HEAP_OBJECT_IMPLEMENTATION(LiteralToken); |
| 607 | 607 |
| 608 RawObject** from() { | 608 RawObject** from() { |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 friend class SnapshotReader; | 850 friend class SnapshotReader; |
| 851 }; | 851 }; |
| 852 | 852 |
| 853 | 853 |
| 854 class RawContextScope : public RawObject { | 854 class RawContextScope : public RawObject { |
| 855 RAW_HEAP_OBJECT_IMPLEMENTATION(ContextScope); | 855 RAW_HEAP_OBJECT_IMPLEMENTATION(ContextScope); |
| 856 | 856 |
| 857 // TODO(iposva): Switch to convential enum offset based structure to avoid | 857 // TODO(iposva): Switch to convential enum offset based structure to avoid |
| 858 // alignment mishaps. | 858 // alignment mishaps. |
| 859 struct VariableDesc { | 859 struct VariableDesc { |
| 860 RawSmi* token_index; | 860 RawSmi* token_pos; |
| 861 RawString* name; | 861 RawString* name; |
| 862 RawBool* is_final; | 862 RawBool* is_final; |
| 863 RawAbstractType* type; | 863 RawAbstractType* type; |
| 864 RawSmi* context_index; | 864 RawSmi* context_index; |
| 865 RawSmi* context_level; | 865 RawSmi* context_level; |
| 866 }; | 866 }; |
| 867 | 867 |
| 868 intptr_t num_variables_; | 868 intptr_t num_variables_; |
| 869 | 869 |
| 870 // Variable length data follows here. | 870 // Variable length data follows here. |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1516 kExternalUint64Array == kByteArray + 18 && | 1516 kExternalUint64Array == kByteArray + 18 && |
| 1517 kExternalFloat32Array == kByteArray + 19 && | 1517 kExternalFloat32Array == kByteArray + 19 && |
| 1518 kExternalFloat64Array == kByteArray + 20 && | 1518 kExternalFloat64Array == kByteArray + 20 && |
| 1519 kClosure == kByteArray + 21); | 1519 kClosure == kByteArray + 21); |
| 1520 return (index >= kByteArray && index <= kClosure); | 1520 return (index >= kByteArray && index <= kClosure); |
| 1521 } | 1521 } |
| 1522 | 1522 |
| 1523 } // namespace dart | 1523 } // namespace dart |
| 1524 | 1524 |
| 1525 #endif // VM_RAW_OBJECT_H_ | 1525 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |