TriState should be an enum class and use "Indeterminate" instead of "Mixed"
authorross.kirsling@sony.com <ross.kirsling@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 May 2020 05:38:06 +0000 (05:38 +0000)
committerross.kirsling@sony.com <ross.kirsling@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 May 2020 05:38:06 +0000 (05:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=211268

Reviewed by Mark Lam.

Source/JavaScriptCore:

* b3/B3Const32Value.cpp:
(JSC::B3::Const32Value::equalConstant const):
(JSC::B3::Const32Value::notEqualConstant const):
(JSC::B3::Const32Value::lessThanConstant const):
(JSC::B3::Const32Value::greaterThanConstant const):
(JSC::B3::Const32Value::lessEqualConstant const):
(JSC::B3::Const32Value::greaterEqualConstant const):
(JSC::B3::Const32Value::aboveConstant const):
(JSC::B3::Const32Value::belowConstant const):
(JSC::B3::Const32Value::aboveEqualConstant const):
(JSC::B3::Const32Value::belowEqualConstant const):
* b3/B3Const64Value.cpp:
(JSC::B3::Const64Value::equalConstant const):
(JSC::B3::Const64Value::notEqualConstant const):
(JSC::B3::Const64Value::lessThanConstant const):
(JSC::B3::Const64Value::greaterThanConstant const):
(JSC::B3::Const64Value::lessEqualConstant const):
(JSC::B3::Const64Value::greaterEqualConstant const):
(JSC::B3::Const64Value::aboveConstant const):
(JSC::B3::Const64Value::belowConstant const):
(JSC::B3::Const64Value::aboveEqualConstant const):
(JSC::B3::Const64Value::belowEqualConstant const):
* b3/B3ConstDoubleValue.cpp:
(JSC::B3::ConstDoubleValue::equalConstant const):
(JSC::B3::ConstDoubleValue::notEqualConstant const):
(JSC::B3::ConstDoubleValue::lessThanConstant const):
(JSC::B3::ConstDoubleValue::greaterThanConstant const):
(JSC::B3::ConstDoubleValue::lessEqualConstant const):
(JSC::B3::ConstDoubleValue::greaterEqualConstant const):
(JSC::B3::ConstDoubleValue::equalOrUnorderedConstant const):
* b3/B3ConstFloatValue.cpp:
(JSC::B3::ConstFloatValue::equalConstant const):
(JSC::B3::ConstFloatValue::notEqualConstant const):
(JSC::B3::ConstFloatValue::lessThanConstant const):
(JSC::B3::ConstFloatValue::greaterThanConstant const):
(JSC::B3::ConstFloatValue::lessEqualConstant const):
(JSC::B3::ConstFloatValue::greaterEqualConstant const):
(JSC::B3::ConstFloatValue::equalOrUnorderedConstant const):
* b3/B3Procedure.cpp:
(JSC::B3::Procedure::addBoolConstant):
* b3/B3Procedure.h:
* b3/B3ReduceStrength.cpp:
* b3/B3Value.cpp:
(JSC::B3::Value::equalConstant const):
(JSC::B3::Value::notEqualConstant const):
(JSC::B3::Value::lessThanConstant const):
(JSC::B3::Value::greaterThanConstant const):
(JSC::B3::Value::lessEqualConstant const):
(JSC::B3::Value::greaterEqualConstant const):
(JSC::B3::Value::aboveConstant const):
(JSC::B3::Value::belowConstant const):
(JSC::B3::Value::aboveEqualConstant const):
(JSC::B3::Value::belowEqualConstant const):
(JSC::B3::Value::equalOrUnorderedConstant const):
(JSC::B3::Value::asTriState const):
* b3/B3Value.h:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::~CodeBlock):
(JSC::CodeBlock::thresholdForJIT):
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
* bytecode/UnlinkedFunctionExecutable.cpp:
(JSC::UnlinkedFunctionExecutable::visitChildren):
* bytecompiler/NodesCodegen.cpp:
(JSC::ConstantNode::emitBytecodeInConditionContext):
(JSC::BinaryOpNode::emitBytecodeInConditionContext):
(JSC::BinaryOpNode::tryFoldToBranch):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* dfg/DFGCFGSimplificationPhase.cpp:
(JSC::DFG::CFGSimplificationPhase::run):
* dfg/DFGLazyJSValue.cpp:
(JSC::DFG::equalToSingleCharacter):
(JSC::DFG::equalToStringImpl):
(JSC::DFG::LazyJSValue::strictEqual const):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileDataViewGet):
(JSC::FTL::DFG::LowerDFGToB3::compileDataViewSet):
* ftl/FTLOutput.cpp:
(JSC::FTL::Output::equal):
(JSC::FTL::Output::notEqual):
(JSC::FTL::Output::above):
(JSC::FTL::Output::aboveOrEqual):
(JSC::FTL::Output::below):
(JSC::FTL::Output::belowOrEqual):
(JSC::FTL::Output::greaterThan):
(JSC::FTL::Output::greaterThanOrEqual):
(JSC::FTL::Output::lessThan):
(JSC::FTL::Output::lessThanOrEqual):
* jit/JITOperations.cpp:
* runtime/CachedTypes.cpp:
(JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
* runtime/DefinePropertyAttributes.h:
(JSC::DefinePropertyAttributes::DefinePropertyAttributes):
(JSC::DefinePropertyAttributes::hasWritable const):
(JSC::DefinePropertyAttributes::writable const):
(JSC::DefinePropertyAttributes::hasConfigurable const):
(JSC::DefinePropertyAttributes::configurable const):
(JSC::DefinePropertyAttributes::hasEnumerable const):
(JSC::DefinePropertyAttributes::enumerable const):
(JSC::DefinePropertyAttributes::setWritable):
(JSC::DefinePropertyAttributes::setConfigurable):
(JSC::DefinePropertyAttributes::setEnumerable):
* runtime/IntlCollator.cpp:
(JSC::IntlCollator::initializeCollator):
* runtime/IntlDateTimeFormat.cpp:
(JSC::IntlDateTimeFormat::initializeDateTimeFormat):
* runtime/IntlNumberFormat.cpp:
(JSC::IntlNumberFormat::initializeNumberFormat):
* runtime/IntlObject.cpp:
(JSC::intlBooleanOption):
* runtime/JSCJSValueInlines.h:
(JSC::JSValue::pureStrictEqual):
(JSC::JSValue::pureToBoolean const):
* runtime/JSCellInlines.h:
(JSC::JSCell::pureToBoolean const):

Source/WebCore:

* dom/Document.cpp:
(WebCore::Document::queryCommandIndeterm):
(WebCore::Document::queryCommandState):
* editing/EditingStyle.cpp:
(WebCore::EditingStyle::triStateOfStyle const):
(WebCore::EditingStyle::hasStyle):
* editing/Editor.cpp:
(WebCore::Editor::selectionUnorderedListState const):
(WebCore::Editor::selectionOrderedListState const):
* editing/EditorCommand.cpp:
(WebCore::isStylePresent):
(WebCore::stateStyle):
(WebCore::stateTextWritingDirection):
(WebCore::stateNone):
(WebCore::stateStyleWithCSS):
(WebCore::Editor::Command::state const):
(WebCore::Editor::Command::value const):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::checkOrEnableIfNeeded const):

Source/WebKit:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::validateCommand):

* WebProcess/WebPage/glib/WebPageGLib.cpp:
(WebKit::WebPage::getPlatformEditorState const):

Source/WebKitLegacy/mac:

* WebView/WebHTMLView.mm:
(kit):
(-[WebHTMLView validateUserInterfaceItemWithoutDelegate:]):

Source/WTF:

The word "indeterminate" comes from boost::tribool.
A third state is generally not "mixed" but rather unknown.

* wtf/TriState.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@260984 268f45cc-cd09-0410-ab3c-d52691b4dbfc

42 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/b3/B3Const32Value.cpp
Source/JavaScriptCore/b3/B3Const64Value.cpp
Source/JavaScriptCore/b3/B3ConstDoubleValue.cpp
Source/JavaScriptCore/b3/B3ConstFloatValue.cpp
Source/JavaScriptCore/b3/B3Procedure.cpp
Source/JavaScriptCore/b3/B3Procedure.h
Source/JavaScriptCore/b3/B3ReduceStrength.cpp
Source/JavaScriptCore/b3/B3Value.cpp
Source/JavaScriptCore/b3/B3Value.h
Source/JavaScriptCore/bytecode/CodeBlock.cpp
Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp
Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp
Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
Source/JavaScriptCore/dfg/DFGCFGSimplificationPhase.cpp
Source/JavaScriptCore/dfg/DFGLazyJSValue.cpp
Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
Source/JavaScriptCore/ftl/FTLOutput.cpp
Source/JavaScriptCore/jit/JITOperations.cpp
Source/JavaScriptCore/runtime/CachedTypes.cpp
Source/JavaScriptCore/runtime/DefinePropertyAttributes.h
Source/JavaScriptCore/runtime/IntlCollator.cpp
Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp
Source/JavaScriptCore/runtime/IntlNumberFormat.cpp
Source/JavaScriptCore/runtime/IntlObject.cpp
Source/JavaScriptCore/runtime/JSCJSValueInlines.h
Source/JavaScriptCore/runtime/JSCellInlines.h
Source/WTF/ChangeLog
Source/WTF/wtf/TriState.h
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/editing/EditingStyle.cpp
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/EditorCommand.cpp
Source/WebCore/page/ContextMenuController.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebHTMLView.mm

index ca8d951..705fa1d 100644 (file)
@@ -1,5 +1,131 @@
 2020-04-30  Ross Kirsling  <ross.kirsling@sony.com>
 
