Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Issue 10993: Begin using the virtual frame for assignment statements of the form:... (Closed)

Created:
12 years ago by Kevin Millikin (Chromium)
Modified:
9 years, 7 months ago
Reviewers:
iposva, William Hesse
CC:
v8-dev
Visibility:
Public.

Description

Begin using the virtual frame for assignment statements of the form: <local> = <literal> Literals are pushed on the frame as virtual elements. Assignment of a virtual element to a frame slot (eg, local or parameter) makes that slot virtual too. The above code compiles into a single move of a constant to memory, and that move is actually only caused by spilling the frame. Visiting expressions is guarded by spilling the frame to keep everything spilled in code that assumes it. That's ugly but temporary. Committed: http://code.google.com/p/v8/source/detail?r=868

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+243 lines, -91 lines) Patch
M src/codegen-ia32.h View 1 chunk +4 lines, -0 lines 0 comments Download
M src/codegen-ia32.cc View 54 chunks +162 lines, -77 lines 7 comments Download
M src/virtual-frame-ia32.h View 5 chunks +23 lines, -2 lines 2 comments Download
M src/virtual-frame-ia32.cc View 5 chunks +54 lines, -12 lines 6 comments Download

Messages

Total messages: 5 (0 generated)
Kevin Millikin (Chromium)
Without allocating locals to registers, we are not yet doing better than the peephole optimizer. ...
12 years ago (2008-11-28 08:56:05 UTC) #1
William Hesse
Aside from my comments, it looks good. But Ivan should look at it, I think. ...
12 years ago (2008-11-28 10:32:45 UTC) #2
Kevin Millikin (Chromium)
http://codereview.chromium.org/10993/diff/1/5 File src/codegen-ia32.cc (right): http://codereview.chromium.org/10993/diff/1/5#newcode2600 Line 2600: // Smis are loaded in two steps via ...
12 years ago (2008-11-28 12:19:07 UTC) #3
iposva
http://codereview.chromium.org/10993/diff/1/5 File src/codegen-ia32.cc (right): http://codereview.chromium.org/10993/diff/1/5#newcode3112 Line 3112: frame_->SpillAll(); Is there a single call to Load ...
12 years ago (2008-12-03 07:04:39 UTC) #4
Kevin Millikin (Chromium)
12 years ago (2008-12-03 15:08:38 UTC) #5
http://codereview.chromium.org/10993/diff/1/5
File src/codegen-ia32.cc (right):

http://codereview.chromium.org/10993/diff/1/5#newcode3112
Line 3112: frame_->SpillAll();
On 2008/12/03 07:04:40, iposva wrote:
> Is there a single call to Load in this file that is not followed by a
> frame_->SpillAll()?
> You should probably move the mandatory (?) spilling code into the Load
function
> and explain the reason for it in a good fat comment.

Actually there are two (but they are easy to miss).  one is in
VisitExpressionStatement where a value is discarded, which doesn't require a
fully spilled frame and emits no code for virtual TOS elements; and the other is
in VisitAssignment for the case of simple "=" assignments, where the RHS can
safely be a register or constant which is simply compiled to a memory move for
LHSs that are LOCAL or PARAMETER slots.

The calls to SpillAll are annoying, but temporary---ultimately they will all go
away (or be moved to more optimal places).

I don't mind using the accessor, but I'm not sure what it's buying us either.

http://codereview.chromium.org/10993/diff/1/5#newcode4185
Line 4185: frame->SpillAll();
On 2008/12/03 07:04:40, iposva wrote:
> Could this SpillAll() be moved after the EmitPop(eax)? Then you could
> potentially materialize the value for eax without having to go through memory
> and then spill the remainder after EmitPop().

Eventually when this code is reworked.  Right now the functions with "Emit" (ie,
EmitPush and EmitPop) in their names will actually emit those specific machine
instructions.  They do not do any magic with virtual frame elements, so they
require fully spilled frames.

Powered by Google App Engine
This is Rietveld 408576698