Commit Graph

575 Commits

Author SHA1 Message Date
gsathya
ec61e6b434 [promises] Remove one runtime call to create_resolving_functions
- Creates a new promise-utils.{h, cc} which refactors out the
logic to create resolving functions. This is shared between the
runtime functions and builtins.

- Changes PromiseResolveThenableJobInfo to store the context
since we no longer create the resolving functions in JS.

- Changes EnqueuPromiseResolveThenableJob to take in the promise and
  not the callbacks.

BUG=v8:5343

Review-Url: https://codereview.chromium.org/2487053002
Cr-Commit-Position: refs/heads/master@{#40941}
2016-11-11 20:59:46 +00:00
gsathya
cb6c8e48cc [promises] Move CreateResolvingFunctions to c++
- A new runtime function (%create_resolving_functions) is installed to
  call the CreateResolvingFunctions builtin from JS.

- Three new builtins are created - resolve and reject functions and a
  third function that creates a new JSFunctions from these
  resolve/reject builtins.

- The promise reject function is installed on the context temporarily
  as internal_promise_reject. This should go away once we remove
  PromiseSet.

BUG=v8:5343

Review-Url: https://codereview.chromium.org/2459283004
Cr-Commit-Position: refs/heads/master@{#40903}
2016-11-10 16:05:08 +00:00
gsathya
f80f450993 [promises] Move PromiseReject to c++
This patch refactors most of FulfillPromise runtime call out to a separate
function so that we can to it from PromiseReject runtime call.

This patch adds a PromiseStatus enum.

BUG=v8:5343

Review-Url: https://codereview.chromium.org/2451163003
Cr-Commit-Position: refs/heads/master@{#40615}
2016-10-27 11:51:49 +00:00
gsathya
a7a350012c [promises] remove kPending check in RejectPromise
RejectPromise is always called on a pending promise making this a redundant check.

BUG=v8:5343

Review-Url: https://codereview.chromium.org/2446113007
Cr-Commit-Position: refs/heads/master@{#40591}
2016-10-26 13:00:52 +00:00
gsathya
87ec1673e4 [promises] Remove FulfillPromise
This patch replaces it with calls to the runtime function and PromiseSet.

This allows us to move PromiseReject to C++ without regressions.

BUG=v8:5343

Review-Url: https://codereview.chromium.org/2451133002
Cr-Commit-Position: refs/heads/master@{#40589}
2016-10-26 12:45:53 +00:00
gsathya
d7a8caa92a [promises] move most of FulfillPromise to c++
This causes a 3.1% regression because we unconditionally call out to a
runtime function.

This patch refactors out most of EnqueuePromiseReactionJob
runtime function into a separate function.

BUG=v8:5343

Review-Url: https://codereview.chromium.org/2449053003
Cr-Commit-Position: refs/heads/master@{#40570}
2016-10-25 16:13:04 +00:00
gsathya
c6722aeae1 [promises] remove PromiseEnqueue
Removes PromiseEnqueue and moves debugging code to a separate
function which gets called when the debugger is active.

BUG=v8:5343

Review-Url: https://codereview.chromium.org/2450763002
Cr-Commit-Position: refs/heads/master@{#40562}
2016-10-25 12:33:13 +00:00
gsathya
d390e11e02 [promises] remove if kPending check
FulfillPromise is always called when a promise is in a pending state
which makes this check redundant.

Review-Url: https://codereview.chromium.org/2442373002
Cr-Commit-Position: refs/heads/master@{#40556}
2016-10-25 11:06:08 +00:00
jgruber
77ddcfb3e0 [regexp] Remove unused code
This CL removes code that is now unused since the port of regexp.js has been
completed. Removed functions / classes are:

* regexp.js (GetSubstitution moved to string.js)
* RegExpConstructResult stub
* RegExpFlags intrinsic
* RegExpSource intrinsic
* RegExpInitializeAndCompile runtime function

BUG=v8:5339

Review-Url: https://codereview.chromium.org/2448463002
Cr-Commit-Position: refs/heads/master@{#40547}
2016-10-25 07:19:13 +00:00
gsathya
cade0f4ba5 [promises] move PromiseResolveThenableJob debugging code to runtime function
Moving the rest of the debugging code is blocked on making IsPromise inlinable.

BUG=v8:5343

Review-Url: https://chromiumcodereview.appspot.com/2431793003
Cr-Commit-Position: refs/heads/master@{#40440}
2016-10-19 14:15:28 +00:00
gsathya
0d8b253c34 Move PromiseNextMicrotaskID to cpp
BUG=v8:5343

Review-Url: https://codereview.chromium.org/2425553003
Cr-Commit-Position: refs/heads/master@{#40405}
2016-10-18 15:41:46 +00:00
bmeurer
1b4e0fcaea [builtins] Migrate Number.parseInt to TurboFan builtin.
R=epertoso@chromium.org
BUG=v8:5049

Review-Url: https://codereview.chromium.org/2424403002
Cr-Commit-Position: refs/heads/master@{#40399}
2016-10-18 12:45:01 +00:00
caitp
86d0dd362f [builtins] implement Array.prototype[@@iterator] in TFJ builtins
Implements the variations of CreateArrayIterator() in TFJ builtins
(ArrayPrototypeValues, ArrayPrototypeEntries and ArrayPrototypeKeys), and
provides two new Object types with numerous maps which identify certain
behaviours, which will be useful for inlining.

Removes src/js/array-iterator.js entirely

Also adds support for printing Symbol literals inserted by the Parser during
desugaring when FLAG_print_builtin_ast is set to true.

BUG=v8:5388
R=bmeurer@chromium.org, cbruni@chromium.org
TBR=ulan@chromium.org

Review-Url: https://codereview.chromium.org/2405253006
Cr-Commit-Position: refs/heads/master@{#40373}
2016-10-18 02:43:14 +00:00
gsathya
18a116c7bd [promises] Move async debug event creation to c++
BUG=v8:5343

Review-Url: https://codereview.chromium.org/2415023002
Cr-Commit-Position: refs/heads/master@{#40369}
2016-10-17 15:38:16 +00:00
gsathya
b122da39d0 [async await] Fix debug async task event
If the catch prediction machinery in the middle of some async op, we
shouldn't send invalid events to the debugger.

Instead of sending events with an undefined id, we don't send them at
all.

Review-Url: https://codereview.chromium.org/2417093003
Cr-Commit-Position: refs/heads/master@{#40327}
2016-10-14 21:16:58 +00:00
yangguo
92efd8f112 Clean up builtins export whitelist.
R=bmeurer@chromium.org

Review-Url: https://codereview.chromium.org/2410303009
Cr-Commit-Position: refs/heads/master@{#40311}
2016-10-14 11:52:03 +00:00
jgruber
f60a7c4f61 [regexp] Turn last match info into a simple FixedArray
Now that all accesses to the last match info are in C++ and TF code, we can
finally turn the last match info into a FixedArray. Similar to the ArrayList,
it uses its first field to store its length and grows dynamically in amortized
O(1) time.

Unlike previously, this means that the last match info pointer stored on the
context can actually change (in case the FixedArray needs to grow).

BUG=v8:5339

Review-Url: https://codereview.chromium.org/2415103002
Cr-Commit-Position: refs/heads/master@{#40308}
2016-10-14 11:47:09 +00:00
bmeurer
71cb88281c [builtins] Also port the Object.prototype.__proto__ accessors to C++.
These accessors also always call into C++ anyways, so there's no point
in having the JavaScript wrappers.

R=yangguo@chromium.org
BUG=v8:5049, chromium:655963

Committed: https://crrev.com/ede69cfabd790fe9f171b5d1f426ea0fc55e3c98
Review-Url: https://codereview.chromium.org/2417183002
Cr-Original-Commit-Position: refs/heads/master@{#40298}
Cr-Commit-Position: refs/heads/master@{#40306}
2016-10-14 11:25:02 +00:00
machenbach
0b74984156 Revert of [builtins] Also port the Object.prototype.__proto__ accessors to C++. (patchset #1 id:1 of https://codereview.chromium.org/2417183002/ )
Reason for revert:
[Sheriff] Speculative revert for webkit tests:
https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Linux%2064/builds/10656

Was broken before, but this one test failure started with this CL:
inspector/console/console-dir.htm

All other errors stopped after another revert.

See also:
https://github.com/v8/v8/wiki/Blink-layout-tests

Original issue's description:
> [builtins] Also port the Object.prototype.__proto__ accessors to C++.
>
> These accessors also always call into C++ anyways, so there's no point
> in having the JavaScript wrappers.
>
> R=yangguo@chromium.org
> BUG=v8:5049
>
> Committed: https://crrev.com/ede69cfabd790fe9f171b5d1f426ea0fc55e3c98
> Cr-Commit-Position: refs/heads/master@{#40298}

TBR=yangguo@chromium.org,bmeurer@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:5049

Review-Url: https://codereview.chromium.org/2415173003
Cr-Commit-Position: refs/heads/master@{#40303}
2016-10-14 09:50:51 +00:00
bmeurer
ede69cfabd [builtins] Also port the Object.prototype.__proto__ accessors to C++.
These accessors also always call into C++ anyways, so there's no point
in having the JavaScript wrappers.

R=yangguo@chromium.org
BUG=v8:5049

Review-Url: https://codereview.chromium.org/2417183002
Cr-Commit-Position: refs/heads/master@{#40298}
2016-10-14 08:36:52 +00:00
bmeurer
4a88d8fb1d [builtins] Migrate Object.setPrototypeOf to C++.
This calls into C++ anyways, so no need to add the JavaScript wrapper
around it.

R=yangguo@chromium.org
BUG=v8:5049

Review-Url: https://codereview.chromium.org/2421803002
Cr-Commit-Position: refs/heads/master@{#40293}
2016-10-14 08:10:18 +00:00
jgruber
a10b4712c6 [regexp] Port remaining JS functions in regexp.js
This ports RegExpInitialize, IsRegExp, InternalMatch and InternalReplace to C++
/ TurboFan. InternalMatch is in TurboFan because it calls RegExpExecStub and
needs to construct a RegExpResult (which are, respectively, a PlatformStub and
a CodeStubAssembler function).

Except for LastMatchInfo (and GetSubstitution, which could be moved to string.js
anytime), regexp.js is now completely empty.

BUG=v8:5339

Review-Url: https://codereview.chromium.org/2409513003
Cr-Commit-Position: refs/heads/master@{#40277}
2016-10-13 15:03:22 +00:00
jgruber
33a4faa47d [regexp] Port RegExp.prototype[@@replace]
This moves the implementation of @@replace from regexp.js to builtins-regexp.cc
(the TurboFan fast path) and runtime-regexp.cc (slow path). The fast path
handles all cases in which the regexp itself is an unmodified JSRegExp
instance, the given 'replace' argument is not callable and does not contain any
'$' characters (i.e. we are doing a string replacement).

BUG=v8:5339

Review-Url: https://codereview.chromium.org/2398423002
Cr-Commit-Position: refs/heads/master@{#40253}
2016-10-13 11:27:50 +00:00
gsathya
094e95cdd1 [promises] don't store undefined resulting from ResolvePromise
Review-Url: https://codereview.chromium.org/2419713002
Cr-Commit-Position: refs/heads/master@{#40241}
2016-10-12 23:53:52 +00:00
gsathya
6f94a8f1c7 [promises] Move PromiseReactionJob to c++
This patch results in a 11% improvement over 5 runs in the
bluebird benchmark.

BUG=v8:5343,v8:5046
TBR=bmeurer@chromium.org

Review-Url: https://codereview.chromium.org/2406343002
Cr-Commit-Position: refs/heads/master@{#40239}
2016-10-12 20:45:57 +00:00
jgruber
32b2d7c814 [i18n] Avoid name conflicts caused by minifier
Our minifier (tools/jsmin.py) shortens variable names it comes across.
It generally tries to avoid name conflicts caused by renamed variables,
but cannot handle lambda function syntax.

This is what happens here. Both lambda function parameters 'x' and 'y'
are not recognized as identifiers by the minifier and it thus potentially
causes naming conflicts.

BUG=v8:5505

Review-Url: https://codereview.chromium.org/2412533002
Cr-Commit-Position: refs/heads/master@{#40198}
2016-10-12 07:37:04 +00:00
petermarshall
08217e45a7 [builtins] Move StringStartsWith to a C++ builtin.
BUG=v8:5364

Review-Url: https://codereview.chromium.org/2407173002
Cr-Commit-Position: refs/heads/master@{#40165}
2016-10-11 11:36:12 +00:00
petermarshall
5af6ec76b2 [builtins] Move StringEndsWith to a C++ builtin.
BUG=v8:5364

Review-Url: https://codereview.chromium.org/2406873002
Cr-Commit-Position: refs/heads/master@{#40164}
2016-10-11 11:28:12 +00:00
jgruber
05a5599234 [regexp] Port split
This CL ports RegExp.prototype[@@split] to C++. Performance
regressions are expected due to:

* Slow RegExpImpl::Exec implementation instead of RegExpExec
  stub. We should be able to improve this by straight-lining
  RegExpImpl::Exec.
* Slow Factory::NewSubString instead of SubStringStub.
* Slow elements access to lastMatchInfo.

These points will be addressed in a follow-up CL.

BUG=v8:5339

Review-Url: https://codereview.chromium.org/2401643002
Cr-Commit-Position: refs/heads/master@{#40161}
2016-10-11 10:38:14 +00:00
yangguo
0d8e52123e [Math] implement Math.random as TFJ builtin.
R=bmeurer@chromium.org
BUG=v8:5049, v8:5086

Review-Url: https://codereview.chromium.org/2402363002
Cr-Commit-Position: refs/heads/master@{#40149}
2016-10-11 06:47:15 +00:00
gsathya
1f80f66de0 [promises] update deferred reactions symbol
The behavior was changed in https://codereview.chromium.org/2357423002

Review-Url: https://codereview.chromium.org/2403163002
Cr-Commit-Position: refs/heads/master@{#40142}
2016-10-10 22:59:48 +00:00
gsathya
7d336218bf [regexp] Remove unused InternalPackedArray
Review-Url: https://codereview.chromium.org/2397373004
Cr-Commit-Position: refs/heads/master@{#40130}
2016-10-10 16:57:57 +00:00
petermarshall
8b48aa1cda [builtins] Move StringIncludes to a builtin.
Also add a test for when the first argument is null or undefined, as there are no tests that cover this currently.

BUG=v8:5364

Review-Url: https://codereview.chromium.org/2399423003
Cr-Commit-Position: refs/heads/master@{#40127}
2016-10-10 15:01:32 +00:00
jgruber
80f3c6ce77 [regexp] Port test, match, and search
This CL ports RegExp.prototype.test, RegExp.prototype.match
and RegExp.prototype.search to C++.

Performance regressions are expected but should be improved
in an upcoming CL.

BUG=v8:5339

Review-Url: https://codereview.chromium.org/2394713003
Cr-Commit-Position: refs/heads/master@{#40122}
2016-10-10 13:57:20 +00:00
jgruber
67bcc7f6dc [regexp] Port RegExpCompile and RegExpToString
Again, fast paths could be added for unmodified JSRegExp instances.

BUG=v8:5339

Review-Url: https://codereview.chromium.org/2392463005
Cr-Commit-Position: refs/heads/master@{#40119}
2016-10-10 13:06:39 +00:00
petermarshall
407b479d23 Revert of [builtins] Move StringIncludes to a builtin. (patchset #4 id:60001 of https://codereview.chromium.org/2399423003/ )
Reason for revert:
String.includes crashes when called with null or undefined as the first param

Original issue's description:
> [builtins] Move StringIncludes to a builtin.
>
> BUG=v8:5364
>
> Committed: https://crrev.com/b374d719e79a5b32168c25c0cda30056f5e6e36c
> Cr-Commit-Position: refs/heads/master@{#40110}

TBR=franzih@chromium.org,bmeurer@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:5364

Review-Url: https://codereview.chromium.org/2407793002
Cr-Commit-Position: refs/heads/master@{#40118}
2016-10-10 11:27:30 +00:00
petermarshall
b374d719e7 [builtins] Move StringIncludes to a builtin.
BUG=v8:5364

Review-Url: https://codereview.chromium.org/2399423003
Cr-Commit-Position: refs/heads/master@{#40110}
2016-10-10 08:31:43 +00:00
petermarshall
58529ed3a0 [builtins] Move StringIndexOf to a C++ builtin.
BUG=v8:5364

Review-Url: https://codereview.chromium.org/2350963004
Cr-Commit-Position: refs/heads/master@{#40093}
2016-10-07 17:04:12 +00:00
bmeurer
0f7f6e33ba [builtins] Migrate Number.parseFloat to a TurboFan builtin.
This implicitly convers parseFloat on the global object as well, since
it's the same function. This is mostly straight-forward, but adds
another fast case for HeapNumbers as well.

R=ishell@chromium.org

Review-Url: https://codereview.chromium.org/2395373002
Cr-Commit-Position: refs/heads/master@{#40072}
2016-10-07 08:59:02 +00:00
gsathya
9d836ec64a [promises] fix deferred object leak
This patch sets `this` to be undefined when calling resolve and reject
functions attached to the deferred.

BUG=v8:5476

Review-Url: https://codereview.chromium.org/2399053003
Cr-Commit-Position: refs/heads/master@{#40056}
2016-10-06 18:29:35 +00:00
jgruber
4e219bb46a [regexp] Port RegExp getters and setters
Flag getters are implemented as TurboFan stubs while the rest are written as
C++. This distinction is somewhat arbitrary and more getters could be ported to
TurboFan in the future.

BUG=v8:5339

Review-Url: https://codereview.chromium.org/2389233002
Cr-Commit-Position: refs/heads/master@{#40036}
2016-10-06 13:01:08 +00:00
gsathya
4dc97f4a83 [promises] dont create resolving closures in PromiseThen
When we create native promises as part of PromiseThen, we don't have
to create resolving closures. The closure will only ever be called
once from PromiseHandle, therefore we don't need the alreadyResolved
check.

This results in a 21.76% improvement in the bluebird benchmark
over 5 runs.

BUG=v8:5046

Review-Url: https://codereview.chromium.org/2396763002
Cr-Commit-Position: refs/heads/master@{#40018}
2016-10-05 23:36:01 +00:00
gsathya
34a0ac3cca [promises] Use PromiseCreate when applicable
Review-Url: https://codereview.chromium.org/2376613003
Cr-Commit-Position: refs/heads/master@{#40011}
2016-10-05 19:44:04 +00:00
jgruber
d515156441 [regexp] Port RegExpConstructor to C++
This moves the RegExp constructor to C++. Local runs of octane/regexp are
performance-neutral:

C++: 4970.1 +- 404.981
JS: 4869.2 +- 586.743

That's probably only the case because exec and replace dominate
octane/regexp. There's potential for improvement here, for instance by
adding a fast-path if new.target is an unmodified JSRegExp function.

BUG=v8:5339

Review-Url: https://codereview.chromium.org/2384613004
Cr-Commit-Position: refs/heads/master@{#39981}
2016-10-05 09:13:37 +00:00
jgruber
7d26871d2d [stubs] Port String.prototype.substr to TurboFan
BUG=v8:5415

Review-Url: https://codereview.chromium.org/2373493002
Cr-Commit-Position: refs/heads/master@{#39951}
2016-10-04 12:00:28 +00:00
jgruber
db99bdff76 [regexp] Port RegExp.prototype.exec to TurboFan
This ports RegExp.prototype.exec to a TurboFan builtin.

LastMatchInfo is now stored on the context in order to be able to access
it from the stub.

Unmodified RegExp instances go through a fast path of accessing the
lastIndex property as an in-object field, while modified instances call
into runtime for lastIndex loads and stores.

Octane/regexp shows slight improvements (between 0 and 5%) with this CL.

BUG=v8:5339

Review-Url: https://codereview.chromium.org/2375953002
Cr-Commit-Position: refs/heads/master@{#39899}
2016-09-30 07:24:36 +00:00
jgruber
e3222de330 [stubs] Port String.prototype.substring to TurboFan
BUG=v8:5415

Committed: https://crrev.com/cc37dff7ba21345b3a867a86127a208e34a3f707
Review-Url: https://codereview.chromium.org/2358133004
Cr-Original-Commit-Position: refs/heads/master@{#39717}
Cr-Commit-Position: refs/heads/master@{#39852}
2016-09-29 08:16:19 +00:00
bmeurer
19b3943607 [turbofan] ChangeFloat64ToTagged shouldn't canonicalize.
This matches current Crankshaft/fullcodegen behavior more closely and
thus reduces the chances that we run into unnecessary polymorphism due
to the field representation tracking in our object model.

Drive-by-fixes: Make sure the JSRegExp::lastIndex field stays Smi
if possible (otherwise we tank the regexp benchmark in Octane).

CQ_INCLUDE_TRYBOTS=master.tryserver.v8:v8_mac64_rel,v8_mac64_dbg
R=jarin@chromium.org
BUG=v8:5267

Committed: 6a939714e9
Committed: https://crrev.com/ee158e6c4cc896479a32245432a3c2fdd31bcb73
Committed: https://crrev.com/ddf792beb3a72f6dba83e94fc8ada03ebf1630bd
Review-Url: https://codereview.chromium.org/2367593003
Cr-Original-Original-Commit-Position: refs/heads/master@{#39692}
Cr-Original-Commit-Position: refs/heads/master@{#39748}
Cr-Commit-Position: refs/heads/master@{#39803}
2016-09-28 06:07:57 +00:00
gsathya
1f89abcb9a [promises] Don't create resolving functions for PromiseCreate
Previously passing in the PromiseNopResolver function to the Promise
constructor would result in creating the resolving functions to be in
passed in to the executor, but the PromiseNopResolver does not use
these resolving functions resulting in wastefully creating these closures.

Instead we pass in the promiseRawSymbol to the promise constructor
so that these unnecessary resolving functions are not created.

BUG=v8:5046

Review-Url: https://codereview.chromium.org/2353303003
Cr-Commit-Position: refs/heads/master@{#39791}
2016-09-27 18:46:18 +00:00
jgruber
515994b8ca [regexp] Don't cache exec method in Regexp.proto[@@split]
The call to RegExpSubclassExec may refer to a different exec method
since splitter is newly constructed previously to the call.

BUG=v8:5351

Review-Url: https://codereview.chromium.org/2370733003
Cr-Commit-Position: refs/heads/master@{#39774}
2016-09-27 14:02:33 +00:00