]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/put-by-id-throw-through-optimized-code.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / put-by-id-throw-through-optimized-code.js
CommitLineData
81345200
A
1function foo(o) {
2 "use strict";
3 o.f = 42;
4}
5
6noInline(foo);
7
8for (var i = 0; i < 100000; ++i) {
9 var o = {};
10 foo(o);
11 if (o.f != 42)
12 throw "Error: bad result: " + o.f;
13 o = {f:23};
14 foo(o);
15 if (o.f != 42)
16 throw "Error: bad result: " + o.f;
17 o = {g:12};
18 foo(o);
19 if (o.f != 42)
20 throw "Error: bad result: " + o.f;
21}
22
23var didThrow;
24try {
25 var o = {};
26 Object.freeze(o);
27 foo(o);
28} catch (e) {
29 didThrow = e;
30}
31
32if (!didThrow || didThrow.toString().indexOf("TypeError:") != 0)
33 throw "Error: didn't throw or threw wrong exception: " + didThrow;