blob: d5d9ae647e0158e47b8aa38e1a5b76ab564047bf [file]
// Copyright 2019 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_EXECUTION_ISOLATE_UTILS_INL_H_
#define V8_EXECUTION_ISOLATE_UTILS_INL_H_
#include "src/execution/isolate-utils.h"
// Include the non-inl header before the rest of the headers.
#include "src/common/ptr-compr-inl.h"
#include "src/execution/isolate.h"
#include "src/heap/heap-layout-inl.h"
#include "src/sandbox/isolate.h"
namespace v8::internal {
V8_INLINE bool GetIsolateFromHeapObject(Tagged<HeapObject> object,
Isolate** isolate) {
MemoryChunk* chunk = MemoryChunk::FromHeapObject(object);
if (chunk->InReadOnlySpace()) {
*isolate = nullptr;
return false;
}
*isolate = Isolate::FromHeap(chunk->Metadata()->heap());
return true;
}
} // namespace v8::internal
#endif // V8_EXECUTION_ISOLATE_UTILS_INL_H_