Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: runtime/vm/object.h

Issue 1325373004: More cleanups for background compilation. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Simpler code Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 } 1126 }
1127 1127
1128 // Check if this class represents a canonical signature class, i.e. not an 1128 // Check if this class represents a canonical signature class, i.e. not an
1129 // alias as defined in a typedef. 1129 // alias as defined in a typedef.
1130 bool IsCanonicalSignatureClass() const; 1130 bool IsCanonicalSignatureClass() const;
1131 1131
1132 // Check the subtype relationship. 1132 // Check the subtype relationship.
1133 bool IsSubtypeOf(const TypeArguments& type_arguments, 1133 bool IsSubtypeOf(const TypeArguments& type_arguments,
1134 const Class& other, 1134 const Class& other,
1135 const TypeArguments& other_type_arguments, 1135 const TypeArguments& other_type_arguments,
1136 Error* bound_error) const { 1136 Error* bound_error,
1137 Heap::Space space = Heap::kNew) const {
1137 return TypeTest(kIsSubtypeOf, 1138 return TypeTest(kIsSubtypeOf,
1138 type_arguments, 1139 type_arguments,
1139 other, 1140 other,
1140 other_type_arguments, 1141 other_type_arguments,
1141 bound_error); 1142 bound_error,
1143 space);
1142 } 1144 }
1143 1145
1144 // Check the 'more specific' relationship. 1146 // Check the 'more specific' relationship.
1145 bool IsMoreSpecificThan(const TypeArguments& type_arguments, 1147 bool IsMoreSpecificThan(const TypeArguments& type_arguments,
1146 const Class& other, 1148 const Class& other,
1147 const TypeArguments& other_type_arguments, 1149 const TypeArguments& other_type_arguments,
1148 Error* bound_error) const { 1150 Error* bound_error,
1151 Heap::Space space = Heap::kNew) const {
1149 return TypeTest(kIsMoreSpecificThan, 1152 return TypeTest(kIsMoreSpecificThan,
1150 type_arguments, 1153 type_arguments,
1151 other, 1154 other,
1152 other_type_arguments, 1155 other_type_arguments,
1153 bound_error); 1156 bound_error,
1157 space);
1154 } 1158 }
1155 1159
1156 // Check if this is the top level class. 1160 // Check if this is the top level class.
1157 bool IsTopLevel() const; 1161 bool IsTopLevel() const;
1158 1162
1159 bool IsPrivate() const; 1163 bool IsPrivate() const;
1160 1164
1161 RawArray* fields() const { return raw_ptr()->fields_; } 1165 RawArray* fields() const { return raw_ptr()->fields_; }
1162 void SetFields(const Array& value) const; 1166 void SetFields(const Array& value) const;
1163 void AddField(const Field& field) const; 1167 void AddField(const Field& field) const;
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 const String& name) const; 1487 const String& name) const;
1484 1488
1485 // Allocate an instance class which has a VM implementation. 1489 // Allocate an instance class which has a VM implementation.
1486 template <class FakeInstance> static RawClass* New(intptr_t id); 1490 template <class FakeInstance> static RawClass* New(intptr_t id);
1487 1491
1488 // Check the subtype or 'more specific' relationship. 1492 // Check the subtype or 'more specific' relationship.
1489 bool TypeTest(TypeTestKind test_kind, 1493 bool TypeTest(TypeTestKind test_kind,
1490 const TypeArguments& type_arguments, 1494 const TypeArguments& type_arguments,
1491 const Class& other, 1495 const Class& other,
1492 const TypeArguments& other_type_arguments, 1496 const TypeArguments& other_type_arguments,
1493 Error* bound_error) const; 1497 Error* bound_error,
1498 Heap::Space space) const;
1494 1499
1495 static bool TypeTestNonRecursive( 1500 static bool TypeTestNonRecursive(
1496 const Class& cls, 1501 const Class& cls,
1497 TypeTestKind test_kind, 1502 TypeTestKind test_kind,
1498 const TypeArguments& type_arguments, 1503 const TypeArguments& type_arguments,
1499 const Class& other, 1504 const Class& other,
1500 const TypeArguments& other_type_arguments, 1505 const TypeArguments& other_type_arguments,
1501 Error* bound_error); 1506 Error* bound_error,
1507 Heap::Space space);
1502 1508
1503 FINAL_HEAP_OBJECT_IMPLEMENTATION(Class, Object); 1509 FINAL_HEAP_OBJECT_IMPLEMENTATION(Class, Object);
1504 friend class AbstractType; 1510 friend class AbstractType;
1505 friend class Instance; 1511 friend class Instance;
1506 friend class Object; 1512 friend class Object;
1507 friend class Type; 1513 friend class Type;
1508 friend class Intrinsifier; 1514 friend class Intrinsifier;
1509 }; 1515 };
1510 1516
1511 1517
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1584 // Consider only a prefix of length 'len'. 1590 // Consider only a prefix of length 'len'.
1585 bool IsRawInstantiatedRaw(intptr_t len) const { 1591 bool IsRawInstantiatedRaw(intptr_t len) const {
1586 return IsDynamicTypes(true, 0, len); 1592 return IsDynamicTypes(true, 0, len);
1587 } 1593 }
1588 1594
1589 // Check the subtype relationship, considering only a subvector of length 1595 // Check the subtype relationship, considering only a subvector of length
1590 // 'len' starting at 'from_index'. 1596 // 'len' starting at 'from_index'.
1591 bool IsSubtypeOf(const TypeArguments& other, 1597 bool IsSubtypeOf(const TypeArguments& other,
1592 intptr_t from_index, 1598 intptr_t from_index,
1593 intptr_t len, 1599 intptr_t len,
1594 Error* bound_error) const { 1600 Error* bound_error,
1595 return TypeTest(kIsSubtypeOf, other, from_index, len, bound_error); 1601 Heap::Space space = Heap::kNew) const {
1602 return TypeTest(kIsSubtypeOf, other, from_index, len, bound_error, space);
1596 } 1603 }
1597 1604
1598 // Check the 'more specific' relationship, considering only a subvector of 1605 // Check the 'more specific' relationship, considering only a subvector of
1599 // length 'len' starting at 'from_index'. 1606 // length 'len' starting at 'from_index'.
1600 bool IsMoreSpecificThan(const TypeArguments& other, 1607 bool IsMoreSpecificThan(const TypeArguments& other,
1601 intptr_t from_index, 1608 intptr_t from_index,
1602 intptr_t len, 1609 intptr_t len,
1603 Error* bound_error) const { 1610 Error* bound_error,
1604 return TypeTest(kIsMoreSpecificThan, other, from_index, len, bound_error); 1611 Heap::Space space = Heap::kNew) const {
1612 return TypeTest(kIsMoreSpecificThan,
1613 other, from_index, len, bound_error, space);
1605 } 1614 }
1606 1615
1607 // Check if the vectors are equal (they may be null). 1616 // Check if the vectors are equal (they may be null).
1608 bool Equals(const TypeArguments& other) const { 1617 bool Equals(const TypeArguments& other) const {
1609 return IsSubvectorEquivalent(other, 0, IsNull() ? 0 : Length()); 1618 return IsSubvectorEquivalent(other, 0, IsNull() ? 0 : Length());
1610 } 1619 }
1611 1620
1612 bool IsEquivalent(const TypeArguments& other, TrailPtr trail = NULL) const { 1621 bool IsEquivalent(const TypeArguments& other, TrailPtr trail = NULL) const {
1613 return IsSubvectorEquivalent(other, 0, IsNull() ? 0 : Length(), trail); 1622 return IsSubvectorEquivalent(other, 0, IsNull() ? 0 : Length(), trail);
1614 } 1623 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1706 bool IsDynamicTypes(bool raw_instantiated, 1715 bool IsDynamicTypes(bool raw_instantiated,
1707 intptr_t from_index, 1716 intptr_t from_index,
1708 intptr_t len) const; 1717 intptr_t len) const;
1709 1718
1710 // Check the subtype or 'more specific' relationship, considering only a 1719 // Check the subtype or 'more specific' relationship, considering only a
1711 // subvector of length 'len' starting at 'from_index'. 1720 // subvector of length 'len' starting at 'from_index'.
1712 bool TypeTest(TypeTestKind test_kind, 1721 bool TypeTest(TypeTestKind test_kind,
1713 const TypeArguments& other, 1722 const TypeArguments& other,
1714 intptr_t from_index, 1723 intptr_t from_index,
1715 intptr_t len, 1724 intptr_t len,
1716 Error* bound_error) const; 1725 Error* bound_error,
1726 Heap::Space space) const;
1717 1727
1718 // Return the internal or public name of a subvector of this type argument 1728 // Return the internal or public name of a subvector of this type argument
1719 // vector, e.g. "<T, dynamic, List<T>, int>". 1729 // vector, e.g. "<T, dynamic, List<T>, int>".
1720 RawString* SubvectorName(intptr_t from_index, 1730 RawString* SubvectorName(intptr_t from_index,
1721 intptr_t len, 1731 intptr_t len,
1722 NameVisibility name_visibility) const; 1732 NameVisibility name_visibility) const;
1723 1733
1724 RawArray* instantiations() const; 1734 RawArray* instantiations() const;
1725 void set_instantiations(const Array& value) const; 1735 void set_instantiations(const Array& value) const;
1726 RawAbstractType* const* TypeAddr(intptr_t index) const; 1736 RawAbstractType* const* TypeAddr(intptr_t index) const;
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
2417 // parameters of the other function in order for this function to override the 2427 // parameters of the other function in order for this function to override the
2418 // other function. 2428 // other function.
2419 bool HasCompatibleParametersWith(const Function& other, 2429 bool HasCompatibleParametersWith(const Function& other,
2420 Error* bound_error) const; 2430 Error* bound_error) const;
2421 2431
2422 // Returns true if the type of this function is a subtype of the type of 2432 // Returns true if the type of this function is a subtype of the type of
2423 // the other function. 2433 // the other function.
2424 bool IsSubtypeOf(const TypeArguments& type_arguments, 2434 bool IsSubtypeOf(const TypeArguments& type_arguments,
2425 const Function& other, 2435 const Function& other,
2426 const TypeArguments& other_type_arguments, 2436 const TypeArguments& other_type_arguments,
2427 Error* bound_error) const { 2437 Error* bound_error,
2438 Heap::Space space = Heap::kNew) const {
2428 return TypeTest(kIsSubtypeOf, 2439 return TypeTest(kIsSubtypeOf,
2429 type_arguments, 2440 type_arguments,
2430 other, 2441 other,
2431 other_type_arguments, 2442 other_type_arguments,
2432 bound_error); 2443 bound_error,
2444 space);
2433 } 2445 }
2434 2446
2435 // Returns true if the type of this function is more specific than the type of 2447 // Returns true if the type of this function is more specific than the type of
2436 // the other function. 2448 // the other function.
2437 bool IsMoreSpecificThan(const TypeArguments& type_arguments, 2449 bool IsMoreSpecificThan(const TypeArguments& type_arguments,
2438 const Function& other, 2450 const Function& other,
2439 const TypeArguments& other_type_arguments, 2451 const TypeArguments& other_type_arguments,
2440 Error* bound_error) const { 2452 Error* bound_error,
2453 Heap::Space space = Heap::kNew) const {
2441 return TypeTest(kIsMoreSpecificThan, 2454 return TypeTest(kIsMoreSpecificThan,
2442 type_arguments, 2455 type_arguments,
2443 other, 2456 other,
2444 other_type_arguments, 2457 other_type_arguments,
2445 bound_error); 2458 bound_error,
2459 space);
2446 } 2460 }
2447 2461
2448 // Returns true if this function represents an explicit getter function. 2462 // Returns true if this function represents an explicit getter function.
2449 bool IsGetterFunction() const { 2463 bool IsGetterFunction() const {
2450 return kind() == RawFunction::kGetterFunction; 2464 return kind() == RawFunction::kGetterFunction;
2451 } 2465 }
2452 2466
2453 // Returns true if this function represents an implicit getter function. 2467 // Returns true if this function represents an implicit getter function.
2454 bool IsImplicitGetterFunction() const { 2468 bool IsImplicitGetterFunction() const {
2455 return kind() == RawFunction::kImplicitGetter; 2469 return kind() == RawFunction::kImplicitGetter;
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
2720 GrowableHandlePtrArray<const String>* pieces) const; 2734 GrowableHandlePtrArray<const String>* pieces) const;
2721 RawString* BuildSignature(bool instantiate, 2735 RawString* BuildSignature(bool instantiate,
2722 NameVisibility name_visibility, 2736 NameVisibility name_visibility,
2723 const TypeArguments& instantiator) const; 2737 const TypeArguments& instantiator) const;
2724 2738
2725 // Check the subtype or 'more specific' relationship. 2739 // Check the subtype or 'more specific' relationship.
2726 bool TypeTest(TypeTestKind test_kind, 2740 bool TypeTest(TypeTestKind test_kind,
2727 const TypeArguments& type_arguments, 2741 const TypeArguments& type_arguments,
2728 const Function& other, 2742 const Function& other,
2729 const TypeArguments& other_type_arguments, 2743 const TypeArguments& other_type_arguments,
2730 Error* bound_error) const; 2744 Error* bound_error,
2745 Heap::Space space) const;
2731 2746
2732 // Checks the type of the formal parameter at the given position for 2747 // Checks the type of the formal parameter at the given position for
2733 // subtyping or 'more specific' relationship between the type of this function 2748 // subtyping or 'more specific' relationship between the type of this function
2734 // and the type of the other function. 2749 // and the type of the other function.
2735 bool TestParameterType(TypeTestKind test_kind, 2750 bool TestParameterType(TypeTestKind test_kind,
2736 intptr_t parameter_position, 2751 intptr_t parameter_position,
2737 intptr_t other_parameter_position, 2752 intptr_t other_parameter_position,
2738 const TypeArguments& type_arguments, 2753 const TypeArguments& type_arguments,
2739 const Function& other, 2754 const Function& other,
2740 const TypeArguments& other_type_arguments, 2755 const TypeArguments& other_type_arguments,
2741 Error* bound_error) const; 2756 Error* bound_error,
2757 Heap::Space space) const;
2742 2758
2743 FINAL_HEAP_OBJECT_IMPLEMENTATION(Function, Object); 2759 FINAL_HEAP_OBJECT_IMPLEMENTATION(Function, Object);
2744 friend class Class; 2760 friend class Class;
2745 friend class SnapshotWriter; 2761 friend class SnapshotWriter;
2746 friend class Parser; // For set_eval_script. 2762 friend class Parser; // For set_eval_script.
2747 // RawFunction::VisitFunctionPointers accesses the private constructor of 2763 // RawFunction::VisitFunctionPointers accesses the private constructor of
2748 // Function. 2764 // Function.
2749 friend class RawFunction; 2765 friend class RawFunction;
2750 }; 2766 };
2751 2767
(...skipping 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after
5125 // Check if this type represents the '_Smi' type. 5141 // Check if this type represents the '_Smi' type.
5126 bool IsSmiType() const; 5142 bool IsSmiType() const;
5127 5143
5128 // Check if this type represents the 'String' type. 5144 // Check if this type represents the 'String' type.
5129 bool IsStringType() const; 5145 bool IsStringType() const;
5130 5146
5131 // Check if this type represents the 'Function' type. 5147 // Check if this type represents the 'Function' type.
5132 bool IsFunctionType() const; 5148 bool IsFunctionType() const;
5133 5149
5134 // Check the subtype relationship. 5150 // Check the subtype relationship.
5135 bool IsSubtypeOf(const AbstractType& other, Error* bound_error) const { 5151 bool IsSubtypeOf(const AbstractType& other,
5136 return TypeTest(kIsSubtypeOf, other, bound_error); 5152 Error* bound_error,
5153 Heap::Space space = Heap::kNew) const {
5154 return TypeTest(kIsSubtypeOf, other, bound_error, space);
5137 } 5155 }
5138 5156
5139 // Check the 'more specific' relationship. 5157 // Check the 'more specific' relationship.
5140 bool IsMoreSpecificThan(const AbstractType& other, 5158 bool IsMoreSpecificThan(const AbstractType& other,
5141 Error* bound_error) const { 5159 Error* bound_error,
5142 return TypeTest(kIsMoreSpecificThan, other, bound_error); 5160 Heap::Space space = Heap::kNew) const {
5161 return TypeTest(kIsMoreSpecificThan, other, bound_error, space);
5143 } 5162 }
5144 5163
5145 private: 5164 private:
5146 // Check the subtype or 'more specific' relationship. 5165 // Check the subtype or 'more specific' relationship.
5147 bool TypeTest(TypeTestKind test_kind, 5166 bool TypeTest(TypeTestKind test_kind,
5148 const AbstractType& other, 5167 const AbstractType& other,
5149 Error* bound_error) const; 5168 Error* bound_error,
5169 Heap::Space space) const;
5150 5170
5151 // Return the internal or public name of this type, including the names of its 5171 // Return the internal or public name of this type, including the names of its
5152 // type arguments, if any. 5172 // type arguments, if any.
5153 RawString* BuildName(NameVisibility visibility) const; 5173 RawString* BuildName(NameVisibility visibility) const;
5154 5174
5155 protected: 5175 protected:
5156 HEAP_OBJECT_IMPLEMENTATION(AbstractType, Instance); 5176 HEAP_OBJECT_IMPLEMENTATION(AbstractType, Instance);
5157 friend class Class; 5177 friend class Class;
5158 friend class Function; 5178 friend class Function;
5159 friend class TypeArguments; 5179 friend class TypeArguments;
(...skipping 2946 matching lines...) Expand 10 before | Expand all | Expand 10 after
8106 8126
8107 8127
8108 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 8128 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
8109 intptr_t index) { 8129 intptr_t index) {
8110 return array.At((index * kEntryLength) + kTargetFunctionIndex); 8130 return array.At((index * kEntryLength) + kTargetFunctionIndex);
8111 } 8131 }
8112 8132
8113 } // namespace dart 8133 } // namespace dart
8114 8134
8115 #endif // VM_OBJECT_H_ 8135 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698