Log Message
Follow-up after String.codePointAt optimization https://bugs.webkit.org/show_bug.cgi?id=201889
Reviewed by Saam Barati. JSTests: * stress/string-char-at-bad-type.js: Added. (shouldBe): (object.toString): (test): * stress/string-char-code-at-bad-type.js: Added. (shouldBe): (object.toString): (test): * stress/string-code-point-at-bad-type.js: Added. (shouldBe): (object.toString): (test): Source/_javascript_Core: Follow-up after string.codePointAt DFG / FTL optimizations, 1. Gracefully accept arguments more than expected for intrinsics 2. Check BadType in String.codePointAt, String.charAt, and String.charCodeAt. * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
Modified Paths
- trunk/JSTests/ChangeLog
- trunk/Source/_javascript_Core/ChangeLog
- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp
Added Paths
Diff
Modified: trunk/JSTests/ChangeLog (250003 => 250004)
--- trunk/JSTests/ChangeLog 2019-09-17 23:55:26 UTC (rev 250003)
+++ trunk/JSTests/ChangeLog 2019-09-18 00:31:50 UTC (rev 250004)
@@ -1,5 +1,25 @@
2019-09-17 Yusuke Suzuki <[email protected]>
+ Follow-up after String.codePointAt optimization
+ https://bugs.webkit.org/show_bug.cgi?id=201889
+
+ Reviewed by Saam Barati.
+
+ * stress/string-char-at-bad-type.js: Added.
+ (shouldBe):
+ (object.toString):
+ (test):
+ * stress/string-char-code-at-bad-type.js: Added.
+ (shouldBe):
+ (object.toString):
+ (test):
+ * stress/string-code-point-at-bad-type.js: Added.
+ (shouldBe):
+ (object.toString):
+ (test):
+
+2019-09-17 Yusuke Suzuki <[email protected]>
+
[JSC] CheckArray+NonArray is not filtering out Array in AI
https://bugs.webkit.org/show_bug.cgi?id=201857
<rdar://problem/54194820>
Added: trunk/JSTests/stress/string-char-at-bad-type.js (0 => 250004)
--- trunk/JSTests/stress/string-char-at-bad-type.js (rev 0)
+++ trunk/JSTests/stress/string-char-at-bad-type.js 2019-09-18 00:31:50 UTC (rev 250004)
@@ -0,0 +1,17 @@
+function shouldBe(actual, expected) {
+ if (actual !== expected)
+ throw new Error('bad value: ' + actual);
+}
+
+var object = {
+ toString() { return "Cocoa"; }
+};
+var charAt = String.prototype.charAt;
+function test(object)
+{
+ shouldBe(charAt.call(object, 0), `C`);
+}
+noInline(test);
+
+for (var i = 0; i < 1e5; ++i)
+ test(object);
Added: trunk/JSTests/stress/string-char-code-at-bad-type.js (0 => 250004)
--- trunk/JSTests/stress/string-char-code-at-bad-type.js (rev 0)
+++ trunk/JSTests/stress/string-char-code-at-bad-type.js 2019-09-18 00:31:50 UTC (rev 250004)
@@ -0,0 +1,17 @@
+function shouldBe(actual, expected) {
+ if (actual !== expected)
+ throw new Error('bad value: ' + actual);
+}
+
+var object = {
+ toString() { return "Cocoa"; }
+};
+var charCodeAt = String.prototype.charCodeAt;
+function test(object)
+{
+ shouldBe(charCodeAt.call(object, 0), 67);
+}
+noInline(test);
+
+for (var i = 0; i < 1e5; ++i)
+ test(object);
Added: trunk/JSTests/stress/string-code-point-at-bad-type.js (0 => 250004)
--- trunk/JSTests/stress/string-code-point-at-bad-type.js (rev 0)
+++ trunk/JSTests/stress/string-code-point-at-bad-type.js 2019-09-18 00:31:50 UTC (rev 250004)
@@ -0,0 +1,17 @@
+function shouldBe(actual, expected) {
+ if (actual !== expected)
+ throw new Error('bad value: ' + actual);
+}
+
+var object = {
+ toString() { return "Cocoa"; }
+};
+var codePointAt = String.prototype.codePointAt;
+function test(object)
+{
+ shouldBe(codePointAt.call(object, 0), 67);
+}
+noInline(test);
+
+for (var i = 0; i < 1e5; ++i)
+ test(object);
Modified: trunk/Source/_javascript_Core/ChangeLog (250003 => 250004)
--- trunk/Source/_javascript_Core/ChangeLog 2019-09-17 23:55:26 UTC (rev 250003)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-09-18 00:31:50 UTC (rev 250004)
@@ -1,3 +1,18 @@
+2019-09-17 Yusuke Suzuki <[email protected]>
+
+ Follow-up after String.codePointAt optimization
+ https://bugs.webkit.org/show_bug.cgi?id=201889
+
+ Reviewed by Saam Barati.
+
+ Follow-up after string.codePointAt DFG / FTL optimizations,
+
+ 1. Gracefully accept arguments more than expected for intrinsics
+ 2. Check BadType in String.codePointAt, String.charAt, and String.charCodeAt.
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
+
2019-09-17 Tadeu Zagallo <[email protected]>
Change WebAssembly calling conventions
Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (250003 => 250004)
--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2019-09-17 23:55:26 UTC (rev 250003)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2019-09-18 00:31:50 UTC (rev 250004)
@@ -2460,9 +2460,6 @@
}
case ArrayPopIntrinsic: {
- if (argumentCountIncludingThis != 1)
- return false;
-
ArrayMode arrayMode = getArrayMode(Array::Write);
if (!arrayMode.isJSArray())
return false;
@@ -2594,10 +2591,10 @@
}
case CharCodeAtIntrinsic: {
- if (argumentCountIncludingThis != 2)
+ if (argumentCountIncludingThis < 2)
return false;
- if (m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, Uncountable))
+ if (m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, Uncountable) || m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadType))
return false;
insertChecks();
@@ -2613,10 +2610,10 @@
if (!is64Bit())
return false;
- if (argumentCountIncludingThis != 2)
+ if (argumentCountIncludingThis < 2)
return false;
- if (m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, Uncountable))
+ if (m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, Uncountable) || m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadType))
return false;
insertChecks();
@@ -2629,9 +2626,12 @@
}
case CharAtIntrinsic: {
- if (argumentCountIncludingThis != 2)
+ if (argumentCountIncludingThis < 2)
return false;
+ if (m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadType))
+ return false;
+
// FIXME: String#charAt returns empty string when index is out-of-bounds, and this does not break the AI's claim.
// Only FTL supports out-of-bounds version now. We should support out-of-bounds version even in DFG.
// https://bugs.webkit.org/show_bug.cgi?id=201678
@@ -2668,7 +2668,7 @@
}
case RegExpExecIntrinsic: {
- if (argumentCountIncludingThis != 2)
+ if (argumentCountIncludingThis < 2)
return false;
insertChecks();
@@ -2680,7 +2680,7 @@
case RegExpTestIntrinsic:
case RegExpTestFastIntrinsic: {
- if (argumentCountIncludingThis != 2)
+ if (argumentCountIncludingThis < 2)
return false;
if (intrinsic == RegExpTestIntrinsic) {
@@ -2748,7 +2748,7 @@
}
case ObjectGetPrototypeOfIntrinsic: {
- if (argumentCountIncludingThis != 2)
+ if (argumentCountIncludingThis < 2)
return false;
insertChecks();
@@ -2775,7 +2775,7 @@
}
case ReflectGetPrototypeOfIntrinsic: {
- if (argumentCountIncludingThis != 2)
+ if (argumentCountIncludingThis < 2)
return false;
insertChecks();
@@ -2799,7 +2799,7 @@
}
case StringPrototypeReplaceIntrinsic: {
- if (argumentCountIncludingThis != 3)
+ if (argumentCountIncludingThis < 3)
return false;
// Don't inline intrinsic if we exited due to "search" not being a RegExp or String object.
@@ -2851,7 +2851,7 @@
}
case StringPrototypeReplaceRegExpIntrinsic: {
- if (argumentCountIncludingThis != 3)
+ if (argumentCountIncludingThis < 3)
return false;
insertChecks();
@@ -2887,7 +2887,7 @@
return true;
}
case IMulIntrinsic: {
- if (argumentCountIncludingThis != 3)
+ if (argumentCountIncludingThis < 3)
return false;
insertChecks();
VirtualRegister leftOperand = virtualRegisterForArgument(1, registerOffset);
@@ -2899,8 +2899,6 @@
}
case RandomIntrinsic: {
- if (argumentCountIncludingThis != 1)
- return false;
insertChecks();
setResult(addToGraph(ArithRandom));
return true;
@@ -2953,7 +2951,7 @@
}
case FiatInt52Intrinsic: {
- if (argumentCountIncludingThis != 2)
+ if (argumentCountIncludingThis < 2)
return false;
insertChecks();
VirtualRegister operand = virtualRegisterForArgument(1, registerOffset);
@@ -2965,7 +2963,7 @@
}
case JSMapGetIntrinsic: {
- if (argumentCountIncludingThis != 2)
+ if (argumentCountIncludingThis < 2)
return false;
insertChecks();
@@ -2981,7 +2979,7 @@
case JSSetHasIntrinsic:
case JSMapHasIntrinsic: {
- if (argumentCountIncludingThis != 2)
+ if (argumentCountIncludingThis < 2)
return false;
insertChecks();
@@ -3005,7 +3003,7 @@
}
case JSSetAddIntrinsic: {
- if (argumentCountIncludingThis != 2)
+ if (argumentCountIncludingThis < 2)
return false;
insertChecks();
@@ -3019,7 +3017,7 @@
}
case JSMapSetIntrinsic: {
- if (argumentCountIncludingThis != 3)
+ if (argumentCountIncludingThis < 3)
return false;
insertChecks();
@@ -3086,7 +3084,7 @@
}
case JSWeakMapGetIntrinsic: {
- if (argumentCountIncludingThis != 2)
+ if (argumentCountIncludingThis < 2)
return false;
if (m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadType))
@@ -3105,7 +3103,7 @@
}
case JSWeakMapHasIntrinsic: {
- if (argumentCountIncludingThis != 2)
+ if (argumentCountIncludingThis < 2)
return false;
if (m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadType))
@@ -3125,7 +3123,7 @@
}
case JSWeakSetHasIntrinsic: {
- if (argumentCountIncludingThis != 2)
+ if (argumentCountIncludingThis < 2)
return false;
if (m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadType))
@@ -3145,7 +3143,7 @@
}
case JSWeakSetAddIntrinsic: {
- if (argumentCountIncludingThis != 2)
+ if (argumentCountIncludingThis < 2)
return false;
if (m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadType))
@@ -3162,7 +3160,7 @@
}
case JSWeakMapSetIntrinsic: {
- if (argumentCountIncludingThis != 3)
+ if (argumentCountIncludingThis < 3)
return false;
if (m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadType))
@@ -3365,7 +3363,7 @@
}
case HasOwnPropertyIntrinsic: {
- if (argumentCountIncludingThis != 2)
+ if (argumentCountIncludingThis < 2)
return false;
// This can be racy, that's fine. We know that once we observe that this is created,
@@ -3403,9 +3401,6 @@
}
case StringPrototypeToLowerCaseIntrinsic: {
- if (argumentCountIncludingThis != 1)
- return false;
-
if (m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadType))
return false;
@@ -3417,9 +3412,6 @@
}
case NumberPrototypeToStringIntrinsic: {
- if (argumentCountIncludingThis != 1 && argumentCountIncludingThis != 2)
- return false;
-
if (m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadType))
return false;
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
