repo.or.cz
/
qtwebkit.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
Update ReadMe.md
[qtwebkit.git]
/
JSTests
/
microbenchmarks
/
poly-chain-access-different-prototypes-simple.js
blob
e845c1c9191a4c3dda3b8a4c38a722c6806fc720
1
(function() {
2
function Foo() { }
3
Foo.prototype.f = 42;
4
function Bar() { }
5
Bar.prototype = new Foo();
6
function Baz() { }
7
Baz.prototype = new Foo();
8
9
function foo(o, p) {
10
var n = 1000000;
11
var result = 0;
12
for (var i = 0; i < n; ++i) {
13
result += o.f;
14
var tmp = o;
15
o = p;
16
p = tmp;
17
}
18
19
if (result != n * 42)
20
throw "Error: bad result: " + result;
21
}
22
23
foo(new Bar(), new Baz());
24
})();