Commit Graph

101 Commits

Author SHA1 Message Date
kmillikin@chromium.org
ac896bb5a0 Add a predicate IsPrimitive to AST Expression nodes.
IsPrimitive reflects that an expression's value is known statically to
be one of the ECMA-262-3 JS types other than Object (e.g., Undefined,
Null, Boolean, String, or Number).

The type conversions ToPrimitive, ToNumber, ToInteger, ToInt32,
ToUInt32, ToUint16, ToString, or ToObject cannot invoke user code for
primitive input values.  ToObject throws a TypeError if its input is
Undefined or Null.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4116 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-12 13:10:42 +00:00
kmillikin@chromium.org
cb1f817f77 Initialize reaching definitions state for all flow graph nodes.
Reaching definitions in (RD_in) is initially empty for all nodes.  Gen
and kill sets are computed.  AST node numbers are used for nodes to
refer to their definition number.

Also: two small changes to flow graph printing.  Children of branch
nodes are visited in right-to-left order when performing depth first
search.  Instructions are numbered locally within blocks so as to not
destroy AST node number before printing (it's useful to print the
definition).

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4107 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-11 16:24:05 +00:00
ager@chromium.org
ef371f3f24 Do not waste space for the fast-case elements backing storage for
object-literals with few elements but large element indices.

We can decide at parse time whether the created object literal should
have fast-case of slow-case elements.

Remove unused runtime function.
Review URL: http://codereview.chromium.org/805004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4100 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-11 10:34:29 +00:00
fschneider@chromium.org
7d933936d3 Fix assigned variables analysis.
This change fixes a bug with the arguments object that occurred with
r4087 and r4088. The fix is not marking the arguments variable as trivial
since it can have side effects.


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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4099 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-11 10:28:40 +00:00
whesse@chromium.org
a77411bc70 Revert changes 4088 and 4087 to fix build.
Review URL: http://codereview.chromium.org/805005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4089 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-10 20:41:11 +00:00
fschneider@chromium.org
0143d707a6 Add an assigned variables analysis.
This change adds a pass over the AST that computes the
set of assigned variables for locals and parameters for each expression.

The result of this analysis is used to for two purposes:
1. Recognize variables that are trivial subexpressions. A left sub-expression
   of a binary operation is trivial if it is a local variable or a parameter
   and it is not assigned in the right sub-expression. In the case of a 
   trivial left sub-expression we evaluate the right first.
   Currently only binary operations and compare operations are considered
   when finding trivial left sub-expressions.

2. Recogize certain simple for-loops with a constant trip count where the loop
   variable is always within smi range. If the loop count variable is not
   assigned in the body of the loop (except in the update expression the
   for-loop). This allows omitting smi checks on operation using the loop
   count variable.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4087 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-10 17:19:22 +00:00
kmillikin@chromium.org
0c2885f83d Add IsStackAllocated helper for variables.
Add a simple boolean helper function for Variables and Slots.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4065 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-09 10:39:18 +00:00
whesse@chromium.org
b1bac8ce4f Fix typographical error in comment in r4056
Review URL: http://codereview.chromium.org/668258

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4057 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-08 16:01:40 +00:00
whesse@chromium.org
3dbefbedef Add AST analysis that flags expressions that will have ToInt32 applied to them.
Simplify AST analysis of side-effect-free int32 expressions.
Review URL: http://codereview.chromium.org/668256

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4056 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-08 15:28:57 +00:00
kmillikin@chromium.org
bce8d2ebae Remove unneeded variable usage analysis.
A variable usage analysis pass was run on toplevel and lazily-compiled
code but never used.  Remove this pass and the data structures it
builds.

The representation of variable usage for Variables has been changed
from a struct containing a (weighted) count of reads and writes to a
simple flag.  VariableProxies are always used, as before.  The unused
"object uses" is removed.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4052 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-08 13:01:24 +00:00
kmillikin@chromium.org
8528d650d8 Initial implementation of an edge-labeled instruction flow graph.
The flow graph is built by walking the AST.  Edges are labeled with
instructions (AST nodes).  Normal nodes have a single predecessor edge and a
single (labeled) successor edge.  Branch nodes are explicit, they have a
single predecessor edge and a pair of (unlabeled) successor edges.  Merge
nodes are explicit, they have a pair of predecessor edges and a single
(unlabeled) successor edge.

There is a distinguished (normal) entry node and a distinguished (special)
exit node with arbitrarily many predecessor edges and no successor edges.

