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

Issue 10448007: Split an allocation policy into an allocator and a deallocator. (Closed)

Created:
8 years, 7 months ago by sanjoy
Modified:
8 years, 6 months ago
CC:
v8-dev
Visibility:
Public.

Description

Split an allocation policy into an allocator and a deallocator. This refactoring will make way for passing around a Zone directly into methods that allocate from Zones. Besides saving a TLS access in some cases, we will later be able to decouple Zones from Isolates completely -- a first step towards running parts of the crankshaft pipeline concurrently without locking out the Isolate. BUG= TEST=

Patch Set 1 #

Patch Set 2 : Make TemplateHashMapImpl consistent with the rest of the approach. #

Total comments: 15

Patch Set 3 : Fixed the issues pointed out. #

Total comments: 3

Patch Set 4 : Merge Allocator and Deallocator and simplify. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+162 lines, -135 lines) Patch
M src/allocation.h View 1 2 3 3 chunks +7 lines, -7 lines 0 comments Download
M src/allocation-inl.h View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M src/full-codegen.h View 1 1 chunk +3 lines, -4 lines 0 comments Download
M src/hashmap.h View 1 2 3 13 chunks +43 lines, -36 lines 0 comments Download
M src/isolate.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M src/isolate.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M src/list.h View 1 2 3 5 chunks +36 lines, -18 lines 0 comments Download
M src/list-inl.h View 1 2 3 6 chunks +19 lines, -19 lines 0 comments Download
M src/splay-tree.h View 1 2 3 4 chunks +17 lines, -12 lines 0 comments Download
M src/splay-tree-inl.h View 1 2 3 3 chunks +10 lines, -7 lines 0 comments Download
M src/string-stream.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M src/v8.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/v8globals.h View 1 chunk +1 line, -1 line 0 comments Download
M src/zone.h View 1 2 3 3 chunks +16 lines, -21 lines 0 comments Download
M src/zone-inl.h View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M test/cctest/test-list.cc View 1 2 3 1 chunk +2 lines, -3 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
sanjoy
8 years, 7 months ago (2012-05-24 13:27:23 UTC) #1
sanjoy
8 years, 7 months ago (2012-05-25 09:38:46 UTC) #2
danno
http://chromiumcodereview.appspot.com/10448007/diff/3001/src/list.h File src/list.h (right): http://chromiumcodereview.appspot.com/10448007/diff/3001/src/list.h#newcode52 src/list.h:52: typedef typename P::Alloc Allocator; AllocationPolicy instead of P http://chromiumcodereview.appspot.com/10448007/diff/3001/src/splay-tree-inl.h ...
8 years, 7 months ago (2012-05-25 11:03:37 UTC) #3
sanjoy1
http://chromiumcodereview.appspot.com/10448007/diff/3001/src/splay-tree.h File src/splay-tree.h (right): http://chromiumcodereview.appspot.com/10448007/diff/3001/src/splay-tree.h#newcode128 src/splay-tree.h:128: UNREACHABLE(); On 2012/05/25 11:03:37, danno wrote: > Why unreachable? ...
8 years, 7 months ago (2012-05-25 20:32:44 UTC) #4
danno
Please also run out performance regression tests to make sure this is performance neutral. http://chromiumcodereview.appspot.com/10448007/diff/10001/src/splay-tree-inl.h ...
8 years, 6 months ago (2012-05-31 11:03:35 UTC) #5
Vyacheslav Egorov (Google)
8 years, 6 months ago (2012-05-31 12:07:58 UTC) #6
DBC: I don't think decoupling things that are tightly coupled (ike allocation
and deallocation) into separate classes is the right way.

One simple approach would be to have a single allocator classes with interface
like:

class SomeAllocator {
 INLINE(void* New(size_t size));
 INLINE(static void Delete(void* p));
};

And parameterize our containers with it. If Allocator needs any booking data to
correctly free p it will prepend it to the allocated data in a regular fashion
(that is it will allocate sizeof(BookKeeping) + size more for each object, etc).

Such approach seems more natural from the memory management perspective then
having completely disjoint Allocator/Deallocator that are then united into
Policy.

Powered by Google App Engine
This is Rietveld 408576698