+        TriState should be an enum class and use "Indeterminate" instead of "Mixed"
+        https://bugs.webkit.org/show_bug.cgi?id=211268
+
+        Reviewed by Mark Lam.
+
+        * b3/B3Const32Value.cpp:
+        (JSC::B3::Const32Value::equalConstant const):
+        (JSC::B3::Const32Value::notEqualConstant const):
+        (JSC::B3::Const32Value::lessThanConstant const):
+        (JSC::B3::Const32Value::greaterThanConstant const):
+        (JSC::B3::Const32Value::lessEqualConstant const):
+        (JSC::B3::Const32Value::greaterEqualConstant const):
+        (JSC::B3::Const32Value::aboveConstant const):
+        (JSC::B3::Const32Value::belowConstant const):
+        (JSC::B3::Const32Value::aboveEqualConstant const):
+        (JSC::B3::Const32Value::belowEqualConstant const):
+        * b3/B3Const64Value.cpp:
+        (JSC::B3::Const64Value::equalConstant const):
+        (JSC::B3::Const64Value::notEqualConstant const):
+        (JSC::B3::Const64Value::lessThanConstant const):
+        (JSC::B3::Const64Value::greaterThanConstant const):
+        (JSC::B3::Const64Value::lessEqualConstant const):
+        (JSC::B3::Const64Value::greaterEqualConstant const):
+        (JSC::B3::Const64Value::aboveConstant const):
+        (JSC::B3::Const64Value::belowConstant const):
+        (JSC::B3::Const64Value::aboveEqualConstant const):
+        (JSC::B3::Const64Value::belowEqualConstant const):
+        * b3/B3ConstDoubleValue.cpp:
+        (JSC::B3::ConstDoubleValue::equalConstant const):
+        (JSC::B3::ConstDoubleValue::notEqualConstant const):
+        (JSC::B3::ConstDoubleValue::lessThanConstant const):
+        (JSC::B3::ConstDoubleValue::greaterThanConstant const):
+        (JSC::B3::ConstDoubleValue::lessEqualConstant const):
+        (JSC::B3::ConstDoubleValue::greaterEqualConstant const):
+        (JSC::B3::ConstDoubleValue::equalOrUnorderedConstant const):
+        * b3/B3ConstFloatValue.cpp:
+        (JSC::B3::ConstFloatValue::equalConstant const):
+        (JSC::B3::ConstFloatValue::notEqualConstant const):
+        (JSC::B3::ConstFloatValue::lessThanConstant const):
+        (JSC::B3::ConstFloatValue::greaterThanConstant const):
+        (JSC::B3::ConstFloatValue::lessEqualConstant const):
+        (JSC::B3::ConstFloatValue::greaterEqualConstant const):
+        (JSC::B3::ConstFloatValue::equalOrUnorderedConstant const):
+        * b3/B3Procedure.cpp:
+        (JSC::B3::Procedure::addBoolConstant):
+        * b3/B3Procedure.h:
+        * b3/B3ReduceStrength.cpp:
+        * b3/B3Value.cpp:
+        (JSC::B3::Value::equalConstant const):
+        (JSC::B3::Value::notEqualConstant const):
+        (JSC::B3::Value::lessThanConstant const):
+        (JSC::B3::Value::greaterThanConstant const):
+        (JSC::B3::Value::lessEqualConstant const):
+        (JSC::B3::Value::greaterEqualConstant const):
+        (JSC::B3::Value::aboveConstant const):
+        (JSC::B3::Value::belowConstant const):
+        (JSC::B3::Value::aboveEqualConstant const):
+        (JSC::B3::Value::belowEqualConstant const):
+        (JSC::B3::Value::equalOrUnorderedConstant const):
+        (JSC::B3::Value::asTriState const):
+        * b3/B3Value.h:
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::~CodeBlock):
+        (JSC::CodeBlock::thresholdForJIT):
+        * bytecode/UnlinkedCodeBlock.cpp:
+        (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
+        * bytecode/UnlinkedFunctionExecutable.cpp:
+        (JSC::UnlinkedFunctionExecutable::visitChildren):
+        * bytecompiler/NodesCodegen.cpp:
+        (JSC::ConstantNode::emitBytecodeInConditionContext):
+        (JSC::BinaryOpNode::emitBytecodeInConditionContext):
+        (JSC::BinaryOpNode::tryFoldToBranch):
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
+        * dfg/DFGCFGSimplificationPhase.cpp:
+        (JSC::DFG::CFGSimplificationPhase::run):
+        * dfg/DFGLazyJSValue.cpp:
+        (JSC::DFG::equalToSingleCharacter):
+        (JSC::DFG::equalToStringImpl):
+        (JSC::DFG::LazyJSValue::strictEqual const):
+        * dfg/DFGSpeculativeJIT64.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+        * ftl/FTLLowerDFGToB3.cpp:
+        (JSC::FTL::DFG::LowerDFGToB3::compileDataViewGet):
+        (JSC::FTL::DFG::LowerDFGToB3::compileDataViewSet):
+        * ftl/FTLOutput.cpp:
+        (JSC::FTL::Output::equal):
+        (JSC::FTL::Output::notEqual):
+        (JSC::FTL::Output::above):
+        (JSC::FTL::Output::aboveOrEqual):
+        (JSC::FTL::Output::below):
+        (JSC::FTL::Output::belowOrEqual):
+        (JSC::FTL::Output::greaterThan):
+        (JSC::FTL::Output::greaterThanOrEqual):
+        (JSC::FTL::Output::lessThan):
+        (JSC::FTL::Output::lessThanOrEqual):
+        * jit/JITOperations.cpp:
+        * runtime/CachedTypes.cpp:
+        (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
+        * runtime/DefinePropertyAttributes.h:
+        (JSC::DefinePropertyAttributes::DefinePropertyAttributes):
+        (JSC::DefinePropertyAttributes::hasWritable const):
+        (JSC::DefinePropertyAttributes::writable const):
+        (JSC::DefinePropertyAttributes::hasConfigurable const):
+        (JSC::DefinePropertyAttributes::configurable const):
+        (JSC::DefinePropertyAttributes::hasEnumerable const):
+        (JSC::DefinePropertyAttributes::enumerable const):
+        (JSC::DefinePropertyAttributes::setWritable):
+        (JSC::DefinePropertyAttributes::setConfigurable):
+        (JSC::DefinePropertyAttributes::setEnumerable):
+        * runtime/IntlCollator.cpp:
+        (JSC::IntlCollator::initializeCollator):
+        * runtime/IntlDateTimeFormat.cpp:
+        (JSC::IntlDateTimeFormat::initializeDateTimeFormat):
+        * runtime/IntlNumberFormat.cpp:
+        (JSC::IntlNumberFormat::initializeNumberFormat):
+        * runtime/IntlObject.cpp:
+        (JSC::intlBooleanOption):
+        * runtime/JSCJSValueInlines.h:
+        (JSC::JSValue::pureStrictEqual):
+        (JSC::JSValue::pureToBoolean const):
+        * runtime/JSCellInlines.h:
+        (JSC::JSCell::pureToBoolean const):
+
+2020-04-30  Ross Kirsling  <ross.kirsling@sony.com>
+
         [JSC] intlBooleanOption should return TriState instead of taking an out param
         https://bugs.webkit.org/show_bug.cgi?id=211256
 
index 5ace364..2b3021b 100644 (file)
@@ -207,14 +207,14 @@ Value* Const32Value::iToFConstant(Procedure& proc) const
 TriState Const32Value::equalConstant(const Value* other) const
 {
     if (!other->hasInt32())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value == other->asInt32());
 }
 
 TriState Const32Value::notEqualConstant(const Value* other) const
 {
     if (!other->hasInt32())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value != other->asInt32());
 }
 
@@ -222,9 +222,9 @@ TriState Const32Value::lessThanConstant(const Value* other) const
 {
     // INT32_MAX < x is always false.
     if (static_cast<int32_t>(m_value) == std::numeric_limits<int32_t>::max())
-        return FalseTriState;
+        return TriState::False;
     if (!other->hasInt32())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value < other->asInt32());
 }
 
@@ -232,9 +232,9 @@ TriState Const32Value::greaterThanConstant(const Value* other) const
 {
     // INT32_MIN > x is always false.
     if (static_cast<int32_t>(m_value) == std::numeric_limits<int32_t>::min())
-        return FalseTriState;
+        return TriState::False;
     if (!other->hasInt32())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value > other->asInt32());
 }
 
@@ -242,9 +242,9 @@ TriState Const32Value::lessEqualConstant(const Value* other) const
 {
     // INT32_MIN <= x is always true.
     if (static_cast<int32_t>(m_value) == std::numeric_limits<int32_t>::min())
-        return TrueTriState;
+        return TriState::True;
     if (!other->hasInt32())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value <= other->asInt32());
 }
 
@@ -252,9 +252,9 @@ TriState Const32Value::greaterEqualConstant(const Value* other) const
 {
     // INT32_MAX >= x is always true.
     if (static_cast<int32_t>(m_value) == std::numeric_limits<int32_t>::max())
-        return TrueTriState;
+        return TriState::True;
     if (!other->hasInt32())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value >= other->asInt32());
 }
 
@@ -262,9 +262,9 @@ TriState Const32Value::aboveConstant(const Value* other) const
 {
     // UINT32_MIN > x is always false.
     if (static_cast<uint32_t>(m_value) == std::numeric_limits<uint32_t>::min())
-        return FalseTriState;
+        return TriState::False;
     if (!other->hasInt32())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(static_cast<uint32_t>(m_value) > static_cast<uint32_t>(other->asInt32()));
 }
 
@@ -272,9 +272,9 @@ TriState Const32Value::belowConstant(const Value* other) const
 {
     // UINT32_MAX < x is always false.
     if (static_cast<uint32_t>(m_value) == std::numeric_limits<uint32_t>::max())
-        return FalseTriState;
+        return TriState::False;
     if (!other->hasInt32())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(static_cast<uint32_t>(m_value) < static_cast<uint32_t>(other->asInt32()));
 }
 
@@ -282,9 +282,9 @@ TriState Const32Value::aboveEqualConstant(const Value* other) const
 {
     // UINT32_MAX >= x is always true.
     if (static_cast<uint32_t>(m_value) == std::numeric_limits<uint32_t>::max())
-        return TrueTriState;
+        return TriState::True;
     if (!other->hasInt32())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(static_cast<uint32_t>(m_value) >= static_cast<uint32_t>(other->asInt32()));
 }
 
@@ -292,9 +292,9 @@ TriState Const32Value::belowEqualConstant(const Value* other) const
 {
     // UINT32_MIN <= x is always true.
     if (static_cast<uint32_t>(m_value) == std::numeric_limits<uint32_t>::min())
-        return TrueTriState;
+        return TriState::True;
     if (!other->hasInt32())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(static_cast<uint32_t>(m_value) <= static_cast<uint32_t>(other->asInt32()));
 }
 
index 8d795b0..a440e7c 100644 (file)
@@ -207,14 +207,14 @@ Value* Const64Value::iToFConstant(Procedure& proc) const
 TriState Const64Value::equalConstant(const Value* other) const
 {
     if (!other->hasInt64())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value == other->asInt64());
 }
 
 TriState Const64Value::notEqualConstant(const Value* other) const
 {
     if (!other->hasInt64())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value != other->asInt64());
 }
 
@@ -222,9 +222,9 @@ TriState Const64Value::lessThanConstant(const Value* other) const
 {
     // INT64_MAX < x is always false.
     if (static_cast<int64_t>(m_value) == std::numeric_limits<int64_t>::max())
-        return FalseTriState;
+        return TriState::False;
     if (!other->hasInt64())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value < other->asInt64());
 }
 
@@ -232,9 +232,9 @@ TriState Const64Value::greaterThanConstant(const Value* other) const
 {
     // INT64_MIN > x is always false.
     if (static_cast<int64_t>(m_value) == std::numeric_limits<int64_t>::min())
-        return FalseTriState;
+        return TriState::False;
     if (!other->hasInt64())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value > other->asInt64());
 }
 
@@ -242,9 +242,9 @@ TriState Const64Value::lessEqualConstant(const Value* other) const
 {
     // INT64_MIN <= x is always true.
     if (static_cast<int64_t>(m_value) == std::numeric_limits<int64_t>::min())
-        return TrueTriState;
+        return TriState::True;
     if (!other->hasInt64())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value <= other->asInt64());
 }
 
@@ -252,9 +252,9 @@ TriState Const64Value::greaterEqualConstant(const Value* other) const
 {
     // INT64_MAX >= x is always true.
     if (static_cast<int64_t>(m_value) == std::numeric_limits<int64_t>::max())
-        return TrueTriState;
+        return TriState::True;
     if (!other->hasInt64())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value >= other->asInt64());
 }
 
@@ -262,9 +262,9 @@ TriState Const64Value::aboveConstant(const Value* other) const
 {
     // UINT64_MIN > x is always false.
     if (static_cast<uint64_t>(m_value) == std::numeric_limits<uint64_t>::min())
-        return FalseTriState;
+        return TriState::False;
     if (!other->hasInt64())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(static_cast<uint64_t>(m_value) > static_cast<uint64_t>(other->asInt64()));
 }
 
@@ -272,9 +272,9 @@ TriState Const64Value::belowConstant(const Value* other) const
 {
     // UINT64_MAX < x is always false.
     if (static_cast<uint64_t>(m_value) == std::numeric_limits<uint64_t>::max())
-        return FalseTriState;
+        return TriState::False;
     if (!other->hasInt64())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(static_cast<uint64_t>(m_value) < static_cast<uint64_t>(other->asInt64()));
 }
 
@@ -282,9 +282,9 @@ TriState Const64Value::aboveEqualConstant(const Value* other) const
 {
     // UINT64_MAX >= x is always true.
     if (static_cast<uint64_t>(m_value) == std::numeric_limits<uint64_t>::max())
-        return TrueTriState;
+        return TriState::True;
     if (!other->hasInt64())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(static_cast<uint64_t>(m_value) >= static_cast<uint64_t>(other->asInt64()));
 }
 
@@ -292,9 +292,9 @@ TriState Const64Value::belowEqualConstant(const Value* other) const
 {
     // UINT64_MIN <= x is always true.
     if (static_cast<uint64_t>(m_value) == std::numeric_limits<uint64_t>::min())
-        return TrueTriState;
+        return TriState::True;
     if (!other->hasInt64())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(static_cast<uint64_t>(m_value) <= static_cast<uint64_t>(other->asInt64()));
 }
 
index 5dd7d91..ac91002 100644 (file)
@@ -141,52 +141,52 @@ Value* ConstDoubleValue::modConstant(Procedure& proc, const Value* other) const
 TriState ConstDoubleValue::equalConstant(const Value* other) const
 {
     if (!other->hasDouble())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value == other->asDouble());
 }
 
 TriState ConstDoubleValue::notEqualConstant(const Value* other) const
 {
     if (!other->hasDouble())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value != other->asDouble());
 }
 
 TriState ConstDoubleValue::lessThanConstant(const Value* other) const
 {
     if (!other->hasDouble())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value < other->asDouble());
 }
 
 TriState ConstDoubleValue::greaterThanConstant(const Value* other) const
 {
     if (!other->hasDouble())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value > other->asDouble());
 }
 
 TriState ConstDoubleValue::lessEqualConstant(const Value* other) const
 {
     if (!other->hasDouble())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value <= other->asDouble());
 }
 
 TriState ConstDoubleValue::greaterEqualConstant(const Value* other) const
 {
     if (!other->hasDouble())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value >= other->asDouble());
 }
 
 TriState ConstDoubleValue::equalOrUnorderedConstant(const Value* other) const
 {
     if (std::isnan(m_value))
-        return TrueTriState;
+        return TriState::True;
 
     if (!other->hasDouble())
-        return MixedTriState;
+        return TriState::Indeterminate;
     double otherValue = other->asDouble();
     return triState(std::isunordered(m_value, otherValue) || m_value == otherValue);
 }
index 2270f00..38cc460 100644 (file)
@@ -133,52 +133,52 @@ Value* ConstFloatValue::divConstant(Procedure& proc, const Value* other) const
 TriState ConstFloatValue::equalConstant(const Value* other) const
 {
     if (!other->hasFloat())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value == other->asFloat());
 }
 
 TriState ConstFloatValue::notEqualConstant(const Value* other) const
 {
     if (!other->hasFloat())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value != other->asFloat());
 }
 
 TriState ConstFloatValue::lessThanConstant(const Value* other) const
 {
     if (!other->hasFloat())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value < other->asFloat());
 }
 
 TriState ConstFloatValue::greaterThanConstant(const Value* other) const
 {
     if (!other->hasFloat())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value > other->asFloat());
 }
 
 TriState ConstFloatValue::lessEqualConstant(const Value* other) const
 {
     if (!other->hasFloat())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value <= other->asFloat());
 }
 
 TriState ConstFloatValue::greaterEqualConstant(const Value* other) const
 {
     if (!other->hasFloat())
-        return MixedTriState;
+        return TriState::Indeterminate;
     return triState(m_value >= other->asFloat());
 }
 
 TriState ConstFloatValue::equalOrUnorderedConstant(const Value* other) const
 {
     if (std::isnan(m_value))
-        return TrueTriState;
+        return TriState::True;
 
     if (!other->hasFloat())
-        return MixedTriState;
+        return TriState::Indeterminate;
     float otherValue = other->asFloat();
     return triState(std::isunordered(m_value, otherValue) || m_value == otherValue);
 }
