ysuzuki@apple.com | b064c65 | 2019-09-11 22:36:52 +0000 | [diff] [blame] | 1 | function shouldBe(actual, expected) { |
| 2 | if (actual !== expected) |
| 3 | throw new Error('bad value: ' + actual); |
| 4 | } |
| 5 | |
| 6 | function test(string) { |
| 7 | return string.codePointAt(0); |
| 8 | } |
| 9 | noInline(test); |
| 10 | |
| 11 | function breaking(string) { |
| 12 | return string.codePointAt(1); |
| 13 | } |
| 14 | noInline(breaking); |
| 15 | |
| 16 | var string = "𠮷野家"; |
| 17 | shouldBe(string.length, 4); |
| 18 | for (var i = 0; i < 1e6; ++i) { |
| 19 | shouldBe(test(string), 0x20bb7); |
| 20 | shouldBe(test("𠮷"), 0x20bb7); |
| 21 | shouldBe(breaking(string), 0xdfb7); |
| 22 | } |