Commit Graph

59 Commits

Author SHA1 Message Date
sgjesse@chromium.org
4e03645dc4 Analyze functions for assignment to this properties.
During parsing functions are analyzed for statements of the form this.x = ...;. These assignments are categorized in two types: simple and non simple. The simple ones are where the right hand side is known to be either a constant or an argument to the function. If a function only contains statements of this type the property names are collected and for the simple assignments the index of the argument or the constant value assigned are stored as well.

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

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

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2710 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-08-19 07:30:20 +00:00
sgjesse@chromium.org
7b05678316 Refactor SetFunctionInfo to reduce long argument list.
Review URL: http://codereview.chromium.org/165527

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2687 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-08-14 11:05:42 +00:00
kmillikin@chromium.org
a48fd5916e Change the overly-general class named Node to the more specific
AstNode in case we ever want to have some other kind of node.

Split the NODE_LIST macro-generating macro so that we can iterate
concrete subclasses of Statement and concrete subclasses of Expression
separately.
Review URL: http://codereview.chromium.org/159632

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2586 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-07-30 11:53:29 +00:00
kasperl@chromium.org
f1ffd50257 Optimize %ClassOf() on IA-32 and use it instead of the
custom %HasXXXClass() calls.
Review URL: http://codereview.chromium.org/151018

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2293 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-06-29 10:45:16 +00:00
kasperl@chromium.org
a1622491af Optimize %IsConstructCall() on IA-32.
Review URL: http://codereview.chromium.org/150018

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2290 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-06-29 08:14:06 +00:00
antonm@chromium.org
ecfd1f1017 Attempt to reduce performance penalty for logging and profiling
Review URL: http://codereview.chromium.org/125141

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2263 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-06-24 13:09:34 +00:00
kmillikin@chromium.org
73fe551048 Remove the unused support for jump-table switch statements.
Review URL: http://codereview.chromium.org/126193

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2183 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-06-16 09:50:37 +00:00
sgjesse@chromium.org
97482a43bf Fix disassembly output from oprofile.
Only send the inscructions part of a code object to oprofile when reporting dynamically generated code. Before the code object header was also reported to oprofile as code which caused strange disassembly output when using opannotate.
Review URL: http://codereview.chromium.org/125126

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2174 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-06-15 16:33:28 +00:00
ager@chromium.org
225a6a82b0 Optimize Math.sin and Math.cos by avoiding runtime calls.
Review URL: http://codereview.chromium.org/125121

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2166 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-06-15 12:06:48 +00:00
kasperl@chromium.org
ce7cdbd799 Change the implementation of Math.random to use George
Marsaglia's multiply-with-carry instead of mixing the
bits obtained from calling the system random() twice.

This seems to be a bit faster and gives a better 
distribution than the system random() in particular on 
Windows. 
Review URL: http://codereview.chromium.org/126113

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2159 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-06-15 08:04:47 +00:00
mikhail.naganov@gmail.com
d7cccf6b8d Add log compression ability.
This is a trivial per-row compression:
- short aliases are introduced for events and code creation tags;
- in tick events, offsets are used instead of absolute addresses;
- removed 'code-allocation' event, as it seems not used.

The first two options are depend on the new flag: 'compress-log', which is off by default.

On benchmarks run w/o snapshot, this gives 45% log size reduction.

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


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2122 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-06-08 13:39:48 +00:00
kmillikin@chromium.org
bd82b972fc Simplify the processing of deferred code in the code generator. Our
deferred code snippets are highly stylized.  They always make a call
to a stub or the runtime and then return.  This change takes advantage
of that.

Creating a deferred code object now captures a snapshot of the
registers in the virtual frame.  The registers are automatically saved
on entry to the deferred code and restored on exit.

The clients of deferred code must ensure that there is no change to
the registers in the virtual frame (eg, by allocating which can cause
spilling) or to the stack pointer.  That is currently the case.

As a separate change, I will add either code to verify this constraint
or else code to forbid any frame effect.

