| 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" |
| 11 #include "vm/snapshot.h" | 11 #include "vm/snapshot.h" |
| 12 | 12 |
| 13 #include "include/dart_api.h" | 13 #include "include/dart_api.h" |
| 14 | 14 |
| 15 namespace dart { | 15 namespace dart { |
| 16 | 16 |
| 17 // Macrobatics to define the Object hierarchy of VM implementation classes. | 17 // Macrobatics to define the Object hierarchy of VM implementation classes. |
| 18 #define CLASS_LIST_NO_OBJECT(V) \ | 18 #define CLASS_LIST_NO_OBJECT(V) \ |
| 19 V(Class) \ | 19 V(Class) \ |
| 20 V(UnresolvedClass) \ | 20 V(UnresolvedClass) \ |
| 21 V(AbstractType) \ | 21 V(AbstractType) \ |
| 22 V(Type) \ | 22 V(Type) \ |
| 23 V(TypeParameter) \ | 23 V(TypeParameter) \ |
| 24 V(AbstractTypeArguments) \ | 24 V(AbstractTypeArguments) \ |
| 25 V(TypeArguments) \ | 25 V(TypeArguments) \ |
| 26 V(InstantiatedTypeArguments) \ | 26 V(InstantiatedTypeArguments) \ |
| 27 V(PatchClass) \ |
| 27 V(Function) \ | 28 V(Function) \ |
| 28 V(Field) \ | 29 V(Field) \ |
| 29 V(LiteralToken) \ | 30 V(LiteralToken) \ |
| 30 V(TokenStream) \ | 31 V(TokenStream) \ |
| 31 V(Script) \ | 32 V(Script) \ |
| 32 V(Library) \ | 33 V(Library) \ |
| 33 V(LibraryPrefix) \ | 34 V(LibraryPrefix) \ |
| 34 V(Code) \ | 35 V(Code) \ |
| 35 V(Instructions) \ | 36 V(Instructions) \ |
| 36 V(PcDescriptors) \ | 37 V(PcDescriptors) \ |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 &ptr()->uninstantiated_type_arguments_); | 534 &ptr()->uninstantiated_type_arguments_); |
| 534 } | 535 } |
| 535 RawAbstractTypeArguments* uninstantiated_type_arguments_; | 536 RawAbstractTypeArguments* uninstantiated_type_arguments_; |
| 536 RawAbstractTypeArguments* instantiator_type_arguments_; | 537 RawAbstractTypeArguments* instantiator_type_arguments_; |
| 537 RawObject** to() { | 538 RawObject** to() { |
| 538 return reinterpret_cast<RawObject**>(&ptr()->instantiator_type_arguments_); | 539 return reinterpret_cast<RawObject**>(&ptr()->instantiator_type_arguments_); |
| 539 } | 540 } |
| 540 }; | 541 }; |
| 541 | 542 |
| 542 | 543 |
| 544 class RawPatchClass : public RawObject { |
| 545 private: |
| 546 RAW_HEAP_OBJECT_IMPLEMENTATION(PatchClass); |
| 547 |
| 548 RawObject** from() { |
| 549 return reinterpret_cast<RawObject**>(&ptr()->patched_class_); |
| 550 } |
| 551 RawClass* patched_class_; |
| 552 RawScript* script_; |
| 553 RawObject** to() { |
| 554 return reinterpret_cast<RawObject**>(&ptr()->script_); |
| 555 } |
| 556 }; |
| 557 |
| 558 |
| 543 class RawFunction : public RawObject { | 559 class RawFunction : public RawObject { |
| 544 public: | 560 public: |
| 545 enum Kind { | 561 enum Kind { |
| 546 kRegularFunction, | 562 kRegularFunction, |
| 547 kClosureFunction, | 563 kClosureFunction, |
| 548 kSignatureFunction, // represents a signature only without actual code. | 564 kSignatureFunction, // represents a signature only without actual code. |
| 549 kGetterFunction, // represents getter functions e.g: get foo() { .. }. | 565 kGetterFunction, // represents getter functions e.g: get foo() { .. }. |
| 550 kSetterFunction, // represents setter functions e.g: set foo(..) { .. }. | 566 kSetterFunction, // represents setter functions e.g: set foo(..) { .. }. |
| 551 kConstructor, | 567 kConstructor, |
| 552 kImplicitGetter, // represents an implicit getter for fields. | 568 kImplicitGetter, // represents an implicit getter for fields. |
| 553 kImplicitSetter, // represents an implicit setter for fields. | 569 kImplicitSetter, // represents an implicit setter for fields. |
| 554 kConstImplicitGetter, // represents an implicit const getter for fields. | 570 kConstImplicitGetter, // represents an implicit const getter for fields. |
| 555 }; | 571 }; |
| 556 | 572 |
| 557 private: | 573 private: |
| 558 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); | 574 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); |
| 559 | 575 |
| 560 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 576 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
| 561 RawString* name_; | 577 RawString* name_; |
| 562 RawClass* owner_; | 578 RawObject* owner_; // Class or patch class where this function was defined. |
| 563 RawAbstractType* result_type_; | 579 RawAbstractType* result_type_; |
| 564 RawArray* parameter_types_; | 580 RawArray* parameter_types_; |
| 565 RawArray* parameter_names_; | 581 RawArray* parameter_names_; |
| 566 RawCode* code_; // Compiled code for the function. | 582 RawCode* code_; // Compiled code for the function. |
| 567 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. | 583 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. |
| 568 RawContextScope* context_scope_; | 584 RawContextScope* context_scope_; |
| 569 RawFunction* parent_function_; // Enclosing function of this local function. | 585 RawFunction* parent_function_; // Enclosing function of this local function. |
| 570 RawClass* signature_class_; // Only for closure or signature function. | 586 RawClass* signature_class_; // Only for closure or signature function. |
| 571 RawCode* closure_allocation_stub_; // Stub code for allocation of closures. | 587 RawCode* closure_allocation_stub_; // Stub code for allocation of closures. |
| 572 RawFunction* implicit_closure_function_; // Implicit closure function. | 588 RawFunction* implicit_closure_function_; // Implicit closure function. |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1533 kExternalUint64ArrayCid == kByteArrayCid + 18 && | 1549 kExternalUint64ArrayCid == kByteArrayCid + 18 && |
| 1534 kExternalFloat32ArrayCid == kByteArrayCid + 19 && | 1550 kExternalFloat32ArrayCid == kByteArrayCid + 19 && |
| 1535 kExternalFloat64ArrayCid == kByteArrayCid + 20 && | 1551 kExternalFloat64ArrayCid == kByteArrayCid + 20 && |
| 1536 kStacktraceCid == kByteArrayCid + 21); | 1552 kStacktraceCid == kByteArrayCid + 21); |
| 1537 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid); | 1553 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid); |
| 1538 } | 1554 } |
| 1539 | 1555 |
| 1540 } // namespace dart | 1556 } // namespace dart |
| 1541 | 1557 |
| 1542 #endif // VM_RAW_OBJECT_H_ | 1558 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |