mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 953104 - OdinMonkey: report validation failure for missing function-pointer tables (r=bbouvier)
--HG-- extra : rebase_source : 4d3c08640274629bd44393aee2234c4f6f829cb0
This commit is contained in:
parent
5ab78a1a10
commit
7384b47bfa
@ -12,7 +12,7 @@ assertAsmTypeFail(USE_ASM + "function f() {} function g(i) {i=i|0} var tbl=[f,g]
|
||||
assertAsmTypeFail(USE_ASM + "function f() {} function g() {return 0} var tbl=[f,g]; return f");
|
||||
assertAsmTypeFail(USE_ASM + "function f(i) {i=i|0} function g(i) {i=+i} var tbl=[f,g]; return f");
|
||||
assertAsmTypeFail(USE_ASM + "function f() {return 0} function g() {return 0.0} var tbl=[f,g]; return f");
|
||||
assertAsmTypeFail(USE_ASM + "var tbl=0; function g() {tbl[0&1]()} return g");
|
||||
assertAsmTypeFail(USE_ASM + "var tbl=0; function g() {tbl[0&1]()|0} return g");
|
||||
assertEq(asmLink(asmCompile(USE_ASM + "function f() { return 42 } var tbl=[f]; return f"))(), 42);
|
||||
assertEq(asmLink(asmCompile(USE_ASM + "function f() {return 0} function g() {return 1} var tbl=[f,g]; return f"))(), 0);
|
||||
|
||||
@ -26,6 +26,7 @@ assertAsmTypeFail(USE_ASM + "function f() {return 42} function g(i) { i=i|0; ret
|
||||
assertAsmTypeFail(USE_ASM + "function f(i) {i=i|0} function g(i) { i=i|0; return tbl[i&1]()|0 } var tbl=[f,f]; return g");
|
||||
assertAsmTypeFail(USE_ASM + "function f(i) {i=i|0} function g(i) { i=i|0; return tbl[i&1](3.0)|0 } var tbl=[f,f]; return g");
|
||||
assertAsmTypeFail(USE_ASM + "function f(d) {d=+d} function g(i) { i=i|0; return tbl[i&1](3)|0 } var tbl=[f,f]; return g");
|
||||
assertAsmTypeFail(USE_ASM + "function g() {tbl[0&1]()|0} return g");
|
||||
assertEq(asmLink(asmCompile(USE_ASM + "function f() {return 42} function g(i) { i=i|0; return tbl[i&1]()|0 } var tbl=[f,f]; return g"))(0), 42);
|
||||
assertEq(asmLink(asmCompile(USE_ASM + "function f() {return 42} function g(i) { i=i|0; return tbl[i&1]()|0 } const tbl=[f,f]; return g"))(0), 42);
|
||||
assertEq(asmLink(asmCompile(USE_ASM + "function f() {return 42} function g() {return 13} function h(i) { i=i|0; return tbl[i&1]()|0 } var tbl=[f,g]; return h"))(1), 13);
|
||||
|
@ -1209,8 +1209,9 @@ class MOZ_STACK_CLASS ModuleCompiler
|
||||
unsigned mask() const { return mask_; }
|
||||
unsigned globalDataOffset() const { return globalDataOffset_; }
|
||||
|
||||
void initElems(FuncPtrVector &&elems) { elems_ = Move(elems); JS_ASSERT(!elems_.empty()); }
|
||||
unsigned numElems() const { JS_ASSERT(!elems_.empty()); return elems_.length(); }
|
||||
bool initialized() const { return !elems_.empty(); }
|
||||
void initElems(FuncPtrVector &&elems) { elems_ = Move(elems); JS_ASSERT(initialized()); }
|
||||
unsigned numElems() const { JS_ASSERT(initialized()); return elems_.length(); }
|
||||
const Func &elem(unsigned i) const { return *elems_[i]; }
|
||||
};
|
||||
|
||||
@ -5702,6 +5703,11 @@ CheckFuncPtrTables(ModuleCompiler &m)
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < m.numFuncPtrTables(); i++) {
|
||||
if (!m.funcPtrTable(i).initialized())
|
||||
return m.fail(nullptr, "expecting function-pointer table");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user