The graph is intended to support graph-based analysis and transformation.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4051 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-08 12:53:11 +00:00
whesse@chromium.org
7657955f3f Add syntax checker for side-effect-free expressions to AstOptimizer in rewriter.cc. Add bit fields for syntax checker results to Expression in ast.h.
Review URL: http://codereview.chromium.org/660372

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3998 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-02 14:00:59 +00:00
sgjesse@chromium.org
d960bd2c4b Re-introduce this as a trivial expression
The reverts r3939 as it turned out not be the root cause for the regression http://crbug.com/36604.
Review URL: http://codereview.chromium.org/661365

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3993 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-02 11:58:10 +00:00
sgjesse@chromium.org
6ceb6d95fc Don't treat this as a trivial expression.
This caused some regressions in Chromium.

BUG=http://crbug.com/36604
Review URL: http://codereview.chromium.org/652228

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3939 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-02-24 14:02:20 +00:00
kmillikin@chromium.org
e1041c9f9c Introduce 'trivial' expressions, use them for this property assignments.
Add a (currently) syntactic predicate to AST expression nodes telling
whether they are 'trivial'.  Trivial expressions have no side effects,
do not require storage to be allocated for them, and can be evaluated
out of order (because their value does not change between when they
are visited by the code generator as expressions in the AST and when
it is consumed).

Mark 'this' and literals as trivial.  Allow them to be pushed on the
virtual frame.  Make use of them to push 'this' more lazily in this
property assignments.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3906 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-02-19 09:01:31 +00:00
fschneider@chromium.org
4a2c81d3b0 Add last use data flow information to the fast code generator.
This change add simple local live variable information to 
the fast code generator.  It supports only AST nodes that 
are accepted by the syntax checker.

Each variable use points to a variable definition structure
which contains the last use of the definition.

To determine whether a variable is live after a certain point
we can check whether its last use occurs later in the evaluation
order defined by the AST labeling number.

The new information is currently only printed out together with
the IR and not yet used for code generation.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3839 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-02-12 10:16:30 +00:00
kmillikin@chromium.org
9b5c312bfc Initial implementation of fast path operation for bitwise OR.
Support a binary operation (bitwise OR) so long as it's not nested in
the left subexpression.  This ensures that the expression stack never
has height greater than two and so can be kept fully in registers.

The bounded expression stack height and the absence of any side
effects on the fast path allows us to still bailout out to the very
beginning of the function if any of our fast-path checks fail.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3822 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-02-09 13:44:43 +00:00
lrn@chromium.org
f03e42b133 Added validating JSON parser mode to parser.
Review URL: http://codereview.chromium.org/549207

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3752 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-02-01 10:31:55 +00:00
kmillikin@chromium.org
8588518851 Introduce a stack-allocated structure to encapsulate compile-time information.
Use it to hold the possible shared function info, the possible
receiver, and the compilation loop nesting depth.  Remove loop nesting
from FunctionLiteral AST nodes.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3744 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-29 11:55:40 +00:00
fschneider@chromium.org
88f6734ddb Add a pass for the fast compiler to label expression nodes.
This change adds a post-order numbering to AST nodes that
are relevant for the fast code generator. It is only invoked
together with the fast compiler. 

Also changed the ast printer to print the  numbering for 
testing purposes if it is present.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3738 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-29 09:42:13 +00:00
kmillikin@chromium.org
2b62886dab Refactor the selection of code generator and add the possibility of a
simpler backend for non-toplevel code.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3721 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-27 15:23:48 +00:00
kmillikin@chromium.org
3e8539d873 First step of refactoring expression contexts in the toplevel code
generator.

Contexts are no longer stored in the AST but in the code generator's
state.  This means that the running the code generator selector is not
required to use the toplevel code generator (for instance, if we
already know that we can and should use it).

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3645 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-19 12:41:02 +00:00
fschneider@chromium.org
acf74b04a7 Fix a problem when compiling built-ins with the top-level compiler.
Replace runtime call to NumberAdd with call to binary op stub.

Until now the top-level compiler always called a runtime function
for count operations. 

In some places we expected in the JS builtins smis as arguments.
If we perform a count operation before all smis would get converted into
heap numbers by the runtime number add function and result in a runtime 
assert.

Also: Add missing debugger information in the top-level compiler for 
do-while loops.


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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3610 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-14 17:22:59 +00:00
kmillikin@chromium.org
9dec8f3c74 Remove an inlined ASSERT made obsolete by r3598.
Review URL: http://codereview.chromium.org/549035

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3599 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-13 16:21:06 +00:00
kmillikin@chromium.org
ede65c19a1 Remove a pair of problematic uses of the Reference utility class from
the code generators.

These uses broke the rules of the class because it was safe to do so,
but there was no real reason to do it that way.
Review URL: http://codereview.chromium.org/543041

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3598 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-13 16:01:15 +00:00
kmillikin@chromium.org
f0b8c2d97a Some cleanup of the toplevel code generator:
* Rename the operation of filling a context with a value.  Formerly it
  was 'Move', now it's 'Apply' so as to avoid confusion with various
  other Moves (eg, in the toplevel codegen, in the macro assemblers).

