AsmJS.cpp |
/
// A wasm module can either use no memory, a unshared memory (ArrayBuffer) or
// shared memory (SharedArrayBuffer).
enum class MemoryUsage { None = false, Unshared = 1, Shared = 2 };
// The asm.js valid heap lengths are precisely the WASM valid heap lengths for
// ARM greater or equal to MinHeapLength
static const size_t MinHeapLength = PageSize;
// An asm.js heap can in principle be up to INT32_MAX bytes but requirements
// on the format restrict it further to the largest pseudo-ARM-immediate.
// See IsValidAsmJSHeapLength().
static const uint64_t MaxHeapLength = 0x7f000000;
static uint64_t RoundUpToNextValidAsmJSHeapLength(uint64_t length) {
if (length <= MinHeapLength) {
return MinHeapLength;
}
return wasm::RoundUpToNextValidARMImmediate(length);
}
static uint64_t DivideRoundingUp(uint64_t a, uint64_t b) {
return (a + (b - 1)) / b;
}
/**************************************************************************** |
214068 |
AsmJS.h |
|
3602 |
GenerateIntrinsics.py |
\
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef %(includeguard)s
#define %(includeguard)s
/* This file is generated by wasm/GenerateInstrinsic.py. Do not edit! */
%(contents)s
#endif // %(includeguard)s
|
2726 |
moz.build |
|
1793 |
WasmBaselineCompile.cpp |
[SMDOC] WebAssembly baseline compiler (RabaldrMonkey)
For now, see WasmBCClass.h for general comments about the compiler's
structure.
----------------
General assumptions for 32-bit vs 64-bit code:
- A 32-bit register can be extended in-place to a 64-bit register on 64-bit
systems.
- Code that knows that Register64 has a '.reg' member on 64-bit systems and
'.high' and '.low' members on 32-bit systems, or knows the implications
thereof, is #ifdef JS_PUNBOX64. All other code is #if(n)?def JS_64BIT.
Coding standards are a little fluid:
- In "small" code generating functions (eg emitMultiplyF64, emitQuotientI32,
and surrounding functions; most functions fall into this class) where the
meaning is obvious:
Old school:
- if there is a single source + destination register, it is called 'r'
- if there is one source and a different destination, they are called 'rs'
and 'rd'
- if there is one source + destination register and another source register
they are called 'r' and 'rs'
- if there are two source registers and a destination register they are
called 'rs0', 'rs1', and 'rd'.
The new thing:
- what is called 'r' in the old-school naming scheme is increasingly called
'rsd' in source+dest cases.
- Generic temp registers are named /temp[0-9]?/ not /tmp[0-9]?/.
- Registers can be named non-generically for their function ('rp' for the
'pointer' register and 'rv' for the 'value' register are typical) and those
names may or may not have an 'r' prefix.
- "Larger" code generating functions make their own rules.
|
355381 |
WasmBaselineCompile.h |
|
3158 |
WasmBCClass-inl.h |
|
1752 |
WasmBCClass.h |
|
69470 |
WasmBCCodegen-inl.h |
|
14900 |
WasmBCDefs.h |
|
6500 |
WasmBCFrame.cpp |
|
18983 |
WasmBCFrame.h |
|
51748 |
WasmBCMemory.cpp |
|
86534 |
WasmBCRegDefs-inl.h |
|
3974 |
WasmBCRegDefs.h |
|
23589 |
WasmBCRegMgmt-inl.h |
|
12025 |
WasmBCStk.h |
|
9198 |
WasmBCStkMgmt-inl.h |
|
31373 |
WasmBinary.cpp |
|
8977 |
WasmBinary.h |
|
27453 |
WasmBuiltins.cpp |
|
71975 |
WasmBuiltins.h |
|
11150 |
WasmCode.cpp |
|
39616 |
WasmCode.h |
|
30140 |
WasmCodegenConstants.h |
|
3027 |
WasmCodegenTypes.cpp |
|
7203 |
WasmCodegenTypes.h |
|
25200 |
WasmCompile.cpp |
|
30971 |
WasmCompile.h |
|
4033 |
WasmCompileArgs.h |
|
7068 |
WasmConstants.h |
|
27794 |
WasmContext.h |
|
1244 |
WasmDebug.cpp |
|
17346 |
WasmDebug.h |
[SMDOC] Wasm debug traps
There is a single debug trap handler for the process, WasmHandleDebugTrap in
WasmBuiltins.cpp. That function is invoked through the Debug Trap Stub,
generated by GenerateDebugTrapStub in WasmStubs.cpp. When any function in an
instance needs to trap for any reason (enter frame, leave frame, breakpoint,
or single-stepping) then a pointer to the Debug Trap Stub is installed in the
Instance. Debug-enabled code will look for this pointer and call it if it is
not null.
WasmHandleDebugTrap may therefore be called very frequently when any function
in the instance is being debugged, and must filter the trap against the
tables in the DebugState. It can make use of the return address for the
call, which identifies the site uniquely.
In order to greatly reduce the frequency of calls to the Debug Trap Stub, an
array of flag bits, one per function, is attached to the instance. The code
at the breakable point calls a shared stub within the function containing the
breakable point to check whether the bit is set for the function. If it is
not set, the stub can return to its caller immediately; if the bit is set,
the stub will jump to the installed Debug Trap Stub.
|
7181 |
WasmDebugFrame.cpp |
static |
5741 |
WasmDebugFrame.h |
|
7285 |
WasmException.h |
|
962 |
WasmExprType.h |
|
9680 |
WasmFrame.h |
|
18630 |
WasmFrameIter.cpp |
|
64851 |
WasmFrameIter.h |
|
9138 |
WasmGC.cpp |
|
11247 |
WasmGC.h |
|
18542 |
WasmGcObject.cpp |
|
31341 |
WasmGcObject.h |
|
16406 |
WasmGenerator.cpp |
limitedSize= |
39799 |
WasmGenerator.h |
|
8886 |
WasmInitExpr.cpp |
eager |
18885 |
WasmInitExpr.h |
|
3247 |
WasmInstance-inl.h |
|
926 |
WasmInstance.cpp |
|
100053 |
WasmInstance.h |
|
22440 |
WasmInstanceData.h |
|
4474 |
WasmIntrinsic.cpp |
static |
7772 |
WasmIntrinsic.h |
|
2154 |
WasmIntrinsic.yaml |
|
7347 |
WasmIonCompile.cpp |
|
288038 |
WasmIonCompile.h |
|
1524 |
WasmJS.cpp |
[SMDOC] WebAssembly code rules (evolving)
TlsContext.get() is only to be invoked from functions that have been invoked
_directly_ by generated code as cold(!) Builtin calls, from code that is
only used by signal handlers, or from helper functions that have been
called _directly_ from a simulator. All other code shall pass in a
JSContext* to functions that need it, or an Instance* or Instance* since
the context is available through them.
Code that uses TlsContext.get() shall annotate each such call with the
reason why the call is OK.
|
179496 |
WasmJS.h |
|
23350 |
WasmLog.cpp |
|
2017 |
WasmLog.h |
|
1361 |
WasmMemory.cpp |
|
15495 |
WasmMemory.h |
|
8824 |
WasmModule.cpp |
|
37850 |
WasmModule.h |
|
8409 |
WasmModuleTypes.cpp |
static |
4907 |
WasmModuleTypes.h |
|
19775 |
WasmOpIter.cpp |
|
27112 |
WasmOpIter.h |
|
132151 |
WasmProcess.cpp |
|
13393 |
WasmProcess.h |
|
2286 |
WasmRealm.cpp |
|
4869 |
WasmRealm.h |
|
2719 |
WasmSerialize.cpp |
|
41086 |
WasmSerialize.h |
|
11741 |
WasmShareable.h |
|
2563 |
WasmSignalHandlers.cpp |
|
37190 |
WasmSignalHandlers.h |
|
2802 |
WasmStubs.cpp |
|
115660 |
WasmStubs.h |
|
11375 |
WasmTable.cpp |
static |
13522 |
WasmTable.h |
|
5088 |
WasmTypeDecls.h |
|
3019 |
WasmTypeDef.cpp |
|
17332 |
WasmTypeDef.h |
|
49235 |
WasmUtility.h |
|
2399 |
WasmValidate.cpp |
|
105865 |
WasmValidate.h |
|
11097 |
WasmValType.cpp |
|
10741 |
WasmValType.h |
|
26017 |
WasmValue.cpp |
|
28095 |
WasmValue.h |
|
22934 |