当前位置: 首页>>代码示例>>C++>>正文


C++ FunctionDecoder::d方法代码示例

本文整理汇总了C++中FunctionDecoder::d方法的典型用法代码示例。如果您正苦于以下问题:C++ FunctionDecoder::d方法的具体用法?C++ FunctionDecoder::d怎么用?C++ FunctionDecoder::d使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FunctionDecoder的用法示例。


在下文中一共展示了FunctionDecoder::d方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

static bool
DecodeBranch(FunctionDecoder& f, Expr expr, ExprType* type)
{
    MOZ_ASSERT(expr == Expr::Br || expr == Expr::BrIf);

    uint32_t relativeDepth;
    if (!f.d().readVarU32(&relativeDepth))
        return f.fail("expected relative depth");

    if (!f.branchWithType(relativeDepth, ExprType::Void))
        return f.fail("branch depth exceeds current nesting level");

    Expr value;
    if (!f.d().readExpr(&value))
        return f.fail("expected branch value");

    if (value != Expr::Nop)
        return f.fail("NYI: branch values");

    if (expr == Expr::BrIf) {
        ExprType actual;
        if (!DecodeExpr(f, &actual))
            return false;

        if (!CheckType(f, actual, ValType::I32))
            return false;

        *type = ExprType::Void;
    } else {
        *type = AnyType;
    }

    return true;
}
开发者ID:cbradley857,项目名称:gecko-dev,代码行数:34,代码来源:Wasm.cpp

示例2: DecodeExpr

static bool
DecodeLoadStoreAddress(FunctionDecoder &f)
{
    uint32_t offset, align;
    return DecodeExpr(f, ExprType::I32) &&
           f.d().readVarU32(&offset) &&
           f.d().readVarU32(&align) &&
           mozilla::IsPowerOfTwo(align) &&
           (offset == 0 || f.fail("NYI: address offsets")) &&
           f.fail("NYI: wasm loads and stores");
}
开发者ID:kitcambridge,项目名称:gecko-dev,代码行数:11,代码来源:Wasm.cpp

示例3: CheckType

static bool
DecodeConst(FunctionDecoder& f, ExprType expected)
{
    if (!f.d().readVarU32())
        return f.fail("unable to read i32.const immediate");

    return CheckType(f, ExprType::I32, expected);
}
开发者ID:ajkerrigan,项目名称:gecko-dev,代码行数:8,代码来源:Wasm.cpp

示例4: DecodeCallWithSig

static bool
DecodeCallImport(FunctionDecoder& f, ExprType* type)
{
    uint32_t importIndex;
    if (!f.d().readVarU32(&importIndex))
        return f.fail("unable to read import index");

    if (importIndex >= f.mg().numImports())
        return f.fail("import index out of range");

    return DecodeCallWithSig(f, *f.mg().import(importIndex).sig, type);
}
开发者ID:cbradley857,项目名称:gecko-dev,代码行数:12,代码来源:Wasm.cpp

示例5: CheckType

static bool
DecodeLoadStoreAddress(FunctionDecoder &f, unsigned width)
{
    uint32_t flags;
    if (!f.d().readVarU32(&flags))
        return f.fail("expected memory access flags");

    uint32_t alignLog2 = flags;
    if (alignLog2 >= 32 || (1u << alignLog2) > width)
        return f.fail("greater than natural alignment");

    uint32_t offset;
    if (!f.d().readVarU32(&offset))
        return f.fail("expected memory access offset");

    ExprType baseType;
    if (!DecodeExpr(f, &baseType))
        return false;

    return CheckType(f, baseType, ExprType::I32);
}
开发者ID:cbradley857,项目名称:gecko-dev,代码行数:21,代码来源:Wasm.cpp

示例6: CheckType

static bool
DecodeConstF64(FunctionDecoder& f, ExprType expected)
{
    double value;
    if (!f.d().readFixedF64(&value))
        return f.fail("unable to read f64.const immediate");
    if (IsNaN(value)) {
        const double jsNaN = JS::GenericNaN();
        if (memcmp(&value, &jsNaN, sizeof(value)) != 0)
            return f.fail("NYI: NaN literals with custom payloads");
    }

    return CheckType(f, ExprType::F64, expected);
}
开发者ID:kitcambridge,项目名称:gecko-dev,代码行数:14,代码来源:Wasm.cpp

示例7: DecodeCallWithSig

static bool
DecodeCallIndirect(FunctionDecoder& f, ExprType expected)
{
    uint32_t sigIndex;
    if (!f.d().readVarU32(&sigIndex))
        return f.fail("unable to read indirect call signature index");

    if (sigIndex >= f.mg().numSigs())
        return f.fail("signature index out of range");

    if (!DecodeExpr(f, ExprType::I32))
        return false;

    return DecodeCallWithSig(f, f.mg().sig(sigIndex), expected);
}
开发者ID:kitcambridge,项目名称:gecko-dev,代码行数:15,代码来源:Wasm.cpp

