v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
object-access.h
Go to the documentation of this file.
1// Copyright 2018 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_WASM_OBJECT_ACCESS_H_
6#define V8_WASM_OBJECT_ACCESS_H_
7
8#if !V8_ENABLE_WEBASSEMBLY
9#error This header should only be included if WebAssembly is enabled.
10#endif // !V8_ENABLE_WEBASSEMBLY
11
12#include "src/common/globals.h"
16
17namespace v8 {
18namespace internal {
19namespace wasm {
20
21class ObjectAccess : public AllStatic {
22 public:
23 // Convert an offset into an object to an offset into a tagged object.
24 static constexpr int ToTagged(int offset) { return offset - kHeapObjectTag; }
25
26 // Get the offset into a fixed array for a given {index}.
27 static constexpr int ElementOffsetInTaggedFixedArray(int index) {
29 }
30
31 // Get the offset into a fixed uint8 array for a given {index}.
32 static constexpr int ElementOffsetInTaggedFixedUInt8Array(int index) {
34 }
35
36 // Get the offset into a fixed uint32 array for a given {index}.
37 static constexpr int ElementOffsetInTaggedFixedUInt32Array(int index) {
39 }
40
41 // Get the offset into a fixed address array for a given {index}.
42 static constexpr int ElementOffsetInTaggedFixedAddressArray(int index) {
44 }
45
46 // Get the offset into a trusted fixed address array for a given {index}.
48 int index) {
50 }
51
52 // Get the offset into a ProtectedFixedArray for a given {index}.
53 static constexpr int ElementOffsetInProtectedFixedArray(int index) {
55 }
56
57 // Get the offset of the context stored in a {JSFunction} object.
58 static constexpr int ContextOffsetInTaggedJSFunction() {
59 return ToTagged(JSFunction::kContextOffset);
60 }
61
62 // Get the offset of the shared function info in a {JSFunction} object.
64 return ToTagged(JSFunction::kSharedFunctionInfoOffset);
65 }
66
67 // Get the offset of the flags in a {SharedFunctionInfo} object.
68 static constexpr int FlagsOffsetInSharedFunctionInfo() {
69 return ToTagged(SharedFunctionInfo::kFlagsOffset);
70 }
71};
72
73} // namespace wasm
74} // namespace internal
75} // namespace v8
76
77#endif // V8_WASM_OBJECT_ACCESS_H_
static constexpr int OffsetOfElementAt(int index)
static constexpr int ElementOffsetInTaggedFixedUInt8Array(int index)
static constexpr int SharedFunctionInfoOffsetInTaggedJSFunction()
static constexpr int ElementOffsetInTaggedFixedArray(int index)
static constexpr int ElementOffsetInTaggedFixedUInt32Array(int index)
static constexpr int ElementOffsetInTaggedFixedAddressArray(int index)
static constexpr int ContextOffsetInTaggedJSFunction()
static constexpr int ElementOffsetInProtectedFixedArray(int index)
static constexpr int ToTagged(int offset)
static constexpr int FlagsOffsetInSharedFunctionInfo()
static constexpr int ElementOffsetInTaggedTrustedFixedAddressArray(int index)
int32_t offset
const int kHeapObjectTag
Definition v8-internal.h:72
Definition c-api.cc:87