Title: [279729] trunk/Source
- Revision
- 279729
- Author
- [email protected]
- Date
- 2021-07-08 10:27:49 -0700 (Thu, 08 Jul 2021)
Log Message
Use JSC::Yarr::flagsString to get string representation of RegExp flags
https://bugs.webkit.org/show_bug.cgi?id=227790
Reviewed by Keith Miller.
Source/_javascript_Core:
* yarr/YarrFlags.h:
Source/WebCore:
This patch uses JSC::Yarr::flagsString function to retrieve string representation of
RegExp flags. This allows JSC to add flags without changing WebCore code.
Covered by existing tests.
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::dumpIfTerminal):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (279728 => 279729)
--- trunk/Source/_javascript_Core/ChangeLog 2021-07-08 17:17:09 UTC (rev 279728)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-07-08 17:27:49 UTC (rev 279729)
@@ -1,3 +1,12 @@
+2021-07-08 Yusuke Suzuki <[email protected]>
+
+ Use JSC::Yarr::flagsString to get string representation of RegExp flags
+ https://bugs.webkit.org/show_bug.cgi?id=227790
+
+ Reviewed by Keith Miller.
+
+ * yarr/YarrFlags.h:
+
2021-07-07 Yusuke Suzuki <[email protected]>
[JSC] Clean up RegExp flag code
Modified: trunk/Source/_javascript_Core/yarr/YarrFlags.h (279728 => 279729)
--- trunk/Source/_javascript_Core/yarr/YarrFlags.h 2021-07-08 17:17:09 UTC (rev 279728)
+++ trunk/Source/_javascript_Core/yarr/YarrFlags.h 2021-07-08 17:27:49 UTC (rev 279729)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2019 Sony Interactive Entertainment Inc.
+ * Copyright (C) 2021 Apple Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -53,6 +54,6 @@
JS_EXPORT_PRIVATE std::optional<OptionSet<Flags>> parseFlags(StringView);
using FlagsString = std::array<char, Yarr::numberOfFlags + 1>; // numberOfFlags + null-terminator
-FlagsString flagsString(OptionSet<Flags>);
+JS_EXPORT_PRIVATE FlagsString flagsString(OptionSet<Flags>);
} } // namespace JSC::Yarr
Modified: trunk/Source/WebCore/ChangeLog (279728 => 279729)
--- trunk/Source/WebCore/ChangeLog 2021-07-08 17:17:09 UTC (rev 279728)
+++ trunk/Source/WebCore/ChangeLog 2021-07-08 17:27:49 UTC (rev 279729)
@@ -1,3 +1,17 @@
+2021-07-08 Yusuke Suzuki <[email protected]>
+
+ Use JSC::Yarr::flagsString to get string representation of RegExp flags
+ https://bugs.webkit.org/show_bug.cgi?id=227790
+
+ Reviewed by Keith Miller.
+
+ This patch uses JSC::Yarr::flagsString function to retrieve string representation of
+ RegExp flags. This allows JSC to add flags without changing WebCore code.
+ Covered by existing tests.
+
+ * bindings/js/SerializedScriptValue.cpp:
+ (WebCore::CloneSerializer::dumpIfTerminal):
+
2021-07-08 Megan Gardner <[email protected]>
Add logging for legacy AppHighlight decoding to aid in future debugging.
Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (279728 => 279729)
--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2021-07-08 17:17:09 UTC (rev 279728)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2021-07-08 17:27:49 UTC (rev 279729)
@@ -1240,25 +1240,9 @@
return true;
}
if (auto* regExp = jsDynamicCast<RegExpObject*>(vm, obj)) {
- char flags[7];
- int flagCount = 0;
- if (regExp->regExp()->global())
- flags[flagCount++] = 'g';
- if (regExp->regExp()->ignoreCase())
- flags[flagCount++] = 'i';
- if (regExp->regExp()->multiline())
- flags[flagCount++] = 'm';
- if (regExp->regExp()->dotAll())
- flags[flagCount++] = 's';
- if (regExp->regExp()->unicode())
- flags[flagCount++] = 'u';
- if (regExp->regExp()->sticky())
- flags[flagCount++] = 'y';
- if (regExp->regExp()->hasIndices())
- flags[flagCount++] = 'd';
write(RegExpTag);
write(regExp->regExp()->pattern());
- write(String(flags, flagCount));
+ write(String(JSC::Yarr::flagsString(regExp->regExp()->flags()).data()));
return true;
}
if (obj->inherits<JSMessagePort>(vm)) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes