Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Issue 7031005: Extend Handle API with MarkIndependent. (Closed)

Created:
9 years, 7 months ago by Vyacheslav Egorov (Chromium)
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

Extend Handle API with MarkIndependent. Garbage collector is free to ignore object groups for independent handles and can collect then in minor collections. Committed: http://code.google.com/p/v8/source/detail?r=7915

Patch Set 1 #

Total comments: 30

Patch Set 2 : partially fixed Vitaly's and Anton's comments #

Patch Set 3 : remove default clause #

Total comments: 3

Patch Set 4 : do not process PENDING dependent handles after SCAVENGE #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+189 lines, -44 lines) Patch
M include/v8.h View 1 3 chunks +12 lines, -0 lines 2 comments Download
M src/api.cc View 1 chunk +7 lines, -0 lines 0 comments Download
M src/global-handles.h View 1 2 3 4 chunks +14 lines, -1 line 0 comments Download
M src/global-handles.cc View 1 2 3 8 chunks +60 lines, -2 lines 0 comments Download
M src/heap.cc View 1 2 3 5 chunks +28 lines, -9 lines 0 comments Download
M src/mark-compact.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/v8globals.h View 2 chunks +8 lines, -1 line 0 comments Download
M test/cctest/test-api.cc View 1 1 chunk +59 lines, -30 lines 5 comments Download

Messages

Total messages: 14 (0 generated)
Vyacheslav Egorov (Chromium)
9 years, 7 months ago (2011-05-16 13:10:21 UTC) #1
Vyacheslav Egorov (Chromium)
fyi: +iposva, +vitalyr
9 years, 7 months ago (2011-05-16 13:11:05 UTC) #2
Vitaly Repeshko
Almost LG, but we should be more careful with nasty callbacks that can trigger GC. ...
9 years, 7 months ago (2011-05-16 13:42:11 UTC) #3
antonm
DBC Overall, independent doesn't look like a very good name to me. Something like early ...
9 years, 7 months ago (2011-05-16 14:13:19 UTC) #4
Vyacheslav Egorov (Chromium)
Thanks for looking at this Vitaly. My replies inline. http://codereview.chromium.org/7031005/diff/1/include/v8.h File include/v8.h (right): http://codereview.chromium.org/7031005/diff/1/include/v8.h#newcode392 include/v8.h:392: ...
9 years, 7 months ago (2011-05-16 14:15:46 UTC) #5
Vitaly Repeshko
http://codereview.chromium.org/7031005/diff/1/include/v8.h File include/v8.h (right): http://codereview.chromium.org/7031005/diff/1/include/v8.h#newcode392 include/v8.h:392: * is free to ignore any object groups containing ...
9 years, 7 months ago (2011-05-16 14:31:22 UTC) #6
Vyacheslav Egorov (Chromium)
Anton thanks for driving by. I have addressed some of your and Vitaly's comments. http://codereview.chromium.org/7031005/diff/1/include/v8.h ...
9 years, 7 months ago (2011-05-16 14:55:34 UTC) #7
Vitaly Repeshko
http://codereview.chromium.org/7031005/diff/1/include/v8.h File include/v8.h (right): http://codereview.chromium.org/7031005/diff/1/include/v8.h#newcode392 include/v8.h:392: * is free to ignore any object groups containing ...
9 years, 7 months ago (2011-05-16 15:04:03 UTC) #8
Vyacheslav Egorov (Chromium)
http://codereview.chromium.org/7031005/diff/1/src/heap.cc File src/heap.cc (right): http://codereview.chromium.org/7031005/diff/1/src/heap.cc#newcode777 src/heap.cc:777: isolate_->global_handles()->PostGarbageCollectionProcessing(); On 2011/05/16 15:04:03, Vitaly Repeshko wrote: > On ...
9 years, 7 months ago (2011-05-16 15:19:58 UTC) #9
antonm
http://codereview.chromium.org/7031005/diff/1/src/global-handles.cc File src/global-handles.cc (right): http://codereview.chromium.org/7031005/diff/1/src/global-handles.cc#newcode330 src/global-handles.cc:330: Handle<Object> GlobalHandles::Create(Object* value) { Sorry, missed this one. On ...
9 years, 7 months ago (2011-05-16 15:20:44 UTC) #10
Vyacheslav Egorov (Chromium)
http://codereview.chromium.org/7031005/diff/2003/test/cctest/test-api.cc File test/cctest/test-api.cc (right): http://codereview.chromium.org/7031005/diff/2003/test/cctest/test-api.cc#newcode4472 test/cctest/test-api.cc:4472: obj.Dispose(); On 2011/05/16 15:20:44, antonm wrote: > this slightly ...
9 years, 7 months ago (2011-05-16 15:29:44 UTC) #11
antonm
http://codereview.chromium.org/7031005/diff/2003/test/cctest/test-api.cc File test/cctest/test-api.cc (right): http://codereview.chromium.org/7031005/diff/2003/test/cctest/test-api.cc#newcode4472 test/cctest/test-api.cc:4472: obj.Dispose(); Sorry, I was wrong in my assumption. On ...
9 years, 7 months ago (2011-05-16 15:48:23 UTC) #12
Vitaly Repeshko
LGTM with a few final comments. http://codereview.chromium.org/7031005/diff/1/src/heap.cc File src/heap.cc (right): http://codereview.chromium.org/7031005/diff/1/src/heap.cc#newcode1037 src/heap.cc:1037: isolate_->global_handles()->IdentifyWeakIndependentHandles( On 2011/05/16 ...
9 years, 7 months ago (2011-05-16 21:40:37 UTC) #13
Vyacheslav Egorov (Chromium)
9 years, 7 months ago (2011-05-17 11:55:31 UTC) #14
Thanks, Vitaly & Anton!

I'll be landing.

http://codereview.chromium.org/7031005/diff/1/src/heap.cc
File src/heap.cc (right):

http://codereview.chromium.org/7031005/diff/1/src/heap.cc#newcode1037
src/heap.cc:1037: isolate_->global_handles()->IdentifyWeakIndependentHandles(
On 2011/05/16 21:40:37, Vitaly Repeshko wrote:
> On 2011/05/16 14:55:34, Vyacheslav Egorov wrote:
> > On 2011/05/16 14:31:22, Vitaly Repeshko wrote:
> > > On 2011/05/16 14:15:46, Vyacheslav Egorov wrote:
> > > > On 2011/05/16 13:42:11, Vitaly Repeshko wrote:
> > > > > Scanning the linked list of handles was really slow in some
benchmarks.
> We
> > > > > should merge these two passes because the scavenges should be as fast
as
> > > > > possible.
> > > > 
> > > > If there are two weak handles that point to the same object them both
> should
> > > > have their callbacks called.
> > > > 
> > > > Thus merging these two passes together would require additional mark
> > somewhere
> > > > on the object to distinguish objects evacuated by normal scavenging and
> > > objects
> > > > evacuated by scavenging of weak independent handles. We probably can use
> the
> > > > second bit from map word but this would complicate things.
> > > 
> > > Ahh, this is annoying. Can we at least inline the "identify" callback?
> > 
> > To inline identify callback we need to move IdentifyWeakIndependentHandles
> into
> > global-handles-inl.h.
> > 
> > I can do that but I really think it's premature optimization. I have not
seen
> > any significant degradation on a test that had dozens of thousands of
> > independent handles created and destroyed every second.
> > 
> > Alternatively we can have separate lists for independent and dependent
handles
> > so we will not pay anything for dependent handles when we don't need to
> iterate
> > over them.
> 
> I do remember seeing scavenge time increase when I experimented with a similar
> approach for DOM nodes. But it was more than a year ago.
> 
> I've got an idea on how to merge the passes: we can detect when an object was
> evacuated by comparing its forwarded address with a saved new space top.
> 
> Feel free to postpone doing this (if it works at all) or other optimizations.

Very neat! But unfortunately will not work for promoted objects as they have no
imposed linear order. 

I will postpone optimization.

http://codereview.chromium.org/7031005/diff/8001/include/v8.h
File include/v8.h (right):

http://codereview.chromium.org/7031005/diff/8001/include/v8.h#newcode392
include/v8.h:392: * is free to ignore any object groups containing this object.
On 2011/05/16 21:40:37, Vitaly Repeshko wrote:
> I still think this comment should be updated.

Done.

http://codereview.chromium.org/7031005/diff/8001/test/cctest/test-api.cc
File test/cctest/test-api.cc (right):

http://codereview.chromium.org/7031005/diff/8001/test/cctest/test-api.cc#newc...
test/cctest/test-api.cc:4487: THREADED_TEST(GCFromWeakCallbacks) {
On 2011/05/16 21:40:37, Vitaly Repeshko wrote:
> Please add a test where an independent weak callback makes an object live
again.

Done.

http://codereview.chromium.org/7031005/diff/8001/test/cctest/test-api.cc#newc...
test/cctest/test-api.cc:4513: 
On 2011/05/16 21:40:37, Vitaly Repeshko wrote:
> nit: Remove extra blank line.

Done.

Powered by Google App Engine
This is Rietveld 408576698