Bug 51358 - Should check stack depth rather than using recursion limits in byte compi...
authorbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Dec 2010 23:56:36 +0000 (23:56 +0000)
committerbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Dec 2010 23:56:36 +0000 (23:56 +0000)
commit5554a5e753eee5f419225a5721a1f98c81f2a7a6
treeacabf34f2a30d5f7fba3b917ee50bf7ecb9613c9
parent01f312ab96020e49a3c417c999ac3fc6ca9345fc
Bug 51358 - Should check stack depth rather than using recursion limits in byte compilation

Reviewed by Olver Hunt.

The current implementation of recursion limit checking is not safe on smaller stacks.
Switch to using a common mechanism, shared with the parser, to check recursion limits.

Make bytecompiler use StackBounds. Empirical testing shows emitStrcat to have the largest
footprint on the stack, at just under 1k on x86-64.  Given this, the default recursion
check (requiring 4k of available space to recurse) seems reasonable.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::emitNode):
(JSC::BytecodeGenerator::emitNodeInConditionContext):
* bytecompiler/NodesCodegen.cpp:
(JSC::BinaryOpNode::emitStrcat):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@74374 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JavaScriptCore/ChangeLog
JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
JavaScriptCore/bytecompiler/BytecodeGenerator.h