Commit Graph

24257 Commits

Author SHA1 Message Date
littledan
d20a509042 Optimize String.prototype.includes
This patch removes the MathMax call from String.prototype.includes
in order to improve performance. With some quick and dirty benchmarking,
(test case courtesy of the node folks) a sizable performance gain is visible:

d8> function testIndexOf() { var stringArray = [ 'hello', 'world', '123', 'abc' ]; return stringArray.some(function(val, idx, arr) { return val.indexOf('world') !== -1 })}
d8> function testIncludes() { var stringArray = [ 'hello', 'world', '123', 'abc' ]; return stringArray.some(function(val, idx, arr) { return val.includes('world') })}
d8> function testTime(fn) { var before = Date.now(); fn(); return Date.now() - before; }
d8> testTime(function() { for (var i = 0; i < 10000000; i++) { testIncludes() } })
2244
d8> testTime(function() { for (var i = 0; i < 10000000; i++) { testIndexOf() } })
2212

Compare that to before the test, when the performance difference was much larger:

d8> testTime(function() { for (var i = 0; i < 10000000; i++) { testIndexOf() } })
2223
d8> testTime(function() { for (var i = 0; i < 10000000; i++) { testIncludes() } })
2650

In my runs, performance of both functions drifts up and down, but running them in quick
succession back and forth shows a roughly consistent delta of about this magnitude.

String.prototype.includes is still slightly (maybe 5%) slower than String.prototype.indexOf,
but the effect is significantly reduced.

R=adamk
BUG=v8:3807
LOG=Y

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

