Debian Codegraph @

js/src/wasm/WasmException.h

raw
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 *
4 * Copyright 2021 Mozilla Foundation
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 #ifndef wasm_exception_h
20 #define wasm_exception_h
21
22 namespace js {
23 namespace wasm {
24
25 static const uint32_t CatchAllIndex = UINT32_MAX;
26 static_assert(CatchAllIndex > MaxTags);
27
28 struct TryTableCatch {
29 TryTableCatch()
30 : tagIndex(CatchAllIndex), labelRelativeDepth(0), captureExnRef(false) {}
31
32 // The tag index for this catch, or CatchAllIndex for a catch_all.
33 uint32_t tagIndex;
34 // The relative depth of where to branch to when catching an exception.
35 uint32_t labelRelativeDepth;
36 // Whether the exnref that is caught should be captured and passed to the
37 // branch target.
38 bool captureExnRef;
39 // The params that the target branch at `labelRelativeDepth` expects. This
40 // includes any exnref that should or should not be captured.
41 ValTypeVector labelType;
42 };
43 using TryTableCatchVector = Vector<TryTableCatch, 1, SystemAllocPolicy>;
44
45 } // namespace wasm
46 } // namespace js
47
48 #endif // wasm_exception_h