Index: test/mjsunit/stack-overflow-arity-catch-inline.js |
diff --git a/test/webkit/fast/js/stack-overflow-arrity-catch.js b/test/mjsunit/stack-overflow-arity-catch-inline.js |
similarity index 67% |
copy from test/webkit/fast/js/stack-overflow-arrity-catch.js |
copy to test/mjsunit/stack-overflow-arity-catch-inline.js |
index f36512adbb835d50431a84e4b7cff97b38953ff0..ed9d441facc048187a4b9b004ae852d56583a986 100644 |
--- a/test/webkit/fast/js/stack-overflow-arrity-catch.js |
+++ b/test/mjsunit/stack-overflow-arity-catch-inline.js |
@@ -21,63 +21,73 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-description('Test that if an arrity check causes a stack overflow, the exception goes to the right catch'); |
+// Flags: --turbo --allow-natives-syntax |
+ |
+var stackOverflowIn20ArgFn = false, reached20ArgFn = false, |
+ gotRegexCatch = false, gotDateCatch = false; |
function funcWith20Args(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, |
arg9, arg10, arg11, arg12, arg13, arg14, arg15, |
arg16, arg17, arg18, arg19, arg20) |
{ |
- debug("ERROR: Shouldn't arrive in 20 arg function!"); |
+ reached20ArgFn = true; |
} |
-var gotRightCatch = false, gotWrongCatch1 = false, gotWrongCatch2 = false; |
+%OptimizeFunctionOnNextCall(funcWith20Args); |
+funcWith20Args(1, 2, 3, 4, 5, 6); |
+reached20ArgFn = false; |
-function test1() |
+function mutual_recursion_1() |
{ |
try { |
- test2(); |
+ mutual_recursion_2(); |
} catch (err) { |
// Should get here because of stack overflow, |
- // now cause a stack overflow exception due to arrity processing |
+ // now cause a stack overflow exception due to arity processing |
try { |
var dummy = new RegExp('a|b|c'); |
} catch(err) { |
- // (1) It is dendent on the stack size if we arrive here, in (2) or |
+ // (1) It is dependent on the stack size if we arrive here, in (2) or |
// both. |
- gotWrongCatch1 = true; |
+ gotRegexCatch = true; |
} |
try { |
funcWith20Args(1, 2, 3); |
} catch (err2) { |
- gotRightCatch = true; |
+ stackOverflowIn20ArgFn = true; |
} |
} |
} |
-function test2() |
+function mutual_recursion_2() |
{ |
try { |
var dummy = new Date(); |
} catch(err) { |
- // (2) It is dendent on the stack size if we arrive here, in (1) or |
+ // (2) It is dependent on the stack size if we arrive here, in (1) or |
// both. |
- gotWrongCatch2 = true; |
+ gotDateCatch = true; |
} |
try { |
- test1(); |
+ mutual_recursion_1(); |
} catch (err) { |
// Should get here because of stack overflow, |
- // now cause a stack overflow exception due to arrity processing |
+ // now cause a stack overflow exception due to arity processing |
try { |
funcWith20Args(1, 2, 3, 4, 5, 6); |
} catch (err2) { |
- gotRightCatch = true; |
+ stackOverflowIn20ArgFn = true; |
} |
} |
} |
-test1(); |
+%OptimizeFunctionOnNextCall(mutual_recursion_1); |
+%OptimizeFunctionOnNextCall(mutual_recursion_2); |
+ |
+mutual_recursion_1(); |
-shouldBeTrue("gotRightCatch"); |
+// assertTrue(gotDateCatch || gotRegexCatch); |
+assertTrue(reached20ArgFn); |
+assertTrue(!stackOverflowIn20ArgFn); |