Debugger Statementの紹介と使い方 proposal-debugger-operandsについて
DebuggerStatement
View Slide
Name@brn (ꫬꅿ⨳ⵃ)Occupationؿٗٝزؒٝسؒٝآص،٥ط؎ذ؍ـؒٝآص،CompanyCyberagent ،سذؙأةآؔ AI MessengerOSSContributor of V8Abouthttp://info.b6n.ch
What is debugger?debugger statementהכ؝٦س⚥ח剅ֻֿהדرغحؖ饯⹛׃ـٖ؎ؙ׃גֻ堣腉
const ret = foo()!if (ret) {!debugger;!}!
In V8BytecodeהJIT؝٦سדⰟ鸐ךⳢ椚遤ֲ
BytecodeDebuggerعٝسָٓDebuggerغ؎ز؝٦س鋅אֽהRuntime_HandleDebuggerStatementㄎן⳿׃גծ✲ח涫ꐮׁגְ؝٦ٕغحؙㄎן⳿ׅIn V8
JIT CodeJIT⻉ך麓玎דㄏ⟀ך⽃秪⻉הְֲ剑黝⻉ָ遤ָծך麓玎דDebugger Statementכ⯓玎ךRuntime_HandleDebuggerStatementㄎן⳿׃ך؝٦سפה湫䱸㢌䳔ׁIn V8
Break PointאְדזךדBreakpointחאְגـٓؐؠך؎ٝألؙةַ䭷㹀ֿׅהָדֹ• In V8
In V8DebugBreakכDebugger Statementה麩גוֿח䯏Ⰵַַׁזְךד✲חRuntime_HandleDebuggerStatementהַחכ㢌䳔דֹזְ
BytecodeDebugBreakعٝسָٓDebug::HandleDebugBreakㄎן⳿׃גծ穠卓Debugger StatementהずׄⳢ椚遤ֲIn V8
JIT Code(X64)ـٖ؎ؙه؎ٝزכׅץגInt3ㄏ⟀ָ涪遤ׁגSIGTRAP䒷ֹ饯ֿׅinterruptָ饯ֿהStackGuard::HandleInterruptsָㄎן⳿ׁגծַֿDebug::HandleDebugBreakפIn V8
Future⯓傈ךTC39 Meetingדproposal-debugger-operandָStage1חז
proposal-debugger-operandـٖ؎ؙه؎ٝزךؚٕ٦ف⻉ח״♧俕ON/OFFծ勴⟝➰ֹـٖ؎ؙך鏣㹀瘝ָ遤ִFuture
const log = (v) => {!debugger { group: 'logging' };!console.log(v);!};!
const route = (httpRequest) => {!debugger {!test: () => httpRequest.tracing || !isProduction!};!console.log(v);!};!
㹋騧涪儗חכDebugger㙵鴥דծٔٔ٦أ儗ח嶊ׅWebpack⢪גזUglifyָ嶊׃גֻv4ך㜥さכmode productionד䩛ח嶊ִ
class Logger {!fatal() {!console.error("Error");!debugger;!}!}!
תה⢪ג➂㼰זְ⽩韋דָׅ涪儗ח⢪ֲה穠圓嚂דׅ