Codegen: Add ref.is_invalid instruction

Spidermonkey returns a sentinel ref value of '-1' from some VM functions
to indicate failure. This commit adds an instruction analagous to ref.is_null
that checks for this value.
This commit is contained in:
Ryan Hunt
2019-11-27 14:16:09 -06:00
parent a15bb9cfcb
commit 848baa0aa7
3 changed files with 43 additions and 0 deletions

View File

@@ -3190,6 +3190,24 @@ pub(crate) fn define(
.operands_out(vec![a]),
);
let a = &Operand::new("a", b1);
let x = &Operand::new("x", Ref);
ig.push(
Inst::new(
"is_invalid",
r#"
Reference verification.
The condition code determines if the reference type in question is
invalid or not.
"#,
&formats.unary,
)
.operands_in(vec![x])
.operands_out(vec![a]),
);
let Cond = &Operand::new("Cond", &imm.intcc);
let f = &Operand::new("f", iflags);
let a = &Operand::new("a", b1);