Commit Graph

51 Commits

Author SHA1 Message Date
mstarzinger@chromium.org
6a260c3363 Move global code for builtins into setup functions.
R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/14125004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14228 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-04-11 12:15:25 +00:00
yangguo@chromium.org
215ba8cfc9 Combine %_SubString and %_StringCharAt.
R=ulan@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/12217071

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13700 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-02-20 14:29:40 +00:00
yangguo@chromium.org
01f4cb0951 Introduce InternalPackedArray.
R=jkummerow@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/12255049

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13678 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-02-15 15:20:05 +00:00
yangguo@chromium.org
6c92aba643 Fix spec violations related to regexp.lastIndex
BUG=v8:2437, v8:2438

Review URL: https://chromiumcodereview.appspot.com/11451005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13143 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-12-05 12:32:25 +00:00
erik.corry@gmail.com
a36695e853 Microoptimization to regexps.
Review URL: https://chromiumcodereview.appspot.com/10917260

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12511 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-09-14 12:01:12 +00:00
svenpanne@chromium.org
0fa7de11b5 Enable map transitions for accessor properties.
To avoid a performance regression for context creation with snapshots, we avoid
creating a useless long map chain for regular expressions, keeping the snapshot
size almost the same as before.

Review URL: https://chromiumcodereview.appspot.com/10440045

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11664 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-05-25 12:32:02 +00:00
mstarzinger@chromium.org
7e613579be Fix RegExp.prototype.toString for incompatible receivers.
BUG=v8:1981
TEST=mjsunit/regexp

Review URL: https://chromiumcodereview.appspot.com/10426005
Patch from Ioseb Dzmanashvili <ioseb.dzmanashvili@gmail.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11637 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-05-23 20:48:08 +00:00
mstarzinger@chromium.org
e3be59512a Fix source property of empty RegExp objects.
R=rossberg@chromium.org
BUG=v8:1982
TEST=test262/15.10.4.1-5

Review URL: https://chromiumcodereview.appspot.com/10134010

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11416 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-04-23 13:59:43 +00:00
erik.corry@gmail.com
b32ff09a49 Regexp.rightContext was still not quite right. Fixed and
added more tests.
Review URL: https://chromiumcodereview.appspot.com/10008104

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11312 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-04-13 11:03:22 +00:00
erikcorry
32f16418ea Regexp: Fix rightContext in the lastMatchInfoOverride
case.
Review URL: http://codereview.chromium.org/10068010

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11285 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-04-12 12:13:18 +00:00
yangguo@chromium.org
184b7a8915 Experimental profiler: split RegExp.test() for better optimization.
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/9701064

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11065 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-03-15 17:21:42 +00:00
svenpanne@chromium.org
1729e3c0dd Make the runtime entry for setting/changing accessors "atomic".
Previously, there were 1 or 2 calls to the runtime when accessors were changed
or set. This doesn't really work well with property attributes, leading to some
hacks and complicates things even further when trying to share maps in presence
of accessors. Therefore, the runtime entry now takes the full triple (getter,
setter, attributes), where the getter and/or the setter can be null in case they
shouldn't be changed.

For now, we do basically the same on the native side as we did before on the
JavaScript side, but this will change in future CLs, the current CL is already
large enough.

Note that object literals with a getter and a setter for the same property still
do 2 calls, but this is a little bit more tricky to fix and will be handled in a
separate CL.

Review URL: https://chromiumcodereview.appspot.com/9616016

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10956 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-03-07 13:24:44 +00:00
svenpanne@chromium.org
76a201df2f Removed Runtime_DefineAccessor.
Runtime_DefineOrRedfineAccessorProperty basically does the same, so we have 1
code path less to worry about.

Review URL: https://chromiumcodereview.appspot.com/9424033

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10779 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-02-21 12:47:27 +00:00
rossberg@chromium.org
1336b913d0 Make built-ins strict mode conforming, and support a --use-strict flag.
* Turned all uses of 'const' into 'var'.
* Turned all uses of local 'function' into 'var'.
* Added a couple of missing toplevel 'var' declarations.

One consequence is that the properties on the builtin object  are no longer
non-writable, and I had to adapt one test. Is that a problem?

