Commit Graph

446 Commits

Author SHA1 Message Date
ricow@chromium.org
a9641176fd Remove assertion that is no longer valid in InitializeStringSearch.
This assertion is no longer valid because r5380 changes the assumption
about the pat parameter.

In addition, we embed the no allocation part of StringSplit in a block
to reenable allocation later in that method.


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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5381 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-31 10:39:02 +00:00
sandholm@chromium.org
97ccb64a06 Simplify code by removing special-casing for single-character patterns
Review URL: http://codereview.chromium.org/3276004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5380 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-31 09:22:53 +00:00
erik.corry@gmail.com
663f378da5 Get gcc to check that we don't ignore return values of functions that can
fail to allocate because we need a GC.
Review URL: http://codereview.chromium.org/3274008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5379 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-31 08:05:42 +00:00
serya@chromium.org
71548e969b Using array index hash code for string-to-number conversion.
Review URL: http://codereview.chromium.org/3141022

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5362 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-27 11:47:12 +00:00
vitalyr@chromium.org
ee1dc27795 Fast string construct stub (ia32 only for now).
Review URL: http://codereview.chromium.org/3211002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5357 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-26 13:59:37 +00:00
vitalyr@chromium.org
9f65b1e32d Explicitly set expected number of properties for instances of builtin types.
We used to inherit an estimate on the expected number of properties in
%SetCode. It is not accurate and does not help for the types where
adding custom properties is rare (String, Date, etc.).

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5348 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-25 17:50:37 +00:00
lrn@chromium.org
b1e27e2cd5 Created collector class and used it to collect identifiers during scanning.
The collector class automatically expands to hold the values added to it,
like a List, but doesn't ensure that the backing store is contiguous, which
allows it to avoid copying back and forth as the buffer grows.

This is in preparation for identifyng identical symbols during preparsing.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5325 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-24 10:53:44 +00:00
lrn@chromium.org
0d12f8f4e5 Fixed remaining bugs in COW-regexp-results.
Review URL: http://codereview.chromium.org/3197011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5322 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-23 13:58:56 +00:00
lrn@chromium.org
0210df5848 Use Copy-on-write arrays for cached regexp results.
Review URL: http://codereview.chromium.org/3158020

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5310 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-20 09:37:22 +00:00
sgjesse@chromium.org
85718e89ac Use consistent types when calling RegExpImpl::IrregexpExecOnce
Review URL: http://codereview.chromium.org/3167021

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5298 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-18 08:54:25 +00:00
vitalyr@chromium.org
3202df6c69 Copy-on-write arrays.
Object model changes
----------------------------------------
New fixed_cow_array_map is used for the elements array of a JSObject
to mark it as COW. The JSObject's map and other fields are not
affected. The JSObject's map still has the "fast elements" bit set. It
means we can do only the receiver map check in keyed loads and the
receiver and the elements map checks in keyed stores. So introducing
COW arrays doesn't hurt performance of these operations. But note that
the elements map check is necessary in all mutating operations because
the "has fast elements" bit now means "has fast elements for reading".
EnsureWritableFastElements can be used in runtime functions to perform
the necessary lazy copying.

Generated code changes
----------------------------------------
Generic keyed load is updated to only do the receiver map check (this
could have been done earlier). FastCloneShallowArrayStub now has two
modes: clone elements and use COW elements. AssertFastElements macro
is added to check the elements when necessary. The custom call IC
generators for Array.prototype.{push,pop} are updated to avoid going
to the slow case (and patching the IC) when calling the builtin should
work.

COW enablement
----------------------------------------
Currently we only put shallow and simple literal arrays in the COW
mode. This is done by the parser.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5275 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-16 16:06:46 +00:00
ricow@chromium.org
36e5743674 Put direct code pointers into JSFunction objects. This is a first step
in allowing more flexible compilation and to simplify builtins lookup. 

