Commit Graph

346 Commits

Author SHA1 Message Date
whesse@chromium.org
493c9f072c Enable writes and reads of context slots in fast compiler.
Review URL: http://codereview.chromium.org/360054

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3242 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-09 09:56:57 +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
kmillikin@chromium.org
debb5f8b48 Change the special handling of typeof comparisons to strings for
regular expressions to be consistent with typeof in other contexts.
Typeof regular expressions should now be 'function' in all contexts.

In the JS natives, IS_FUNCTION, IS_OBJECT, and IS_REGEXP return the
same answers as before.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3231 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-05 16:08:48 +00:00
sgjesse@chromium.org
41d6cae46d Fix issue 493: Infinite loop when debug break is set when entering function.apply.
In the generated code for function.apply there was a loop checking the stack limit for interruption. This loop would call into the runtime system to handle interuption and keep running until there was no interruption. However if the interuption was debug break the runtime system would never clear the interruption as debug break is prevented in builtins are prevented and the assumption here was that returning with the debug break flag set would move execution forward.

Renamed initial_jslimit and initial_climit to real_jslimit and real_climit. Renamed a few external references related to the stack limit as well.

Exposed the real stack limit to generated code to make the stack check when entering function.apply use the real stack limit and not the stack limit which is changed to signal interruption.

Added the real stack limit to the roots array.

BUG=http://code.google.com/p/v8/issues/detail?id=493
TEST=cctest/test-debug/DebugBreakFunctionApply
Review URL: http://codereview.chromium.org/345048

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3229 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-05 13:59:40 +00:00
ager@chromium.org
b5a19c1036 Rework the way we handle the fact that the ARM simulator uses a
separate JS stack.

In exception handling, we need to be able to compare addresses into
the JavaScript portion of the stack with the address of a C++ handler
on the stack.  Since the stacks are separate on the simulator, we need
a JavaScript stack address corresponding to a C++ try catch handler in
order to perform valid address comparisons.

On the simulator, we now link the C++ try catch handlers indirectly
through the JS stack and use the JS stack indirection address for
comparisons.

      JS                    C++
                           
                           handler
 [C++ address]   <------    next_
                \
                 \
                  \---->   handler
 [C++ address]   <------    next_


On actual hardware the C++ try catch handlers continue to be directly
linked.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3228 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-05 13:27:21 +00:00
whesse@chromium.org
ec7034e65b Make "typeof this" return object in fast compiler.
Review URL: http://codereview.chromium.org/366028

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3227 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-05 12:45:53 +00:00
kmillikin@chromium.org
efd20687c9 In the toplevel code generator, support local context allocation
provided that none of the parameters need to be copied into the
context.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3224 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-05 10:38:26 +00:00
whesse@chromium.org
c1e7dd83a4 Implement typeof in fast compiler.
Review URL: http://codereview.chromium.org/354027

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3222 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-05 10:15:25 +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
fschneider@chromium.org
ff0d885b95 Emitting the common return sequence in the top-level compiler in one function for each platform.
I factored out the code for emitting the return sequence since we had this code duplicated in the top-level compiler.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3213 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-04 14:11:39 +00:00
kmillikin@chromium.org
34dee0319c Remove the typeof state threaded through the code generator. It was
used to signal that an expression was the immediate subexpression of
typeof, or (?) in the arm of a conditional expression itself in the
typeof state.

It was inconsistently consulted.  It was not used for property loads,
but only for slot loads.  This means that we matched the Webkit JSC
(not Spidermonkey) behavior for:

typeof(true ? x : y)  // throws ReferenceError

and we matched the SpiderMonkey behavior (not JSC) for:

with ({}) { typeof(true ? x : y) }  // ==> "undefined"

Now we are expected to match the JSC behavior in all cases.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3212 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-04 13:56:41 +00:00
christian.plesner.hansen@gmail.com
a1b2f47600 Reverting 3174. Aka reapplying 3150, 3151 and 3159. Aka api accessor
ics.

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


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3209 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-04 08:51:48 +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
85fc0d688a Fix a latent bug in the top-level compilation of function calls.
Calls to a non-global variable would go through the "call to a global"
path, rather than the "call to an arbitrary (other) expression" path.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3204 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-03 12:47:19 +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
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
fschneider@chromium.org
e38cd233c3 Support for function calls on an arbitrary expression that returns
a function in the top-level compiler.

e.g.

function f() { return (function() { return true; }) }
f()()


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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3196 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-02 12:04:35 +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
e09c4f20c5 Add unary not operator to fast compiler.
Review URL: http://codereview.chromium.org/343057

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3193 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-11-02 10:17:12 +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
whesse@chromium.org
b7c0b738c7 Add void operator to fast compiler.
Review URL: http://codereview.chromium.org/342055

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3186 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-30 11:32:42 +00:00
erik.corry@gmail.com
dbd7f20d2d Introduce a switch for the new snapshot code and switch
it on by default.  Includes bug fixes for new snapshots.
Review URL: http://codereview.chromium.org/342054

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3184 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-30 10:23:12 +00:00
fschneider@chromium.org
07cd399b5c Support for calls on named and keyed properties in the fast compiler of the form:
o.x() and o[expr]()

other changes:
- Fix missing relocation info for StoreIC on global object.
- Generate only one common return sequence instead of always appending 
  "return <undefined>" at the end of each function: The first JS 
  return-statement will generate the common return sequence. All
  other return-statements will generate a unconditional branch to the common
  return sequence.


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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3183 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-30 10:22:31 +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
fschneider@chromium.org
143b4b87b4 Support for property assignment in the fast compiler.
The code for .result = (b.y = 99) where b is a global variable is:

  push [esi+0x17]
  mov ecx,0xf5c229ad          ;; object: 0xf5c229ad <String[1]: b>
  call LoadIC_Initialize
  nop
  mov [esp],eax
  mov eax,0xc6
  mov ecx,0xf5c25c41          ;; object: 0xf5c25c41 <String[1]: y>
  call StoreIC_Initialize
  nop
  mov [esp],eax
  pop [ebp+0xf4]

There is still some room for improvement in the generated code.

Other changes:
 - Replaced switch-statement in FastCodeGenerator::VisitProperty with DropAndMove(...)
 - Do not emit nop after IC calls on ARM.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3180 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-30 07:56:38 +00:00
kmillikin@chromium.org
b1defd51cb Rename the Location type tags to be consistent with our current naming
scheme for enumerations (eg, EFFECT => kEffect).

Remove the ability to move from one Location to another, which should
never be necessary.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3175 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-29 13:58:04 +00:00
sgjesse@chromium.org
be769f6a24 Reverting 3159, 3151 and 3150
TBR=christian.plesner.hansen@gmail.com
Review URL: http://codereview.chromium.org/343035

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3174 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-29 13:17:11 +00:00
kmillikin@chromium.org
c612751095 Fix x64 build.
TBR=whesse@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3173 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-29 12:19:20 +00:00
whesse@chromium.org
05d6294e98 Add binary operations to fast compiler.
Review URL: http://codereview.chromium.org/342019

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3172 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-29 11:55:03 +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
lrn@chromium.org
0aecc29024 Issue 485: Fix leak of builtins object through call and apply functions.
Review URL: http://codereview.chromium.org/345007


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3164 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-28 13:51:30 +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
erik.corry@gmail.com
97de363ef5 * Fix new snapshot code on ARM.
Review URL: http://codereview.chromium.org/344011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3161 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-28 12:37:54 +00:00
fschneider@chromium.org
a84ba0e15c Fix missing recording of source position for property access in fast compiler.
Review URL: http://codereview.chromium.org/341002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3157 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-28 10:14:32 +00:00
whesse@chromium.org
0bd21aa0f9 Factor out a commonly used code sequence to DropAndMove(Location, Register)
Review URL: http://codereview.chromium.org/337060

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3156 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-28 09:56:14 +00:00
fschneider@chromium.org
64e1d3205f Support for property access (named, keyed) in the fast compiler.
The generated code is similar to the existing code, but we never
inline any IC code in the fast compiler.


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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3152 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-27 16:11:12 +00:00
christian.plesner.hansen@gmail.com
d05c23dbd0 Fixed build error on x64.
Review URL: http://codereview.chromium.org/339027


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3151 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-27 15:57:21 +00:00
christian.plesner.hansen@gmail.com
895f1d22e5 Implemented specialized stubs for API getters. This includes a number
of individual changes:

  - Added infrastructure for custom stub caching.
  - Push the code object onto the stack in exit calls instead of a
    debug/non-debug marker.
  - Remove the DEBUG_EXIT frame type.
  - Add a new exit stub generator for API getters.


Committed: http://code.google.com/p/v8/source/detail?r=3130
Review URL: http://codereview.chromium.org/330017

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3150 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-27 15:38:49 +00:00
whesse@chromium.org
29914b6be7 Remove --check-stack flag from V8.
Review URL: http://codereview.chromium.org/338017

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3149 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-27 14:56:50 +00:00
whesse@chromium.org
299a491d7a Add VisitCallNew to fast compiler.
Review URL: http://codereview.chromium.org/334041

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3148 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-27 14:52:55 +00:00
kmillikin@chromium.org
a73bbe605e Make it more pleasant to work with expression locations in the
top-level code generator backend.  Introduce function to move one
location to another (source cannot be nowhere); to move registers,
slots, and literals into a location; and to move a location to a
register or slot.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3146 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-27 13:38:57 +00:00
erik.corry@gmail.com
fb2317b63b New snapshot framework. Doesn't work on ARM yet (code targets
are different).  Is able to deserialize the whole heap and run
some stuff.  Not available as the primary snapshot system yet.
Review URL: http://codereview.chromium.org/335009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3142 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-27 11:54:01 +00:00
whesse@chromium.org
0695df6eaa Add fucomip instruction to disassembler. Fix some other floating point instructions.
Review URL: http://codereview.chromium.org/316010

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3141 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-27 10:47:01 +00:00
sgjesse@chromium.org
a332c465db Fix x64 breakage in r3136.
Make sure that the return value is moved to rax. The line added back was accidently removed in r3136.

TBR=lrn@chromium.org
Review URL: http://codereview.chromium.org/339021

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3140 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-27 10:40:43 +00:00
kmillikin@chromium.org
42b28e8120 Fix x64 DEBUG build.
TBR=lrn@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3139 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-27 10:27:08 +00:00
lrn@chromium.org
59e7be2c03 Windows: Change test to not assume ebp is frame-pointer.
Review URL: http://codereview.chromium.org/329007


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3138 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-27 08:50:24 +00:00
kmillikin@chromium.org
76e1e22f15 Eliminate the constant location used for literals in the AST.
Literals now have a location of temporary by default and are
responsible for moving themselves into their location like all other
expressions.

The constant location turned out not to allow us to avoid checking
subexpressions in AST interior nodes, and it turned out to require
checking after some normal calls to Visit (like for the arguments to a
call).  With this change do not have to check after a call to Visit
that we got our result in the expected location.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3137 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-27 08:48:01 +00:00
sgjesse@chromium.org
c84af6828b Port optimization of calls to GenericBinaryStub to x64.
See description of the change in the ia32 changelist at http://codereview.chromium.org/246075.

Minor changes to the ia32 version using variables for the registers to pass parameters in (edx and eax) to make the parameter set up code easier to read.
Review URL: http://codereview.chromium.org/335005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3136 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-10-27 08:20:21 +00:00
lrn@chromium.org
b92a05942e Change NaN-test to only check for QNaNs, and API to only introduce QNaNs.
Review URL: http://codereview.chromium.org/339002


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