Ejemplo n.º 1
0
bool
RSimdBox::recover(JSContext* cx, SnapshotIterator& iter) const
{
    JSObject* resultObject = nullptr;
    RValueAllocation a = iter.readAllocation();
    MOZ_ASSERT(iter.allocationReadable(a));
    MOZ_ASSERT_IF(a.mode() == RValueAllocation::ANY_FLOAT_REG, a.fpuReg().isSimd128());
    const FloatRegisters::RegisterContent* raw = iter.floatAllocationPointer(a);
    switch (SimdType(type_)) {
      case SimdType::Bool8x16:
        resultObject = js::CreateSimd<Bool8x16>(cx, (const Bool8x16::Elem*) raw);
        break;
      case SimdType::Int8x16:
        resultObject = js::CreateSimd<Int8x16>(cx, (const Int8x16::Elem*) raw);
        break;
      case SimdType::Uint8x16:
        resultObject = js::CreateSimd<Uint8x16>(cx, (const Uint8x16::Elem*) raw);
        break;
      case SimdType::Bool16x8:
        resultObject = js::CreateSimd<Bool16x8>(cx, (const Bool16x8::Elem*) raw);
        break;
      case SimdType::Int16x8:
        resultObject = js::CreateSimd<Int16x8>(cx, (const Int16x8::Elem*) raw);
        break;
      case SimdType::Uint16x8:
        resultObject = js::CreateSimd<Uint16x8>(cx, (const Uint16x8::Elem*) raw);
        break;
      case SimdType::Bool32x4:
        resultObject = js::CreateSimd<Bool32x4>(cx, (const Bool32x4::Elem*) raw);
        break;
      case SimdType::Int32x4:
        resultObject = js::CreateSimd<Int32x4>(cx, (const Int32x4::Elem*) raw);
        break;
      case SimdType::Uint32x4:
        resultObject = js::CreateSimd<Uint32x4>(cx, (const Uint32x4::Elem*) raw);
        break;
      case SimdType::Float32x4:
        resultObject = js::CreateSimd<Float32x4>(cx, (const Float32x4::Elem*) raw);
        break;
      case SimdType::Float64x2:
        MOZ_CRASH("NYI, RSimdBox of Float64x2");
        break;
      case SimdType::Bool64x2:
        MOZ_CRASH("NYI, RSimdBox of Bool64x2");
        break;
      case SimdType::Count:
        MOZ_CRASH("RSimdBox of Count is unreachable");
    }

    if (!resultObject)
        return false;

    RootedValue result(cx);
    result.setObject(*resultObject);
    iter.storeInstructionResult(result);
    return true;
}
Ejemplo n.º 2
0
// These tests are checking that all slots of the current architecture can all
// be encoded and decoded correctly.  We iterate on all registers and on many
// fake stack locations (Fibonacci).
static RValueAllocation Read(const RValueAllocation& slot) {
  CompactBufferWriter writer;
  slot.write(writer);

  // Call hash to run its assertions.
  slot.hash();

  CompactBufferReader reader(writer);
  return RValueAllocation::read(reader);
}
Ejemplo n.º 3
0
// These tests are checking that all slots of the current architecture can all
// be encoded and decoded correctly.  We iterate on all registers and on many
// fake stack locations (Fibonacci).
static RValueAllocation
Read(const RValueAllocation &slot)
{
    CompactBufferWriter writer;
    slot.write(writer);

    CompactBufferReader reader(writer);
    return RValueAllocation::read(reader);
}