• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "src/execution/external-pointer-table.h"
6 
7 namespace v8 {
8 namespace internal {
9 
GrowTable(ExternalPointerTable * table)10 void ExternalPointerTable::GrowTable(ExternalPointerTable* table) {
11   // TODO(v8:10391, saelo): overflow check here and in the multiplication below
12   uint32_t new_capacity = table->capacity_ + table->capacity_ / 2;
13   table->buffer_ = reinterpret_cast<Address*>(
14       realloc(table->buffer_, new_capacity * sizeof(Address)));
15   CHECK(table->buffer_);
16   memset(&table->buffer_[table->capacity_], 0,
17          (new_capacity - table->capacity_) * sizeof(Address));
18   table->capacity_ = new_capacity;
19 }
20 
21 }  // namespace internal
22 }  // namespace v8
23