index d682a14..812ca5f 100644 (file)
@@ -164,13 +164,13 @@ Value* Procedure::addBoolConstant(Origin origin, TriState triState)
 {
     int32_t value = 0;
     switch (triState) {
-    case FalseTriState:
+    case TriState::False:
         value = 0;
         break;
-    case TrueTriState:
+    case TriState::True:
         value = 1;
         break;
-    case MixedTriState:
+    case TriState::Indeterminate:
         return nullptr;
     }
 
index 5ce0a52..8a659ba 100644 (file)
@@ -139,7 +139,7 @@ public:
     Value* addBottom(Origin, Type);
     Value* addBottom(Value*);
 
-    // Returns null for MixedTriState.
+    // Returns null for TriState::Indeterminate.
     Value* addBoolConstant(Origin, TriState);
 
     void resetValueOwners();
index 3ccf252..b0f9467 100644 (file)
@@ -1894,7 +1894,7 @@ private:
         case AboveEqual:
         case BelowEqual: {
             CanonicalizedComparison comparison = canonicalizeComparison(m_value);
-            TriState result = MixedTriState;
+            TriState result = TriState::Indeterminate;
             switch (comparison.opcode) {
             case LessThan:
                 result = comparison.operands[1]->greaterThanConstant(comparison.operands[0]);
@@ -2167,7 +2167,7 @@ private:
 
             // Turn this: Branch(0, then, else)
             // Into this: Jump(else)
-            if (triState == FalseTriState) {
+            if (triState == TriState::False) {
                 m_block->taken().block()->removePredecessor(m_block);
                 m_value->replaceWithJump(m_block, m_block->notTaken());
                 m_changedCFG = true;
@@ -2176,7 +2176,7 @@ private:
 
             // Turn this: Branch(not 0, then, else)
             // Into this: Jump(then)
-            if (triState == TrueTriState) {
+            if (triState == TriState::True) {
                 m_block->notTaken().block()->removePredecessor(m_block);
                 m_value->replaceWithJump(m_block, m_block->taken());
                 m_changedCFG = true;
index 4dd5cb8..17a22f0 100644 (file)
@@ -379,57 +379,57 @@ Value* Value::sqrtConstant(Procedure&) const
 
 TriState Value::equalConstant(const Value*) const
 {
-    return MixedTriState;
+    return TriState::Indeterminate;
 }
 
 TriState Value::notEqualConstant(const Value*) const
 {
-    return MixedTriState;
+    return TriState::Indeterminate;
 }
 
 TriState Value::lessThanConstant(const Value*) const
 {
-    return MixedTriState;
+    return TriState::Indeterminate;
 }
 
 TriState Value::greaterThanConstant(const Value*) const
 {
-    return MixedTriState;
+    return TriState::Indeterminate;
 }
 
 TriState Value::lessEqualConstant(const Value*) const
 {
-    return MixedTriState;
+    return TriState::Indeterminate;
 }
 
 TriState Value::greaterEqualConstant(const Value*) const
 {
-    return MixedTriState;
+    return TriState::Indeterminate;
 }
 
 TriState Value::aboveConstant(const Value*) const
 {
-    return MixedTriState;
+    return TriState::Indeterminate;
 }
 
 TriState Value::belowConstant(const Value*) const
 {
-    return MixedTriState;
+    return TriState::Indeterminate;
 }
 
 TriState Value::aboveEqualConstant(const Value*) const
 {
-    return MixedTriState;
+    return TriState::Indeterminate;
 }
 
 TriState Value::belowEqualConstant(const Value*) const
 {
-    return MixedTriState;
+    return TriState::Indeterminate;
 }
 
 TriState Value::equalOrUnorderedConstant(const Value*) const
 {
-    return MixedTriState;
+    return TriState::Indeterminate;
 }
 
 Value* Value::invertedCompare(Procedure& proc) const
@@ -520,7 +520,7 @@ TriState Value::asTriState() const
     case ConstFloat:
         return triState(asFloat() != 0.);
     default:
-        return MixedTriState;
+        return TriState::Indeterminate;
     }
 }
 
index 0100bb4..c7f77d9 100644 (file)
@@ -290,8 +290,8 @@ public:
     bool isRounded() const;
 
     TriState asTriState() const;
-    bool isLikeZero() const { return asTriState() == FalseTriState; }
-    bool isLikeNonZero() const { return asTriState() == TrueTriState; }
+    bool isLikeZero() const { return asTriState() == TriState::False; }
+    bool isLikeNonZero() const { return asTriState() == TriState::True; }
 
     Effects effects() const;
 
index d4acaf8..6974adb 100644 (file)
@@ -853,8 +853,8 @@ CodeBlock::~CodeBlock()
     if (UNLIKELY(vm.m_perBytecodeProfiler))
         vm.m_perBytecodeProfiler->notifyDestruction(this);
 
-    if (!vm.heap.isShuttingDown() && unlinkedCodeBlock()->didOptimize() == MixedTriState)
-        unlinkedCodeBlock()->setDidOptimize(FalseTriState);
+    if (!vm.heap.isShuttingDown() && unlinkedCodeBlock()->didOptimize() == TriState::Indeterminate)
+        unlinkedCodeBlock()->setDidOptimize(TriState::False);
 
 #if ENABLE(VERBOSE_VALUE_PROFILE)
     dumpValueProfiles();
@@ -3385,11 +3385,11 @@ Optional<BytecodeIndex> CodeBlock::bytecodeIndexFromCallSiteIndex(CallSiteIndex
 int32_t CodeBlock::thresholdForJIT(int32_t threshold)
 {
     switch (unlinkedCodeBlock()->didOptimize()) {
-    case MixedTriState:
+    case TriState::Indeterminate:
         return threshold;
-    case FalseTriState:
+    case TriState::False:
         return threshold * 4;
-    case TrueTriState:
+    case TriState::True:
         return threshold / 2;
     }
     ASSERT_NOT_REACHED();
index 54da57d..48cab42 100644 (file)
@@ -69,7 +69,7 @@ UnlinkedCodeBlock::UnlinkedCodeBlock(VM& vm, Structure* structure, CodeType code
     , m_derivedContextType(static_cast<unsigned>(info.derivedContextType()))
     , m_evalContextType(static_cast<unsigned>(info.evalContextType()))
     , m_codeType(static_cast<unsigned>(codeType))
-    , m_didOptimize(static_cast<unsigned>(MixedTriState))
+    , m_didOptimize(static_cast<unsigned>(TriState::Indeterminate))
     , m_age(0)
     , m_hasCheckpoints(false)
     , m_parseMode(info.parseMode())
@@ -78,7 +78,7 @@ UnlinkedCodeBlock::UnlinkedCodeBlock(VM& vm, Structure* structure, CodeType code
 {
     ASSERT(m_constructorKind == static_cast<unsigned>(info.constructorKind()));
     ASSERT(m_codeType == static_cast<unsigned>(codeType));
-    ASSERT(m_didOptimize == static_cast<unsigned>(MixedTriState));
+    ASSERT(m_didOptimize == static_cast<unsigned>(TriState::Indeterminate));
     if (info.needsClassFieldInitializer() == NeedsClassFieldInitializer::Yes) {
         createRareDataIfNecessary(holdLock(cellLock()));
         m_rareData->m_needsClassFieldInitializer = static_cast<unsigned>(NeedsClassFieldInitializer::Yes);
index 0bf3028..5b98a54 100644 (file)
@@ -152,7 +152,7 @@ void UnlinkedFunctionExecutable::visitChildren(JSCell* cell, SlotVisitor& visito
         auto markIfProfitable = [&] (WriteBarrier<UnlinkedFunctionCodeBlock>& unlinkedCodeBlock) {
             if (!unlinkedCodeBlock)
                 return;
-            if (unlinkedCodeBlock->didOptimize() == TrueTriState)
+            if (unlinkedCodeBlock->didOptimize() == TriState::True)
                 visitor.append(unlinkedCodeBlock);
             else if (unlinkedCodeBlock->age() < UnlinkedCodeBlock::maxAge)
                 visitor.append(unlinkedCodeBlock);
index 13d4ba7..312492a 100644 (file)
@@ -103,15 +103,15 @@ void ConstantNode::emitBytecodeInConditionContext(BytecodeGenerator& generator,
     TriState value = jsValue(generator).pureToBoolean();
 
     if (UNLIKELY(needsDebugHook())) {
-        if (value != MixedTriState)
+        if (value != TriState::Indeterminate)
             generator.emitDebugHook(this);
     }
 
-    if (value == MixedTriState)
+    if (value == TriState::Indeterminate)
         ExpressionNode::emitBytecodeInConditionContext(generator, trueTarget, falseTarget, fallThroughMode);
-    else if (value == TrueTriState && fallThroughMode == FallThroughMeansFalse)
+    else if (value == TriState::True && fallThroughMode == FallThroughMeansFalse)
         generator.emitJump(trueTarget);
-    else if (value == FalseTriState && fallThroughMode == FallThroughMeansTrue)
+    else if (value == TriState::False && fallThroughMode == FallThroughMeansTrue)
         generator.emitJump(falseTarget);
 
     // All other cases are unconditional fall-throughs, like "if (true)".
@@ -2476,13 +2476,13 @@ void BinaryOpNode::emitBytecodeInConditionContext(BytecodeGenerator& generator,
     tryFoldToBranch(generator, branchCondition, branchExpression);
 
     if (UNLIKELY(needsDebugHook())) {
-        if (branchCondition != MixedTriState)
+        if (branchCondition != TriState::Indeterminate)
             generator.emitDebugHook(this);
     }
 
-    if (branchCondition == MixedTriState)
+    if (branchCondition == TriState::Indeterminate)
         ExpressionNode::emitBytecodeInConditionContext(generator, trueTarget, falseTarget, fallThroughMode);
-    else if (branchCondition == TrueTriState)
+    else if (branchCondition == TriState::True)
         generator.emitNodeInConditionContext(branchExpression, trueTarget, falseTarget, fallThroughMode);
     else
         generator.emitNodeInConditionContext(branchExpression, falseTarget, trueTarget, invert(fallThroughMode));
@@ -2504,7 +2504,7 @@ static inline bool canFoldToBranch(OpcodeID opcodeID, ExpressionNode* branchExpr
 
 void BinaryOpNode::tryFoldToBranch(BytecodeGenerator& generator, TriState& branchCondition, ExpressionNode*& branchExpression)
 {
-    branchCondition = MixedTriState;
+    branchCondition = TriState::Indeterminate;
     branchExpression = 0;
 
     ConstantNode* constant = 0;
@@ -2527,9 +2527,9 @@ void BinaryOpNode::tryFoldToBranch(BytecodeGenerator& generator, TriState& branc
         return;
 
     if (opcodeID == op_eq || opcodeID == op_stricteq)
-        branchCondition = triState(value.pureToBoolean());
+        branchCondition = triState(value.pureToBoolean() != TriState::False);
     else if (opcodeID == op_neq || opcodeID == op_nstricteq)
-        branchCondition = triState(!value.pureToBoolean());
+        branchCondition = triState(value.pureToBoolean() == TriState::False);
 }
 
 RegisterID* BinaryOpNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
index 1a3ee35..90e1330 100644 (file)
@@ -3487,22 +3487,22 @@ bool ByteCodeParser::handleIntrinsicCall(Node* callee, Operand result, Intrinsic
                 RELEASE_ASSERT_NOT_REACHED();
             }
 
-            TriState isLittleEndian = MixedTriState;
+            TriState isLittleEndian = TriState::Indeterminate;
             Node* littleEndianChild = nullptr;
             if (byteSize > 1) {
                 if (argumentCountIncludingThis < 3)
-                    isLittleEndian = FalseTriState;
+                    isLittleEndian = TriState::False;
                 else {
                     littleEndianChild = get(virtualRegisterForArgumentIncludingThis(2, registerOffset));
                     if (littleEndianChild->hasConstant()) {
                         JSValue constant = littleEndianChild->constant()->value();
                         if (constant) {
                             isLittleEndian = constant.pureToBoolean();
-                            if (isLittleEndian != MixedTriState)
+                            if (isLittleEndian != TriState::Indeterminate)
                                 littleEndianChild = nullptr;
                         }
                     } else
-                        isLittleEndian = MixedTriState;
+                        isLittleEndian = TriState::Indeterminate;
                 }
             }
 
@@ -3572,22 +3572,22 @@ bool ByteCodeParser::handleIntrinsicCall(Node* callee, Operand result, Intrinsic
                 RELEASE_ASSERT_NOT_REACHED();
             }
 
-            TriState isLittleEndian = MixedTriState;
+            TriState isLittleEndian = TriState::Indeterminate;
             Node* littleEndianChild = nullptr;
             if (byteSize > 1) {
                 if (argumentCountIncludingThis < 4)
-                    isLittleEndian = FalseTriState;
+                    isLittleEndian = TriState::False;
                 else {
                     littleEndianChild = get(virtualRegisterForArgumentIncludingThis(3, registerOffset));
                     if (littleEndianChild->hasConstant()) {
                         JSValue constant = littleEndianChild->constant()->value();
                         if (constant) {
                             isLittleEndian = constant.pureToBoolean();
-                            if (isLittleEndian != MixedTriState)
+                            if (isLittleEndian != TriState::Indeterminate)
                                 littleEndianChild = nullptr;
                         }
                     } else
-                        isLittleEndian = MixedTriState;
+                        isLittleEndian = TriState::Indeterminate;
                 }
             }
 
index 610d7d2..45790bf 100644 (file)
@@ -170,17 +170,17 @@ public:
                     Node* terminal = block->terminal();
                     if (terminal->child1()->hasConstant()) {
                         FrozenValue* value = terminal->child1()->constant();
-                        TriState found = FalseTriState;
+                        TriState found = TriState::False;
                         BasicBlock* targetBlock = 0;
-                        for (unsigned i = data->cases.size(); found == FalseTriState && i--;) {
+                        for (unsigned i = data->cases.size(); found == TriState::False && i--;) {
                             found = data->cases[i].value.strictEqual(value);
-                            if (found == TrueTriState)
+                            if (found == TriState::True)
                                 targetBlock = data->cases[i].target.block;
                         }
                         
-                        if (found == MixedTriState)
+                        if (found == TriState::Indeterminate)
                             break;
-                        if (found == FalseTriState)
+                        if (found == TriState::False)
                             targetBlock = data->fallThrough.block;
                         ASSERT(targetBlock);
                         
index 4ed7584..01f42f8 100644 (file)
@@ -62,15 +62,15 @@ JSValue LazyJSValue::getValue(VM& vm) const
 static TriState equalToSingleCharacter(JSValue value, UChar character)
 {
     if (!value.isString())
-        return FalseTriState;
+        return TriState::False;
     
     JSString* jsString = asString(value);
     if (jsString->length() != 1)
-        return FalseTriState;
+        return TriState::False;
     
     const StringImpl* string = jsString->tryGetValueImpl();
     if (!string)
-        return MixedTriState;
+        return TriState::Indeterminate;
     
     return triState(string->at(0) == character);
 }
@@ -78,12 +78,12 @@ static TriState equalToSingleCharacter(JSValue value, UChar character)
 static TriState equalToStringImpl(JSValue value, StringImpl* stringImpl)
 {
     if (!value.isString())
-        return FalseTriState;
+        return TriState::False;
     
     JSString* jsString = asString(value);
     const StringImpl* string = jsString->tryGetValueImpl();
     if (!string)
-        return MixedTriState;
+        return TriState::Indeterminate;
     
     return triState(WTF::equal(stringImpl, string));
 }
@@ -142,18 +142,18 @@ TriState LazyJSValue::strictEqual(const LazyJSValue& other) const
         switch (other.m_kind) {
         case KnownValue: {
             if (!value()->value() || !other.value()->value())
-                return value()->value() == other.value()->value() ? TrueTriState : FalseTriState;
+                return value()->value() == other.value()->value() ? TriState::True : TriState::False;
             return JSValue::pureStrictEqual(value()->value(), other.value()->value());
         }
         case SingleCharacterString: {
             if (!value()->value())
-                return FalseTriState;
+                return TriState::False;
             return equalToSingleCharacter(value()->value(), other.character());
         }
         case KnownStringImpl:
         case NewStringImpl: {
             if (!value()->value())
-                return FalseTriState;
+                return TriState::False;
             return equalToStringImpl(value()->value(), other.stringImpl());
         }
         }
@@ -165,7 +165,7 @@ TriState LazyJSValue::strictEqual(const LazyJSValue& other) const
         case KnownStringImpl:
         case NewStringImpl:
             if (other.stringImpl()->length() != 1)
-                return FalseTriState;
+                return TriState::False;
             return triState(other.stringImpl()->at(0) == character());
         case KnownValue:
             return other.strictEqual(*this);
@@ -184,7 +184,7 @@ TriState LazyJSValue::strictEqual(const LazyJSValue& other) const
         break;
     }
     RELEASE_ASSERT_NOT_REACHED();
-    return FalseTriState;
+    return TriState::False;
 }
 
 uintptr_t LazyJSValue::switchLookupValue(SwitchKind kind) const
index 97af2e2..efbdc90 100644 (file)
@@ -5118,9 +5118,9 @@ void SpeculativeJIT::compile(Node* node)
                         m_jit.signExtend16To32(t2, t2);
                 };
 
-                if (data.isLittleEndian == FalseTriState)
+                if (data.isLittleEndian == TriState::False)
                     emitBigEndianLoad();
-                else if (data.isLittleEndian == TrueTriState)
+                else if (data.isLittleEndian == TriState::True)
                     emitLittleEndianLoad();
                 else {
                     RELEASE_ASSERT(isLittleEndianGPR != InvalidGPRReg);
@@ -5137,9 +5137,9 @@ void SpeculativeJIT::compile(Node* node)
             case 4: {
                 m_jit.load32(baseIndex, t2);
 
-                if (data.isLittleEndian == FalseTriState)
+                if (data.isLittleEndian == TriState::False)
                     m_jit.byteSwap32(t2);
-                else if (data.isLittleEndian == MixedTriState) {
+                else if (data.isLittleEndian == TriState::Indeterminate) {
                     RELEASE_ASSERT(isLittleEndianGPR != InvalidGPRReg);
                     auto isLittleEndian = m_jit.branchTest32(MacroAssembler::NonZero, isLittleEndianGPR, TrustedImm32(1));
                     m_jit.byteSwap32(t2);
@@ -5173,9 +5173,9 @@ void SpeculativeJIT::compile(Node* node)
                     m_jit.convertFloatToDouble(resultFPR, resultFPR);
                 };
 
-                if (data.isLittleEndian == TrueTriState)
+                if (data.isLittleEndian == TriState::True)
                     emitLittleEndianCode();
-                else if (data.isLittleEndian == FalseTriState)
+                else if (data.isLittleEndian == TriState::False)
                     emitBigEndianCode();
                 else {
                     RELEASE_ASSERT(isLittleEndianGPR != InvalidGPRReg);
@@ -5200,9 +5200,9 @@ void SpeculativeJIT::compile(Node* node)
                     m_jit.move64ToDouble(t2, resultFPR);
                 };
 
-                if (data.isLittleEndian == TrueTriState)
+                if (data.isLittleEndian == TriState::True)
                     emitLittleEndianCode();
-                else if (data.isLittleEndian == FalseTriState)
+                else if (data.isLittleEndian == TriState::False)
                     emitBigEndianCode();
                 else {
                     RELEASE_ASSERT(isLittleEndianGPR != InvalidGPRReg);
@@ -5312,9 +5312,9 @@ void SpeculativeJIT::compile(Node* node)
                     m_jit.store32(t3, baseIndex);
                 };
 
-                if (data.isLittleEndian == FalseTriState)
+                if (data.isLittleEndian == TriState::False)
                     emitBigEndianCode();
-                else if (data.isLittleEndian == TrueTriState)
+                else if (data.isLittleEndian == TriState::True)
                     emitLittleEndianCode();
                 else {
                     RELEASE_ASSERT(isLittleEndianGPR != InvalidGPRReg);
@@ -5338,9 +5338,9 @@ void SpeculativeJIT::compile(Node* node)
                     m_jit.store64(t3, baseIndex);
                 };
 
-                if (data.isLittleEndian == FalseTriState)
+                if (data.isLittleEndian == TriState::False)
                     emitBigEndianCode();
-                else if (data.isLittleEndian == TrueTriState)
+                else if (data.isLittleEndian == TriState::True)
                     emitLittleEndianCode();
                 else {
                     RELEASE_ASSERT(isLittleEndianGPR != InvalidGPRReg);
@@ -5372,9 +5372,9 @@ void SpeculativeJIT::compile(Node* node)
                     m_jit.store16(t3, baseIndex);
                 };
 
-                if (data.isLittleEndian == FalseTriState)
+                if (data.isLittleEndian == TriState::False)
                     emitBigEndianCode();
-                else if (data.isLittleEndian == TrueTriState)
+                else if (data.isLittleEndian == TriState::True)
                     emitLittleEndianCode();
                 else {
                     RELEASE_ASSERT(isLittleEndianGPR != InvalidGPRReg);
@@ -5400,9 +5400,9 @@ void SpeculativeJIT::compile(Node* node)
                     m_jit.store32(t3, baseIndex);
                 };
 
-                if (data.isLittleEndian == FalseTriState)
+                if (data.isLittleEndian == TriState::False)
                     emitBigEndianCode();
-                else if (data.isLittleEndian == TrueTriState)
+                else if (data.isLittleEndian == TriState::True)
                     emitLittleEndianCode();
                 else {
                     RELEASE_ASSERT(isLittleEndianGPR != InvalidGPRReg);
index a1a16fb..38123ae 100644 (file)
@@ -14190,9 +14190,9 @@ private:
                     return patchpoint;
                 };
 
-                if (data.isLittleEndian == FalseTriState)
+                if (data.isLittleEndian == TriState::False)
                     setInt32(emitBigEndianLoad());
-                else if (data.isLittleEndian == TrueTriState)
+                else if (data.isLittleEndian == TriState::True)
                     setInt32(emitLittleEndianLoad());
                 else
                     setInt32(emitCodeBasedOnEndiannessBranch(isLittleEndian, emitLittleEndianLoad, emitBigEndianLoad));
@@ -14202,9 +14202,9 @@ private:
             case 4: {
                 LValue loadedValue = m_out.load32(pointer);
 
-                if (data.isLittleEndian == FalseTriState)
+                if (data.isLittleEndian == TriState::False)
                     loadedValue = byteSwap32(loadedValue);
-                else if (data.isLittleEndian == MixedTriState) {
+                else if (data.isLittleEndian == TriState::Indeterminate) {
                     auto emitLittleEndianCode = [&] {
                         return loadedValue;
                     };
@@ -14247,9 +14247,9 @@ private:
                     return patchpoint;
                 };
 
-                if (data.isLittleEndian == TrueTriState)
+                if (data.isLittleEndian == TriState::True)
                     setDouble(emitLittleEndianCode());
-                else if (data.isLittleEndian == FalseTriState)
+                else if (data.isLittleEndian == TriState::False)
                     setDouble(emitBigEndianCode());
                 else
                     setDouble(emitCodeBasedOnEndiannessBranch(isLittleEndian, emitLittleEndianCode, emitBigEndianCode));
@@ -14267,9 +14267,9 @@ private:
                     return m_out.bitCast(loadedValue, Double);
                 };
 
-                if (data.isLittleEndian == TrueTriState)
+                if (data.isLittleEndian == TriState::True)
                     setDouble(emitLittleEndianCode());
-                else if (data.isLittleEndian == FalseTriState)
+                else if (data.isLittleEndian == TriState::False)
                     setDouble(emitBigEndianCode());
                 else
                     setDouble(emitCodeBasedOnEndiannessBranch(isLittleEndian, emitLittleEndianCode, emitBigEndianCode));
@@ -14338,9 +14338,9 @@ private:
                     return nullptr;
                 };
 
-                if (data.isLittleEndian == FalseTriState)
+                if (data.isLittleEndian == TriState::False)
                     emitBigEndianCode();
-                else if (data.isLittleEndian == TrueTriState)
+                else if (data.isLittleEndian == TriState::True)
                     emitLittleEndianCode();
                 else
                     emitCodeBasedOnEndiannessBranch(isLittleEndian, emitLittleEndianCode, emitBigEndianCode);
@@ -14356,9 +14356,9 @@ private:
                     return nullptr;
                 };
 
-                if (data.isLittleEndian == FalseTriState)
+                if (data.isLittleEndian == TriState::False)
                     emitBigEndianCode();
-                else if (data.isLittleEndian == TrueTriState)
+                else if (data.isLittleEndian == TriState::True)
                     emitLittleEndianCode();
                 else
                     emitCodeBasedOnEndiannessBranch(isLittleEndian, emitLittleEndianCode, emitBigEndianCode);
@@ -14389,9 +14389,9 @@ private:
                     return nullptr;
                 };
 
-                if (data.isLittleEndian == FalseTriState)
+                if (data.isLittleEndian == TriState::False)
                     emitBigEndianCode();
-                else if (data.isLittleEndian == TrueTriState)
+                else if (data.isLittleEndian == TriState::True)
                     emitLittleEndianCode();
                 else
                     emitCodeBasedOnEndiannessBranch(isLittleEndian, emitLittleEndianCode, emitBigEndianCode);
@@ -14412,9 +14412,9 @@ private:
                     return nullptr;
                 };
 
-                if (data.isLittleEndian == FalseTriState)
+                if (data.isLittleEndian == TriState::False)
                     emitBigEndianCode();
-                else if (data.isLittleEndian == TrueTriState)
+                else if (data.isLittleEndian == TriState::True)
                     emitLittleEndianCode();
                 else
                     emitCodeBasedOnEndiannessBranch(isLittleEndian, emitLittleEndianCode, emitBigEndianCode);
index d57fb1e..6c609b4 100644 (file)
@@ -498,80 +498,80 @@ LValue Output::baseIndex(LValue base, LValue index, Scale scale, ptrdiff_t offse
 LValue Output::equal(LValue left, LValue right)
 {
     TriState result = left->equalConstant(right);
-    if (result != MixedTriState)
-        return constBool(result == TrueTriState);
+    if (result != TriState::Indeterminate)
+        return constBool(result == TriState::True);
     return m_block->appendNew<B3::Value>(m_proc, B3::Equal, origin(), left, right);
 }
 
 LValue Output::notEqual(LValue left, LValue right)
 {
     TriState result = left->notEqualConstant(right);
-    if (result != MixedTriState)
-        return constBool(result == TrueTriState);
+    if (result != TriState::Indeterminate)
+        return constBool(result == TriState::True);
     return m_block->appendNew<B3::Value>(m_proc, B3::NotEqual, origin(), left, right);
 }
 
 LValue Output::above(LValue left, LValue right)
 {
     TriState result = left->aboveConstant(right);
-    if (result != MixedTriState)
-        return constBool(result == TrueTriState);
+    if (result != TriState::Indeterminate)
+        return constBool(result == TriState::True);
     return m_block->appendNew<B3::Value>(m_proc, B3::Above, origin(), left, right);
 }
 
 LValue Output::aboveOrEqual(LValue left, LValue right)
 {
     TriState result = left->aboveEqualConstant(right);
-    if (result != MixedTriState)
-        return constBool(result == TrueTriState);
+    if (result != TriState::Indeterminate)
+        return constBool(result == TriState::True);
     return m_block->appendNew<B3::Value>(m_proc, B3::AboveEqual, origin(), left, right);
 }
 
 LValue Output::below(LValue left, LValue right)
 {
     TriState result = left->belowConstant(right);
-    if (result != MixedTriState)
-        return constBool(result == TrueTriState);
+    if (result != TriState::Indeterminate)
+        return constBool(result == TriState::True);
     return m_block->appendNew<B3::Value>(m_proc, B3::Below, origin(), left, right);
 }
 
 LValue Output::belowOrEqual(LValue left, LValue right)
 {
     TriState result = left->belowEqualConstant(right);
-    if (result != MixedTriState)
-        return constBool(result == TrueTriState);
+    if (result != TriState::Indeterminate)
+        return constBool(result == TriState::True);
     return m_block->appendNew<B3::Value>(m_proc, B3::BelowEqual, origin(), left, right);
 }
 
 LValue Output::greaterThan(LValue left, LValue right)
 {
     TriState result = left->greaterThanConstant(right);
-    if (result != MixedTriState)
-        return constBool(result == TrueTriState);
+    if (result != TriState::Indeterminate)
+        return constBool(result == TriState::True);
     return m_block->appendNew<B3::Value>(m_proc, B3::GreaterThan, origin(), left, right);
 }
 
 LValue Output::greaterThanOrEqual(LValue left, LValue right)
 {
     TriState result = left->greaterEqualConstant(right);
-    if (result != MixedTriState)
-        return constBool(result == TrueTriState);
+    if (result != TriState::Indeterminate)
+        return constBool(result == TriState::True);
     return m_block->appendNew<B3::Value>(m_proc, B3::GreaterEqual, origin(), left, right);
 }
 
 LValue Output::lessThan(LValue left, LValue right)
 {
     TriState result = left->lessThanConstant(right);
-    if (result != MixedTriState)
-        return constBool(result == TrueTriState);
+    if (result != TriState::Indeterminate)
+        return constBool(result == TriState::True);
     return m_block->appendNew<B3::Value>(m_proc, B3::LessThan, origin(), left, right);
 }
 
 LValue Output::lessThanOrEqual(LValue left, LValue right)
 {
     TriState result = left->lessEqualConstant(right);
-    if (result != MixedTriState)
-        return constBool(result == TrueTriState);
+    if (result != TriState::Indeterminate)
+        return constBool(result == TriState::True);
     return m_block->appendNew<B3::Value>(m_proc, B3::LessEqual, origin(), left, right);
 }
 
index 2e17254..0068a7d 100644 (file)
@@ -1717,7 +1717,7 @@ SlowPathReturnType JIT_OPERATION operationOptimize(VM* vmPointer, uint32_t bytec
         dataLogLnIf(Options::verboseOSR(), "Performing OSR ", codeBlock, " -> ", optimizedCodeBlock);
 
         codeBlock->optimizeSoon();
-        codeBlock->unlinkedCodeBlock()->setDidOptimize(TrueTriState);
+        codeBlock->unlinkedCodeBlock()->setDidOptimize(TriState::True);
         void* targetPC = vm.getCTIStub(DFG::osrEntryThunkGenerator).code().executableAddress();
         targetPC = retagCodePtr(targetPC, JITThunkPtrTag, bitwise_cast<PtrTag>(callFrame));
         return encodeResult(targetPC, dataBuffer);
index d11571f..1f9f94a 100644 (file)
@@ -2060,7 +2060,7 @@ ALWAYS_INLINE UnlinkedCodeBlock::UnlinkedCodeBlock(Decoder& decoder, Structure*
     , m_evalContextType(cachedCodeBlock.evalContextType())
     , m_codeType(cachedCodeBlock.codeType())
 
-    , m_didOptimize(static_cast<unsigned>(MixedTriState))
+    , m_didOptimize(static_cast<unsigned>(TriState::Indeterminate))
     , m_age(0)
     , m_hasCheckpoints(cachedCodeBlock.hasCheckpoints())
 
index 3502aa2..c0bc73e 100644 (file)
@@ -32,9 +32,9 @@ namespace JSC {
 
 class DefinePropertyAttributes {
 public:
-    static_assert(FalseTriState == 0, "FalseTriState is 0.");
-    static_assert(TrueTriState == 1, "TrueTriState is 1.");
-    static_assert(MixedTriState == 2, "MixedTriState is 2.");
+    static_assert(!static_cast<uint8_t>(TriState::False), "TriState::False is 0.");
+    static_assert(static_cast<uint8_t>(TriState::True) == 1, "TriState::True is 1.");
+    static_assert(static_cast<uint8_t>(TriState::Indeterminate) == 2, "TriState::Indeterminate is 2.");
 
     static constexpr unsigned ConfigurableShift = 0;
     static constexpr unsigned EnumerableShift = 2;
@@ -45,12 +45,12 @@ public:
 
     DefinePropertyAttributes()
         : m_attributes(
-            (MixedTriState << ConfigurableShift)
-            | (MixedTriState << EnumerableShift)
-            | (MixedTriState << WritableShift)
-            | (0 << ValueShift)
-            | (0 << GetShift)
-            | (0 << SetShift))
+            (static_cast<uint8_t>(TriState::Indeterminate) << ConfigurableShift)
+            | (static_cast<uint8_t>(TriState::Indeterminate) << EnumerableShift)
+            | (static_cast<uint8_t>(TriState::Indeterminate) << WritableShift)
+            | (static_cast<uint8_t>(TriState::False) << ValueShift)
+            | (static_cast<uint8_t>(TriState::False) << GetShift)
+            | (static_cast<uint8_t>(TriState::False) << SetShift))
     {
     }
 
@@ -96,60 +96,60 @@ public:
 
     bool hasWritable() const
     {
-        return extractTriState(WritableShift) != MixedTriState;
+        return extractTriState(WritableShift) != TriState::Indeterminate;
     }
 
     Optional<bool> writable() const
     {
         if (!hasWritable())
             return WTF::nullopt;
-        return extractTriState(WritableShift) == TrueTriState;
+        return extractTriState(WritableShift) == TriState::True;
     }
 
     bool hasConfigurable() const
     {
-        return extractTriState(ConfigurableShift) != MixedTriState;
+        return extractTriState(ConfigurableShift) != TriState::Indeterminate;
     }
 
     Optional<bool> configurable() const
     {
         if (!hasConfigurable())
             return WTF::nullopt;
-        return extractTriState(ConfigurableShift) == TrueTriState;
+        return extractTriState(ConfigurableShift) == TriState::True;
     }
 
     bool hasEnumerable() const
     {
-        return extractTriState(EnumerableShift) != MixedTriState;
+        return extractTriState(EnumerableShift) != TriState::Indeterminate;
     }
 
     Optional<bool> enumerable() const
     {
         if (!hasEnumerable())
             return WTF::nullopt;
-        return extractTriState(EnumerableShift) == TrueTriState;
+        return extractTriState(EnumerableShift) == TriState::True;
     }
 
     void setWritable(bool value)
     {
-        fillWithTriState(value ? TrueTriState : FalseTriState, WritableShift);
+        fillWithTriState(value ? TriState::True : TriState::False, WritableShift);
     }
 
     void setConfigurable(bool value)
     {
-        fillWithTriState(value ? TrueTriState : FalseTriState, ConfigurableShift);
+        fillWithTriState(value ? TriState::True : TriState::False, ConfigurableShift);
     }
 
     void setEnumerable(bool value)
     {
-        fillWithTriState(value ? TrueTriState : FalseTriState, EnumerableShift);
+        fillWithTriState(value ? TriState::True : TriState::False, EnumerableShift);
     }
 
 private:
     void fillWithTriState(TriState state, unsigned shift)
     {
         unsigned mask = 0b11 << shift;
-        m_attributes = (m_attributes & ~mask) | (state << shift);
+        m_attributes = (m_attributes & ~mask) | (static_cast<uint8_t>(state) << shift);
     }
 
     TriState extractTriState(unsigned shift) const
index a1107de..8de003c 100644 (file)
@@ -201,8 +201,8 @@ void IntlCollator::initializeCollator(JSGlobalObject* globalObject, JSValue loca
 
     TriState numeric = intlBooleanOption(globalObject, options, vm.propertyNames->numeric);
     RETURN_IF_EXCEPTION(scope, void());
-    if (numeric != MixedTriState)
-        opt.add("kn"_s, numeric == TrueTriState ? "true"_s : "false"_s);
+    if (numeric != TriState::Indeterminate)
+        opt.add("kn"_s, numeric == TriState::True ? "true"_s : "false"_s);
 
     String caseFirstOption = intlStringOption(globalObject, options, vm.propertyNames->caseFirst, { "upper", "lower", "false" }, "caseFirst must be either \"upper\", \"lower\", or \"false\"", nullptr);
     RETURN_IF_EXCEPTION(scope, void());
@@ -243,7 +243,7 @@ void IntlCollator::initializeCollator(JSGlobalObject* globalObject, JSValue loca
 
     TriState ignorePunctuation = intlBooleanOption(globalObject, options, vm.propertyNames->ignorePunctuation);
     RETURN_IF_EXCEPTION(scope, void());
-    m_ignorePunctuation = (ignorePunctuation == TrueTriState);
+    m_ignorePunctuation = (ignorePunctuation == TriState::True);
 
     UErrorCode status = U_ZERO_ERROR;
     m_collator = std::unique_ptr<UCollator, UCollatorDeleter>(ucol_open(m_locale.utf8().data(), &status));
index 02358c8..7662fa6 100644 (file)
@@ -468,7 +468,7 @@ void IntlDateTimeFormat::initializeDateTimeFormat(JSGlobalObject* globalObject,
 
     TriState hour12 = intlBooleanOption(globalObject, options, vm.propertyNames->hour12);
     RETURN_IF_EXCEPTION(scope, void());
-    bool isHour12Undefined = (hour12 == MixedTriState);
+    bool isHour12Undefined = (hour12 == TriState::Indeterminate);
 
     String hourCycle = intlStringOption(globalObject, options, vm.propertyNames->hourCycle, { "h11", "h12", "h23", "h24" }, "hourCycle must be \"h11\", \"h12\", \"h23\", or \"h24\"", nullptr);
     RETURN_IF_EXCEPTION(scope, void());
@@ -582,14 +582,14 @@ void IntlDateTimeFormat::initializeDateTimeFormat(JSGlobalObject* globalObject,
     if (hour == "2-digit") {
         if (isHour12Undefined && m_hourCycle.isNull())
             skeletonBuilder.appendLiteral("jj");
-        else if (hour12 == TrueTriState)
+        else if (hour12 == TriState::True)
             skeletonBuilder.appendLiteral("hh");
         else
             skeletonBuilder.appendLiteral("HH");
     } else if (hour == "numeric") {
         if (isHour12Undefined && m_hourCycle.isNull())
             skeletonBuilder.append('j');
-        else if (hour12 == TrueTriState)
+        else if (hour12 == TriState::True)
             skeletonBuilder.append('h');
         else
             skeletonBuilder.append('H');
index a6ea1f5..925fac0 100644 (file)
@@ -283,7 +283,7 @@ void IntlNumberFormat::initializeNumberFormat(JSGlobalObject* globalObject, JSVa
 
     TriState useGrouping = intlBooleanOption(globalObject, options, Identifier::fromString(vm, "useGrouping"));
     RETURN_IF_EXCEPTION(scope, void());
-    m_useGrouping = useGrouping != FalseTriState;
+    m_useGrouping = useGrouping != TriState::False;
 
     UNumberFormatStyle style = UNUM_DEFAULT;
     switch (m_style) {
index f23d9ed..2ad7ee6 100644 (file)
@@ -209,16 +209,16 @@ TriState intlBooleanOption(JSGlobalObject* globalObject, JSValue options, Proper
     auto scope = DECLARE_THROW_SCOPE(vm);
 
     if (options.isUndefined())
-        return MixedTriState;
+        return TriState::Indeterminate;
 
     JSObject* opts = options.toObject(globalObject);
-    RETURN_IF_EXCEPTION(scope, MixedTriState);
+    RETURN_IF_EXCEPTION(scope, TriState::Indeterminate);
 
     JSValue value = opts->get(globalObject, property);
-    RETURN_IF_EXCEPTION(scope, MixedTriState);
+    RETURN_IF_EXCEPTION(scope, TriState::Indeterminate);
 
     if (value.isUndefined())
-        return MixedTriState;
+        return TriState::Indeterminate;
 
     return triState(value.toBoolean(globalObject));
 }
index b091162..a0eb013 100644 (file)
@@ -1262,7 +1262,7 @@ inline TriState JSValue::pureStrictEqual(JSValue v1, JSValue v2)
             const StringImpl* v1String = asString(v1)->tryGetValueImpl();
             const StringImpl* v2String = asString(v2)->tryGetValueImpl();
             if (!v1String || !v2String)
-                return MixedTriState;
+                return TriState::Indeterminate;
             return triState(WTF::equal(*v1String, *v2String));
         }
         if (v1.asCell()->isHeapBigInt() && v2.asCell()->isHeapBigInt())
@@ -1275,16 +1275,16 @@ inline TriState JSValue::pureStrictEqual(JSValue v1, JSValue v2)
 inline TriState JSValue::pureToBoolean() const
 {
     if (isInt32())
-        return asInt32() ? TrueTriState : FalseTriState;
+        return asInt32() ? TriState::True : TriState::False;
     if (isDouble())
-        return isNotZeroAndOrdered(asDouble()) ? TrueTriState : FalseTriState; // false for NaN
+        return isNotZeroAndOrdered(asDouble()) ? TriState::True : TriState::False; // false for NaN
     if (isCell())
         return asCell()->pureToBoolean();
 #if USE(BIGINT32)
     if (isBigInt32())
-        return bigInt32AsInt32() ? TrueTriState : FalseTriState;
+        return bigInt32AsInt32() ? TriState::True : TriState::False;
 #endif
-    return isTrue() ? TrueTriState : FalseTriState;
+    return isTrue() ? TriState::True : TriState::False;
 }
 
 ALWAYS_INLINE bool JSValue::requireObjectCoercible(JSGlobalObject* globalObject) const
index 0dea275..e997ad0 100644 (file)
@@ -330,12 +330,12 @@ inline bool JSCell::toBoolean(JSGlobalObject* globalObject) const
 inline TriState JSCell::pureToBoolean() const
 {
     if (isString())
-        return static_cast<const JSString*>(this)->toBoolean() ? TrueTriState : FalseTriState;
+        return static_cast<const JSString*>(this)->toBoolean() ? TriState::True : TriState::False;
     if (isHeapBigInt())
-        return static_cast<const JSBigInt*>(this)->toBoolean() ? TrueTriState : FalseTriState;
+        return static_cast<const JSBigInt*>(this)->toBoolean() ? TriState::True : TriState::False;
     if (isSymbol())
-        return TrueTriState;
-    return MixedTriState;
+        return TriState::True;
+    return TriState::Indeterminate;
 }
 
 inline void JSCellLock::lock()
index 36cada3..05ac9c7 100644 (file)
@@ -1,3 +1,15 @@
+2020-04-30  Ross Kirsling  <ross.kirsling@sony.com>
+
+        TriState should be an enum class and use "Indeterminate" instead of "Mixed"
+        https://bugs.webkit.org/show_bug.cgi?id=211268
+
+        Reviewed by Mark Lam.
+
+        The word "indeterminate" comes from boost::tribool.
+        A third state is generally not "mixed" but rather unknown.
+
+        * wtf/TriState.h:
+
 2020-04-29  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         [Win] Deadlock in WTF::Thread::didExit() while WebKitNetworkProcess.exe is exiting
index 5ae785d..7e52e7b 100644 (file)
 
 namespace WTF {
 
-enum TriState : uint8_t {
-    FalseTriState,
-    TrueTriState,
-    MixedTriState
+enum class TriState : uint8_t {
+    False,
+    True,
+    Indeterminate
 };
 
 inline TriState triState(bool boolean)
@@ -41,7 +41,4 @@ inline TriState triState(bool boolean)
 }
 
 using WTF::TriState;
-using WTF::FalseTriState;
-using WTF::TrueTriState;
-using WTF::MixedTriState;
 using WTF::triState;
index f91b4b2..ed46596 100644 (file)
@@ -1,3 +1,30 @@
+2020-04-30  Ross Kirsling  <ross.kirsling@sony.com>
+
+        TriState should be an enum class and use "Indeterminate" instead of "Mixed"
+        https://bugs.webkit.org/show_bug.cgi?id=211268
+
+        Reviewed by Mark Lam.
+
+        * dom/Document.cpp:
+        (WebCore::Document::queryCommandIndeterm):
+        (WebCore::Document::queryCommandState):
+        * editing/EditingStyle.cpp:
+        (WebCore::EditingStyle::triStateOfStyle const):
+        (WebCore::EditingStyle::hasStyle):
+        * editing/Editor.cpp:
+        (WebCore::Editor::selectionUnorderedListState const):
+        (WebCore::Editor::selectionOrderedListState const):
+        * editing/EditorCommand.cpp:
+        (WebCore::isStylePresent):
+        (WebCore::stateStyle):
+        (WebCore::stateTextWritingDirection):
+        (WebCore::stateNone):
+        (WebCore::stateStyleWithCSS):
+        (WebCore::Editor::Command::state const):
+        (WebCore::Editor::Command::value const):
+        * page/ContextMenuController.cpp:
+        (WebCore::ContextMenuController::checkOrEnableIfNeeded const):
+
 2020-04-30  Simon Fraser  <simon.fraser@apple.com>
 
         Clean up some EventHandler coordinate-related naming and fix ScrollableArea::lastKnownMousePosition() conversions
index 59e30e0..1844bf2 100644 (file)
@@ -5558,12 +5558,12 @@ bool Document::queryCommandEnabled(const String& commandName)
 
 bool Document::queryCommandIndeterm(const String& commandName)
 {
-    return command(this, commandName).state() == MixedTriState;
+    return command(this, commandName).state() == TriState::Indeterminate;
 }
 
 bool Document::queryCommandState(const String& commandName)
 {
-    return command(this, commandName).state() == TrueTriState;
+    return command(this, commandName).state() == TriState::True;
 }
 
 bool Document::queryCommandSupported(const String& commandName)
index 2f6354a..030015b 100644 (file)
@@ -752,7 +752,7 @@ static const CSSPropertyID textOnlyProperties[] = {
 TriState EditingStyle::triStateOfStyle(EditingStyle* style) const
 {
     if (!style || !style->m_mutableStyle)
-        return FalseTriState;
+        return TriState::False;
     return triStateOfStyle(*style->m_mutableStyle, DoNotIgnoreTextOnlyProperties);
 }
 
@@ -760,7 +760,7 @@ template<typename T>
 TriState EditingStyle::triStateOfStyle(T& styleToCompare, ShouldIgnoreTextOnlyProperties shouldIgnoreTextOnlyProperties) const
 {
     if (!m_mutableStyle)
-        return TrueTriState;
+        return TriState::True;
 
     RefPtr<MutableStyleProperties> difference = getPropertiesNotIn(*m_mutableStyle, styleToCompare);
 
@@ -768,22 +768,22 @@ TriState EditingStyle::triStateOfStyle(T& styleToCompare, ShouldIgnoreTextOnlyPr
         difference->removePropertiesInSet(textOnlyProperties, WTF_ARRAY_LENGTH(textOnlyProperties));
 
     if (difference->isEmpty())
-        return TrueTriState;
+        return TriState::True;
     if (difference->propertyCount() == m_mutableStyle->propertyCount())
-        return FalseTriState;
+        return TriState::False;
 
-    return MixedTriState;
+    return TriState::Indeterminate;
 }
 
 TriState EditingStyle::triStateOfStyle(const VisibleSelection& selection) const
 {
     if (!selection.isCaretOrRange())
-        return FalseTriState;
+        return TriState::False;
 
     if (selection.isCaret())
         return triStateOfStyle(EditingStyle::styleAtSelectionStart(selection).get());
 
-    TriState state = FalseTriState;
+    TriState state = TriState::False;
     bool nodeIsStart = true;
     for (Node* node = selection.start().deprecatedNode(); node; node = NodeTraversal::next(*node)) {
         if (node->renderer() && node->hasEditableStyle()) {
@@ -793,7 +793,7 @@ TriState EditingStyle::triStateOfStyle(const VisibleSelection& selection) const
                 state = nodeState;
                 nodeIsStart = false;
             } else if (state != nodeState && node->isTextNode()) {
-                state = MixedTriState;
+                state = TriState::Indeterminate;
                 break;
             }
         }
@@ -1482,7 +1482,7 @@ int EditingStyle::legacyFontSize(Document& document) const
 
 bool EditingStyle::hasStyle(CSSPropertyID propertyID, const String& value)
 {
-    return EditingStyle::create(propertyID, value)->triStateOfStyle(this) != FalseTriState;
+    return EditingStyle::create(propertyID, value)->triStateOfStyle(this) != TriState::False;
 }
 
 RefPtr<EditingStyle> EditingStyle::styleAtSelectionStart(const VisibleSelection& selection, bool shouldUseBackgroundColorInEffect)
index 63cce39..888da92 100644 (file)
@@ -814,30 +814,30 @@ TriState Editor::selectionUnorderedListState() const
 {
     if (m_document.selection().isCaret()) {
         if (enclosingElementWithTag(m_document.selection().selection().start(), ulTag))
-            return TrueTriState;
+            return TriState::True;
     } else if (m_document.selection().isRange()) {
         auto* startNode = enclosingElementWithTag(m_document.selection().selection().start(), ulTag);
         auto* endNode = enclosingElementWithTag(m_document.selection().selection().end(), ulTag);
         if (startNode && endNode && startNode == endNode)
-            return TrueTriState;
+            return TriState::True;
     }
 
-    return FalseTriState;
+    return TriState::False;
 }
 
 TriState Editor::selectionOrderedListState() const
 {
     if (m_document.selection().isCaret()) {
         if (enclosingElementWithTag(m_document.selection().selection().start(), olTag))
-            return TrueTriState;
+            return TriState::True;
     } else if (m_document.selection().isRange()) {
         auto* startNode = enclosingElementWithTag(m_document.selection().selection().start(), olTag);
         auto* endNode = enclosingElementWithTag(m_document.selection().selection().end(), olTag);
         if (startNode && endNode && startNode == endNode)
-            return TrueTriState;
+            return TriState::True;
     }
 
-    return FalseTriState;
+    return TriState::False;
 }
 
 RefPtr<Node> Editor::insertOrderedList()
index e1fb3cd..93ae77d 100644 (file)
@@ -121,7 +121,7 @@ static bool isStylePresent(Editor& editor, CSSPropertyID propertyID, const char*
     // Windows: present throughout the selection
     if (editor.behavior().shouldToggleStyleBasedOnStartOfSelection())
         return editor.selectionStartHasStyle(propertyID, onValue);
-    return editor.selectionHasStyle(propertyID, onValue) == TrueTriState;
+    return editor.selectionHasStyle(propertyID, onValue) == TriState::True;
 }
 
 static bool executeApplyStyle(Frame& frame, EditorCommandSource source, EditAction action, CSSPropertyID propertyID, const String& propertyValue)
@@ -191,7 +191,7 @@ static bool expandSelectionToGranularity(Frame& frame, TextGranularity granulari
 static TriState stateStyle(Frame& frame, CSSPropertyID propertyID, const char* desiredValue)
 {
     if (frame.editor().behavior().shouldToggleStyleBasedOnStartOfSelection())
-        return frame.editor().selectionStartHasStyle(propertyID, desiredValue) ? TrueTriState : FalseTriState;
+        return frame.editor().selectionStartHasStyle(propertyID, desiredValue) ? TriState::True : TriState::False;
     return frame.editor().selectionHasStyle(propertyID, desiredValue);
 }
 
@@ -207,8 +207,8 @@ static TriState stateTextWritingDirection(Frame& frame, WritingDirection directi
     bool hasNestedOrMultipleEmbeddings;
     WritingDirection selectionDirection = EditingStyle::textDirectionForSelection(frame.selection().selection(),
         frame.selection().typingStyle(), hasNestedOrMultipleEmbeddings);
-    // FXIME: We should be returning MixedTriState when selectionDirection == direction && hasNestedOrMultipleEmbeddings
-    return (selectionDirection == direction && !hasNestedOrMultipleEmbeddings) ? TrueTriState : FalseTriState;
+    // FXIME: We should be returning TriState::Indeterminate when selectionDirection == direction && hasNestedOrMultipleEmbeddings
+    return (selectionDirection == direction && !hasNestedOrMultipleEmbeddings) ? TriState::True : TriState::False;
 }
 
 static unsigned verticalScrollDistance(Frame& frame)
@@ -1438,7 +1438,7 @@ static bool enabledInRichlyEditableTextWithEditableImagesEnabled(Frame& frame, E
 
 static TriState stateNone(Frame&, Event*)
 {
-    return FalseTriState;
+    return TriState::False;
 }
 
 static TriState stateBold(Frame& frame, Event*)
@@ -1463,7 +1463,7 @@ static TriState stateStrikethrough(Frame& frame, Event*)
 
 static TriState stateStyleWithCSS(Frame& frame, Event*)
 {
-    return frame.editor().shouldStyleWithCSS() ? TrueTriState : FalseTriState;
+    return frame.editor().shouldStyleWithCSS() ? TriState::True : TriState::False;
 }
 
 static TriState stateSubscript(Frame& frame, Event*)
@@ -1906,7 +1906,7 @@ bool Editor::Command::isEnabled(Event* triggeringEvent) const
 TriState Editor::Command::state(Event* triggeringEvent) const
 {
     if (!isSupported() || !m_frame)
-        return FalseTriState;
+        return TriState::False;
     return m_command->state(*m_frame, triggeringEvent);
 }
 
@@ -1915,7 +1915,7 @@ String Editor::Command::value(Event* triggeringEvent) const
     if (!isSupported() || !m_frame)
         return String();
     if (m_command->value == valueNull && m_command->state != stateNone)
-        return m_command->state(*m_frame, triggeringEvent) == TrueTriState ? "true"_s : "false"_s;
+        return m_command->state(*m_frame, triggeringEvent) == TriState::True ? "true"_s : "false"_s;
     return m_command->value(*m_frame, triggeringEvent);
 }
 
index d2580ea..3190546 100644 (file)
@@ -1172,25 +1172,25 @@ void ContextMenuController::checkOrEnableIfNeeded(ContextMenuItem& item) const
         case ContextMenuItemTagLeftToRight:
         case ContextMenuItemTagRightToLeft: {
             String direction = item.action() == ContextMenuItemTagLeftToRight ? "ltr" : "rtl";
-            shouldCheck = frame->editor().selectionHasStyle(CSSPropertyDirection, direction) != FalseTriState;
+            shouldCheck = frame->editor().selectionHasStyle(CSSPropertyDirection, direction) != TriState::False;
             shouldEnable = true;
             break;
         }
         case ContextMenuItemTagTextDirectionDefault: {
             Editor::Command command = frame->editor().command("MakeTextWritingDirectionNatural");
-            shouldCheck = command.state() == TrueTriState;
+            shouldCheck = command.state() == TriState::True;
             shouldEnable = command.isEnabled();
             break;
         }
         case ContextMenuItemTagTextDirectionLeftToRight: {
             Editor::Command command = frame->editor().command("MakeTextWritingDirectionLeftToRight");
-            shouldCheck = command.state() == TrueTriState;
+            shouldCheck = command.state() == TriState::True;
             shouldEnable = command.isEnabled();
             break;
         }
         case ContextMenuItemTagTextDirectionRightToLeft: {
             Editor::Command command = frame->editor().command("MakeTextWritingDirectionRightToLeft");
-            shouldCheck = command.state() == TrueTriState;
+            shouldCheck = command.state() == TriState::True;
             shouldEnable = command.isEnabled();
             break;
         }
@@ -1231,7 +1231,7 @@ void ContextMenuController::checkOrEnableIfNeeded(ContextMenuItem& item) const
             break;
 #endif
         case ContextMenuItemTagUnderline: {
-            shouldCheck = frame->editor().selectionHasStyle(CSSPropertyWebkitTextDecorationsInEffect, "underline") != FalseTriState;
+            shouldCheck = frame->editor().selectionHasStyle(CSSPropertyWebkitTextDecorationsInEffect, "underline") != TriState::False;
             shouldEnable = frame->editor().canEditRichly();
             break;
         }
@@ -1244,12 +1244,12 @@ void ContextMenuController::checkOrEnableIfNeeded(ContextMenuItem& item) const
             shouldEnable = true;
             break;
         case ContextMenuItemTagItalic: {
-            shouldCheck = frame->editor().selectionHasStyle(CSSPropertyFontStyle, "italic") != FalseTriState;
+            shouldCheck = frame->editor().selectionHasStyle(CSSPropertyFontStyle, "italic") != TriState::False;
             shouldEnable = frame->editor().canEditRichly();
             break;
         }
         case ContextMenuItemTagBold: {
-            shouldCheck = frame->editor().selectionHasStyle(CSSPropertyFontWeight, "bold") != FalseTriState;
+            shouldCheck = frame->editor().selectionHasStyle(CSSPropertyFontWeight, "bold") != TriState::False;
             shouldEnable = frame->editor().canEditRichly();
             break;
         }
index cea14cf..97324cc 100644 (file)
@@ -1,3 +1,16 @@
+2020-04-30  Ross Kirsling  <ross.kirsling@sony.com>
+
+        TriState should be an enum class and use "Indeterminate" instead of "Mixed"
+        https://bugs.webkit.org/show_bug.cgi?id=211268
+
+        Reviewed by Mark Lam.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::validateCommand):
+
+        * WebProcess/WebPage/glib/WebPageGLib.cpp:
+        (WebKit::WebPage::getPlatformEditorState const):
+
 2020-04-30  Jiewen Tan  <jiewen_tan@apple.com>
 
         [WebAuthn] Require user gestures for LocalAuthenticator
index 2941df7..3a1e4ff 100644 (file)
@@ -2835,7 +2835,7 @@ void WebPage::validateCommand(const String& commandName, CallbackID callbackID)
         isEnabled = pluginView->isEditingCommandEnabled(commandName);
     else {
         Editor::Command command = frame.editor().command(commandName);
-        state = command.state();
+        state = (command.state() != TriState::False);
         isEnabled = command.isSupported() && command.isEnabled();
     }
 
index 934ba50..4c500e3 100644 (file)
@@ -83,13 +83,13 @@ void WebPage::getPlatformEditorState(Frame& frame, EditorState& result) const
 #if PLATFORM(GTK)
     const Editor& editor = frame.editor();
     if (selection.isRange()) {
-        if (editor.selectionHasStyle(CSSPropertyFontWeight, "bold") == TrueTriState)
+        if (editor.selectionHasStyle(CSSPropertyFontWeight, "bold") == TriState::True)
             postLayoutData.typingAttributes |= AttributeBold;
-        if (editor.selectionHasStyle(CSSPropertyFontStyle, "italic") == TrueTriState)
+        if (editor.selectionHasStyle(CSSPropertyFontStyle, "italic") == TriState::True)
             postLayoutData.typingAttributes |= AttributeItalics;
-        if (editor.selectionHasStyle(CSSPropertyWebkitTextDecorationsInEffect, "underline") == TrueTriState)
+        if (editor.selectionHasStyle(CSSPropertyWebkitTextDecorationsInEffect, "underline") == TriState::True)
             postLayoutData.typingAttributes |= AttributeUnderline;
-        if (editor.selectionHasStyle(CSSPropertyWebkitTextDecorationsInEffect, "line-through") == TrueTriState)
+        if (editor.selectionHasStyle(CSSPropertyWebkitTextDecorationsInEffect, "line-through") == TriState::True)
             postLayoutData.typingAttributes |= AttributeStrikeThrough;
     } else if (selection.isCaret()) {
         if (editor.selectionStartHasStyle(CSSPropertyFontWeight, "bold"))
index 015e26a..f65c181 100644 (file)
@@ -1,3 +1,14 @@
+2020-04-30  Ross Kirsling  <ross.kirsling@sony.com>
+
+        TriState should be an enum class and use "Indeterminate" instead of "Mixed"
+        https://bugs.webkit.org/show_bug.cgi?id=211268
+
+        Reviewed by Mark Lam.
+
+        * WebView/WebHTMLView.mm:
+        (kit):
+        (-[WebHTMLView validateUserInterfaceItemWithoutDelegate:]):
+
 2020-04-30  Antoine Quint  <graouts@apple.com>
 
         Remove -[WebView setCSSAnimationsSuspended:]
index 71b02d1..1534e6f 100644 (file)
@@ -1013,12 +1013,12 @@ struct WebHTMLViewInterpretKeyEventsParameters {
 static NSControlStateValue kit(TriState state)
 {
     switch (state) {
-        case FalseTriState:
-            return NSControlStateValueOff;
-        case TrueTriState:
-            return NSControlStateValueOn;
-        case MixedTriState:
-            return NSControlStateValueMixed;
+    case TriState::False:
+        return NSControlStateValueOff;
+    case TriState::True:
+        return NSControlStateValueOn;
+    case TriState::Indeterminate:
+        return NSControlStateValueMixed;
     }
     ASSERT_NOT_REACHED();
     return NSControlStateValueOff;
@@ -2948,7 +2948,7 @@ IGNORE_WARNINGS_END
         NSMenuItem *menuItem = (NSMenuItem *)item;
         if ([menuItem isKindOfClass:[NSMenuItem class]]) {
             String direction = writingDirection == NSWritingDirectionLeftToRight ? "ltr" : "rtl";
-            [menuItem setState:frame->editor().selectionHasStyle(WebCore::CSSPropertyDirection, direction)];
+            [menuItem setState:(frame->editor().selectionHasStyle(WebCore::CSSPropertyDirection, direction) != TriState::False)];
         }
         return [self _canEdit];
     }
@@ -2965,7 +2965,7 @@ IGNORE_WARNINGS_END
         if ([menuItem isKindOfClass:[NSMenuItem class]]) {
             // Take control of the title of the menu item instead of just checking/unchecking it because
             // a check would be ambiguous.
-            [menuItem setTitle:frame->editor().selectionHasStyle(WebCore::CSSPropertyDirection, "rtl")
+            [menuItem setTitle:(frame->editor().selectionHasStyle(WebCore::CSSPropertyDirection, "rtl") != TriState::False)
                 ? UI_STRING_INTERNAL("Left to Right", "Left to Right context menu item")
                 : UI_STRING_INTERNAL("Right to Left", "Right to Left context menu item")];
         }