Cr-Commit-Position: refs/heads/master@{#29665}
2015-07-15 01:01:55 +00:00
binji
3ec841f2b5 Disable d8-worker-sharedarraybuffer test (fails on TSAN)
See http://build.chromium.org/p/client.v8/builders/V8%20Linux64%20TSAN/builds/4695/steps/Check%20%28flakes%29/logs/d8-worker-sharedarray..

BUG=v8:4306
R=machenbach@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#29664}
2015-07-14 23:34:35 +00:00
binji
4073657ec8 Reland of d8 workers: make sure Shell::Quit is only called once (patchset #1 id:1 of https://codereview.chromium.org/1235083004/)
Reason for revert:
Looks like the failure is unrelated to my change (still fails after the revert). See http://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Win/builds/856/steps/webkit_unit_tests/logs/stdio

Original issue's description:
> Revert of d8 workers: make sure Shell::Quit is only called once (patchset #5 id:80001 of https://codereview.chromium.org/1230403003/)
>
> Reason for revert:
> Breaks webkit_unit_tests. See http://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Win/builds/853/steps/webkit_unit_tests/logs/stdio
>
> Original issue's description:
> > d8 workers: make sure Shell::Quit is only called once
> >
> > When running with isolates, Quit can be called simultaneously by two threads.
> > If this happens, then both threads try to clean up the Workers, which could
> > crash.
> >
> > BUG=v8:4279
> > R=jarin@chromium.org
> > R=machenbach@chromium.org
> > LOG=n
> >
> > Committed: https://crrev.com/76184292b392d107609f21662a949b58bb1e258c
> > Cr-Commit-Position: refs/heads/master@{#29654}
>
> TBR=jarin@chromium.org,machenbach@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=v8:4279
>
> Committed: https://crrev.com/6b2c6eb75678747afca59b4a78ace597e218145d
> Cr-Commit-Position: refs/heads/master@{#29656}

TBR=jarin@chromium.org,machenbach@chromium.org,adamk@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:4279

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

Cr-Commit-Position: refs/heads/master@{#29663}
2015-07-14 23:04:32 +00:00
littledan
5c036cd772 Improve error message for duplicate parameters
Duplicate parameters are banned both overall in strict mode and also
in arrow functions. Our error message for both cases blamed strict
mode, which is confusing. This patch fixes the message to point to
arrow functions as a possible source as well.

R=wingo, adamk
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#29662}
2015-07-14 21:59:03 +00:00
littledan
9d6ab46aef Improve parsing errors related to destructuring bind
For destructuring bind, the parser needs to complain about things
which are inappropriate to have on the left-hand side.

Previously, regexp literals and template literals were let through
the parser inappropriately. This patch turns those into errors.

This patch also fixes off-by-one errors in reporting the location
of this type of error for strings and numbers. Before the patch,
the error would look like:

d8> var {x: 3} = {x: 4}
(d8):1: SyntaxError: Unexpected number
var {x: 3} = {x: 4}
      ^
SyntaxError: Unexpected number

And with the patch, the error is

d8> var {x: 3} = {x: 4}
(d8):1: SyntaxError: Unexpected number
var {x: 3} = {x: 4}
        ^
SyntaxError: Unexpected number

R=rossberg

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

Cr-Commit-Position: refs/heads/master@{#29661}
2015-07-14 21:57:51 +00:00
bbudge
ed898473cf V8: Add utility functions to check SameValue and SameValueZero.
Adds SameValue and SameValueZero functions for float and double.
These will be used for HeapNumber and SIMD values.

LOG=N
BUG=v8:4124

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

Cr-Commit-Position: refs/heads/master@{#29660}
2015-07-14 21:36:01 +00:00
mbrandy
7b1d583d9d PPC: Limit unbound label tracking to branch references.
Labels which are not associated with branches (e.g. labels which
record the location of the embedded constant pool or jump tables)
should not be tracked for the purpose of trampoline generation.

This also improves management of the high water mark in the buffer
which triggers trampoline generation such that it is reset whenever
the number of tracked branches drops to zero.

These changes should help minimize unnecessary trampoline and
(subsequent) slow branch generation.

R=dstence@us.ibm.com, michael_dawson@ca.ibm.com
BUG=

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

Cr-Commit-Position: refs/heads/master@{#29659}
2015-07-14 20:12:03 +00:00
binji
5a9722b2ab d8 workers: Fix transferring SharedArrayBuffer to multiple Workers. (try 2)
Note: the previous try was reverted for occasional flaky tests. This continued
after the revert, and should be fixed by
https://codereview.chromium.org/1226143003.

Previously, the serialization code would call Externalize for every transferred
ArrayBuffer or SharedArrayBuffer, but that function can only be called once. If
the buffer is already externalized, we should call GetContents instead.

Also fix use-after-free bug when transferring ArrayBuffers. The transferred
ArrayBuffer must be internalized in the new isolate, or be managed by the
Shell. The current code gives it to the isolate externalized and frees it
immediately afterward when the SerializationData object is destroyed.

BUG=chromium:497295
R=jarin@chromium.org
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#29658}
2015-07-14 19:56:54 +00:00
adamk
8735d38ed6 Unship spread calls and spread arrays
Return both --harmony-spreadcalls and --harmony-spread-arrays
to staging, in preparation for disabling those features on
the M45 branch.

There are no known bugs in spread calls, but without rest and spread
arrays it seems appropriate to leave all of them out rather than
only supporting a singular use of the '...' operator.

BUG=v8:4298
LOG=y

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

Cr-Commit-Position: refs/heads/master@{#29657}
2015-07-14 18:40:31 +00:00
binji
6b2c6eb756 Revert of d8 workers: make sure Shell::Quit is only called once (patchset #5 id:80001 of https://codereview.chromium.org/1230403003/)
Reason for revert:
Breaks webkit_unit_tests. See http://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Win/builds/853/steps/webkit_unit_tests/logs/stdio

Original issue's description:
> d8 workers: make sure Shell::Quit is only called once
>
> When running with isolates, Quit can be called simultaneously by two threads.
> If this happens, then both threads try to clean up the Workers, which could
> crash.
>
> BUG=v8:4279
> R=jarin@chromium.org
> R=machenbach@chromium.org
> LOG=n
>
> Committed: https://crrev.com/76184292b392d107609f21662a949b58bb1e258c
> Cr-Commit-Position: refs/heads/master@{#29654}

TBR=jarin@chromium.org,machenbach@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:4279

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

Cr-Commit-Position: refs/heads/master@{#29656}
2015-07-14 18:14:01 +00:00
verwaest
69e4dc3707 Allow setting accessor infos over read-only but configurable properties.
BUG=

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

Cr-Commit-Position: refs/heads/master@{#29655}
2015-07-14 17:43:15 +00:00
binji
76184292b3 d8 workers: make sure Shell::Quit is only called once
When running with isolates, Quit can be called simultaneously by two threads.
If this happens, then both threads try to clean up the Workers, which could
crash.

BUG=v8:4279
R=jarin@chromium.org
R=machenbach@chromium.org
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#29654}
2015-07-14 17:42:17 +00:00
binji
a55fcc93ae Don't use length property when bounds checking atomics functions
The length property can be monkey-patched, so use the native function instead.

R=jarin@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#29653}
2015-07-14 16:17:21 +00:00
balazs.kilvady
30b39f25fc Add -Wshorten-64-to-32 flag to mac builds.
BUG=

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

Cr-Commit-Position: refs/heads/master@{#29652}
2015-07-14 16:05:29 +00:00
ishell
bf61b05b3e Follow-up for "Enable loads and stores to global vars through property cell shortcuts installed into parent script context."
Review URL: https://codereview.chromium.org/1236523004

Cr-Commit-Position: refs/heads/master@{#29651}
2015-07-14 15:13:56 +00:00
verwaest
5a52b9fe9f Remove duplicate flattening. Defining accessors doesn't call out, so don't assert that the context doesn't change.
BUG=v8:4137
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#29650}
2015-07-14 14:57:39 +00:00
verwaest
103675d68b Replace Set*Callback with TransitionToAccessorPair
BUG=v8:4137
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#29649}
2015-07-14 11:58:49 +00:00
verwaest
5f24690384 Properly handle missing from normalized stores with keys convertible to array indices
BUG=chromium:509961
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#29648}
2015-07-14 11:44:56 +00:00
mstarzinger
9cf1c58145 [turbofan] Build graphs for super constructor calls.
This adapts JSCallConstruct nodes to represent both, ordinary 'new'
constructor calls as well as 'super' constructor calls. Note that we
still bailout for super calls for now.

R=bmeurer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#29647}
2015-07-14 11:40:31 +00:00
conradw
f996793ec0 [strong] class objects created in strong mode have their prototype frozen
BUG=v8:3956
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#29646}
2015-07-14 11:31:47 +00:00
verwaest
170896e6bf Use the LookupIterator to transition to elements accessors
BUG=v8:4137
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#29645}
2015-07-14 10:53:23 +00:00
chunyang.dai
f3b843bb98 X87: Fix keyed element access wrt string wrappers
port 01f40e6ad6 (r29618).

original commit message:

BUG=

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

Cr-Commit-Position: refs/heads/master@{#29644}
2015-07-14 10:13:10 +00:00
chunyang.dai
4fc51603b7 X87: Cleanup Generate_JSConstructStubHelper a bit.
port 6ddcd32786 (r29617)

original commit message:

  Cleanup Generate_JSConstructStubHelper a bit.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#29643}
2015-07-14 10:11:06 +00:00
chunyang.dai
0b6af2c415 X87: Debugger: record reloc info for debug break slot immediate before the slot.
port 0a19e44925 (r29568)

original commit message:

    If we do it too early, we might get a constant pool between the reloc info
    and the actual slot.

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

Cr-Commit-Position: refs/heads/master@{#29642}
2015-07-14 09:59:26 +00:00
chunyang.dai
5c95669436 X87: [turbofan] Add an InterpreterDispatch linkage type.
port a0129a25ba (r29591).

original commit message:

BUG=

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

Cr-Commit-Position: refs/heads/master@{#29641}
2015-07-14 09:58:12 +00:00
verwaest
0cfb44e27d Remove map-copying for global objects. This was an old (broken) requirement that has been fixed for a while.
BUG=

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

Cr-Commit-Position: refs/heads/master@{#29640}
2015-07-14 09:54:59 +00:00
verwaest
b204a91033 Remove temporary hack re deleting hidden properties
BUG=

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

Cr-Commit-Position: refs/heads/master@{#29639}
2015-07-14 09:22:16 +00:00
yangguo
541aa57718 Fix test case for crbug/507070.
--debug-code causes full-codegen on arm64 to emit different number
of calls, which confuses the debugger when on-stack replacing code
with recompiled debug version on-stack.

BUG=chromium:507070
TBR=mstarzinger@chromium.org
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#29638}
2015-07-14 08:50:18 +00:00
machenbach
33593da46c [Sheriff] Fix gn build.
TBR=jochen@chromium.org, rmcilroy@chromium.org, hablich@chromium.org
NOTRY=true

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

Cr-Commit-Position: refs/heads/master@{#29637}
2015-07-14 08:40:01 +00:00
yangguo
dec11f5ee0 Debugger: make debug code on-stack replacement more robust.
The new implemtation counts the number of calls (or continuations)
before the PC to find the corresponding PC in the new code.

R=mstarzinger@chromium.org
BUG=chromium:507070
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#29636}
2015-07-14 06:38:53 +00:00
bmeurer
86006492a7 [turbofan] Don't use uniform initialization in AccessBuilder.
BUG=v8:4295
LOG=n
TBR=jochen@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#29635}
2015-07-14 03:37:16 +00:00
paul.lind
5ce700be8a Fix big-endian after '[osr] Increase Code::profiler_ticks to 28 bits.'
Several users of kKindSpecificFlags1Offset (aliased as kFullCodeFlags) were
reading/writing bytes -- not endian agnostic.

TEST=mjsunit/debug-setexceptionbreak, mjsunit/debug-mirror-cache, mjsunit/regress/regress-94873, others...
BUG=

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

Cr-Commit-Position: refs/heads/master@{#29634}
2015-07-14 03:34:43 +00:00
ulan
47bcd1a139 [turbofan] Fix undefined behavior in InstructionSequence::GetInstructionBlock.
Some implementations of std::lower_bound require weak-strict ordering.

The comparison operator must be assymetric, which doesn't hold for less_equals.

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

Cr-Commit-Position: refs/heads/master@{#29633}
2015-07-14 03:33:25 +00:00
paul.lind
5bc5ba1e16 [turbofan] Fix a -Wsign-compare error under GCC 4.9.2.
Review URL: https://codereview.chromium.org/1230063011

Cr-Commit-Position: refs/heads/master@{#29632}
2015-07-14 03:30:17 +00:00
chunyang.dai
f9d435d241 X87: Remove separate construct stub for new.target users.
port e50c861b09 (r29562)

original commit message:

BUG=

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

Cr-Commit-Position: refs/heads/master@{#29631}
2015-07-14 02:45:44 +00:00
chunyang.dai
a5458c9221 X87: Debugger: use debug break slot to break on call.
port 8965b683ce (r29561)

original commit message:

    Break point at calls are currently set via IC. To change this, we
    need to set debug break slots instead. We also need to distinguish
    those debug break slots as calls to support step-in.

    To implement this, we add a data field to debug break reloc info to
    indicate non-call debug breaks or in case of call debug breaks, the
    number of arguments. We can later use this to find the callee on the
    evaluation stack in Debug::PrepareStep.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#29630}
2015-07-14 02:34:46 +00:00
chunyang.dai
a02e644c50 X87: [turbofan] Add TruncationMode for TruncateFloat64ToInt32.
port 4b38c15817 (r29527).

original commit message:

    We actually need round to zero truncation to implement the counterpart
    of LDoubleToI in TurboFan, which tries to convert a double to an integer
    as required for keyed load/store optimizations.

    Drive-by-cleanup: Reduce some code duplication in the InstructionSelector
    implementations.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#29629}
2015-07-14 02:29:57 +00:00
chunyang.dai
1b20d50594 X87: Reland: Add unoptimized/optimized variants of MathFloor TF code stub
port 737b8573f8 (r29539)

original commit message:

    - Add a TurboFanIC class, derived from TurboFanCodeStub, that
      automatically distinguishes between versions of the IC called from
      optimized and unoptimized code.
    - Add appropriate InterfaceDescriptors for both the versions of the
      stub called from unoptimized and optimized code
    - Change the MathFloor TF stub generator to output either the
      for-optimized or for-unoptimized version based on the minor_key
      parameter.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#29628}
2015-07-14 02:28:47 +00:00
mbrandy
0f935161f5 PPC: protect against malformed branch and memory access instructions.
R=dstence@us.ibm.com, michael_dawson@ca.ibm.com

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

Cr-Commit-Position: refs/heads/master@{#29627}
2015-07-13 21:58:29 +00:00
binji
7036a0b1b8 d8: Fix some TSAN bugs
* Fix embarrassing bug in DeserializeValue, using a static buffer in
multithreaded code.
* Fix thread leak when Worker.terminate() is not called.

R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#29626}
2015-07-13 21:05:08 +00:00
binji
7f34af65aa In Atomics API, convert operands to numbers before calling runtime.
R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#29625}
2015-07-13 20:36:37 +00:00
balazs.kilvady
24bddcd367 MIPS64: Fix 'Fix keyed element access wrt string wrappers'.
Port 01f40e6ad6

BUG=v8:4296
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#29624}
2015-07-13 19:42:25 +00:00
mbrandy
25510907c3 PPC: Cleanup Generate_JSConstructStubHelper a bit.
Port 6ddcd32786

R=mstarzinger@chromium.org, dstence@us.ibm.com, michael_dawson@ca.ibm.com
BUG=

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

Cr-Commit-Position: refs/heads/master@{#29623}
2015-07-13 18:54:32 +00:00
mbrandy
2606538e56 PPC: Fix keyed element access wrt string wrappers
Port 01f40e6ad6

R=verwaest@chromium.org, dstence@us.ibm.com, michael_dawson@ca.ibm.com
BUG=

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

Cr-Commit-Position: refs/heads/master@{#29622}
2015-07-13 18:51:21 +00:00
balazs.kilvady
48995988a9 MIPS64: Fix BlockTrampolinePoolFor() to emit trampoline before blocking, if needed.
Port f0d1106a3f

Fixes possible failure in AssembleArchTableSwitch().

BUG=v8:4294
LOG=y

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

Cr-Commit-Position: refs/heads/master@{#29621}
2015-07-13 18:26:33 +00:00
mbrandy
5783dc71af PPC: [turbofan] Add an InterpreterDispatch linkage type.
Port a0129a25ba

R=rmcilroy@chromium.org, dstence@us.ibm.com, michael_dawson@ca.ibm.com
BUG=

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

Cr-Commit-Position: refs/heads/master@{#29620}
2015-07-13 17:21:46 +00:00
mbrandy
b33d6c0d46 PPC: This CL also adds hydrogen stubs for global loads and global stores, full-codegen and TurboFan now uses this machinery.
Fix f87286e2db

R=ishell@chromium.org, dstence@us.ibm.com, michael_dawson@ca.ibm.com

Original commit message:
    Loads and stores to global vars are now made via property cell shortcuts installed into parent script context.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#29619}
2015-07-13 17:16:16 +00:00
verwaest
01f40e6ad6 Fix keyed element access wrt string wrappers
BUG=v8:4296
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#29618}
2015-07-13 15:39:07 +00:00
mstarzinger
6ddcd32786 Cleanup Generate_JSConstructStubHelper a bit.
R=bmeurer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#29617}
2015-07-13 15:13:11 +00:00
yurys
e5a77abcf8 Add convenience method for converting v8::PersistentBase to v8::Local
The CL addes convenienve method that allows to write code like the following
v8::Local<v8::Object> local = v8::Local<v8::Object>::New(global, isolate);
in a more readable way:
v8::Local<v8::Object> local = global.Get(isolate);

There is already v8::Eternal::Get that does similar thing.

BUG=None
LOG=Y

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

Cr-Commit-Position: refs/heads/master@{#29616}
2015-07-13 15:02:29 +00:00