Commit 4f2ad8a1 authored by fpizlo@apple.com's avatar fpizlo@apple.com

Incorrect behavior on emscripten-compiled cube2hash

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

Source/JavaScriptCore: 

Reviewed by Mark Hahnenberg.
        
If PutClosureVar is may-aliased to another PutClosureVar or GetClosureVar
then we should bail attempts to CSE.

* dfg/DFGCSEPhase.cpp:
(JSC::DFG::CSEPhase::scopedVarLoadElimination):
(JSC::DFG::CSEPhase::scopedVarStoreElimination):

LayoutTests: 

Reviewed by Mark Hahnenberg.
        
Add the test that actually failed as a JSRegress test. We should track its
performance anyway.
        
Add a regression test for the actual failure.
        
Add .html and -expected.txt files for a JSRegress test that is already in
the repo.

* fast/js/dfg-get-closure-var-put-closure-var-interference.html: Added.
* fast/js/dfg-get-closure-var-put-closure-var-interference-expected.txt: Added.
* fast/js/regress/array-nonarray-polymorhpic-access-expected.txt: Added.
* fast/js/regress/array-nonarray-polymorhpic-access.html: Added.
* fast/js/regress/emscripten-cube2hash-expected.txt: Added.
* fast/js/regress/emscripten-cube2hash.html: Added.
* fast/js/regress/script-tests/emscripten-cube2hash.js: Added.
(.Module.string_appeared_here):
(else.Module.string_appeared_here):
(else.else.Module.string_appeared_here):
(else.else):
(globalEval):
(Runtime.stackSave):
(Runtime.stackRestore):
(Runtime.forceAlign):
(Runtime.isNumberType):
(Runtime.isPointerType):
(Runtime.isStructType):
(or64):
(and64):
(xor64):
(getNativeTypeSize):
(getNativeFieldSize):
(dedup):
(.set var):
(getAlignSize):
(calculateStructAlignment):
(.else.alignment):
(generateStructInfo):
(dynCall):
(addFunction):
(removeFunction):
(warnOnce):
(.Runtime.funcWrappers.func):
(getFuncWrapper):
(UTF8Processor.this.processCChar):
(UTF8Processor.this.processJSString):
(UTF8Processor):
(stackAlloc):
(staticAlloc):
(dynamicAlloc):
(alignMemory):
(makeBigInt):
(assert):
(ccall):
(getCFunc):
(.toC):
(.fromC):
(ccallFunc):
(setValue):
(getValue):
(.set else):
(.set return):
(allocate):
(Pointer_stringify):
(alignMemoryPage):
(enlargeMemory):
(callRuntimeCallbacks):
(preRun):
(ensureInitRuntime):
(preMain):
(exitRuntime):
(postRun):
(addOnPreRun):
(addOnInit):
(addOnPreMain):
(addOnExit):
(addOnPostRun):
(intArrayFromString):
(intArrayToString):
(writeStringToMemory):
(writeArrayToMemory):
(unSign):
(reSign):
(Math.string_appeared_here):
(addRunDependency):
(removeRunDependency):
(loadMemoryInitializer.applyData):
(loadMemoryInitializer.set addOnPreRun):
(__ATINIT__.push):
(STATIC_BASE):
(copyTempDouble):
(___setErrNo):
(PATH.splitPath):
(PATH.normalizeArray):
(PATH.normalize.join):
(PATH.normalize):
(PATH.dirname):
(PATH.basename):
(PATH.join):
(PATH.trim):
(PATH.relative):
(TTY.register):
(TTY.stream_ops.open):
(TTY.stream_ops.close):
(TTY.stream_ops.read):
(TTY.stream_ops.write):
(TTY.default_tty_ops.get_char):
(TTY.default_tty_ops.put_char):
(TTY.default_tty1_ops.put_char):
(MEMFS.mount):
(MEMFS.create_node):
(MEMFS.node_ops.getattr):
(MEMFS.node_ops.setattr):
(MEMFS.node_ops.lookup):
(MEMFS.node_ops.mknod):
(MEMFS.node_ops.rename):
(MEMFS.node_ops.unlink):
(MEMFS.node_ops.rmdir):
(MEMFS.node_ops.readdir):
(MEMFS.node_ops.symlink):
(MEMFS.node_ops.readlink):
(MEMFS.stream_ops.set else):
(MEMFS.stream_ops.read):
(MEMFS.stream_ops.write):
(MEMFS.stream_ops.llseek):
(MEMFS.stream_ops.allocate):
(MEMFS.stream_ops.set return):
(MEMFS.stream_ops.mmap):
(_fflush):
(FS.ErrnoError):
(FS.handleFSError):
(FS.hashName):
(FS.hashAddNode):
(FS.hashRemoveNode):
(FS.lookupNode):
(FS.):
(FS.destroyNode):
(FS.isRoot):
(FS.isMountpoint):
(FS.isFile):
(FS.isDir):
(FS.isLink):
(FS.isChrdev):
(FS.isBlkdev):
(FS.isFIFO):
(FS.cwd):
(FS.var):
(FS.lookupPath):
(FS.getPath):
(FS.modeStringToFlags):
(FS.flagsToPermissionString):
(FS.nodePermissions):
(FS.mayLookup):
(FS.mayMknod):
(FS.mayCreate):
(FS.mayDelete):
(FS.mayOpen):
(FS.chrdev_stream_ops.open):
(FS.chrdev_stream_ops.llseek):
(FS.major):
(FS.minor):
(FS.makedev):
(FS.registerDevice):
(FS.getDevice):
(FS.nextfd):
(FS.getStream):
(FS.closeStream):
(FS.getMode):
(FS.joinPath):
(FS.absolutePath):
(FS.standardizePath):
(FS.findObject):
(FS.analyzePath):
(FS.createFolder):
(FS.createPath):
(FS.createFile):
(FS.createDataFile):
(FS.createDevice):
(FS.createLink):
(FS.forceLoadFile):
(FS.LazyUint8Array):
(FS.LazyUint8Array.prototype.get if):
(FS.LazyUint8Array.prototype):
(FS.LazyUint8Array.prototype.setDataGetter):
(FS.LazyUint8Array.prototype.cacheLength.doXHR):
(FS.LazyUint8Array.prototype.cacheLength):
(FS.get Object):
(FS.get var):
(FS.keys.forEach):
(FS.processData.finish):
(FS.processData):
(FS.else):
(FS.createPreloadedFile):
(FS.createDefaultDirectories):
(FS.createDefaultDevices.):
(FS.createDefaultDevices):
(FS.createStandardStreams):
(FS.staticInit):
(FS.init):
(FS.quit):
(FS.mount):
(FS.lookup):
(FS.mknod):
(FS.create):
(FS.mkdir):
(FS.mkdev):
(FS.symlink):
(FS.rename):
(FS.rmdir):
(FS.readdir):
(FS.unlink):
(FS.readlink):
(FS.stat):
(FS.lstat):
(FS.chmod):
(FS.lchmod):
(FS.fchmod):
(FS.chown):
(FS.lchown):
(FS.fchown):
(FS.truncate):
(FS.ftruncate):
(FS.utime):
(FS.open):
(FS.close):
(FS.llseek):
(FS.read):
(FS.write):
(FS.allocate):
(FS.mmap):
(_send):
(_pwrite):
(_write):
(_fwrite):
(__reallyNegative):
(.getNextArg):
(.switch.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.break):
(.switch.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.break):
(_fprintf):
(_printf):
(_fputs):
(_fputc):
(_puts):
(_abort):
(___errno_location):
(_sbrk.Runtime.dynamicAlloc):
(_sbrk):
(_sysconf):
(_time):
(Browser.mainLoop.pause):
(Browser.mainLoop.resume):
(Browser.mainLoop.updateStatus):
(Browser.init.imagePlugin.string_appeared_here):
(Browser.init.img.onload):
(Browser.init.img.onerror):
(Browser.init.audioPlugin.string_appeared_here):
(Browser.init.finish):
(Browser.init.fail):
(Browser.init.audio.onerror.encode64):
(Browser.init.audio.onerror):
(Browser.init.audio):
(Browser.init.else):
(Browser.init.pointerLockChange):
(Browser.init.canvas):
(Browser.init):
(Browser.destroyContext):
(Browser.fullScreenChange):
(Browser.requestFullScreen):
(Browser.requestAnimationFrame):
(Browser.safeRequestAnimationFrame):
(Browser.safeSetTimeout):
(Browser.safeSetInterval):
(Browser.getMimetype):
(Browser.getUserMedia):
(Browser.getMovementX):
(Browser.getMovementY):
(Browser.calculateMouseEvent):
(Browser.xhr.onload):
(Browser.xhrLoad):
(Browser.updateResizeListeners):
(Browser.setCanvasSize):
(Browser.setFullScreenCanvasSize):
(Browser.setWindowedCanvasSize):
(__ATINIT__.unshift):
(__ATMAIN__.push):
(__ATEXIT__.push):
(Module.string_appeared_here):
(invoke_ii):
(invoke_v):
(invoke_iii):
(invoke_vi):
(asmPrintInt):
(asmPrintFloat):
(asm):
(Runtime.stackAlloc):
(i64Math):
(i64Math.):
(Module.string_appeared_here.Module.callMain.callMain.pad):
(Module.string_appeared_here.Module.callMain):
(run.doRun):
(run.else):
(run):
(exit):
(abort):
* fast/js/script-tests/dfg-get-closure-var-put-closure-var-interference.js: Added.
(foo):
(thingy.return.bar):
(thingy.return.baz):
(thingy):
(runIt):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154344 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 620c79bc
2013-08-19 Filip Pizlo <fpizlo@apple.com>
Incorrect behavior on emscripten-compiled cube2hash
https://bugs.webkit.org/show_bug.cgi?id=120033
Reviewed by Mark Hahnenberg.
Add the test that actually failed as a JSRegress test. We should track its
performance anyway.
Add a regression test for the actual failure.
Add .html and -expected.txt files for a JSRegress test that is already in
the repo.
* fast/js/dfg-get-closure-var-put-closure-var-interference.html: Added.
* fast/js/dfg-get-closure-var-put-closure-var-interference-expected.txt: Added.
* fast/js/regress/array-nonarray-polymorhpic-access-expected.txt: Added.
* fast/js/regress/array-nonarray-polymorhpic-access.html: Added.
* fast/js/regress/emscripten-cube2hash-expected.txt: Added.
* fast/js/regress/emscripten-cube2hash.html: Added.
* fast/js/regress/script-tests/emscripten-cube2hash.js: Added.
(.Module.string_appeared_here):
(else.Module.string_appeared_here):
(else.else.Module.string_appeared_here):
(else.else):
(globalEval):
(Runtime.stackSave):
(Runtime.stackRestore):
(Runtime.forceAlign):
(Runtime.isNumberType):
(Runtime.isPointerType):
(Runtime.isStructType):
(or64):
(and64):
(xor64):
(getNativeTypeSize):
(getNativeFieldSize):
(dedup):
(.set var):
(getAlignSize):
(calculateStructAlignment):
(.else.alignment):
(generateStructInfo):
(dynCall):
(addFunction):
(removeFunction):
(warnOnce):
(.Runtime.funcWrappers.func):
(getFuncWrapper):
(UTF8Processor.this.processCChar):
(UTF8Processor.this.processJSString):
(UTF8Processor):
(stackAlloc):
(staticAlloc):
(dynamicAlloc):
(alignMemory):
(makeBigInt):
(assert):
(ccall):
(getCFunc):
(.toC):
(.fromC):
(ccallFunc):
(setValue):
(getValue):
(.set else):
(.set return):
(allocate):
(Pointer_stringify):
(alignMemoryPage):
(enlargeMemory):
(callRuntimeCallbacks):
(preRun):
(ensureInitRuntime):
(preMain):
(exitRuntime):
(postRun):
(addOnPreRun):
(addOnInit):
(addOnPreMain):
(addOnExit):
(addOnPostRun):
(intArrayFromString):
(intArrayToString):
(writeStringToMemory):
(writeArrayToMemory):
(unSign):
(reSign):
(Math.string_appeared_here):
(addRunDependency):
(removeRunDependency):
(loadMemoryInitializer.applyData):
(loadMemoryInitializer.set addOnPreRun):
(__ATINIT__.push):
(STATIC_BASE):
(copyTempDouble):
(___setErrNo):
(PATH.splitPath):
(PATH.normalizeArray):
(PATH.normalize.join):
(PATH.normalize):
(PATH.dirname):
(PATH.basename):
(PATH.join):
(PATH.trim):
(PATH.relative):
(TTY.register):
(TTY.stream_ops.open):
(TTY.stream_ops.close):
(TTY.stream_ops.read):
(TTY.stream_ops.write):
(TTY.default_tty_ops.get_char):
(TTY.default_tty_ops.put_char):
(TTY.default_tty1_ops.put_char):
(MEMFS.mount):
(MEMFS.create_node):
(MEMFS.node_ops.getattr):
(MEMFS.node_ops.setattr):
(MEMFS.node_ops.lookup):
(MEMFS.node_ops.mknod):
(MEMFS.node_ops.rename):
(MEMFS.node_ops.unlink):
(MEMFS.node_ops.rmdir):
(MEMFS.node_ops.readdir):
(MEMFS.node_ops.symlink):
(MEMFS.node_ops.readlink):
(MEMFS.stream_ops.set else):
(MEMFS.stream_ops.read):
(MEMFS.stream_ops.write):
(MEMFS.stream_ops.llseek):
(MEMFS.stream_ops.allocate):
(MEMFS.stream_ops.set return):
(MEMFS.stream_ops.mmap):
(_fflush):
(FS.ErrnoError):
(FS.handleFSError):
(FS.hashName):
(FS.hashAddNode):
(FS.hashRemoveNode):
(FS.lookupNode):
(FS.):
(FS.destroyNode):
(FS.isRoot):
(FS.isMountpoint):
(FS.isFile):
(FS.isDir):
(FS.isLink):
(FS.isChrdev):
(FS.isBlkdev):
(FS.isFIFO):
(FS.cwd):
(FS.var):
(FS.lookupPath):
(FS.getPath):
(FS.modeStringToFlags):
(FS.flagsToPermissionString):
(FS.nodePermissions):
(FS.mayLookup):
(FS.mayMknod):
(FS.mayCreate):
(FS.mayDelete):
(FS.mayOpen):
(FS.chrdev_stream_ops.open):
(FS.chrdev_stream_ops.llseek):
(FS.major):
(FS.minor):
(FS.makedev):
(FS.registerDevice):
(FS.getDevice):
(FS.nextfd):
(FS.getStream):
(FS.closeStream):
(FS.getMode):
(FS.joinPath):
(FS.absolutePath):
(FS.standardizePath):
(FS.findObject):
(FS.analyzePath):
(FS.createFolder):
(FS.createPath):
(FS.createFile):
(FS.createDataFile):
(FS.createDevice):
(FS.createLink):
(FS.forceLoadFile):
(FS.LazyUint8Array):
(FS.LazyUint8Array.prototype.get if):
(FS.LazyUint8Array.prototype):
(FS.LazyUint8Array.prototype.setDataGetter):
(FS.LazyUint8Array.prototype.cacheLength.doXHR):
(FS.LazyUint8Array.prototype.cacheLength):
(FS.get Object):
(FS.get var):
(FS.keys.forEach):
(FS.processData.finish):
(FS.processData):
(FS.else):
(FS.createPreloadedFile):
(FS.createDefaultDirectories):
(FS.createDefaultDevices.):
(FS.createDefaultDevices):
(FS.createStandardStreams):
(FS.staticInit):
(FS.init):
(FS.quit):
(FS.mount):
(FS.lookup):
(FS.mknod):
(FS.create):
(FS.mkdir):
(FS.mkdev):
(FS.symlink):
(FS.rename):
(FS.rmdir):
(FS.readdir):
(FS.unlink):
(FS.readlink):
(FS.stat):
(FS.lstat):
(FS.chmod):
(FS.lchmod):
(FS.fchmod):
(FS.chown):
(FS.lchown):
(FS.fchown):
(FS.truncate):
(FS.ftruncate):
(FS.utime):
(FS.open):
(FS.close):
(FS.llseek):
(FS.read):
(FS.write):
(FS.allocate):
(FS.mmap):
(_send):
(_pwrite):
(_write):
(_fwrite):
(__reallyNegative):
(.getNextArg):
(.switch.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.break):
(.switch.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.case.string_appeared_here.break):
(_fprintf):
(_printf):
(_fputs):
(_fputc):
(_puts):
(_abort):
(___errno_location):
(_sbrk.Runtime.dynamicAlloc):
(_sbrk):
(_sysconf):
(_time):
(Browser.mainLoop.pause):
(Browser.mainLoop.resume):
(Browser.mainLoop.updateStatus):
(Browser.init.imagePlugin.string_appeared_here):
(Browser.init.img.onload):
(Browser.init.img.onerror):
(Browser.init.audioPlugin.string_appeared_here):
(Browser.init.finish):
(Browser.init.fail):
(Browser.init.audio.onerror.encode64):
(Browser.init.audio.onerror):
(Browser.init.audio):
(Browser.init.else):
(Browser.init.pointerLockChange):
(Browser.init.canvas):
(Browser.init):
(Browser.destroyContext):
(Browser.fullScreenChange):
(Browser.requestFullScreen):
(Browser.requestAnimationFrame):
(Browser.safeRequestAnimationFrame):
(Browser.safeSetTimeout):
(Browser.safeSetInterval):
(Browser.getMimetype):
(Browser.getUserMedia):
(Browser.getMovementX):
(Browser.getMovementY):
(Browser.calculateMouseEvent):
(Browser.xhr.onload):
(Browser.xhrLoad):
(Browser.updateResizeListeners):
(Browser.setCanvasSize):
(Browser.setFullScreenCanvasSize):
(Browser.setWindowedCanvasSize):
(__ATINIT__.unshift):
(__ATMAIN__.push):
(__ATEXIT__.push):
(Module.string_appeared_here):
(invoke_ii):
(invoke_v):
(invoke_iii):
(invoke_vi):
(asmPrintInt):
(asmPrintFloat):
(asm):
(Runtime.stackAlloc):
(i64Math):
(i64Math.):
(Module.string_appeared_here.Module.callMain.callMain.pad):
(Module.string_appeared_here.Module.callMain):
(run.doRun):
(run.else):
(run):
(exit):
(abort):
* fast/js/script-tests/dfg-get-closure-var-put-closure-var-interference.js: Added.
(foo):
(thingy.return.bar):
(thingy.return.baz):
(thingy):
(runIt):
2013-08-20 Bruno de Oliveira Abinader <bruno.d@partner.samsung.com>
[css3-text] Implement CSS3 text-decoration shorthand
Tests that the DFG is appropriately conservative for may-aliased but not must-aliased PutClosureVar and GetClosureVar.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS runIt() is 113
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="script-tests/dfg-get-closure-var-put-closure-var-interference.js"></script>
<script src="resources/js-test-post.js"></script>
</body>
</html>
......@@ -143,6 +143,7 @@ fast/js/dfg-float32array
fast/js/dfg-float64array
fast/js/dfg-flush-get-local
fast/js/dfg-force-exit-then-sparse-conditional-constant-prop-in-loop
fast/js/dfg-get-closure-var-put-closure-var-interference
fast/js/dfg-get-by-id-unset-then-proto
fast/js/dfg-get-by-id-unset-then-proto-less-warmup
fast/js/dfg-get-by-id-unset-then-proto-more-warmup
......
JSRegress/array-nonarray-polymorhpic-access
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/array-nonarray-polymorhpic-access.js"></script>
<script src="resources/regress-post.js"></script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>
JSRegress/emscripten-cube2hash
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/emscripten-cube2hash.js"></script>
<script src="resources/regress-post.js"></script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>
description(
"Tests that the DFG is appropriately conservative for may-aliased but not must-aliased PutClosureVar and GetClosureVar."
);
function foo(bar, baz) {
var x = bar();
baz();
var y = bar();
return x + y;
}
function thingy() {
var x = 42;
return {
bar: function() {
return x;
},
baz: function() {
x = 71;
}
};
}
function runIt() {
var o = thingy();
return foo(o.bar, o.baz);
}
noInline(foo);
while (!dfgCompiled({f:foo}))
runIt();
shouldBe("runIt()", "113");
2013-08-19 Filip Pizlo <fpizlo@apple.com>
Incorrect behavior on emscripten-compiled cube2hash
https://bugs.webkit.org/show_bug.cgi?id=120033
Reviewed by Mark Hahnenberg.
If PutClosureVar is may-aliased to another PutClosureVar or GetClosureVar
then we should bail attempts to CSE.
* dfg/DFGCSEPhase.cpp:
(JSC::DFG::CSEPhase::scopedVarLoadElimination):
(JSC::DFG::CSEPhase::scopedVarStoreElimination):
2013-08-20 Gavin Barraclough <barraclough@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=120073
......
......@@ -256,9 +256,11 @@ private:
break;
}
case PutClosureVar: {
if (node->child2() == registers && node->varNumber() == varNumber)
if (node->varNumber() != varNumber)
break;
if (node->child2() == registers)
return node->child3().node();
break;
return 0;
}
case SetLocal: {
VariableAccessData* variableAccessData = node->variableAccessData();
......@@ -340,9 +342,11 @@ private:
Node* node = m_currentBlock->at(i);
switch (node->op()) {
case PutClosureVar: {
if (node->child1() == scope && node->child2() == registers && node->varNumber() == varNumber)
if (node->varNumber() != varNumber)
break;
if (node->child1() == scope && node->child2() == registers)
return node;
break;
return 0;
}
case GetClosureVar: {
......
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