Diff
Modified: branches/safari-537.73-branch/LayoutTests/ChangeLog (158148 => 158149)
--- branches/safari-537.73-branch/LayoutTests/ChangeLog 2013-10-29 01:15:38 UTC (rev 158148)
+++ branches/safari-537.73-branch/LayoutTests/ChangeLog 2013-10-29 01:34:50 UTC (rev 158149)
@@ -1,3 +1,16 @@
+2013-10-28 Lucas Forschler <[email protected]>
+
+ Merge r157830
+
+ 2013-10-22 Geoffrey Garen <[email protected]>
+
+ REGRESSION: `if (false === (true && undefined)) console.log("wrong!");` logs "wrong!", shouldn't!
+ https://bugs.webkit.org/show_bug.cgi?id=123179
+
+ Reviewed by Mark Hahnenberg.
+
+ * js/dom/branch-fold-correctness.html: Added a test for this case.
+
2013-10-28 Mark Lam <[email protected]>
Merge r155471.
Modified: branches/safari-537.73-branch/LayoutTests/fast/js/branch-fold-correctness-expected.txt (158148 => 158149)
--- branches/safari-537.73-branch/LayoutTests/fast/js/branch-fold-correctness-expected.txt 2013-10-29 01:15:38 UTC (rev 158148)
+++ branches/safari-537.73-branch/LayoutTests/fast/js/branch-fold-correctness-expected.txt 2013-10-29 01:34:50 UTC (rev 158149)
@@ -1,4 +1,4 @@
This page tests branches that might cause interesting forms of _expression_ folding in bytecode.
-tests completed: 32
+tests completed: 33
Modified: branches/safari-537.73-branch/LayoutTests/fast/js/branch-fold-correctness.html (158148 => 158149)
--- branches/safari-537.73-branch/LayoutTests/fast/js/branch-fold-correctness.html 2013-10-29 01:15:38 UTC (rev 158148)
+++ branches/safari-537.73-branch/LayoutTests/fast/js/branch-fold-correctness.html 2013-10-29 01:34:50 UTC (rev 158149)
@@ -187,6 +187,10 @@
} else
fail();
+ ++count;
+ if (false === (true && undefined))
+ fail();
+
log("tests completed: " + count);
})();
</script>
Modified: branches/safari-537.73-branch/Source/_javascript_Core/ChangeLog (158148 => 158149)
--- branches/safari-537.73-branch/Source/_javascript_Core/ChangeLog 2013-10-29 01:15:38 UTC (rev 158148)
+++ branches/safari-537.73-branch/Source/_javascript_Core/ChangeLog 2013-10-29 01:34:50 UTC (rev 158149)
@@ -1,3 +1,20 @@
+2013-10-28 Lucas Forschler <[email protected]>
+
+ Merge r157830
+
+ 2013-10-22 Geoffrey Garen <[email protected]>
+
+ REGRESSION: `if (false === (true && undefined)) console.log("wrong!");` logs "wrong!", shouldn't!
+ https://bugs.webkit.org/show_bug.cgi?id=123179
+
+ Reviewed by Mark Hahnenberg.
+
+ * parser/NodeConstructors.h:
+ (JSC::LogicalOpNode::LogicalOpNode):
+ * parser/ResultType.h:
+ (JSC::ResultType::forLogicalOp): Don't assume that && produces a boolean.
+ This is _javascript_ (aka Sparta).
+
2013-10-28 Brent Fulgham <[email protected]>
Debug build correction after r158124.
@@ -8,6 +25,23 @@
2013-10-28 Lucas Forschler <[email protected]>
+ Merge r157830
+
+ 2013-10-22 Geoffrey Garen <[email protected]>
+
+ REGRESSION: `if (false === (true && undefined)) console.log("wrong!");` logs "wrong!", shouldn't!
+ https://bugs.webkit.org/show_bug.cgi?id=123179
+
+ Reviewed by Mark Hahnenberg.
+
+ * parser/NodeConstructors.h:
+ (JSC::LogicalOpNode::LogicalOpNode):
+ * parser/ResultType.h:
+ (JSC::ResultType::forLogicalOp): Don't assume that && produces a boolean.
+ This is _javascript_ (aka Sparta).
+
+2013-10-28 Lucas Forschler <[email protected]>
+
Merge r156302
2013-09-23 Patrick Gansterer <[email protected]>
Modified: branches/safari-537.73-branch/Source/_javascript_Core/parser/NodeConstructors.h (158148 => 158149)
--- branches/safari-537.73-branch/Source/_javascript_Core/parser/NodeConstructors.h 2013-10-29 01:15:38 UTC (rev 158148)
+++ branches/safari-537.73-branch/Source/_javascript_Core/parser/NodeConstructors.h 2013-10-29 01:34:50 UTC (rev 158149)
@@ -521,7 +521,7 @@
}
inline LogicalOpNode::LogicalOpNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, LogicalOperator oper)
- : ExpressionNode(location, ResultType::booleanType())
+ : ExpressionNode(location, ResultType::forLogicalOp(expr1->resultDescriptor(), expr2->resultDescriptor()))
, m_expr1(expr1)
, m_expr2(expr2)
, m_operator(oper)
Modified: branches/safari-537.73-branch/Source/_javascript_Core/parser/ResultType.h (158148 => 158149)
--- branches/safari-537.73-branch/Source/_javascript_Core/parser/ResultType.h 2013-10-29 01:15:38 UTC (rev 158148)
+++ branches/safari-537.73-branch/Source/_javascript_Core/parser/ResultType.h 2013-10-29 01:34:50 UTC (rev 158149)
@@ -120,7 +120,20 @@
return stringType();
return stringOrNumberType();
}
-
+
+ // Unlike in C, a logical op produces the value of the
+ // last _expression_ evaluated (and not true or false).
+ static ResultType forLogicalOp(ResultType op1, ResultType op2)
+ {
+ if (op1.definitelyIsBoolean() && op2.definitelyIsBoolean())
+ return booleanType();
+ if (op1.definitelyIsNumber() && op2.definitelyIsNumber())
+ return numberType();
+ if (op1.definitelyIsString() && op2.definitelyIsString())
+ return stringType();
+ return unknownType();
+ }
+
static ResultType forBitOp()
{
return numberTypeIsInt32();