示例8:

static bool
DecodeBlock(FunctionDecoder& f, ExprType expected)
{
    uint32_t numExprs;
    if (!f.d().readVarU32(&numExprs))
        return f.fail("unable to read block's number of expressions");

    if (numExprs) {
        for (uint32_t i = 0; i < numExprs - 1; i++) {
            if (!DecodeExpr(f, ExprType::Void))
                return false;
        }
        if (!DecodeExpr(f, expected))
            return false;
    } else {
        if (!CheckType(f, ExprType::Void, expected))
            return false;
    }

    return true;
}
开发者ID:ajkerrigan,项目名称:gecko-dev,代码行数:21,代码来源:Wasm.cpp

示例9: DecodeNop

static bool
DecodeExpr(FunctionDecoder& f, ExprType* type)
{
    Expr expr;
    if (!f.d().readExpr(&expr))
        return f.fail("unable to read expression");

    switch (expr) {
      case Expr::Nop:
        return DecodeNop(f, type);
      case Expr::Call:
        return DecodeCall(f, type);
      case Expr::CallImport:
        return DecodeCallImport(f, type);
      case Expr::CallIndirect:
        return DecodeCallIndirect(f, type);
      case Expr::I32Const:
        return DecodeConstI32(f, type);
      case Expr::I64Const:
        return DecodeConstI64(f, type);
      case Expr::F32Const:
        return DecodeConstF32(f, type);
      case Expr::F64Const:
        return DecodeConstF64(f, type);
      case Expr::GetLocal:
        return DecodeGetLocal(f, type);
      case Expr::SetLocal:
        return DecodeSetLocal(f, type);
      case Expr::Block:
        return DecodeBlock(f, /* isLoop */ false, type);
      case Expr::Loop:
        return DecodeBlock(f, /* isLoop */ true, type);
      case Expr::If:
        return DecodeIfElse(f, /* hasElse */ false, type);
      case Expr::IfElse:
        return DecodeIfElse(f, /* hasElse */ true, type);
      case Expr::I32Clz:
      case Expr::I32Ctz:
      case Expr::I32Popcnt:
        return DecodeUnaryOperator(f, ValType::I32, type);
      case Expr::I64Clz:
      case Expr::I64Ctz:
      case Expr::I64Popcnt:
        return f.fail("NYI: i64") &&
               DecodeUnaryOperator(f, ValType::I64, type);
      case Expr::F32Abs:
      case Expr::F32Neg:
      case Expr::F32Ceil:
      case Expr::F32Floor:
      case Expr::F32Sqrt:
        return DecodeUnaryOperator(f, ValType::F32, type);
      case Expr::F32Trunc:
        return f.fail("NYI: trunc");
      case Expr::F32Nearest:
        return f.fail("NYI: nearest");
      case Expr::F64Abs:
      case Expr::F64Neg:
      case Expr::F64Ceil:
      case Expr::F64Floor:
      case Expr::F64Sqrt:
        return DecodeUnaryOperator(f, ValType::F64, type);
      case Expr::F64Trunc:
        return f.fail("NYI: trunc");
      case Expr::F64Nearest:
        return f.fail("NYI: nearest");
      case Expr::I32Add:
      case Expr::I32Sub:
      case Expr::I32Mul:
      case Expr::I32DivS:
      case Expr::I32DivU:
      case Expr::I32RemS:
      case Expr::I32RemU:
      case Expr::I32And:
      case Expr::I32Or:
      case Expr::I32Xor:
      case Expr::I32Shl:
      case Expr::I32ShrS:
      case Expr::I32ShrU:
        return DecodeBinaryOperator(f, ValType::I32, type);
      case Expr::I64Add:
      case Expr::I64Sub:
      case Expr::I64Mul:
      case Expr::I64DivS:
      case Expr::I64DivU:
      case Expr::I64RemS:
      case Expr::I64RemU:
      case Expr::I64And:
      case Expr::I64Or:
      case Expr::I64Xor:
      case Expr::I64Shl:
      case Expr::I64ShrS:
      case Expr::I64ShrU:
        return DecodeBinaryOperator(f, ValType::I64, type);
      case Expr::F32Add:
      case Expr::F32Sub:
      case Expr::F32Mul:
      case Expr::F32Div:
      case Expr::F32Min:
      case Expr::F32Max:
        return DecodeBinaryOperator(f, ValType::F32, type);
//.........这里部分代码省略.........
开发者ID:cbradley857,项目名称:gecko-dev,代码行数:101,代码来源:Wasm.cpp


注:本文中的FunctionDecoder::d方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。