Issue #2645 - Fix type confusion for ResumeKind

It used a mix of uint8_t and uint16_t. Set it to uint16_t.
Also don't allow non-typeset to simplify stubs used in compound opcodes.
This commit is contained in:
Moonchild 2024-10-11 22:02:44 +02:00 committed by roytam1
commit 19c4996881
3 changed files with 8 additions and 5 deletions

View file

@ -1960,8 +1960,13 @@ CASE(JSOP_RETRVAL)
/* Resume execution in the calling frame. */
if (MOZ_LIKELY(interpReturnOK)) {
TypeScript::Monitor(cx, script, REGS.pc, REGS.sp[-1]);
if (JSOp(*REGS.pc) == JSOP_RESUME) {
ADVANCE_AND_DISPATCH(JSOP_RESUME_LENGTH);
}
TypeScript::Monitor(cx, script, REGS.pc, REGS.sp[-1]);
MOZ_ASSERT(CodeSpec[*REGS.pc].length == JSOP_CALL_LENGTH);
ADVANCE_AND_DISPATCH(JSOP_CALL_LENGTH);
}

View file

@ -2106,7 +2106,7 @@
* Operands: resume kind (GeneratorObject::ResumeKind)
* Stack: gen, val => rval
*/ \
macro(JSOP_RESUME, 205,"resume", NULL, 3, 2, 1, JOF_UINT8|JOF_INVOKE) \
macro(JSOP_RESUME, 205,"resume", NULL, 2, 2, 1, JOF_UINT16|JOF_INVOKE) \
/*
* Pops the top two values on the stack as 'obj' and 'v', pushes 'v' to
* 'obj'.

View file

@ -3335,9 +3335,7 @@ js::TypeMonitorResult(JSContext* cx, JSScript* script, jsbytecode* pc, TypeSet::
void
js::TypeMonitorResult(JSContext* cx, JSScript* script, jsbytecode* pc, const js::Value& rval)
{
/* Allow the non-TYPESET scenario to simplify stubs used in compound opcodes. */
if (!(CodeSpec[*pc].format & JOF_TYPESET))
return;
MOZ_ASSERT(CodeSpec[*pc].format & JOF_TYPESET);
if (!script->hasBaselineScript())
return;