Bug 1262367: Baldr: Rename "trap" to "unreachable"; r=luke

MozReview-Commit-ID: B8Lgj4mF5aq

--HG--
extra : rebase_source : 8b024a6daa420eeca5fafe180ae58ba222a720e8
extra : amend_source : bce7ecb1dcbcf8e0001e461577da9e4eccfd048f
This commit is contained in:
Benjamin Bouvier 2016-04-06 10:36:42 +02:00
Родитель 907939a278
Коммит ad6e9687bd
3 изменённых файлов: 20 добавлений и 17 удалений

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

@ -211,8 +211,8 @@ enum class WasmAstExprKind
SetLocal,
Store,
TernaryOperator,
Trap,
UnaryOperator,
Unreachable
};
class WasmAstExpr : public WasmAstNode
@ -241,10 +241,10 @@ struct WasmAstNop : WasmAstExpr
{}
};
struct WasmAstTrap : WasmAstExpr
struct WasmAstUnreachable : WasmAstExpr
{
WasmAstTrap()
: WasmAstExpr(WasmAstExprKind::Trap)
WasmAstUnreachable()
: WasmAstExpr(WasmAstExprKind::Unreachable)
{}
};
@ -831,9 +831,9 @@ class WasmToken
Table,
TernaryOpcode,
Text,
Trap,
Type,
UnaryOpcode,
Unreachable,
ValueType
};
private:
@ -1996,8 +1996,11 @@ WasmTokenStream::next()
return WasmToken(WasmToken::Table, begin, cur_);
if (consume(MOZ_UTF16("type")))
return WasmToken(WasmToken::Type, begin, cur_);
if (consume(MOZ_UTF16("trap")))
return WasmToken(WasmToken::Trap, begin, cur_);
break;
case 'u':
if (consume(MOZ_UTF16("unreachable")))
return WasmToken(WasmToken::Unreachable, begin, cur_);
break;
default:
@ -2772,8 +2775,8 @@ ParseExprInsideParens(WasmParseContext& c)
switch (token.kind()) {
case WasmToken::Nop:
return new(c.lifo) WasmAstNop;
case WasmToken::Trap:
return new(c.lifo) WasmAstTrap;
case WasmToken::Unreachable:
return new(c.lifo) WasmAstUnreachable;
case WasmToken::BinaryOpcode:
return ParseBinaryOperator(c, token.expr());
case WasmToken::Block:
@ -3491,7 +3494,7 @@ ResolveExpr(Resolver& r, WasmAstExpr& expr)
{
switch (expr.kind()) {
case WasmAstExprKind::Nop:
case WasmAstExprKind::Trap:
case WasmAstExprKind::Unreachable:
return true;
case WasmAstExprKind::BinaryOperator:
return ResolveBinaryOperator(r, expr.as<WasmAstBinaryOperator>());
@ -3833,7 +3836,7 @@ EncodeExpr(Encoder& e, WasmAstExpr& expr)
switch (expr.kind()) {
case WasmAstExprKind::Nop:
return e.writeExpr(Expr::Nop);
case WasmAstExprKind::Trap:
case WasmAstExprKind::Unreachable:
return e.writeExpr(Expr::Unreachable);
case WasmAstExprKind::BinaryOperator:
return EncodeBinaryOperator(e, expr.as<WasmAstBinaryOperator>());

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

@ -518,8 +518,8 @@ assertEq(f(3), -1);
// unreachable
const UNREACHABLE = /unreachable/;
assertErrorMessage(wasmEvalText(`(module (func (trap)) (export "" 0))`), Error, UNREACHABLE);
assertErrorMessage(wasmEvalText(`(module (func (if (trap) (i32.const 0))) (export "" 0))`), Error, UNREACHABLE);
assertErrorMessage(wasmEvalText(`(module (func (block (br_if 0 (trap)))) (export "" 0))`), Error, UNREACHABLE);
assertErrorMessage(wasmEvalText(`(module (func (block (br_table 0 (trap)))) (export "" 0))`), Error, UNREACHABLE);
assertErrorMessage(wasmEvalText(`(module (func (result i32) (i32.add (i32.const 0) (trap))) (export "" 0))`), Error, UNREACHABLE);
assertErrorMessage(wasmEvalText(`(module (func (unreachable)) (export "" 0))`), Error, UNREACHABLE);
assertErrorMessage(wasmEvalText(`(module (func (if (unreachable) (i32.const 0))) (export "" 0))`), Error, UNREACHABLE);
assertErrorMessage(wasmEvalText(`(module (func (block (br_if 0 (unreachable)))) (export "" 0))`), Error, UNREACHABLE);
assertErrorMessage(wasmEvalText(`(module (func (block (br_table 0 (unreachable)))) (export "" 0))`), Error, UNREACHABLE);
assertErrorMessage(wasmEvalText(`(module (func (result i32) (i32.add (i32.const 0) (unreachable))) (export "" 0))`), Error, UNREACHABLE);

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

@ -38,7 +38,7 @@ wasmEvalText(`(module
(func (result i32) (param i32) (param i32) (i32.const 0))
(func (result i32)
(call 0 (i32.const 1) (call 0 (i32.const 2) (i32.const 3)))
(call 0 (trap) (i32.const 4))
(call 0 (unreachable) (i32.const 4))
)
)`);