Commit Graph

37 Commits

Author SHA1 Message Date
Clemens Backes
920a53b6b6 Fix LINT exceptions across the code base
The category name changed in https://crrev.com/c/2159690 (in
depot_tools), hence presubmit tests start failing whenever someone
touches a file which still refers to the old category.

R=zhin@chromium.org
TBR=machenbach@chromium.org

No-Try: true
No-Tree-Checks: true
Change-Id: I62813a42d63e512d421c4fe94229d04a56056978
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2165760
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67403}
2020-04-27 16:37:04 +00:00
Michael Lippautz
4214933c6b Reland "[api,heap] Remove deprecated Persistent APIs"
Removes APIs:
- MarkIndependent
- IsIndependent
- MarkActive
- RegisterExternalReference

All weak persistent handles are now treated as independent. Users of
traced handles should already use v8::EmbedderHeapTracer.

This reverts commit 49954eb56f.

Bug: chromium:923361
Change-Id: I0b9fcd678964331f926f6b725f70eb64268ca33f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1578462
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60971}
2019-04-24 09:34:27 +00:00
Michael Lippautz
49954eb56f Revert "[api,heap] Remove deprecated Persistent APIs"
This reverts commit 1ebf5f7281.

Reason for revert: Breaks TSAN

Original change's description:
> [api,heap] Remove deprecated Persistent APIs
> 
> Removes APIs:
> - MarkIndependent
> - IsIndependent
> - MarkActive
> - RegisterExternalReference
> 
> All weak persistent handles are now treated as independent. Users of
> traced handles should already use v8::EmbedderHeapTracer.
> 
> Bug: chromium:923361
> Change-Id: Ic90a647fe2ce9db92197ad6560e4907290805592
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1578459
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#60953}

TBR=ulan@chromium.org,mlippautz@chromium.org

Change-Id: I8281daf30b67c1b71ef6e65d8f13a59230ba0334
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:923361
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1578900
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60954}
2019-04-23 14:56:53 +00:00
Michael Lippautz
1ebf5f7281 [api,heap] Remove deprecated Persistent APIs
Removes APIs:
- MarkIndependent
- IsIndependent
- MarkActive
- RegisterExternalReference

All weak persistent handles are now treated as independent. Users of
traced handles should already use v8::EmbedderHeapTracer.

Bug: chromium:923361
Change-Id: Ic90a647fe2ce9db92197ad6560e4907290805592
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1578459
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60953}
2019-04-23 14:08:51 +00:00
Michael Lippautz
c8785d1572 [heap, api] Advance deprecations around global handles
Bug: chromium:923361, v8:8834
Change-Id: I46b6ad9eaa86476963a4e2cb3a5712447f180c20
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1528235
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60303}
2019-03-18 16:09:18 +00:00
Michael Lippautz
7b6a7379b6 PersistentValueMapBase: Deprecate outdated marking API
Embedders should use EmbedderHeapTracer::RegisterEmbedderReference
instead.

Bug: chromium:923361
Change-Id: If76c0354475798b09af95bedee0890594b29cd14
Reviewed-on: https://chromium-review.googlesource.com/c/1486472
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59840}
2019-02-25 16:43:33 +00:00
Michael Lippautz
81060c32da [api] Allow label annotations for PersistentValueMapBase
Allows adding a label to strong retainers in PersistentValueMapBase and
its subclasses. These labels show up in DevTools and enable identifying
strong retainers of objects.

R: ulan@chromium.org
Change-Id: Id5e19507c40e44688c82a4caec89449b563a0e8b
Reviewed-on: https://chromium-review.googlesource.com/c/1372069
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58177}
2018-12-12 09:15:26 +00:00
Hans Wennborg
63ca293dcf Remove PersistentContainerCallbackType::kWeak
From what I understand, it's been slated for removal for a long time, and
more accutely, Clang recently started warning about it being shadowed by
another kWeak enum:

