blob: db9a216531f03ee4128f14b0c9081af7e6fc529b [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4//
5// Flags: --allow-natives-syntax --typed-array-max-size-in-heap=1
6
7var foo = (function () {
8 var y = 0;
9 return function foo(x) {
10 // Needs to be an external array.
11 var a = new Float64Array(32);
12 a[0] = 42;
13 y = x + 0.1; // This has to allocate.
14 return a[0];
15 }
16})();
17
18foo(1);
19foo(1);
20%OptimizeFunctionOnNextCall(foo);
21foo(1);
22// Try to force a GC during allocation in above marked line.
23for (var i = 0; i < 20; ++i) {
24 %SetAllocationTimeout(i, i, false);
25 assertEquals(42, foo(2));
26}