utatane.tea@gmail.com | 9842c04 | 2015-07-27 23:51:28 +0000 | [diff] [blame] | 1 | function shouldBe(actual, expected) { |
| 2 | if (actual !== expected) |
| 3 | throw new Error('bad value: ' + actual); |
| 4 | } |
| 5 | |
| 6 | function testing(object) { |
| 7 | shouldBe(object[0], 0); |
| 8 | shouldBe(object[1], 1); |
| 9 | shouldBe(object[2], "String"); |
| 10 | } |
| 11 | noInline(testing); |
| 12 | |
| 13 | function testing2(object) { |
| 14 | shouldBe(object[0], 0); |
| 15 | shouldBe(object[1], 1); |
| 16 | shouldBe(object[2], "String"); |
| 17 | } |
| 18 | noInline(testing2); |
| 19 | |
| 20 | for (var i = 0; i < 10000; ++i) |
| 21 | testing({ |
| 22 | 0: 0, |
| 23 | 1: 1, |
| 24 | 2: "String" |
| 25 | }); |
| 26 | |
| 27 | testing({ |
| 28 | 0: 0, |
| 29 | get 1() { |
| 30 | return 1; |
| 31 | }, |
| 32 | 2: "String" |
| 33 | }); |
| 34 | |
| 35 | for (var i = 0; i < 10000; ++i) |
| 36 | testing2({ |
| 37 | 0: 0, |
| 38 | get 1() { |
| 39 | return 1; |
| 40 | }, |
| 41 | 2: "String" |
| 42 | }); |
| 43 | |
| 44 | /* vim: set sw=4 ts=4 et tw=80 : */ |