haikuwebkit/LayoutTests/js/dfg-cfa-merge-with-dead-use...

11 lines
362 B
Plaintext
Raw Permalink Normal View History

Python implementation reports "MemoryError" instead of doing things https://bugs.webkit.org/show_bug.cgi?id=106690 Source/JavaScriptCore: Reviewed by Oliver Hunt. The bug was that the CFA was assuming that a variable is dead at the end of a basic block and hence doesn't need to be merged to the next block if the last mention of the variable was dead. This is almost correct, except that it doesn't work if the last mention is a GetLocal - the GetLocal itself may be dead, but that doesn't mean that the variable is dead - it may still be live. The appropriate thing to do is to look at the GetLocal's Phi. If the variable is used in the next block then the next block will have a reference to the last mention in our block unless that last mention is a GetLocal, in which case it will link to the Phi. Doing it this way captures everything that the CFA wants: if the last use is a live GetLocal then the CFA needs to consider the GetLocal itself for possible refinements to the proof of the value in the variable, but if the GetLocal is dead, then this must mean that the variable is not mentioned in the block but may still be "passed through" it, which is what the Phi will tell us. Note that it is not possible for the GetLocal to refer to anything other than a Phi, and it is also not possible for the last mention of a variable to be a dead GetLocal while there are other mentions that aren't dead - if there had been SetLocals or GetLocals prior to the dead one then the dead one wouldn't have been emitted by the parser. This also fixes a similar bug in the handling of captured variables. If a variable is captured, then it doesn't matter if the last mention is dead, or not. Either way, we already know that a captured variable will be live in the next block, so we must merge it no matter what. Finally, this change makes the output of Operands dumping a bit more verbose: it now prints the variable name next to each variable's dump. I've often found the lack of this information confusing particularly for operand dumps that involve a lot of variables. * bytecode/Operands.h: (JSC::dumpOperands): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::mergeStateAtTail): LayoutTests: Reviewed by Oliver Hunt. * fast/js/dfg-cfa-merge-with-dead-use-at-tail-expected.txt: Added. * fast/js/dfg-cfa-merge-with-dead-use-at-tail.html: Added. * fast/js/jsc-test-list: * fast/js/script-tests/dfg-cfa-merge-with-dead-use-at-tail.js: Added. (foo): Canonical link: https://commits.webkit.org/125075@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139687 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-01-15 00:53:39 +00:00
Tests that a dead use of a variable at the tail of a basic block doesn't confuse the CFA into believing that the variable being used is dead as well.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
fast/js/dfg-* tests should wait for the concurrent JIT https://bugs.webkit.org/show_bug.cgi?id=120723 Rubber stamped by Oliver Hunt. Convert more tests. * fast/js/dfg-branch-logical-not-peephole-around-osr-exit-expected.txt: * fast/js/dfg-branch-not-fail-expected.txt: * fast/js/dfg-byte-array-put-expected.txt: * fast/js/dfg-call-function-hit-watchpoint-expected.txt: * fast/js/dfg-call-method-hit-watchpoint-expected.txt: * fast/js/dfg-captured-var-get-local-expected.txt: * fast/js/dfg-cfa-merge-with-dead-use-at-tail-expected.txt: * fast/js/dfg-cfg-simplify-eliminate-set-local-type-check-then-branch-not-null-and-decrement-expected.txt: * fast/js/dfg-cfg-simplify-eliminate-set-local-type-check-then-branch-not-null-expected.txt: * fast/js/dfg-cfg-simplify-eliminate-set-local-type-check-then-typeof-expected.txt: * fast/js/dfg-cfg-simplify-phantom-get-local-on-same-block-set-local-expected.txt: * fast/js/dfg-cfg-simplify-redundant-dead-get-local-expected.txt: * fast/js/dfg-check-function-change-structure-expected.txt: * fast/js/jsc-test-list: * fast/js/script-tests/dfg-branch-logical-not-peephole-around-osr-exit.js: * fast/js/script-tests/dfg-branch-not-fail.js: * fast/js/script-tests/dfg-byte-array-put.js: * fast/js/script-tests/dfg-call-function-hit-watchpoint.js: * fast/js/script-tests/dfg-call-method-hit-watchpoint.js: * fast/js/script-tests/dfg-captured-var-get-local.js: * fast/js/script-tests/dfg-cfa-merge-with-dead-use-at-tail.js: * fast/js/script-tests/dfg-cfg-simplify-eliminate-set-local-type-check-then-branch-not-null-and-decrement.js: * fast/js/script-tests/dfg-cfg-simplify-eliminate-set-local-type-check-then-branch-not-null.js: * fast/js/script-tests/dfg-cfg-simplify-eliminate-set-local-type-check-then-typeof.js: * fast/js/script-tests/dfg-cfg-simplify-phantom-get-local-on-same-block-set-local.js: * fast/js/script-tests/dfg-cfg-simplify-redundant-dead-get-local.js: * fast/js/script-tests/dfg-check-function-change-structure.js: Canonical link: https://commits.webkit.org/138734@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155122 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-09-05 15:54:07 +00:00
PASS foo(false, true, 5) is 42 on all iterations including after DFG tier-up.
Python implementation reports "MemoryError" instead of doing things https://bugs.webkit.org/show_bug.cgi?id=106690 Source/JavaScriptCore: Reviewed by Oliver Hunt. The bug was that the CFA was assuming that a variable is dead at the end of a basic block and hence doesn't need to be merged to the next block if the last mention of the variable was dead. This is almost correct, except that it doesn't work if the last mention is a GetLocal - the GetLocal itself may be dead, but that doesn't mean that the variable is dead - it may still be live. The appropriate thing to do is to look at the GetLocal's Phi. If the variable is used in the next block then the next block will have a reference to the last mention in our block unless that last mention is a GetLocal, in which case it will link to the Phi. Doing it this way captures everything that the CFA wants: if the last use is a live GetLocal then the CFA needs to consider the GetLocal itself for possible refinements to the proof of the value in the variable, but if the GetLocal is dead, then this must mean that the variable is not mentioned in the block but may still be "passed through" it, which is what the Phi will tell us. Note that it is not possible for the GetLocal to refer to anything other than a Phi, and it is also not possible for the last mention of a variable to be a dead GetLocal while there are other mentions that aren't dead - if there had been SetLocals or GetLocals prior to the dead one then the dead one wouldn't have been emitted by the parser. This also fixes a similar bug in the handling of captured variables. If a variable is captured, then it doesn't matter if the last mention is dead, or not. Either way, we already know that a captured variable will be live in the next block, so we must merge it no matter what. Finally, this change makes the output of Operands dumping a bit more verbose: it now prints the variable name next to each variable's dump. I've often found the lack of this information confusing particularly for operand dumps that involve a lot of variables. * bytecode/Operands.h: (JSC::dumpOperands): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::mergeStateAtTail): LayoutTests: Reviewed by Oliver Hunt. * fast/js/dfg-cfa-merge-with-dead-use-at-tail-expected.txt: Added. * fast/js/dfg-cfa-merge-with-dead-use-at-tail.html: Added. * fast/js/jsc-test-list: * fast/js/script-tests/dfg-cfa-merge-with-dead-use-at-tail.js: Added. (foo): Canonical link: https://commits.webkit.org/125075@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139687 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-01-15 00:53:39 +00:00
PASS successfullyParsed is true
TEST COMPLETE