Commit Graph

71 Commits

Author SHA1 Message Date
iposva@chromium.org
a1ec99c05d - Remove function boilerplate objects and use SharedFunctionInfos in
their place.
- Add one field to the SharedFunctionInfo to remember the number of
  literals used in this function.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4211 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-23 06:04:44 +00:00
fschneider@chromium.org
ebf9e6e8e2 Remove unused LivenessAnalyzer class.
Also remove unused attributes related to it from the ast.
Review URL: http://codereview.chromium.org/1117003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4194 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-19 12:54:35 +00:00
kmillikin@chromium.org
a9202fc45d Begin using a list of bailouts instead of a singleton in the fast code generator.
A list of bailout descriptions is kept in the CompilationInfo
structure that is shared between the primary and secondary code
generators.  The primary adds a description to the list for each
bailout position.

Responsibility for binding labels is moved from the primary to the
secondary code generator. All the labels still target the start of the
secondary code and the compilation state of the primary is still
ignored.

Move the compilation mode flag to the CompilationInfo.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3920 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-02-19 14:52:39 +00:00
ager@chromium.org
806c15e4b5 Remove the LookupResult IsValid method because it is confusing.
Replaced IsValid by IsPropertyOrTransition and used IsProperty in most
of the places where IsValid was used before.  Most of the time when
inspecting a lookup result we really want to know if there is a real
property present.  Only for stores are we interested in transitions.

BUG=http://crbug.com/20104
TEST=cctest/test-api/NamedInterceptorMapTransitionRead
Review URL: http://codereview.chromium.org/647015

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3901 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-02-18 15:10:35 +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
b04a26dc31 Harden global variable accesses in the fast code generator.
Explicitly check that global variables do not have accessors or
interceptors in the fast code generator syntax checker.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3828 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-02-10 13:46:15 +00:00
kmillikin@chromium.org
30cf88af6b Restrict the syntax that we aggressively optimize.
Do not use the speculative compiler for functions with other than one
statement in the body, and do not use it if subexpressions can have
side effects.  Bailing out to the beginning of the full code is not
sound if side effects have already occurred.

Add tests that would fail without the restrictions.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3826 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-02-10 09:18:55 +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
fschneider@chromium.org
2f0f6face1 Fast compiler: Load globals variables directly from property cells.
This is a first step towards loading globals directly from property cells instead
of going through a load IC.

This change supports only properties with the DontDelete attribute since
we are only able to bailout into the generic code generated by the secondary 
code generator the beginning of a function. The resulting fast-case code is 
specialized for a specific context. When invoked with a different global object, 
it will always bailout to the secondary code.

When loading a property that does not exist at compile-time or a property
that is deleteable we still generate the generic load IC.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3808 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-02-05 13:57:18 +00:00
kmillikin@chromium.org
c174657e9e Incorporate the arguments to the code generator constructors and their
MakeCode functions in the CompilationInfo structure.  This makes it
easier to add new arguments and makes all arguments uniformly
available to the various backends.
Review URL: http://codereview.chromium.org/566008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3789 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-02-03 16:12:55 +00:00
ager@chromium.org
dc49c566a4 Use the virtual-frame based optimizing compiler for split-compilation
bailouts.  For now the virtual-frame state at entry of a function is
hard-coded when using the virtual-frame based compiler as the
secondary compiler.

