mirror of
https://github.com/tc39/test262.git
synced 2025-09-19 08:08:00 +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)
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
// Makes sure we don't use base's tag register on 32-bit when an inline cache fails and jumps to the slow path
|
|
// because the slow path depends on the base being present.
|
|
|
|
var createCustomGetterObject = $vm.createCustomGetterObject;
|
|
|
|
function assert(b) {
|
|
if (!b)
|
|
throw new Error("baddd");
|
|
}
|
|
noInline(assert);
|
|
|
|
let customGetter = createCustomGetterObject();
|
|
let otherObj = {
|
|
customGetter: 20
|
|
};
|
|
function randomFunction() {}
|
|
noInline(randomFunction);
|
|
|
|
function foo(o, c) {
|
|
let baz = o.customGetter;
|
|
if (c) {
|
|
o = 42;
|
|
}
|
|
let jaz = o.foo;
|
|
let kaz = jaz + "hey";
|
|
let raz = kaz + "hey";
|
|
let result = o.customGetter;
|
|
randomFunction(!c, baz, jaz, kaz, raz);
|
|
return result;
|
|
}
|
|
noInline(foo);
|
|
|
|
for (let i = 0; i < 10000; i++) {
|
|
switch (i % 2) {
|
|
case 0:
|
|
assert(foo(customGetter) === 100);
|
|
break;
|
|
case 1:
|
|
assert(foo(otherObj) === 20);
|
|
break;
|
|
}
|
|
}
|
|
assert(foo({hello: 20, world:50, customGetter: 40}) === 40); // Make sure we don't trample registers in "o.customGetter" inline cache failure in foo.
|