Inlined everything, thank you again!
(Sorry, going to sleep now. Hope it looks good now ;) )
https://codereview.chromium.org/1316873004/diff/1/src/heap/heap.cc
File src/heap/heap.cc (right):
https://codereview.chromium.org/1316873004/diff/1/src/heap/heap.cc#newcode1739
src/heap/heap.cc:1739: void
Heap::RegisterNewArrayBufferHelper(std::map<void*, size_t>&
live_buffers,
On 2015/08/28 08:05:02, Michael Lippautz wrote:
Please get rid of this function and inline it into
RegisterNewArrayBuffer.
Acknowledged.
https://codereview.chromium.org/1316873004/diff/1/src/heap/heap.cc#newcode1745
src/heap/heap.cc:1745: void Heap::UnregisterArrayBufferHelper(
On 2015/08/28 08:05:02, Michael Lippautz wrote:
Ditto, please inline the call manually.
Acknowledged.
https://codereview.chromium.org/1316873004/diff/1/src/heap/heap.cc#newcode1754
src/heap/heap.cc:1754: void Heap::RegisterLiveArrayBufferHelper(
On 2015/08/28 08:05:02, Michael Lippautz wrote:
Please get rid of this function and inline it into
RegisterLiveArrayBuffer.
Acknowledged.
https://codereview.chromium.org/1316873004/diff/1/src/heap/heap.cc#newcode1760
src/heap/heap.cc:1760: size_t Heap::FreeDeadArrayBuffersHelper(
On 2015/08/28 08:05:02, Michael Lippautz wrote:
We should get rid of this one. See below.
Acknowledged.
https://codereview.chromium.org/1316873004/diff/1/src/heap/heap.cc#newcode1784
src/heap/heap.cc:1784: void Heap::TearDownArrayBuffersHelper(
On 2015/08/28 08:05:02, Michael Lippautz wrote:
Also inline please.
Acknowledged.
https://codereview.chromium.org/1316873004/diff/1/src/heap/heap.cc#newcode1834
src/heap/heap.cc:1834: void Heap::FreeDeadArrayBuffers(bool
from_scavenge) {
On 2015/08/28 08:05:02, Michael Lippautz wrote:
The logic here is way too complicated as the semantic is to maintain
two
distinct sets for array buffers.
I inlined, reshuffled and consolidated the calls. I think we should
get rid of
the helper method as the actual logic seems to be pretty simple.
Please check the simplification. I am using .erase() with buffers
(there exists
an overload that takes a map). The loops (over maps) get unfolded into
a single
loop in the last step.
======== Step 0 (baseline; inlined FreeDeadArrayBuffersHelper call
from patch)
========
FreeDeadArrayBuffers(from_scavenge):
if from_scavenge:
not_yet_discovered_array_buffers_.erase(not_yet_discovered_array_buffers_for_scavenge_)
else:
live_array_buffers_for_scavenge_.erase(not_yet_discovered_array_buffers_)
# inlined FreeDeadArrayBuffersHelper
# parameters are unfolded here
if from_scavenge:
not_yet_discovered_buffers =
not_yet_discovered_array_buffers_for_scavenge_
else:
not_yet_discovered_buffers = not_yet_discovered_array_buffers_
for buffer in not_yet_discovered_buffers:
isolate.free_array_buffer(buffer)
if (!from_scavenge):
live_array_buffers_.erase(buffer)
live_array_buffers_for_scavenge_.erase(buffer)
if (from_scavenge):
not_yet_discovered_buffers = live_array_buffers_for_scavenge_;
else:
not_yet_discovered_buffers = live_array_buffers_;
not_yet_discovered_buffers.insert(live_array_buffers_for_scavenge.begin(),
...end())
======== Step 1 (shuffle inlined stuff around) ========
FreeDeadArrayBuffers(from_scavenge):
if from_scavenge:
not_yet_discovered_array_buffers_.erase(not_yet_discovered_array_buffers_for_scavenge_)
not_yet_discovered_buffers =
not_yet_discovered_array_buffers_for_scavenge_
live_array_buffers_for_scavenge_.erase(not_yet_discovered_buffers)
else:
live_array_buffers_for_scavenge_.erase(not_yet_discovered_array_buffers_)
not_yet_discovered_buffers = not_yet_discovered_array_buffers_
live_array_buffers_for_scavenge_.erase(not_yet_discovered_buffers)
live_array_buffers_.erase(not_yet_discovered_buffers)
# rest of inlined FreeDeadArrayBuffersHelper
for buffer in not_yet_discovered_buffers:
isolate.free_array_buffer(buffer)
if (from_scavenge):
not_yet_discovered_buffers = live_array_buffers_for_scavenge_;
else:
not_yet_discovered_buffers = live_array_buffers_;
not_yet_discovered_buffers.insert(live_array_buffers_for_scavenge_)
======== Step 2 (re-orde / remove duplicates) ========
FreeDeadArrayBuffers(from_scavenge):
if from_scavenge:
tmp_not_yet_discovered_buffers =
not_yet_discovered_array_buffers_for_scavenge_
not_yet_discovered_array_buffers_.erase((tmp_not_yet_discovered_buffers)
live_array_buffers_for_scavenge_.erase(tmp_not_yet_discovered_buffers)
else:
tmp_not_yet_discovered_buffers = not_yet_discovered_array_buffers_
live_array_buffers_for_scavenge_.erase(tmp_not_yet_discovered_buffers)
live_array_buffers_.erase(tmp_not_yet_discovered_buffers)
# rest of inlined FreeDeadArrayBuffersHelper
for buffer in tmp_not_yet_discovered_buffers:
isolate.free_array_buffer(buffer)
if (from_scavenge):
not_yet_discovered_buffers = live_array_buffers_for_scavenge_;
else:
not_yet_discovered_buffers = live_array_buffers_;
not_yet_discovered_buffers.insert(live_array_buffers_for_scavenge_)
======== Step 3 (consolidate into a single loop) ========
FreeDeadArrayBuffers(from_scavenge):
if from_scavenge:
tmp_not_yet_discovered_buffers =
not_yet_discovered_array_buffers_for_scavenge_
else:
tmp_not_yet_discovered_buffers = not_yet_discovered_array_buffers_
for buffer in tmp_not_yet_discovered_buffers:
isolate.free_array_buffer(buffer)
live_array_buffers_for_scavenge_.erase(buffer)
if (from_scavenge):
not_yet_discovered_array_buffers_.erase(buffer)
else:
live_array_buffers_.erase(tmp_not_yet_discovered_buffers)
if (from_scavenge):
not_yet_discovered_buffers = live_array_buffers_for_scavenge_;
else:
not_yet_discovered_buffers = live_array_buffers_;
not_yet_discovered_buffers.insert(live_array_buffers_for_scavenge_)
Acknowledged.
https://codereview.chromium.org/1316873004/
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.