tor-browser

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

WasmSummarizeInsn.h (1382B)


      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 * This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef wasm_WasmSummarizeInsn_h
      8 #define wasm_WasmSummarizeInsn_h
      9 
     10 #include "mozilla/Maybe.h"
     11 #include "wasm/WasmCodegenTypes.h"  // TrapMachineInsn
     12 
     13 namespace js {
     14 namespace wasm {
     15 
     16 #ifdef DEBUG
     17 
     18 // Inspect the machine instruction at `insn` and return a classification as to
     19 // what it is.  If the instruction can't be identified, return
     20 // `mozilla::Nothing`.  If the instruction is identified, the identification
     21 // must be correct -- in other words, if a `mozilla::Some(i)` is returned, `i`
     22 // must be the correct classification for the instruction.  Return
     23 // `mozilla::Nothing` in case of doubt.
     24 //
     25 // This function is only used by ModuleGenerator::finishCodeBlock to audit wasm
     26 // trap sites.  So it doesn't need to handle the whole complexity of the
     27 // machine's instruction set.  It only needs to handle the tiny sub-dialect
     28 // used by the trappable instructions we actually generate.
     29 mozilla::Maybe<TrapMachineInsn> SummarizeTrapInstruction(const uint8_t* insn);
     30 
     31 #endif
     32 
     33 }  // namespace wasm
     34 }  // namespace js
     35 
     36 #endif /* wasm_WasmSummarizeInsn_h */