|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +// This file is supposed to be run in the d8 shell, so no Node.js API is |
| 4 | +// used here. |
| 5 | +// To enable post-mortem support in d8, build it with |
| 6 | +// v8_postmortem_support = true. |
| 7 | +// Run this file with `lldb -- d8 --abort_on_uncaught_exception d8-scenario.js` |
| 8 | + |
| 9 | +class Class { |
| 10 | + constructor() { |
| 11 | + this.x = 1; |
| 12 | + this.y = 123.456; |
| 13 | + |
| 14 | + this.hashmap = {}; |
| 15 | + } |
| 16 | + |
| 17 | + method(num, str, arr) { |
| 18 | + this.hashmap['some-key'] = num; |
| 19 | + this.hashmap['other-key'] = str; |
| 20 | + this.hashmap['cons-string'] = |
| 21 | + 'this could be a bit smaller, but v8 wants big str.'; |
| 22 | + this.hashmap['cons-string'] += this.hashmap['cons-string']; |
| 23 | + this.hashmap['internalized-string'] = 'foobar'; |
| 24 | + |
| 25 | + this.hashmap['array'] = [true, 1, undefined, null, 'test', Class]; |
| 26 | + this.hashmap['long-array'] = arr; |
| 27 | + this.hashmap['array-buffer'] = new Uint8Array( |
| 28 | + [0x01, 0x02, 0x03, 0x04, 0x05] |
| 29 | + ).buffer; |
| 30 | + this.hashmap['uint8-array'] = new Uint8Array( |
| 31 | + [0x01, 0x40, 0x60, 0x80, 0xf0, 0xff] |
| 32 | + ); |
| 33 | + |
| 34 | + this.hashmap[0] = null; |
| 35 | + this.hashmap[4] = undefined; |
| 36 | + this.hashmap[23] = /regexp/; |
| 37 | + this.hashmap[25] = (a, b) => a + b; |
| 38 | + throw new Error('Uncaught'); |
| 39 | + } |
| 40 | +} |
| 41 | + |
| 42 | +function closure() { |
| 43 | + const c = new Class(); |
| 44 | + c.method(42, 'ohai', new Array(20).fill(5)); |
| 45 | +} |
| 46 | + |
| 47 | +closure(); |
0 commit comments