diff --git a/include/hermes/VM/SingleObject.h b/include/hermes/VM/SingleObject.h index 1262e6d49b4..b4d70d9465b 100644 --- a/include/hermes/VM/SingleObject.h +++ b/include/hermes/VM/SingleObject.h @@ -53,7 +53,7 @@ struct IsGCObject> { template const ObjectVTable SingleObject::vt = { - VTable(kind, cellSize>(), nullptr, nullptr), + VTable(kind, cellSize>()), SingleObject::_getOwnIndexedRangeImpl, SingleObject::_haveOwnIndexedImpl, SingleObject::_getOwnIndexedPropertyFlagsImpl, diff --git a/include/hermes/VM/StringPrimitive.h b/include/hermes/VM/StringPrimitive.h index e98cec3f75e..e65f0a01326 100644 --- a/include/hermes/VM/StringPrimitive.h +++ b/include/hermes/VM/StringPrimitive.h @@ -838,6 +838,7 @@ template const VTable DynamicStringPrimitive::vt = VTable( DynamicStringPrimitive::getCellKind(), 0, + false, nullptr, nullptr, nullptr @@ -865,6 +866,7 @@ template const VTable ExternalStringPrimitive::vt = VTable( ExternalStringPrimitive::getCellKind(), 0, + false, ExternalStringPrimitive::_finalizeImpl, ExternalStringPrimitive::_mallocSizeImpl, nullptr @@ -886,6 +888,7 @@ template const VTable BufferedStringPrimitive::vt = VTable( BufferedStringPrimitive::getCellKind(), 0, + false, nullptr, // finalize. nullptr, // mallocSize nullptr diff --git a/include/hermes/VM/VTable.h b/include/hermes/VM/VTable.h index baf551898b8..35fd792b853 100644 --- a/include/hermes/VM/VTable.h +++ b/include/hermes/VM/VTable.h @@ -106,6 +106,8 @@ struct VTable { /// If it is variable sized, it should inherit from \see /// VariableSizeRuntimeCell. const uint32_t size; + /// Whether the cell supports large allocation. + bool allowLargeAlloc; /// Called during GC when an object becomes unreachable. Must not perform any /// allocations or access any garbage-collectable objects. Unless an /// operation is documented to be safe to call from a finalizer, it probably @@ -137,6 +139,7 @@ struct VTable { constexpr explicit VTable( CellKind kind, uint32_t size, + bool allowLargeAlloc = false, FinalizeCallback *finalize = nullptr, MallocSizeCallback *mallocSize = nullptr, TrimSizeCallback *trimSize = nullptr @@ -153,6 +156,7 @@ struct VTable { ) : kind(kind), size(heapAlignSize(size)), + allowLargeAlloc(allowLargeAlloc), finalize_(finalize), mallocSize_(mallocSize), trimSize_(trimSize) diff --git a/lib/VM/ArrayStorage.cpp b/lib/VM/ArrayStorage.cpp index a4fc8acba0c..795af685192 100644 --- a/lib/VM/ArrayStorage.cpp +++ b/lib/VM/ArrayStorage.cpp @@ -19,6 +19,7 @@ template const VTable ArrayStorageBase::vt( ArrayStorageBase::getCellKind(), 0, + false, nullptr, nullptr, _trimSizeCallback diff --git a/lib/VM/Callable.cpp b/lib/VM/Callable.cpp index 2127e25f27f..6143b80b973 100644 --- a/lib/VM/Callable.cpp +++ b/lib/VM/Callable.cpp @@ -593,6 +593,7 @@ const CallableVTable BoundFunction::vt{ VTable( CellKind::BoundFunctionKind, cellSize(), + false, nullptr, nullptr, nullptr @@ -905,6 +906,7 @@ const CallableVTable NativeJSFunction::vt{ VTable( CellKind::NativeJSFunctionKind, cellSize(), + false, nullptr, nullptr, nullptr @@ -1054,6 +1056,7 @@ const CallableVTable NativeFunction::vt{ VTable( CellKind::NativeFunctionKind, cellSize(), + false, nullptr, nullptr, nullptr @@ -1233,6 +1236,7 @@ const CallableVTable NativeConstructor::vt{ VTable( CellKind::NativeConstructorKind, cellSize(), + false, nullptr, nullptr, nullptr @@ -1284,6 +1288,7 @@ const CallableVTable JSFunction::vt{ VTable( CellKind::JSFunctionKind, cellSize(), + false, nullptr, nullptr, nullptr diff --git a/lib/VM/DecoratedObject.cpp b/lib/VM/DecoratedObject.cpp index cf221061048..a0a47025ed2 100644 --- a/lib/VM/DecoratedObject.cpp +++ b/lib/VM/DecoratedObject.cpp @@ -22,6 +22,7 @@ const ObjectVTable DecoratedObject::vt{ VTable( CellKind::DecoratedObjectKind, cellSize(), + false, DecoratedObject::_finalizeImpl, DecoratedObject::_mallocSizeImpl), DecoratedObject::_getOwnIndexedRangeImpl, diff --git a/lib/VM/Domain.cpp b/lib/VM/Domain.cpp index c0d2b7b3916..a530137045f 100644 --- a/lib/VM/Domain.cpp +++ b/lib/VM/Domain.cpp @@ -18,6 +18,7 @@ namespace vm { const VTable Domain::vt{ CellKind::DomainKind, cellSize(), + false, _finalizeImpl, _mallocSizeImpl, nullptr diff --git a/lib/VM/DummyObject.cpp b/lib/VM/DummyObject.cpp index cab35da5c22..8eaa7e2b243 100644 --- a/lib/VM/DummyObject.cpp +++ b/lib/VM/DummyObject.cpp @@ -19,6 +19,7 @@ namespace testhelpers { const VTable DummyObject::vt{ CellKind::DummyObjectKind, cellSize(), + false, _finalizeImpl, _mallocSizeImpl, nullptr diff --git a/lib/VM/FastArray.cpp b/lib/VM/FastArray.cpp index a7dd89f23e9..1b31077f03b 100644 --- a/lib/VM/FastArray.cpp +++ b/lib/VM/FastArray.cpp @@ -28,6 +28,7 @@ const ObjectVTable FastArray::vt{ VTable( CellKind::FastArrayKind, cellSize(), + false, nullptr, nullptr, nullptr diff --git a/lib/VM/HiddenClass.cpp b/lib/VM/HiddenClass.cpp index fcd069eb0a5..f5948000928 100644 --- a/lib/VM/HiddenClass.cpp +++ b/lib/VM/HiddenClass.cpp @@ -95,6 +95,7 @@ void TransitionMap::uncleanMakeLarge(Runtime &runtime) { const VTable HiddenClass::vt{ CellKind::HiddenClassKind, cellSize(), + false, _finalizeImpl, _mallocSizeImpl, nullptr diff --git a/lib/VM/HostModel.cpp b/lib/VM/HostModel.cpp index a87c1c6c91b..512e7e709db 100644 --- a/lib/VM/HostModel.cpp +++ b/lib/VM/HostModel.cpp @@ -20,6 +20,7 @@ const CallableVTable FinalizableNativeFunction::vt{ VTable( CellKind::FinalizableNativeFunctionKind, cellSize(), + false, FinalizableNativeFunction::_finalizeImpl), FinalizableNativeFunction::_getOwnIndexedRangeImpl, FinalizableNativeFunction::_haveOwnIndexedImpl, @@ -81,6 +82,7 @@ const ObjectVTable HostObject::vt{ VTable( CellKind::HostObjectKind, cellSize(), + false, HostObject::_finalizeImpl), HostObject::_getOwnIndexedRangeImpl, HostObject::_haveOwnIndexedImpl, diff --git a/lib/VM/JSArray.cpp b/lib/VM/JSArray.cpp index 3e43bd9d79b..8f772873cf1 100644 --- a/lib/VM/JSArray.cpp +++ b/lib/VM/JSArray.cpp @@ -372,6 +372,7 @@ const ObjectVTable Arguments::vt{ VTable( CellKind::ArgumentsKind, cellSize(), + false, nullptr, nullptr, nullptr @@ -493,6 +494,7 @@ const ObjectVTable JSArray::vt{ VTable( CellKind::JSArrayKind, cellSize(), + false, nullptr, nullptr, nullptr diff --git a/lib/VM/JSArrayBuffer.cpp b/lib/VM/JSArrayBuffer.cpp index 1a60101d143..d24938317bf 100644 --- a/lib/VM/JSArrayBuffer.cpp +++ b/lib/VM/JSArrayBuffer.cpp @@ -20,6 +20,7 @@ const ObjectVTable JSArrayBuffer::vt{ VTable( CellKind::JSArrayBufferKind, cellSize(), + false, _finalizeImpl, _mallocSizeImpl, nullptr diff --git a/lib/VM/JSCallSite.cpp b/lib/VM/JSCallSite.cpp index 2e6f0c71f5e..d63578b566b 100644 --- a/lib/VM/JSCallSite.cpp +++ b/lib/VM/JSCallSite.cpp @@ -15,7 +15,7 @@ namespace hermes { namespace vm { const ObjectVTable JSCallSite::vt{ - VTable(CellKind::JSCallSiteKind, cellSize(), nullptr, nullptr), + VTable(CellKind::JSCallSiteKind, cellSize()), JSCallSite::_getOwnIndexedRangeImpl, JSCallSite::_haveOwnIndexedImpl, JSCallSite::_getOwnIndexedPropertyFlagsImpl, diff --git a/lib/VM/JSError.cpp b/lib/VM/JSError.cpp index edd77e49418..271c0c04a62 100644 --- a/lib/VM/JSError.cpp +++ b/lib/VM/JSError.cpp @@ -31,6 +31,7 @@ const ObjectVTable JSError::vt{ VTable( CellKind::JSErrorKind, cellSize(), + false, JSError::_finalizeImpl, JSError::_mallocSizeImpl), JSError::_getOwnIndexedRangeImpl, diff --git a/lib/VM/JSObject.cpp b/lib/VM/JSObject.cpp index 02126de5a86..ef22482436c 100644 --- a/lib/VM/JSObject.cpp +++ b/lib/VM/JSObject.cpp @@ -26,6 +26,7 @@ const ObjectVTable JSObject::vt{ VTable( CellKind::JSObjectKind, cellSize(), + false, nullptr, nullptr, nullptr diff --git a/lib/VM/JSRegExp.cpp b/lib/VM/JSRegExp.cpp index a8140cfd34c..d8ee6c7e3bd 100644 --- a/lib/VM/JSRegExp.cpp +++ b/lib/VM/JSRegExp.cpp @@ -27,6 +27,7 @@ const ObjectVTable JSRegExp::vt{ VTable( CellKind::JSRegExpKind, cellSize(), + false, JSRegExp::_finalizeImpl, JSRegExp::_mallocSizeImpl, nullptr diff --git a/lib/VM/JSWeakMapImpl.cpp b/lib/VM/JSWeakMapImpl.cpp index c64134ad9c1..eb8e48f5469 100644 --- a/lib/VM/JSWeakMapImpl.cpp +++ b/lib/VM/JSWeakMapImpl.cpp @@ -206,6 +206,7 @@ const ObjectVTable JSWeakMapImpl::vt{ VTable( C, cellSize(), + false, JSWeakMapImpl::_finalizeImpl, JSWeakMapImpl::_mallocSizeImpl, nullptr diff --git a/lib/VM/JSWeakRef.cpp b/lib/VM/JSWeakRef.cpp index 7d74a2125d5..2fadbe2ebd8 100644 --- a/lib/VM/JSWeakRef.cpp +++ b/lib/VM/JSWeakRef.cpp @@ -17,6 +17,7 @@ const ObjectVTable JSWeakRef::vt{ VTable( CellKind::JSWeakRefKind, cellSize(), + false, JSWeakRef::_finalizeImpl, nullptr, nullptr diff --git a/lib/VM/NativeState.cpp b/lib/VM/NativeState.cpp index e9975f05a49..0f0f8f78eb9 100644 --- a/lib/VM/NativeState.cpp +++ b/lib/VM/NativeState.cpp @@ -15,6 +15,7 @@ namespace vm { const VTable NativeState::vt{ CellKind::NativeStateKind, cellSize(), + false, _finalizeImpl, }; diff --git a/lib/VM/SegmentedArray.cpp b/lib/VM/SegmentedArray.cpp index 93c4af99437..71f85f699b7 100644 --- a/lib/VM/SegmentedArray.cpp +++ b/lib/VM/SegmentedArray.cpp @@ -17,6 +17,7 @@ template const VTable SegmentedArrayBase::Segment::vt( getCellKind(), cellSize(), + false, nullptr, nullptr, nullptr @@ -76,6 +77,7 @@ template const VTable SegmentedArrayBase::vt( getCellKind(), /*variableSize*/ 0, + false, nullptr, nullptr, _trimSizeCallback