../../v8/include/v8-profiler.h:369:5: warning: declaration shadows a variable
in namespace 'v8' [-Wshadow]
    kWeak = 6              // A weak reference (ignored by the GC).
    ^
../../v8/include/v8-util.h:29:3: note: previous declaration is here
  kWeak = kWeakWithParameter  // For backwards compatibility.  Deprecate.
  ^

Bug: chromium:895475
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I07de1418aea2d68ef5641ece4ab13f71b6d5ec7f
Reviewed-on: https://chromium-review.googlesource.com/c/1285189
Reviewed-by: Marja Hölttä <marja@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Hans Wennborg <hans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56743}
2018-10-17 14:51:20 +00:00
Jakob Kummerow
a2f1824839 [ubsan] Replace internal::Object references in v8.h
with internal::Address. This is in preparation for the upcoming
changes to internal::Object. The public API is unchanged, and
there should be no change in behavior either.

Most of the casts newly introduced here will disappear again once
the migration is complete.

Bug: v8:3770
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I2990b06a2511ccc5de3f98fd95a805f30ed589ab
Reviewed-on: https://chromium-review.googlesource.com/c/1036612
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56705}
2018-10-16 19:02:21 +00:00
Florian Sattler
c835ff79ef [cleanup] Replace 0 and NULL with nullptr for external includes.
Fixing clang-tidy warning.

Bug: v8:8015
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I4f9eb0fedbe1d35a571f3d5b111705a820edfb5b
Reviewed-on: https://chromium-review.googlesource.com/1224377
Commit-Queue: Florian Sattler <sattlerf@google.com>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55905}
2018-09-14 13:28:56 +00:00
ccyongwang
40eeaefb79 remove SetReference from PersistentValueMapBase.
Bug: v8:5828
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I5aabd10a76cd50fefe0ab50ccf239f562cad1522
Reviewed-on: https://chromium-review.googlesource.com/844038
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50718}
2018-01-19 13:40:51 +00:00
ccyongwang
39b2227bbd fix compile error when use PersistentValueMap.
In PersistentValueMap, SetWeak function should supply WeakCallbackType arguments.

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I70a59e90b7ea0a10f695419e57ae9bfb8d5ba852
Reviewed-on: https://chromium-review.googlesource.com/684002
Commit-Queue: Marja Hölttä <marja@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48529}
2017-10-13 10:23:57 +00:00
Daniel Cheng
60991f990b Don't use DCHECK in v8-util.h.
This will randomly break compilation units that don't happen to #define
DCHECK before v8-util.h is included.

BUG=chromium:688155

Change-Id: I7abdaf87c8bb7aca995d9e6e7ef8b4faff0dc50c
Reviewed-on: https://chromium-review.googlesource.com/447002
Reviewed-by: Marja Hölttä <marja@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43455}
2017-02-27 16:05:46 +00:00
mlippautz
5b1de36d93 [api] Remove EmbedderReachableReferenceReporter
API was highly experimental. Embedders should use V8::RegisterExternalReference instead.

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