The deferred code itself does not use the virtual frame or register
allocator (or even the code generator).  It is raw macro assembler
code.
Review URL: http://codereview.chromium.org/118226

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2112 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-06-05 14:16:32 +00:00
kmillikin@chromium.org
3d15415414 Simplify deferred code by removing some unneeded or redundant stuff.
Review URL: http://codereview.chromium.org/113895

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2065 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-05-27 15:13:00 +00:00
kmillikin@chromium.org
9c829fafe9 Change the register allocator so that it no longer tracks references
to the platform-specific reserved registers.  They are always in use
for their intended purpose, cannot appear in the virtual frame, and
can be freely used without allocation in the code generator.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2061 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-05-27 07:53:47 +00:00
erik.corry@gmail.com
01f7c87f22 This patch much improves our tracking of whether function is
called from within a loop or not.  In the past we lost the
information if a call site went megamorphic before a lazily
compiled callee was called for the first time.  Now we track
that correctly (this is an issue that affects richards).
We still don't manage to track the in-loop state through a
constructor call, since constructor calls use LoadICs instead
of CallICs.  This issue affects delta-blue.  So in this patch
we assume that lazy compilations that don't happen through a
CallIC happen from inside a loop.  I have an idea to fix this
but this patch is big enough already.
With our improved tracking of in-loop state I have switched
off the inlining of in-object loads for code that is not in
a loop.  This benefits compile speed.  One issue is that
eagerly compiled code now doesn't get the in-object loads
inlined.  We need to eagerly compile less code to fix this.
Review URL: http://codereview.chromium.org/115744

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2046 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-05-25 18:29:02 +00:00
mikhail.naganov@gmail.com
30a0a7de43 Split nested namespaces declaration in two lines in accordance with C++ Style Guide.
This issue was raised by Brett Wilson while reviewing my changelist for readability. Craig Silverstein (one of C++ SG maintainers) confirmed that we should declare one namespace per line. Our way of namespaces closing seems not violating style guides (there is no clear agreement on it), so I left it intact.

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


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2038 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-05-25 10:05:56 +00:00
mikhail.naganov@gmail.com
6d71da11fd Merge in changes from readability review.
All changes from http://codereview.chromium.org/115024, except splitting namespace declarations in two lines (will be done separately for all source files).

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


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2037 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-05-25 08:39:22 +00:00
ager@chromium.org
ef85ba46b0 First round of size reduction for JumpTargets. Reduce their size by
two words: there is no reason to keep a pointer to the current code
generator and macro assembler in the JumpTarget.
Review URL: http://codereview.chromium.org/113458

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1987 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-05-18 12:26:59 +00:00
bak@chromium.org
81af5beefa Changed FuncNameInferrer and ScopeInfo to support zone allocation.
Yields a 2% speedup when running compiler-benchmark.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1985 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-05-18 09:41:16 +00:00
ager@chromium.org
a3f30f5a3a Clean up the Result class. Reduce the size of Result from four words
to one by keeping a stack of active code generators and by using
indirection to handles.

Mainly a cleanup.  No visible performance impact.
Review URL: http://codereview.chromium.org/113455

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1965 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-05-15 11:09:51 +00:00
bak@chromium.org
9e02f380f0 Removed the delete calls to ZoneObjects.
Review URL: http://codereview.chromium.org/115348

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1948 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-05-14 11:36:10 +00:00
kmillikin@chromium.org
f48a6bf30f Add more detailed timers of the various compilation passes. The
aggregate compilation time timer is the same as it was before.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1946 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-05-14 10:29:48 +00:00
mikhail.naganov@gmail.com
3e82fce446 Restore stack backtrace tests removed in revision 1785.
To re-enable tests, instead of compiled code patching, inlined code is used.
Inlined code is only installed in test.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1892 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-05-07 09:24:43 +00:00
feng@chromium.org
ea48d53bad Add ENABLE_DEBUGGER_SUPPORT macro.
ENABLE_DEBUGGER_SUPPORT is enabled by default unless it is on Android platform.
On Android platform, it can also enabled by passing -DENABLE_DEBUGGER_SUPPORT flag to the compiler.

