summaryrefslogtreecommitdiff
path: root/deps/v8/src/zone
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2017-05-02 10:50:00 +0200
committerMichaël Zasso <targos@protonmail.com>2017-05-06 20:02:35 +0200
commit60d1aac8d225e844e68ae48e8f3d58802e635fbe (patch)
tree922f347dd054db18d88666fad7181e5a777f4022 /deps/v8/src/zone
parent73d9c0f903ae371cd5011af64c3a6f69a1bda978 (diff)
downloadandroid-node-v8-60d1aac8d225e844e68ae48e8f3d58802e635fbe.tar.gz
android-node-v8-60d1aac8d225e844e68ae48e8f3d58802e635fbe.tar.bz2
android-node-v8-60d1aac8d225e844e68ae48e8f3d58802e635fbe.zip
deps: update V8 to 5.8.283.38
PR-URL: https://github.com/nodejs/node/pull/12784 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Diffstat (limited to 'deps/v8/src/zone')
-rw-r--r--deps/v8/src/zone/accounting-allocator.cc4
-rw-r--r--deps/v8/src/zone/zone-allocator.h15
-rw-r--r--deps/v8/src/zone/zone.cc9
-rw-r--r--deps/v8/src/zone/zone.h4
4 files changed, 24 insertions, 8 deletions
diff --git a/deps/v8/src/zone/accounting-allocator.cc b/deps/v8/src/zone/accounting-allocator.cc
index 587e09d585..c06306309d 100644
--- a/deps/v8/src/zone/accounting-allocator.cc
+++ b/deps/v8/src/zone/accounting-allocator.cc
@@ -73,7 +73,9 @@ Segment* AccountingAllocator::GetSegment(size_t bytes) {
Segment* result = GetSegmentFromPool(bytes);
if (result == nullptr) {
result = AllocateSegment(bytes);
- result->Initialize(bytes);
+ if (result != nullptr) {
+ result->Initialize(bytes);
+ }
}
return result;
diff --git a/deps/v8/src/zone/zone-allocator.h b/deps/v8/src/zone/zone-allocator.h
index 1e2862a2c1..5852ca918c 100644
--- a/deps/v8/src/zone/zone-allocator.h
+++ b/deps/v8/src/zone/zone-allocator.h
@@ -26,8 +26,10 @@ class zone_allocator {
typedef zone_allocator<O> other;
};
- // TODO(bbudge) Remove when V8 updates to MSVS 2015. See crbug.com/603131.
+#ifdef V8_CC_MSVC
+ // MSVS unfortunately requires the default constructor to be defined.
zone_allocator() : zone_(nullptr) { UNREACHABLE(); }
+#endif
explicit zone_allocator(Zone* zone) throw() : zone_(zone) {}
explicit zone_allocator(const zone_allocator& other) throw()
: zone_(other.zone_) {}
@@ -49,10 +51,15 @@ class zone_allocator {
size_type max_size() const throw() {
return std::numeric_limits<int>::max() / sizeof(value_type);
}
- void construct(pointer p, const T& val) {
- new (static_cast<void*>(p)) T(val);
+ template <typename U, typename... Args>
+ void construct(U* p, Args&&... args) {
+ void* v_p = const_cast<void*>(static_cast<const void*>(p));
+ new (v_p) U(std::forward<Args>(args)...);
+ }
+ template <typename U>
+ void destroy(U* p) {
+ p->~U();
}
- void destroy(pointer p) { p->~T(); }
bool operator==(zone_allocator const& other) const {
return zone_ == other.zone_;
diff --git a/deps/v8/src/zone/zone.cc b/deps/v8/src/zone/zone.cc
index 8dd96dc1cd..d2dd9ce068 100644
--- a/deps/v8/src/zone/zone.cc
+++ b/deps/v8/src/zone/zone.cc
@@ -49,7 +49,8 @@ Zone::Zone(AccountingAllocator* allocator, const char* name)
limit_(0),
allocator_(allocator),
segment_head_(nullptr),
- name_(name) {
+ name_(name),
+ sealed_(false) {
allocator_->ZoneCreation(this);
}
@@ -62,6 +63,8 @@ Zone::~Zone() {
}
void* Zone::New(size_t size) {
+ CHECK(!sealed_);
+
// Round up the requested size to fit the alignment.
size = RoundUp(size, kAlignmentInBytes);
@@ -111,9 +114,9 @@ void Zone::DeleteAll() {
// of the segment chain. Returns the new segment.
Segment* Zone::NewSegment(size_t requested_size) {
Segment* result = allocator_->GetSegment(requested_size);
- DCHECK_GE(result->size(), requested_size);
- segment_bytes_allocated_ += result->size();
if (result != nullptr) {
+ DCHECK_GE(result->size(), requested_size);
+ segment_bytes_allocated_ += result->size();
result->set_zone(this);
result->set_next(segment_head_);
segment_head_ = result;
diff --git a/deps/v8/src/zone/zone.h b/deps/v8/src/zone/zone.h
index dbc1dadadd..c916972dcf 100644
--- a/deps/v8/src/zone/zone.h
+++ b/deps/v8/src/zone/zone.h
@@ -50,6 +50,9 @@ class V8_EXPORT_PRIVATE Zone final {
return static_cast<T*>(New(length * sizeof(T)));
}
+ // Seals the zone to prevent any further allocation.
+ void Seal() { sealed_ = true; }
+
// Returns true if more memory has been allocated in zones than
// the limit allows.
bool excess_allocation() const {
@@ -106,6 +109,7 @@ class V8_EXPORT_PRIVATE Zone final {
Segment* segment_head_;
const char* name_;
+ bool sealed_;
};
// ZoneObject is an abstraction that helps define classes of objects