diff options
Diffstat (limited to 'js/src/wasm/WasmConstants.h')
-rw-r--r-- | js/src/wasm/WasmConstants.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/js/src/wasm/WasmConstants.h b/js/src/wasm/WasmConstants.h index 0ce741b2d0..8d339d5cf3 100644 --- a/js/src/wasm/WasmConstants.h +++ b/js/src/wasm/WasmConstants.h @@ -94,6 +94,9 @@ enum class TypeCode { // A null reference in the func hierarchy. NullFuncRef = 0x73, // SLEB128(-0x0D) + // A null reference in the exn hierarchy. + NullExnRef = 0x74, // SLEB128(-0x0C) + // A reference to any struct value. StructRef = 0x6b, // SLEB128(-0x15) @@ -994,6 +997,19 @@ struct BuiltinModuleIds { WASM_DECLARE_CACHEABLE_POD(BuiltinModuleIds) +enum class StackSwitchKind { + SwitchToSuspendable, + SwitchToMain, + ContinueOnSuspendable, +}; + +enum class UpdateSuspenderStateAction { + Enter, + Suspend, + Resume, + Leave, +}; + enum class MozOp { // ------------------------------------------------------------------------ // These operators are emitted internally when compiling asm.js and are @@ -1041,6 +1057,8 @@ enum class MozOp { // particular operation id. See BuiltinModuleFuncId above. CallBuiltinModuleFunc, + StackSwitch, + Limit }; @@ -1092,6 +1110,7 @@ struct OpBytes { static const char NameSectionName[] = "name"; static const char SourceMappingURLSectionName[] = "sourceMappingURL"; +static const char BranchHintingSectionName[] = "metadata.code.branch_hint"; enum class NameType { Module = 0, Function = 1, Local = 2 }; @@ -1151,6 +1170,7 @@ static_assert(uint64_t(MaxArrayPayloadBytes) < static const unsigned MaxTryTableCatches = 10000; static const unsigned MaxBrTableElems = 1000000; static const unsigned MaxCodeSectionBytes = MaxModuleBytes; +static const unsigned MaxBranchHintValue = 2; // 512KiB should be enough, considering how Rabaldr uses the stack and // what the standard limits are: @@ -1163,6 +1183,21 @@ static const unsigned MaxCodeSectionBytes = MaxModuleBytes; static const unsigned MaxFrameSize = 512 * 1024; +// Limit for the amount of stacks present in the runtime. +static const size_t SuspendableStacksMaxCount = 100; + +// Max size of an allocated stack. +static const size_t SuspendableStackSize = 0x100000; + +// Size of additional space at the top of a suspendable stack. +// The space is allocated to C++ handlers such as error/trap handlers, +// or stack snapshots utilities. +static const size_t SuspendableRedZoneSize = 0x6000; + +// Total size of a suspendable stack to be reserved. +static constexpr size_t SuspendableStackPlusRedZoneSize = + SuspendableStackSize + SuspendableRedZoneSize; + // Asserted by Decoder::readVarU32. static const unsigned MaxVarU32DecodedBytes = 5; |