Chromium Code Reviews| Index: test/mjsunit/regress/regress-319722-ArrayBuffer.js |
| diff --git a/test/mjsunit/stack-traces-custom-lazy.js b/test/mjsunit/regress/regress-319722-ArrayBuffer.js |
| similarity index 72% |
| copy from test/mjsunit/stack-traces-custom-lazy.js |
| copy to test/mjsunit/regress/regress-319722-ArrayBuffer.js |
| index 91d97f3739dc746434731352a0ec7ade0d839484..6d4ecd03f6cd79e5699371e0896182ef14162dfd 100644 |
| --- a/test/mjsunit/stack-traces-custom-lazy.js |
| +++ b/test/mjsunit/regress/regress-319722-ArrayBuffer.js |
| @@ -25,25 +25,35 @@ |
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| -function testPrepareStackTrace(closure) { |
| - var error = undefined; |
| +// Flags: --nostress-opt --allow-natives-syntax |
| +var maxSize = %MaxSmi() + 1; |
| +var ab = null; |
| + |
| +// Allocate the largest ArrayBuffer we can on this architecture. |
| +for (k = 8; k >= 1 && ab == null; k = k/2) { |
|
Jakob Kummerow
2013/11/15 15:13:08
the update step should be "k = k >> 1", otherwise
Dmitry Lomov (no reviews)
2013/11/15 16:03:07
No, I think it is fine as it is, because 1/2 = 0.5
|
| try { |
| - closure(); |
| - assertUnreachable(); |
| + ab = new ArrayBuffer(maxSize * k); |
| } catch (e) { |
| - error = e; |
| + ab = null; |
| } |
| +} |
| + |
| +assertTrue(ab != null); |
| - // We expect custom formatting to be lazy. Setting the custom |
| - // function right before calling error.stack should be fine. |
| - Error.prepareStackTrace = function(e, frames) { |
| - return "bar"; |
| - } |
| - assertEquals("bar", error.stack); |
| - Error.prepareStackTrace = undefined; |
| +function TestArray(constr) { |
| + assertThrows(function() { |
| + new constr(ab, 0, maxSize); |
| + }, RangeError); |
| } |
| -testPrepareStackTrace(function() { throw new Error("foo"); }); |
| -testPrepareStackTrace(function f() { f(); }); |
| +TestArray(Uint8Array); |
| +TestArray(Int8Array); |
| +TestArray(Uint16Array); |
| +TestArray(Int16Array); |
| +TestArray(Uint32Array); |
| +TestArray(Int32Array); |
| +TestArray(Float32Array); |
| +TestArray(Float64Array); |
| +TestArray(Uint8ClampedArray); |