Commit Graph

194 Commits

Author SHA1 Message Date
Sathya Gunasekaran
ea632716d7 [d8] Fix stack overflow when importing modules
Bug: chromium:740694
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: Ib23bca1942c25d8a9f32e12be3f7b50fc3ab55c8
Reviewed-on: https://chromium-review.googlesource.com/568222
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46611}
2017-07-12 23:39:51 +00:00
Sathya Gunasekaran
22e95814a8 [ESnext] Change dynamic import API to return a promise
Previously V8 created a promise to return to userland,
but instead we let the embedder create and track the promise.

Bug: v8:5785
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I8903ffbabf3a256f1c8df844a656a873da304586
Reviewed-on: https://chromium-review.googlesource.com/492646
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Daniel Clifford <danno@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46333}
2017-06-29 22:34:41 +00:00
Mircea Trofin
0aef84da31 Revert "Revert "Reland "Introducing an event loop mechanism for d8."""
This reverts commit 619dfed4f7.

Original CL:  https://chromium-review.googlesource.com/c/494968/

Bug: 
Change-Id: Ib4a1f481e46f1972420cc8f8d2192bb6c470e08d
Reviewed-on: https://chromium-review.googlesource.com/501650
Commit-Queue: Brad Nelson <bradnelson@chromium.org>
Reviewed-by: Brad Nelson <bradnelson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45240}
2017-05-10 18:34:10 +00:00
Mircea Trofin
619dfed4f7 Revert "Reland "Introducing an event loop mechanism for d8.""
This reverts commit 45bbf8041d.

Reason for revert: Still some flakes.

Original change's description:
> Reland "Introducing an event loop mechanism for d8."
> 
> This reverts commit 02595c60a3.
> 
> Original CL: https://chromium-review.googlesource.com/c/494968/
> 
> Bug: 
> Change-Id: I7441ed91ebb4a087cdf437ae3239f9b021110a11
> Reviewed-on: https://chromium-review.googlesource.com/500947
> Reviewed-by: Bill Budge <bbudge@chromium.org>
> Commit-Queue: Mircea Trofin <mtrofin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#45212}

TBR=bradnelson@chromium.org,bbudge@chromium.org,mtrofin@chromium.org,jochen@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Bug: 
Change-Id: Idf2ea0431865104042a68bd2dac944a9725bf3f9
Reviewed-on: https://chromium-review.googlesource.com/501370
Reviewed-by: Mircea Trofin <mtrofin@chromium.org>
Commit-Queue: Mircea Trofin <mtrofin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45215}
2017-05-10 04:50:19 +00:00
Mircea Trofin
45bbf8041d Reland "Introducing an event loop mechanism for d8."
This reverts commit 02595c60a3.

Original CL: https://chromium-review.googlesource.com/c/494968/

Bug: 
Change-Id: I7441ed91ebb4a087cdf437ae3239f9b021110a11
Reviewed-on: https://chromium-review.googlesource.com/500947
Reviewed-by: Bill Budge <bbudge@chromium.org>
Commit-Queue: Mircea Trofin <mtrofin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45212}
2017-05-10 01:02:42 +00:00
Michael Achenbach
02595c60a3 Revert "Revert "Revert "Introducing an event loop mechanism for d8."""
This reverts commit 7dcc8effbd.

Reason for revert: Some flakes still (see comments) and breaks predictable testing:
https://build.chromium.org/p/client.v8/builders/V8%20Linux%20-%20predictable/builds/11452

