PageRenderTime 21ms CodeModel.GetById 11ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 1ms

/js/src/jit-test/tests/basic/testMethodWriteBarrier3.js

http://github.com/zpao/v8monkey
JavaScript | 27 lines | 23 code | 4 blank | 0 comment | 1 complexity | 671df47852cb2a130e261bb445c3c9dd MD5 | raw file
 1function g() {}
 2
 3function h() {
 4    for (var i = 0; i < 9; i++)
 5	x.f = i;
 6}
 7
 8function j() {
 9    x.f();
10}
11
12var x = {f: 0.7, g: g};
13x.g();  // interpreter brands x
14h();
15print(shapeOf(x));
16x.f = function (){}; // does not change x's shape
17j();
18print(shapeOf(x));
19h(); // should change x's shape
20
21var thrown = 'none';
22try {
23    j(); // should throw since x.f === 8
24} catch (exc) {
25    thrown = exc.name;
26}
27assertEq(thrown, 'TypeError');