* Use the abstraction Drop rather than math on the stack pointer.

* Add a predicate on AST expression nodes to abstract a repeated test
  whether we should us a regular (named) IC or a keyed IC.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3580 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-12 08:48:26 +00:00
lrn@chromium.org
46504c1557 Attempt to make \b\w+ faster. Slight performance increase on, e.g., string unpacking.
Review URL: http://codereview.chromium.org/507051


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3563 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-07 19:01:23 +00:00
fschneider@chromium.org
735aee05f0 Use one runtime call for creating object/array literals in
the code generator.

The runtime function checks if it needs to create a boilerplate
object or if it can clone from an existing boilerplate.

This is already done in the top-level compiler. 

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3516 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-12-22 12:41:45 +00:00
bak@chromium.org
07742f5672 -Inlined double variant of compare iff one of the sides is a constant smi and it is not a for loop condition.
Review URL: http://codereview.chromium.org/507040

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3487 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-12-18 06:38:12 +00:00
iposva@chromium.org
4380812b39 - Undo unfortunate renaming of StaticType.
Review URL: http://codereview.chromium.org/506050

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3478 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-12-17 06:21:50 +00:00
fschneider@chromium.org
c25151faa6 Adding compound assignments to the top-level compiler.
Review URL: http://codereview.chromium.org/486008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3455 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-12-11 16:09:16 +00:00
fschneider@chromium.org
3a21aafa7c Added fast compiler support for calling JS runtime functions.
Also added a simple test that invokes a JS runtime function
in top-level code.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3371 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-27 00:28:06 +00:00
yurys@chromium.org
9bafc32932 Step next should respect do/while condition block.
Condition block of do/while statements is a valid break location so it should have its own position. The block is represented by a regular Expression node so we cannot store the position in it, instead the position is stored in a separate field in DoWhileStatement AST node.

BUG=514
Review URL: http://codereview.chromium.org/385136

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3312 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-16 21:59:31 +00:00
ager@chromium.org
2252cc1bc9 Fix inline constructor code bailout.
Remove variable that is currently unused.

BUG=http://code.google.com/p/v8/issues/detail?id=502
Review URL: http://codereview.chromium.org/392001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3267 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-11 09:00:09 +00:00
kmillikin@chromium.org
8595cbb0d3 Remove an unused enumeration value.
Review URL: http://codereview.chromium.org/366030

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3233 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-05 17:25:50 +00:00
kmillikin@chromium.org
3eb69a34fa Begin using the top-level code generator for code that is inside
directly-applied function literals that are themselves compiled with
the top-level code generator.

The choice is guarded by a test that the function is anonymous (thus
not expected to be recursive) and not in a loop.

A compilation hint is set in the shared function info and used to make
the choice.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3206 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-03 14:48:59 +00:00
kmillikin@chromium.org
ab3e85eeb4 Initial implementation of top-level compilation of expressions in test
context.  Test contexts are used for the left subexpressions of
short-circuited boolean operators.  The right subexpressions inherit
their expression context from the binary op expression.

Compilation of short-circuited operations in effect and test context
is straightforward:

effect(e0 || e1) =
 test(e0, L0, L1)
 L1: effect(e1)
 L0:

test(e0 || e1, L0, L1) =
 test(e0, L0, L2)
 L2: test(e1, L0, L1)

Because the value of the first subexpression may be needed as the
value of the whole expression in a value context, we introduce a
hybrid value/test contest (the value is needed if true, but not if
false).

value(e0 || e1) =
 value/test(e0, L0, L1)
 L1: value(e1)
 L0:

The compilation of value/test and test/value (introduced by boolean
AND) is:

value/test(e0 || e1, L0, L1) =
 value/test(e0, L0, L2)
 L2: value/test(e1, L0, L1)

test/value(e0 || e1, L0, L1) =
 test(e0, L0, L2)
 L2: test/value(e1, L0, L1)

Boolean AND is the dual.  The AST nodes themselves (not their parents)
are responsible for producing the proper result (effect, value, or
control flow) depending on their context.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3187 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-30 14:06:48 +00:00
kmillikin@chromium.org
d92fa03eca Move the Location class into the AST Expression class as a member.
Since it is (currently) only an enum, change it to an enum (for now).

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3181 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-30 08:36:46 +00:00
kmillikin@chromium.org
9ad7a66f98 Rename the kinds of locations to be consistent with the (codegen)
context of the expressions they label.  Introduce an "unintialized"
location to catch failure to assign any location at all.

