
Syntax tree 로 변형interpreter(aka Ignition) 이 해석해서 컴파일러에 전달Optimizing Compiler (aka Turbofan)는 자바스크립트 코드를 머신 코드로 변환 시킨다Eager (full-parse) : 바로 파싱
Lazy (pre-parse) : 나중에 파싱
// eager parse declarations right away
// 바로 파싱
const a = 1;
const b = 2;
// lazily parse this as we don't need it right away
// 나중에 파싱
function add(a, b) {
  return a + b;
}
// oh looks like we do need add so lets go back and parse it
add(a, b);
// eager parse declarations right away
const a = 1;
const b = 2;
// eager parse this too
// 즉시실행 되어서 바로 파싱
var add = (function(a, b) {
  return a + b;
})();
// we can use this right away as we have eager parsed
// already
add(a, b);
// 쓴 코드
const square = (x) => { return x * x }
const callFunction100Times = (func) => {
  for(let i = 0; i < 100; i++) {
    // the func param will be called 100 times
    func(2)
  }
}
callFunction100Times(square)
// V8엔진이 최적화 해버린 코드
const square = (x) => { return x * x }
const callFunction100Times = (func) => {
  for(let i = 100; i < 100; i++) {
    // the function is inlined so we don't have 
    // to keep calling func
    return x * x
  }
}
callFunction100Times(square)