зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1134198 - Refactor JS_GENERATOR_CLOSED checking. (r=jandem)
This commit is contained in:
Родитель
3e51d931ff
Коммит
086b9abe47
|
@ -570,7 +570,7 @@ HandleExceptionBaseline(JSContext* cx, const JitFrameIterator& frame, ResumeFrom
|
|||
|
||||
RootedValue exception(cx);
|
||||
if (cx->isExceptionPending() && cx->compartment()->isDebuggee() &&
|
||||
cx->getPendingException(&exception) && !exception.isMagic(JS_GENERATOR_CLOSING))
|
||||
!cx->isClosingGenerator())
|
||||
{
|
||||
switch (Debugger::onExceptionUnwind(cx, frame.baselineFrame())) {
|
||||
case JSTRAP_ERROR:
|
||||
|
@ -633,9 +633,7 @@ HandleExceptionBaseline(JSContext* cx, const JitFrameIterator& frame, ResumeFrom
|
|||
if (cx->isExceptionPending()) {
|
||||
// If we're closing a legacy generator, we have to skip catch
|
||||
// blocks.
|
||||
if (!cx->getPendingException(&exception))
|
||||
continue;
|
||||
if (exception.isMagic(JS_GENERATOR_CLOSING))
|
||||
if (cx->isClosingGenerator())
|
||||
continue;
|
||||
|
||||
// Ion can compile try-catch, but bailing out to catch
|
||||
|
|
|
@ -991,6 +991,12 @@ JSContext::isThrowingOutOfMemory()
|
|||
return throwing && unwrappedException_ == StringValue(names().outOfMemory);
|
||||
}
|
||||
|
||||
bool
|
||||
JSContext::isClosingGenerator()
|
||||
{
|
||||
return throwing && unwrappedException_.isMagic(JS_GENERATOR_CLOSING);
|
||||
}
|
||||
|
||||
bool
|
||||
JSContext::saveFrameChain()
|
||||
{
|
||||
|
|
|
@ -428,6 +428,7 @@ struct JSContext : public js::ExclusiveContext,
|
|||
bool getPendingException(JS::MutableHandleValue rval);
|
||||
|
||||
bool isThrowingOutOfMemory();
|
||||
bool isClosingGenerator();
|
||||
|
||||
void setPendingException(js::Value v);
|
||||
|
||||
|
|
|
@ -1315,11 +1315,7 @@ HandleError(JSContext* cx, InterpreterRegs& regs)
|
|||
again:
|
||||
if (cx->isExceptionPending()) {
|
||||
/* Call debugger throw hooks. */
|
||||
RootedValue exception(cx);
|
||||
if (!cx->getPendingException(&exception))
|
||||
goto again;
|
||||
|
||||
if (!exception.isMagic(JS_GENERATOR_CLOSING)) {
|
||||
if (!cx->isClosingGenerator()) {
|
||||
JSTrapStatus status = Debugger::onExceptionUnwind(cx, regs.fp());
|
||||
switch (status) {
|
||||
case JSTRAP_ERROR:
|
||||
|
@ -1355,9 +1351,7 @@ HandleError(JSContext* cx, InterpreterRegs& regs)
|
|||
switch (tn->kind) {
|
||||
case JSTRY_CATCH:
|
||||
/* Catch cannot intercept the closing of a generator. */
|
||||
if (!cx->getPendingException(&exception))
|
||||
return ErrorReturnContinuation;
|
||||
if (exception.isMagic(JS_GENERATOR_CLOSING))
|
||||
if (cx->isClosingGenerator())
|
||||
break;
|
||||
return CatchContinuation;
|
||||
|
||||
|
@ -1385,16 +1379,10 @@ HandleError(JSContext* cx, InterpreterRegs& regs)
|
|||
* Propagate the exception or error to the caller unless the exception
|
||||
* is an asynchronous return from a generator.
|
||||
*/
|
||||
if (cx->isExceptionPending()) {
|
||||
RootedValue exception(cx);
|
||||
if (!cx->getPendingException(&exception))
|
||||
return ErrorReturnContinuation;
|
||||
|
||||
if (exception.isMagic(JS_GENERATOR_CLOSING)) {
|
||||
cx->clearPendingException();
|
||||
ok = true;
|
||||
SetReturnValueForClosingGenerator(cx, regs.fp());
|
||||
}
|
||||
if (cx->isClosingGenerator()) {
|
||||
cx->clearPendingException();
|
||||
ok = true;
|
||||
SetReturnValueForClosingGenerator(cx, regs.fp());
|
||||
}
|
||||
} else {
|
||||
// We may be propagating a forced return from the interrupt
|
||||
|
|
Загрузка…
Ссылка в новой задаче