Initial infrastructure for fast compilation of top-level code. The
authorkmillikin@chromium.org <kmillikin@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 14 Oct 2009 19:30:50 +0000 (19:30 +0000)
committerkmillikin@chromium.org <kmillikin@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 14 Oct 2009 19:30:50 +0000 (19:30 +0000)
commitf74e723599a7061ee53977479ae0f6c8ef2ac370
tree4a3bffa8bf4fc18255fc36346ce7b01cbb17a1f5
parente0b8ab8815f51f8c37a27301a50de0c10d709827
Initial infrastructure for fast compilation of top-level code.  The
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
14 files changed:
src/SConscript
src/arm/codegen-arm.h
src/codegen.cc
src/codegen.h
src/compiler.cc
src/fast-codegen.cc [new file with mode: 0644]
src/fast-codegen.h [new file with mode: 0644]
src/flag-definitions.h
src/ia32/codegen-ia32.h
src/ia32/fast-codegen-ia32.cc [new file with mode: 0644]
src/v8-counters.h
src/x64/codegen-x64.h
tools/gyp/v8.gyp
tools/visual_studio/v8_base.vcproj