OLD | NEW |
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 library universe.side_effects; | 5 library universe.side_effects; |
6 | 6 |
7 class SideEffects { | 7 class SideEffects { |
8 // Changes flags. | 8 // Changes flags. |
9 static const int FLAG_CHANGES_INDEX = 0; | 9 static const int FLAG_CHANGES_INDEX = 0; |
10 static const int FLAG_CHANGES_INSTANCE_PROPERTY = FLAG_CHANGES_INDEX + 1; | 10 static const int FLAG_CHANGES_INSTANCE_PROPERTY = FLAG_CHANGES_INDEX + 1; |
(...skipping 15 matching lines...) Expand all Loading... |
26 SideEffects() { | 26 SideEffects() { |
27 setAllSideEffects(); | 27 setAllSideEffects(); |
28 setDependsOnSomething(); | 28 setDependsOnSomething(); |
29 } | 29 } |
30 | 30 |
31 SideEffects.empty() { | 31 SideEffects.empty() { |
32 clearAllDependencies(); | 32 clearAllDependencies(); |
33 clearAllSideEffects(); | 33 clearAllSideEffects(); |
34 } | 34 } |
35 | 35 |
| 36 SideEffects.fromFlags(this._flags); |
| 37 |
36 bool operator ==(other) => _flags == other._flags; | 38 bool operator ==(other) => _flags == other._flags; |
37 | 39 |
38 int get hashCode => throw new UnsupportedError('SideEffects.hashCode'); | 40 int get hashCode => throw new UnsupportedError('SideEffects.hashCode'); |
39 | 41 |
40 bool _getFlag(int position) => (_flags & (1 << position)) != 0; | 42 bool _getFlag(int position) => (_flags & (1 << position)) != 0; |
41 void _setFlag(int position) { | 43 void _setFlag(int position) { |
42 _flags |= (1 << position); | 44 _flags |= (1 << position); |
43 } | 45 } |
44 | 46 |
45 void _clearFlag(int position) { | 47 void _clearFlag(int position) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 bool dependsOn(int dependsFlags) => (_flags & dependsFlags) != 0; | 142 bool dependsOn(int dependsFlags) => (_flags & dependsFlags) != 0; |
141 | 143 |
142 void add(SideEffects other) { | 144 void add(SideEffects other) { |
143 _flags |= other._flags; | 145 _flags |= other._flags; |
144 } | 146 } |
145 | 147 |
146 void setTo(SideEffects other) { | 148 void setTo(SideEffects other) { |
147 _flags = other._flags; | 149 _flags = other._flags; |
148 } | 150 } |
149 | 151 |
| 152 int get flags => _flags; |
| 153 |
150 String toString() { | 154 String toString() { |
151 StringBuffer buffer = new StringBuffer(); | 155 StringBuffer buffer = new StringBuffer(); |
152 buffer.write('Depends on'); | 156 buffer.write('Depends on'); |
153 if (dependsOnIndexStore()) buffer.write(' []'); | 157 if (dependsOnIndexStore()) buffer.write(' []'); |
154 if (dependsOnInstancePropertyStore()) buffer.write(' field store'); | 158 if (dependsOnInstancePropertyStore()) buffer.write(' field store'); |
155 if (dependsOnStaticPropertyStore()) buffer.write(' static store'); | 159 if (dependsOnStaticPropertyStore()) buffer.write(' static store'); |
156 if (!dependsOnSomething()) buffer.write(' nothing'); | 160 if (!dependsOnSomething()) buffer.write(' nothing'); |
157 buffer.write(', Changes'); | 161 buffer.write(', Changes'); |
158 if (changesIndex()) buffer.write(' []'); | 162 if (changesIndex()) buffer.write(' []'); |
159 if (changesInstanceProperty()) buffer.write(' field'); | 163 if (changesInstanceProperty()) buffer.write(' field'); |
160 if (changesStaticProperty()) buffer.write(' static'); | 164 if (changesStaticProperty()) buffer.write(' static'); |
161 if (!hasSideEffects()) buffer.write(' nothing'); | 165 if (!hasSideEffects()) buffer.write(' nothing'); |
162 buffer.write('.'); | 166 buffer.write('.'); |
163 return buffer.toString(); | 167 return buffer.toString(); |
164 } | 168 } |
165 } | 169 } |
OLD | NEW |