Setup frame pointer correctly on function entry on ARM in
fast-codegen-arm.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3776 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-02-03 07:58:47 +00:00
kmillikin@chromium.org
41865cd677 Implement simple fast-path code for functions containing this property stores and global variables.
Code is specialized to the initial receiver.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3760 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-02-01 17:01:58 +00:00
kmillikin@chromium.org
5536273594 Add fast code generator visitor.
It does not yet emit code so there is a flag --print-ir to print the
AST as seen by the code generator.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3748 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-29 15:29:33 +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
kmillikin@chromium.org
e7528c4ac6 Propagate receiver from initial call site to code generator.
When doing lazy compilation of methods, allow the code generator to know the
(initial) receiver at the (initial) call site.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3739 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-29 09:52:51 +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
1405258621 Rename the fast-codegen* files to full-codegen*.
Review URL: http://codereview.chromium.org/549109

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3662 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-20 16:28:21 +00:00
kmillikin@chromium.org
6ad58b53f4 Rename the toplevel code generator from "Fast" to "Full". It was
always ambiguous whether it tried to generate fast code, or generate
it quickly.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3660 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-20 15:51:03 +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
kmillikin@chromium.org
9095abb776 Introduce 'top-of-stack caching' to the toplevel code generator by
allowing the value of the rightmost subexpressions to be evaluated
into an accumulator register (eg, eax, rax, or r0) rather than onto
the stack.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3630 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-18 14:04:55 +00:00
fschneider@chromium.org
1cc579ff4e Fix issue 541 and some refactoring of the top-level compiler.
* Refactor VisitProperty to use the platform-specific methods for emitting the IC calls.
* Refactor recording of source positions in the top-level compiler.
* Correct the recorded source positions for assignments and property loads.
* Fix bug on x64 where source positions were not recorded before a calling a call-IC.
* Correct some inconsistencies between IA-32 and X64 top-level code generator.

We now pass all regression tests with 
--always-fast-compiler.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3612 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-15 12:00:59 +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
39b9f57f19 Cleanup the handling of control flow in the toplevel code generator.
Do abstract the setting and restoring of 'argument' state into a
function that takes arguments.

Do not set the argument state in the code generator unless it
represents arguments to a recursive call to Visit.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3594 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-13 11:29:08 +00:00
fschneider@chromium.org
fdba189730 Fix a problem with const initialization in the top-level code generator.
When initializing the special local variable containing the reference to the enclosing 
function in named functions we now (correctly) emit an INIT_CONST instead of INIT_VAR,
and we correctly bail out in the top-level code generator.

Also part of this change is adding missing statement position information 
for some statements in the top-level code generator.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3587 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-12 17:22:57 +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
kmillikin@chromium.org
b74daccff0 Style cleanup of switches over Slot::Type in the nonoptimizing code
generator.

The Slot::Type enumeration has four values.  It should never be
necessary to use a default to handle the case of a value out of range
of the enumeration.  Doing so silences a useful warning when one of
the enumeration values is actually forgotten or when a new enumeration
value is added.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3532 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-05 09:11:10 +00:00
fschneider@chromium.org
637a21952f Added general pre- and postfix count operations to top-level compiler.
Until now we only supported postfix operations on global variables.
This change add generic count operations to the top-level compiler.

I tried to re-use code from the code generator used for assignment expressions
where possible.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3530 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-01-04 13:56:31 +00:00
lrn@chromium.org
9b0a967cae Fast-codegen: Adding support for try/catch and throw.
Still no support for lookup-variables, so we bailout if using the catch variable.

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


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3498 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-12-18 13:38:28 +00:00
lrn@chromium.org
482d434f4d Fast codegen: Implement with.
Review URL: http://codereview.chromium.org/491077


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3473 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-12-16 09:51:07 +00:00
lrn@chromium.org
9ff5f9daed Fast-codegen: Implementing try/finally on top of nesting context.
Review URL: http://codereview.chromium.org/492002


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3461 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-12-14 11:09:25 +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
lrn@chromium.org
aef02ccccb Fast codegen: Working break and continue.
Started framework for all intra-functional outward control transfers,
including handling of try/finally.

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


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3448 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-12-10 14:06:08 +00:00
kmillikin@chromium.org
b4e7472028 Disible the toplevel compiler for code containing for loops.
Review URL: http://codereview.chromium.org/492003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3447 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-12-10 13:12:13 +00:00
fschneider@chromium.org
2c9b2ab78a Adding ThisFunction expression to top-level compiler.
Review URL: http://codereview.chromium.org/466056

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3430 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-12-07 15:10:39 +00:00
fschneider@chromium.org
7a3a043eb2 Refactor code for generating assignments in the fast compiler.
1. Refactor the structure of VisitAssignment: The existing code is not ideal 
to be extended with support for compound assignments.

