Changeset 153208 in webkit for trunk/Source/JavaScriptCore/dfg/DFGAbstractValue.h
- Timestamp:
- Jul 24, 2013, 9:02:00 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGAbstractValue.h
r153129 r153208 58 58 } 59 59 60 bool isClear() const 61 { 62 bool result = m_type == SpecNone && !m_arrayModes && m_currentKnownStructure.isClear() && m_futurePossibleStructure.isClear(); 63 if (result) 64 ASSERT(!m_value); 65 return result; 66 } 60 bool isClear() const { return m_type == SpecNone; } 67 61 68 62 void makeTop() … … 191 185 void filter(Graph&, const StructureSet&); 192 186 193 void filterArrayModes(ArrayModes arrayModes) 194 { 195 ASSERT(arrayModes); 196 197 m_type &= SpecCell; 198 m_arrayModes &= arrayModes; 199 200 // I could do more fancy filtering here. But it probably won't make any difference. 201 202 checkConsistency(); 203 } 204 205 void filter(SpeculatedType type) 206 { 207 if (type == SpecTop) 208 return; 209 m_type &= type; 210 211 // It's possible that prior to this filter() call we had, say, (Final, TOP), and 212 // the passed type is Array. At this point we'll have (None, TOP). The best way 213 // to ensure that the structure filtering does the right thing is to filter on 214 // the new type (None) rather than the one passed (Array). 215 m_currentKnownStructure.filter(m_type); 216 m_futurePossibleStructure.filter(m_type); 217 218 filterArrayModesByType(); 219 filterValueByType(); 220 221 checkConsistency(); 222 } 187 void filterArrayModes(ArrayModes arrayModes); 188 189 void filter(SpeculatedType type); 223 190 224 191 void filterByValue(JSValue value) … … 281 248 } 282 249 283 void checkConsistency() const 284 { 285 if (!(m_type & SpecCell)) { 286 ASSERT(m_currentKnownStructure.isClear()); 287 ASSERT(m_futurePossibleStructure.isClear()); 288 ASSERT(!m_arrayModes); 289 } 290 291 if (isClear()) 292 ASSERT(!m_value); 293 294 if (!!m_value) 295 ASSERT(mergeSpeculations(m_type, speculationFromValue(m_value)) == m_type); 296 297 // Note that it's possible for a prediction like (Final, []). This really means that 298 // the value is bottom and that any code that uses the value is unreachable. But 299 // we don't want to get pedantic about this as it would only increase the computational 300 // complexity of the code. 301 } 250 void checkConsistency() const; 302 251 303 252 void dump(PrintStream&) const; … … 315 264 // 316 265 // Where x will later have a new property added to it, 'g'. Because of the 317 // known but not-yet-executed property addition, x's current lystructure will266 // known but not-yet-executed property addition, x's current structure will 318 267 // not be watchpointable; hence we have no way of statically bounding the set 319 268 // of possible structures that x may have if a clobbering event happens. So, … … 411 360 412 361 void setFuturePossibleStructure(Graph&, Structure* structure); 413 void filterFuturePossibleStructure(Graph&, Structure* structure); 414 415 // We could go further, and ensure that if the futurePossibleStructure contravenes 416 // the value, then we could clear both of those things. But that's unlikely to help 417 // in any realistic scenario, so we don't do it. Simpler is better. 418 void filterValueByType() 419 { 420 if (!!m_type) { 421 // The type is still non-empty. This implies that regardless of what filtering 422 // was done, we either didn't have a value to begin with, or that value is still 423 // valid. 424 ASSERT(!m_value || validateType(m_value)); 425 return; 426 } 427 428 // The type has been rendered empty. That means that the value must now be invalid, 429 // as well. 430 ASSERT(!m_value || !validateType(m_value)); 431 m_value = JSValue(); 432 } 433 434 void filterArrayModesByType() 435 { 436 if (!(m_type & SpecCell)) 437 m_arrayModes = 0; 438 else if (!(m_type & ~SpecArray)) 439 m_arrayModes &= ALL_ARRAY_ARRAY_MODES; 440 441 // NOTE: If m_type doesn't have SpecArray set, that doesn't mean that the 442 // array modes have to be a subset of ALL_NON_ARRAY_ARRAY_MODES, since 443 // in the speculated type type-system, RegExpMatchesArry and ArrayPrototype 444 // are Otherobj (since they are not *exactly* JSArray) but in the ArrayModes 445 // type system they are arrays (since they expose the magical length 446 // property and are otherwise allocated using array allocation). Hence the 447 // following would be wrong: 448 // 449 // if (!(m_type & SpecArray)) 450 // m_arrayModes &= ALL_NON_ARRAY_ARRAY_MODES; 451 } 362 363 void filterValueByType(); 364 void filterArrayModesByType(); 365 366 bool shouldBeClear() const; 367 void normalizeClarity(); 452 368 }; 453 369
Note:
See TracChangeset
for help on using the changeset viewer.