This should not affect any existing build (I hope, cross my fingers) except the build in real Android environment (in other word, it only affects me now).

There are lot of room for code refactoring in stead of using #ifdef all over the place. I will leave this to v8 folks.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1745 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-04-20 16:36:13 +00:00
sgjesse@chromium.org
8b4cfc3768 Fix the source position recorded for funtion return
Record the function return position as the end of the function source. Don't record function entry and return positions as statement positions.

Added a test for source position for break at function return.
Review URL: http://codereview.chromium.org/67109

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1706 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-04-14 14:56:03 +00:00
mikhail.naganov@gmail.com
3c2a7bdf21 Add name inference for anonymous functions to facilitate debugging and profiling of JS code.
Currently function name inference is wired with AST optimization pass to avoid introducing another pass over AST. A better solution would be to rewrite AST visitors so they can be naturally combined together in a single pass, as their current implementation doesn't allow it.

For examples of cases where function names can be inferred, see the tests file.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1696 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-04-14 00:51:59 +00:00
kmillikin@chromium.org
06860982a9 Clean up return statements in the code generator by explicitly
counting the reference to the return value and passing it to the
return label.  This requires threading it through try/catch and
try/finally.  The return value is loaded into eax more lazily than
before.

Also, perform some related refactoring of jump targets.
Review URL: http://codereview.chromium.org/56172

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1669 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-04-02 08:58:18 +00:00
kmillikin@chromium.org
d0b7f84ec0 Use the AST optimizer on the bodies of function literals. Notify the
oprofile agent when we compile the body of a function literal.
Review URL: http://codereview.chromium.org/57048

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1645 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-03-31 09:02:40 +00:00
kmillikin@chromium.org
6565243504 Inline the Result::Unuse member function and change the Result
destructor to no longer invalidate the result.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1560 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-03-20 12:58:14 +00:00
kmillikin@chromium.org
9752bf90b5 Remove a bunch of unnecessary includes from header files in favor of
forward declarations.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1559 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-03-20 09:35:31 +00:00
erik.corry@gmail.com
608a99a90c Remove all uses of StringShape variables, since that has proven
to be error-prone and of little benefit in terms of performance.
Review URL: http://codereview.chromium.org/45010

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1521 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-03-17 09:33:06 +00:00
kmillikin@chromium.org
82df32b78c Fix issue 268 by explicitly calling Unuse (to deallocate all contained
virtual frames) on zone-allocated jump targets.  These include jump
targets in AST nodes and the entry and exit targets of deferred code.

See http://code.google.com/p/v8/issues/detail?id=268

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1486 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-03-11 10:25:48 +00:00
kmillikin@chromium.org
1984f54a78 Assert in debug mode that we do not try to compile a function literal
more than once.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1456 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-03-09 14:48:34 +00:00
iposva@chromium.org
be0c1e26e9 Add a meaningful name when disassembling code. This makes it easier
to match generated code to the originating source.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1408 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-03-04 06:14:34 +00:00
kmillikin@chromium.org
f4735247cf Merge from experimental code generator branch to bleeding edge.
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1389 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-02-27 13:00:32 +00:00
iposva@chromium.org
c093e94546 - Pass the knowledge whether the old GC is compacting to the GC prologue and epilogue. This allows us to skip frame cooking and uncooking when doing a mark-sweep GC.
- Add the ability for the code to refer to its code object by adding a handle to the code object in the MacroAssembler.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1368 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-02-25 16:52:15 +00:00
christian.plesner.hansen@gmail.com
4e78736900 Fixed build with no ENABLE_LOGGING_AND_PROFILING
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1039 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-01-07 14:24:08 +00:00
christian.plesner.hansen@gmail.com
afcc36a417 Added runtime call to the logging infrastructure. Made some changes
to the way regexps are being logged.


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1028 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2009-01-06 13:24:52 +00:00
sgjesse@chromium.org
b3dd6b686a Refactored the recording of source position in the generated code. The code generator now has two methods
void CodeForStatement(Node* node)
  void CodeForSourcePosition(int pos)

The first is used to indicate that code is about to be generated for the given statement and the second is used to indicate that code is about to be generated for the given source position.