2. Reuse common code for keyed property assigments: Now variables rewritten 
to a property (.arguments access) are treated like normal keyed property
assignments. This allows us to remove some code duplication.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3425 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-12-04 14:30:27 +00:00
lrn@chromium.org
d4d2277e2e Fast-compiler: Add stack limit checks to back edges of while, do-while and for.
A few other tweaks.

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


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3355 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-25 09:05:30 +00:00
fschneider@chromium.org
b27f0c8d08 Cleanup and fix generated comments in the top-level compiler.
Review URL: http://codereview.chromium.org/384087

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3298 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-13 09:42:18 +00:00
fschneider@chromium.org
091c7a2306 Fixed bug in while-loops that caused an assertion to fail.
We forgot resetting true-/false-label to NULL after evaluating the 
condition expression in dowhile- and while-loops. 
This change fixes this.

This causes an assertion to fail in VisitIfStatement whenever there is an 
if-statement after a while-loop before. e.g. like in:

  var i=0, j=0;
  while(j<5) { j++; }
  if (i ==0 ) { j++; }




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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3255 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-10 09:57:13 +00:00
lrn@chromium.org
5b1faade55 Fast-compiler: Added trivial implementations of while and do/while.
Review URL: http://codereview.chromium.org/372055


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3250 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-09 13:22:38 +00:00
fschneider@chromium.org
9a7c403bbb Add support for all declarations in the top-level compiler:
Until now we only handled global declarations. This change
adds declarations of local variables, consts and functions.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3234 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-05 17:33:50 +00:00
fschneider@chromium.org
877db0f539 Add support for debugger statement to top-level compiler.
Review URL: http://codereview.chromium.org/366004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3220 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-04 19:04:29 +00:00
kmillikin@chromium.org
0ce4eab1b2 Obey the flag --lazy in the toplevel code generator.
There were two separate implementations of the function
'BuildBoilerplate' that is used to compile function declarations and
function literals.  The implementations did not do exactly the same
thing.  In particular, one ignored the flag --lazy.

Combine the two implementations.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3218 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-04 17:59:24 +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
whesse@chromium.org
84542872f6 Commiting changelist issue 348039 outside the codereview tool. Add comparisons to fast compiler
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3200 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-02 15:01:06 +00:00
kmillikin@chromium.org
1affb78938 Add support for for loops to the toplevel code generator.
Review URL: http://codereview.chromium.org/340059

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3199 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-02 14:12:48 +00:00
kmillikin@chromium.org
aa3b00a25a Add support for initialization block assignments in the toplevel code
generator, mimicing the behavior of the optimizing compiler.

Initialization blocks can only contain (thus begin and end) with a
property assignment in toplevel code.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3198 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-02 13:30:24 +00:00
kmillikin@chromium.org
b710d66f39 Refactor the somewhat complicated code generation for assignments into
a platform-independent structure and a few platform-specific helpers
to do the heavy lifting.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3195 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-02 11:01:47 +00:00
fschneider@chromium.org
a07146c0cb Support for post-fix count operations (x++, x--) where x is a global
variable for the top-level compiler.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3194 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-02 10:22:22 +00:00
whesse@chromium.org
e4f5b74dd1 Add conditional expressions (ternary choice operator) to fast compiler.
Review URL: http://codereview.chromium.org/340058

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3192 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-02 08:44:19 +00:00
kmillikin@chromium.org
20f780fdbc Implement new support for if statements in top-level code.
Review URL: http://codereview.chromium.org/346022

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3188 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-30 15:34:09 +00:00