| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 class ValueSet { | 5 class ValueSet { |
| 6 int size = 0; | 6 int size = 0; |
| 7 List<HInstruction> table; | 7 List<HInstruction> table; |
| 8 ValueSetNode collisions; | 8 ValueSetNode collisions; |
| 9 ValueSet() : table = new List<HInstruction>(8); | 9 ValueSet() : table = new List<HInstruction>(8); |
| 10 | 10 |
| 11 bool isEmpty() => size == 0; | 11 bool isEmpty() => size == 0; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 40 for (ValueSetNode node = collisions; node !== null; node = node.next) { | 40 for (ValueSetNode node = collisions; node !== null; node = node.next) { |
| 41 if (node.hashCode == hashCode) { | 41 if (node.hashCode == hashCode) { |
| 42 HInstruction cached = node.value; | 42 HInstruction cached = node.value; |
| 43 if (cached.gvnEquals(instruction)) return cached; | 43 if (cached.gvnEquals(instruction)) return cached; |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 return null; | 46 return null; |
| 47 } | 47 } |
| 48 | 48 |
| 49 void kill(int flags) { | 49 void kill(int flags) { |
| 50 if (flags == 0) return; |
| 50 int depends = HInstruction.computeDependsOnFlags(flags); | 51 int depends = HInstruction.computeDependsOnFlags(flags); |
| 51 // Kill in the hash table. | 52 // Kill in the hash table. |
| 52 for (int index = 0, length = table.length; index < length; index++) { | 53 for (int index = 0, length = table.length; index < length; index++) { |
| 53 HInstruction instruction = table[index]; | 54 HInstruction instruction = table[index]; |
| 54 if (instruction !== null && (instruction.flags & depends) != 0) { | 55 if (instruction !== null && (instruction.flags & depends) != 0) { |
| 55 table[index] = null; | 56 table[index] = null; |
| 56 size--; | 57 size--; |
| 57 } | 58 } |
| 58 } | 59 } |
| 59 // Kill in the collisions list. | 60 // Kill in the collisions list. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 assert(table.length == capacity); | 145 assert(table.length == capacity); |
| 145 } | 146 } |
| 146 } | 147 } |
| 147 | 148 |
| 148 class ValueSetNode { | 149 class ValueSetNode { |
| 149 final HInstruction value; | 150 final HInstruction value; |
| 150 final int hashCode; | 151 final int hashCode; |
| 151 ValueSetNode next; | 152 ValueSetNode next; |
| 152 ValueSetNode(this.value, this.hashCode, this.next); | 153 ValueSetNode(this.value, this.hashCode, this.next); |
| 153 } | 154 } |
| OLD | NEW |