Google V8: ãããããã©ã°é
V8ããã«ããããä½ãããd8.exeã®ã³ã¼ãã«ãã¬ã¼ã¯ãã¤ã³ããç½®ãã¦ãã¹ãããå®è¡ãã¦ããããé¢ç½ãããªãã¡ã¤ã«ãçºè¦ãv8\src\flag-definitions.hã«ä½ãè²ã ãã©ã°ãå®ç¾©ããã¦ããã
// codegen-ia32.cc / codegen-arm.cc DEFINE_bool(trace_codegen, false, "print name of functions for which code is generated") DEFINE_bool(print_source, false, "pretty print source code") DEFINE_bool(print_builtin_source, false, "pretty print source code for builtins") DEFINE_bool(print_ast, false, "print source AST") DEFINE_bool(print_builtin_ast, false, "print source AST for builtins") DEFINE_bool(trace_calls, false, "trace calls") DEFINE_bool(trace_builtin_calls, false, "trace builtins calls") DEFINE_string(stop_at, "", "function name where to insert a breakpoint") // compiler.cc DEFINE_bool(print_builtin_scopes, false, "print scopes for builtins") DEFINE_bool(print_scopes, false, "print scopes") // contexts.cc DEFINE_bool(trace_contexts, false, "trace contexts operations") // heap.cc DEFINE_bool(gc_greedy, false, "perform GC prior to some allocations") DEFINE_bool(gc_verbose, false, "print stuff during garbage collection") DEFINE_bool(heap_stats, false, "report heap statistics before and after GC") DEFINE_bool(code_stats, false, "report code statistics after GC") DEFINE_bool(verify_heap, false, "verify heap pointers before and after GC") DEFINE_bool(print_handles, false, "report handles after GC") DEFINE_bool(print_global_handles, false, "report global handles after GC") DEFINE_bool(print_rset, false, "print remembered sets before GC") [...]
print_astãtrueã«ãããASTã表示ã§ããã®ããªï¼è©¦ãã«trueã«ãã¦ãã«ããã¦ã¿ãã
DEFINE_bool(print_ast, true, "print source AST")
ãã«ãå¾ãd8.exeãå®è¡ãASTããããã®ãç»é¢ã«å¤§éã«è¡¨ç¤ºãããããã
ããã³ããã§å
¥åããã¹ã¯ãªããã ããASTã¨ãã¦è¡¨ç¤ºãã¦ãããã®ãã¨æã£ãããd8.exeã§ãã¼ããã¦ããJavaScriptã®ASTãåºãã¦ããã£ã½ãã
[...] . . . . . VALUE . . . . . . LITERAL "\n" . . . . PROPERTY - CONSTANT . . . . . KEY . . . . . . LITERAL "" . . . . . VALUE . . . . . . LITERAL "\f" . . . . PROPERTY - CONSTANT . . . . . KEY " . . . . . LITERAL " . . . . . VALUE . . . . . . LITERAL "\r" . . . . PROPERTY - CONSTANT . . . . . KEY . . . . . . LITERAL """ . . . . . VALUE . . . . . . LITERAL "\"" . . . . PROPERTY - CONSTANT . . . . . KEY . . . . . . LITERAL "\" . . . . . VALUE . . . . . . LITERAL "\\" . BLOCK INIT . . CALL RUNTIME InitializeConstGlobal . . . LITERAL "ctrlCharTest_" . . . CALL NEW . . . . VAR PROXY (mode = DYNAMIC) "RegExp" . . . . LITERAL "["\\ V8 version 1.1.2 (candidate) [console: dumb] d8>
ããã³ããã§Enterãã¼ãæ¼ãã¨ãã¹ã¿ãã¯ãã¬ã¼ã ï¼ã表示ãã¦è½ã¡ãããªããããããï¼
[...] #46# 0141737D: 0141737D <an Object>> r: 01500161 <true> x: 01500161 <true> h: 01500161 <true> f: 01500161 <true> l: 01500161 <true> e: 01500161 <true> a: 01500161 <true> u: 01500161 <true> o: 01500161 <true> n: 01500161 <true> y: 01500161 <true> s: 01500161 <true> i: 01500161 <true> m: 01500161 <true> #47# 0100FE85: 0100FE85 <JS array[1461]> 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 ... #48# 014173E5: 014173E5 <a RangeError>> #49# 01417371: 01417371 <an Object>> #50# 0101F941: 0101F941 <a ScriptMirror>> type_: 015057E1 <String[6]: script> script_: 0101F44D <a Script> value = 0145A319 <Script>>#51# handle_: 0 #51# 0101F44D: 0101F44D <a Script> value = 0145A319 <Script>> value(): 0145A319 <Script>#52# #52# 0145A319: 0145A319 <Script> ===================== C:\projects\v8\tools\visual_studio\Debug>