Bug 1342553, Bug 1343072, Bug 1344753 (details in the description)

Bug 1342553 - Part 0.1: Use try-catch for IteratorClose in for-of
Bug 1343072 - Update HasLiveStackValueAtDepth to follow the change in
JSTRY_FOR_OF
Bug 1344753 - Update for-of stack depth in
ControlFlowGenerator::processWhileOrForInLoop

Issue #74
This commit is contained in:
janekptacijarabaci 2018-03-25 16:22:38 +02:00 committed by Roy Tam
commit 444483bf81
11 changed files with 378 additions and 189 deletions

View file

@ -1189,17 +1189,6 @@ ProcessTryNotes(JSContext* cx, EnvironmentIter& ei, InterpreterRegs& regs)
break;
}
case JSTRY_ITERCLOSE: {
// The iterator object is at the top of the stack.
Value* sp = regs.spForStackDepth(tn->stackDepth);
RootedObject iterObject(cx, &sp[-1].toObject());
if (!IteratorCloseForException(cx, iterObject)) {
SettleOnTryNote(cx, tn, ei, regs);
return ErrorReturnContinuation;
}
break;
}
case JSTRY_DESTRUCTURING_ITERCLOSE: {
// Whether the destructuring iterator is done is at the top of the
// stack. The iterator object is second from the top.
@ -1892,7 +1881,6 @@ CASE(JSOP_UNUSED192)
CASE(JSOP_UNUSED209)
CASE(JSOP_UNUSED210)
CASE(JSOP_UNUSED211)
CASE(JSOP_UNUSED219)
CASE(JSOP_UNUSED220)
CASE(JSOP_UNUSED221)
CASE(JSOP_UNUSED222)
@ -2637,6 +2625,15 @@ CASE(JSOP_CHECKISOBJ)
}
END_CASE(JSOP_CHECKISOBJ)
CASE(JSOP_CHECKISCALLABLE)
{
if (!IsCallable(REGS.sp[-1])) {
MOZ_ALWAYS_FALSE(ThrowCheckIsCallable(cx, CheckIsCallableKind(GET_UINT8(REGS.pc))));
goto error;
}
}
END_CASE(JSOP_CHECKISCALLABLE)
CASE(JSOP_CHECKTHIS)
{
if (REGS.sp[-1].isMagic(JS_UNINITIALIZED_LEXICAL)) {
@ -5094,6 +5091,19 @@ js::ThrowCheckIsObject(JSContext* cx, CheckIsObjectKind kind)
return false;
}
bool
js::ThrowCheckIsCallable(JSContext* cx, CheckIsCallableKind kind)
{
switch (kind) {
case CheckIsCallableKind::IteratorReturn:
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_RETURN_NOT_CALLABLE);
break;
default:
MOZ_CRASH("Unknown kind");
}
return false;
}
bool
js::ThrowUninitializedThis(JSContext* cx, AbstractFramePtr frame)
{