Unfortunately, we cannot actually switch the library scripts to strict mode
by default, because that makes observable things like poisoned .caller properties
for library functions.

Also removed dead flag code in Compiler::Compile.

R=yangguo@chromium.org
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/9415010

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10758 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-02-20 13:48:24 +00:00
erik.corry@gmail.com
70da367f6b More spelling changes.
Review URL: http://codereview.chromium.org/9231009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10407 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-01-16 12:38:59 +00:00
lrn@chromium.org
c7fccff9af Clean up JavaScript files to better follow coding standard.
Multiline conditionals must use braces.
Semicolons are not optional.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10074 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-11-28 12:11:00 +00:00
lrn@chromium.org
a9edfefa58 Remove special-casing of calls to RegExp test and exec methods with no argument.
Matches new JSC behavior. Fix issue 75740.

BUG=75740
TEST=mjsunit/regexp-static

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9804 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-10-26 12:51:07 +00:00
lrn@chromium.org
b9d39c48b8 Make the RegExp.prototype object be a RegExp object.
BUG=v8:1217
TEST=mjsunit/regress/regress-1217

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9419 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-26 08:42:01 +00:00
yangguo@chromium.org
7ab81a14fa Reverting r9399.
Review URL: http://codereview.chromium.org/7989007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9401 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-22 15:55:44 +00:00
yangguo@chromium.org
dfeaa56b9a Fix debug builds broken by r9399.
Review URL: http://codereview.chromium.org/7996002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9400 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-22 15:39:22 +00:00
yangguo@chromium.org
0c6863a1ef Set RegExp's prototype to RegExp as specified by ES5.
BUG=v8:1217
TEST=regress-1217.js

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9399 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-22 15:11:12 +00:00
lrn@chromium.org
ffffa716c5 Lock the prototype of internal classes.
Prototypes and their properties and methods are locked down to prevent fiddling with their operation, even if the build-in object leaks.

Made some built-in functions only work during bootstrapping.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9122 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-09-05 07:30:35 +00:00
lrn@chromium.org
d8a123169b Make regexp flag parsing stricter.
BUG=v8:1628
TEST=mjsunit/regress/regress-219

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8973 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-08-19 11:02:41 +00:00
ricow@chromium.org
0f682143d9 Introduce code flushing of RegExp code.
Due to issues relating mostly to chrome extensions we have lately been
running into OOMs that are caused by our executable space running
out. This change introduces flushing of code from regexps if we have
not used the code for 5 mark sweeps.

The approach is different from the normal function code flusing. Here
we make a copy of the code inside the data array, and exchange the
original code with a smi determined by the sweep_generation (a new
heap variable increased everytime we do mark sweep/compact). If we
encounter a smi in EnsureCompiled we simply reinstate the code
object. If, in the marking phase of mark sweep, we find a regexp that
already have a smi in the code field, and this is more than 5
generations old we flush the code from the saved index.
Review URL: http://codereview.chromium.org/7282026

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8532 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-07-05 06:19:53 +00:00
lrn@chromium.org
4707d7ac08 Stop using plain Arrays internally in built-in functions.
In built-in code we use arrays for internal computations.
This makes it possible to affect the built-in code by putting getters
or setters on the Array prototype chain.
This adds a new internal Array constructor that creates Arrays with
a very simplistic prototype chain that doesn't include any publicly
visible objects. These Arrays shoudl ofcourse never leak outside the
builtins, since that would expose the prototype object.
The prototype object contains only the array functions that we use:
push, pop and join (and not even a toString, so it doesn't stringify
well).

Also change uses of .call to %_CallFunction.

