Chromium Code Reviews
Help | Chromium Project | Gerrit Changes | Sign in
(72)

Issue 1098953006: Oilpan: Support polymorphic objects in HeapVectorBackings (Closed)

Created:
5 years ago by haraken
Modified:
4 years, 11 months ago
Reviewers:
oilpan-reviews, tkent, sof
CC:
blink-reviews, Mads Ager (chromium), oilpan-reviews, blink-reviews-wtf_chromium.org, aandrey+blink_chromium.org, kouhei+heap_chromium.org, Mikhail
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Oilpan: Support polymorphic objects in HeapVectorBackings This CL supports HeapVector<T> where T is ALLOW_ONLY_INLINE_ALLOCATION and T has a vtable. The way we support it is somewhat hacky: 1) VectorUnusedSlotClearer zeros out unused slots. 2) HeapVectorBacking calls finalizers and trace methods only for slots that are not zeroed out if T has a vtable. That way we can avoid HeapVectorBacking from visiting unused slots. Note: For T that doesn't have a vtable, HeapVectorBacking visits all objects (including unused slots) treating a zeroed slot as a valid object. This works as long as T is canInitializeWithMemset. This means that after this CL, HeapVector can support objects that are canInitializeWithMemset or have a vtable. This CL adds a static_assert about it to Heap.h. BUG=475801 TEST=HeapTest.VectorDestructorsWithVtable TBR=tkent Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=194780

Patch Set 1 #

Patch Set 2 : #

Total comments: 5

Patch Set 3 : #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+134 lines, -27 lines) Patch
M Source/platform/heap/Heap.h View 1 2 4 chunks +44 lines, -21 lines 0 comments Download
M Source/platform/heap/Heap.cpp View 1 1 chunk +0 lines, -5 lines 0 comments Download
M Source/platform/heap/HeapTest.cpp View 1 3 chunks +89 lines, -0 lines 0 comments Download
M Source/wtf/Vector.h View 1 2 1 chunk +1 line, -1 line 3 comments Download

Messages

Total messages: 16 (5 generated)
haraken
Not yet for review. I need to land https://codereview.chromium.org/1088973006/ first. I understand this CL is ...
5 years ago (2015-04-24 10:06:57 UTC) #2
haraken
PTAL I agree that this is hacky, but I cannot come up with any alternative ...
5 years ago (2015-04-27 06:57:57 UTC) #3
haraken
The bot looks fine. Is anyone willing to look at this CL?
5 years ago (2015-04-30 13:56:32 UTC) #4
sof
lgtm to try (but non-owner for wtf/Vector.h) https://codereview.chromium.org/1098953006/diff/20001/Source/platform/heap/Heap.h File Source/platform/heap/Heap.h (left): https://codereview.chromium.org/1098953006/diff/20001/Source/platform/heap/Heap.h#oldcode2193 Source/platform/heap/Heap.h:2193: // HeapVectorBacking ...
5 years ago (2015-04-30 21:15:47 UTC) #6
haraken
Thanks for review! https://codereview.chromium.org/1098953006/diff/20001/Source/platform/heap/Heap.h File Source/platform/heap/Heap.h (left): https://codereview.chromium.org/1098953006/diff/20001/Source/platform/heap/Heap.h#oldcode2193 Source/platform/heap/Heap.h:2193: // HeapVectorBacking does not know the ...
5 years ago (2015-04-30 23:40:20 UTC) #8
haraken
TBRing tkent-san for wtf/.
5 years ago (2015-04-30 23:40:31 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1098953006/40001
5 years ago (2015-04-30 23:40:53 UTC) #12
commit-bot: I haz the power
Committed patchset #3 (id:40001) as https://src.chromium.org/viewvc/blink?view=rev&revision=194780
5 years ago (2015-05-01 01:06:21 UTC) #13
tkent
https://codereview.chromium.org/1098953006/diff/40001/Source/wtf/Vector.h File Source/wtf/Vector.h (right): https://codereview.chromium.org/1098953006/diff/40001/Source/wtf/Vector.h#newcode93 Source/wtf/Vector.h:93: memset(reinterpret_cast<void*>(begin), 0, sizeof(T) * (end - begin)); Why do ...
4 years, 12 months ago (2015-05-07 00:43:21 UTC) #14
haraken
https://codereview.chromium.org/1098953006/diff/40001/Source/wtf/Vector.h File Source/wtf/Vector.h (right): https://codereview.chromium.org/1098953006/diff/40001/Source/wtf/Vector.h#newcode93 Source/wtf/Vector.h:93: memset(reinterpret_cast<void*>(begin), 0, sizeof(T) * (end - begin)); On 2015/05/07 ...
4 years, 12 months ago (2015-05-07 00:49:41 UTC) #15
tkent
4 years, 11 months ago (2015-05-08 06:42:00 UTC) #16
Message was sent while issue was closed.
https://codereview.chromium.org/1098953006/diff/40001/Source/wtf/Vector.h
File Source/wtf/Vector.h (right):

https://codereview.chromium.org/1098953006/diff/40001/Source/wtf/Vector.h#new...
Source/wtf/Vector.h:93: memset(reinterpret_cast<void*>(begin), 0, sizeof(T) *
(end - begin));
On 2015/05/07 00:49:40, haraken wrote:
> On 2015/05/07 00:43:21, Slow until end of May wrote:
> > Why do you do reinterpret_cast<>?
> 
> Because without the reinterpret_cast, clang complains that we should not use
> memset for slots that contain vtables. We use this technique to avoid the
> compile error in some places in platform/heap/.
> 

Thanks.  lgtm

Powered by Google App Engine
This is Rietveld 408576698