This changes a number of places where code objects are assigned to
SharedFunctionInfo objects to also assign this code object to the
JSFunction. In addition, the code flushing is changed slightly to
accomodate this (we need to flush the code from functions pointing to
SharedFunctionInfo objects that has already been flushed).


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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5233 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-11 08:12:53 +00:00
lrn@chromium.org
6267578925 Removed support for object literal get/set with number/string property name.
It doesn't work correctly for array indices.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5232 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-10 12:44:13 +00:00
lrn@chromium.org
53e22e386c Create a new RegExp object for every evaluation of a RegExp literal.
Changes necessary to following ES5 semantics and matching Safari - in ES3
the same RegExp object was generated by each evaluation of the RegExp literal.
Fixes bug 704.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5198 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-06 13:04:27 +00:00
sgjesse@chromium.org
88b19a9d0c Re-apply r5165 (Added support for ES5's propertyname production)
TBR=lrn@chromium.org
Review URL: http://codereview.chromium.org/3073031

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5192 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-06 08:03:44 +00:00
sgjesse@chromium.org
1844e149ab Revert r5165 (Added support for ES5's propertyname production)
This is to test in Chromium without this change.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5182 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-05 14:46:34 +00:00
lrn@chromium.org
24cf5459f5 Added support for ES5's propertyname production.
Object initialisers and dot-notation property access allows keywords in ES5.
Also allowed non-identifiers after "get" or "set" in an object initialiser.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5165 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-08-02 12:09:10 +00:00
podivilov@chromium.org
c115a39942 Add debugger protocol request for setting global flags.
Review URL: http://codereview.chromium.org/2880011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5148 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-07-28 15:50:05 +00:00
podivilov@chromium.org
52762e4c59 Breakpoint position should be inside function body.
Review URL: http://codereview.chromium.org/2883042

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5145 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-07-28 13:02:03 +00:00
lrn@chromium.org
539142a161 Fix some bugs in Function.prototype.bind implementation.
Correctly handle not passing thisArg.
Fixes to NewObjectFromBound to use correct argument count, not leak memory,
and handle constructors that throw exceptions.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5137 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-07-27 09:20:21 +00:00
peter.rybin@gmail.com
30b85b3962 Fix break position not to be outside of the script
Review URL: http://codereview.chromium.org/3017021

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5131 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-07-23 17:21:55 +00:00
ricow@chromium.org
c167942fd1 Fix presubmit errors.
Review URL: http://codereview.chromium.org/3009017

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5125 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-07-23 10:15:21 +00:00
ricow@chromium.org
e084e56129 Implement Function.prototype.bind (ES5 15.3.4.5).
Please note that we do not implement correctly the setting of caller
and arguments on the returned objects, since we already have these
properties on function objects (and they are non-configurable).

Also corrects indention in DefineOwnProperty.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5124 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-07-23 10:08:55 +00:00
kaznacheev@chromium.org
3377349a51 Support object literal map caching for literals with keys that are array indices.
The caching code used to require that all keys in the literal were symbol strings
in order to be able to cache object literal maps.

Relaxed this requirement to allow array indices as well (as in { "1": "one", two: "two" }).

Changed the way 'number_of_properties' is calculated so that redundant property slots are not
allocated for array indices. 


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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5114 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-07-22 06:28:47 +00:00
kaznacheev@chromium.org
db23321704 Create a separate class to encapsulate ScopeInfo serialization.
The static ScopeInfo members moved into this class.
The new class is named ScopeInfoObject which I am not proud of,
better ideas are very welcome.

Also got rid of the sentinels in the serialized scope info which saves 3 words per function
and is not slower.
 
Review URL: http://codereview.chromium.org/2908009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5067 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-07-14 11:18:09 +00:00
kaznacheev@chromium.org
0243bc875c Move serialized scope info from Code object to SharedFunctionInfo.
The scope info is now stored in a FixedArray referenced from SharedFunctionInfo.


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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5056 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-07-13 13:06:33 +00:00
erik.corry@gmail.com
5bc0522ad4 Second half of number alloc change accidentally omitted from
last change.
Review URL: http://codereview.chromium.org/2919001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5039 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-07-08 13:50:13 +00:00
erik.corry@gmail.com
118a421067 Simplify the transitions in the Binary Op ICs. Now a single call
to the runtime will both patch in the more specialized binary op
stub and calculate the answer.  This eliminates the need to call
both the rest of the binary op and the patching runtime call.  The
runtime routines are altered to be more agressive in returning
Smis so we don't get spurious heap numbers as inputs to binary ops
while we are patching the binary op ICs.
Review URL: http://codereview.chromium.org/2843049

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5026 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-07-06 12:56:55 +00:00
vitalyr@chromium.org
7b521af105 Fix crash: handle all flat string types in regexp replace.
Review URL: http://codereview.chromium.org/2868046

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5025 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-07-06 12:22:19 +00:00
lrn@chromium.org
90e9e99b3c RegExp replace with empty string optimization by Sandholm.
Review URL: http://codereview.chromium.org/2809048

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5021 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-07-05 12:49:00 +00:00
ager@chromium.org
06a28cbe57 Fix bug in date code (issue 736) where -0 was not mapped to 0. This caused the
runtime system to throw an exception because it expected smi arguments.


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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5013 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-07-02 20:09:33 +00:00
ricow@chromium.org
eed4ed99c8 Add ES5 Object.isExtensible and Object.preventExtensions.
Review URL: http://codereview.chromium.org/2819034

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5011 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-07-02 14:36:34 +00:00
lrn@chromium.org
0653689450 Fix Chromium issue 47824.
In rare cases a two-byte string was mistaken for an ascii-string.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4985 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-30 07:40:40 +00:00
podivilov@chromium.org
b2b140a525 Provide actual breakpoints locations in response to setBreakpoint and listBreakpoints requests.
Review URL: http://codereview.chromium.org/2799037

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4965 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-28 12:09:29 +00:00
vitalyr@chromium.org
8ab6832203 Add "has fast elements" bit to maps and use it in inlined keyed loads.
A potential issue with this change is creating lots of maps when
objects flip between fast/slow elements modes.  We could add special
transitions to avoid this.  Yet testing this on our benchmarks, gmail,
and wave seems to indicate that this is not a real problem.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4941 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-24 13:56:35 +00:00
vitalyr@chromium.org
3cafa65462 Track ascii-ness of data in externalized strings.
If a two-byte string only contains ascii characters, then we can save
memory when flattening a cons string containing it. Similarly we can
use this in Array.prototype.join implementation. To track this a new
bit is added to instance type. This bit is used as a hint in generated
code and in runtime functions.

To enable testing a new V8 extension is added controlled by
--expose-externalize-string flag.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4894 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-17 16:19:28 +00:00
podivilov@chromium.org
7808d45af5 Fix a bug when top level break points fall into the last function in script.
Review URL: http://codereview.chromium.org/2824007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4890 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-17 12:47:08 +00:00
podivilov@chromium.org
f5fdef253b Save actual break point location to script break point object.
Review URL: http://codereview.chromium.org/2864003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4879 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-16 14:50:07 +00:00
ricow@chromium.org
de512af068 Add support for elements and array indices in Object.defineProperty
(fixes bug 619).

This also fixes a bug in GetOwnProperty in runtime.cc discovered by
the new test cases. That part of the code was not testable before
since we had no way of correctly defining properties on elements.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4862 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-14 13:55:38 +00:00
sgjesse@chromium.org
e045ca6898 Better handling of stepping out of a function
With the change in r4820 all return statements are now breakable like any statement, so stepping will stop before the return statement actually returning from a function. With this change the position when breaking in the function return (after executing the return statement) will be the actual end of the function. At this point the return value is available as it saved to the stack by the debug break at return handling. Added information on the actual value returned from the function to the debugger.
Review URL: http://codereview.chromium.org/2783002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4835 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-10 09:02:16 +00:00
ager@chromium.org
723bed3105 Optimize calls to evals. Most of the time there is no reason to
perform a context lookup in the runtime system for the 'eval'
function. Instead load the 'eval' function from the global context in
generated code if it is not shadowed.

Will port to other platforms as a separate change.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4794 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-04 10:19:19 +00:00
vitalyr@chromium.org
6c74d30f83 Fix double to integer conversions in runtime string indexing.
Review URL: http://codereview.chromium.org/2577001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4791 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-03 11:31:19 +00:00
vitalyr@chromium.org
3ec0b86495 Make StringCharCodeAt runtime function do what it name implies and not
just indexed string access.

The difference is that String.prototype.charCodeAt accepts any number
as an index, whereas string[] only accepts array indices.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4790 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-03 09:32:07 +00:00
vegorov@chromium.org
fc7c5f789a Cardmarking writebarrier.
Reapply r4715 with fixes reviewed in http://codereview.chromium.org/2276002.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4743 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-05-27 12:30:45 +00:00
ricow@chromium.org
5058db86c4 Add support for getOwnPropertyDescriptor on array indices (fixes issue 599).
This fix adds support for retriving a property descriptor on elements. The
new version supports both fast and slow case elements. In the fast case
we always default configurable, writable, enumerable to true (we don't have
PropertyDetails for fast elements).

A few new tests are added to get-own-property-descriptor.js, I will
add a lot more to object-define-property when I add support for indices in
Object.defineProperty.


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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4738 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-05-27 07:43:43 +00:00
vitalyr@chromium.org
64bc39a726 Fix: make string indexing work with Infinity.
NumberToUint32 that I was trying to use maps -0 to +0 (as desired) but
also maps +/-Infinity to +0, which made +/-Infinity a valid string
index. I fixed it by introducing a new runtime function with the right
semantics.

TEST=LayoutTests/fast/js/char-at.html,mjsunit/string-charat.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4734 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-05-26 16:11:30 +00:00
vegorov@chromium.org
e268fbdaba Revert r4715.
TBR=ager@chromium.org
Review URL: http://codereview.chromium.org/2274001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4723 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-05-26 09:24:44 +00:00
vegorov@chromium.org
675e711f1c Cardmarking writebarrier.
- New сardmarking write barrier handles large objects and normal objects in a similar fashion (no more additional space for pointer tracking is required, no conditional branches in WB code).
- Changes to enable oldspaces iteration without maps decoding:
-- layout change for FixedArrays: length is stored as a smis (initial patch by
Kevin Millikin)
-- layout change for SharedFunctionInfo: integer fields are stored as smi on
arm, ia32 and rearranged on x64.
-- layout change for String: meaning of LSB bit is fliped (1 now means hash not
computed); on x64 padding is added.
-- layout of maps is _not_ changed. Map space is currently iterated in a special
way.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4715 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-05-25 13:15:16 +00:00
vegorov@chromium.org
2241d2af45 Reverting r4703.
TBR=ager@chromium.org
Review URL: http://codereview.chromium.org/2073018

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4704 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-05-21 17:37:47 +00:00
vegorov@chromium.org
8879691793 Cardmarking writebarrier.
Reapplication of r4685 (reviewed http://codereview.chromium.org/2101002) with minor modifications:

- Fix compilation problems on Win64.
- Improve heap verification pass: search for garbage pointers to new space not only in dirty regions but in all regions.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4703 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-05-21 15:52:38 +00:00