Ignore:
Timestamp:
Aug 27, 2020, 1:01:04 PM (5 years ago)
Author:
[email protected]
Message:

[JSC] Use auxiliary memory for JSBigInt storage
https://bugs.webkit.org/show_bug.cgi?id=215876

Reviewed by Mark Lam.

This makes JSBigInt non-destructible cell. And it makes allocating JSBigInt from JIT easy.

  • runtime/JSBigInt.cpp:

(JSC::JSBigInt::JSBigInt):
(JSC::JSBigInt::visitChildren):
(JSC::JSBigInt::createWithLength):
(JSC::JSBigInt::destroy): Deleted.

  • runtime/JSBigInt.h:
  • runtime/VM.cpp:

(JSC::VM::VM):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSBigInt.cpp

    r264346 r266250  
    6464    : Base(vm, structure)
    6565    , m_length(length)
    66     , m_data(data, length)
     66    , m_data(vm, this, data, length)
    6767{ }
    6868
    69 void JSBigInt::destroy(JSCell* thisCell)
    70 {
    71     static_cast<JSBigInt*>(thisCell)->~JSBigInt();
     69void JSBigInt::visitChildren(JSCell* cell, SlotVisitor& visitor)
     70{
     71    auto* thisObject = jsCast<JSBigInt*>(cell);
     72    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     73    Base::visitChildren(thisObject, visitor);
     74    if (auto* data = thisObject->m_data.getUnsafe())
     75        visitor.markAuxiliary(data);
    7276}
    7377
     
    109113
    110114    ASSERT(length <= maxLength);
    111     void* data = Gigacage::tryMalloc(Gigacage::Primitive, length * sizeof(Digit));
     115    void* data = vm.primitiveGigacageAuxiliarySpace.allocateNonVirtual(vm, length * sizeof(Digit), nullptr, AllocationFailureMode::ReturnNull);
    112116    if (UNLIKELY(!data)) {
    113117        if (nullOrGlobalObjectForOOM) {
Note: See TracChangeset for help on using the changeset viewer.