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

Unified Diff: include/v8.h

Issue 2233683002: Add kGCCallbackFlagCollectAllExternalMemory for external memory limit triggered gc (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | src/heap/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 69bf17c33e5c901609e76e4af509c970cac5aab5..539bd410b1cf06c2063861c9a442605525d527c4 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -5238,6 +5238,7 @@ enum GCCallbackFlags {
kGCCallbackFlagForced = 1 << 2,
kGCCallbackFlagSynchronousPhantomCallbackProcessing = 1 << 3,
kGCCallbackFlagCollectAllAvailableGarbage = 1 << 4,
+ kGCCallbackFlagCollectAllExternalMemory = 1 << 5,
};
typedef void (*GCCallback)(GCType type, GCCallbackFlags flags);
@@ -8794,11 +8795,14 @@ int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
typedef internal::Internals I;
int64_t* external_memory = reinterpret_cast<int64_t*>(
reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryOffset);
- const int64_t external_memory_limit = *reinterpret_cast<int64_t*>(
+ int64_t* external_memory_limit = reinterpret_cast<int64_t*>(
reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryLimitOffset);
const int64_t amount = *external_memory + change_in_bytes;
*external_memory = amount;
- if (change_in_bytes > 0 && amount > external_memory_limit) {
+ if (amount + 192 * 1024 * 1024 < *external_memory_limit) {
Michael Lippautz 2016/08/12 07:06:23 Can we avoid polluting the API and instead adjust
+ *external_memory_limit = amount + 192 * 1024 * 1024;
Hannes Payer (out of office) 2016/08/12 14:06:09 Why are you shrinking the limit here?
+ }
+ if (change_in_bytes > 0 && amount > *external_memory_limit) {
ReportExternalAllocationLimitReached();
}
return *external_memory;
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698