tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

WasmTypeDecls.h (3229B)


      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_type_decls_h
     20 #define wasm_type_decls_h
     21 
     22 #include "NamespaceImports.h"
     23 #include "gc/Barrier.h"
     24 #include "js/GCVector.h"
     25 #include "js/HashTable.h"
     26 #include "js/RootingAPI.h"
     27 #include "js/UniquePtr.h"
     28 #include "js/Utility.h"
     29 #include "js/Vector.h"
     30 
     31 namespace js {
     32 
     33 using JSObjectVector = GCVector<JSObject*, 0, SystemAllocPolicy>;
     34 
     35 class WasmMemoryObject;
     36 class WasmModuleObject;
     37 class WasmInstanceObject;
     38 class WasmTableObject;
     39 class WasmGlobalObject;
     40 class WasmTagObject;
     41 class WasmExceptionObject;
     42 
     43 using WasmInstanceObjectVector = GCVector<WasmInstanceObject*>;
     44 using WasmMemoryObjectVector =
     45    GCVector<WasmMemoryObject*, 0, SystemAllocPolicy>;
     46 using WasmTableObjectVector = GCVector<WasmTableObject*, 0, SystemAllocPolicy>;
     47 using WasmGlobalObjectVector =
     48    GCVector<WasmGlobalObject*, 0, SystemAllocPolicy>;
     49 using WasmTagObjectVector = GCVector<WasmTagObject*, 0, SystemAllocPolicy>;
     50 
     51 struct CodeMetadataForAsmJS;
     52 
     53 namespace wasm {
     54 
     55 struct ModuleMetadata;
     56 struct CodeMetadata;
     57 class CodeRange;
     58 class CodeBlock;
     59 class Decoder;
     60 class GeneratedSourceMap;
     61 class Instance;
     62 class Module;
     63 
     64 class Code;
     65 using SharedCode = RefPtr<const Code>;
     66 using MutableCode = RefPtr<Code>;
     67 
     68 class Table;
     69 using SharedTable = RefPtr<Table>;
     70 using SharedTableVector = Vector<SharedTable, 0, SystemAllocPolicy>;
     71 
     72 class DebugState;
     73 using UniqueDebugState = UniquePtr<DebugState>;
     74 
     75 struct DataSegment;
     76 using MutableDataSegment = RefPtr<DataSegment>;
     77 using SharedDataSegment = RefPtr<const DataSegment>;
     78 using DataSegmentVector = Vector<SharedDataSegment, 0, SystemAllocPolicy>;
     79 
     80 struct ModuleElemSegment;
     81 using ModuleElemSegmentVector = Vector<ModuleElemSegment, 0, SystemAllocPolicy>;
     82 
     83 class Val;
     84 using ValVector = GCVector<Val, 0, SystemAllocPolicy>;
     85 
     86 // Uint32Vector has initial size 8 on the basis that the dominant use cases
     87 // (line numbers and control stacks) tend to have a small but nonzero number
     88 // of elements.
     89 using Uint32Vector = Vector<uint32_t, 8, SystemAllocPolicy>;
     90 
     91 using Bytes = Vector<uint8_t, 0, SystemAllocPolicy>;
     92 using UTF8Bytes = Vector<char, 0, SystemAllocPolicy>;
     93 using InstanceVector = Vector<Instance*, 0, SystemAllocPolicy>;
     94 using UniqueCharsVector = Vector<UniqueChars, 0, SystemAllocPolicy>;
     95 
     96 class RecGroup;
     97 class TypeDef;
     98 class TypeContext;
     99 enum class TypeDefKind : uint8_t;
    100 
    101 template <class T>
    102 class PackedType;
    103 
    104 class ValTypeTraits;
    105 using ValType = PackedType<ValTypeTraits>;
    106 class RefType;
    107 class MaybeRefType;
    108 
    109 }  // namespace wasm
    110 }  // namespace js
    111 
    112 #endif  // wasm_type_decls_h