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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/universe/side_effects.dart

Issue 17569004: Implement hashCode on objects stored in a set or used as map keys. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with TOT Created 7 years, 6 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
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 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 14 matching lines...) Expand all
25 25
26 SideEffects() { 26 SideEffects() {
27 setAllSideEffects(); 27 setAllSideEffects();
28 setDependsOnSomething(); 28 setDependsOnSomething();
29 } 29 }
30 30
31 SideEffects.empty(); 31 SideEffects.empty();
32 32
33 bool operator==(other) => flags == other.flags; 33 bool operator==(other) => flags == other.flags;
34 34
35 int get hashCode => throw new UnsupportedError('SideEffects.hashCode');
36
35 bool getFlag(int position) => (flags & (1 << position)) != 0; 37 bool getFlag(int position) => (flags & (1 << position)) != 0;
36 void setFlag(int position) { flags |= (1 << position); } 38 void setFlag(int position) { flags |= (1 << position); }
37 void clearFlag(int position) { flags &= ~(1 << position); } 39 void clearFlag(int position) { flags &= ~(1 << position); }
38 40
39 int getChangesFlags() => flags & ((1 << FLAG_CHANGES_COUNT) - 1); 41 int getChangesFlags() => flags & ((1 << FLAG_CHANGES_COUNT) - 1);
40 int getDependsOnFlags() { 42 int getDependsOnFlags() {
41 return (flags & ((1 << FLAG_DEPENDS_ON_COUNT) - 1)) >> FLAG_CHANGES_COUNT; 43 return (flags & ((1 << FLAG_DEPENDS_ON_COUNT) - 1)) >> FLAG_CHANGES_COUNT;
42 } 44 }
43 45
44 bool hasSideEffects() => getChangesFlags() != 0; 46 bool hasSideEffects() => getChangesFlags() != 0;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 if (!dependsOnSomething()) buffer.write(' nothing'); 101 if (!dependsOnSomething()) buffer.write(' nothing');
100 buffer.write(', Changes'); 102 buffer.write(', Changes');
101 if (changesIndex()) buffer.write(' []'); 103 if (changesIndex()) buffer.write(' []');
102 if (changesInstanceProperty()) buffer.write(' field'); 104 if (changesInstanceProperty()) buffer.write(' field');
103 if (changesStaticProperty()) buffer.write(' static'); 105 if (changesStaticProperty()) buffer.write(' static');
104 if (!hasSideEffects()) buffer.write(' nothing'); 106 if (!hasSideEffects()) buffer.write(' nothing');
105 buffer.write('.'); 107 buffer.write('.');
106 return buffer.toString(); 108 return buffer.toString();
107 } 109 }
108 } 110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698