Changeset 185768 in webkit
- Timestamp:
- Jun 19, 2015, 2:17:54 PM (10 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r185765 r185768 1 2015-06-19 Mark Lam <mark.lam@apple.com> 2 3 Employ explicit operator bool() instead of using the UnspecifiedBoolType workaround. 4 https://bugs.webkit.org/show_bug.cgi?id=146154 5 6 Reviewed by Darin Adler. 7 8 * assembler/MacroAssemblerCodeRef.h: 9 (JSC::MacroAssemblerCodePtr::dataLocation): 10 (JSC::MacroAssemblerCodePtr::operator bool): 11 (JSC::MacroAssemblerCodePtr::operator==): 12 (JSC::MacroAssemblerCodeRef::tryToDisassemble): 13 (JSC::MacroAssemblerCodeRef::operator bool): 14 (JSC::MacroAssemblerCodeRef::dump): 15 (JSC::MacroAssemblerCodePtr::operator UnspecifiedBoolType*): Deleted. 16 (JSC::MacroAssemblerCodeRef::operator UnspecifiedBoolType*): Deleted. 17 18 * bytecode/CodeOrigin.cpp: 19 (JSC::CodeOrigin::isApproximatelyEqualTo): 20 - Fixed a bug here where we were expecting to compare Executable pointers, but 21 ended up comparing a (UnspecifiedBoolType*)1 with another 22 (UnspecifiedBoolType*)1. 23 24 * bytecode/LLIntCallLinkInfo.h: 25 (JSC::LLIntCallLinkInfo::~LLIntCallLinkInfo): 26 (JSC::LLIntCallLinkInfo::isLinked): 27 (JSC::LLIntCallLinkInfo::unlink): 28 * dfg/DFGBlockWorklist.h: 29 (JSC::DFG::BlockWith::BlockWith): 30 (JSC::DFG::BlockWith::operator bool): 31 (JSC::DFG::BlockWithOrder::BlockWithOrder): 32 (JSC::DFG::BlockWithOrder::operator bool): 33 (JSC::DFG::BlockWith::operator UnspecifiedBoolType*): Deleted. 34 (JSC::DFG::BlockWithOrder::operator UnspecifiedBoolType*): Deleted. 35 * dfg/DFGIntegerRangeOptimizationPhase.cpp: 36 * dfg/DFGLazyNode.h: 37 (JSC::DFG::LazyNode::operator!): 38 (JSC::DFG::LazyNode::operator bool): 39 (JSC::DFG::LazyNode::operator UnspecifiedBoolType*): Deleted. 40 * heap/CopyWriteBarrier.h: 41 (JSC::CopyWriteBarrier::operator!): 42 (JSC::CopyWriteBarrier::operator bool): 43 (JSC::CopyWriteBarrier::get): 44 (JSC::CopyWriteBarrier::operator UnspecifiedBoolType*): Deleted. 45 * heap/Handle.h: 46 (JSC::HandleBase::operator!): 47 (JSC::HandleBase::operator bool): 48 (JSC::HandleBase::slot): 49 (JSC::HandleBase::operator UnspecifiedBoolType*): Deleted. 50 * heap/Strong.h: 51 (JSC::Strong::operator!): 52 (JSC::Strong::operator bool): 53 (JSC::Strong::swap): 54 (JSC::Strong::operator UnspecifiedBoolType*): Deleted. 55 * jit/JITWriteBarrier.h: 56 (JSC::JITWriteBarrierBase::operator bool): 57 (JSC::JITWriteBarrierBase::operator!): 58 (JSC::JITWriteBarrierBase::setFlagOnBarrier): 59 (JSC::JITWriteBarrierBase::operator UnspecifiedBoolType*): Deleted. 60 * runtime/JSArray.cpp: 61 (JSC::JSArray::setLengthWithArrayStorage): 62 * runtime/JSCJSValue.h: 63 * runtime/JSCJSValueInlines.h: 64 (JSC::JSValue::JSValue): 65 (JSC::JSValue::operator bool): 66 (JSC::JSValue::operator==): 67 (JSC::JSValue::operator UnspecifiedBoolType*): Deleted. 68 * runtime/JSObject.h: 69 (JSC::JSObject::hasSparseMap): 70 * runtime/PropertyDescriptor.h: 71 (JSC::PropertyDescriptor::writablePresent): 72 (JSC::PropertyDescriptor::enumerablePresent): 73 (JSC::PropertyDescriptor::configurablePresent): 74 (JSC::PropertyDescriptor::setterPresent): 75 (JSC::PropertyDescriptor::getterPresent): 76 * runtime/WriteBarrier.h: 77 (JSC::WriteBarrierBase::slot): 78 (JSC::WriteBarrierBase::operator bool): 79 (JSC::WriteBarrierBase::operator!): 80 (JSC::WriteBarrierBase<Unknown>::tagPointer): 81 (JSC::WriteBarrierBase<Unknown>::payloadPointer): 82 (JSC::WriteBarrierBase<Unknown>::operator bool): 83 (JSC::WriteBarrierBase<Unknown>::operator!): 84 (JSC::WriteBarrierBase::operator UnspecifiedBoolType*): Deleted. 85 (JSC::WriteBarrierBase<Unknown>::operator UnspecifiedBoolType*): Deleted. 86 1 87 2015-06-19 Anders Carlsson <andersca@apple.com> 2 88 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h
r175762 r185768 319 319 #endif 320 320 321 typedef void* (MacroAssemblerCodePtr::*UnspecifiedBoolType); 322 operator UnspecifiedBoolType*() const 323 { 324 return !!m_value ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; 325 } 321 explicit operator bool() const { return m_value; } 326 322 327 323 bool operator==(const MacroAssemblerCodePtr& other) const … … 443 439 } 444 440 445 typedef void* (MacroAssemblerCodeRef::*UnspecifiedBoolType); 446 operator UnspecifiedBoolType*() const 447 { 448 return !!m_codePtr ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; 449 } 441 explicit operator bool() const { return !!m_codePtr; } 450 442 451 443 void dump(PrintStream& out) const -
trunk/Source/JavaScriptCore/bytecode/CodeOrigin.cpp
r183072 r185768 75 75 return true; 76 76 77 if (a.inlineCallFrame->executable != b.inlineCallFrame->executable)77 if (a.inlineCallFrame->executable.get() != b.inlineCallFrame->executable.get()) 78 78 return false; 79 79 -
trunk/Source/JavaScriptCore/bytecode/LLIntCallLinkInfo.h
r108444 r185768 46 46 } 47 47 48 bool isLinked() { return callee; }48 bool isLinked() { return !!callee; } 49 49 50 50 void unlink() -
trunk/Source/JavaScriptCore/dfg/DFGBlockWorklist.h
r173072 r185768 66 66 } 67 67 68 typedef void* (BlockWith<T>::*UnspecifiedBoolType); 69 operator UnspecifiedBoolType*() const 70 { 71 return block ? reinterpret_cast<UnspecifiedBoolType*>(1) : nullptr; 72 } 68 explicit operator bool() const { return block; } 73 69 74 70 BasicBlock* block; … … 142 138 } 143 139 144 typedef void* (BlockWithOrder::*UnspecifiedBoolType); 145 operator UnspecifiedBoolType*() const 146 { 147 return block ? reinterpret_cast<UnspecifiedBoolType*>(1) : nullptr; 148 } 140 explicit operator bool() const { return block; } 149 141 150 142 BasicBlock* block; -
trunk/Source/JavaScriptCore/dfg/DFGIntegerRangeOptimizationPhase.cpp
r185646 r185768 115 115 typedef void* (Relationship::*UnspecifiedBoolType); 116 116 117 operator UnspecifiedBoolType*() const 118 { 119 return m_left ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; 120 } 117 explicit operator bool() const { return m_left; } 121 118 122 119 Node* left() const { return m_left; } -
trunk/Source/JavaScriptCore/dfg/DFGLazyNode.h
r184927 r185768 142 142 bool operator!() const { return !asValue() && !asNode(); } 143 143 144 typedef void* (LazyNode::*UnspecifiedBoolType); 145 146 operator UnspecifiedBoolType*() const 147 { 148 return !!*this ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; 149 } 144 explicit operator bool() const { return !!*this; } 150 145 151 146 void dump(PrintStream& out) const; -
trunk/Source/JavaScriptCore/heap/CopyWriteBarrier.h
r163576 r185768 51 51 bool operator!() const { return !m_value; } 52 52 53 typedef T* (CopyWriteBarrier::*UnspecifiedBoolType); 54 operator UnspecifiedBoolType*() const { return m_value ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; } 53 explicit operator bool() const { return m_value; } 55 54 56 55 T* get() const -
trunk/Source/JavaScriptCore/heap/Handle.h
r142966 r185768 53 53 bool operator!() const { return !m_slot || !*m_slot; } 54 54 55 // This conversion operator allows implicit conversion to bool but not to other integer types. 56 typedef JSValue (HandleBase::*UnspecifiedBoolType); 57 operator UnspecifiedBoolType*() const { return (m_slot && *m_slot) ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; } 55 explicit operator bool() const { return m_slot && *m_slot; } 58 56 59 57 HandleSlot slot() const { return m_slot; } -
trunk/Source/JavaScriptCore/heap/Strong.h
r157653 r185768 85 85 bool operator!() const { return !slot() || !*slot(); } 86 86 87 // This conversion operator allows implicit conversion to bool but not to other integer types. 88 typedef JSValue (HandleBase::*UnspecifiedBoolType); 89 operator UnspecifiedBoolType*() const { return !!*this ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; } 87 explicit operator bool() const { return !!*this; } 90 88 91 89 void swap(Strong& other) -
trunk/Source/JavaScriptCore/jit/JITWriteBarrier.h
r179478 r185768 44 44 class JITWriteBarrierBase { 45 45 public: 46 typedef void* (JITWriteBarrierBase::*UnspecifiedBoolType); 47 operator UnspecifiedBoolType*() const { return get() ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; } 46 explicit operator bool() const { return get(); } 48 47 bool operator!() const { return !get(); } 49 48 -
trunk/Source/JavaScriptCore/runtime/JSArray.cpp
r184767 r185768 377 377 for (unsigned i = newLength; i < usedVectorLength; ++i) { 378 378 WriteBarrier<Unknown>& valueSlot = storage->m_vector[i]; 379 bool hadValue = valueSlot;379 bool hadValue { valueSlot }; 380 380 valueSlot.clear(); 381 381 storage->m_numValuesInVector -= hadValue; -
trunk/Source/JavaScriptCore/runtime/JSCJSValue.h
r182057 r185768 196 196 explicit JSValue(unsigned long long); 197 197 198 typedef void* (JSValue::*UnspecifiedBoolType); 199 operator UnspecifiedBoolType*() const; 198 explicit operator bool() const; 200 199 bool operator==(const JSValue& other) const; 201 200 bool operator!=(const JSValue& other) const; -
trunk/Source/JavaScriptCore/runtime/JSCJSValueInlines.h
r184983 r185768 214 214 } 215 215 216 inline JSValue::operator UnspecifiedBoolType*() const216 inline JSValue::operator bool() const 217 217 { 218 218 ASSERT(tag() != DeletedValueTag); 219 return tag() != EmptyValueTag ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0;219 return tag() != EmptyValueTag; 220 220 } 221 221 … … 363 363 } 364 364 365 inline JSValue::operator UnspecifiedBoolType*() const366 { 367 return u.asInt64 ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0;365 inline JSValue::operator bool() const 366 { 367 return u.asInt64; 368 368 } 369 369 -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r185597 r185768 430 430 return false; 431 431 case ALL_ARRAY_STORAGE_INDEXING_TYPES: 432 return m_butterfly->arrayStorage()->m_sparseMap;432 return !!m_butterfly->arrayStorage()->m_sparseMap; 433 433 default: 434 434 RELEASE_ASSERT_NOT_REACHED(); -
trunk/Source/JavaScriptCore/runtime/PropertyDescriptor.h
r173269 r185768 78 78 bool enumerablePresent() const { return m_seenAttributes & EnumerablePresent; } 79 79 bool configurablePresent() const { return m_seenAttributes & ConfigurablePresent; } 80 bool setterPresent() const { return m_setter; }81 bool getterPresent() const { return m_getter; }80 bool setterPresent() const { return !!m_setter; } 81 bool getterPresent() const { return !!m_getter; } 82 82 bool equalTo(ExecState*, const PropertyDescriptor& other) const; 83 83 bool attributesEqual(const PropertyDescriptor& other) const; -
trunk/Source/JavaScriptCore/runtime/WriteBarrier.h
r184328 r185768 114 114 T** slot() { return reinterpret_cast<T**>(&m_cell); } 115 115 116 typedef T* (WriteBarrierBase::*UnspecifiedBoolType); 117 operator UnspecifiedBoolType*() const { return m_cell ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; } 116 explicit operator bool() const { return m_cell; } 118 117 119 118 bool operator!() const { return !m_cell; } … … 166 165 int32_t* payloadPointer() { return &bitwise_cast<EncodedValueDescriptor*>(&m_value)->asBits.payload; } 167 166 168 typedef JSValue (WriteBarrierBase::*UnspecifiedBoolType); 169 operator UnspecifiedBoolType*() const { return get() ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; } 167 explicit operator bool() const { return !!get(); } 170 168 bool operator!() const { return !get(); } 171 169
Note:
See TracChangeset
for help on using the changeset viewer.