• kmillikin@chromium.org's avatar
    Initial infrastructure for fast compilation of top-level code. The · f74e7235
    kmillikin@chromium.org authored
    fast code generator is optimized for compilation time and code size.
    
    Currently it is only implemented on IA32.  It is potentially triggered
    for any code in the global scope (including code eval'd in the global
    scope).  It performs a syntactic check and chooses to compile in fast
    mode if the AST contains only supported constructs and matches some
    other constraints.
    
    Initially supported constructs are
    
    * ExpressionStatement,
    * ReturnStatement,
    * VariableProxy (variable references) to parameters and
        stack-allocated locals,
    * Assignment with lhs a parameter or stack-allocated local, and
    * Literal
    
    This allows compilation of literals at the top level and not much
    else.
    
    All intermediate values are allocated to temporaries and the stack is
    used for all temporaries.  The extra memory traffic is a known issue.
    
    The code generated for 'true' is:
    
     0  push ebp
     1  mov ebp,esp
     3  push esi
     4  push edi
     5  push 0xf5cca135             ;; object: 0xf5cca135 <undefined>
    10  cmp esp,[0x8277efc]
    16  jnc 27  (0xf5cbbb1b)
    22  call 0xf5cac960             ;; code: STUB, StackCheck, minor: 0
    27  push 0xf5cca161             ;; object: 0xf5cca161 <true>
    32  mov eax,[esp]
    35  mov [ebp+0xf4],eax
    38  pop eax
    39  mov eax,[ebp+0xf4]
    42  mov esp,ebp                 ;; js return
    44  pop ebp
    45  ret 0x4
    48  mov eax,0xf5cca135          ;; object: 0xf5cca135 <undefined>
    53  mov esp,ebp                 ;; js return
    55  pop ebp
    56  ret 0x4
    
    Review URL: http://codereview.chromium.org/273050
    
    git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3067 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
    f74e7235
v8-counters.h 10.3 KB