blob: 7eacd172cca146ffd440fd84829f38ca791f2151 [file] [log] [blame]
var createBuiltin = $vm.createBuiltin;
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
var builtin = createBuiltin(`(function (target) {
return @toObject(target, "");
})`);
noInline(builtin);
(function () {
for (var i = 0; i < 1e4; ++i) {
var arg = {};
var object = builtin(arg);
shouldBe(object, arg);
var arg = [];
var object = builtin(arg);
shouldBe(object, arg);
var arg = function () { };
var object = builtin(arg);
shouldBe(object, arg);
}
}());