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

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

Issue 2739643002: VM: Remove ZoneCompileType class. (Closed)
Patch Set: Created 3 years, 9 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/intrinsifier.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_
6 #define RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ 6 #define RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 29 matching lines...) Expand all
40 // 40 //
41 // It captures the following properties: 41 // It captures the following properties:
42 // - whether value can potentially be null or it is definitely not null; 42 // - whether value can potentially be null or it is definitely not null;
43 // - concrete class id of the value or kDynamicCid if unknown statically; 43 // - concrete class id of the value or kDynamicCid if unknown statically;
44 // - abstract super type of the value, concrete type of the value in runtime 44 // - abstract super type of the value, concrete type of the value in runtime
45 // is guaranteed to be sub type of this type. 45 // is guaranteed to be sub type of this type.
46 // 46 //
47 // Values of CompileType form a lattice with a None type as a bottom and a 47 // Values of CompileType form a lattice with a None type as a bottom and a
48 // nullable Dynamic type as a top element. Method Union provides a join 48 // nullable Dynamic type as a top element. Method Union provides a join
49 // operation for the lattice. 49 // operation for the lattice.
50 class CompileType : public ValueObject { 50 class CompileType : public ZoneAllocated {
51 public: 51 public:
52 static const bool kNullable = true; 52 static const bool kNullable = true;
53 static const bool kNonNullable = false; 53 static const bool kNonNullable = false;
54 54
55 CompileType(bool is_nullable, intptr_t cid, const AbstractType* type) 55 CompileType(bool is_nullable, intptr_t cid, const AbstractType* type)
56 : is_nullable_(is_nullable), cid_(cid), type_(type) {} 56 : is_nullable_(is_nullable), cid_(cid), type_(type) {}
57 57
58 CompileType(const CompileType& other) 58 CompileType(const CompileType& other)
59 : ValueObject(), 59 : is_nullable_(other.is_nullable_),
60 is_nullable_(other.is_nullable_),
61 cid_(other.cid_), 60 cid_(other.cid_),
62 type_(other.type_) {} 61 type_(other.type_) {}
63 62
64 CompileType& operator=(const CompileType& other) { 63 CompileType& operator=(const CompileType& other) {
65 is_nullable_ = other.is_nullable_; 64 is_nullable_ = other.is_nullable_;
66 cid_ = other.cid_; 65 cid_ = other.cid_;
67 type_ = other.type_; 66 type_ = other.type_;
68 return *this; 67 return *this;
69 } 68 }
70 69
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 bool CanComputeIsInstanceOf(const AbstractType& type, 168 bool CanComputeIsInstanceOf(const AbstractType& type,
170 bool is_nullable, 169 bool is_nullable,
171 bool* is_instance); 170 bool* is_instance);
172 171
173 bool is_nullable_; 172 bool is_nullable_;
174 intptr_t cid_; 173 intptr_t cid_;
175 const AbstractType* type_; 174 const AbstractType* type_;
176 }; 175 };
177 176
178 177
179 // Zone allocated wrapper for the CompileType value.
180 class ZoneCompileType : public ZoneAllocated {
181 public:
182 static CompileType* Wrap(const CompileType& type) {
183 ZoneCompileType* zone_type = new ZoneCompileType(type);
184 return zone_type->ToCompileType();
185 }
186
187 CompileType* ToCompileType() { return &type_; }
188
189 protected:
190 explicit ZoneCompileType(const CompileType& type) : type_(type) {}
191
192 CompileType type_;
193 };
194
195
196 class EffectSet : public ValueObject { 178 class EffectSet : public ValueObject {
197 public: 179 public:
198 enum Effects { 180 enum Effects {
199 kNoEffects = 0, 181 kNoEffects = 0,
200 kExternalization = 1, 182 kExternalization = 1,
201 kLastEffect = kExternalization 183 kLastEffect = kExternalization
202 }; 184 };
203 185
204 EffectSet(const EffectSet& other) : ValueObject(), effects_(other.effects_) {} 186 EffectSet(const EffectSet& other) : ValueObject(), effects_(other.effects_) {}
205 187
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 #else 1619 #else
1638 return (representation() == kPairOfTagged) || 1620 return (representation() == kPairOfTagged) ||
1639 (representation() == kUnboxedMint); 1621 (representation() == kUnboxedMint);
1640 #endif 1622 #endif
1641 } 1623 }
1642 1624
1643 // Compile time type of the definition, which may be requested before type 1625 // Compile time type of the definition, which may be requested before type
1644 // propagation during graph building. 1626 // propagation during graph building.
1645 CompileType* Type() { 1627 CompileType* Type() {
1646 if (type_ == NULL) { 1628 if (type_ == NULL) {
1647 type_ = ZoneCompileType::Wrap(ComputeType()); 1629 type_ = new CompileType(ComputeType());
1648 } 1630 }
1649 return type_; 1631 return type_;
1650 } 1632 }
1651 1633
1652 // Does this define a mint? 1634 // Does this define a mint?
1653 inline bool IsMintDefinition(); 1635 inline bool IsMintDefinition();
1654 1636
1655 bool IsInt32Definition() { 1637 bool IsInt32Definition() {
1656 return IsBinaryInt32Op() || IsBoxInt32() || IsUnboxInt32() || 1638 return IsBinaryInt32Op() || IsBoxInt32() || IsUnboxInt32() ||
1657 IsUnboxedIntConverter(); 1639 IsUnboxedIntConverter();
1658 } 1640 }
1659 1641
1660 // Compute compile type for this definition. It is safe to use this 1642 // Compute compile type for this definition. It is safe to use this
1661 // approximation even before type propagator was run (e.g. during graph 1643 // approximation even before type propagator was run (e.g. during graph
1662 // building). 1644 // building).
1663 virtual CompileType ComputeType() const { return CompileType::Dynamic(); } 1645 virtual CompileType ComputeType() const { return CompileType::Dynamic(); }
1664 1646
1665 // Update CompileType of the definition. Returns true if the type has changed. 1647 // Update CompileType of the definition. Returns true if the type has changed.
1666 virtual bool RecomputeType() { return false; } 1648 virtual bool RecomputeType() { return false; }
1667 1649
1668 PRINT_OPERANDS_TO_SUPPORT 1650 PRINT_OPERANDS_TO_SUPPORT
1669 PRINT_TO_SUPPORT 1651 PRINT_TO_SUPPORT
1670 1652
1671 bool UpdateType(CompileType new_type) { 1653 bool UpdateType(CompileType new_type) {
1672 if (type_ == NULL) { 1654 if (type_ == NULL) {
1673 type_ = ZoneCompileType::Wrap(new_type); 1655 type_ = new CompileType(new_type);
1674 return true; 1656 return true;
1675 } 1657 }
1676 1658
1677 if (type_->IsNone() || !type_->IsEqualTo(&new_type)) { 1659 if (type_->IsNone() || !type_->IsEqualTo(&new_type)) {
1678 *type_ = new_type; 1660 *type_ = new_type;
1679 return true; 1661 return true;
1680 } 1662 }
1681 1663
1682 return false; 1664 return false;
1683 } 1665 }
(...skipping 6359 matching lines...) Expand 10 before | Expand all | Expand 10 after
8043 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ 8025 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \
8044 UNIMPLEMENTED(); \ 8026 UNIMPLEMENTED(); \
8045 return NULL; \ 8027 return NULL; \
8046 } \ 8028 } \
8047 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8029 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8048 8030
8049 8031
8050 } // namespace dart 8032 } // namespace dart
8051 8033
8052 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ 8034 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/intrinsifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698