Submit Search
Upload
V8 javascript engine for フロントエンドデベロッパー
•
10 likes
•
5,947 views
Taketoshi 青野健利
Follow
V8 javascript engine がどうjavascriptを最適化し、実行するかの概要
Read less
Read more
Software
Report
Share
Report
Share
1 of 77
Download now
Download to read offline
Recommended
Google V8 engine
Google V8 engine
Xuân Thu Nguyễn
Webrender 1.0
Webrender 1.0
Daosheng Mu
React workshop
React workshop
Imran Sayed
Spring MVC 3.0 Framework
Spring MVC 3.0 Framework
Ravi Kant Soni (ravikantsoni03@gmail.com)
Web Worker, Service Worker and Worklets
Web Worker, Service Worker and Worklets
Keshav Gupta
Rxjs ngvikings
Rxjs ngvikings
Christoffer Noring
Apache Hive Hook
Apache Hive Hook
Minwoo Kim
WebAssembly Overview
WebAssembly Overview
Alexandr Skachkov
Recommended
Google V8 engine
Google V8 engine
Xuân Thu Nguyễn
Webrender 1.0
Webrender 1.0
Daosheng Mu
React workshop
React workshop
Imran Sayed
Spring MVC 3.0 Framework
Spring MVC 3.0 Framework
Ravi Kant Soni (ravikantsoni03@gmail.com)
Web Worker, Service Worker and Worklets
Web Worker, Service Worker and Worklets
Keshav Gupta
Rxjs ngvikings
Rxjs ngvikings
Christoffer Noring
Apache Hive Hook
Apache Hive Hook
Minwoo Kim
WebAssembly Overview
WebAssembly Overview
Alexandr Skachkov
React hooks Episode #1: An introduction.
React hooks Episode #1: An introduction.
ManojSatishKumar
React js for beginners
React js for beginners
Alessandro Valenti
Reactjs
Reactjs
Mallikarjuna G D
Its time to React.js
Its time to React.js
Ritesh Mehrotra
Etsy Activity Feeds Architecture
Etsy Activity Feeds Architecture
Dan McKinley
Spring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topics
Guy Nir
Introduction to React JS for beginners | Namespace IT
Introduction to React JS for beginners | Namespace IT
namespaceit
Webpack slides
Webpack slides
Андрей Вандакуров
An Introduction to ReactJS
An Introduction to ReactJS
All Things Open
React Js Simplified
React Js Simplified
Sunil Yadav
webworkers
webworkers
Asanka Indrajith
MongoDB Performance Tuning
MongoDB Performance Tuning
MongoDB
Fast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible Java
Charles Nutter
Introduction to redis
Introduction to redis
NexThoughts Technologies
Let's Compare: A Benchmark review of InfluxDB and Elasticsearch
Let's Compare: A Benchmark review of InfluxDB and Elasticsearch
InfluxData
AngularJS $http Interceptors (Explanation and Examples)
AngularJS $http Interceptors (Explanation and Examples)
Brian Swartzfager
React js
React js
Rajesh Kolla
WebAssembly Demystified
WebAssembly Demystified
Jay Phelps
Styled Components & React.js
Styled Components & React.js
Grayson Hicks
ReactJS
ReactJS
Hiten Pratap Singh
Living with garbage
Living with garbage
lucenerevolution
Living with Garbage by Gregg Donovan at LuceneSolr Revolution 2013
Living with Garbage by Gregg Donovan at LuceneSolr Revolution 2013
Gregg Donovan
More Related Content
What's hot
React hooks Episode #1: An introduction.
React hooks Episode #1: An introduction.
ManojSatishKumar
React js for beginners
React js for beginners
Alessandro Valenti
Reactjs
Reactjs
Mallikarjuna G D
Its time to React.js
Its time to React.js
Ritesh Mehrotra
Etsy Activity Feeds Architecture
Etsy Activity Feeds Architecture
Dan McKinley
Spring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topics
Guy Nir
Introduction to React JS for beginners | Namespace IT
Introduction to React JS for beginners | Namespace IT
namespaceit
Webpack slides
Webpack slides
Андрей Вандакуров
An Introduction to ReactJS
An Introduction to ReactJS
All Things Open
React Js Simplified
React Js Simplified
Sunil Yadav
webworkers
webworkers
Asanka Indrajith
MongoDB Performance Tuning
MongoDB Performance Tuning
MongoDB
Fast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible Java
Charles Nutter
Introduction to redis
Introduction to redis
NexThoughts Technologies
Let's Compare: A Benchmark review of InfluxDB and Elasticsearch
Let's Compare: A Benchmark review of InfluxDB and Elasticsearch
InfluxData
AngularJS $http Interceptors (Explanation and Examples)
AngularJS $http Interceptors (Explanation and Examples)
Brian Swartzfager
React js
React js
Rajesh Kolla
WebAssembly Demystified
WebAssembly Demystified
Jay Phelps
Styled Components & React.js
Styled Components & React.js
Grayson Hicks
ReactJS
ReactJS
Hiten Pratap Singh
What's hot
(20)
React hooks Episode #1: An introduction.
React hooks Episode #1: An introduction.
React js for beginners
React js for beginners
Reactjs
Reactjs
Its time to React.js
Its time to React.js
Etsy Activity Feeds Architecture
Etsy Activity Feeds Architecture
Spring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topics
Introduction to React JS for beginners | Namespace IT
Introduction to React JS for beginners | Namespace IT
Webpack slides
Webpack slides
An Introduction to ReactJS
An Introduction to ReactJS
React Js Simplified
React Js Simplified
webworkers
webworkers
MongoDB Performance Tuning
MongoDB Performance Tuning
Fast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible Java
Introduction to redis
Introduction to redis
Let's Compare: A Benchmark review of InfluxDB and Elasticsearch
Let's Compare: A Benchmark review of InfluxDB and Elasticsearch
AngularJS $http Interceptors (Explanation and Examples)
AngularJS $http Interceptors (Explanation and Examples)
React js
React js
WebAssembly Demystified
WebAssembly Demystified
Styled Components & React.js
Styled Components & React.js
ReactJS
ReactJS
Similar to V8 javascript engine for フロントエンドデベロッパー
Living with garbage
Living with garbage
lucenerevolution
Living with Garbage by Gregg Donovan at LuceneSolr Revolution 2013
Living with Garbage by Gregg Donovan at LuceneSolr Revolution 2013
Gregg Donovan
Building a SIMD Supported Vectorized Native Engine for Spark SQL
Building a SIMD Supported Vectorized Native Engine for Spark SQL
Databricks
Living With Garbage
Living With Garbage
Gregg Donovan
Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19
confluent
Price of an Error
Price of an Error
Andrey Karpov
All you need to know about the JavaScript event loop
All you need to know about the JavaScript event loop
Saša Tatar
Javascript Everywhere
Javascript Everywhere
Pascal Rettig
Full Stack Scala
Full Stack Scala
Ramnivas Laddad
12 Monkeys Inside JS Engine
12 Monkeys Inside JS Engine
ChengHui Weng
R and cpp
R and cpp
Romain Francois
NoSQL and JavaScript: a love story
NoSQL and JavaScript: a love story
Alexandre Morgaut
Tips and tricks for building high performance android apps using native code
Tips and tricks for building high performance android apps using native code
Kenneth Geisshirt
Apache Spark, the Next Generation Cluster Computing
Apache Spark, the Next Generation Cluster Computing
Gerger
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
Ricardo Silva
Android RenderScript on LLVM
Android RenderScript on LLVM
John Lee
Apache Spark for Library Developers with William Benton and Erik Erlandson
Apache Spark for Library Developers with William Benton and Erik Erlandson
Databricks
V8
V8
changehee lee
Будь первым
Будь первым
FDConf
200 Open Source Projects Later: Source Code Static Analysis Experience
200 Open Source Projects Later: Source Code Static Analysis Experience
Andrey Karpov
Similar to V8 javascript engine for フロントエンドデベロッパー
(20)
Living with garbage
Living with garbage
Living with Garbage by Gregg Donovan at LuceneSolr Revolution 2013
Living with Garbage by Gregg Donovan at LuceneSolr Revolution 2013
Building a SIMD Supported Vectorized Native Engine for Spark SQL
Building a SIMD Supported Vectorized Native Engine for Spark SQL
Living With Garbage
Living With Garbage
Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19
Price of an Error
Price of an Error
All you need to know about the JavaScript event loop
All you need to know about the JavaScript event loop
Javascript Everywhere
Javascript Everywhere
Full Stack Scala
Full Stack Scala
12 Monkeys Inside JS Engine
12 Monkeys Inside JS Engine
R and cpp
R and cpp
NoSQL and JavaScript: a love story
NoSQL and JavaScript: a love story
Tips and tricks for building high performance android apps using native code
Tips and tricks for building high performance android apps using native code
Apache Spark, the Next Generation Cluster Computing
Apache Spark, the Next Generation Cluster Computing
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
Android RenderScript on LLVM
Android RenderScript on LLVM
Apache Spark for Library Developers with William Benton and Erik Erlandson
Apache Spark for Library Developers with William Benton and Erik Erlandson
V8
V8
Будь первым
Будь первым
200 Open Source Projects Later: Source Code Static Analysis Experience
200 Open Source Projects Later: Source Code Static Analysis Experience
More from Taketoshi 青野健利
ServiceWorkerとES6 Modules時代のTypescript開発考察
ServiceWorkerとES6 Modules時代のTypescript開発考察
Taketoshi 青野健利
javascriptのデータ構造の話
javascriptのデータ構造の話
Taketoshi 青野健利
非同期javascriptの過去と未来
非同期javascriptの過去と未来
Taketoshi 青野健利
仮想DOMの実装とパフォーマンス
仮想DOMの実装とパフォーマンス
Taketoshi 青野健利
JavascriptのGC入門
JavascriptのGC入門
Taketoshi 青野健利
V8 Iginition Interpreter
V8 Iginition Interpreter
Taketoshi 青野健利
GraphQL with React
GraphQL with React
Taketoshi 青野健利
Jspmとtypescriptで開発する
Jspmとtypescriptで開発する
Taketoshi 青野健利
React and-rx
React and-rx
Taketoshi 青野健利
WebWorker and Atomics
WebWorker and Atomics
Taketoshi 青野健利
More from Taketoshi 青野健利
(10)
ServiceWorkerとES6 Modules時代のTypescript開発考察
ServiceWorkerとES6 Modules時代のTypescript開発考察
javascriptのデータ構造の話
javascriptのデータ構造の話
非同期javascriptの過去と未来
非同期javascriptの過去と未来
仮想DOMの実装とパフォーマンス
仮想DOMの実装とパフォーマンス
JavascriptのGC入門
JavascriptのGC入門
V8 Iginition Interpreter
V8 Iginition Interpreter
GraphQL with React
GraphQL with React
Jspmとtypescriptで開発する
Jspmとtypescriptで開発する
React and-rx
React and-rx
WebWorker and Atomics
WebWorker and Atomics
Recently uploaded
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
Delhi Call girls
Software Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
Arshad QA
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
WSO2
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
panagenda
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
Jim McKeeth
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
masabamasaba
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
kalichargn70th171
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
VictorSzoltysek
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
OnePlan Solutions
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
masabamasaba
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
masabamasaba
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Steffen Staab
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
Delhi Call girls
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
masabamasaba
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2
Recently uploaded
(20)
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
Software Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
V8 javascript engine for フロントエンドデベロッパー
1.
V8 javascript engine
2.
: @brn (
) : : Cyberagent RightSegment AI Messenger : http://abcdef.gets.b6n.ch/ Twitter: https://twitter.com/brn227
3.
V8 V8 Google javascript
Google Chrome javascript
4.
V8 V8 • •
Hidden Class • Inline Caching • GC • 2016 • CPU Mips Arm X64 X86 7
5.
V8 javascript
6.
V8 Code base V8
108 C++ …
7.
V8 Source AST Bytecode
Graph Assembly
8.
Parsing V8 AST AST
AbstractSyntaxTree
9.
Abstract Syntax Tree if (x) { x = 100 }
10.
Abstract Syntax Tree IF CONDITION THEN BLOCK EXPRESSION STATEMENT ASSIGN VAR PROXY (X)
LITERAL (100) if (x) { x = 100
11.
Parsing Web javascript
12.
Parsing V8
13.
Lazy Parsing function x() {return 1;} FUNCTION(X)
14.
Lazy Parsing function x() {return 1;} x() FUNCTION NAME (x) RETURN LITERAL(1)
15.
Lazy Parsing V8
16.
PreParsing v8::internal::PreParser • •
17.
Dive into Parsing V8
Parsing https://docs.google.com/presentation/d/1b- ALt6W01nIxutFVFmXMOyd_6ou_6qqP6S0Prmb1iDs/present? slide=id.p
18.
Abstract Syntax Tree V8
yacc lex
19.
AST Rewriter V8 AST
20.
AST Rewriter javascript Spread var x = [1,2,3]; var y = […x]; V8
AltJS
21.
AST Rewriter do { $R = []; for ($i of x) %AppendElement($R, $i); $R } // src/parsing/parser.cc do for-of
22.
Abstract Syntax Tree AST
V8 AST AST …
23.
Abstract Syntax Tree var x = 100
24.
Abstract Syntax Tree var EXPRESSION STATEMENT CALL RUNTIME [IniOalizeVarGlobal] LITERAL (x) LITERAL (100) x 100 ?
25.
Abstract Syntax Tree V8
Runtime C++ AST AST
26.
AST to Bytecode AST
AST Bytecode V8 Bytecode 1Byte Bytecode VM Ignition
27.
Igniton V8 Ignition Bytecode AST
28.
Igniton Ignition CPU Ignition BytecodeHandler Bytecode
29.
Igniton
30.
// 擬似的なjavascriptコード ! var Bytecodes = [0,1,2,3] var index = 0; function dispatch(next) { BytecodeHandlers[next](); } const BytecodeHandlers = { ['0']() {...; dispatch(Bytecodes[index++])}, ['1']() {...; dispatch(Bytecodes[index++])}, ['2']() {...; dispatch(Bytecodes[index++])}, ['3']() {...; dispatch(Bytecodes[index++])} } const firstBytecode = Bytecodes[index++]; BytecodeHandlers[firstBytecode](firstBytecode);
31.
Igniton Dispatch Table 00 01
02 04 08 0f 10 10 Node Node Node MachineCode MachineCode IGNITION_HANDLER Entry Function(Machine Code) グラフからコードを生成 生成したコードを、 DispatchTableの対応する バイトコードのインデックスへ 登録
32.
Igniton Ignition AST V8
AST v8::internal::AstVisitor<Subclass> AstVisitor Visitor AST
33.
Visitor Pattern class Visitor { void Visit(Ast* ast) { ast->Accept(this); } void VisitXXX(XXX* ast) { ast->property->accept(this); } } class Ast(XXX) { void Accept(Visitor* visitor) { visitor->VisitXXX(this) } }
34.
Igniton Bytecode BytecodeArray BytecodeArray
35.
Igniton Dispatch Table Entry Function(Machine
Code) BytecodeArray Dispatch Tableから対応するHandlerを取り出して実行 0 1 3 4 5 6 7 8 8 6 1
36.
Code Generation V8 CodeStub Builtins Runtime BytecodeHandler
37.
Code Generation Bytecode Bytecode
BytecodeHandler
38.
IGNITION_HANDLER(JumpIfToBooleanFalse, InterpreterAssembler) {! Node*
value = GetAccumulator();! // Accumulatorの値を取得! Node* relative_jump = BytecodeOperandUImmWord(0);! // 引数のoperandを取得! Label if_true(this), if_false(this);! BranchIfToBooleanIsTrue(value, &if_true, &if_false);! // valueがtrueならif_true、falseならif_false! Bind(&if_true);! Dispatch();! Bind(&if_false);! // operandのbytecodeまでjump! Jump(relative_jump);! }!
39.
Code Generation Graph
40.
Code Generation C++ DSL
41.
IGNITION_HANDLER(ForInContinue, InterpreterAssembler) {! ...! Branch(WordEqual(index,
cache_length), &if_true, &if_false);! Bind(&if_true);! {! SetAccumulator(BooleanConstant(false));! Goto(&end);! }! Bind(&if_false);! {! SetAccumulator(BooleanConstant(true));! Goto(&end);! }! ...! }!
42.
Code Generation MacroAssembler MacroAssembler Assembler V8
masm MacroAssembler
43.
#define __ ACCESS_MASM(masm)! ! static
void Generate_StackOverflowCheck(...) {! ! __ LoadRoot(kScratchRegister, Heap::kRealStackLimitRootIndex);! __ movp(scratch, rsp);! ! __ subp(scratch, kScratchRegister);! __ sarp(scratch, Immediate(kPointerSizeLog2));! ! __ cmpp(scratch, num_args);! ! __ j(less_equal, stack_overflow, stack_overflow_distance);! }!
44.
Code Generation GraphResolver CodeGenerator
Graph MacroAssembler Assembler
45.
Code Generation MacroAssembler Graph
Graph • CodeStubAssembler • CodeAssembler • RawMachineAssembler • MachineOperatorBuilder
46.
Code Generation e.x Load CodeStubAssembler::Load CodeAssembler::raw_assembler()->Load() RawMachineAssembler::Load AddNode(MachineAssembler::Load()) Graph Leaf Node
47.
Optimization javascript javascript javascript V8 JIT(
)
48.
Optimization V8 3 •
Hidden Class • Inline Caching • TurboFan
49.
Hidden Class javascript class
prototype • •
50.
Hidden Class V8 function Point(x, y) { this.x = x; this.y = y }; var point = new Point(1, 1); Point
51.
Map V8 • •
• Map Map Map
52.
Map function Point(x, y) { this.x = x; this.y = y; } Map FixedArray [ {a: {offset: 0}}, {b: {offset: 1}} ]
53.
Map javascript
54.
Map Transition V8 transition
Map Map
55.
Map Transition function Point(x, y) { this.x = x; this.y = y; } Map FixedArray [ {x: {offset: 0}}, {y: {offset: 1}}, transiOon: {address: …} ] var x = new Point(1, 1); x.z = 1; Map FixedArray [ {x: {offset: 0}}, {y: {offset: 1}}, {z: {offset: 2}} ] transition
56.
Inline Caching Inline Caching
57.
class X {add()
{return 1}}! class Y {add() {return 2}}! var m = [new X(), new X(), new Y()];! for (let i = 0; i < m.length; i++) {! m[i].add();! }! !
58.
Inline Caching 初回 V8 add Receiver Map Cached address 1. Search 2.
Check 4. Cache 3. Call
59.
Inline Caching 二回目以降 V8 add Receiver Map Cached address 1. Search
and Call
60.
Inline Caching Inline Caching
4 • Premonomorphic • Monomorphic • Polymorphic • Megamorphic
61.
Premonomorphic Premonomorphic IC Stub
62.
Monomorphic Monomorphic Receiver IC
63.
Polymorphic Polymorphic Receiver Polymorphic Map
Monomorphic IC
64.
Megamorphic Megamorphic
65.
(Load/Store)IC_Miss LoadIC_Miss StoreIC_Miss IC C++
66.
(Load/Store)IC_Miss 二回目以降 V8 add Receiver (y) Map Cached address (x) 1. Search 2. Compare
Map x !== y 3. (Load/Store)IC_Miss
67.
Optimized Compilation V8 Bytecode
Generic Runtime
68.
Hot Spot V8 •
•
69.
Loop Tracing V8 V8 OnStackReplacement
70.
On Stack Replacement for (let i = 0; i < 10000; i++) { doSomething(i); } JumpLoop LoopHeader SlowCode
FastCode PC( )
71.
Function Call Tracing Ignition
Return Bytecode BytecodeHandler Interrupt Body
72.
Function Interruption function Y() { … } RETURN OP Replace Body しきい値チェック
73.
TurboFan V8 Graph Graph
TurboFan
74.
TurboFan TurboFan • Loop
peeling / Loop elimination • Escape analysis • Lowering • Effect and control linearize • Dead code elimination • Control flow optimization • Memory optimization
75.
Deoptimization Map overlow 0
… V8 Bytecode
76.
Pipeline OpOmize Assembler TurboFan Source AST Parser Bytecode Graph IgniOon Compile Optimization Deoptimization
77.
V8 GC V8
GC
Download now