Changeset 180453 in webkit


Ignore:
Timestamp:
Feb 20, 2015 2:21:47 PM (9 years ago)
Author:
msaboff@apple.com
Message:

Layout Test js/regress-141098.html is failing on 32-bit Machines
https://bugs.webkit.org/show_bug.cgi?id=141848

Reviewed by Geoffrey Garen.

It appears that different control flow paths in probeAndRecurse() allowed the second time
through the test to recurse deeper before getting to the point of overflowing the stack.
Restructured the test so that the exact same control flow in probeAndRecurse() is used
both times we call it, including probing the depth of the stack. Now we pass a flag that
indicates whether or not we should try ever expanding eval strings or reuse the most
recent eval string.

  • js/script-tests/regress-141098.js:

(testEval):
(probeAndRecurse):

Location:
trunk/LayoutTests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r180448 r180453  
     12015-02-20  Michael Saboff  <msaboff@apple.com>
     2
     3        Layout Test js/regress-141098.html is failing on 32-bit Machines
     4        https://bugs.webkit.org/show_bug.cgi?id=141848
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        It appears that different control flow paths in probeAndRecurse() allowed the second time
     9        through the test to recurse deeper before getting to the point of overflowing the stack.
     10        Restructured the test so that the exact same control flow in probeAndRecurse() is used
     11        both times we call it, including probing the depth of the stack.  Now we pass a flag that
     12        indicates whether or not we should try ever expanding eval strings or reuse the most
     13        recent eval string.
     14
     15        * js/script-tests/regress-141098.js:
     16        (testEval):
     17        (probeAndRecurse):
     18
    1192015-02-20  Brent Fulgham  <bfulgham@apple.com>
    220
  • trunk/LayoutTests/js/script-tests/regress-141098.js

    r180448 r180453  
    1 //@ skip
    2 
    31description("Regression test for https://webkit.org/b/141098. Make sure eval() properly handles running out of stack space. This test should run without crashing.");
    42
     
    1311    var count = 1;
    1412
    15     if (!maxIterations) {
     13    if (!maxIterations)
    1614        var result = eval(lastEvalString);
    17     } else {
     15    else {
    1816        for (var iter = 0; iter < maxIterations; count *= 4, iter++) {
    1917            var evalString = "\"dummy\".valueOf(";
     
    2725            evalString +=  ");";
    2826
    29             lastEvalString = evalString;
     27            if (maxIterations > 1)
     28                lastEvalString = evalString;
    3029            result = eval(evalString);
    3130        }
     
    3534}
    3635
    37 function probeAndRecurse(depth)
     36function probeAndRecurse(depth, reuseEvalString)
    3837{
    3938    var result;
    4039
    4140    // Probe stack depth
    42     if (depth > 0) {
    43         try {
    44             result = probeAndRecurse(depth+1);
     41    try {
     42        result = probeAndRecurse(depth+1, reuseEvalString);
    4543
    46             if (!result) {
    47                 try {
    48                     testEval(1);
    49                 } catch (e) {
    50                     return -49;
    51                 }
    52             } else
    53                 return result + 1
    54         } catch (e) {
    55             // We exceeded stack space, now return up the stack until we can execute a simple eval.
    56             // Then run an eval test to exceed stack.
    57             return -49;
    58         }
    59     } else if (depth != 0)
    60         return probeAndRecurse(depth+1);
     44        if (!result) {
     45            try {
     46                testEval(1);
     47            } catch (e) {
     48                return -49;
     49            }
     50        } else
     51            return result + 1
     52    } catch (e) {
     53        // We exceeded stack space, now return up the stack until we can execute a simple eval.
     54        // Then run an eval test to exceed stack.
     55        return -49;
     56    }
    6157
    6258    try {
    63         testEval((depth > 0) ? 20 : 0);
     59        testEval(reuseEvalString ? 0 : 20);
    6460    } catch (e) {
    6561        testPassed("Exception: " + e);
     
    6965}
    7066
    71 var depth = probeAndRecurse(1);
     67var depth = probeAndRecurse(0, false);
    7268
    7369// Tier up the eval'ed code.
     
    7773    testEval(0);
    7874
    79 probeAndRecurse(-depth);
     75probeAndRecurse(0, true);
Note: See TracChangeset for help on using the changeset viewer.