Changeset 94629 in webkit for trunk/Source/JavaScriptCore/bytecode/ValueProfile.h
- Timestamp:
- Sep 6, 2011, 7:47:51 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecode/ValueProfile.h
r94559 r94629 118 118 return result; 119 119 } 120 121 unsigned numberOfBooleans() const 122 { 123 unsigned result = 0; 124 for (unsigned i = 0; i < numberOfBuckets; ++i) { 125 if (!!buckets[i] && JSValue::decode(buckets[i]).isBoolean()) 126 result++; 127 } 128 return result; 129 } 120 130 121 131 // These methods are not particularly optimized, in that they will each … … 143 153 return computeProbability(numberOfArrays(), numberOfSamples()); 144 154 } 155 156 unsigned probabilityOfBoolean() const 157 { 158 return computeProbability(numberOfBooleans(), numberOfSamples()); 159 } 145 160 146 161 #ifndef NDEBUG … … 148 163 { 149 164 fprintf(out, 150 "samples = %u, int32 = %u , double = %u, cell = %u, array = %u",165 "samples = %u, int32 = %u (%u), double = %u (%u), cell = %u (%u), array = %u (%u), boolean = %u (%u)", 151 166 numberOfSamples(), 152 numberOfInt32s(), 153 numberOfDoubles(), 154 numberOfCells(), 155 numberOfArrays()); 167 probabilityOfInt32(), numberOfInt32s(), 168 probabilityOfDouble(), numberOfDoubles(), 169 probabilityOfCell(), numberOfCells(), 170 probabilityOfArray(), numberOfArrays(), 171 probabilityOfBoolean(), numberOfBooleans()); 156 172 bool first = true; 157 173 for (unsigned i = 0; i < numberOfBuckets; ++i) { … … 179 195 unsigned cells; 180 196 unsigned arrays; 197 unsigned booleans; 181 198 }; 182 199 … … 184 201 void computeStatistics(JSGlobalData& globalData, Statistics& statistics) const 185 202 { 186 unsigned samples = 0; 187 unsigned int32s = 0; 188 unsigned doubles = 0; 189 unsigned cells = 0; 190 unsigned arrays = 0; 203 unsigned samples = 0; 204 unsigned int32s = 0; 205 unsigned doubles = 0; 206 unsigned cells = 0; 207 unsigned arrays = 0; 208 unsigned booleans = 0; 191 209 192 210 for (unsigned i = 0; i < numberOfBuckets; ++i) { … … 214 232 if (isJSArray(&globalData, value.asCell())) 215 233 arrays++; 216 } 217 } 218 219 statistics.samples = samples; 220 statistics.int32s = int32s; 221 statistics.doubles = doubles; 222 statistics.cells = cells; 223 statistics.arrays = arrays; 234 } else if (value.isBoolean()) 235 booleans++; 236 } 237 238 statistics.samples = samples; 239 statistics.int32s = int32s; 240 statistics.doubles = doubles; 241 statistics.cells = cells; 242 statistics.arrays = arrays; 243 statistics.booleans = booleans; 224 244 } 225 245
Note:
See TracChangeset
for help on using the changeset viewer.