Review-Url: https://codereview.chromium.org/2474163002
Cr-Commit-Position: refs/heads/master@{#40769}
2016-11-04 14:28:56 +00:00
hlopko
0698f10661 Introduce EmbedderReachableReferenceReporter
This cl introduces reporter to the embedder heap tracer. Heap tracer uses
reporter to report reachable objects from embedder heap. This refactoring is a
step towards being able to take heap snapshots with wrapper tracing.

LOG=no
BUG=468240

Review-Url: https://codereview.chromium.org/2371733002
Cr-Commit-Position: refs/heads/master@{#39824}
2016-09-28 12:55:12 +00:00
ulan
82dcb2beee [API] Remove deprecated WeakCallbackData and related functions.
This removes:
- PersistentBase::SetWeak that takes WeakCallbackData.
  The embedders should use the version that takes WeakCallbackInfo.
- PersistentBase::SetPhantom.
  The embedders should SetWeak that takes WeakCallbackInfo.

Functions in DefaultPersistentValueMapTraits are changed to accept
WeakCallbackInfo instead of WeakCallbackData.

BUG=chromium:609808
LOG=NO

Review-Url: https://codereview.chromium.org/1953263002
Cr-Commit-Position: refs/heads/master@{#36079}
2016-05-06 13:18:07 +00:00
hlopko
b605482600 Add RegisterExternallyReferencedObject to PersistenValueMap
PersistentValueMap is used to hold per-world wrappers in the blink. Currently,
when we trace wrappers, we visit wrappers in all worlds via this PersistentValueMap. This cl introduces convenient (and faster) way of registering these external references.

BUG=468240
LOG=no

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

Cr-Commit-Position: refs/heads/master@{#35523}
2016-04-15 12:23:48 +00:00
mstarzinger
92e85aed10 [presubmit] Fix build/include linter violations.
R=bmeurer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#30554}
2015-09-03 07:56:14 +00:00
epertoso
e6e53390cc Let the second pass phantom callbacks run in a separate task on the foreground thread.
R=jochen@chromium.org
LOG=y
BUG=

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

Cr-Commit-Position: refs/heads/master@{#29680}
2015-07-15 12:26:11 +00:00
dcarney
8a9fe731fb add StdGlobalValueMap
BUG=

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

Cr-Commit-Position: refs/heads/master@{#27994}
2015-04-22 09:17:34 +00:00
dcarney
e7ba4791e5 simplify GlobalValueMap calls to DisposeWeak
BUG=

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

Cr-Commit-Position: refs/heads/master@{#27750}
2015-04-10 13:40:31 +00:00
dcarney
2455aadf7b two pass phantom collection
R=jochen@chromium.org, erikcorry@chromium.org

BUG=

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

Cr-Commit-Position: refs/heads/master@{#27475}
2015-03-26 11:50:28 +00:00
dcarney
adeb82ef23 fix disposal of phantom handles in GlobalValueMap
additionally, add a drive by fix to WeakCallbackInfo

R=jochen@chromium.org, erikcorry@chromium.org

BUG=

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

Cr-Commit-Position: refs/heads/master@{#27407}
2015-03-24 13:22:15 +00:00
dcarney
60c1ad026d remove phantom naming from the api
since the old style weakness is slated for removal, we might as well reuse the name to limit confusion.  additionally I simplified the callback type to a enum to either get internal field values or not

this should be a non-breaking change with the exception of PhantomPersistentValueMap, which is unused.

R=jochen@chromium.org, erikcorry@chromium.org

BUG=

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

Cr-Commit-Position: refs/heads/master@{#27084}
2015-03-09 21:48:09 +00:00
erikcorry
8c58ed1a0c Support old and new weak handle API
R=dcarney@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#26246}
2015-01-23 11:28:54 +00:00
svenpanne@chromium.org
e02158e8c1 Make presubmit script happy again.
No clue why this seems to be an issue only for me, though...

R=bmeurer@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21735 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-06-10 09:24:00 +00:00
vogelheim@chromium.org
06086a90e0 Fix the "PersistentValueMap" memory leak reported here:
http://build.chromium.org/p/client.v8/builders/V8%20Linux64%20ASAN

The bug:
The code assumed that a weak Persistent whose weak callback is being
called would still be weak. That isn't true since the persistent is
un-weakened by the garbage collector before calling the weak callback. [1]

Specifically, PersistentValueMap would funnel all 'remove' actions
through its Release method, which uses PersistentBase::ClearWeak to
obtain the callback data. [2] For 'removes' caused by the weak callback,
ClearWeak always returns a NULL-pointer since by that time the weak
persistent was already un-weakend. The result was a memory leak in
the test, since the code to delete the weak callback data would
delete NULL.

The fix:
I explicity call Traits::DisposeCallbackData from the weak callback
with the data obtained from the v8::WeakCallbackData. To avoid invalid
calls to DisposeCallbackData, I also check whether this instance is
(still) weak before calling it. (That check could easily be elided
if it's expensive, for the price of having two 'remove' code paths.)

Severety:
Probably low. At least in Chromium, noone uses the API in a way to
trigger this; only the test does.

[1] https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/global-handles.cc&q=global-handles.cc&sq=package:chromium&type=cs&l=231
[2] https://code.google.com/p/chromium/codesearch#chromium/src/v8/include/v8-util.h&sq=package:chromium&l=332-345

R=dcarney@chromium.org, dcarney

BUG=

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21514 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-05-27 09:31:06 +00:00
ishell@chromium.org
ff2d004f85 Presubmit checks recover:
1) runtime/references checks temporarily disabled (56 items left)
2) other errors fixed

R=jkummerow@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21222 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-05-09 12:59:24 +00:00
bmeurer@chromium.org
d4b533d41b Bulk update of Google copyright headers in source files.
R=svenpanne@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@21035 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-04-29 06:42:26 +00:00
vogelheim@chromium.org
ebe0c79594 Remove V8_INLINE from v8-util.h.
(These have been causing compilation problems on some
platforms. For VS, V8_INLINE turns into 'force inline',
which will then cause a problem when the compiler won't
actually inline. Search for "C4714 warning" for details.)

BUG=
R=jochen@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20432 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-04-02 12:07:10 +00:00
jochen@chromium.org
5838d03291 Remove V8_INLINE to prevent C4714 warning under Win64.
BUG=
R=jochen@chromium.org

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

Patch from Daniel Vogelheim <vogelheim@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20412 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-04-01 18:04:06 +00:00
dcarney@chromium.org
8b304a6832 Implement PersistentValueVector, analogous to PersistentValueMap.
BUG=
R=dcarney@chromium.org

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

Patch from Daniel Vogelheim <vogelheim@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20341 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-31 10:03:20 +00:00
marja@chromium.org
6730ec8433 Amend PersistentValueMap:
- Use the surrounding map (instead of Traits::Impl) for weak callback.
- Provide for a fast reference to a mapped value.
- Restructure Traits to accomondate for the first point above.

[Why?] As discussed, I proceeded to replace Impl with the map.
The problem I encountered with that version is that now the
Traits class depends on itself: The weak-related methods require the
map type in their signature. But the map type includes the Traits class
and hence the Traits class method signatures depend on the specific Traits class. That
makes them practically un-derivable: While you can derive a Traits class
from another one, since the compiler now expects methods with a different
signature. To accommodate, I pulled the dispose traits into the weak traits
class. I also removed the Impl*/MapType* parameter from the Dispose call,
since no implementation seems to need it.

R=dcarney@chromium.org
BUG=

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

Patch from Daniel Vogelheim <vogelheim@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20326 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-28 09:35:50 +00:00
dcarney@chromium.org
99b115b120 Provide default traits for PersistentValueMap
Re-try of issue 201643003. This caused linker errors on Win64, since the
linker insists on seeing the StrongMapTrait method implementations even
though they are never used. This will provide default implementations
for them.

R=dcarney@chromium.org

BUG=

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

Patch from Daniel Vogelheim <vogelheim@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20084 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-19 15:35:02 +00:00
yangguo@chromium.org
0dd31685f0 Revert "First attempt at providing default traits for PersistentValueMap."
This reverts r20038.

TBR=vogelheim@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20042 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-18 16:32:39 +00:00
dcarney@chromium.org
6deb7b0db4 First attempt at providing default traits for PersistentValueMap.
BUG=
R=dcarney@chromium.org

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

Patch from Daniel Vogelheim <vogelheim@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20038 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-18 15:01:12 +00:00
dcarney@chromium.org
45ffad09d8 Move PersitentValueMap into seperate header, to avoid excessive polution
of v8.h.

R=dcarney@chromium.org
BUG=

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

Patch from Daniel Vogelheim <vogelheim@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19936 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-14 14:57:04 +00:00