summaryrefslogtreecommitdiff
path: root/deps/v8/src/zone
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2018-03-07 08:54:53 +0100
committerMichaël Zasso <targos@protonmail.com>2018-03-07 16:48:52 +0100
commit88786fecff336342a56e6f2e7ff3b286be716e47 (patch)
tree92e6ba5b8ac8dae1a058988d20c9d27bfa654390 /deps/v8/src/zone
parent4e86f9b5ab83cbabf43839385bf383e6a7ef7d19 (diff)
downloadandroid-node-v8-88786fecff336342a56e6f2e7ff3b286be716e47.tar.gz
android-node-v8-88786fecff336342a56e6f2e7ff3b286be716e47.tar.bz2
android-node-v8-88786fecff336342a56e6f2e7ff3b286be716e47.zip
deps: update V8 to 6.5.254.31
PR-URL: https://github.com/nodejs/node/pull/18453 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'deps/v8/src/zone')
-rw-r--r--deps/v8/src/zone/accounting-allocator.cc8
-rw-r--r--deps/v8/src/zone/zone-containers.h5
-rw-r--r--deps/v8/src/zone/zone.cc9
-rw-r--r--deps/v8/src/zone/zone.h7
4 files changed, 21 insertions, 8 deletions
diff --git a/deps/v8/src/zone/accounting-allocator.cc b/deps/v8/src/zone/accounting-allocator.cc
index ee841fb4af..8ef141b4c1 100644
--- a/deps/v8/src/zone/accounting-allocator.cc
+++ b/deps/v8/src/zone/accounting-allocator.cc
@@ -10,6 +10,8 @@
#include <malloc.h> // NOLINT
#endif
+#include "src/allocation.h"
+
namespace v8 {
namespace internal {
@@ -82,11 +84,7 @@ Segment* AccountingAllocator::GetSegment(size_t bytes) {
}
Segment* AccountingAllocator::AllocateSegment(size_t bytes) {
- void* memory = malloc(bytes);
- if (memory == nullptr) {
- V8::GetCurrentPlatform()->OnCriticalMemoryPressure();
- memory = malloc(bytes);
- }
+ void* memory = AllocWithRetry(bytes);
if (memory != nullptr) {
base::AtomicWord current =
base::Relaxed_AtomicIncrement(&current_memory_usage_, bytes);
diff --git a/deps/v8/src/zone/zone-containers.h b/deps/v8/src/zone/zone-containers.h
index 78d25cc644..5e9fd0440a 100644
--- a/deps/v8/src/zone/zone-containers.h
+++ b/deps/v8/src/zone/zone-containers.h
@@ -41,6 +41,11 @@ class ZoneVector : public std::vector<T, ZoneAllocator<T>> {
ZoneVector(size_t size, T def, Zone* zone)
: std::vector<T, ZoneAllocator<T>>(size, def, ZoneAllocator<T>(zone)) {}
+ // Constructs a new vector and fills it with the contents of the given
+ // initializer list.
+ ZoneVector(std::initializer_list<T> list, Zone* zone)
+ : std::vector<T, ZoneAllocator<T>>(list, ZoneAllocator<T>(zone)) {}
+
// Constructs a new vector and fills it with the contents of the range
// [first, last).
template <class InputIt>
diff --git a/deps/v8/src/zone/zone.cc b/deps/v8/src/zone/zone.cc
index de8146de05..470f4c4177 100644
--- a/deps/v8/src/zone/zone.cc
+++ b/deps/v8/src/zone/zone.cc
@@ -42,7 +42,8 @@ const size_t kASanRedzoneBytes = 0;
} // namespace
-Zone::Zone(AccountingAllocator* allocator, const char* name)
+Zone::Zone(AccountingAllocator* allocator, const char* name,
+ SegmentSize segment_size)
: allocation_size_(0),
segment_bytes_allocated_(0),
position_(0),
@@ -50,7 +51,8 @@ Zone::Zone(AccountingAllocator* allocator, const char* name)
allocator_(allocator),
segment_head_(nullptr),
name_(name),
- sealed_(false) {
+ sealed_(false),
+ segment_size_(segment_size) {
allocator_->ZoneCreation(this);
}
@@ -148,6 +150,9 @@ Address Zone::NewExpand(size_t size) {
V8::FatalProcessOutOfMemory("Zone");
return nullptr;
}
+ if (segment_size_ == SegmentSize::kLarge) {
+ new_size = kMaximumSegmentSize;
+ }
if (new_size < kMinimumSegmentSize) {
new_size = kMinimumSegmentSize;
} else if (new_size > kMaximumSegmentSize) {
diff --git a/deps/v8/src/zone/zone.h b/deps/v8/src/zone/zone.h
index c8c1fe3515..e15e3d116e 100644
--- a/deps/v8/src/zone/zone.h
+++ b/deps/v8/src/zone/zone.h
@@ -34,9 +34,13 @@ namespace internal {
//
// Note: The implementation is inherently not thread safe. Do not use
// from multi-threaded code.
+
+enum class SegmentSize { kLarge, kDefault };
+
class V8_EXPORT_PRIVATE Zone final {
public:
- Zone(AccountingAllocator* allocator, const char* name);
+ Zone(AccountingAllocator* allocator, const char* name,
+ SegmentSize segment_size = SegmentSize::kDefault);
~Zone();
// Allocate 'size' bytes of memory in the Zone; expands the Zone by
@@ -109,6 +113,7 @@ class V8_EXPORT_PRIVATE Zone final {
Segment* segment_head_;
const char* name_;
bool sealed_;
+ SegmentSize segment_size_;
};
// ZoneObject is an abstraction that helps define classes of objects