| 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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 kImplicitSetter, // represents an implicit setter for fields. | 603 kImplicitSetter, // represents an implicit setter for fields. |
| 604 kImplicitStaticFinalGetter, // represents an implicit getter for static | 604 kImplicitStaticFinalGetter, // represents an implicit getter for static |
| 605 // final fields (incl. static const fields). | 605 // final fields (incl. static const fields). |
| 606 kStaticInitializer, // used in implicit static getters. | 606 kStaticInitializer, // used in implicit static getters. |
| 607 kMethodExtractor, // converts method into implicit closure on the receiver. | 607 kMethodExtractor, // converts method into implicit closure on the receiver. |
| 608 kNoSuchMethodDispatcher, // invokes noSuchMethod. | 608 kNoSuchMethodDispatcher, // invokes noSuchMethod. |
| 609 kInvokeFieldDispatcher, // invokes a field as a closure. | 609 kInvokeFieldDispatcher, // invokes a field as a closure. |
| 610 }; | 610 }; |
| 611 | 611 |
| 612 private: | 612 private: |
| 613 // So that the MarkingVisitor::DetachCode can null out the code fields. |
| 614 friend class MarkingVisitor; |
| 613 friend class Class; | 615 friend class Class; |
| 614 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); | 616 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); |
| 617 static bool SkipCode(RawFunction* raw_fun); |
| 615 | 618 |
| 616 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 619 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
| 617 RawString* name_; | 620 RawString* name_; |
| 618 RawObject* owner_; // Class or patch class or mixin class | 621 RawObject* owner_; // Class or patch class or mixin class |
| 619 // where this function is defined. | 622 // where this function is defined. |
| 620 RawAbstractType* result_type_; | 623 RawAbstractType* result_type_; |
| 621 RawArray* parameter_types_; | 624 RawArray* parameter_types_; |
| 622 RawArray* parameter_names_; | 625 RawArray* parameter_names_; |
| 626 RawObject* data_; // Additional data specific to the function kind. |
| 623 RawCode* code_; // Compiled code for the function. | 627 RawCode* code_; // Compiled code for the function. |
| 624 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. | 628 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. |
| 625 RawObject* data_; // Additional data specific to the function kind. | |
| 626 RawObject** to() { | 629 RawObject** to() { |
| 630 return reinterpret_cast<RawObject**>(&ptr()->unoptimized_code_); |
| 631 } |
| 632 RawObject** to_no_code() { |
| 627 return reinterpret_cast<RawObject**>(&ptr()->data_); | 633 return reinterpret_cast<RawObject**>(&ptr()->data_); |
| 628 } | 634 } |
| 629 | 635 |
| 630 intptr_t token_pos_; | 636 intptr_t token_pos_; |
| 631 intptr_t end_token_pos_; | 637 intptr_t end_token_pos_; |
| 632 intptr_t usage_counter_; // Incremented while function is running. | 638 intptr_t usage_counter_; // Incremented while function is running. |
| 633 int16_t num_fixed_parameters_; | 639 int16_t num_fixed_parameters_; |
| 634 int16_t num_optional_parameters_; // > 0: positional; < 0: named. | 640 int16_t num_optional_parameters_; // > 0: positional; < 0: named. |
| 635 int16_t deoptimization_counter_; | 641 int16_t deoptimization_counter_; |
| 636 uint16_t kind_tag_; // See Function::KindTagBits. | 642 uint16_t kind_tag_; // See Function::KindTagBits. |
| (...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1725 // Make sure this is updated when new TypedData types are added. | 1731 // Make sure this is updated when new TypedData types are added. |
| 1726 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 13); | 1732 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 13); |
| 1727 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 14); | 1733 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 14); |
| 1728 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 13); | 1734 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 13); |
| 1729 return (kNullCid - kTypedDataInt8ArrayCid); | 1735 return (kNullCid - kTypedDataInt8ArrayCid); |
| 1730 } | 1736 } |
| 1731 | 1737 |
| 1732 } // namespace dart | 1738 } // namespace dart |
| 1733 | 1739 |
| 1734 #endif // VM_RAW_OBJECT_H_ | 1740 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |