v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
isolate-utils-inl.h
Go to the documentation of this file.
1// Copyright 2019 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_EXECUTION_ISOLATE_UTILS_INL_H_
6#define V8_EXECUTION_ISOLATE_UTILS_INL_H_
7
9// Include the non-inl header before the rest of the headers.
10
13#include "src/heap/heap-inl.h"
14#include "src/sandbox/isolate.h"
15
16namespace v8::internal {
17
18// TODO(396607238): Replace all callers with `Isolate::Current()->heap()`.
21 // Do not use this method on shared objects. This method would always return
22 // the shared space isolate for shared objects. However, on worker isolates
23 // this might be different from the current isolate. In such cases either
24 // require the current isolate as an additional argument from the caller or
25 // use Isolate::Current(). From there you can access the shared space isolate
26 // with `isolate->shared_space_isolate()` if needed.
28 Heap* heap = chunk->GetHeap();
29 // TODO(396607238): Make this a `SBXCHECK`.
31 return heap;
32}
33
34// TODO(396607238): Replace all callers with `Isolate::Current()`.
38
42
47
49 Isolate** isolate) {
51 if (chunk->InReadOnlySpace()) {
52 *isolate = nullptr;
53 return false;
54 }
55 *isolate = Isolate::FromHeap(chunk->GetHeap());
56 return true;
57}
58
59} // namespace v8::internal
60
61#endif // V8_EXECUTION_ISOLATE_UTILS_INL_H_
static Isolate * TryGetCurrent()
Definition api.cc:9954
static Isolate * FromHeap(const Heap *heap)
Definition isolate.h:1202
V8_INLINE bool InWritableSharedSpace() const
V8_INLINE Heap * GetHeap()
static V8_INLINE MemoryChunk * FromHeapObject(Tagged< HeapObject > object)
V8_INLINE bool InReadOnlySpace() const
Tagged(T object) -> Tagged< T >
V8_INLINE Isolate * GetIsolateFromWritableObject(Tagged< HeapObject > object)
V8_INLINE bool GetIsolateFromHeapObject(Tagged< HeapObject > object, Isolate **isolate)
V8_INLINE Heap * GetHeapFromWritableObject(Tagged< HeapObject > object)
#define DCHECK(condition)
Definition logging.h:482
#define DCHECK_EQ(v1, v2)
Definition logging.h:485
#define V8_INLINE
Definition v8config.h:500