Title: [238297] trunk
Revision
238297
Author
[email protected]
Date
2018-11-16 12:42:51 -0800 (Fri, 16 Nov 2018)

Log Message

KnownCellUse should also have SpecCellCheck as its type filter
https://bugs.webkit.org/show_bug.cgi?id=191729
<rdar://problem/45872852>

Reviewed by Filip Pizlo.

JSTests:

* stress/known-cell-type-check-should-allow-empty-value-to-flow-through.js: Added.
(C):

Source/_javascript_Core:

We write transformations in the compiler like this where we emit edges with
KnownCellUse if we know we're inserting code at a point where we're dominated
by a Cell check:

a: SomeValue
b: Something(Cell:@a)
c: SomethingElse(@b)
d: CheckNotEmpty(@a)

=>

a: SomeValue
b: Something(Cell:@a)
e: RandomOtherThing(KnownCellUse:@a)
c: SomethingElse(@b)
d: CheckNotEmpty(@a)

However, doing this used to lead to subtly incorrect programs since KnownCellUse
did not allow the empty value to flow through it. We used to end up incorrectly
deleting @d in the above program. We fix this, we make KnownCellUse allow the empty
value to flow through.

* dfg/DFGUseKind.h:
(JSC::DFG::typeFilterFor):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (238296 => 238297)


--- trunk/JSTests/ChangeLog	2018-11-16 20:18:47 UTC (rev 238296)
+++ trunk/JSTests/ChangeLog	2018-11-16 20:42:51 UTC (rev 238297)
@@ -1,3 +1,14 @@
+2018-11-16  Saam Barati  <[email protected]>
+
+        KnownCellUse should also have SpecCellCheck as its type filter
+        https://bugs.webkit.org/show_bug.cgi?id=191729
+        <rdar://problem/45872852>
+
+        Reviewed by Filip Pizlo.
+
+        * stress/known-cell-type-check-should-allow-empty-value-to-flow-through.js: Added.
+        (C):
+
 2018-11-16  Tadeu Zagallo  <[email protected]>
 
         Fix assertion failure on BytecodeGenerator::recordOpcode

Added: trunk/JSTests/stress/known-cell-type-check-should-allow-empty-value-to-flow-through.js (0 => 238297)


--- trunk/JSTests/stress/known-cell-type-check-should-allow-empty-value-to-flow-through.js	                        (rev 0)
+++ trunk/JSTests/stress/known-cell-type-check-should-allow-empty-value-to-flow-through.js	2018-11-16 20:42:51 UTC (rev 238297)
@@ -0,0 +1,25 @@
+//@ runDefault("--jitPolicyScale=0", "--useConcurrentJIT=0")
+
+class C extends class {} {
+    constructor(beforeSuper) {
+        let f = () => {
+            for (let j=0; j<10; j++) {
+                try {
+                    this.x
+                } catch (e) {
+                }
+            }
+        };
+        if (beforeSuper) {
+            f();
+            super();
+        } else {
+            super();
+            f();
+        }
+    }
+};
+for (let i = 0; i < 10000; i++) {
+    new C(false);
+    new C(true);
+}

Modified: trunk/Source/_javascript_Core/ChangeLog (238296 => 238297)


--- trunk/Source/_javascript_Core/ChangeLog	2018-11-16 20:18:47 UTC (rev 238296)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-11-16 20:42:51 UTC (rev 238297)
@@ -1,3 +1,36 @@
+2018-11-16  Saam Barati  <[email protected]>
+
+        KnownCellUse should also have SpecCellCheck as its type filter
+        https://bugs.webkit.org/show_bug.cgi?id=191729
+        <rdar://problem/45872852>
+
+        Reviewed by Filip Pizlo.
+
+        We write transformations in the compiler like this where we emit edges with
+        KnownCellUse if we know we're inserting code at a point where we're dominated
+        by a Cell check:
+        
+        a: SomeValue
+        b: Something(Cell:@a)
+        c: SomethingElse(@b)
+        d: CheckNotEmpty(@a)
+        
+        =>
+        
+        a: SomeValue
+        b: Something(Cell:@a)
+        e: RandomOtherThing(KnownCellUse:@a)
+        c: SomethingElse(@b)
+        d: CheckNotEmpty(@a)
+        
+        However, doing this used to lead to subtly incorrect programs since KnownCellUse
+        did not allow the empty value to flow through it. We used to end up incorrectly
+        deleting @d in the above program. We fix this, we make KnownCellUse allow the empty
+        value to flow through.
+
+        * dfg/DFGUseKind.h:
+        (JSC::DFG::typeFilterFor):
+
 2018-11-16  Tadeu Zagallo  <[email protected]>
 
         Fix assertion failure on BytecodeGenerator::recordOpcode

Modified: trunk/Source/_javascript_Core/dfg/DFGUseKind.h (238296 => 238297)


--- trunk/Source/_javascript_Core/dfg/DFGUseKind.h	2018-11-16 20:18:47 UTC (rev 238296)
+++ trunk/Source/_javascript_Core/dfg/DFGUseKind.h	2018-11-16 20:42:51 UTC (rev 238297)
@@ -119,9 +119,8 @@
     case KnownBooleanUse:
         return SpecBoolean;
     case CellUse:
+    case KnownCellUse:
         return SpecCellCheck;
-    case KnownCellUse:
-        return SpecCell;
     case CellOrOtherUse:
         return SpecCellCheck | SpecOther;
     case ObjectUse:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to