• kmillikin@chromium.org's avatar
    Added first support for tracking locations of expressions in the · 339e49c0
    kmillikin@chromium.org authored
    fast-mode code generator.
    
    AST expression nodes are annotated with a location when doing the
    initial syntactic check of the AST.  In the current implementation,
    expression locations are 'temporary' (ie, allocated to the stack) or
    'nowhere' (ie, the expression's value is not needed though it must be
    evaluated for side effects).
    
    For the assignment '.result = true' on IA32, we had before (with the
    true value already on top of the stack):
    
    32  mov eax,[esp]
    35  mov [ebp+0xf4],eax
    38  pop eax
    
    Now:
    
    32  pop [ebp+0xf4]
    
    
    ======== On x64, before:
    
    37  movq rax,[rsp]
    41  movq [rbp-0x18],rax
    45  pop rax
    
    Now:
    
    37  pop [rbp-0x18]
    
    
    ======== On ARM, before (with the true value in register ip):
    
    36  str ip, [sp, #-4]!
    40  ldr ip, [sp, #+0]
    44  str ip, [fp, #-12]
    48  add sp, sp, #4
    
    Now:
    
    36  str ip, [fp, #-12]
    
    
    Review URL: http://codereview.chromium.org/267118
    
    git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3076 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
    339e49c0
ast.h 51.4 KB