Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2020-05-14 22:03:59 +0300
committerJames M Snell <jasnell@gmail.com>2020-05-31 02:20:02 +0300
commite2cd71536161589dff96adf882970b9a33380f02 (patch)
treec88f653beca27baf69a1e1545ad9d0fe8c7008fb /src/env.cc
parent56ff1ee55a57b1169dc567f0f51e58a6f2ccda6d (diff)
src: turn AllocatedBuffer into thin wrapper around v8::BackingStore
Alternative to https://github.com/nodejs/node/pull/33381 that reimplements that change on top of moving AllocatedBuffer out of env.h PR-URL: https://github.com/nodejs/node/pull/33291 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: David Carlier <devnexen@gmail.com>
Diffstat (limited to 'src/env.cc')
-rw-r--r--src/env.cc19
1 files changed, 0 insertions, 19 deletions
diff --git a/src/env.cc b/src/env.cc
index a28679728e5..7591ed1c435 100644
--- a/src/env.cc
+++ b/src/env.cc
@@ -1104,25 +1104,6 @@ void Environment::MemoryInfo(MemoryTracker* tracker) const {
// node, we shift its sizeof() size out of the Environment node.
}
-char* Environment::Reallocate(char* data, size_t old_size, size_t size) {
- if (old_size == size) return data;
- // If we know that the allocator is our ArrayBufferAllocator, we can let
- // if reallocate directly.
- if (isolate_data()->uses_node_allocator()) {
- return static_cast<char*>(
- isolate_data()->node_allocator()->Reallocate(data, old_size, size));
- }
- // Generic allocators do not provide a reallocation method; we need to
- // allocate a new chunk of memory and copy the data over.
- char* new_data = AllocateUnchecked(size);
- if (new_data == nullptr) return nullptr;
- memcpy(new_data, data, std::min(size, old_size));
- if (size > old_size)
- memset(new_data + old_size, 0, size - old_size);
- Free(data, old_size);
- return new_data;
-}
-
void Environment::RunWeakRefCleanup() {
isolate()->ClearKeptObjects();
}