summaryrefslogtreecommitdiff
path: root/deps/v8/src/zone/zone-segment.h
diff options
context:
space:
mode:
authorUjjwal Sharma <usharma1998@gmail.com>2019-03-15 18:35:06 +0530
committerRefael Ackermann <refack@gmail.com>2019-03-28 16:36:18 -0400
commitf579e1194046c50f2e6bb54348d48c8e7d1a53cf (patch)
tree9125787c758358365f74f9fd9673c14f57e67870 /deps/v8/src/zone/zone-segment.h
parent2c73868b0471fbd4038f500d076df056cbf697fe (diff)
downloadandroid-node-v8-f579e1194046c50f2e6bb54348d48c8e7d1a53cf.tar.gz
android-node-v8-f579e1194046c50f2e6bb54348d48c8e7d1a53cf.tar.bz2
android-node-v8-f579e1194046c50f2e6bb54348d48c8e7d1a53cf.zip
deps: update V8 to 7.4.288.13
PR-URL: https://github.com/nodejs/node/pull/26685 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'deps/v8/src/zone/zone-segment.h')
-rw-r--r--deps/v8/src/zone/zone-segment.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/deps/v8/src/zone/zone-segment.h b/deps/v8/src/zone/zone-segment.h
index 206edc7d64..2bc2f7f1ca 100644
--- a/deps/v8/src/zone/zone-segment.h
+++ b/deps/v8/src/zone/zone-segment.h
@@ -15,20 +15,24 @@
namespace v8 {
namespace internal {
-// Forward declaration
+// Forward declarations.
+class AccountingAllocator;
class Zone;
class Segment {
public:
- void Initialize(size_t size) { size_ = size; }
-
Zone* zone() const { return zone_; }
void set_zone(Zone* const zone) { zone_ = zone; }
Segment* next() const { return next_; }
void set_next(Segment* const next) { next_ = next; }
- size_t size() const { return size_; }
+ // {total_size} returns the allocated size including the bookkeeping bytes of
+ // the {Segment}.
+ size_t total_size() const { return size_; }
+
+ // {capacity} returns the number of storage bytes in this {Segment}, i.e.
+ // {end() - start()}.
size_t capacity() const { return size_ - sizeof(Segment); }
Address start() const { return address(sizeof(Segment)); }
@@ -40,6 +44,11 @@ class Segment {
void ZapHeader();
private:
+ // Segments are only created by the AccountingAllocator.
+ friend class AccountingAllocator;
+
+ explicit Segment(size_t size) : size_(size) {}
+
#ifdef DEBUG
// Constant byte value used for zapping dead memory in debug mode.
static const unsigned char kZapDeadByte = 0xcd;
@@ -50,10 +59,11 @@ class Segment {
return reinterpret_cast<Address>(this) + n;
}
- Zone* zone_;
- Segment* next_;
- size_t size_;
+ Zone* zone_ = nullptr;
+ Segment* next_ = nullptr;
+ const size_t size_;
};
+
} // namespace internal
} // namespace v8