Commit c2eda9aa authored by oliver@apple.com's avatar oliver@apple.com

fourthTier: DFG should CSE MakeRope

https://bugs.webkit.org/show_bug.cgi?id=117905

Source/JavaScriptCore:

Reviewed by Geoffrey Garen.

Adds MakeRope to the CSE phase and removes the comment that says that
we could do it but aren't doing it.

Also fixed SpeculatedType dumping so that if you have a Cell type then
it just prints "Cell" and if you just have Object then it just prints
"Object", instead of printing the long list of types.

* bytecode/SpeculatedType.cpp:
(JSC::dumpSpeculation):
* dfg/DFGCSEPhase.cpp:
(JSC::DFG::CSEPhase::performNodeCSE):

LayoutTests:

Reviewed by Geoffrey Garen.

This benchmark speeds up by 50%.

* fast/js/regress/make-rope-cse-expected.txt: Added.
* fast/js/regress/make-rope-cse.html: Added.
* fast/js/regress/script-tests/make-rope-cse.js: Added.
(foo):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153242 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 63af2d44
2013-06-21 Filip Pizlo <fpizlo@apple.com>
fourthTier: DFG should CSE MakeRope
https://bugs.webkit.org/show_bug.cgi?id=117905
Reviewed by Geoffrey Garen.
This benchmark speeds up by 50%.
* fast/js/regress/make-rope-cse-expected.txt: Added.
* fast/js/regress/make-rope-cse.html: Added.
* fast/js/regress/script-tests/make-rope-cse.js: Added.
(foo):
2013-06-21 Filip Pizlo <fpizlo@apple.com>
fourthTier: DFG should't exit just because it GetByVal'd a big character
JSRegress/make-rope-cse
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS no exception thrown
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body>
<script src="resources/regress-pre.js"></script>
<script src="script-tests/make-rope-cse.js"></script>
<script src="resources/regress-post.js"></script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>
function foo(a, b) {
var result = "";
for (var i = 0; i < 100000; ++i) {
result += a + b;
result += a + b;
result += a + b;
}
return result;
}
var result = foo("foo", "bar");
if (result.length != 1800000)
throw "Bad result: " + result.length;
2013-06-21 Filip Pizlo <fpizlo@apple.com>
fourthTier: DFG should CSE MakeRope
https://bugs.webkit.org/show_bug.cgi?id=117905
Reviewed by Geoffrey Garen.
Adds MakeRope to the CSE phase and removes the comment that says that
we could do it but aren't doing it.
Also fixed SpeculatedType dumping so that if you have a Cell type then
it just prints "Cell" and if you just have Object then it just prints
"Object", instead of printing the long list of types.
* bytecode/SpeculatedType.cpp:
(JSC::dumpSpeculation):
* dfg/DFGCSEPhase.cpp:
(JSC::DFG::CSEPhase::performNodeCSE):
2013-06-21 Filip Pizlo <fpizlo@apple.com>
fourthTier: DFG should't exit just because it GetByVal'd a big character
......
......@@ -51,90 +51,98 @@ void dumpSpeculation(PrintStream& out, SpeculatedType value)
bool isTop = true;
if (value & SpecCellOther)
myOut.print("Othercell");
else
isTop = false;
if ((value & SpecCell) == SpecCell)
myOut.print("Cell");
else {
if ((value & SpecObject) == SpecObject)
myOut.print("Object");
else {
if (value & SpecCellOther)
myOut.print("Othercell");
else
isTop = false;
if (value & SpecObjectOther)
myOut.print("Otherobj");
else
isTop = false;
if (value & SpecObjectOther)
myOut.print("Otherobj");
else
isTop = false;
if (value & SpecFinalObject)
myOut.print("Final");
else
isTop = false;
if (value & SpecFinalObject)
myOut.print("Final");
else
isTop = false;
if (value & SpecArray)
myOut.print("Array");
else
isTop = false;
if (value & SpecArray)
myOut.print("Array");
else
isTop = false;
if (value & SpecInt8Array)
myOut.print("Int8array");
else
isTop = false;
if (value & SpecInt8Array)
myOut.print("Int8array");
else
isTop = false;
if (value & SpecInt16Array)
myOut.print("Int16array");
else
isTop = false;
if (value & SpecInt16Array)
myOut.print("Int16array");
else
isTop = false;
if (value & SpecInt32Array)
myOut.print("Int32array");
else
isTop = false;
if (value & SpecInt32Array)
myOut.print("Int32array");
else
isTop = false;
if (value & SpecUint8Array)
myOut.print("Uint8array");
else
isTop = false;
if (value & SpecUint8Array)
myOut.print("Uint8array");
else
isTop = false;
if (value & SpecUint8ClampedArray)
myOut.print("Uint8clampedarray");
else
isTop = false;
if (value & SpecUint16Array)
myOut.print("Uint16array");
else
isTop = false;
if (value & SpecUint8ClampedArray)
myOut.print("Uint8clampedarray");
else
isTop = false;
if (value & SpecUint32Array)
myOut.print("Uint32array");
else
isTop = false;
if (value & SpecUint16Array)
myOut.print("Uint16array");
else
isTop = false;
if (value & SpecFloat32Array)
myOut.print("Float32array");
else
isTop = false;
if (value & SpecUint32Array)
myOut.print("Uint32array");
else
isTop = false;
if (value & SpecFloat64Array)
myOut.print("Float64array");
else
isTop = false;
if (value & SpecFloat32Array)
myOut.print("Float32array");
else
isTop = false;
if (value & SpecFunction)
myOut.print("Function");
else
isTop = false;
if (value & SpecFloat64Array)
myOut.print("Float64array");
else
isTop = false;
if (value & SpecArguments)
myOut.print("Arguments");
else
isTop = false;
if (value & SpecFunction)
myOut.print("Function");
else
isTop = false;
if (value & SpecString)
myOut.print("String");
else
isTop = false;
if (value & SpecArguments)
myOut.print("Arguments");
else
isTop = false;
if (value & SpecStringObject)
myOut.print("Stringobject");
else
isTop = false;
if (value & SpecStringObject)
myOut.print("Stringobject");
else
isTop = false;
}
if (value & SpecString)
myOut.print("String");
else
isTop = false;
}
if (value & SpecInt32)
myOut.print("Int");
......
......@@ -1049,15 +1049,6 @@ private:
dataLogF(" %s @%u: ", Graph::opName(node->op()), node->index());
#endif
// NOTE: there are some nodes that we deliberately don't CSE even though we
// probably could, like MakeRope and ToPrimitive. That's because there is no
// evidence that doing CSE on these nodes would result in a performance
// progression. Hence considering these nodes in CSE would just mean that this
// code does more work with no win. Of course, we may want to reconsider this,
// since MakeRope is trivially CSE-able. It's not trivially doable for
// ToPrimitive, but we could change that with some speculations if we really
// needed to.
switch (node->op()) {
case Identity:
......@@ -1101,6 +1092,7 @@ private:
case TypeOf:
case CompareEqConstant:
case ValueToInt32:
case MakeRope:
if (cseMode == StoreElimination)
break;
setReplacement(pureCSE(node));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment