Title: [288649] trunk/Source/_javascript_Core
- Revision
- 288649
- Author
- [email protected]
- Date
- 2022-01-26 15:29:32 -0800 (Wed, 26 Jan 2022)
Log Message
Move leftover JSValue inlines from JSString.h to JSCJSValueInlines.h
https://bugs.webkit.org/show_bug.cgi?id=235662
Reviewed by Yusuke Suzuki.
JSString.h still contains some JSValue inlines from years past
(including toBoolean which doesn't overtly relate to strings at all);
these can be moved to JSCJSValueInlines.h without issue.
* runtime/JSCJSValueInlines.h:
(JSC::JSValue::toBoolean const): Added.
(JSC::JSValue::toString const): Added.
(JSC::JSValue::toStringOrNull const): Added.
(JSC::JSValue::toWTFString const): Added.
* runtime/JSString.h:
(JSC::JSValue::toBoolean const): Deleted.
(JSC::JSValue::toString const): Deleted.
(JSC::JSValue::toStringOrNull const): Deleted.
(JSC::JSValue::toWTFString const): Deleted.
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (288648 => 288649)
--- trunk/Source/_javascript_Core/ChangeLog 2022-01-26 23:07:55 UTC (rev 288648)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-01-26 23:29:32 UTC (rev 288649)
@@ -1,3 +1,25 @@
+2022-01-26 Ross Kirsling <[email protected]>
+
+ Move leftover JSValue inlines from JSString.h to JSCJSValueInlines.h
+ https://bugs.webkit.org/show_bug.cgi?id=235662
+
+ Reviewed by Yusuke Suzuki.
+
+ JSString.h still contains some JSValue inlines from years past
+ (including toBoolean which doesn't overtly relate to strings at all);
+ these can be moved to JSCJSValueInlines.h without issue.
+
+ * runtime/JSCJSValueInlines.h:
+ (JSC::JSValue::toBoolean const): Added.
+ (JSC::JSValue::toString const): Added.
+ (JSC::JSValue::toStringOrNull const): Added.
+ (JSC::JSValue::toWTFString const): Added.
+ * runtime/JSString.h:
+ (JSC::JSValue::toBoolean const): Deleted.
+ (JSC::JSValue::toString const): Deleted.
+ (JSC::JSValue::toStringOrNull const): Deleted.
+ (JSC::JSValue::toWTFString const): Deleted.
+
2022-01-26 Alexey Shvayka <[email protected]>
globalThis.queueMicrotask() should report thrown exceptions
Modified: trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h (288648 => 288649)
--- trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h 2022-01-26 23:07:55 UTC (rev 288648)
+++ trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h 2022-01-26 23:29:32 UTC (rev 288649)
@@ -914,6 +914,44 @@
return jsNumber(value);
}
+inline bool JSValue::toBoolean(JSGlobalObject* globalObject) const
+{
+ if (isInt32())
+ return asInt32();
+ if (isDouble())
+ return asDouble() > 0.0 || asDouble() < 0.0; // false for NaN
+ if (isCell())
+ return asCell()->toBoolean(globalObject);
+#if USE(BIGINT32)
+ if (isBigInt32())
+ return !!bigInt32AsInt32();
+#endif
+ return isTrue(); // false, null, and undefined all convert to false.
+}
+
+inline JSString* JSValue::toString(JSGlobalObject* globalObject) const
+{
+ if (isString())
+ return asString(asCell());
+ bool returnEmptyStringOnError = true;
+ return toStringSlowCase(globalObject, returnEmptyStringOnError);
+}
+
+inline JSString* JSValue::toStringOrNull(JSGlobalObject* globalObject) const
+{
+ if (isString())
+ return asString(asCell());
+ bool returnEmptyStringOnError = false;
+ return toStringSlowCase(globalObject, returnEmptyStringOnError);
+}
+
+inline String JSValue::toWTFString(JSGlobalObject* globalObject) const
+{
+ if (isString())
+ return static_cast<JSString*>(asCell())->value(globalObject);
+ return toWTFStringSlowCase(globalObject);
+}
+
inline JSObject* JSValue::toObject(JSGlobalObject* globalObject) const
{
return isCell() ? asCell()->toObject(globalObject) : toObjectSlowCase(globalObject);
Modified: trunk/Source/_javascript_Core/runtime/JSString.h (288648 => 288649)
--- trunk/Source/_javascript_Core/runtime/JSString.h 2022-01-26 23:07:55 UTC (rev 288648)
+++ trunk/Source/_javascript_Core/runtime/JSString.h 2022-01-26 23:29:32 UTC (rev 288649)
@@ -1035,44 +1035,4 @@
return m_fiber & JSRopeString::isSubstringInPointer;
}
-// --- JSValue inlines ----------------------------
-
-inline bool JSValue::toBoolean(JSGlobalObject* globalObject) const
-{
- if (isInt32())
- return asInt32();
- if (isDouble())
- return asDouble() > 0.0 || asDouble() < 0.0; // false for NaN
- if (isCell())
- return asCell()->toBoolean(globalObject);
-#if USE(BIGINT32)
- if (isBigInt32())
- return !!bigInt32AsInt32();
-#endif
- return isTrue(); // false, null, and undefined all convert to false.
-}
-
-inline JSString* JSValue::toString(JSGlobalObject* globalObject) const
-{
- if (isString())
- return asString(asCell());
- bool returnEmptyStringOnError = true;
- return toStringSlowCase(globalObject, returnEmptyStringOnError);
-}
-
-inline JSString* JSValue::toStringOrNull(JSGlobalObject* globalObject) const
-{
- if (isString())
- return asString(asCell());
- bool returnEmptyStringOnError = false;
- return toStringSlowCase(globalObject, returnEmptyStringOnError);
-}
-
-inline String JSValue::toWTFString(JSGlobalObject* globalObject) const
-{
- if (isString())
- return static_cast<JSString*>(asCell())->value(globalObject);
- return toWTFStringSlowCase(globalObject);
-}
-
} // namespace JSC
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes