Commit Graph

569 Commits

Author SHA1 Message Date
fschneider@chromium.org
313f9505b4 Make accessors for oddball objects return Oddball* instead of Object*.
Fix a use of the hole value and the undefined value before initialization when
initializing V8. Before we just read a NULL value from them.
Review URL: http://codereview.chromium.org/8130002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9557 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-10-10 09:21:48 +00:00
danno@chromium.org
3b07abbdbe Activate smi-only optimizations for large array literals.
BUG=none
TEST=none

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9553 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-10-10 08:31:06 +00:00
fschneider@chromium.org
9bc30dfe93 Small simplification of HChange instruction.
Use existing flag to mark HChange instructions that deoptimize on undefined.

Also there is no need to store the source representation explicitly.
Review URL: http://codereview.chromium.org/8066007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9472 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-28 14:01:40 +00:00
vegorov@chromium.org
fd2bac7e92 Remove HEnvironment::CheckDepth.
R=fschneider@chromium.org
BUG=v8:1727

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9465 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-28 11:58:40 +00:00
fschneider@chromium.org
f85bcba479 Limit depth of inlining for --stress-opt runs to avoid going into infinite recursion.
Review URL: http://codereview.chromium.org/8060033

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9464 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-28 11:34:54 +00:00
fschneider@chromium.org
27e1a8d414 Improve our simple elimination of hole checks.
Currently we avoid checking for the hole value after array loads, if the
result is only used by instructions that definitely deoptimize in case
of the hole value (HChange instructions).

This change performs the same procedure for loading from deleteable/read-only
global variable where we can also avoid the check in the same cases.
Review URL: http://codereview.chromium.org/8054008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9453 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-27 13:03:19 +00:00
vegorov@chromium.org
2e08515d21 Check the depth of the constructed HEnvironment.
Temporary check to catch 1727 on the reliability bot.

R=fschneider@chromium.org
BUG=v8:1727

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9452 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-27 12:55:43 +00:00
kmillikin@chromium.org
bcb781d76a Record function call targets, use them for inlining.
Introduce a version of the CallFunctionStub that records monomorphic
call targets in a one-element cache in the instruction stream.  Use
the cache for inlining attempts in the optimizing backend.

R=fschneider@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9449 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-27 11:42:02 +00:00
kmillikin@chromium.org
c1b978c076 Fix a GC-safety issue in optimized code.
It's not safe to use an immediate heap object in generated unless we take
pains to ensure it's not in new space.  Continue using the caller's context
for inlined functions on all platforms except IA32.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9427 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-26 12:20:11 +00:00
jkummerow@chromium.org
0455aadbeb Add Crankshaft support for smi-only elements
Review URL: http://codereview.chromium.org/8002019

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9426 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-26 12:09:04 +00:00
kmillikin@chromium.org
883f32695b Enable inlining functions with contexts different than their caller.
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9421 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-26 09:17:56 +00:00
svenpanne@chromium.org
1311b8f0e2 Improve Hydrogen code for accessing undefined/null/Infinity.
In some special (but probably very common) cases we can do better than loading
from a global cell for these global properties by emitting the corresponding
constant directly. This opens up opportunities for further improvements, coming
in a separate CL...
Review URL: http://codereview.chromium.org/7992002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9409 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-23 08:00:06 +00:00
danno@chromium.org
f48c9f6557 Basic support for tracking smi-only arrays on ia32.
Activated by the flag --smi-only-arrays

Currently not crankshaft support, using flag on non-ia32 platforms will lead to write barrier misses and crashes.

BUG=none
TEST=elements_kind.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9392 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-22 11:30:04 +00:00
rossberg@chromium.org
fdade92c20 Reorganize object type enum, such that proxies are no longer in the middle
of the range of proper JS objects.

Unfortunately, callable types no longer form a range now. However, there
are only two anyway. We put them at either end of the range of JS object
types so that certain compares can be combined.

R=erik.corry@gmail.com,kmillikin@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9370 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-21 14:46:54 +00:00
kmillikin@chromium.org
99eab94443 Reapply "Clean up Context::Lookup and its uses."
The threading test failures seem to be due to a GC-unsafe place, that
mixed handles and raw pointers, in the runtime code for context
lookup.

R=fschneider@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9356 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-21 08:51:44 +00:00
fschneider@chromium.org
76c869434d Fix a bug with uninitialized const variables in the optimizing compiler.
We have to check for uninitialized uses before phi-elimination. Otherwise we
may miss such a use and result in using the hole value instead. This
causes a NULL-dereference or assertion failure.

BUG=96989
TEST=mjsunit/compiler/regress-96989.js
Review URL: http://codereview.chromium.org/7974009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9337 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-20 10:26:01 +00:00
fschneider@chromium.org
b77a69f22c Only do a full verify after computing dominators.
We don't modify the graph in later phases. This speeds up debug tests
by a lot.
Review URL: http://codereview.chromium.org/7942001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9325 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-19 15:09:30 +00:00
svenpanne@chromium.org
cf63503cad Unify the handling of comparinsons against null and undefined.
Although this patch is not small, most parts of it are rather mechanical:

 * First of all, the concept of a 'nil-like' value is introduced, which can be
   null or undefined. They are treated symmetrically regarding comparisons, so
   it makes sense to handle them in a uniform manner. It is a mystery why
   JavaScript defines two of those beasts, when even *one* is a design wart...

 * Extended and renamed a few things which now handle undefined in addition to
   null.

 * Made the parts of the full code generator and the hydrogen generation which
   deal with comparisons a bit more similar regarding their handling of special
   cases.

 * Refactored the syntactical detection of special cases for comparisons,
   hopefully making them a bit more readable and less copy-n-paste-oriented.
   Things like this should really be a one-liner in any sane programming
   language... :-P

 * Cut down the length of the argument lists of a few functions to something
   less insane, making them more easily understandable locally. This involves
   minor code duplication, but this was a good tradeoff and can be remedied
   later if necessary.

 * Replaced some boolean arguments with more readable enums.

 * Fixed a TODO: Values which are definitely a Smi or unboxed can never be equal
   to null or undefined.
Review URL: http://codereview.chromium.org/7918012

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9323 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-19 14:50:33 +00:00
fschneider@chromium.org
5cf540acce When --nolimit-inlining flag is set, don't limit inlining depth.
This flag is used to debug problems with inlining.
By default we still limit inlining to small functions and up to a maximum
depth to avoid too much code size growth.
Review URL: http://codereview.chromium.org/7919012

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9314 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-17 12:29:16 +00:00
danno@chromium.org
6a5e0448c8 Share Maps for ElementsKind transitions
Support sharing maps after an changing an object's ElementsKind for element kinds other then external elements.

R=svenpanne@chromium.org
BUG=none
TEST=external-arrays.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9304 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-15 16:38:47 +00:00
svenpanne@chromium.org
8c744768e2 Nuke CompareToNull AST node.
The Great Master Plan is to move the recognition of special cases for
comparisons further down the compilation pipeline where more information is
available. This is a first step into this direction: The special handling of
equality comparisons involving null is pushed from the parser to the code
generators, removing the need for a special AST node. (There are rumors from
usually well-informed sources that this node type is actually a relic of ancient
crankshaft days...)

The next steps will be the unification of null/undefined handling and pushing
the special case handling in crankshaft even further down the pipeline, enabling
the recognition of cases like "var foo=null; if (foo === bar) ...", but these
will be in separate CLs.
Review URL: http://codereview.chromium.org/7887037

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9293 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-15 09:09:40 +00:00
kmillikin@chromium.org
40cd59f238 Remove in-loop tracking for call ICs.
We passed this flag around in a lot of places and had differenc call
ICs based on it, but never did any real specialization based on its
value.

R=fschneider@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9260 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-13 12:53:28 +00:00
rossberg@chromium.org
e645597aa7 Implement function proxies (except for their use as constructors).
Introduce new %Apply native.

Extend Execution::Call to optionally handle receiver rewriting (needed for %Apply).

Fix Function.prototype.bind for functions that have .apply modified.

R=kmillikin@chromium.org
BUG=v8:1543
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9258 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-13 11:42:57 +00:00
kmillikin@chromium.org
e9c6a554fc Revert "Clean up Context::Lookup and its uses."
This reverts commit 9241.  This change shows failures on Mac and Win
for the threading tests.  Reverting while I investigate.

R=fschneider@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9246 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-13 07:51:22 +00:00
kmillikin@chromium.org
c0491e712d Reapply "Clean up Context::Lookup and its uses."
With a fix for a context lookup bug in the original change.

R=fschneider@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9241 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-12 12:13:00 +00:00
svenpanne@chromium.org
baab04283d Refactored HInferRepresenation::TryChange a bit, making the heuristics a bit clearer.
Removed an unneeded check for phis: There are never HValues in the work list
which are not convertible to integer and are not a phi. (But even if they were,
ignoring IsConvertibleToInteger() then looks like the wrong thing to do.)
Review URL: http://codereview.chromium.org/7857033

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9225 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-12 09:24:18 +00:00
kmillikin@chromium.org
faa82f6363 Revert "Clean up Context::Lookup and its uses."
This reverts commit 9223, due to test failures.

R=ricow@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9224 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-12 09:17:26 +00:00
kmillikin@chromium.org
df11bd7b75 Clean up Context::Lookup and its uses.
Refactor Context::Lookup so it is more obvious.  Change the comment in
contexts.h so it no longer indicates that it can return an arguments
object (it can't) and clean up the call sites that had leftover dead code.

BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9223 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-12 08:57:09 +00:00
mikhail.naganov@gmail.com
f8e5c71e18 Rename SmartPointer to SmartArrayPointer.
As pointed out in: http://codereview.chromium.org/7754007/#msg5

"SmartPointer should have been named SmartArrayPointer as it expects an input
allocated using new[] and deallocates it using delete[]. Using it as a simple
scoped pointer for a single object is incorrect."

R=mnaganov@chromium.org

Review URL: http://codereview.chromium.org/7860011
Patch from Thiago Farina <tfarina@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9215 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-09 22:39:47 +00:00
svenpanne@chromium.org
1341ae7c1a Re-use phi reachability information to avoid a fixed-point computation.
When we propagate the information that a value is not convertible to integer,
there is no need for a separate fixed-point computation, we can do things the
"Millikin way" (tm), folding as much computation as possible into a single pass:
;-) We already have the phi node reachability information, so we can easily
propagate this while doing the representation histogram computation.
Review URL: http://codereview.chromium.org/7754010

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9212 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-09 13:12:52 +00:00
danno@chromium.org
9b2de409f9 Mechanical refactor to move ElementsKind type out of JSObject.
R=svenpanne@chromium.org
BUG=none
TEST=all

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9208 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-09 09:35:57 +00:00
fschneider@chromium.org
366416f7bd Add a function to compute loop nesting level to HBasicBlock.
Review URL: http://codereview.chromium.org/7857031

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9207 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-09 09:17:57 +00:00
kmillikin@chromium.org
5f1b39e0d5 Remove ExitContextStatement.
All the constructs that used it are now properly bracketed in the AST and we
handle abrupt exits without try/finally.  We can treat normal context exit
as occurring implicitly at the end of a body.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9189 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-08 08:59:14 +00:00
svenpanne@chromium.org
ffb70bc843 Improved phi reachability computation a bit.
The use-def relation between phis is mainly "forwards" (i.e. from phis with
smaller IDs to ones with larger IDs), so the fixed point computation terminates
faster when iterate through the phis in a "backwards" manner. This is quite
visible in complex Mandreel-generated code, where a few hundred phis with
non-trivial use-def chains are generated.
Review URL: http://codereview.chromium.org/7848012

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9185 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-08 07:40:11 +00:00
kmillikin@chromium.org
765cf1f25e Fix presubmit failures.
TBR=fschneider@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9163 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-07 11:11:36 +00:00
kmillikin@chromium.org
94777e213d Remove variable rewrites and the unneccesary Slot class.
R=fschneider@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9162 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-07 11:02:31 +00:00
fschneider@chromium.org
913f444cb7 Support declarations of context allocated locals in Crankshaft.
The changes to scopes and parser introduce a VariableProxy
wrapping the function-name variable for function literals.
It seems the easiest way to get an AST id for the HSimulate
after context-slot stores in declarations.
Review URL: http://codereview.chromium.org/7826009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9112 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-01 16:33:57 +00:00
svenpanne@chromium.org
d02dfb301d Tiny change flags cleanups.
Introduced a getter for change flags, making a related helper function private.

Do not print a '*' at the end of hydrogen instruction mnemonics with side
effects, this is subsumed by the 'changes' info.
Review URL: http://codereview.chromium.org/7827009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9092 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-01 11:06:03 +00:00
vegorov@chromium.org
e833f91eb3 Do constant function check earlier in TryCallApply and ensure correct environment for deopt.
R=kmillikin@chromium.org
BUG=v8:1650
TEST=test/mjsunit/regress/regress-1650.js
Review URL: http://codereview.chromium.org/7812033

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9091 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-01 10:33:59 +00:00
fschneider@chromium.org
ffc6c7e56b Introduce local function declarations in Crankshaft and fix issue 1647.
We have to emit code for declarations later into the body block
(and not into the start block) so that the environment contains
the correct values.

In order to capture the environment effect of the declarations
that generate code (function declarations) I inserted a separate
AST id and a HSimulate after the declarations are visited.

Also fixes handling deopt in named function expressions:
BUG=v8:1647
TEST=test/mjsunit/regress/regress-fundecl.js, test/mjsunit/regress/regress-1647.js
Review URL: http://codereview.chromium.org/7776009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9083 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-08-31 13:26:08 +00:00
keuchel@chromium.org
42388ad5c7 Temporal dead zone behaviour for let bindings.
BUG=
TEST=mjsunit/harmony/block-let-semantics.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9070 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-08-30 11:23:57 +00:00
fschneider@chromium.org
a846d482dd Revert r9047 to fix broken build.
I need some more time to properly fix the problem.

TBR=kmillikin@chromium.org
Review URL: http://codereview.chromium.org/7781008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9055 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-08-29 12:19:43 +00:00
fschneider@chromium.org
8ab5b50f1b Introduce support for local function declarations in Hydrogen.
Review URL: http://codereview.chromium.org/7782001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9047 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-08-29 10:50:47 +00:00
fschneider@chromium.org
a58b9ba90b Remove code handling parameters rewritten to properties (aka synthetic properties).
After merging the new arguments branch, there is no need for this code anymore.

TEST=all tests pass
Review URL: http://codereview.chromium.org/7753030

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9031 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-08-29 07:07:39 +00:00
lrn@chromium.org
cd3588d582 Make (some) functions called from builtin functions use the callback's global as receiver.
Changes GetGlobalReceiver() to GetDefaultReceiver(func) that returns undefined
for strict and native functions, and the function's context's global proxy
for "normal" functions.

BUG=v8:1547
TEST=cctest/api-test/ForeignFunctionReceiver

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9030 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-08-26 13:53:00 +00:00
fschneider@chromium.org
701146a3d7 Perform range analysis after GVN.
This eliminate redundant HChange instructions and allows range information of
converted values propagated across control-flow splits.

It fixes the performance regression on code like:

if (x > 1) {
  y = x - 1;
}

where we should eliminate the overflow check on the sub inside the if-statement.
Review URL: http://codereview.chromium.org/7709025

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8997 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-08-23 11:19:08 +00:00
fschneider@chromium.org
99b4d756fc Insert representation changes before doing range analysis and fix a bug in Range::Copy.
This improves our static type information by calculating the result type
of conversions (HChange) during range analysis. It allows e.g. to eliminate
the write barrier in the following example where it was not possible before:

function f(x) {
  var y = x + 1;
  if (y > 0 && y < 100) {
    a[0] = y;
  }
}


* Fix bug in Range::Copy. The minus-zero flags has to be preserved by default.
Review URL: http://codereview.chromium.org/7634022

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8994 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-08-23 07:34:45 +00:00
vitalyr@chromium.org
633e615b89 Improve memory usage of receiver type feedback.
Some AST nodes (Property, Call, etc.) store either a list of receiver
types or a monomorphic receiver type. This patch merges the two fields
using a small pointer list. GetMonomorphicReceiverType() is now a
purely convenience function returning the first and only recorded
type.

This saves about 500K (of about 39M) on average when compiling V8
benchmark as measured by a simple patch adding a zone allocation
counter (https://gist.github.com/1149397).

R=kmillikin@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8993 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-08-22 14:23:37 +00:00
kmillikin@chromium.org
91553bbacd Simplify handling of exits from with and catch.
Remove the try/finally used for with and catch.  Instead of using
try/finally to handle break and continue from with or catch,
statically track nesting dept and clean up when compiling break or
continue.

And instead of using try/finally to handle throw to handler in a frame
whose pc is inside a with or catch, store the context that the handler
should run in in the handler itself.

BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8922 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-08-12 10:52:49 +00:00
keuchel@chromium.org
3c7ca304fe Preliminary code for block scopes and block contexts.
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8911 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-08-11 16:29:28 +00:00
danno@chromium.org
d5d7185578 Create a common base class for Fixed-, FixedDouble- and ExternalArrays.
Also unify Crankshaft code to load array length.

BUG=v8:1493
TEST=external-arrays.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8901 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-08-11 14:00:16 +00:00
vitalyr@chromium.org
a107387dde Fix fun.apply(receiver, arguments) optimization.
R=kmillikin@chromium.org
BUG=v8:1592
TEST=mjsunit/regress/regress-1592.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8884 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-08-10 16:05:17 +00:00
vegorov@chromium.org
bd8c469cf9 Check phi uses of the arguments object after redundant phies elimination.
This allows to handle code like:

var a = arguments;
while (smth) a[i];

without bailout.

R=kmillikin@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8803 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-08-03 10:40:03 +00:00
vegorov@chromium.org
a547d333f0 Check for phi-uses of arguments object before eliminating dead phi's.
HGraphBuilder::TryArgumentsAccess does not emit any uses for receiver and will generate incorrect code when receiver for a property access is defined by a phi that returns either arguments object or something else.
 
BUG=v8:1582
TEST=test/mjsunit/regress/regress-1582.js
Review URL: http://codereview.chromium.org/7553006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8774 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-08-02 09:32:28 +00:00
fschneider@chromium.org
6c58013b36 Fix presubmit error.
TBR=whesse@chromium.org
Review URL: http://codereview.chromium.org/7470016

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8743 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-07-26 10:24:14 +00:00
fschneider@chromium.org
41ac29d0f4 Landing http://codereview.chromium.org/7514005/
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8742 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-07-26 10:12:37 +00:00
svenpanne@chromium.org
8ebf3993d6 Record ToBoolean's type information in Hydrogen's HBranch instruction, so we can use it in LCodeGen::DoBranch later.
Review URL: http://codereview.chromium.org/7491043

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8736 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-07-25 14:08:36 +00:00
jkummerow@chromium.org
622cf2e091 Fix deopts caused by misplaced COW checks.
TEST=Performance of pixel-array-blur back to normal.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8709 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-07-21 12:01:51 +00:00
jkummerow@chromium.org
c9f2a4325f Add fake data dependencies (instead of disabling GVN) to fix code motion
for HInstructions used in polymorphic array access code.

TEST=existing tests pass.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8699 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-07-20 14:43:10 +00:00
danno@chromium.org
11c7b47430 Crankshaft support for FixedDoubleArrays
BUG=none
TEST=unboxed-double-arrays.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8682 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-07-19 13:04:00 +00:00
jkummerow@chromium.org
d4779286b6 Add map check for COW elements to crankshaft array handling code.
BUG=1560
TEST=mjsunit/regress/regress-1560.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8656 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-07-14 14:45:20 +00:00
ager@chromium.org
9c233c711e Fix shortcutting bug in HInferRepresentation
* src/hydrogen.cc (HInferRepresentation::Analyze): Fix iterative loop
  over phis; the shortcutting behavior of || appears to be accidental
  here, causing O(n^2) convergence.  Not that it matters much, but hey!

While I'm at it, a minor comment fix:

* src/hydrogen-instructions.h (EnsureAndPropagateNotMinusZero): Fix a
  comment about the kinds of instructions that propagate to multiple
  inputs.

BUG=
TEST=passes tools/test.py

Review URL: http://codereview.chromium.org/7350019
Patch from Andy Wingo <wingo@igalia.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8645 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-07-13 14:43:09 +00:00
sgjesse@chromium.org
10bb16f495 Add support for lazy deoptimization from deferred stack checks
The debugger can be entered from the deferred stack check in optimized code. This can cause both lazy deoptimization and debugger deoptimization (setting the first break point and inspecting the stack for optimized code respectively). This required deoptimization support from the deferred stack check.

The lazy deoptimiztion call is inserted when the deferred code is done including restoring the registers. The bailout to the full code is the begining of the loop body as that is where the stack check is sitting in the optimized code. The bailout is not to the stack check in the full code as that is sitting at the end of the loop.

R=kmillikin@chromium.org

BUG=none
TEST=none

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8535 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-07-05 13:21:29 +00:00
whesse@chromium.org
f3d1453f83 As part of allowing different contexts for inlined functions, eliminate most explicit reads of the context from the stack frame in ia32 crankshaft codegen.
Eliminates the enum flag RESTORE_CONTEXT and CONTEXT_ADJUSTED, and adds a context HValue and LOperand to many hydrogen and lithium instructions.

Context is still used from the stack from in CallKnownFunction (this seems safe), and in CallRuntimeFromDeferred in lithium-codegen-ia32.cc, which needs to be fixed.

BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8529 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-07-04 14:13:08 +00:00
fschneider@chromium.org
b12e933e43 Refactor handling of test expressions in the graph builder.
Instead of generating two instructions and combining them
at lithium translation using the EmitAtUses predicate, we
generate the correct branch instruction right from the start.
Review URL: http://codereview.chromium.org/7237024

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8495 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-30 14:19:52 +00:00
ager@chromium.org
0d8c343c90 Do not pass the global object as the receiver to strict-mode and
builtin replace and sort functions.

R=ricow@chromium.org
BUG=v8:1360
TEST=mjsunit/regress/regress-1360.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8488 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-30 12:29:19 +00:00
jkummerow@chromium.org
39b06d8850 Add support for dictionary elements to polymorphic crankshaft code.
Review URL: http://codereview.chromium.org/7285001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8479 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-30 08:40:31 +00:00
sgjesse@chromium.org
7d2be7c0e0 Support debugger inspection of locals in optimized frames
Optimized frames are now handled by the debugger. When discovering optimized frames during stack inspection in the debugger they are "deoptimized" using the normal deoptimization code and the deoptimizer output information is used to provide frame information to the debugger.

Before this change the debugger reported each optimized frame as one frame no matter the number of inlined functuions that might have been called inside of it. Also all locals where reported as undefined. Locals can still be reposted as undefined when their value is not "known" by the optimized frame.

As the structures used to calculate the output frames when deoptimizing are not GC safe the information for the debugger is copied to another structure (DeoptimizedFrameInfo) which is registered with the global deoptimizer data and processed during GC.

R=fschneider@chromium.org

BUG=v8:1140
TEST=test/mjsunit/debug-evaluate-locals-optimized*

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8464 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-29 13:02:00 +00:00
kmillikin@chromium.org
e859416b9f Better placement of argument pushing for a few hydrogen call instructions.
Where it's simple to do so (keyed calls, calls to unknown global variables,
calls to local variables and non-property/non-variable expressions), end the
live range of argument subexpressions immediately after the last use of the
expression rather than at the call.

R=fschneider@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8445 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-28 12:51:21 +00:00
ager@chromium.org
3f6043d370 Cleanup to HEnvironment::CopyForInlining
* src/hydrogen.cc (HEnvironment::CopyForInlining): As the code for both
  the ::HYDROGEN and ::LITHIUM compilation phases is the same, just use
  one code path and remove the arg.

* src/hydrogen.h (HEnvironment): Remove now-unused CompilationPhase
  enum type and arg to CopyForInlining.

* src/arm/lithium-arm.cc (LChunkBuilder::DoEnterInlined):
* src/ia32/lithium-ia32.cc (LChunkBuilder::DoEnterInlined):
* src/x64/lithium-x64.cc (LChunkBuilder::DoEnterInlined): Adapt
  callers.

* AUTHORS: Add Igalia.

BUG=
TEST=I ran tools/test.py.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8442 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-28 08:54:09 +00:00
sgjesse@chromium.org
54d6072332 Change the handling of stack check on backward branches
The hydrogen stack check instruction is now added to each loop and the stack check handling on the back edge has been removed.

This change causes regression on small tight loops as the stack check is now at the top of the loop instead of at the bottom, and that requires one additional unconditional jump per loop iteration. However the reason for this change is to avoid worse regressions for upcoming changes to correctly support debugger break in optimized code.

R=fschneider@chromium.org

BUG=none
TEST=none

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8428 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-27 12:12:27 +00:00
keuchel@chromium.org
628a2e2a1f Better codegen for '<expression> === void <literal>'.
Detect the pattern in both, the full compiler and crankshaft and generate direct pointer
comparisons. Along the way I cleaned up 'typeof <expression> == <string literal>' comparisons
as well by lifting platform independent code and checking the symmetric case.

BUG=v8:1440
TEST=cctest/test-api.cc

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8420 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-24 14:30:10 +00:00
ager@chromium.org
5ea7238814 Fix renaming patch to also compile in debug mode.
R=ricow@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8387 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-23 06:33:38 +00:00
ager@chromium.org
03fc1660b3 HBasicBlock::CreateSimulate argument name clarity
* src/hydrogen.h:
* src/hydrogen.cc (HBasicBlock::CreateSimulate): Rename "id" arg to
  "ast_id".

BUG=
TEST=

Review URL: http://codereview.chromium.org/7234010
Patch from Andy Wingo <wingo@igalia.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8385 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-23 06:26:50 +00:00
fschneider@chromium.org
01a8cda43e Remove redundant hydrogen- and lithium instruction for symbol comparison.
We had two instructions HCompareJsObjectEq and HCompareSymbolEq that behave
exactly the same. I removed one and renamed the remaining instruction into
HCompareObjectEq.
Review URL: http://codereview.chromium.org/7206040

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8349 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-21 11:18:15 +00:00
sgjesse@chromium.org
4fa40ebc78 Include the loop header block when eliminating stack checks
In simple unconditional loops - like the following - the hydrogen stack check elimination did not detect the call as the loop header block itself was not considered.

function f(o) {
  while(true) {
    o.a();
  }
}

R=fschneider@chromium.org

BUG=none
TEST=none

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8329 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-20 12:29:03 +00:00
jkummerow@chromium.org
b789cb8c94 Crankshaft support for polymorphic array handling
Review URL: http://codereview.chromium.org/7170012

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8325 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-20 10:19:00 +00:00
karlklose@chromium.org
f4e4bc43a8 Merge arguments branch to bleeding edge (second try).
Review URL: http://codereview.chromium.org/7187007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8315 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-16 14:12:58 +00:00
karlklose@chromium.org
cc19d1e278 Revert "Merge arguments branch to bleeding merge."
This reverts commit ceb31498b9d69edca3260820fb4047045891ce6d.

TBR=kmillikin@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8308 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-16 06:37:49 +00:00
karlklose@chromium.org
6cfeb2d400 Merge arguments branch to bleeding merge.
Review URL: http://codereview.chromium.org/7167006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8300 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-15 15:09:28 +00:00
vitalyr@chromium.org
d254298e3a Make valgrind happy with SparseSet.
R=ager@chromium.org
BUG=crbug.com/83626

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8279 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-14 12:48:25 +00:00
svenpanne@chromium.org
a4cf7be941 First steps towards better code generation for LBranch:
* AST Expression nodes get a separate testing ID to record type info in
   ToBooleanStub later. This is necessary to avoid clashes with other uses of
   already existing IDs.

 * In order to avoid threading the condition expression through tons of places,
   TestContexts carry it now with them. Note that we will probably only need the
   testing ID of the expression, but having the whole thing at hand makes
   debugging easier. Probably we will change this later...
Review URL: http://codereview.chromium.org/7046073

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8274 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-14 09:15:25 +00:00
fschneider@chromium.org
5a236ce6fd Add support for hydrogen control instructions with >2 successor blocks.
This change makes the number of successors of a control instruction
configurable with a template parameter and changes the existing instructions
to use it.

To iterate over all successors I added an iterator instead of always calling
First- and SecondSuccessor.
Review URL: http://codereview.chromium.org/7114004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8262 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-10 12:09:48 +00:00
danno@chromium.org
7c26e7143f Fix bogus unreachable in debug code.
BUG=none
TEST=none
TBR=jkummerow@chromium.org

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8247 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-09 16:20:41 +00:00
fschneider@chromium.org
424407c727 Simplify the check when to perform loop invariant code motion.
Allow HChange instructions to be hoisted out of loops. To avoid
unnecessary code motion we don't hoist instructions from blocks that
have been marked containing an unconditional deoptimization.
Review URL: http://codereview.chromium.org/7003087

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8245 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-09 15:49:21 +00:00
danno@chromium.org
9f432cd159 Dispatch on ElementsKind rather than ExternalArrayType when generating ICs and Crankshaft code for many element operations. This is preparation to be able to share more code in the various element accessor implementations.
Merge logic to maintain external array and fast element stub caches.

BUG=none
TEST=none

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8244 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-09 15:19:37 +00:00
whesse@chromium.org
c40aa827bf Add boolean flag to HChange and LNumberUntagD to not convert undefined to NaN.
This is needed so that HCompare, optimized for double inputs, works correctly on undefined inputs.
BUG=v8:1434
TEST=mjsunit/bugs/bug-1434.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8237 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-09 12:27:28 +00:00
kmillikin@chromium.org
371af773cf A collection of context-related refactoring changes.
Introduce separate maps for function and with contexts.  Use the function
context map for testing whether a context is a function context (global
contexts are no longer function contexts).

Split the paths for allocating with and catch contexts.

Rename some functions.  Generally refactor code to make it simpler.

R=ager@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8231 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-09 11:26:01 +00:00
fschneider@chromium.org
68eab4a8d8 Fix bug with GVN on array loads.
This fixes a bug where an array load was incorrectly hoisted by GVN.

BUG=85177
TEST=mjsunit/regress/regress-85177.js
Review URL: http://codereview.chromium.org/7003054

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8230 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-09 11:15:03 +00:00
kmillikin@chromium.org
e9a1ffde92 Stop using with explicitly to implement try/catch.
The AST for TryCatch gives us enough structure that we do not need to expand
it to explicitly include a with.  Try/catch is still handled the same as
before at runtime.

R=ager@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8224 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-08 13:55:33 +00:00
fschneider@chromium.org
7c9cf0b3a1 Re-land r8140: Deoptimize on never-executed code-paths.
Original cl: http://codereview.chromium.org/7105015

I'm removing the test GlobalLoadICGC test that was introduced for testing
inlined global cell loads (in the classic backend) and has an invalid assumption
about the number of global objects referenced from a v8 context. We don't have
this feature with Crankshaft anymore.
Review URL: http://codereview.chromium.org/7112032

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8185 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-06 14:57:25 +00:00
fschneider@chromium.org
ff76d1ab0c Revert r8140.
It breaks test when running with nosnapshot.
TBR=ager@chromium.org
Review URL: http://codereview.chromium.org/7027029

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8145 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-01 13:34:15 +00:00
kmillikin@chromium.org
27f2f6aa0b Delay processing of declarations for inlining candidates.
Processing the declarations in an inlining candidate must be performed
after constructing the Hydrogen environment of the candidate function.

R=fschneider@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8144 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-01 13:26:30 +00:00
fschneider@chromium.org
0aa422923c Eagerly deoptimize on never-executed code-paths.
If type-feedback indicates that an expression was never executed in
the non-optimized code, we insert a forced deoptimization right away
to enable re-optimization if we ever hit this path.

With this change we still continue to build the graph. As a next step, we
should remove the dead code after the deoptimize.

I had to remove one assert about the optimization status in a test since
we now immediately deoptimize after exiting the loop that triggers OSR.

Also remove a restriction that control-flow from an inlined function in a
test context always reaches both true- and false-target.
Review URL: http://codereview.chromium.org/7105015

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8140 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-01 11:04:40 +00:00
kmillikin@chromium.org
d985af520e Disable context-allocated const variables.
We intended them to be fully disabled for now, but there was a missing
check at initialization time.

R=fschneider@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8139 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-01 09:12:22 +00:00
svenpanne@chromium.org
15cb93ed62 Ooops, forgot to commit the renamings in Hydrogen for issue 6976028....
TBR=danno@chromium.org
Review URL: http://codereview.chromium.org/7105014

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8132 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-06-01 07:11:25 +00:00
rossberg@chromium.org
670f947a5c Implement set trap for proxies, and revamp class hierarchy in preparation:
- Introduce a class JSReceiver, that is a common superclass of JSObject and
  JSProxy. Use JSReceiver where appropriate (probably lots of places that we
  still have to migrate, but we will find those later with proxy test suite).

- Move appropriate methods to JSReceiver class (SetProperty,
  GetPropertyAttribute, Get/SetPrototype, Lookup, and so on).

- Introduce new JSFunctionProxy subclass of JSProxy. Currently only a stub.

- Overhaul enum InstanceType:
  * Introduce FIRST/LAST_SPEC_OBJECT_TYPE that ranges over all types that
    represent JS objects, and use that consistently to check language types.
  * Rename FIRST/LAST_JS_OBJECT_TYPE and FIRST/LAST_FUNCTION_CLASS_TYPE
    to FIRST/LAST_[NON]CALLABLE_SPEC_OBJECT_TYPE for clarity.
  * Eliminate the overlap over JS_REGEXP_TYPE.
  * Also replace FIRST_JS_OBJECT with FIRST_JS_RECEIVER, but only use it where
    we exclusively talk about the internal representation type.
  * Insert JS_PROXY and JS_FUNCTION_PROXY in the appropriate places.

- Fix all checks concerning classification, especially for functions, to
  use the CALLABLE_SPEC_OBJECT range (that includes funciton proxies).

- Handle proxies in SetProperty (that was the easiest part :) ).

- A few simple test cases.

R=kmillikin@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8126 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-31 16:38:40 +00:00
kmillikin@chromium.org
00f2ff321e Support optimization of named function literals.
Introduce a Hydrogen value for the value denoted by the function name.

R=fschneider@chromium.org,mnaganov@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8121 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-31 11:54:46 +00:00
svenpanne@chromium.org
dcb558fdf0 Push the general AST id field down from ASTNode to Expression.
Almost all uses were below Expression already, only a single use in IfStatement
had to be handled explicitly (probably an oversight from earlier changes?). This
is a small step towards a less ad-hoc handling of IDs in the front end.
Review URL: http://codereview.chromium.org/7054034

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8118 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-31 09:34:37 +00:00
ager@chromium.org
017935408d Reapply change to Pass undefined to JS builtins when called with
implicit receiver.

A couple of corner cases have to be treated specially to not break
everything: eval and getter/setter definitions.

R=fschneider@chromium.org
BUG=v8:1365
TEST=mjsunit/regress/regress-1365.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8110 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-30 13:49:22 +00:00
fschneider@chromium.org
e0985887bf Simple support for const variables in Crankshaft.
The approach is to handle the common case in the optimizing
compiler and to bailout for the rare corner cases.

This is done by initializing all local const-variables with
the hole value and disallowing any use of the hole value statically.
Review URL: http://codereview.chromium.org/6026006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8104 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-30 11:31:41 +00:00
danno@chromium.org
c2394e0a71 Prevent deopt on double value assignment to typed arrays
Implement truncation of double and tagged values when assigning to an element of a typed arrays in order to avoid depots.

BUG=1313
TEST=test/mjsunit/external-array.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8077 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-26 12:07:22 +00:00
ager@chromium.org
c832c467a4 Revert "Pass undefined to JS builtins when called with implicit receiver."
Presubmit and failing test.

TBR=lrn@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8075 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-26 11:22:29 +00:00
ager@chromium.org
19b718fe73 Pass undefined to JS builtins when called with implicit receiver.
A couple of corner cases have to be treated specially to not break
everything: eval and getter/setter definitions.

R=lrn@chromium.org
BUG=v8:1365
TEST=mjsunit/regress/regress-1365.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8073 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-26 11:07:48 +00:00
kmillikin@chromium.org
68e2d1bfed Do not allow inlining functions with direct arguments access.
Our implementations of arguments without materializing the arguments
object (based on inspecting the stack frame) does not work for inlined
functions.  Guard all attempts by disallowing them if possible or else
bailing out of the optimizing compiler.

R=fschneider@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8072 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-26 10:56:07 +00:00
ager@chromium.org
6f775f2fb0 Fix calls of strict mode function with an implicit receiver.
Only IA32 version for now. I'll start porting.

Strict mode functions are to get 'undefined' as the receiver when
called with an implicit receiver. Modes are bad! It forces us to have
checks on all function calls.

This change attempts to limit the cost by passing information about
whether or not a call is with an implicit or explicit receiver in ecx
as part of the calling convention. The cost is setting ecx on all
calls and checking ecx on entry to strict mode functions.

Implicit/explicit receiver state has to be maintained by ICs. Various
stubs have to not clobber ecx or save and restore it.

CallFunction stub needs to check if the receiver is implicit when it
doesn't know from the context.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8040 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-24 14:01:36 +00:00
kmillikin@chromium.org
47157e8a56 When inlining fails, disable optimization of the proper function.
Also, refactor disabling of optimization to make it easier to ensure
that both SharedFunctionInfo and Code get disabled.

R=whesse@chromium.org
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7963 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-19 13:15:57 +00:00
whesse@chromium.org
7878391841 Refactor TraceInlining method of hydrogen so it works correctly.
Fix TraceInline.

BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7961 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-19 12:53:50 +00:00
vitalyr@chromium.org
85edb5f96b Make GVN side effect analysis more precise.
When descending the dominator tree we used to collect side effects from all blocks between the dominator and the dominated blocks in the block ordering. This could include blocks that do not appear on paths from the dominator to the dominated and unnecessarily removed available values from the GVN map.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7943 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-18 17:18:35 +00:00
fschneider@chromium.org
66911961cf Fix bug in optimized compiler's switch-statement.
In the case where the default-clause occurs as the first clause,
the case-blocks were not wired up correctly.

BUG=v8:1394
TEST=mjsunit/compiler/regress-1394.js
Review URL: http://codereview.chromium.org/7037023

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7927 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-18 11:06:07 +00:00
whesse@chromium.org
0eca2b4fc1 Fix error in postfix ++ in Crankshaft.
Add HForceRepresentation, to represent the implicit ToNumber applied to the input of a count operation.

BUG=v8:1389

TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7913 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-17 11:41:59 +00:00
danno@chromium.org
daa1be1226 Support conversion of clamped double values for pixel arrays in Crankshaft.
BUG=1313
TEST=test/mjsunit/external-array.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7901 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-16 14:10:56 +00:00
svenpanne@chromium.org
fe2074f580 Removed a "feature envy" bad smell: Moved AssumeRepresentation method to where
it belongs.
Review URL: http://codereview.chromium.org/7015039

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7890 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-13 13:29:02 +00:00
svenpanne@chromium.org
78f4dd1208 Use type feedback for unary minus, improving the performance on e.g. 3d-cube by
7.2% and math-cordic by 5.7%.
Review URL: http://codereview.chromium.org/7013025

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7882 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-13 08:21:35 +00:00
fschneider@chromium.org
5f29f9bd8e Don't use environment values at certain deoptimize-instructions.
If a HDeoptimize does not cut away parts of the control-flow-graph
we don't need to insert uses to correctly elimiate dead phis since
the full function is visible to the optimizing compiler.

This is a small improvement of the change r7221 which fixed a problem
when deoptimizing on never executed case-clauses.
Review URL: http://codereview.chromium.org/7012010

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7877 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-12 14:56:56 +00:00
svenpanne@chromium.org
a3afc9a896 Made the output of the --trace-representation flag a bit more informative and
centralized its handling.
Review URL: http://codereview.chromium.org/6969034

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7874 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-12 13:36:49 +00:00
vitalyr@chromium.org
03c00ee6a6 Support symbol comparison in crankshaft.
Review URL: http://codereview.chromium.org/7000021

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7865 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-11 12:50:04 +00:00
vitalyr@chromium.org
4cc800b3cf Support %_IsUndetectableObject in crankshaft.
Review URL: http://codereview.chromium.org/6995046

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7856 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-11 11:53:43 +00:00
whesse@chromium.org
bf06fbdbf1 Recommit "First step in letting Crankshaft inline functions with a different context.""
This reverts r7810, thus recommitting 7807.

BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7851 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-11 11:03:12 +00:00
svenpanne@chromium.org
9f3f90ddc0 Improved c1visualizer output a bit: Emit a human-readable description for
changes instead of a bit-pattern. Fixed logic when ranges are emitted. Improved
indentation in hydrogen.cfg (aesthetical change only). Some minor additional
cleanup.
Review URL: http://codereview.chromium.org/6995024

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7849 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-11 09:19:28 +00:00
svenpanne@chromium.org
986ed5358e Reverted some code which got accidentally committed as part of another commit.
TBR=vitalyr@chromium.org
Review URL: http://codereview.chromium.org/6994011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7842 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-10 14:39:19 +00:00
vitalyr@chromium.org
5ac2a3acfc Fix lint.
TBR=svenpanne@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7841 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-10 14:21:23 +00:00
vitalyr@chromium.org
c10267f1fa Refactor HCheckInstanceType to allow mask/tag tests.
This allows us to get rid of totally fake LAST_STRING_TYPE and makes
it possible to test for symbols.

I considered splitting HCheckInstanceType into two instructions, but
it seems nice to be able to hide the instance type implementation
details from the hydrogen level.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7840 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-10 14:17:23 +00:00
svenpanne@chromium.org
4912c0371b A few "extract method" refactorings, trying to get individual method definitions
onto a sinlge 30" screen. A lot of times, the AST visitor stops a bit too early,
so we have to do the rest of the dispatch by hand. This is caused by the fact
that the kind of the AST nodes are a bit too coarse for some traversals (e.g. a
single node type for all binary ops), perhaps one could try to refine this a
little bit more.
Review URL: http://codereview.chromium.org/6963008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7839 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-10 13:29:57 +00:00
whesse@chromium.org
912ec759da Revert "First step in letting Crankshaft inline functions with a different context."
This reverts commit r7807.  TBR=kmillikin@chromium.org.

BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7810 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-06 15:02:15 +00:00
whesse@chromium.org
efc43746df First step in letting Crankshaft inline functions with a different context.
Use a special slot for HContext, and fetch the value from there each time it is used.  Allocate space for special slots in every HEnvironment.  Fill them with constant undefined.  Do not copy them to LEnvironment.

BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7807 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-06 13:26:22 +00:00
whesse@chromium.org
788db8aedc Tiny refactoring - change compilation phase parameter for CopyForInlining from a boolean to an enum.
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7782 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-04 15:00:04 +00:00
fschneider@chromium.org
3e94ac952d Change heuristics for deciding phi-representation types to use int32 more frequently.
Until now we conservatively chose a double representation if
at least one use occurs in a double operation. This causes performance
degradation in many cases where there are mixes uses (integer and double)

e.g.:

for (int i = 0; i < 10; i++) {
  var t = i / 3.5;
  a[i] = t;
}

where the use in i/3 requires a double, where as the keyed store requires i
as an integer.

For these cases we want to have i as an integer and convert it only before the
double division.

In order to avoid unconditional deoptimization in some rare cases, we check
phis if there is any conversion that will always fail when converting a
heap-number constant to int32.
Review URL: http://codereview.chromium.org/6905166

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7757 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-03 08:31:35 +00:00
kmillikin@chromium.org
d0fcbb4ece Simplify include dependencies.
Try to make sure that accessors.h, data-flow.h, list-inl.h, and
scopeinfo.h are included only where needed, but without introducing
implicit dependencies.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7756 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-03 08:23:58 +00:00
kmillikin@chromium.org
1af840ad4c Be more discriminating about uses of the arguments object in optimized code.
Because we track the value of the arguments object, we need to check
values whenever plugged into a forbidden value context.  It is not
enough to check at only variable references as we did previously.

R=fschneider@chromium.org
BUG=1351
TEST=regress-1351.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7739 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-02 11:35:51 +00:00
whesse@chromium.org
4f41d895b0 Use type info for count operation in Crankshaft.
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7717 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-29 09:21:18 +00:00
vegorov@chromium.org
b62bdda7d1 Crankshaft support for IN.
In JavaScriptFrame::Print avoid printing optimized frame as if it is unoptimized.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7682 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-26 15:22:44 +00:00
kmillikin@chromium.org
4d1b2b1d38 Change the Hydrogen representation of uses.
Rather than representing a use as a pointer to an HValue and then searching
for the specific (ambiguous) operand, we now represent a use as a pair of an
HValue and the input operand index.  Additionally, use a linked list instead
of a growable array list since we never use random access.

This allows us to remove a bunch of similarly named and subtly different
functions from the HValue API.  The cost in extra zone allocation per use is
partially offset by reusing use list nodes when replacing a use of one value
with another.

R=danno@chromium.org,fschneider@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7674 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-20 10:38:08 +00:00
fschneider@chromium.org
ef24af119e Land Kevin's patch for supporting %_CallFunction in Crankshaft.
Original code review: http://codereview.chromium.org/6838018/

TBR=ager@chromium.org
Review URL: http://codereview.chromium.org/6869005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7624 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-15 07:58:22 +00:00
vitalyr@chromium.org
cc782be64e Support string add in crankshaft:
o The type recording binary stub got a new type for string + string.

o Added HStringAdd and LStringAdd based on the new type info.

o Started using HValue types to avoid unneccesary checks.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7622 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-15 06:39:36 +00:00
kmillikin@chromium.org
db91b43ace Fix a just-introduced bug in polymorphic inlining.
When inlining a polymorphic variant, the inlined function indicates we
should bailout of the entire compilation by setting the stack overflow flag
on the visitor.  We need to check this flag and bailout if a call to
TryInline succeeds and it is not in tail position in a graph builder
function.

R=fschneider@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7604 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-13 11:59:23 +00:00
kmillikin@chromium.org
6d7b88b5bc Fix typo which broke build.
TBR=fschneider@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7602 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-13 11:30:36 +00:00
kmillikin@chromium.org
c25c2784d9 Relax assumptions about control flow in the hydrogen graph.
Previously we assumed that control was always live after visiting an
expression, and that control was live to both basic block targets of an
expression in a test context.

Now we allow any expression to exit the graph.

R=fschneider@chromium.org,danno@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7601 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-13 11:24:06 +00:00
mmaly@chromium.org
164e3a4173 Strict mode fixes.
- mutual inlining strict and non-strict functions in crankshaft.
- assignment to undefined variable with eval in scope.
- propagation of strict mode through lazy compilation.

BUG=
TEST=test/mjsunit/strict-mode.js test/mjsunit/strict-mode-opt.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7561 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-08 14:30:10 +00:00
whesse@chromium.org
85363049ac Restart AST node numbering when we enter a function.
BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7543 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-07 14:45:34 +00:00
danno@chromium.org
fa69fd0817 Fix opmitized external array access for compound assignments and count operations, also implement missing ARM typed array Hydrogen loads and stores.
BUG=none
TEST=none

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7536 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-07 09:51:25 +00:00
fschneider@chromium.org
f983244124 Remove unnecessary AST node for ++ and -- operations.
Instead of adding an extra AST node we can just use an auxiliary
bailout id for named and keyed property count operations.
Review URL: http://codereview.chromium.org/6810015

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7524 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-07 07:56:43 +00:00
vitalyr@chromium.org
38e328d469 Use placement new for zone objects in hydrogen.
Review URL: http://codereview.chromium.org/6794041

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7506 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-05 18:47:46 +00:00
fschneider@chromium.org
7ef5cec9ae Remove environment length from HSimulate instructions.
It was only used in an ASSERT when reconstructing environments
at lithium translation time.
Review URL: http://codereview.chromium.org/6693062

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7501 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-05 09:55:18 +00:00
ricow@chromium.org
3dd575ec0d Add inline non-transcendental cache version of log to lithium.
In addition, this change allows one additional level of inlining. 
Review URL: http://codereview.chromium.org/6720017

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7500 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-05 09:21:02 +00:00
sgjesse@chromium.org
1244225ba8 Extend crankshaft support for global stores
All global stores are now supported in crankshaft by using the normal store IC when other optimizations are not possible due to the state of the global object.

R=fschneider@chromium.org

BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7495 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-04 15:03:34 +00:00
vitalyr@chromium.org
0b40589e73 Fix multi-isolate build:
o Make ia32 macro assembler work without an isolate and use it in the
  custom memcpy creation code.
o Remove isolate-dependent code from the custom memcpy and modulo
  functions creation code.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7482 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-01 14:46:30 +00:00
sgjesse@chromium.org
1e8079fcc9 Increase coverage of global loads in optimized code
In the cases where a global property cell cannot be used in the optimized code
use standard load ic to get the property instead of bailing out.

This is re-committing r7212 and r7215 which where reverted in r7239 with the addition of recoring the source position in the hydrogen code for the LoadGlobalCell instruction. To record that position an optional position field has been added to the variable proxy AST node.
Review URL: http://codereview.chromium.org/6758007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7474 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-01 11:54:04 +00:00
vegorov@chromium.org
ae65366f0b Fix SlotRef::SlotAddress for parameters indices.
Fix %NewObjectFromBound to correctly handle optimized frames (including those with inlined functions).

Fix %_IsConstructCall handling in hydrogen: when called from inlined function return false constant directly instead of emiting HIsConstructCall.

Fix success case in TraceInline.

BUG=v8:1229
TEST=test/mjsunit/regress/regress-1229.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7472 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-01 11:41:36 +00:00
antonm@chromium.org
71431d79a0 Do not create a SharedFunctionInfo for closures on each recompilation.
Unoptimized code should already keep a reference to the SharedFunctionInfo,
let's use it instead of allocating a new object and prohibiting SharedFunctionInfo
specific optimizations.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7467 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-01 10:20:39 +00:00
sgjesse@chromium.org
2531480d10 Re-establish mips basic infrastructure.
This commit adds current working versions of assembler, macro-assembler,
disassembler, and simulator.

All other mips arch files are replaced with stubbed-out versions that
will build.

Arch independent files are updated as needed to support building and
running mips.

The only test is cctest/test-assembler-mips, and this passes on the
simulator and on mips hardware.

TEST=none
BUG=none

Patch by Paul Lind from MIPS.

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


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7388 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-28 13:05:36 +00:00
fschneider@chromium.org
6fadb5257f Fix hydrogen statistics output when no code gets optimized.
In that case print 0 instead of NaN for normalized time and bytes allocated.

R=kmillikin@chromium.org
Review URL: http://codereview.chromium.org/6696070

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7359 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-25 10:02:42 +00:00
danno@chromium.org
ea45f6719e Support external arrays in Crankshaft
Add specialized hydrogen and lithium instructions to support loading and storing to external arrays.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7354 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-24 22:14:15 +00:00
fschneider@chromium.org
7d8e6c929d Enable GVN for polymorphic loads by not expanding them at the HIR level.
This change adds a new IR instruction for polymorphic loads. It performs
map compares and loads in one IR instruction instead of splitting each
load into a graph of map-compares and field loads.
 
The advantage is a smaller IR and less basic blocks, plus it allows to
do GVN on polymorphic loads.
Review URL: http://codereview.chromium.org/6708085

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7336 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-24 10:11:51 +00:00
vitalyr@chromium.org
1dc8f7edb3 Store HValue uses in a custom small list structure.
This saves about 700K of zone allocation when compiling the V8
benchmark suite.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7330 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-23 14:44:19 +00:00
fschneider@chromium.org
8066271fd2 Optimize calls to object literal properties that are initialized with a function literal.
This allows fast calls and inlining of functions like:

var o = {f: function() { return "foo"; }}
o.f();


Object literals that contain function literals are initially created a dictionary mode
object and only transformed to fast properties once all properties are computed and
added. This allows us to create constant function properties for functions declared
inside the object literal. Function literals inside object literals are marked for
pretenuring so that they work as contant function properties.

Object literals without functions should just function as before.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7283 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-21 12:25:31 +00:00
vitalyr@chromium.org
0dce18e6c2 Clean up Isolate usages in ast visitor and hydrogen.
Review URL: http://codereview.chromium.org/6688066

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7282 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-21 11:57:59 +00:00
vitalyr@chromium.org
7976ca2cbc Merge isolates to bleeding_edge.
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7271 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-18 20:35:07 +00:00
vitalyr@chromium.org
76e226f832 Revert r7268: it borked the history.
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7269 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-18 19:41:05 +00:00
vitalyr@chromium.org
6ff7fdebd3 Merge isolates to bleeding_edge.
Review URL: http://codereview.chromium.org/6685088

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7268 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-18 18:49:56 +00:00
antonm@chromium.org
6311105e00 Refactor fast API call.
Make it use custom call generator infrastructure.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7246 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-17 17:25:54 +00:00
ricow@chromium.org
d6caa8872a Revert revisions 7215 and 7212.
This caueses line positions to be off by one in certain cases, causing webkit http/tests/inspector/console-xhr-logging to fail.
Review URL: http://codereview.chromium.org/6667077

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7239 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-17 14:30:48 +00:00
vegorov@chromium.org
c83f0a715e Make HDeoptimize to explicitly use environment values.
Otherwise dead phi elimination can actually remove some of the implicitly used phis.

BUG=1257
TEST=test/mjsunit/regress/regress-1257.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7221 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-17 12:22:49 +00:00
lrn@chromium.org
2038178fbe Add support for unary plus in hydrogen compiler.
Also strength-reduction of unary minus.
Fixes issue 1248.

BUG=1248

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7217 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-17 10:37:29 +00:00
sgjesse@chromium.org
1a343b3004 Fix infinite recursion in the compiler introduced in r7212
In most situations tests passed just causing a bailout from the compiler due to stack overflow. On Mac some tests actually did crash and of cause some benchmarks showed regressions due to this.
Review URL: http://codereview.chromium.org/6665064

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7215 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-17 09:55:57 +00:00
sgjesse@chromium.org
1a6c821b05 Increase coverage of global loads in optimized code
In the cases where a global property cell cannot be used in the optimized code use standard load ic to get the property instead of bailing out.
Review URL: http://codereview.chromium.org/6665026

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7212 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-17 08:16:12 +00:00
vitalyr@chromium.org
269b19b447 Crankshaft support for StringCharFromCode.
This allows more efficient implementations of string keyed access,
String.prototype.chatAt, and String.fromCharCode.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7160 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-14 15:36:00 +00:00
antonm@chromium.org
7b6e295021 Faster invocation for most of API calls.
For most of API calls we generate better stub which is faster than invocation
via builtin, so use IC instead of direct call in Hydrogen.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7149 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-11 13:25:01 +00:00
whesse@chromium.org
7175dc09ef Crankshaft: Fix error in range analysis of compare operations.
Review URL: http://codereview.chromium.org/6658035

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7130 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-10 13:34:56 +00:00
fschneider@chromium.org
48832819b7 Normalize statistics about compilation time and allocation size.
Now we print compilation time and zone allocation per KB of compiled
source code to better compare with previous revisions.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7128 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-10 13:26:51 +00:00
fschneider@chromium.org
241e4d364e Initialize zone lists in the register allocator with more reasonable initial capacities.
Also replace fixed length zone lists with embedded vectors for the fixed live ranges.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7122 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-10 11:54:55 +00:00
fschneider@chromium.org
012db51660 Reuse backing store of two zone lists by using Rewind(0) instead of Clear().
Review URL: http://codereview.chromium.org/6647019

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7108 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-09 15:50:24 +00:00
danno@chromium.org
9cca7d2733 Combine typed and pixel arrays.
Worth mentioning:
- Specialized versions of pixel array and store/loads inside the generic stubs have been removed, since to have parity for all external arrays, 8 different versions would have to be inlined/checked.
- There's a new constant in v8.h for external arrays with pixel array elements.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7106 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-09 15:01:16 +00:00
kmillikin@chromium.org
a05a492254 Remove class HSubgraph.
Review URL: http://codereview.chromium.org/6647018

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7100 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-09 12:37:56 +00:00
kmillikin@chromium.org
d31594feae Refactor construction of switch statements to avoid subgraphs.
Refactor construction of switch statements so it doesn't use class
HSubgraph.

There are also a few improvements.  We do not use an auxiliary list of
comparisons because they're embedded as a linked list in the graph
under construction.  We share a common break block for all breaks from
the same switch.  We do not insert empty blocks unless necessary to
maintain edge-split form.

There is also a bug fix.  The entry to a clause body is a potential
join and must have a join ID set, otherwise deoptimization within the
body can go to an unpredictable place in the unoptimized code.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7099 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-09 12:06:54 +00:00
fschneider@chromium.org
4d2c3ee82d Avoid allocation of temporary zone lists when inserting representation changes.
Instead of allocating fresh temporary lists for every instruction, reuse
the same instance and reset it between instructions.

This reduces the amount of zone memory used for inserting the HChange
instructions roughly by half.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7094 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-08 15:08:36 +00:00
fschneider@chromium.org
12ba2dd435 Improve dead phi elimination.
This change splits the existing phi elimination into two phases:
1. Remove redundant phis
2. Remove dead phis with a fixed point iteration.

The new approach allows us to remove dead phis that are connected
in a cycle.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7085 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-08 10:04:23 +00:00
mmaly@chromium.org
927f341d3c Strict mode arguments do not share binding with formal parameters.
Move strict mode flag from TemporaryScope to Scope so that it can be accessed from variable binding code.
Arguments do not alias in strict mode (ia32, x64 and arm, codegen and full codegen).
Hydrogen tolerates null arguments_shadow().
In codegen-<arch> arguments object is allocated eagerly to capture values before they get modified.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7083 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-07 19:23:46 +00:00
kmillikin@chromium.org
4a9056cbce Fix a stack-height mismatch during deoptimization.
When deoptimizing after a conditional expression in an effect context, we
should not see the value of the conditional expression.

BUG=v8:1237

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7082 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-07 17:01:12 +00:00
kmillikin@chromium.org
2662624988 Refactor inlined functions to avoid using subgraphs.
Function inlining no longer uses subgraphs.  We detect inlining in an
effect context and avoid materializing a return value earlier than we
did before.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7080 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-07 15:42:23 +00:00
kmillikin@chromium.org
5c6b3ae6c6 Fix presubmit errors.
TBR=whesse

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7075 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-07 12:08:51 +00:00
kmillikin@chromium.org
c3172a6b7e Refactor polymorphic load and inline function graph construction.
Change the way we construct the graph for polymorphic loads to match that of
polymorphic stores.

Introduce a stack-allocated helper for saving and restoring all the
function-specific graph builder state that needs to change when we begin
translating an inlined function.  Make this class authoritative by moving
redundant state out of the builder and deferring to the current function's
state.

Ensure that we always print a tracing message when abandoning an inlining
attempt.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7074 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-07 11:52:36 +00:00
fschneider@chromium.org
ff6190946c Reorganize code for range analysis and suppress unnecessary debug printing of unknown ranges.
Review URL: http://codereview.chromium.org/6611020

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7060 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-04 12:09:54 +00:00
kmillikin@chromium.org
36f63b8476 Change the translation of polymorphic stores.
They do not use subgraphs or subgraph scopes.  Instead of computing a list
of single-block subgraphs and then adding all the edges afterward, build
both the blocks and edges directly.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7058 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-04 10:07:43 +00:00
fschneider@chromium.org
db9e6dcd86 Mark HChange that convert to int32 with truncation with the appropiate flag.
Before we would compute the flag by iterating over all uses. The truncating 
flag is always determined at construction time since we already computed
the flag for all other instructions before inserting HChange instructions.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7047 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-03 13:50:16 +00:00
kmillikin@chromium.org
84aceb526a Refactor translation of short-circuit logical operations to avoid subgraphs.
Do not use a subgraph or subgraph scope for the Hydrogen translation
of the short-circuit logical operations.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7045 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-03 13:02:56 +00:00
kmillikin@chromium.org
d6a041b8f9 Remove some more uses of subgraphs and more cleanup of the graph builder.
Do not use subgraphs to implement the translation of simple branching
control flow, for the function body entry, or for labeled blocks.

Combine all the loop construction functions into a single one.

Resolve a possible problem with duplicate AST IDs used both for joined loop
break blocks, the normal loop exit, and for their common successor, by never
introducing the extra (successor) block and instead making the normal loop
exit a predecessor of the break join block.  There is a similar issue with
joined continue blocks.

Remove a (never needed) two-element zone list per each time we replace one
hydrogen value with another.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7027 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-02 14:09:59 +00:00
kmillikin@chromium.org
043a876e93 Translate loops without using subgraphs.
Build all loop graphs without using class HSubgraph.  This also eliminates a
silly goto for the update expression of a for loop.

Support for peeling loops is removed because it's currently untested.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7017 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-02 11:09:25 +00:00
kmillikin@chromium.org
6b1530ea6d Fix a stack height mismatch when deoptimizing.
When deoptimizing from the key subexpression of a keyed arguments access,
the unoptimized code expects to find the value of the receiver on the
expression stack.  The environment of the optimizing compiler did not
contain this value during evaluation of the key subexpression.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6981 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-01 09:32:45 +00:00
kmillikin@chromium.org
ee2659d4e6 Remove all functionality from class HSubgraph.
Move the member functions of HSubgraph to HGraphBuilder.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6958 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-28 08:52:00 +00:00
lrn@chromium.org
485f4ea0d9 Clear exceptions set during attempts to lazily optimize.
Resubmit of patch for issue 1145 with a few additions:
- Now also clears exceptions when calling Runtime_LazyRecompile.
- Sets function where parsing fails to not be optimizable.

BUG=v8:1145
TEST=test/mjsunit/regress/regress-1145.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6945 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-25 11:17:31 +00:00
fschneider@chromium.org
bdcf0ec270 Fix debug tracing of live ranges and remove unused code.
When printing the sub-parts of a live range, only print the use intervals
belonging to each part.

Add a flag to print all use positions (incl. environment uses)


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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6917 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-23 15:25:04 +00:00
kmillikin@chromium.org
791c9e2c21 Remove most uses of HSubgraph as an argument.
In a lot of cases where we were passing a subgraph (a pair of basic blocks),
we actually only needed a basic block.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6913 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-23 11:59:18 +00:00
fschneider@chromium.org
288b4fb8f4 HIR refactoring.
Review URL: http://codereview.chromium.org/6538080

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6910 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-23 11:19:50 +00:00
rossberg@chromium.org
3af35dc96f Optimize functions needing a local context.
Allocate the context in the prologue. Two issues had to be solved:
(1) deoptimization needs to handle functions with a local context,
(2) we need a safepoint in the prologue.
(Thanks to Kevin.)

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6903 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-22 16:56:57 +00:00
mikhail.naganov@gmail.com
56788625b6 Fix CPU profiling for Crankshaft.
The main issue was due to multiple recompilations of functions.  Now
code objects are grouped by function using SFI object address.
JSFunction objects are no longer tracked, instead we track SFI object
moves. To pick a correct code version, we now sample return addresses
instead of JSFunction addresses.

tools/{linux|mac|windows}-tickprocessor scripts differentiate
between code optimization states for the same function
(using * and ~ prefixes introduced earlier).

DevTools CPU profiler treats all variants of function code as
a single function.

ll_prof treats each optimized variant as a separate entry, because
it can disassemble each one of them.

tickprocessor.py not updated -- it is deprecated and will be removed.

BUG=v8/1087,b/3178160
TEST=all existing tests pass, including Chromium layout tests

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6902 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-22 16:31:24 +00:00
kmillikin@chromium.org
3c02d036a8 Partial refactoring of subgraphs.
Change the interface to the Hydrogen graph builder to appear like it
directly holds a current basic block and a current environment.
Remove some direct accesses to the current subgraph, and remove
subgraph accessors that simply forwarded to the exit block.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6887 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-22 10:32:16 +00:00
kmillikin@chromium.org
14e185b31b Change the translation of break/continue into Hydrogen.
Resolve break and continue when we see them, rather then deferring
them until later.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6878 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-22 08:40:10 +00:00
kmillikin@chromium.org
663da3df40 Fix presubmit failure.
TBR=ager@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6877 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-22 06:41:32 +00:00
kmillikin@chromium.org
c1386c3381 Shorten live ranges for arguments to runtime calls.
Before, the live ranges of the arguments extended to the call itself, and
they were pushed immediately before the call.  Now, they are spilled eagerly
as soon as their value is available and they are spilled to the right place.

The inlined runtime calls in the optimized backend are changed to work as in
all the other backends: they get their arguments untranslated and can choose
their own custom evaluation order.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6876 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-22 06:25:01 +00:00
kmillikin@chromium.org
b02107284a Fix incorrect deoptimization for logical not in an effect context.
The baseline compiler does not materialize a value for expressions of
the form !expr in an effect context so the graph translation should
not produce such an environment, otherwise we risk targeting it by
deoptimization.

BUG=v8:1167

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6833 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-17 13:05:49 +00:00
kmillikin@chromium.org
82cdd48b2f Fix a bug in deoptimization after logical expressions in an effect context.
When deoptimizing to after an expression of the form (expr0 || expr1)
or (expr0 && expr1) in an effect context, the unoptimized code could
incorrectly see the value of the expression.

Handle the short-circuit binary operators specially in effect contexts.
This fixes the issue and will generate better code when the left
subexpression is boolean-valued.

BUG=v8:1166

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6831 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-17 11:06:50 +00:00
danno@chromium.org
181bdc5f06 Fix syntax error, feel sheepish.
Review URL: http://codereview.chromium.org/6525052

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6822 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-16 13:59:26 +00:00
danno@chromium.org
e8c012c99a Fix presubmit problem.
Review URL: http://codereview.chromium.org/6526048

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6820 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-16 13:52:46 +00:00
danno@chromium.org
12b4e0efe7 Implement crankshaft support for pixel array stores.
Review URL: http://codereview.chromium.org/6528013

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6817 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-16 13:31:12 +00:00
karlklose@chromium.org
7de60ef84d ARM: Implement GetCachedArrayIndex in the lithium code generator.
Add GetCachedArrayIndex to the Hydrogen instruction set and implement GetCachedArrayIndex in the lithium code generator. The x64 and ia32 code generators implementations abort in the chunk builder.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6803 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-16 08:21:45 +00:00
rossberg@chromium.org
ae8c5defbc Enable compound assignment to context slots.
Review URL: http://codereview.chromium.org/6523025

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6798 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-15 16:37:40 +00:00
kmillikin@chromium.org
f2e38c6276 Refactor construction of polymorphic loads, stores, and calls.
Rather than passing in a pair of unequal-length lists, pass the default
subgraph separately.  Construct the typecase from the top down rather than
the bottom up, so it doesn't need an intermediate zone list.

Also, change a basic block's 'last' instruction field to really be its last
instruction by correctly updating it when inserting and removing
instructions.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6783 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-15 07:58:04 +00:00
fschneider@chromium.org
9bbb257b02 Small cleanup of unused code in hydrogen IR.
Review URL: http://codereview.chromium.org/6513008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6763 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-14 09:23:26 +00:00
fschneider@chromium.org
56f6cbbeae Revert r6748.
I'm seeing some crashes after this change which I need to investigate.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6755 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-11 14:34:02 +00:00
antonm@chromium.org
e96c24bf03 Properly treat exceptions thrown while compiling.
BUG=v8:1132
TEST=test/mjsunit/regress/regress-1132.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6754 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-11 14:26:56 +00:00
kmillikin@chromium.org
3ef7ca6c28 Remove the uses of the arguments from all calls.
Before, Hydrogen call instructions had uses of the PushArgument instructions
for their arguments.  These operands were unneeded, bloated the IR, and
caused calls to be the only Hydrogen instructions with an unpredictable
number of operands.

Now, PushArgument is a pure side-effecting instruction that has no uses.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6749 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-11 13:20:06 +00:00
fschneider@chromium.org
bbba0dbd61 Add a genuine unary minus instruction to Crankshaft.
This change introduces an instruction for negation instead
of generating a multiplication with -1.

The code for x64 and ARM is not included in this change.


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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6748 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-11 12:56:30 +00:00
kmillikin@chromium.org
2e08148b06 Fix the semantics of delete on parameters.
Before, an attempt to delete a parameter in a function that used the
arguments object in any way would succeed with true and delete both
the parameter and the corresponding arguments object property.

Now, an attempt to delete such a parameter does not delete and
evaluates to false.

Parameters can be deleted, as before, from functions that use the
arguments object, by deleting the corresponding arguments object
property (this is a spec violation).

BUG=fixes v8:1136

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6745 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-11 11:57:11 +00:00
danno@chromium.org
1bd9f602be Implement crankshaft support for pixel array loads.
Review URL: http://codereview.chromium.org/6410112

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6725 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-10 12:02:36 +00:00
kmillikin@chromium.org
c0fd053982 Fix a representation change bug in the Hydrogen graph construction.
We could try to treat an HPhi as an HInstruction because the code did
not properly handle the case of a phi in a block with itself as one of
the predecessors.

BUG=v8:1134

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6721 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-10 10:28:59 +00:00
kmillikin@chromium.org
e88f25f6dc Insert a space to please our presubmit overlords.
Review URL: http://codereview.chromium.org/6480027

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6715 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-10 09:16:33 +00:00
kmillikin@chromium.org
ebebcae4c2 Allow esi to be an allocatable register on IA32.
Make esi available to the register allocator rather than dedicating it
permanently to the context.

The context is still passed in register esi to JavaScript and to the runtime
as part of the calling convention.  Because some stubs might end up calling
JS or the runtime, it is also conservatively passed to stubs.

Roughly half the calls have been modified to use the context as an input
value in fixed register esi.  The other half are marked as calls or deferred
code so esi is spilled and can be explicitly set.

It is no longer necessary to restore the context to esi after a call that
might change it.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6713 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-10 09:00:50 +00:00
kmillikin@chromium.org
991a1cae12 Fix an assertion failure in stack trace construction.
When constructing stack traces we interpret the deoptimization data for
optimized frames to find the receiver value.  This value could sometimes be
eliminated from the deoptimization data if we though it was unused.

BUG=v8:1118

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6694 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-09 11:45:50 +00:00
whesse@chromium.org
39c855bd48 Bailout from crankshaft if a global property is found in the prototype chain of the global object, not on the global object itself.
Review URL: http://codereview.chromium.org/6449002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6678 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-08 13:28:09 +00:00
vegorov@chromium.org
76cf30d9c8 Support %_IsConstructCall in the Crankshaft pipeline.
Provide special case for f.bind(obj).

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6671 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-08 10:08:47 +00:00
kmillikin@chromium.org
97ccdd1e99 Introduce a hydrogen value for contexts, support context slot assignment.
Each context in the context chain has a corresponding hydrogen value.
The context values are used for global object lookup and context slot
lookup.  Add simple (non-compound) assignment to context slots.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6615 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-03 13:10:28 +00:00
kmillikin@chromium.org
f1149734fc Partial fix for V8 issue 1079.
Record a safepoint with a deoptimization id for throw in optimized code.  We
don't seem to much care what the AST ID is because we will not be using it
for lazy deoptimization (throw doesn't return to the point of throw).  For
hygiene we use the actual ID of the throw expression.  Throw is no longer a
control-flow instruction, but it's followed by an unconditional abnormal
exit.  This is required to insert a simulate between the throw and the exit.

Make our optimized treatment of Function.prototype.apply act like a call and
have side effects.  This ensures that it will get a lazy deoptimization
environment.  Use that deoptimization ID in the safepoint for the call.

Deleting a property was also missing a deoptimization ID, though there was a
deoptimization environment assigned to the instruction.  Record the
environment and use the deoptimization ID at the safepoint.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6576 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-02 13:55:29 +00:00
fschneider@chromium.org
4e7ddab6dc Fix a bug in the placement of minus-zero checks and in GVN.
1. The placement of checks for negative zero has to be computed after
all conversion instructions have been inserted. I separated the code
into its own phase.

2. GVN need to take instruction flags into account when comparing
instructions for redundancy.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6534 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-31 12:36:54 +00:00
fschneider@chromium.org
d82332ebb7 Cleanup unused code from the type oracle.
Review URL: http://codereview.chromium.org/6135004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6514 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-27 14:04:07 +00:00
ager@chromium.org
dc61921bbf Fix reintroduction of global variables that have been deleted.
Deletion of global properties puts 'the hole' in the global property
cell and updates the property details in the property dictionary with
the information that the property has been deleted. When setting
global properties that have been deleted in generated code we just
store the new value in the global property cell. This does not update
the property details in the property dictionary. Therefore, it looks
like the property is not there eventhough it was just reintroduced.

Perform 'the hole' checks in generated code for global property stores
and bail out of ICs and optimized code if storing to a property cell
that contains 'the hole'.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6508 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-27 08:35:39 +00:00
kmillikin@chromium.org
09e967b38f Use more detailed compilation info for inlined functions.
Construct the statically-known compilation info for inlined functions using
the target closure (which knows about its scope chain) and not from the
shared function info (which doesn't).

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6499 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-26 17:30:22 +00:00
kmillikin@chromium.org
97f09782fa Disable all code motion on the final optimization attempt.
Before, we disabled code motion for check instructions on the final
optimization attempt.  It is unsafe to prevent movement of check
instructions but to allow movement of instructions that assume the checks
were performed.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6485 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-26 10:25:43 +00:00
vitalyr@chromium.org
76483f871b Support StringLength in hydrogen (similar to ArrayLength).
To avoid deopts a few extra changes were needed:

o Enable megamorphic state for special property loads on
  primitives. We used to flip between monomorphic stubs.
o Extract pure string (no string wrapper support) version of the
  string length stub.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6472 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-25 15:51:10 +00:00
kmillikin@chromium.org
3d15b43393 Begin changing Hydrogen branch instructions.
Rename HBranch (the instruction that coerces an arbitrary HValue to
control flow) to HTest to free up the term Branch to refer to any
control instruction with two successors.

Change the virtual FirstSuccessor and SecondSuccessor functions on
control instructions to a pair of data members.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6417 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-20 12:56:34 +00:00
fschneider@chromium.org
89e74000a0 Use typefeedback for bitwise operations.
Add a generic tagged version for all bitwise operation that
invoke the generic stub. This allows us to perform generic
bitwise operations (i.e. on non-integers) without deoptimizing.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6416 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-20 12:47:22 +00:00
vitalyr@chromium.org
b4ff318e4b Support StringCharCodeAt in hydrogen/lithium.
This patch adds H- and L-variants of StringCharCodeAt and StringLength.

StringCharCodeAt is used to inline a constant function call of
String.prototype.charCodeAt and to implement the corresponding inline
runtime function. It does not yet use the recently introduced extra IC
state. (We can specialize on string encoding and avoid deopts because
of out of bounds accesses.)

StringLength needs more work because the stub version of it also
supports strings wrappers and it matters in some cases. (We have to
separate the string only case.)

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6408 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-19 20:05:22 +00:00
vitalyr@chromium.org
c919bb7d4a Disable aggressive optimizations on the last optimization attempt.
Only has effect on the loop invariant code motion and Check instructions
for now.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6363 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-18 13:43:48 +00:00
antonm@chromium.org
fae90d4f32 Make closures optimizable by Crankshaft compiler.
Currently only closures which only read from the context are supported.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6340 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-17 08:11:03 +00:00
vitalyr@chromium.org
ac9b035a45 Expose receiver check type in call type feedback.
This a preparatory step to support fast function calls on primitive
values. Not really used yet in hydrogen.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6300 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-13 14:16:08 +00:00
vitalyr@chromium.org
9e204dd5df Simplify CheckPrototypeMaps.
This instruction only depends on the prototype and the holder and can
completely ignore the receiver and its map.

This change also fixes a small bug on arm where a cell was loaded
instead of the prototype from new space.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6290 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-13 00:34:08 +00:00
fschneider@chromium.org
b85538bc16 Introduce two more template parameter for Lithium instructions for input and temp operands.
Each LInstruction is now a subclass of LTemplateInstruction<R, I, T>

where R is number of outputs, I number of inputs and T number of temps.

This change only actually uses the parameter I for input operands. 
Since the parameter T for temps is 0, it incurs no extra cost. 

A separate change will introduce using the temps parameter.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6275 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-11 15:47:34 +00:00
kmillikin@chromium.org
32254e5324 Change the hydrogen timing data to include zone allocation.
Review URL: http://codereview.chromium.org/6190002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6249 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-10 14:16:47 +00:00
fschneider@chromium.org
bfecc95694 Revert r6194: Clean up code for type feedback a bit.
This causes a big performance regression. I'll investigate.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6217 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-07 10:36:27 +00:00
fschneider@chromium.org
35533bee36 Clean up code for type feedback a bit.
Remove unused functions and parameters and remove the parts of the
code that mention the old GenericBinaryOpStub. It is not used together
with Crankshaft and replaced with TypeRecordingBinaryOpStub.


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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6194 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-06 10:10:26 +00:00
kmillikin@chromium.org
9a096e643a Fix an bug in deoptimization after polymorphic calls in effect contexts.
For polymorphic calls (also loads and stores) we construct a type switch
graph that has a basic block merging all the variants.  There is an
environment simulation before the goto at the end of all the predecessor
blocks.  This simulation is used to define the environment on entry to the
successor block, and captures the return value of the call.  In effect
contexts, this value should not be present in the environment.

The fix is to use the AST context to decide whether to have this value in
the join node's environment at all.

BUG=1014

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6189 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-06 07:38:19 +00:00
sgjesse@chromium.org
7311e10fdb Optimize instanceof further
If the instance of is performed against what is beliwed to be a constant global function inline the instance of check and have the call to the instanceof stub in deferred code. The inlined check will be patched by the instanceof stub when called from deferred code. This is indicated by the lithium instruction LInstanceOfKnownGlobal.

To help the patching the delta from the return address to the patch site is placed just below the return address in the edi slot of the pushad/popad ares. This is safe because the edi register (which is pushed last) is a temporary for the lithium instruction.

As the instanceof stub can call other JavaScript an additional marking for saving all double registers have been added.

Also tweaked the instanceof stub to produce true/false objects instead of 0/1 for the case with deferred code.
Review URL: http://codereview.chromium.org/5990005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6173 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-05 11:17:37 +00:00
kmillikin@chromium.org
c1fd8bcf60 Fix a bug in deoptimization environments.
The function HEnvironment::SetExpressionStackAt did not update the
environment's history.  This function is used to patch the bailout
environment for count operations and global function calls.

Reorganize class HEnvironment to make it fit V8's style a bit better
and to try to add some sanity to which C++ functions are intended to
be inlined.

Remove the flag --trace-environment which merely duplicated data in
the hydrogen.cfg file except without enough context to be useful.

BUG=1004

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6137 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-03 16:57:46 +00:00
fschneider@chromium.org
0a128e5ae7 Optimize array-length and fast element loads.
1. Separating out the instance-type check from the array-length operation.

2. I also changed the bounds-check on keyed loads to use the length property
for JS arrays (like we do for array stores).

The new pattern should use less registers and allow more checks to be eliminated.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6125 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-30 19:30:42 +00:00
vitalyr@chromium.org
c5916f552f Support load function prototype in hydrogen/lithium.
Review URL: http://codereview.chromium.org/6009005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6112 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-22 15:43:32 +00:00
kmillikin@chromium.org
7171df741a Fix for issue 1007.
The Hydrogen environment only tracks values for stack-allocated variables.
It is a precondition of HEnvironment::Lookup(variable) that variable is
stack-allocated.  The check was missing at one call site.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6094 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-21 11:21:04 +00:00
whesse@chromium.org
5656d64ece Add untagged double versions of Math.sin and Math.cos. Merge classes TranscendentalCacheStub and TranscendentalCacheSSE2Stub.
Review URL: http://codereview.chromium.org/5996002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6083 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-20 13:52:14 +00:00
fschneider@chromium.org
7cc61e6973 Fix GVN for polymorphic loads.
They must not be hoisted above the compare-map-and-branch.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6082 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-20 13:18:47 +00:00
fschneider@chromium.org
6cc0310a72 Mark map-transition stores as map-changing instructions.
This prevents code motion from hoisting map-checks across such stores
which may result in unnecessary deoptimizations.

In the following example program we would move a map-check from the inner loop out before the outer loop which is not desirable:

function f() {
  var o = {};
  var j = 0;
  o.a = 1;
  do {
    o.b = 6;  // Map transition
    for (var i=0; i<10; i++) {
       o.a = o.b + i;
    }
  } while(++j < 1) {}
}

for (var i = 0; i < 1000000; i++) f();


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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6071 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-17 13:44:19 +00:00
vitalyr@chromium.org
2ba48c0a45 Support loading constant functions in hydrogen.
Review URL: http://codereview.chromium.org/5878004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6057 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-16 22:30:53 +00:00
fschneider@chromium.org
73737fcdb6 Fix bugs in the range analysis for integers.
The overflow conditions were not correctly detected for 
certain add, sub and mul instructions.

I replaced the previous code by using 64-bit arithmetic
to correctly identify overflows for *, + and -.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6055 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-16 18:01:36 +00:00
kmillikin@chromium.org
4f231f59b4 Fix an issue discovered in regress-969.
When running with 10 stress runs we get polymorphic stores.  This revealed
an incorrect bailout ID for the state following a polymorphic store.  The ID
should be the internal ID of the assignment side-effect, not the ID of the
end of the expression.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6051 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-16 14:18:41 +00:00
kmillikin@chromium.org
4a6ef3ee28 Fix issue 977, occasional failure of the DeltaBlue benchmark.
Before, when we deoptimized after a branch we jumped to before the branch
was taken in the unoptimized code with a token value that indicated when
edge to take.  There was a lot of machinery to track this value through the
short-circuit logical operations and logical negation, and to handle it
properly at inline function return sites.  There was also machinery to
prevent incorrectly seeing this environment with the extra value never
actually materialized in the unoptimized code.

Instead, now we deoptimize directly to one of the targets of the branch.
Much but not yet all of the extra machinery has been removed or simplified.
The cost is that branching control structures (the looping statements, if
statements, conditional expressions, and the short-circuit binary logical
operations) need extra AST IDs to identify the branch targets.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6049 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-16 13:13:36 +00:00
vitalyr@chromium.org
7a3fd2aa52 Deoptimize non-smi switch cases if they are reached.
This way if the type oracle says an unreachable clause has a non-smi
type, we can still emit optimized code instead of doing an early
bailout.

This change depends of Florian's r5970.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6037 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-15 17:11:11 +00:00
fschneider@chromium.org
c03c71a937 Emit a load of the elements array only before the first store.
This avoid emitting the load for empty and constant array literals.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6034 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-15 16:12:55 +00:00
erik.corry@gmail.com
2996dca6aa Support %_IsObject in Crankshaft.
Review URL: http://codereview.chromium.org/5806001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6027 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-15 12:32:19 +00:00
kmillikin@chromium.org
eb7b4e347e Fix issue 979.
The issue is caused when deoptimizing to an internal AST ID in a
postfix increment or decrement operation on variable.  This could
happen for a global variable.  In that case, the optimized code was
not properly simulating an extra stack slot in the unoptimized code to
hold the original value.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6025 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-15 11:47:05 +00:00
vitalyr@chromium.org
57e072298f Merge math function ids and custom call generator ids.
Two old id types are replaced by builtin function ids. We can use
these in the code generators to emit custom code for the selected
functions.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6013 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-14 18:53:48 +00:00
whesse@chromium.org
c23c244add Reapply change 5989, adding untagged double calls to Math.pow, with problem in generated code for TranscendentalCacheSSE2Stub (unguarded SSE 4.1 code) fixed.
Review URL: http://codereview.chromium.org/5726008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6010 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-14 13:21:29 +00:00
whesse@chromium.org
fdf44a4bc7 Revert change 5989, which causes failures in some benchmarks.
Review URL: http://codereview.chromium.org/5804003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5991 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-13 16:34:59 +00:00
kmillikin@chromium.org
49f4c39d6d Deoptimize to the proper target after assignment side effects.
This fixes V8 issue 989.

Before, assignments used the AST ID of the assignment expression to
mark the side effect of the store, which became a target for
deoptimization bailout for code after the assignment.  In effect
contexts this environment included the value of the assignment, which
was unexpected by the unoptimized code.

Now we introduce a new assignment ID for AST node types that include
an assignment (Assignment, CountOperation, and ForInStatement) and use
it for the side effect of the store.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5990 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-13 16:29:47 +00:00
whesse@chromium.org
1a008f28d5 Allow optimizing compiler to compute Math.log using untagged doubles.
Review URL: http://codereview.chromium.org/5741003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5989 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-13 14:37:19 +00:00
kmillikin@chromium.org
a695d0731e Change the HGraphBuilder to dispatch on the context.
Before, expressions didn't take advantage of knowing their context in
the AST.  Now, we use the context to decide what to do with a value at
the end of visiting an expression.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5954 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-09 12:49:53 +00:00
whesse@chromium.org
3ef0c5dd21 Allow the optimizing code generator to call Math.pow with untagged doubles.
Review URL: http://codereview.chromium.org/5640004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5949 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-08 14:32:40 +00:00
kmillikin@chromium.org
e0d3f6afdf Be more careful about exiting inlined functions in a test context.
When falling off the end of a function inlined in a test context, we cannot
constant fold the test of undefined away. The graph builder assumes that
control flow always reaches both branches of a test.

Instead, explicitly test and branch on "undefined". Introduce a pair of
empty blocks to hold the necessary LeaveInlined instructions.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5927 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-07 12:07:40 +00:00
vegorov@chromium.org
199f1e7977 Fix Win64 compilation.
Review URL: http://codereview.chromium.org/5597007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5925 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-07 11:53:19 +00:00
kasperl@chromium.org
90b3370374 Update V8 to version 3.0 (re-land r5920).
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5922 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-07 11:31:57 +00:00
kasperl@chromium.org
51b494d096 Revert r5920. Will re-land shortly.
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5921 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-07 11:01:02 +00:00
kasperl@chromium.org
e5860bd6a8 Update V8 to version 3.0.
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5920 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-07 09:11:56 +00:00