зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1620960 part 1 - Add JSTryNote::isLoop. r=tcampbell
Later patches will use this. Differential Revision: https://phabricator.services.mozilla.com/D66002 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
22fc0b5d6e
Коммит
4903f49cdc
|
@ -5603,19 +5603,8 @@ void JSScript::updateJitCodeRaw(JSRuntime* rt) {
|
|||
|
||||
bool JSScript::hasLoops() {
|
||||
for (const JSTryNote& tn : trynotes()) {
|
||||
switch (tn.kind) {
|
||||
case JSTRY_FOR_IN:
|
||||
case JSTRY_FOR_OF:
|
||||
case JSTRY_LOOP:
|
||||
return true;
|
||||
case JSTRY_CATCH:
|
||||
case JSTRY_FINALLY:
|
||||
case JSTRY_FOR_OF_ITERCLOSE:
|
||||
case JSTRY_DESTRUCTURING:
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(false, "Add new try note type to JSScript::hasLoops");
|
||||
break;
|
||||
if (tn.isLoop()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -143,6 +143,21 @@ struct JSTryNote {
|
|||
|
||||
template <js::XDRMode mode>
|
||||
js::XDRResult XDR(js::XDRState<mode>* xdr);
|
||||
|
||||
bool isLoop() const {
|
||||
switch (kind) {
|
||||
case JSTRY_LOOP:
|
||||
case JSTRY_FOR_IN:
|
||||
case JSTRY_FOR_OF:
|
||||
return true;
|
||||
case JSTRY_CATCH:
|
||||
case JSTRY_FINALLY:
|
||||
case JSTRY_FOR_OF_ITERCLOSE:
|
||||
case JSTRY_DESTRUCTURING:
|
||||
return false;
|
||||
}
|
||||
MOZ_CRASH("Unexpected try note kind");
|
||||
}
|
||||
};
|
||||
|
||||
namespace js {
|
||||
|
|
Загрузка…
Ссылка в новой задаче