-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
254 lines (220 loc) · 7.36 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>How JavaScript works</title>
<meta name="description" content="A presentation which will tells yyou how javascript virtual machine works">
<meta name="author" content="Dominik Szymanski">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/black.css" id="theme">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<link rel="stylesheet" href="css/presentation.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1>How JavaScript works</h1>
<p>
<small>Created by Dominik Szymanski / <a href="http://twitter.com/dnextbest">@dnextbest</a></small>
</p>
</section>
<section>
<h1 style="text-decoration: line-through;">How JavaScript works</h1>
<h3>How the virtual machine implements the ECMAScript standard</h3>
<p>
<small>Created by Dominik Szymanski / <a href="http://twitter.com/dnextbest">@dnextbest</a></small>
</p>
</section>
<section>
<h2>So how JavaScript VM works ?! (after few hours googling)</h2>
<p class="fragment">
<img src="img/magic.gif" style="width: 60%;">
</p>
</section>
<section style="height: 80%">
<h2>JavaScript VM Schema</h2>
<p>
<div style="height: 80%; width: 31%; border: 4px solid #76bc3f; float:left; margin: 0.5%; text-align:center;">
<b>JAVASCRIPT
ENGINE</b>
<img src="img/v8_logo.png" style="border: none; background: none; box-shadow: none;">
<img src="img/mozilla_logo.png" style="border: none; background: none; box-shadow: none;">
</div>
<div style="height: 80%; width: 31%; border: 4px solid #76bc3f; float:left; margin: 0.5%; text-align:center;">
<b>EVENT
ENGINE</b>
<p style="margin-top:30px">
libuv
</p>
<p style="margin-top:30px">
libevent
</p>
</div>
<div style="height: 80%; width: 31%; border: 4px solid #76bc3f; float:left; margin: 0.5%; text-align:center;">
<b>EXTERNAL API</b>
<p style="margin-top:30px">
WebWorker
</p>
<p style="margin-top:30px">
File system API
</p>
<p style="margin-top:30px">
Browser API
</p>
<p style="margin-top:30px">
etc
</p>
</div>
</p>
</section>
<section>
<h2>Call Stack</h2>
<pre style="width: 50%; float: left;">
<code data-trim contenteditable>
function foo(a,b) {
return a*b;
}
function power(a) {
return foo(a, a);
}
function loger() {
power(2);
}
loger();
</code>
</pre>
<div class="call-stack">
<strong>CALL STACK</strong>
<div style="position:absolute; left: 66%; bottom: 50px;">
<div class="fragment" data-fragment-index="2">foo()</div>
<div class="fragment" data-fragment-index="1">power(2)</div>
<div class="fragment" data-fragment-index="0">loger()</div>
</div>
</div>
</section>
<section>
<h2>Call Stack</h2>
<pre style="width: 50%; float: left;">
<code data-trim contenteditable>
function foo(a,b) {
return a*b;
}
function power(a) {
return foo(a, a);
}
function loger() {
power(2);
}
loger();
</code>
</pre>
<div class="call-stack">
<strong>CALL STACK</strong>
<div style="position:absolute; left: 66%; bottom: 50px;" class="fragment-opaque">
<div class="fragment">foo()</div>
<div class="fragment">power(2)</div>
<div class="fragment">loger()</div>
</div>
</div>
</section>
<section>
<h2>Examples</h2>
<p>
<a href="http://latentflip.com/loupe/?code=JC5vbignYnV0dG9uJywgJ2NsaWNrJywgZnVuY3Rpb24gb25DbGljaygpIHsKICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gdGltZXIoKSB7CiAgICAgICAgY29uc29sZS5sb2coJ1lvdSBjbGlja2VkIHRoZSBidXR0b24hJyk7ICAgIAogICAgfSwgMjAwMCk7Cn0pOwoKY29uc29sZS5sb2coIkhpISIpOwoKc2V0VGltZW91dChmdW5jdGlvbiB0aW1lb3V0KCkgewogICAgY29uc29sZS5sb2coIkNsaWNrIHRoZSBidXR0b24hIik7Cn0sIDUwMDApOwoKY29uc29sZS5sb2coIldlbGNvbWUgdG8gbG91cGUuIik7!!!PGJ1dHRvbj5DbGljayBtZSE8L2J1dHRvbj4%3Dh"></a>
</p>
</section>
<section>
<section>
<h2>Event Loop</h2>
<p>
<img src="img/event_architecture.png" style="border: none; background: none; box-shadow: none;">
</p>
</section>
<section>
<h2>So not every callback is asynchronous?</h2>
<p>
<img src="img/not_every_callback.gif" style="border: none; background: none; box-shadow: none;">
</p>
</section>
</section>
<section>
<h2>Let's talk about types first</h2>
<ul>
<li><strong>Objects</strong></li>
<li><strong>Scalars (immutable)</strong>
<ul>
<li>number</li>
<li>string</li>
<li>boolean</li>
<li>null / undefined </li>
<li>symbol (in es6)</li>
</ul>
</li>
</ul>
</section>
<section>
<h2>Memory managment</h2>
<ul>
<li>garbage collected (stops the world)</li>
<li>young/old memory</li>
<li>memory heap do not contain compiled code</li>
</ul>
</section>
<section>
<h2>How we know which one</h2>
<p>
<img src="img/memory_representation.png" style="height: 450px;">
</p>
</section>
<section>
<img src="img/Compiler-architecture.png" style="width: 850px;">
</section>
<section style="text-align: left;">
<h1>THE END</h1>
<p>
Q & A
</p>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>