utatane.tea@gmail.com | cb7ea56 | 2015-08-20 20:18:45 +0000 | [diff] [blame] | 1 | function shouldBe(actual, expected) |
| 2 | { |
| 3 | if (actual !== expected) |
| 4 | throw new Error('bad value: ' + actual); |
| 5 | } |
| 6 | |
| 7 | function assign(object, name, value) |
| 8 | { |
| 9 | object[name] = value; |
| 10 | } |
| 11 | noInline(assign); |
| 12 | |
| 13 | var string = 'hello'; |
| 14 | for (var i = 0; i < 10001; ++i) { |
| 15 | var object = {}; |
| 16 | if (i === 10000) { |
| 17 | assign(object, 42, 42); |
| 18 | shouldBe(object[42], 42); |
| 19 | shouldBe(object.hello, undefined); |
| 20 | } else { |
| 21 | assign(object, string, 42); |
| 22 | shouldBe(object[string], 42); |
| 23 | } |
| 24 | } |
| 25 | |