Slide 1

Slide 1 text

2025.11.16 | JSConf JP 2025 | @progfay `Error.prototype.stack`: Present & Future

Slide 2

Slide 2 text

ɾWeb Frontend Engineer ɾI like... ɾ🔍 Researching Web Trends ɾ🎤 Japanese Rap Name: Shunsuke Mano   @progfay

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Error.prototype.stack - JavaScript | MDN

Slide 5

Slide 5 text

Let's deep dive into Error.prototype.stack !

Slide 6

Slide 6 text

V8

Slide 7

Slide 7 text

V8 v8/src/execution/messages.cc at 5ac61190087feaa7fda2284f9f06e227141444ee · v8/v8

Slide 8

Slide 8 text

V8 - Stack trace API Stack trace API · V8

Slide 9

Slide 9 text

Node.js node/lib/internal/errors.js at 622c3721bf61e0bda825bed821e316e19ba75eff · nodejs/node

Slide 10

Slide 10 text

Node.js

Slide 11

Slide 11 text

Deno

Slide 12

Slide 12 text

JSC

Slide 13

Slide 13 text

JSC WebKit/Source/JavaScriptCore/interpreter/Interpreter.cpp at 66754d9a9c19aa6402c09970adc0191c460980cc · WebKit/WebKit WebKit/Source/JavaScriptCore/runtime/StackFrame.cpp at 66754d9a9c19aa6402c09970adc0191c460980cc · WebKit/WebKit

Slide 14

Slide 14 text

JSC

Slide 15

Slide 15 text

Bun 🤯

Slide 16

Slide 16 text

Bun bun/src/bun.js/bindings/FormatStackTraceForJS.cpp at 0db90b25261d4379103a4574e722362ed52a31cc · oven-sh/bun

Slide 17

Slide 17 text

https://x.com/bunjavascript/status/1966814439744958941

Slide 18

Slide 18 text

SpiderMonkey

Slide 19

Slide 19 text

SpiderMonkey JS::BuildStackString (SavedStacks.cpp - mozsearch) - 45e3c8634099e0f57fa0e7660dba85580a5dd8e7

Slide 20

Slide 20 text

SpiderMonkey JS::FormatSpiderMonkeyStackFrame (SavedStacks.cpp - mozsearch) - 45e3c8634099e0f57fa0e7660dba85580a5dd8e7

Slide 21

Slide 21 text

SpiderMonkey

Slide 22

Slide 22 text

So many runtimes, so many stack formats...

Slide 23

Slide 23 text

It's time to standardize!

Slide 24

Slide 24 text

tc39/proposal-error-stacks - GitHub

Slide 25

Slide 25 text

proposal-error-stacks • ECMAScript Proposal, specs, and reference implementation for Error.prototype.stack / System.getStack / System.getStackString

Slide 26

Slide 26 text

proposal-error-stacks • ECMAScript Proposal, specs, and reference implementation for Error.prototype.stack / System.getStack / System.getStackString

Slide 27

Slide 27 text

I believe is this seems like too much, too big, not well motivated as a big proposal. Make we could split it up. やりすぎ、 大 きすぎ、根拠も不 十 分に 見 える。 分割しよう。 notes/meetings/2024-12/december-05.md at 3bb70e4b6745798dc145be6859c92a7a0b6d0100 · tc39/notes proposal-error-stacks EN JP

Slide 28

Slide 28 text

• getter: calc & cache formatted stack • setter: update cache V8's Error.prototype.stack is exotic! v8/src/execution/messages.cc at 740213e7e48558f16b6842bb74be0086ac2980d2 · v8/v8 v8/src/builtins/accessors.cc at 740213e7e48558f16b6842bb74be0086ac2980d2 · v8/v8 check cache & return if exists set cache

Slide 29

Slide 29 text

tc39/proposal-error-stack-accessor - GitHub

Slide 30

Slide 30 text

proposal-error-stack-accessor • focus Error.prototype.stack accessor (getter / setter) • the only requirement is that it return a string Spec - Error Stack Accessor

Slide 31

Slide 31 text

Conclusion • Present: So many runtime, so many stack format • Standardizing activity: proposal-error-stacks, proposal-error-stack-accessor • Future: runtimes may provide Structured stack frame There's long way to go...