Changeset 266250 in webkit for trunk/Source/JavaScriptCore


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):

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r266242 r266250  
     12020-08-27  Yusuke Suzuki  <[email protected]>
     2
     3        [JSC] Use auxiliary memory for JSBigInt storage
     4        https://bugs.webkit.org/show_bug.cgi?id=215876
     5
     6        Reviewed by Mark Lam.
     7
     8        This makes JSBigInt non-destructible cell. And it makes allocating JSBigInt from JIT easy.
     9
     10        * runtime/JSBigInt.cpp:
     11        (JSC::JSBigInt::JSBigInt):
     12        (JSC::JSBigInt::visitChildren):
     13        (JSC::JSBigInt::createWithLength):
     14        (JSC::JSBigInt::destroy): Deleted.
     15        * runtime/JSBigInt.h:
     16        * runtime/VM.cpp:
     17        (JSC::VM::VM):
     18
    1192020-08-27  Keith Miller  <[email protected]>
    220
  • 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) {
  • trunk/Source/JavaScriptCore/runtime/JSBigInt.h

    r262342 r266250  
    5151    friend class CachedBigInt;
    5252
    53     static constexpr bool needsDestruction = true;
    54     static void destroy(JSCell*);
     53    static void visitChildren(JSCell*, SlotVisitor&);
    5554
    5655    template<typename CellType, SubspaceAccess>
     
    577576    const unsigned m_length;
    578577    bool m_sign { false };
    579     CagedUniquePtr<Gigacage::Primitive, Digit> m_data;
     578    CagedBarrierPtr<Gigacage::Primitive, Digit> m_data;
    580579};
    581580
  • trunk/Source/JavaScriptCore/runtime/VM.cpp

    r266032 r266250  
    338338    , destructibleObjectSpace("JSDestructibleObject", heap, destructibleObjectHeapCellType.get(), fastMallocAllocator.get()) // Hash:0x4f5ed7a9
    339339    , arraySpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), JSArray)
    340     , bigIntSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), JSBigInt)
     340    , bigIntSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), JSBigInt)
    341341    , calleeSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), JSCallee)
    342342    , clonedArgumentsSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), ClonedArguments)
Note: See TracChangeset for help on using the changeset viewer.