Recognize in the fast-mode code generator when a subexpression is a
authorkmillikin@chromium.org <kmillikin@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 19 Oct 2009 10:36:42 +0000 (10:36 +0000)
committerkmillikin@chromium.org <kmillikin@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 19 Oct 2009 10:36:42 +0000 (10:36 +0000)
commit846688f825aa84b1098f8fb365ddb24cddbebbf4
tree6d62849f66d1634828b817c30f628e9bde10d524
parent7324ec0f833cdb73bcce2017ca2c7ef09ad475df
Recognize in the fast-mode code generator when a subexpression is a
constant known at compile time.  Do not ever use the stack to
materialize (non-function-argument) constants.  Currently, constants
are only the non-materialized, non-function literals in the AST.

It is a known issue that there is no test coverage for the cases of
assigning a non-literal to a variable and returning a literal.  Those
code paths are unreachable and tests will be added when they become
reachable.

For the code '.result = true', we had previously on ia32:

27  push 0xf5c28161             ;; object: 0xf5c28161 <true>
32  pop [ebp+0xf4]

Now:

27  mov eax,0xf5c26161          ;; object: 0xf5c26161 <true>
32  mov [ebp+0xf4],eax

======== We had previously on x64:

25  movq r10,0x7fb8c2f78199    ;; object: 0x7fb8c2f78199 <true>
35  push r10
37  pop [rbp-0x18]

Now:

25  movq r10,0x7fb131386199    ;; object: 0x7fb131386199 <true>
35  movq [rbp-0x18],r10

The generated code for ARM did not include the extra memory traffic.
It was already eliminated by the ARM assembler's push/pop elimination.

Review URL: http://codereview.chromium.org/300003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3088 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
src/arm/fast-codegen-arm.cc
src/compiler.cc
src/fast-codegen.cc
src/ia32/fast-codegen-ia32.cc
src/location.h
src/x64/fast-codegen-x64.cc