mirror of
https://github.com/tc39/test262.git
synced 2025-05-04 15:00:42 +02:00
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
63 lines
983 B
JavaScript
63 lines
983 B
JavaScript
// This test verifies that we don't crash in FTL generated code due to lack of a store barrier
|
|
// for a put-by-val when we don't know when the value was allocated.
|
|
|
|
class MyNumber
|
|
{
|
|
constructor(v)
|
|
{
|
|
this._v = v;
|
|
}
|
|
|
|
plusOne()
|
|
{
|
|
return this._v + 1;
|
|
}
|
|
}
|
|
|
|
noDFG(MyNumber.plusOne);
|
|
|
|
let count = 0;
|
|
let bogus = null;
|
|
|
|
function bar()
|
|
{
|
|
count++;
|
|
|
|
if (!(count % 100))
|
|
fullGC();
|
|
return new MyNumber(count);
|
|
}
|
|
|
|
noDFG(bar);
|
|
noInline(bar);
|
|
|
|
function foo(index, arg)
|
|
{
|
|
var result = [arg[0]];
|
|
if (arg.length > 1)
|
|
result[1] = bar();
|
|
return result;
|
|
}
|
|
|
|
noInline(foo);
|
|
|
|
function test()
|
|
{
|
|
for (let i = 0; i < 50000; i++)
|
|
{
|
|
let a = [1, i];
|
|
let x = foo(i, a);
|
|
|
|
if (!(count % 100))
|
|
edenGC();
|
|
|
|
for (let j = 0; j < 100; j++)
|
|
bogus = new MyNumber(-1);
|
|
|
|
if ((count + 1) != x[1].plusOne())
|
|
throw("Wrong value for count");
|
|
}
|
|
}
|
|
|
|
test();
|