Added position information for some statements which was missing whem.

Updated the code generator for ARM to emit source position the same way as for IA-32.

Added an assert to ensure that deferred code stubs will always have a source source position as if it has not it will take whatever source position before which makes no sense.

The passing test on ARM has only been tested using the simulator.
Review URL: http://codereview.chromium.org/14170

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@985 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2008-12-17 08:45:42 +00:00
kmillikin@chromium.org
291147e2f1 Enable printing code generated for builtins in release mode when the
disassembler is enabled.  It's convenient to be able to see them.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@913 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2008-12-04 08:26:08 +00:00
kasperl@chromium.org
7940adb1ec Track loop nesting across function calls when the function
is called through an IC the first time.
Review URL: http://codereview.chromium.org/10746

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@764 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2008-11-17 05:50:52 +00:00
erik.corry@gmail.com
eca89dc765 Create an abstraction for the string type flags so that they can be cached.
Read the objects.h change first to understand what's going on here.
Review URL: http://codereview.chromium.org/9038

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@675 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2008-11-03 10:16:05 +00:00
erik.corry@gmail.com
dbc6dd66e4 Fix some style issues.
Review URL: http://codereview.chromium.org/8055

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@563 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2008-10-23 07:28:21 +00:00
kmillikin@chromium.org
ebd11b7382 Code formatting changes.
Review URL: http://codereview.chromium.org/7346

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@518 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2008-10-17 09:54:34 +00:00
iposva@chromium.org
89c762edf4 Simplify CodeGenerator hierarchy by not using a base class.
There is nothing virtual about a CodeGenerator since we
either generate code for one platform or for the other.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@480 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2008-10-10 00:00:52 +00:00
kasperl@chromium.org
892b0cac3c Refactor the arguments access code to make it easier to read.
Review URL: http://codereview.chromium.org/6491

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@442 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2008-10-06 11:04:03 +00:00
lrn@chromium.org
17dc503149 Added fast-case switch to ARM.
Refactored to reuse code between ia32 and ARM.
Added tests for switch.


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@424 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2008-10-03 12:04:59 +00:00
sgjesse@chromium.org
8391b19b07 Refactor the enum RelocMode changing the naming scheme from lower case to
upper case. Moved it into the RelocInfo class together with the associated
is_xxx functions. Renamed is_xxx to IsXxx in the process.

Removed the exit_js_frame mode as it was no longer used.

Patch Set 2 renames RELOC_MODE_COUNT to NUMBER_OF_MODES and fixes a couple of lint errors.
Review URL: http://codereview.chromium.org/3186

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@354 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2008-09-22 13:57:03 +00:00
sgjesse@chromium.org
b568d7a17b Defer the writing of the source position data to the relocation information
until a possible debug break location is reached. Currently this is call sites
with calls to code objects and JS return. Source position information in the
code therefore no longer refers to the "first" instruction generated for a
given source position (which was not the case defered code anyway) but to the
first break location after that source position was passed (again defered code
always start with source position information). This doesn't make a difference
for the debugger as it will always be stopped only at debug break locations.
However, this makes the life of the peep-hole optimizer much easier as many
oportunities for posh/pop eliminations where previosly blocked by relocation
information already written to the code object.

Two types of source positions are still collected. Statement positions indicate
the position of the start of the statement leading to this code and (plain)
positions indicate other places typically call sites to help indicate current
position in backtraces. The two different types of positions are also used to
distinguish between step next and step in.

Runs all the tests (including debugger tests) as before.

Moved the checking for the FLAG_debug_info to one place.

I will do the same changes to the ARM codegenerator in a seperate changelist.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@335 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2008-09-18 08:51:43 +00:00
kasperl@chromium.org
64923a6a83 Generalize the Function.prototype.call hooks in the
arguments adaptor code to allow builtins to work without
argument adaptor frames. Get rid of unused JavaScript
implementation of call and apply and the associated
code generation hooks.
Review URL: http://codereview.chromium.org/2850

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@311 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2008-09-15 15:02:38 +00:00