Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (185767 => 185768)
--- trunk/Source/_javascript_Core/ChangeLog 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-06-19 21:17:54 UTC (rev 185768)
@@ -1,3 +1,89 @@
+2015-06-19 Mark Lam <[email protected]>
+
+ Employ explicit operator bool() instead of using the UnspecifiedBoolType workaround.
+ https://bugs.webkit.org/show_bug.cgi?id=146154
+
+ Reviewed by Darin Adler.
+
+ * assembler/MacroAssemblerCodeRef.h:
+ (JSC::MacroAssemblerCodePtr::dataLocation):
+ (JSC::MacroAssemblerCodePtr::operator bool):
+ (JSC::MacroAssemblerCodePtr::operator==):
+ (JSC::MacroAssemblerCodeRef::tryToDisassemble):
+ (JSC::MacroAssemblerCodeRef::operator bool):
+ (JSC::MacroAssemblerCodeRef::dump):
+ (JSC::MacroAssemblerCodePtr::operator UnspecifiedBoolType*): Deleted.
+ (JSC::MacroAssemblerCodeRef::operator UnspecifiedBoolType*): Deleted.
+
+ * bytecode/CodeOrigin.cpp:
+ (JSC::CodeOrigin::isApproximatelyEqualTo):
+ - Fixed a bug here where we were expecting to compare Executable pointers, but
+ ended up comparing a (UnspecifiedBoolType*)1 with another
+ (UnspecifiedBoolType*)1.
+
+ * bytecode/LLIntCallLinkInfo.h:
+ (JSC::LLIntCallLinkInfo::~LLIntCallLinkInfo):
+ (JSC::LLIntCallLinkInfo::isLinked):
+ (JSC::LLIntCallLinkInfo::unlink):
+ * dfg/DFGBlockWorklist.h:
+ (JSC::DFG::BlockWith::BlockWith):
+ (JSC::DFG::BlockWith::operator bool):
+ (JSC::DFG::BlockWithOrder::BlockWithOrder):
+ (JSC::DFG::BlockWithOrder::operator bool):
+ (JSC::DFG::BlockWith::operator UnspecifiedBoolType*): Deleted.
+ (JSC::DFG::BlockWithOrder::operator UnspecifiedBoolType*): Deleted.
+ * dfg/DFGIntegerRangeOptimizationPhase.cpp:
+ * dfg/DFGLazyNode.h:
+ (JSC::DFG::LazyNode::operator!):
+ (JSC::DFG::LazyNode::operator bool):
+ (JSC::DFG::LazyNode::operator UnspecifiedBoolType*): Deleted.
+ * heap/CopyWriteBarrier.h:
+ (JSC::CopyWriteBarrier::operator!):
+ (JSC::CopyWriteBarrier::operator bool):
+ (JSC::CopyWriteBarrier::get):
+ (JSC::CopyWriteBarrier::operator UnspecifiedBoolType*): Deleted.
+ * heap/Handle.h:
+ (JSC::HandleBase::operator!):
+ (JSC::HandleBase::operator bool):
+ (JSC::HandleBase::slot):
+ (JSC::HandleBase::operator UnspecifiedBoolType*): Deleted.
+ * heap/Strong.h:
+ (JSC::Strong::operator!):
+ (JSC::Strong::operator bool):
+ (JSC::Strong::swap):
+ (JSC::Strong::operator UnspecifiedBoolType*): Deleted.
+ * jit/JITWriteBarrier.h:
+ (JSC::JITWriteBarrierBase::operator bool):
+ (JSC::JITWriteBarrierBase::operator!):
+ (JSC::JITWriteBarrierBase::setFlagOnBarrier):
+ (JSC::JITWriteBarrierBase::operator UnspecifiedBoolType*): Deleted.
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::setLengthWithArrayStorage):
+ * runtime/JSCJSValue.h:
+ * runtime/JSCJSValueInlines.h:
+ (JSC::JSValue::JSValue):
+ (JSC::JSValue::operator bool):
+ (JSC::JSValue::operator==):
+ (JSC::JSValue::operator UnspecifiedBoolType*): Deleted.
+ * runtime/JSObject.h:
+ (JSC::JSObject::hasSparseMap):
+ * runtime/PropertyDescriptor.h:
+ (JSC::PropertyDescriptor::writablePresent):
+ (JSC::PropertyDescriptor::enumerablePresent):
+ (JSC::PropertyDescriptor::configurablePresent):
+ (JSC::PropertyDescriptor::setterPresent):
+ (JSC::PropertyDescriptor::getterPresent):
+ * runtime/WriteBarrier.h:
+ (JSC::WriteBarrierBase::slot):
+ (JSC::WriteBarrierBase::operator bool):
+ (JSC::WriteBarrierBase::operator!):
+ (JSC::WriteBarrierBase<Unknown>::tagPointer):
+ (JSC::WriteBarrierBase<Unknown>::payloadPointer):
+ (JSC::WriteBarrierBase<Unknown>::operator bool):
+ (JSC::WriteBarrierBase<Unknown>::operator!):
+ (JSC::WriteBarrierBase::operator UnspecifiedBoolType*): Deleted.
+ (JSC::WriteBarrierBase<Unknown>::operator UnspecifiedBoolType*): Deleted.
+
2015-06-19 Anders Carlsson <[email protected]>
Add a JSC symlink in /System/Library/PrivateFrameworks
Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.h (185767 => 185768)
--- trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.h 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.h 2015-06-19 21:17:54 UTC (rev 185768)
@@ -318,11 +318,7 @@
void* dataLocation() const { ASSERT_VALID_CODE_POINTER(m_value); return m_value; }
#endif
- typedef void* (MacroAssemblerCodePtr::*UnspecifiedBoolType);
- operator UnspecifiedBoolType*() const
- {
- return !!m_value ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0;
- }
+ explicit operator bool() const { return m_value; }
bool operator==(const MacroAssemblerCodePtr& other) const
{
@@ -442,11 +438,7 @@
return JSC::tryToDisassemble(m_codePtr, size(), prefix, WTF::dataFile());
}
- typedef void* (MacroAssemblerCodeRef::*UnspecifiedBoolType);
- operator UnspecifiedBoolType*() const
- {
- return !!m_codePtr ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0;
- }
+ explicit operator bool() const { return !!m_codePtr; }
void dump(PrintStream& out) const
{
Modified: trunk/Source/_javascript_Core/bytecode/CodeOrigin.cpp (185767 => 185768)
--- trunk/Source/_javascript_Core/bytecode/CodeOrigin.cpp 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/bytecode/CodeOrigin.cpp 2015-06-19 21:17:54 UTC (rev 185768)
@@ -74,7 +74,7 @@
if (!a.inlineCallFrame)
return true;
- if (a.inlineCallFrame->executable != b.inlineCallFrame->executable)
+ if (a.inlineCallFrame->executable.get() != b.inlineCallFrame->executable.get())
return false;
a = a.inlineCallFrame->caller;
Modified: trunk/Source/_javascript_Core/bytecode/LLIntCallLinkInfo.h (185767 => 185768)
--- trunk/Source/_javascript_Core/bytecode/LLIntCallLinkInfo.h 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/bytecode/LLIntCallLinkInfo.h 2015-06-19 21:17:54 UTC (rev 185768)
@@ -45,7 +45,7 @@
remove();
}
- bool isLinked() { return callee; }
+ bool isLinked() { return !!callee; }
void unlink()
{
Modified: trunk/Source/_javascript_Core/dfg/DFGBlockWorklist.h (185767 => 185768)
--- trunk/Source/_javascript_Core/dfg/DFGBlockWorklist.h 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/dfg/DFGBlockWorklist.h 2015-06-19 21:17:54 UTC (rev 185768)
@@ -65,11 +65,7 @@
{
}
- typedef void* (BlockWith<T>::*UnspecifiedBoolType);
- operator UnspecifiedBoolType*() const
- {
- return block ? reinterpret_cast<UnspecifiedBoolType*>(1) : nullptr;
- }
+ explicit operator bool() const { return block; }
BasicBlock* block;
T data;
@@ -141,11 +137,7 @@
{
}
- typedef void* (BlockWithOrder::*UnspecifiedBoolType);
- operator UnspecifiedBoolType*() const
- {
- return block ? reinterpret_cast<UnspecifiedBoolType*>(1) : nullptr;
- }
+ explicit operator bool() const { return block; }
BasicBlock* block;
VisitOrder order;
Modified: trunk/Source/_javascript_Core/dfg/DFGIntegerRangeOptimizationPhase.cpp (185767 => 185768)
--- trunk/Source/_javascript_Core/dfg/DFGIntegerRangeOptimizationPhase.cpp 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/dfg/DFGIntegerRangeOptimizationPhase.cpp 2015-06-19 21:17:54 UTC (rev 185768)
@@ -114,10 +114,7 @@
typedef void* (Relationship::*UnspecifiedBoolType);
- operator UnspecifiedBoolType*() const
- {
- return m_left ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0;
- }
+ explicit operator bool() const { return m_left; }
Node* left() const { return m_left; }
Node* right() const { return m_right; }
Modified: trunk/Source/_javascript_Core/dfg/DFGLazyNode.h (185767 => 185768)
--- trunk/Source/_javascript_Core/dfg/DFGLazyNode.h 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/dfg/DFGLazyNode.h 2015-06-19 21:17:54 UTC (rev 185768)
@@ -141,13 +141,8 @@
bool operator!() const { return !asValue() && !asNode(); }
- typedef void* (LazyNode::*UnspecifiedBoolType);
+ explicit operator bool() const { return !!*this; }
- operator UnspecifiedBoolType*() const
- {
- return !!*this ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0;
- }
-
void dump(PrintStream& out) const;
private:
Modified: trunk/Source/_javascript_Core/heap/CopyWriteBarrier.h (185767 => 185768)
--- trunk/Source/_javascript_Core/heap/CopyWriteBarrier.h 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/heap/CopyWriteBarrier.h 2015-06-19 21:17:54 UTC (rev 185768)
@@ -50,8 +50,7 @@
bool operator!() const { return !m_value; }
- typedef T* (CopyWriteBarrier::*UnspecifiedBoolType);
- operator UnspecifiedBoolType*() const { return m_value ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; }
+ explicit operator bool() const { return m_value; }
T* get() const
{
Modified: trunk/Source/_javascript_Core/heap/Handle.h (185767 => 185768)
--- trunk/Source/_javascript_Core/heap/Handle.h 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/heap/Handle.h 2015-06-19 21:17:54 UTC (rev 185768)
@@ -52,9 +52,7 @@
public:
bool operator!() const { return !m_slot || !*m_slot; }
- // This conversion operator allows implicit conversion to bool but not to other integer types.
- typedef JSValue (HandleBase::*UnspecifiedBoolType);
- operator UnspecifiedBoolType*() const { return (m_slot && *m_slot) ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; }
+ explicit operator bool() const { return m_slot && *m_slot; }
HandleSlot slot() const { return m_slot; }
Modified: trunk/Source/_javascript_Core/heap/Strong.h (185767 => 185768)
--- trunk/Source/_javascript_Core/heap/Strong.h 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/heap/Strong.h 2015-06-19 21:17:54 UTC (rev 185768)
@@ -84,9 +84,7 @@
bool operator!() const { return !slot() || !*slot(); }
- // This conversion operator allows implicit conversion to bool but not to other integer types.
- typedef JSValue (HandleBase::*UnspecifiedBoolType);
- operator UnspecifiedBoolType*() const { return !!*this ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; }
+ explicit operator bool() const { return !!*this; }
void swap(Strong& other)
{
Modified: trunk/Source/_javascript_Core/jit/JITWriteBarrier.h (185767 => 185768)
--- trunk/Source/_javascript_Core/jit/JITWriteBarrier.h 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/jit/JITWriteBarrier.h 2015-06-19 21:17:54 UTC (rev 185768)
@@ -43,8 +43,7 @@
#define JITWriteBarrierFlag ((void*)2)
class JITWriteBarrierBase {
public:
- typedef void* (JITWriteBarrierBase::*UnspecifiedBoolType);
- operator UnspecifiedBoolType*() const { return get() ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; }
+ explicit operator bool() const { return get(); }
bool operator!() const { return !get(); }
void setFlagOnBarrier()
Modified: trunk/Source/_javascript_Core/runtime/JSArray.cpp (185767 => 185768)
--- trunk/Source/_javascript_Core/runtime/JSArray.cpp 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/runtime/JSArray.cpp 2015-06-19 21:17:54 UTC (rev 185768)
@@ -376,7 +376,7 @@
unsigned usedVectorLength = min(length, storage->vectorLength());
for (unsigned i = newLength; i < usedVectorLength; ++i) {
WriteBarrier<Unknown>& valueSlot = storage->m_vector[i];
- bool hadValue = valueSlot;
+ bool hadValue { valueSlot };
valueSlot.clear();
storage->m_numValuesInVector -= hadValue;
}
Modified: trunk/Source/_javascript_Core/runtime/JSCJSValue.h (185767 => 185768)
--- trunk/Source/_javascript_Core/runtime/JSCJSValue.h 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/runtime/JSCJSValue.h 2015-06-19 21:17:54 UTC (rev 185768)
@@ -195,8 +195,7 @@
explicit JSValue(long long);
explicit JSValue(unsigned long long);
- typedef void* (JSValue::*UnspecifiedBoolType);
- operator UnspecifiedBoolType*() const;
+ explicit operator bool() const;
bool operator==(const JSValue& other) const;
bool operator!=(const JSValue& other) const;
Modified: trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h (185767 => 185768)
--- trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h 2015-06-19 21:17:54 UTC (rev 185768)
@@ -213,10 +213,10 @@
u.asBits.payload = reinterpret_cast<int32_t>(const_cast<JSCell*>(ptr));
}
-inline JSValue::operator UnspecifiedBoolType*() const
+inline JSValue::operator bool() const
{
ASSERT(tag() != DeletedValueTag);
- return tag() != EmptyValueTag ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0;
+ return tag() != EmptyValueTag;
}
inline bool JSValue::operator==(const JSValue& other) const
@@ -362,9 +362,9 @@
u.asInt64 = reinterpret_cast<uintptr_t>(const_cast<JSCell*>(ptr));
}
-inline JSValue::operator UnspecifiedBoolType*() const
+inline JSValue::operator bool() const
{
- return u.asInt64 ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0;
+ return u.asInt64;
}
inline bool JSValue::operator==(const JSValue& other) const
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (185767 => 185768)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2015-06-19 21:17:54 UTC (rev 185768)
@@ -429,7 +429,7 @@
case ALL_CONTIGUOUS_INDEXING_TYPES:
return false;
case ALL_ARRAY_STORAGE_INDEXING_TYPES:
- return m_butterfly->arrayStorage()->m_sparseMap;
+ return !!m_butterfly->arrayStorage()->m_sparseMap;
default:
RELEASE_ASSERT_NOT_REACHED();
return false;
Modified: trunk/Source/_javascript_Core/runtime/PropertyDescriptor.h (185767 => 185768)
--- trunk/Source/_javascript_Core/runtime/PropertyDescriptor.h 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/runtime/PropertyDescriptor.h 2015-06-19 21:17:54 UTC (rev 185768)
@@ -77,8 +77,8 @@
bool writablePresent() const { return m_seenAttributes & WritablePresent; }
bool enumerablePresent() const { return m_seenAttributes & EnumerablePresent; }
bool configurablePresent() const { return m_seenAttributes & ConfigurablePresent; }
- bool setterPresent() const { return m_setter; }
- bool getterPresent() const { return m_getter; }
+ bool setterPresent() const { return !!m_setter; }
+ bool getterPresent() const { return !!m_getter; }
bool equalTo(ExecState*, const PropertyDescriptor& other) const;
bool attributesEqual(const PropertyDescriptor& other) const;
unsigned attributesOverridingCurrent(const PropertyDescriptor& current) const;
Modified: trunk/Source/_javascript_Core/runtime/WriteBarrier.h (185767 => 185768)
--- trunk/Source/_javascript_Core/runtime/WriteBarrier.h 2015-06-19 20:47:33 UTC (rev 185767)
+++ trunk/Source/_javascript_Core/runtime/WriteBarrier.h 2015-06-19 21:17:54 UTC (rev 185768)
@@ -113,8 +113,7 @@
T** slot() { return reinterpret_cast<T**>(&m_cell); }
- typedef T* (WriteBarrierBase::*UnspecifiedBoolType);
- operator UnspecifiedBoolType*() const { return m_cell ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; }
+ explicit operator bool() const { return m_cell; }
bool operator!() const { return !m_cell; }
@@ -165,8 +164,7 @@
int32_t* tagPointer() { return &bitwise_cast<EncodedValueDescriptor*>(&m_value)->asBits.tag; }
int32_t* payloadPointer() { return &bitwise_cast<EncodedValueDescriptor*>(&m_value)->asBits.payload; }
- typedef JSValue (WriteBarrierBase::*UnspecifiedBoolType);
- operator UnspecifiedBoolType*() const { return get() ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; }
+ explicit operator bool() const { return !!get(); }
bool operator!() const { return !get(); }
private: