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

Issue 384078: Fast-codegen: Added support for arguments in functions. (Closed)

Created:
11 years, 1 month ago by Lasse Reichstein
Modified:
9 years, 6 months ago
CC:
v8-dev
Visibility:
Public.

Description

Fast-codegen: Added support for arguments in functions. Functions using "arguments" have their arguments object created on entry. Also added support for variables rewritten into argument object property access.

Patch Set 1 #

Total comments: 27
Unified diffs Side-by-side diffs Delta from patch set Stats (+161 lines, -25 lines) Patch
M src/arm/fast-codegen-arm.cc View 3 chunks +38 lines, -1 line 10 comments Download
M src/compiler.cc View 2 chunks +16 lines, -14 lines 7 comments Download
M src/fast-codegen.h View 1 chunk +1 line, -0 lines 2 comments Download
M src/fast-codegen.cc View 1 chunk +14 lines, -0 lines 2 comments Download
M src/ia32/fast-codegen-ia32.cc View 3 chunks +42 lines, -4 lines 0 comments Download
M src/x64/fast-codegen-x64.cc View 3 chunks +50 lines, -6 lines 6 comments Download

Messages

Total messages: 4 (0 generated)
Lasse Reichstein
Please review.
11 years, 1 month ago (2009-11-12 09:35:57 UTC) #1
William Hesse
LGTM, with comments addressed. http://codereview.chromium.org/384078/diff/1/3 File src/compiler.cc (right): http://codereview.chromium.org/384078/diff/1/3#newcode604 Line 604: // return NORMAL; Remove. ...
11 years, 1 month ago (2009-11-12 09:56:49 UTC) #2
Kevin Millikin (Chromium)
Some drive bys. I'm surprised that putting state on variable rewrites works. In general, I ...
11 years, 1 month ago (2009-11-12 14:23:13 UTC) #3
Lasse Reichstein
11 years, 1 month ago (2009-11-13 08:54:37 UTC) #4
I'll look into whether putting context on rewritten variable's expressions is
reasonable (and what to do if it isn't - because then how do we compile the
expression it's rewritten to?).

http://codereview.chromium.org/384078/diff/1/2
File src/arm/fast-codegen-arm.cc (right):

http://codereview.chromium.org/384078/diff/1/2#newcode81
Line 81: // Receiver is located above the frame pointer, return address and
I committed this comment: "Receiver is just before the parameters on the
caller's stack."
(and the number it comments is "StandardFrameConstants::kCallerSPOffset +
fun->num_parameters() * kPointerSize".

How does this read?

http://codereview.chromium.org/384078/diff/1/2#newcode85
Line 85: __ stm(db_w, sp, r1.bit() | r2.bit() | r3.bit());
Will fix.

http://codereview.chromium.org/384078/diff/1/2#newcode98
Line 98: function_in_register = false;
It is. I preferred it this way because it avoided interleaving the two,
otherwise independent, blocks.

If anyone wants to add something between them later, they will need to know that
the meaning of "arguments != NULL" is that the function is no longer in register
r1, as well as why that is the case.

http://codereview.chromium.org/384078/diff/1/2#newcode104
Line 104: // Argument to NewContext is the function, still in r1.
Fixed.

http://codereview.chromium.org/384078/diff/1/2#newcode509
Line 509: // the arguments object.
True. It's currently the only reason, but we could prepare for other reasons for
this rewrite (or other expression rewrites, removing the assertion that it's a
property).
I'll reword the comment.

http://codereview.chromium.org/384078/diff/1/3
File src/compiler.cc (right):

http://codereview.chromium.org/384078/diff/1/3#newcode604
Line 604: // return NORMAL;
On 2009/11/12 09:56:49, William Hesse wrote:
> Remove.

Done.

http://codereview.chromium.org/384078/diff/1/3#newcode795
Line 795: // A rewrite of NULL indicates a global variable or explict arguments
access.
Truthified.

http://codereview.chromium.org/384078/diff/1/3#newcode807
Line 807: Property* property = rewrite->AsProperty();
Added

http://codereview.chromium.org/384078/diff/1/4
File src/fast-codegen.cc (right):

http://codereview.chromium.org/384078/diff/1/4#newcode132
Line 132: void FastCodeGenerator::VisitCondition(Expression* expression,
Removed for now.

http://codereview.chromium.org/384078/diff/1/5
File src/fast-codegen.h (right):

http://codereview.chromium.org/384078/diff/1/5#newcode73
Line 73: void VisitCondition(Expression* expression, Label* on_true, Label*
on_false);
I'll call it something else if I revisit the idea.

http://codereview.chromium.org/384078/diff/1/7
File src/x64/fast-codegen-x64.cc (right):

http://codereview.chromium.org/384078/diff/1/7#newcode84
Line 84: // Receiver is located above the frame pointer, return address and
Using "above" and "below" wrt stacks is the stuff religious wars are started
over. Rephrasing completely is probably better.
The same probably goes for parameter numbering (I'd say parameters are counted
from 0, so the receiver is parameter -1).
I think I'll go for "before the parameters on the stack".
We don't have a ParameterOperand, probably since it will require the number of
parameters as an argument as well, which reduces its immediate appeal).

http://codereview.chromium.org/384078/diff/1/7#newcode91
Line 91: // The stub will rewrite receiever and parameter count if the previous
fixed

http://codereview.chromium.org/384078/diff/1/7#newcode95
Line 95: Slot* arguments_slot = arguments->slot();
I'll inline it.
We probably don't have the SlotOperand function because it would need to go in
the macro-assembler (because its return type is Operand on intel and MemOperand
on ARM), but it would require the code of SlotOffset which resides in codegen.
maybe we could move SlotOffset to the macro assembler(s) as well.

Powered by Google App Engine
This is Rietveld 408576698