Reviewers: jochen (slow),
Description:
Always adjust amount of external memory when change is reported.
BUG=
Please review this at https://codereview.chromium.org/866413002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+7, -2 lines):
M include/v8.h
M test/cctest/test-api.cc
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index
7a838d81030d12d2cb135f964071784424c56ecc..3a5b60d0820f029e05ba3fc9b978dde5713efde8
100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -7309,9 +7309,8 @@ int64_t
Isolate::AdjustAmountOfExternalAllocatedMemory(
amount - *amount_of_external_allocated_memory_at_last_global_gc >
I::kExternalAllocationLimit) {
CollectAllGarbage("external memory allocation limit reached.");
- } else {
- *amount_of_external_allocated_memory = amount;
}
+ *amount_of_external_allocated_memory = amount;
return *amount_of_external_allocated_memory;
}
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index
4d39aa543d6f79e96d1e5879f94d53638e1eebc4..1f39fe70b0a924eb6c4e02c7d48189f61da454a6
100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -15199,6 +15199,12 @@ THREADED_TEST(ExternalAllocatedMemory) {
isolate->AdjustAmountOfExternalAllocatedMemory(kSize));
CHECK_EQ(baseline,
isolate->AdjustAmountOfExternalAllocatedMemory(-kSize));
+ const int64_t kTriggerGCSize =
+ v8::internal::Internals::kExternalAllocationLimit + 1;
+ CHECK_EQ(baseline + v8::internal::Internals::kExternalAllocationLimit,
+ isolate->AdjustAmountOfExternalAllocatedMemory(kTriggerGCSize));
+ CHECK_EQ(baseline,
+
isolate->AdjustAmountOfExternalAllocatedMemory(-kTriggerGCSize));
}
--
--
v8-dev mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.