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

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

Issue 12315063: Making CompileType a Value object. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // 106 //
107 // It captures the following properties: 107 // It captures the following properties:
108 // - whether value can potentially be null or it is definitely not null; 108 // - whether value can potentially be null or it is definitely not null;
109 // - concrete class id of the value or kDynamicCid if unknown statically; 109 // - concrete class id of the value or kDynamicCid if unknown statically;
110 // - abstract super type of the value, concrete type of the value in runtime 110 // - abstract super type of the value, concrete type of the value in runtime
111 // is guaranteed to be sub type of this type. 111 // is guaranteed to be sub type of this type.
112 // 112 //
113 // Values of CompileType form a lattice with a None type as a bottom and a 113 // Values of CompileType form a lattice with a None type as a bottom and a
114 // nullable Dynamic type as a top element. Method Union provides a join 114 // nullable Dynamic type as a top element. Method Union provides a join
115 // operation for the lattice. 115 // operation for the lattice.
116 class CompileType { 116 class CompileType : public ValueObject {
117 public: 117 public:
118 static const bool kNullable = true; 118 static const bool kNullable = true;
119 static const bool kNonNullable = false; 119 static const bool kNonNullable = false;
120 120
121 CompileType(const CompileType& other)
122 : ValueObject(),
123 is_nullable_(other.is_nullable_),
124 cid_(other.cid_),
125 type_(other.type_) { }
126
127 CompileType& operator=(const CompileType& other) {
128 is_nullable_ = other.is_nullable_;
129 cid_ = other.cid_;
130 type_ = other.type_;
131 return *this;
132 }
133
Florian Schneider 2013/02/25 11:18:20 This introduces additional unnecessary dependencie
srdjan 2013/02/25 17:30:36 What do you suggest as alternative? Implicit copy
121 // Return type such that concrete value's type in runtime is guaranteed to 134 // Return type such that concrete value's type in runtime is guaranteed to
122 // be subtype of it. 135 // be subtype of it.
123 const AbstractType* ToAbstractType(); 136 const AbstractType* ToAbstractType();
124 137
125 // Return class id such that it is either kDynamicCid or in runtime 138 // Return class id such that it is either kDynamicCid or in runtime
126 // value is guaranteed to have an equal class id. 139 // value is guaranteed to have an equal class id.
127 intptr_t ToCid(); 140 intptr_t ToCid();
128 141
129 // Return class id such that it is either kDynamicCid or in runtime 142 // Return class id such that it is either kDynamicCid or in runtime
130 // value is guaranteed to be either null or have an equal class id. 143 // value is guaranteed to be either null or have an equal class id.
(...skipping 4400 matching lines...) Expand 10 before | Expand all | Expand 10 after
4531 ForwardInstructionIterator* current_iterator_; 4544 ForwardInstructionIterator* current_iterator_;
4532 4545
4533 private: 4546 private:
4534 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 4547 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4535 }; 4548 };
4536 4549
4537 4550
4538 } // namespace dart 4551 } // namespace dart
4539 4552
4540 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 4553 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698