Original change's description:
> Revert "Revert "Introducing an event loop mechanism for d8.""
> 
> This reverts commit f7c25da680.
> 
> Reason for revert: Fixed
> 
> Original change's description:
> > Revert "Introducing an event loop mechanism for d8."
> > 
> > This reverts commit de964dbe57.
> > 
> > Reason for revert:
> > https://build.chromium.org/p/client.v8/builders/V8%20Linux/builds/17958
> > 
> > Original change's description:
> > > Introducing an event loop mechanism for d8.
> > > 
> > > This mechanism ensures APIs like wasm async complete their work, 
> > > without requiring use of natives (%APIs).
> > > 
> > > The mechanism is similar to the one used in content_shell,
> > > which should allow us to easily port tests in that environment.
> > > 
> > > Review-Url: https://codereview.chromium.org/2842843005
> > > Cr-Original-Commit-Position: refs/heads/master@{#44908}
> > > Bug: 
> > > Change-Id: I9deee0d256a600c60b42902fc8ef8478e5546344
> > > Reviewed-on: https://chromium-review.googlesource.com/494968
> > > Commit-Queue: Mircea Trofin <mtrofin@google.com>
> > > Reviewed-by: Jochen Eisinger <jochen@chromium.org>
> > > Cr-Commit-Position: refs/heads/master@{#45165}
> > 
> > TBR=bradnelson@chromium.org,mtrofin@chromium.org,mtrofin@google.com,jochen@chromium.org
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > 
> > Change-Id: Iafec2615d705d1990c57229cab3a988c00b5e12f
> > Reviewed-on: https://chromium-review.googlesource.com/498630
> > Reviewed-by: Michael Achenbach <machenbach@chromium.org>
> > Commit-Queue: Michael Achenbach <machenbach@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#45166}
> 
> TBR=bradnelson@chromium.org,machenbach@chromium.org,mtrofin@chromium.org,mtrofin@google.com,jochen@chromium.org,v8-reviews@googlegroups.com
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> 
> Change-Id: Ic3c782e918326e291a6cb9bb349c609e9a340b09
> Reviewed-on: https://chromium-review.googlesource.com/498430
> Reviewed-by: Mircea Trofin <mtrofin@chromium.org>
> Commit-Queue: Mircea Trofin <mtrofin@google.com>
> Cr-Commit-Position: refs/heads/master@{#45172}

TBR=bradnelson@chromium.org,machenbach@chromium.org,mtrofin@chromium.org,mtrofin@google.com,jochen@chromium.org,v8-reviews@googlegroups.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: I21ffba7141db0bfb4a3275b6e1bf4fb399800ed2
Reviewed-on: https://chromium-review.googlesource.com/500128
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45177}
2017-05-09 07:43:45 +00:00
Mircea Trofin
7dcc8effbd Revert "Revert "Introducing an event loop mechanism for d8.""
This reverts commit f7c25da680.

Reason for revert: Fixed

Original change's description:
> Revert "Introducing an event loop mechanism for d8."
> 
> This reverts commit de964dbe57.
> 
> Reason for revert:
> https://build.chromium.org/p/client.v8/builders/V8%20Linux/builds/17958
> 
> Original change's description:
> > Introducing an event loop mechanism for d8.
> > 
> > This mechanism ensures APIs like wasm async complete their work, 
> > without requiring use of natives (%APIs).
> > 
> > The mechanism is similar to the one used in content_shell,
> > which should allow us to easily port tests in that environment.
> > 
> > Review-Url: https://codereview.chromium.org/2842843005
> > Cr-Original-Commit-Position: refs/heads/master@{#44908}
> > Bug: 
> > Change-Id: I9deee0d256a600c60b42902fc8ef8478e5546344
> > Reviewed-on: https://chromium-review.googlesource.com/494968
> > Commit-Queue: Mircea Trofin <mtrofin@google.com>
> > Reviewed-by: Jochen Eisinger <jochen@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#45165}
> 
> TBR=bradnelson@chromium.org,mtrofin@chromium.org,mtrofin@google.com,jochen@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> 
> Change-Id: Iafec2615d705d1990c57229cab3a988c00b5e12f
> Reviewed-on: https://chromium-review.googlesource.com/498630
> Reviewed-by: Michael Achenbach <machenbach@chromium.org>
> Commit-Queue: Michael Achenbach <machenbach@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#45166}

TBR=bradnelson@chromium.org,machenbach@chromium.org,mtrofin@chromium.org,mtrofin@google.com,jochen@chromium.org,v8-reviews@googlegroups.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: Ic3c782e918326e291a6cb9bb349c609e9a340b09
Reviewed-on: https://chromium-review.googlesource.com/498430
Reviewed-by: Mircea Trofin <mtrofin@chromium.org>
Commit-Queue: Mircea Trofin <mtrofin@google.com>
Cr-Commit-Position: refs/heads/master@{#45172}
2017-05-08 20:19:41 +00:00
Michael Achenbach
f7c25da680 Revert "Introducing an event loop mechanism for d8."
This reverts commit de964dbe57.

Reason for revert:
https://build.chromium.org/p/client.v8/builders/V8%20Linux/builds/17958

Original change's description:
> Introducing an event loop mechanism for d8.
> 
> This mechanism ensures APIs like wasm async complete their work, 
> without requiring use of natives (%APIs).
> 
> The mechanism is similar to the one used in content_shell,
> which should allow us to easily port tests in that environment.
> 
> Review-Url: https://codereview.chromium.org/2842843005
> Cr-Original-Commit-Position: refs/heads/master@{#44908}
> Bug: 
> Change-Id: I9deee0d256a600c60b42902fc8ef8478e5546344
> Reviewed-on: https://chromium-review.googlesource.com/494968
> Commit-Queue: Mircea Trofin <mtrofin@google.com>
> Reviewed-by: Jochen Eisinger <jochen@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#45165}

TBR=bradnelson@chromium.org,mtrofin@chromium.org,mtrofin@google.com,jochen@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: Iafec2615d705d1990c57229cab3a988c00b5e12f
Reviewed-on: https://chromium-review.googlesource.com/498630
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45166}
2017-05-08 17:47:27 +00:00
Mircea Trofin
de964dbe57 Introducing an event loop mechanism for d8.
This mechanism ensures APIs like wasm async complete their work, 
without requiring use of natives (%APIs).

The mechanism is similar to the one used in content_shell,
which should allow us to easily port tests in that environment.

Review-Url: https://codereview.chromium.org/2842843005
Cr-Original-Commit-Position: refs/heads/master@{#44908}
Bug: 
Change-Id: I9deee0d256a600c60b42902fc8ef8478e5546344
Reviewed-on: https://chromium-review.googlesource.com/494968
Commit-Queue: Mircea Trofin <mtrofin@google.com>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45165}
2017-05-08 15:35:42 +00:00
ochang
3f4536894a d8: Make in process stack dumping optional
Adds a flag (--disable-in-process-stack-traces) to not install
signal handlers so that e.g. ASan signal handlers will work.

This flag mirrors chromium's one.

R=jochen@chromium.org
BUG=chromium:716235

Review-Url: https://codereview.chromium.org/2854173002
Cr-Commit-Position: refs/heads/master@{#45142}
2017-05-05 16:00:27 +00:00
yangguo
9d71683e11 Introduce mkgrokdump to update tools/v8heapconst.py.
- Migrate make grokdump to GYP and GN
- Move code from d8 into stand-alone execution
- Add test case to ensure it's up-to-date

Review-Url: https://codereview.chromium.org/2809653003
Cr-Original-Original-Commit-Position: refs/heads/master@{#44687}
Committed: 0cc0c130fa
Review-Url: https://codereview.chromium.org/2809653003
Cr-Original-Commit-Position: refs/heads/master@{#44710}
Committed: 477f005574
Review-Url: https://codereview.chromium.org/2809653003
Cr-Commit-Position: refs/heads/master@{#44738}
2017-04-20 06:15:02 +00:00
Wiktor Garbacz
115aff0d85 [d8] Fix use-external-strings flag.
BUG=v8:6093

Change-Id: I4572fcb4258c9a6ee6e5d5ed18e3567460c90211
Reviewed-on: https://chromium-review.googlesource.com/481300
Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Commit-Queue: Wiktor Garbacz <wiktorg@google.com>
Cr-Commit-Position: refs/heads/master@{#44723}
2017-04-19 13:00:41 +00:00
Wiktor Garbacz
2a2a417b06 [d8] Add a flag to use external strings.
This is to make testing parse tasks, which currently only work with
external strings, easier.

BUG=v8:6093

Change-Id: Ia248ea9e9547604b4c81179e54d8ef564377e2a9
Reviewed-on: https://chromium-review.googlesource.com/480559
Commit-Queue: Wiktor Garbacz <wiktorg@google.com>
Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44715}
2017-04-19 09:35:42 +00:00
machenbach
84b22eb29f Revert of Introduce mkgrokdump to update tools/v8heapconst.py. (patchset #21 id:390001 of https://codereview.chromium.org/2809653003/ )
Reason for revert:
Test driver runs into assert:
https://build.chromium.org/p/client.v8/builders/V8%20Win64/builds/17082

Original issue's description:
> Introduce mkgrokdump to update tools/v8heapconst.py.
>
> - Migrate make grokdump to GYP and GN
> - Move code from d8 into stand-alone execution
> - Add test case to ensure it's up-to-date
>
> Review-Url: https://codereview.chromium.org/2809653003
> Cr-Original-Commit-Position: refs/heads/master@{#44687}
> Committed: 0cc0c130fa
> Review-Url: https://codereview.chromium.org/2809653003
> Cr-Commit-Position: refs/heads/master@{#44710}
> Committed: 477f005574

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

Review-Url: https://codereview.chromium.org/2826743003
Cr-Commit-Position: refs/heads/master@{#44711}
2017-04-19 07:03:00 +00:00
yangguo
477f005574 Introduce mkgrokdump to update tools/v8heapconst.py.
- Migrate make grokdump to GYP and GN
- Move code from d8 into stand-alone execution
- Add test case to ensure it's up-to-date

Review-Url: https://codereview.chromium.org/2809653003
Cr-Original-Commit-Position: refs/heads/master@{#44687}
Committed: 0cc0c130fa
Review-Url: https://codereview.chromium.org/2809653003
Cr-Commit-Position: refs/heads/master@{#44710}
2017-04-19 06:10:15 +00:00
yangguo
0e12ac85c1 Revert of Introduce mkgrokdump to update tools/v8heapconst.py. (patchset #19 id:350001 of https://codereview.chromium.org/2809653003/ )
Reason for revert:
http://build.chromium.org/p/client.v8/builders/V8%20Win64/builds/17063/steps/Check/logs/mkgrokdump

Original issue's description:
> Introduce mkgrokdump to update tools/v8heapconst.py.
>
> - Migrate make grokdump to GYP and GN
> - Move code from d8 into stand-alone execution
> - Add test case to ensure it's up-to-date
>
> Review-Url: https://codereview.chromium.org/2809653003
> Cr-Commit-Position: refs/heads/master@{#44687}
> Committed: 0cc0c130fa

TBR=mstarzinger@chromium.org,machenbach@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review-Url: https://codereview.chromium.org/2824853003
Cr-Commit-Position: refs/heads/master@{#44691}
2017-04-18 14:41:13 +00:00
yangguo
0cc0c130fa Introduce mkgrokdump to update tools/v8heapconst.py.
- Migrate make grokdump to GYP and GN
- Move code from d8 into stand-alone execution
- Add test case to ensure it's up-to-date

Review-Url: https://codereview.chromium.org/2809653003
Cr-Commit-Position: refs/heads/master@{#44687}
2017-04-18 14:05:27 +00:00
gsathya
94283dcf44 [ESNext] Implement DynamicImportCall
This patch implements the runtime semantics of dynamic import.

We create a new ASTNode so that we can pass the JSFunction closure() to
the runtime function from which we get the script_url.

d8 implements the embedder logic required to load and evaluate the modules.

The API is mostly implemented as specified.

BUG=8:5785

Review-Url: https://codereview.chromium.org/2703563002
Cr-Commit-Position: refs/heads/master@{#44551}
2017-04-11 09:33:11 +00:00
Igor Sheludko
1c7f83980e [runtime] Mark old JSGlobalProxy's map as unstable when an iframe navigates away.
This CL also introduces Realm.navigate(i).

BUG=chromium:683667

Change-Id: I9227292ea3a575f34367e82fc6297d234d3eecae
Reviewed-on: https://chromium-review.googlesource.com/447638
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43494}
2017-02-28 17:05:51 +00:00
yangguo
20c7d5431a [debugger] add lcov support to d8.
Use d8 with --lcov=<file> to append coverage info to a file.
The result can be fed into genhtml(1).

R=jgruber@chromium.org
BUG=v8:5808

Review-Url: https://codereview.chromium.org/2695823003
Cr-Commit-Position: refs/heads/master@{#43207}
2017-02-15 10:16:44 +00:00
binji
67fc083aae [d8] Fix ArrayBuffer memory leaks in d8 introduced by commit 96635558.
BUG=686338
R=cbruni@chromium.org,jbroman@chromium.org

Review-Url: https://codereview.chromium.org/2662193002
Cr-Commit-Position: refs/heads/master@{#42937}
2017-02-04 00:43:36 +00:00
binji
966355585b [d8] Use ValueSerializer for postMessage (instead of ad-hoc serializer)
Review-Url: https://codereview.chromium.org/2643723010
Cr-Commit-Position: refs/heads/master@{#42749}
2017-01-27 20:15:37 +00:00
rmcilroy
a3052cfe22 [compiler] Collect eager inner functions for compilation during renumbering.
This CL modifies the ast-numbering phase to collect function literals which
should be compiled eagerly. This is then used to eagerly compile the inner
functions before compiling the outer function. This will be used to queue
compilation jobs on the CompilerDispatcher in a later CL.

This CL moves the compilation of eager inner functions out of the
GetSharedFunctionInfo function and instead compiles them explicitly. This
simplifies GetSharedFunctionInfo and also means there is no need to pass a
LazyCompilationMode to the function, so this concept has been removed.

BUG=v8:5203,v8:5215

Review-Url: https://codereview.chromium.org/2618553004
Cr-Commit-Position: refs/heads/master@{#42221}
2017-01-11 12:18:48 +00:00
clemensh
222541dff5 [wasm] Generate correct locations for error messages
The current logic in Isolate::GetLocationFromStackTrace just ignores
wasm frames, making the computed location point to the first javascript
frame, like this:

test.js:17: RuntimeError: divide by zero
module.exports.main();
               ^
RuntimeError: divide by zero
    at main (<WASM>[1]+5)
    at test.js:17:16

This CL not only fixes the location to point to the top-most wasm
frame, but also exposes to the embedder that the script of that location
is a wasm script, allowing for custom printing of wasm locations.
The Shell::ReportException method now checks for this flag, and prints
wasm locations like this:

<WASM>[0]+5: RuntimeError: divide by zero
RuntimeError: divide by zero
    at main (<WASM>[0]+5)
    at test/message/wasm-trap.js:15:16

R=titzer@chromium.org, yangguo@chromium.org
BUG=chromium:613110

Review-Url: https://codereview.chromium.org/2563673002
Cr-Commit-Position: refs/heads/master@{#41640}
2016-12-12 12:46:02 +00:00
jgravelle
fb96618ee0 Add Shell::PrintErr and expose it in the d8 shell as printErr
This function is implemented in other JavaScript shells

BUG=None

R=titzer

Review-Url: https://codereview.chromium.org/2458963003
Cr-Commit-Position: refs/heads/master@{#40677}
2016-10-31 16:40:33 +00:00
yangguo
2f135d464c [debugger] basic test infrastructure for new debugger test api.
This introduces:
- a way in d8 to send messages to the inspector and receive responses.
- a new test suite where existing debugger tests should migrate to.

R=jgruber@chromium.org, kozyatinskiy@chromium.org, machenbach@chromium.org
BUG=v8:5530

Review-Url: https://chromiumcodereview.appspot.com/2425973002
Cr-Commit-Position: refs/heads/master@{#40487}
2016-10-21 06:38:05 +00:00
adamk
9d2051fc28 [modules] Store Module metadata in per-Context EmbedderData
This is a re-land of https://codereview.chromium.org/2393303002/ with
an additional call to DisposeModuleEmbedderData() added to fix lsan failures.

Unifies the approaches used for storing the specifier -> module mapping
and the module -> directory mapping, using std::unordered_maps for both
and storing them per-Context.

This requires adding a method to the v8::Module API to get a hash code
for a Module, but allows slimming down the API in return: gone are
SetEmbedderData/GetEmbedderData, along with the fourth argument
to ResolveModuleCallback.

Besides a simpler API, this allows d8 to get closer to the HTML loader,
which requires each Realm to have a persistent module map (though this
capability is not yet exercised by any tests).

BUG=v8:1569
TBR=neis@chromium.org,jochen@chromium.org

Review-Url: https://codereview.chromium.org/2405313002
Cr-Commit-Position: refs/heads/master@{#40186}
2016-10-11 19:22:25 +00:00
adamk
127798897f Revert of [modules] Store Module metadata in per-Context EmbedderData (patchset #7 id:120001 of https://codereview.chromium.org/2393303002/ )
Reason for revert:
Fails under LeakSanitizer on auto-roll fyi bot:

https://build.chromium.org/p/client.v8.fyi/builders/Auto-roll%20-%20release%20process/builds/49447

Original issue's description:
> [modules] Store Module metadata in per-Context EmbedderData
>
> Unifies the approaches used for storing the specifier -> module mapping
> and the module -> directory mapping, using std::unordered_maps for both
> and storing them per-Context.
>
> This requires adding a method to the v8::Module API to get a hash code
> for a Module, but allows slimming down the API in return: gone are
> SetEmbedderData/GetEmbedderData, along with the fourth argument
> to ResolveModuleCallback.
>
> Besides a simpler API, this allows d8 to get closer to the HTML loader,
> which requires each Realm to have a persistent module map (though this
> capability is not yet exercised by any tests).
>
> BUG=v8:1569
>
> Committed: https://crrev.com/9cf8fce74cf6e7afd6aea3f3545f6bb61572f277
> Cr-Commit-Position: refs/heads/master@{#40133}

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

Review-Url: https://codereview.chromium.org/2406973003
Cr-Commit-Position: refs/heads/master@{#40145}
2016-10-11 00:25:12 +00:00
adamk
9cf8fce74c [modules] Store Module metadata in per-Context EmbedderData
Unifies the approaches used for storing the specifier -> module mapping
and the module -> directory mapping, using std::unordered_maps for both
and storing them per-Context.

This requires adding a method to the v8::Module API to get a hash code
for a Module, but allows slimming down the API in return: gone are
SetEmbedderData/GetEmbedderData, along with the fourth argument
to ResolveModuleCallback.

Besides a simpler API, this allows d8 to get closer to the HTML loader,
which requires each Realm to have a persistent module map (though this
capability is not yet exercised by any tests).

BUG=v8:1569

Review-Url: https://codereview.chromium.org/2393303002
Cr-Commit-Position: refs/heads/master@{#40133}
2016-10-10 17:37:51 +00:00
leszeks
050bf39d85 Instead of having a hashmap with a function pointer defining its
matching function, creates a hashmap the specialises the case of keys
that simply check pointer equality.

I measure an average ~1% improvement on Octane code-load.

Review-Url: https://codereview.chromium.org/2369963002
Cr-Commit-Position: refs/heads/master@{#39920}
2016-09-30 16:17:06 +00:00
adamk
cf127e8144 [modules] Expand API to allow linking and use it in d8
This patch gives the ability for the embedder to ask for the
module requests of a module, and to pass a ResolveCallback
into Module::Instantiate().

In d8, I've implemented a simple module_map that's used
along with this API to allow loading, compiling, instantiating,
and evaluating a whole tree of modules.

No path resolution is yet implemented, meaning that all
import paths are relative to whatever directory d8 runs
in. And no imports are linked to the exports of the
requested module.

BUG=v8:1569

Review-Url: https://codereview.chromium.org/2351113004
Cr-Commit-Position: refs/heads/master@{#39569}
2016-09-20 23:39:41 +00:00
jgruber
4f5695229e [d8] Fix the shared-library build
This commit ensures that the d8 shared library build uses the same logic as
the standard static build by exporting relevant functions and classes.

BUG=chromium:646337

Committed: https://crrev.com/2c10ca8086a4d595ecf9aa843d2031b068470d65
Review-Url: https://codereview.chromium.org/2342563002
Cr-Original-Commit-Position: refs/heads/master@{#39503}
Cr-Commit-Position: refs/heads/master@{#39547}
2016-09-20 12:06:54 +00:00
machenbach
298ee9cde1 Revert of [d8] Fix the shared-library build (patchset #12 id:20002 of https://codereview.chromium.org/2342563002/ )
Reason for revert:
Unblocking roll

Original issue's description:
> [d8] Fix the shared-library build
>
> This commit ensures that the d8 shared library build uses the same logic as
> the standard static build by exporting relevant functions and classes.
>
> BUG=chromium:646337
>
> Committed: https://crrev.com/2c10ca8086a4d595ecf9aa843d2031b068470d65
> Cr-Commit-Position: refs/heads/master@{#39503}

TBR=jochen@chromium.org,vogelheim@chromium.org,bmeurer@chromium.org,titzer@chromium.org,jgruber@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:646337

Review-Url: https://codereview.chromium.org/2356703003
Cr-Commit-Position: refs/heads/master@{#39526}
2016-09-20 07:13:27 +00:00
jgruber
2c10ca8086 [d8] Fix the shared-library build
This commit ensures that the d8 shared library build uses the same logic as
the standard static build by exporting relevant functions and classes.

BUG=chromium:646337

Review-Url: https://codereview.chromium.org/2342563002
Cr-Commit-Position: refs/heads/master@{#39503}
2016-09-19 12:47:22 +00:00
adamk
aa6db9d990 [modules] Introduce v8::Module to the API and return it from CompileModule
R=neis@chromium.org
BUG=v8:1569

Review-Url: https://codereview.chromium.org/2347933002
Cr-Commit-Position: refs/heads/master@{#39481}
2016-09-16 21:47:54 +00:00
lpy
0359e1f63e [Tracing] Create TraceConfig JSON string parser in D8.
BUG=v8:4561
LOG=N

Review-Url: https://codereview.chromium.org/2208873002
Cr-Commit-Position: refs/heads/master@{#38553}
2016-08-10 17:11:08 +00:00
fmeawad
821c3e563c Reland [Tracing] V8 Tracing Controller
V8 has had a trace event macro interface for while, but without a tracing
controller a standalone V8 would be unable to collect traces.

This CL introduces a complete Tracing Controller system for V8.
It is fully function except that it does not yet store trace event args.

This CL has a few components,
The tracing controller itself, contributed by the author of this CL
The Trace config (including the parser), contributed by lpy@
The Trace Object, Trace Writer, and Trace Buffer are all contributed by rksang@

BUG=v8:4561
LOG=N

The original CL was failing the V8 Arm Builder:
https://build.chromium.org/p/client.v8.ports/builders/V8%20Arm%20-%20builder/builds/2456
and the V8 Mips Builder:
https://build.chromium.org/p/client.v8.ports/builders/V8%20Mips%20-%20builder/builds/2506

The failure is due to undefined behavior of CHECK_EQ of 2 const char*

Fix in patch #1

Committed: https://crrev.com/3d598452679ce208ad9b2f48e0fb3fae352ce375
Cr-Commit-Position: refs/heads/master@{#38073}

patch from issue 2137013006 at patchset 200001 (http://crrev.com/2137013006#ps200001)

Review-Url: https://codereview.chromium.org/2183923004
Cr-Commit-Position: refs/heads/master@{#38104}
2016-07-27 16:21:54 +00:00
lpy
13c3d06a31 Revert of [Tracing] V8 Tracing Controller (patchset #11 id:200001 of https://codereview.chromium.org/2137013006/ )
Reason for revert:
Revert this CL due to V8 Arm Builder failure and V8 Mips Builder failure.

https://build.chromium.org/p/client.v8.ports/builders/V8%20Arm%20-%20builder/builds/2456

https://build.chromium.org/p/client.v8.ports/builders/V8%20Mips%20-%20builder/builds/2506

Original issue's description:
> [Tracing] V8 Tracing Controller
>
> V8 has had a trace event macro interface for while, but without a tracing
> controller a standalone V8 would be unable to collect traces.
>
> This CL introduces a complete Tracing Controller system for V8.
> It is fully function except that it does not yet store trace event args.
>
> This CL has a few components,
> The tracing controller itself, contributed by the author of this CL
> The Trace config (including the parser), contributed by lpy@
> The Trace Object, Trace Writer, and Trace Buffer are all contributed by rksang@
>
> BUG=v8:4561
> LOG=N
>
> Committed: https://crrev.com/3d598452679ce208ad9b2f48e0fb3fae352ce375
> Cr-Commit-Position: refs/heads/master@{#38073}

TBR=jochen@chromium.org,mattloring@google.com,rskang@google.com,yangguo@chromium.org,fmeawad@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:4561

Review-Url: https://codereview.chromium.org/2183943002
Cr-Commit-Position: refs/heads/master@{#38074}
2016-07-26 22:45:25 +00:00
fmeawad
3d59845267 [Tracing] V8 Tracing Controller
V8 has had a trace event macro interface for while, but without a tracing
controller a standalone V8 would be unable to collect traces.

This CL introduces a complete Tracing Controller system for V8.
It is fully function except that it does not yet store trace event args.

This CL has a few components,
The tracing controller itself, contributed by the author of this CL
The Trace config (including the parser), contributed by lpy@
The Trace Object, Trace Writer, and Trace Buffer are all contributed by rksang@

BUG=v8:4561
LOG=N

Review-Url: https://codereview.chromium.org/2137013006
Cr-Commit-Position: refs/heads/master@{#38073}
2016-07-26 22:15:39 +00:00
lpy
2fd55667a6 Move hashmap into src/base.
We ported hashmap.h into libsampler as a workaround before, so the main focus of
this patch is to reduce code duplication. This patch moves the hashmap into
src/base as well as creates DefaultAllocationPolicy using malloc and free.

BUG=v8:5050
LOG=n

Review-Url: https://codereview.chromium.org/2010243003
Cr-Commit-Position: refs/heads/master@{#36873}
2016-06-09 18:00:31 +00:00
littledan
9778f2efad Expose a way to make a same-origin realm
Some tests, e.g. in test262, want to create a new same-origin
realm. This patch exposes a new function,
Realm.createAllowCrossRealmAccess(), which vends a new realm with
the same security token as the currently executing one.

Review-Url: https://codereview.chromium.org/1973363004
Cr-Commit-Position: refs/heads/master@{#36561}
2016-05-27 18:50:16 +00:00
ssanfilippo
905becd13b [Interpreter] Add Ignition statistics JavaScript extension.
This commit introduces IgnitionStatisticsExtension, which provides
methods for accessing Ignition statistics and counters from JavaScript.

The extension is registered when FLAG_ignition and
FLAG_trace_ignition_dispatches are both enabled.

For the moment, the only exposed function is
getIgnitionDispatchCounters(), which allows to retrieve Ignition
dispatch counters as a JavaScript object.

BUG=v8:4899
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#35816}
2016-04-27 11:11:44 +00:00
yangguo
18c80bc879 [d8] remove utility context.
We only use it to store the Stringify function to format
REPL output. This is overkill and introduces issues with
security tokens.

R=jochen@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#35158}
2016-03-31 10:18:25 +00:00
mstarzinger
00a07bc1b7 Remove inline header includes from non-inline headers (1).
This tries to remove includes of "-inl.h" headers from normal ".h"
headers, thereby reducing the chance of any cyclic dependencies and
decreasing the average size of our compilation units.

Note that this change still leaves 7 violations of that rule in the
code. However there now is the "tools/check-inline-includes.sh" tool
detecting such violations.

R=bmeurer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#30125}
2015-08-12 07:32:54 +00:00
mstarzinger
58109a2c50 Remove several grab-bag includes from the v8.h header.
This is the first step of turning the v8.h file into a normal header
instead of an include-the-world header. The new rule is that no other
header files are allowed to include v8.h, which is enforced by DEPS.

Also the number of includes inside the v8.h file has been drastically
reduced. Basically the last missing piece is the inclusion of the big
objects-inl.h file.

This in turn makes many headers follow the IWYU principle.

R=bmeurer@chromium.org,hpayer@chromium.org,titzer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#30102}
2015-08-11 07:34:17 +00:00
binji
053b8434f0 [d8] Fix tsan bugs
script_executed and last_run are read/written by multiple threads. Also
externalized_shared_contents_ is modified by multiple threads.

BUG=4306
R=jarin@chromium.org
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#29912}
2015-07-30 08:20:51 +00:00
binji
a87db3dec8 [d8 Workers] Fix bug creating Worker during main thread termination
When the main thread terminates, it forcibly terminates all Worker threads.
When this happens, the threads objects were only half-created; they had a
JavaScript Worker object, but not a C++ worker object.

This CL fixes that bug, as well as some other fixes:
* Signatures on Worker methods
* Use SetAlignedPointerFromInternalField instead of using an External.
* Remove state_ from Worker. Simplify to atomic bool running_.

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

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

Cr-Commit-Position: refs/heads/master@{#29911}
2015-07-30 08:19:39 +00:00
yangguo
8e027195b4 Remove readline support from d8.
Nobody seems to use it. A good alternative is rlwrap.

R=jochen@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#29810}
2015-07-23 13:20:31 +00:00
yangguo
cd0015aad0 Remove d8's interactive Javascript debugger.
The code is unmaintained and full of errors...
but this CL wipes them all away.

Nobody seems to use it anyways.

R=mvstanton@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#29801}
2015-07-23 09:49:33 +00:00
jochen
d180390f7f Reland of "Make d8 stop using to-be-deprecated APIs"
Original issue's description:
> BUG=v8:4134
> LOG=n
> R=yangguo@chromium.org
>
> Review URL: https://codereview.chromium.org/1239053004

BUG=v8:4134
LOG=n
R=yangguo@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#29742}
2015-07-20 07:05:55 +00:00