-
Notifications
You must be signed in to change notification settings - Fork 160
Expand file tree
/
Copy pathV8ValueWireData.h
More file actions
158 lines (122 loc) · 6.04 KB
/
V8ValueWireData.h
File metadata and controls
158 lines (122 loc) · 6.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#pragma once
//-----------------------------------------------------------------------------
// V8Value::WireData
//-----------------------------------------------------------------------------
struct V8Value::WireData
{
// IMPORTANT: maintain bitwise equivalence with managed struct V8.SplitProxy.V8Value.WireData
Type Type;
Subtype Subtype;
union
{
Flags Flags;
int16_t SignBit;
};
union
{
int32_t Length;
int32_t IdentityHash;
};
union
{
int32_t Int32Value;
double DoubleValue;
const StdChar* pStringData;
const uint64_t* pBigIntData;
const V8ObjectHandle* pV8ObjectHandle;
void* pvHostObject;
};
};
//-----------------------------------------------------------------------------
static_assert(sizeof(V8Value::WireData) == 16, "The managed SplitProxy code assumes that sizeof(V8Value::WireData) is 16 on all platforms.");
static_assert(offsetof(V8Value::WireData, Type) == 0, "The managed SplitProxy code assumes that offsetof(V8Value::WireData, Type) is 0 on all platforms.");
static_assert(offsetof(V8Value::WireData, Subtype) == 1, "The managed SplitProxy code assumes that offsetof(V8Value::WireData, Subtype) is 1 on all platforms.");
static_assert(offsetof(V8Value::WireData, Flags) == 2, "The managed SplitProxy code assumes that offsetof(V8Value::WireData, Flags) is 2 on all platforms.");
static_assert(offsetof(V8Value::WireData, SignBit) == 2, "The managed SplitProxy code assumes that offsetof(V8Value::WireData, SignBit) is 2 on all platforms.");
static_assert(offsetof(V8Value::WireData, Length) == 4, "The managed SplitProxy code assumes that offsetof(V8Value::WireData, Length) is 4 on all platforms.");
static_assert(offsetof(V8Value::WireData, IdentityHash) == 4, "The managed SplitProxy code assumes that offsetof(V8Value::WireData, IdentityHash) is 4 on all platforms.");
static_assert(offsetof(V8Value::WireData, Int32Value) == 8, "The managed SplitProxy code assumes that offsetof(V8Value::WireData, Int32Value) is 8 on all platforms.");
static_assert(offsetof(V8Value::WireData, DoubleValue) == 8, "The managed SplitProxy code assumes that offsetof(V8Value::WireData, DoubleValue) is 8 on all platforms.");
static_assert(offsetof(V8Value::WireData, pStringData) == 8, "The managed SplitProxy code assumes that offsetof(V8Value::WireData, pStringData) is 8 on all platforms.");
static_assert(offsetof(V8Value::WireData, pBigIntData) == 8, "The managed SplitProxy code assumes that offsetof(V8Value::WireData, pBigIntData) is 8 on all platforms.");
static_assert(offsetof(V8Value::WireData, pV8ObjectHandle) == 8, "The managed SplitProxy code assumes that offsetof(V8Value::WireData, pV8ObjectHandle) is 8 on all platforms.");
static_assert(offsetof(V8Value::WireData, pvHostObject) == 8, "The managed SplitProxy code assumes that offsetof(V8Value::WireData, pvHostObject) is 8 on all platforms.");
//-----------------------------------------------------------------------------
// V8Value::Decoded
//-----------------------------------------------------------------------------
struct V8Value::Decoded: WireData
{
// IMPORTANT: maintain bitwise equivalence with managed struct V8.SplitProxy.V8Value.Decoded
};
//-----------------------------------------------------------------------------
static_assert(sizeof(V8Value::Decoded) == sizeof(V8Value::WireData));
//-----------------------------------------------------------------------------
// V8Value::FastArg
//-----------------------------------------------------------------------------
struct V8Value::FastArg final: Decoded
{
// IMPORTANT: maintain bitwise equivalence with managed struct V8.SplitProxy.V8Value.FastArg
~FastArg()
{
switch (Type)
{
case Type::V8Object:
delete pV8ObjectHandle;
break;
default:
break;
}
}
};
//-----------------------------------------------------------------------------
static_assert(sizeof(V8Value::FastArg) == sizeof(V8Value::Decoded));
//-----------------------------------------------------------------------------
// V8Value::FastResult
//-----------------------------------------------------------------------------
struct V8Value::FastResult final: WireData
{
// IMPORTANT: maintain bitwise equivalence with managed struct V8.SplitProxy.V8Value.FastResult
FastResult()
{
Type = Type::Nonexistent;
}
~FastResult()
{
switch (Type)
{
case Type::String:
::Memory_Free(pStringData);
break;
case Type::BigInt:
::Memory_Free(pBigIntData);
break;
case Type::V8Object:
delete pV8ObjectHandle;
break;
default:
break;
}
}
};
//-----------------------------------------------------------------------------
static_assert(sizeof(V8Value::FastResult) == sizeof(V8Value::WireData));
//-----------------------------------------------------------------------------
// V8Value::FastScriptArg
//-----------------------------------------------------------------------------
struct V8Value::FastScriptArg final: WireData
{
// IMPORTANT: maintain bitwise equivalence with managed struct V8.SplitProxy.V8Value.FastScriptArg
};
//-----------------------------------------------------------------------------
static_assert(sizeof(V8Value::FastScriptArg) == sizeof(V8Value::WireData));
//-----------------------------------------------------------------------------
// V8Value::FastScriptResult
//-----------------------------------------------------------------------------
struct V8Value::FastScriptResult final: Decoded
{
// IMPORTANT: maintain bitwise equivalence with managed struct V8.SplitProxy.V8Value.FastScriptResult
};
//-----------------------------------------------------------------------------
static_assert(sizeof(V8Value::FastScriptResult) == sizeof(V8Value::Decoded));