| 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 part of universe; | 5 part of universe; |
| 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 21 matching lines...) Expand all Loading... |
| 32 clearAllDependencies(); | 32 clearAllDependencies(); |
| 33 clearAllSideEffects(); | 33 clearAllSideEffects(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool operator==(other) => _flags == other._flags; | 36 bool operator==(other) => _flags == other._flags; |
| 37 | 37 |
| 38 int get hashCode => throw new UnsupportedError('SideEffects.hashCode'); | 38 int get hashCode => throw new UnsupportedError('SideEffects.hashCode'); |
| 39 | 39 |
| 40 bool _getFlag(int position) => (_flags & (1 << position)) != 0; | 40 bool _getFlag(int position) => (_flags & (1 << position)) != 0; |
| 41 void _setFlag(int position) { _flags |= (1 << position); } | 41 void _setFlag(int position) { _flags |= (1 << position); } |
| 42 bool _clearFlag(int position) { _flags &= ~(1 << position); } | 42 void _clearFlag(int position) { _flags &= ~(1 << position); } |
| 43 | 43 |
| 44 int getChangesFlags() => _flags & ((1 << FLAG_CHANGES_COUNT) - 1); | 44 int getChangesFlags() => _flags & ((1 << FLAG_CHANGES_COUNT) - 1); |
| 45 int getDependsOnFlags() { | 45 int getDependsOnFlags() { |
| 46 return (_flags & ((1 << FLAG_DEPENDS_ON_COUNT) - 1)) >> FLAG_CHANGES_COUNT; | 46 return (_flags & ((1 << FLAG_DEPENDS_ON_COUNT) - 1)) >> FLAG_CHANGES_COUNT; |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool hasSideEffects() => getChangesFlags() != 0; | 49 bool hasSideEffects() => getChangesFlags() != 0; |
| 50 bool dependsOnSomething() => getDependsOnFlags() != 0; | 50 bool dependsOnSomething() => getDependsOnFlags() != 0; |
| 51 | 51 |
| 52 void setAllSideEffects() { _flags |= ((1 << FLAG_CHANGES_COUNT) - 1); } | 52 void setAllSideEffects() { _flags |= ((1 << FLAG_CHANGES_COUNT) - 1); } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 if (!dependsOnSomething()) buffer.write(' nothing'); | 122 if (!dependsOnSomething()) buffer.write(' nothing'); |
| 123 buffer.write(', Changes'); | 123 buffer.write(', Changes'); |
| 124 if (changesIndex()) buffer.write(' []'); | 124 if (changesIndex()) buffer.write(' []'); |
| 125 if (changesInstanceProperty()) buffer.write(' field'); | 125 if (changesInstanceProperty()) buffer.write(' field'); |
| 126 if (changesStaticProperty()) buffer.write(' static'); | 126 if (changesStaticProperty()) buffer.write(' static'); |
| 127 if (!hasSideEffects()) buffer.write(' nothing'); | 127 if (!hasSideEffects()) buffer.write(' nothing'); |
| 128 buffer.write('.'); | 128 buffer.write('.'); |
| 129 return buffer.toString(); | 129 return buffer.toString(); |
| 130 } | 130 } |
| 131 } | 131 } |
| OLD | NEW |