Changed the object literal initialization on ARM to use a Store IC in
the same cases where it did on the other platforms.  This was required
because the location of the literal property name is given an
"unitialized" location.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3171 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-29 10:35:29 +00:00
kmillikin@chromium.org
6a83cb0ced In the toplevel compiler, shift the responsibility of assigning a
location to an Expression AST node from the node's parent to the node
itself.

This allows an inherited code generation context from a parent node to
be passed arbitrarily far down the tree (eg, the subexpression of a
unary not is in the same context as the unary expression itself, the
then and else subexpressions of the ternary operator are in the same
context as the whole expression, and so forth).

We do not yet take advantage of this in the backend (eg, the right
subexpression of short-circuited OR is still compiled by using the
parent's destination location, rather than the subexpression's
itself).

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3163 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-28 13:25:40 +00:00
kmillikin@chromium.org
339e49c0b2 Added first support for tracking locations of expressions in the
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
2009-10-15 16:42:22 +00:00
kmillikin@chromium.org
6f5ed57683 Untangle some #include dependencies.
"jsregexp.h" and "jump-target.h" required "macro-assembler.h" to
always be included first.  Instead the include of "macro-assembler.h"
has moved into those header files.

"dateparser-inl.h" required "dateparser.h" to always be included
first.  Instead the include of "dateparser.h" has moved into
"dateparser-inl.h".

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3074 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-15 15:01:36 +00:00
kmillikin@chromium.org
ac731896da Remove a redundant field in the FunctionLiteral class. The boolean
contains_array_literal_ implies materialized_literal_count_ > 0, and
we appear not to need to know about array literals specifically.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3055 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-13 09:37:17 +00:00
kmillikin@chromium.org
a563800b4c Initial implementation of printing the AST as a JSON string. This
implementation is not yet complete (it prints only the node name for
some AST constructs) and does not serialize everything needed to
reconstitute the AST.

It is motivated by a desire to prototype source-to-source
transformations in JavaScript itself (or anything else that can grok
JSON), but it should have other uses too.

Feedback is welcome.
Review URL: http://codereview.chromium.org/131101

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3051 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-12 15:06:28 +00:00
kmillikin@chromium.org
586f94f292 Split the AST LoopStatement type into separate types for do/while,
while, and for loops.

Previously they were distinguished by a type field, which required
runtime asserts to avoid invalid nodes (since not all loop types have
the same internal structure).  Now they C++ type system is used to
require well-formed loop ASTs.

Because they do not share compilation code, we had very large
functions in the code generators that merely did a runtime dispatch to
a specific implementation based on the type.
Review URL: http://codereview.chromium.org/269049

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3048 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-12 13:14:06 +00:00
kmillikin@chromium.org
fb038bf146 Two changes, one a refactoring and one that affects V8's JS semantics.
1. Change the AST node type CallNew to be a subclass of Expression
   rather than Call.  It's not really a call but it just happens to
   have the same fields.

2. Change our error reporting for invalid left-hand sides in for-in
   statements, pre- and postfix count expressions, and assignments.
   Before we signaled a syntax error at compile time *unless* the LHS
   was a function call or 'new' expression, in which case we signaled
   a reference error at runtime.  Now we signal a reference error at
   runtime in all cases.  This matches the JSC behavior in Safari 4.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2994 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-09-30 09:49:36 +00:00
kmillikin@chromium.org
928bfae405 Remove CallEval as a subclass of the Call AST node type. We were not
differentiating between Call and CallEval except in the code
generator, and the difference can be detected from a regular Call AST
node at code generation time.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2984 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-09-29 13:28:30 +00:00
kmillikin@chromium.org
f0ba671344 Move the per-ast-node statement position to only statement node types.
It was not currently being used for expressions or declarations and
always had the default initial value.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2976 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-09-28 12:01:05 +00:00
sgjesse@chromium.org
4e03645dc4 Analyze functions for assignment to this properties.
During parsing functions are analyzed for statements of the form this.x = ...;. These assignments are categorized in two types: simple and non simple. The simple ones are where the right hand side is known to be either a constant or an argument to the function. If a function only contains statements of this type the property names are collected and for the simple assignments the index of the argument or the constant value assigned are stored as well.

When the initial map for a function is created and the function consists of only this type of assignemnts the initial map is created with a descriptor array describing these properties which will be known to always exist in an object created from the function.

The information on this property assignments is not collected during pre-parsing so if compiling using pre-parse data these optimization hints are not available.

Next step will be to use the information collected for the simple assignments to generate constructor code which will create and initialize the object from this information without calling the code for the function.
Review URL: http://codereview.chromium.org/172088

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2710 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-08-19 07:30:20 +00:00
sgjesse@chromium.org
8c9b30af83 Removed some comments which did not make any sense.
Review URL: http://codereview.chromium.org/159783

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2606 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-08-03 10:59:00 +00:00