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

Unified Diff: src/heap/heap.cc

Issue 1344823002: Version 4.6.85.17 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.6
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index b0f44dc3829d7c4181e74b59485c2bfed8ff1340..e3cf13673f54db6bd747485a27a4d3c102c333a4 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -1847,6 +1847,9 @@ void Heap::RegisterNewArrayBuffer(bool in_new_space, void* data,
RegisterNewArrayBufferHelper(live_array_buffers_for_scavenge_, data,
length);
}
+
+ // We may go over the limit of externally allocated memory here. We call the
+ // api function to trigger a GC in this case.
reinterpret_cast<v8::Isolate*>(isolate_)
->AdjustAmountOfExternalAllocatedMemory(length);
}
@@ -1889,16 +1892,13 @@ void Heap::FreeDeadArrayBuffers(bool from_scavenge) {
live_array_buffers_for_scavenge_.erase(buffer.first);
}
}
- size_t freed_memory = FreeDeadArrayBuffersHelper(
+
+ // Do not call through the api as this code is triggered while doing a GC.
+ amount_of_external_allocated_memory_ -= FreeDeadArrayBuffersHelper(
isolate_,
from_scavenge ? live_array_buffers_for_scavenge_ : live_array_buffers_,
from_scavenge ? not_yet_discovered_array_buffers_for_scavenge_
: not_yet_discovered_array_buffers_);
- if (freed_memory) {
- reinterpret_cast<v8::Isolate*>(isolate_)
- ->AdjustAmountOfExternalAllocatedMemory(
- -static_cast<int64_t>(freed_memory));
- }
}
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698