/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
deps/v8/src/objects/cpp-heap-object-wrapper-inl.h
70 строк
3 KB
Michaël Zasso
deps: update V8 to 14.3.127.12
13 ноя 2025, 17:08
Не верифицирован
13 ноя 2025, 17:08
53379f3
Код
Авторство
О чём код?
// Copyright 2025 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_OBJECTS_CPP_HEAP_OBJECT_WRAPPER_INL_H_ #define V8_OBJECTS_CPP_HEAP_OBJECT_WRAPPER_INL_H_ #include "src/objects/cpp-heap-object-wrapper.h" // Include the non-inl header before the rest of the headers. #include "src/heap/heap-write-barrier-inl.h" #include "src/objects/heap-object-inl.h" namespace v8::internal { // static CppHeapObjectWrapper CppHeapObjectWrapper::From( Tagged<CppHeapPointerWrapperObjectT> object) { DCHECK(IsCppHeapPointerWrapperObject(object)); if (IsCppHeapExternalObject(object)) { return CppHeapObjectWrapper(Cast<CppHeapExternalObject>(object)); } DCHECK(IsJSObject(object)); return CppHeapObjectWrapper(Cast<JSObject>(object)); } CppHeapObjectWrapper::CppHeapObjectWrapper(Tagged<CppHeapExternalObject> object) : object_(object), offset_(CppHeapExternalObject::kCppHeapWrappableOffset) { DCHECK(IsCppHeapPointerWrapperObject(object)); } CppHeapObjectWrapper::CppHeapObjectWrapper(Tagged<JSObject> object) : object_(object), offset_(JSAPIObjectWithEmbedderSlots::kCppHeapWrappableOffset) { DCHECK(IsCppHeapPointerWrapperObject(object)); DCHECK(IsJSApiWrapperObject(object)); DCHECK(IsJSAPIObjectWithEmbedderSlots(object_) || IsJSSpecialObject(object_)); } void CppHeapObjectWrapper::InitializeCppHeapWrapper() { object_->SetupLazilyInitializedCppHeapPointerField(offset_); } template <CppHeapPointerTag lower_bound, CppHeapPointerTag upper_bound> void* CppHeapObjectWrapper::GetCppHeapWrappable( IsolateForPointerCompression isolate) const { return reinterpret_cast<void*>( object_->ReadCppHeapPointerField<lower_bound, upper_bound>(offset_, isolate)); } void* CppHeapObjectWrapper::GetCppHeapWrappable( IsolateForPointerCompression isolate, CppHeapPointerTagRange tag_range) const { return reinterpret_cast<void*>( object_->ReadCppHeapPointerField(offset_, isolate, tag_range)); } void CppHeapObjectWrapper::SetCppHeapWrappable( IsolateForPointerCompression isolate, void* instance, CppHeapPointerTag tag) { object_->WriteLazilyInitializedCppHeapPointerField( offset_, isolate, reinterpret_cast<Address>(instance), tag); WriteBarrier::ForCppHeapPointer( object_, object_->RawCppHeapPointerField(offset_), instance); } } // namespace v8::internal #endif // V8_OBJECTS_CPP_HEAP_OBJECT_WRAPPER_INL_H_