diff options
Diffstat (limited to 'deps/v8/src/compiler/wasm-compiler.h')
-rw-r--r-- | deps/v8/src/compiler/wasm-compiler.h | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/deps/v8/src/compiler/wasm-compiler.h b/deps/v8/src/compiler/wasm-compiler.h index ab42610239..c431f53efe 100644 --- a/deps/v8/src/compiler/wasm-compiler.h +++ b/deps/v8/src/compiler/wasm-compiler.h @@ -58,15 +58,12 @@ wasm::WasmCompilationResult ExecuteTurbofanWasmCompilation( // type of the target function/callable and whether the signature matches the // argument arity. enum class WasmImportCallKind : uint8_t { - kLinkError, // static Wasm->Wasm type error - kRuntimeTypeError, // runtime Wasm->JS type error - kWasmToCapi, // fast Wasm->C-API call - kWasmToWasm, // fast Wasm->Wasm call - kJSFunctionArityMatch, // fast Wasm->JS call - kJSFunctionArityMismatch, // Wasm->JS, needs adapter frame - kJSFunctionArityMismatchSkipAdaptor, // Wasm->JS, arity mismatch calling - // strict mode function where we don't - // need the ArgumentsAdaptorTrampoline. + kLinkError, // static Wasm->Wasm type error + kRuntimeTypeError, // runtime Wasm->JS type error + kWasmToCapi, // fast Wasm->C-API call + kWasmToWasm, // fast Wasm->Wasm call + kJSFunctionArityMatch, // fast Wasm->JS call + kJSFunctionArityMismatch, // Wasm->JS, needs adapter frame // Math functions imported from JavaScript that are intrinsified kFirstMathIntrinsic, kF64Acos = kFirstMathIntrinsic, @@ -126,6 +123,11 @@ std::unique_ptr<OptimizedCompilationJob> NewJSToWasmCompilationJob( const wasm::FunctionSig* sig, const wasm::WasmModule* module, bool is_import, const wasm::WasmFeatures& enabled_features); +MaybeHandle<Code> CompileWasmToJSWrapper(Isolate* isolate, + const wasm::FunctionSig* sig, + WasmImportCallKind kind, + int expected_arity); + // Compiles a stub with JS linkage that serves as an adapter for function // objects constructed via {WebAssembly.Function}. It performs a round-trip // simulating a JS-to-Wasm-to-JS coercion of parameter and return values. @@ -206,10 +208,8 @@ class WasmGraphBuilder { Node* RefNull(); Node* RefFunc(uint32_t function_index); Node* RefAsNonNull(Node* arg, wasm::WasmCodePosition position); - Node* Uint32Constant(uint32_t value); Node* Int32Constant(int32_t value); Node* Int64Constant(int64_t value); - Node* IntPtrConstant(intptr_t value); Node* Float32Constant(float value); Node* Float64Constant(double value); Node* Simd128Constant(const uint8_t value[16]); @@ -303,23 +303,28 @@ class WasmGraphBuilder { //----------------------------------------------------------------------- Node* CurrentMemoryPages(); Node* TraceMemoryOperation(bool is_store, MachineRepresentation, Node* index, - uint32_t offset, wasm::WasmCodePosition); + uintptr_t offset, wasm::WasmCodePosition); Node* LoadMem(wasm::ValueType type, MachineType memtype, Node* index, - uint32_t offset, uint32_t alignment, + uint64_t offset, uint32_t alignment, wasm::WasmCodePosition position); #if defined(V8_TARGET_BIG_ENDIAN) || defined(V8_TARGET_ARCH_S390_LE_SIM) Node* LoadTransformBigEndian(wasm::ValueType type, MachineType memtype, wasm::LoadTransformationKind transform, - Node* index, uint32_t offset, uint32_t alignment, + Node* index, uint64_t offset, uint32_t alignment, wasm::WasmCodePosition position); #endif Node* LoadTransform(wasm::ValueType type, MachineType memtype, wasm::LoadTransformationKind transform, Node* index, - uint32_t offset, uint32_t alignment, + uint64_t offset, uint32_t alignment, wasm::WasmCodePosition position); - Node* StoreMem(MachineRepresentation mem_rep, Node* index, uint32_t offset, + Node* LoadLane(MachineType memtype, Node* value, Node* index, uint32_t offset, + uint8_t laneidx, wasm::WasmCodePosition position); + Node* StoreMem(MachineRepresentation mem_rep, Node* index, uint64_t offset, uint32_t alignment, Node* val, wasm::WasmCodePosition position, wasm::ValueType type); + Node* StoreLane(MachineRepresentation mem_rep, Node* index, uint32_t offset, + uint32_t alignment, Node* val, uint8_t laneidx, + wasm::WasmCodePosition position, wasm::ValueType type); static void PrintDebugName(Node* node); void set_instance_node(Node* instance_node) { @@ -382,7 +387,7 @@ class WasmGraphBuilder { Node* Simd8x16ShuffleOp(const uint8_t shuffle[16], Node* const* inputs); Node* AtomicOp(wasm::WasmOpcode opcode, Node* const* inputs, - uint32_t alignment, uint32_t offset, + uint32_t alignment, uint64_t offset, wasm::WasmCodePosition position); Node* AtomicFence(); @@ -455,7 +460,10 @@ class WasmGraphBuilder { Node* BuildLoadIsolateRoot(); - Node* MemBuffer(uint32_t offset); + // MemBuffer is only called with valid offsets (after bounds checking), so the + // offset fits in a platform-dependent uintptr_t. + Node* MemBuffer(uintptr_t offset); + // BoundsCheckMem receives a uint32 {index} node and returns a ptrsize index. Node* BoundsCheckMem(uint8_t access_size, Node* index, uint64_t offset, wasm::WasmCodePosition, EnforceBoundsCheck); @@ -470,8 +478,8 @@ class WasmGraphBuilder { // partially out-of-bounds, traps if it is completely out-of-bounds. Node* BoundsCheckMemRange(Node** start, Node** size, wasm::WasmCodePosition); - Node* CheckBoundsAndAlignment(uint8_t access_size, Node* index, - uint32_t offset, wasm::WasmCodePosition); + Node* CheckBoundsAndAlignment(int8_t access_size, Node* index, + uint64_t offset, wasm::WasmCodePosition); Node* Uint32ToUintptr(Node*); const Operator* GetSafeLoadOperator(int offset, wasm::ValueType type); @@ -612,7 +620,7 @@ class WasmGraphBuilder { Node* BuildMultiReturnFixedArrayFromIterable(const wasm::FunctionSig* sig, Node* iterable, Node* context); - Node* BuildLoadFunctionDataFromExportedFunction(Node* closure); + Node* BuildLoadFunctionDataFromJSFunction(Node* closure); Node* BuildLoadJumpTableOffsetFromExportedFunctionData(Node* function_data); Node* BuildLoadFunctionIndexFromExportedFunctionData(Node* function_data); |