Changeset 184624 in webkit
- Timestamp:
- May 20, 2015 12:55:58 AM (9 years ago)
- Location:
- branches/safari-601.1.32-branch/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-601.1.32-branch/Source/JavaScriptCore/ChangeLog
r184562 r184624 1 2015-05-20 Babak Shafiei <bshafiei@apple.com> 2 3 Merge r184540. 4 5 2015-05-18 Filip Pizlo <fpizlo@apple.com> 6 7 Add SpecBoolInt32 type that means "I'm an int and I'm either 0 or 1" 8 https://bugs.webkit.org/show_bug.cgi?id=145137 9 10 Reviewed by Benjamin Poulain. 11 12 It's super useful to know if an integer value could be either zero or one. We have an 13 immediate need for this because of Int32|Boolean uses, where knowing that the Int32 is 14 either 0 or 1 means that there is no actual polymorphism if you just look at the low bit 15 (1 behaves like true, 0 behaves like false, and the low bit of 1|true is 1, and the low 16 bit of 0|false is 0). 17 18 We do this by splitting the SpecInt32 type into SpecBoolInt32 and SpecNonBoolInt32. This 19 change doesn't have any effect on behavior, yet. But it does give us the ability to 20 predict and prove when values are SpecBoolInt32; it's just we don't leverage this yet. 21 22 This is perf-neutral. 23 24 * bytecode/SpeculatedType.cpp: 25 (JSC::dumpSpeculation): 26 (JSC::speculationToAbbreviatedString): 27 (JSC::speculationFromValue): 28 * bytecode/SpeculatedType.h: 29 (JSC::isStringOrStringObjectSpeculation): 30 (JSC::isBoolInt32Speculation): 31 (JSC::isInt32Speculation): 32 (JSC::isInt32OrBooleanSpeculation): 33 * dfg/DFGAbstractInterpreterInlines.h: 34 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): 35 1 36 2015-05-18 Matthew Hanson <matthew_hanson@apple.com> 2 37 -
branches/safari-601.1.32-branch/Source/JavaScriptCore/bytecode/SpeculatedType.cpp
r182971 r184624 159 159 } 160 160 161 if (value &SpecInt32)161 if (value == SpecInt32) 162 162 myOut.print("Int32"); 163 else 164 isTop = false; 163 else { 164 if (value & SpecBoolInt32) 165 myOut.print("Boolint32"); 166 else 167 isTop = false; 168 169 if (value & SpecNonBoolInt32) 170 myOut.print("Nonboolint32"); 171 else 172 isTop = false; 173 } 165 174 166 175 if (value & SpecInt52) … … 250 259 if (isCellSpeculation(prediction)) 251 260 return "<Cell>"; 261 if (isBoolInt32Speculation(prediction)) 262 return "<BoolInt32>"; 252 263 if (isInt32Speculation(prediction)) 253 264 return "<Int32>"; … … 357 368 if (value.isEmpty()) 358 369 return SpecEmpty; 359 if (value.isInt32()) 360 return SpecInt32; 370 if (value.isInt32()) { 371 if (value.asInt32() & ~1) 372 return SpecNonBoolInt32; 373 return SpecBoolInt32; 374 } 361 375 if (value.isDouble()) { 362 376 double number = value.asNumber(); -
branches/safari-601.1.32-branch/Source/JavaScriptCore/bytecode/SpeculatedType.h
r181993 r184624 63 63 static const SpeculatedType SpecCellOther = 0x00040000; // It's definitely a JSCell but not a subclass of JSObject and definitely not a JSString. FIXME: This shouldn't be part of heap-top or bytecode-top. https://bugs.webkit.org/show_bug.cgi?id=133078 64 64 static const SpeculatedType SpecCell = 0x0007ffff; // It's definitely a JSCell. 65 static const SpeculatedType SpecInt32 = 0x00200000; // It's definitely an Int32. 65 static const SpeculatedType SpecBoolInt32 = 0x00100000; // It's definitely an Int32 with value 0 or 1. 66 static const SpeculatedType SpecNonBoolInt32 = 0x00200000; // It's definitely an Int32 with value other than 0 or 1. 67 static const SpeculatedType SpecInt32 = 0x00300000; // It's definitely an Int32. 66 68 static const SpeculatedType SpecInt52 = 0x00400000; // It's definitely an Int52 and we intend it to unbox it. 67 static const SpeculatedType SpecMachineInt = 0x00 600000; // It's something that we can do machine int arithmetic on.69 static const SpeculatedType SpecMachineInt = 0x00700000; // It's something that we can do machine int arithmetic on. 68 70 static const SpeculatedType SpecInt52AsDouble = 0x00800000; // It's definitely an Int52 and it's inside a double. 69 static const SpeculatedType SpecInteger = 0x00 e00000; // It's definitely some kind of integer.71 static const SpeculatedType SpecInteger = 0x00f00000; // It's definitely some kind of integer. 70 72 static const SpeculatedType SpecNonIntAsDouble = 0x01000000; // It's definitely not an Int52 but it's a real number and it's a double. 71 73 static const SpeculatedType SpecDoubleReal = 0x01800000; // It's definitely a non-NaN double. … … 75 77 static const SpeculatedType SpecBytecodeDouble = 0x03800000; // It's either a non-NaN or a NaN double, but it's definitely not impure NaN. 76 78 static const SpeculatedType SpecFullDouble = 0x07800000; // It's either a non-NaN or a NaN double. 77 static const SpeculatedType SpecBytecodeRealNumber = 0x01 a00000; // It's either an Int32 or a DoubleReal.78 static const SpeculatedType SpecFullRealNumber = 0x01 e00000; // It's either an Int32 or a DoubleReal, or a Int52.79 static const SpeculatedType SpecBytecodeNumber = 0x03 a00000; // It's either an Int32 or a Double, and the Double cannot be an impure NaN.80 static const SpeculatedType SpecFullNumber = 0x07 e00000; // It's either an Int32, Int52, or a Double, and the Double can be impure NaN.79 static const SpeculatedType SpecBytecodeRealNumber = 0x01b00000; // It's either an Int32 or a DoubleReal. 80 static const SpeculatedType SpecFullRealNumber = 0x01f00000; // It's either an Int32 or a DoubleReal, or a Int52. 81 static const SpeculatedType SpecBytecodeNumber = 0x03b00000; // It's either an Int32 or a Double, and the Double cannot be an impure NaN. 82 static const SpeculatedType SpecFullNumber = 0x07f00000; // It's either an Int32, Int52, or a Double, and the Double can be impure NaN. 81 83 static const SpeculatedType SpecBoolean = 0x10000000; // It's definitely a Boolean. 82 84 static const SpeculatedType SpecOther = 0x20000000; // It's definitely either Null or Undefined. … … 257 259 } 258 260 261 inline bool isBoolInt32Speculation(SpeculatedType value) 262 { 263 return value == SpecBoolInt32; 264 } 265 259 266 inline bool isInt32Speculation(SpeculatedType value) 260 267 { 261 return value == SpecInt32;268 return value && !(value & ~SpecInt32); 262 269 } 263 270 -
branches/safari-601.1.32-branch/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r184525 r184624 258 258 break; 259 259 } 260 261 if (node->op() == BitAnd 262 && (isBoolInt32Speculation(forNode(node->child1()).m_type) || 263 isBoolInt32Speculation(forNode(node->child2()).m_type))) { 264 forNode(node).setType(SpecBoolInt32); 265 break; 266 } 267 260 268 forNode(node).setType(SpecInt32); 261 269 break; … … 298 306 m_state.setFoundConstants(true); 299 307 if (value.m_type & SpecBoolean) { 300 value.merge(Spec Int32);308 value.merge(SpecBoolInt32); 301 309 value.filter(~SpecBoolean); 302 310 } … … 336 344 break; 337 345 } 346 } 347 348 if (isBooleanSpeculation(forNode(node->child1()).m_type)) { 349 forNode(node).setType(SpecBoolInt32); 350 break; 338 351 } 339 352
Note: See TracChangeset
for help on using the changeset viewer.