js/src/util/AllocPolicy.cpp
author Chris Martin <cmartin@mozilla.com>
Thu, 02 May 2019 16:31:53 +0000
changeset 472343 596926f7e8125bcd9094a1183b2e887b592ae418
parent 467900 cf6d9523f2cb7c957feeaa12b7933ebb2c1c24e5
permissions -rw-r--r--
Bug 1052579 - Remove arenaId member that was introduced in D25705 r=sfink In D25705, I added a new arenaId member to the js::BaseAllocPolicy. This increased the size of everything that uses a JS AllocPolicy, which is a lot. This change follows suit from earlier work, which is to make everything allocation-related have an "arena" version and a "default" version that uses the arena version with the implied default arena. StringBuffer is then changed to use this new functionity to define its own alloc policy that uses the new StringBufferArena. Differential Revision: https://phabricator.services.mozilla.com/D29685

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * vim: set ts=8 sts=2 et sw=2 tw=80:
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "js/AllocPolicy.h"

#include "vm/JSContext.h"

using namespace js;

void* TempAllocPolicy::onOutOfMemory(arena_id_t arenaId,
                                     AllocFunction allocFunc, size_t nbytes,
                                     void* reallocPtr) {
  return cx_->onOutOfMemory(allocFunc, arenaId, nbytes, reallocPtr);
}

void TempAllocPolicy::reportAllocOverflow() const {
  ReportAllocationOverflow(cx_);
}