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;
}
/**************************************************************************** |
216225 |
AsmJS.h |
|
4806 |
GenerateBuiltinModules.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/GenerateBuiltinModules.py. Do not edit! */
%(contents)s
#endif // %(includeguard)s
|
5479 |
moz.build |
|
1890 |
test.js |
|
0 |
WasmAnyRef.cpp |
|
3552 |
WasmAnyRef.h |
|
15035 |
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.
|
404764 |
WasmBaselineCompile.h |
|
3152 |
WasmBCClass-inl.h |
|
4256 |
WasmBCClass.h |
|
73502 |
WasmBCCodegen-inl.h |
|
14898 |
WasmBCDefs.h |
|
6256 |
WasmBCFrame.cpp |
|
19259 |
WasmBCFrame.h |
|
52351 |
WasmBCMemory.cpp |
|
94996 |
WasmBCRegDefs-inl.h |
|
3974 |
WasmBCRegDefs.h |
|
23690 |
WasmBCRegMgmt-inl.h |
|
11907 |
WasmBCStk.h |
|
9198 |
WasmBCStkMgmt-inl.h |
|
32429 |
WasmBinary.cpp |
|
9193 |
WasmBinary.h |
|
28007 |
WasmBinaryTypes.h |
wasm_WasmBinaryTypes_h |
2680 |
WasmBuiltinModule.cpp |
reportOOM |
14298 |
WasmBuiltinModule.h |
|
5298 |
WasmBuiltinModule.yaml |
|
13780 |
WasmBuiltins.cpp |
|
84161 |
WasmBuiltins.h |
|
12093 |
WasmCode.cpp |
|
56679 |
WasmCode.h |
|
45158 |
WasmCodegenConstants.h |
|
3399 |
WasmCodegenTypes.cpp |
|
11901 |
WasmCodegenTypes.h |
|
50202 |
WasmCompile.cpp |
|
41382 |
WasmCompile.h |
|
4728 |
WasmCompileArgs.h |
|
9867 |
WasmConstants.h |
|
31201 |
WasmContext.h |
|
2137 |
WasmDebug.cpp |
|
17630 |
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,
of which there is one per module, generated by GenerateDebugStub in
WasmStubs.cpp. When any function in an instance needs to debug-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 (1) it is not
null and (2) subject to filtering as follows.
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 stub at the end of the function (the
Per Function Debug Stub) to check whether the bit is set for the function.
If it is not set, the per-function stub can return to its caller
immediately; if the bit is set, the per-function stub will jump to the
installed (per-module) Debug Trap Stub.
See also [SMDOC] "Wasm debug traps -- code details"
|
7585 |
WasmDebugFrame.cpp |
static |
5967 |
WasmDebugFrame.h |
|
7316 |
WasmDump.cpp |
|
8429 |
WasmDump.h |
|
2454 |
WasmException.h |
|
1642 |
WasmExprType.h |
|
9575 |
WasmFeatures.cpp |
|
11521 |
WasmFeatures.h |
|
4271 |
WasmFrame.h |
|
18642 |
WasmFrameIter.cpp |
|
76539 |
WasmFrameIter.h |
|
12662 |
WasmGC.cpp |
|
11825 |
WasmGC.h |
|
19871 |
WasmGcObject-inl.h |
static |
14117 |
WasmGcObject.cpp |
|
25962 |
WasmGcObject.h |
|
22806 |
WasmGenerator.cpp |
limitedSize= |
49021 |
WasmGenerator.h |
|
12318 |
WasmHeuristics.h |
|
12092 |
WasmInitExpr.cpp |
|
20421 |
WasmInitExpr.h |
|
4204 |
WasmInstance-inl.h |
|
789 |
WasmInstance.cpp |
|
154487 |
WasmInstance.h |
|
29690 |
WasmInstanceData.h |
|
13254 |
WasmIonCompile.cpp |
|
356151 |
WasmIonCompile.h |
|
1886 |
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.
|
170638 |
WasmJS.h |
|
20414 |
WasmLog.cpp |
|
2079 |
WasmLog.h |
|
1361 |
WasmMemory.cpp |
|
15627 |
WasmMemory.h |
|
9345 |
WasmMetadata.cpp |
|
14694 |
WasmMetadata.h |
|
20850 |
WasmModule.cpp |
|
34408 |
WasmModule.h |
|
8250 |
WasmModuleTypes.cpp |
static |
5591 |
WasmModuleTypes.h |
|
27860 |
WasmOpIter.cpp |
|
63780 |
WasmOpIter.h |
|
133707 |
WasmPI.cpp |
|
74217 |
WasmPI.h |
|
9802 |
WasmProcess.cpp |
= nullptr |
6770 |
WasmProcess.h |
|
2352 |
WasmRealm.cpp |
|
4985 |
WasmRealm.h |
|
2992 |
WasmSerialize.cpp |
|
54380 |
WasmSerialize.h |
|
11812 |
WasmShareable.h |
|
3317 |
WasmSignalHandlers.cpp |
|
36601 |
WasmSignalHandlers.h |
|
2802 |
WasmStaticTypeDefs.cpp |
|
1664 |
WasmStaticTypeDefs.h |
|
1278 |
WasmStubs.cpp |
|
126418 |
WasmStubs.h |
|
11595 |
WasmSummarizeInsn.cpp |
|
58489 |
WasmSummarizeInsn.h |
wasm_WasmSummarizeInsn_h |
1382 |
WasmTable.cpp |
static |
14901 |
WasmTable.h |
|
5338 |
WasmTypeDecls.h |
|
3006 |
WasmTypeDef.cpp |
|
19950 |
WasmTypeDef.h |
|
53097 |
WasmUtility.h |
|
2392 |
WasmValidate.cpp |
|
140141 |
WasmValidate.h |
|
7115 |
WasmValType.cpp |
|
8966 |
WasmValType.h |
|
28583 |
WasmValue.cpp |
|
27536 |
WasmValue.h |
|
16900 |