BUG=1206

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7040 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-03 11:49:03 +00:00
ager@chromium.org
f8b74a1541 Avoid using Function.prototype.call in a number of places in our
builtins files. We should always use %_CallFunction for a couple of
reasons: it cannot be overwritten and it does not wrap basic types in
wrapper objects.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6524 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-28 10:33:10 +00:00
sandholm@chromium.org
578e70a552 Improve regexp split, replace and test.
Review URL: http://codereview.chromium.org/5959002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6065 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-17 11:57:10 +00:00
sandholm@chromium.org
425a221b02 Optimizing BuildResultFromMatchInfo, StringReplace and StringSplit.
Review URL: http://codereview.chromium.org/5708006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5982 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-13 12:19:10 +00:00
sandholm@chromium.org
c8932d030b Special case global and non-global code paths in regexp.test.
Review URL: http://codereview.chromium.org/4517003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5810 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-11-11 08:47:30 +00:00
sandholm@chromium.org
97cb006188 Minor regexp test cleanup.
Review URL: http://codereview.chromium.org/4371002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5759 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-11-03 10:30:15 +00:00
lrn@chromium.org
e1458503d1 Remove regexp caching.
Review URL: http://codereview.chromium.org/4308001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5755 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-11-02 13:37:59 +00:00
ricow@chromium.org
01d7470b9b Remove trailing spaces from js files.
This is a cosmetic change only.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5630 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-10-15 13:03:59 +00:00
lrn@chromium.org
d5ac565882 Restructure RegExp exec cache code.
Review URL: http://codereview.chromium.org/3778004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5622 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-10-14 12:54:00 +00:00
lrn@chromium.org
6c0cde67bc Fix bug in cache handling of lastIndex on global regexps.
Review URL: http://codereview.chromium.org/3745005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5615 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-10-14 08:51:20 +00:00
lrn@chromium.org
0dece535d9 RegExp: Fix caching to correctly set lastIndex.
BUG: 52801

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5504 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-09-22 11:22:57 +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
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
lrn@chromium.org
ade53c4282 X64: Make the ToBoolean inline code do even less if the value is known to be a smi.
Review URL: http://codereview.chromium.org/2834028

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4978 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-29 14:15:34 +00:00
lrn@chromium.org
991af26519 Less intrusive patch for regexp bug.
Review URL: http://codereview.chromium.org/2843024

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4947 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-25 07:51:46 +00:00
lrn@chromium.org
7b46a1f49d Fix bug in regexp exec with global regexps.
Review URL: http://codereview.chromium.org/2826020

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4945 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-25 07:00:29 +00:00
sandholm@chromium.org
c9b1bf7eaa Fix issue in previous test optimization
Review URL: http://codereview.chromium.org/2653002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4801 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-04 13:43:41 +00:00
sandholm@chromium.org
6e7d663eed Simplify criteria for doing an optimized test call
Review URL: http://codereview.chromium.org/2662002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4800 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-04 13:37:28 +00:00
sandholm@chromium.org
52f52ae99f Simplify regexp test call when the regexp starts and ends with '.*'.
Review URL: http://codereview.chromium.org/2645002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4799 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-06-04 11:58:40 +00:00
lrn@chromium.org
0adfe842a5 Fix incorrect handling of global RegExp properties for nested replace-regexp-with-function.
Review URL: http://codereview.chromium.org/1695002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4455 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-04-21 08:33:04 +00:00
lrn@chromium.org
285d5bc48a Native construction of RegExp result objects, with in-object index and input.
Avoid cloning using CloneRegExpResult for results that are just arrays.
Made a more direct path for string.match with string argument.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4395 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-04-13 09:31:03 +00:00
sandholm@chromium.org
67116752d9 Adding Lasse's improvement to r4364
http://codereview.chromium.org/1556019
http://code.google.com/p/v8/source/detail?r=4364

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4373 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-04-09 09:21:46 +00:00
sandholm@chromium.org
c9b3e45cca Adding boolean saveAnswer property of RegExpCache to avoid unnecessary cloning of the regexp answer object/array.
Review URL: http://codereview.chromium.org/1556019

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4364 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-04-08 14:42:27 +00:00
kmillikin@chromium.org
1cf0439ca7 Remove trailing regexp from .js files.
Removed trailing whitespace using regexp replace.  No other changes.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4314 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-30 07:15:23 +00:00
lrn@chromium.org
845fd15dd6 Pre-create properties on JSRegExp objects
Initialize properties in single runtime call.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4298 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-26 14:19:47 +00:00
lrn@chromium.org
498b074bd0 Run string replace regexp with function in C++ code loop.
Reuses the result array to save on allocation.
Matches Safari's behavior.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4269 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-03-25 12:57:58 +00:00