Bug 1266781: Add new traps; r=luke

MozReview-Commit-ID: FixlUGoHUdR

--HG--
extra : rebase_source : 6e02eef4f97bf64b8b2d06e6a97ffe23bc6608ed
This commit is contained in:
Benjamin Bouvier 2016-04-26 18:04:09 +02:00
Родитель f13688180e
Коммит 933f7f7289
4 изменённых файлов: 28 добавлений и 0 удалений

Просмотреть файл

@ -903,6 +903,10 @@ wasm::GenerateJumpTarget(MacroAssembler& masm, JumpTarget target)
return GenerateErrorStub(masm, SymbolicAddress::BadIndirectCall); return GenerateErrorStub(masm, SymbolicAddress::BadIndirectCall);
case JumpTarget::UnreachableTrap: case JumpTarget::UnreachableTrap:
return GenerateErrorStub(masm, SymbolicAddress::UnreachableTrap); return GenerateErrorStub(masm, SymbolicAddress::UnreachableTrap);
case JumpTarget::InvalidConversionToIntegerTrap:
return GenerateErrorStub(masm, SymbolicAddress::InvalidConversionToIntegerTrap);
case JumpTarget::IntegerOverflowTrap:
return GenerateErrorStub(masm, SymbolicAddress::IntegerOverflowTrap);
case JumpTarget::Throw: case JumpTarget::Throw:
return GenerateThrow(masm); return GenerateThrow(masm);
case JumpTarget::Limit: case JumpTarget::Limit:

Просмотреть файл

@ -86,6 +86,20 @@ UnreachableTrap()
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_WASM_UNREACHABLE); JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_WASM_UNREACHABLE);
} }
static void
IntegerOverflowTrap()
{
JSContext* cx = JSRuntime::innermostWasmActivation()->cx();
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_WASM_INTEGER_OVERFLOW);
}
static void
InvalidConversionToIntegerTrap()
{
JSContext* cx = JSRuntime::innermostWasmActivation()->cx();
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_WASM_INVALID_CONVERSION);
}
static int32_t static int32_t
CoerceInPlace_ToInt32(MutableHandleValue val) CoerceInPlace_ToInt32(MutableHandleValue val)
{ {
@ -238,6 +252,10 @@ wasm::AddressOf(SymbolicAddress imm, ExclusiveContext* cx)
return FuncCast(BadIndirectCall, Args_General0); return FuncCast(BadIndirectCall, Args_General0);
case SymbolicAddress::UnreachableTrap: case SymbolicAddress::UnreachableTrap:
return FuncCast(UnreachableTrap, Args_General0); return FuncCast(UnreachableTrap, Args_General0);
case SymbolicAddress::IntegerOverflowTrap:
return FuncCast(IntegerOverflowTrap, Args_General0);
case SymbolicAddress::InvalidConversionToIntegerTrap:
return FuncCast(InvalidConversionToIntegerTrap, Args_General0);
case SymbolicAddress::HandleExecutionInterrupt: case SymbolicAddress::HandleExecutionInterrupt:
return FuncCast(WasmHandleExecutionInterrupt, Args_General0); return FuncCast(WasmHandleExecutionInterrupt, Args_General0);
case SymbolicAddress::InvokeImport_Void: case SymbolicAddress::InvokeImport_Void:

Просмотреть файл

@ -614,6 +614,8 @@ enum class SymbolicAddress
OnImpreciseConversion, OnImpreciseConversion,
BadIndirectCall, BadIndirectCall,
UnreachableTrap, UnreachableTrap,
IntegerOverflowTrap,
InvalidConversionToIntegerTrap,
HandleExecutionInterrupt, HandleExecutionInterrupt,
InvokeImport_Void, InvokeImport_Void,
InvokeImport_I32, InvokeImport_I32,
@ -643,6 +645,8 @@ enum class JumpTarget
ConversionError, ConversionError,
BadIndirectCall, BadIndirectCall,
UnreachableTrap, UnreachableTrap,
IntegerOverflowTrap,
InvalidConversionToIntegerTrap,
Throw, Throw,
Limit Limit
}; };

Просмотреть файл

@ -350,6 +350,8 @@ MSG_DEF(JSMSG_WASM_BAD_IND_CALL, 0, JSEXN_ERR, "wasm indirect call sig
MSG_DEF(JSMSG_WASM_BAD_BUF_ARG, 0, JSEXN_TYPEERR, "first argument must be a typed array") MSG_DEF(JSMSG_WASM_BAD_BUF_ARG, 0, JSEXN_TYPEERR, "first argument must be a typed array")
MSG_DEF(JSMSG_WASM_BAD_IMPORT_ARG, 0, JSEXN_TYPEERR, "second argument, if present, must be an object") MSG_DEF(JSMSG_WASM_BAD_IMPORT_ARG, 0, JSEXN_TYPEERR, "second argument, if present, must be an object")
MSG_DEF(JSMSG_WASM_UNREACHABLE, 0, JSEXN_ERR, "reached unreachable trap") MSG_DEF(JSMSG_WASM_UNREACHABLE, 0, JSEXN_ERR, "reached unreachable trap")
MSG_DEF(JSMSG_WASM_INTEGER_OVERFLOW, 0, JSEXN_ERR, "integer overflow")
MSG_DEF(JSMSG_WASM_INVALID_CONVERSION, 0, JSEXN_ERR, "invalid conversion to integer")
// Proxy // Proxy
MSG_DEF(JSMSG_BAD_TRAP_RETURN_VALUE, 2, JSEXN_TYPEERR,"trap {1} for {0} returned a primitive value") MSG_DEF(JSMSG_BAD_TRAP_RETURN_VALUE, 2, JSEXN_TYPEERR,"trap {1} for {0} returned a primitive value")