diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-12-01 13:34:22 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-12-17 06:25:23 -0500 |
commit | 9163aaebb670bd87e6ef71beaf24999c926217eb (patch) | |
tree | 48bc403ef6b3349b749b0c38c1e94818b0734274 /js/src/vm | |
parent | 1fd726c6b04faacbb49c525ec733d9419ab65a84 (diff) | |
download | uxp-9163aaebb670bd87e6ef71beaf24999c926217eb.tar.gz |
Bug 1343481 - Part 1: Remove {JSFunction,JSScript,LazyScript}.isGenerator() method.
Tag #1287
Diffstat (limited to 'js/src/vm')
-rw-r--r-- | js/src/vm/Debugger.cpp | 3 | ||||
-rw-r--r-- | js/src/vm/EnvironmentObject.cpp | 21 | ||||
-rw-r--r-- | js/src/vm/GeneratorObject.cpp | 3 | ||||
-rw-r--r-- | js/src/vm/ObjectGroup.cpp | 2 | ||||
-rw-r--r-- | js/src/vm/Probes-inl.h | 5 | ||||
-rw-r--r-- | js/src/vm/SelfHosting.cpp | 3 | ||||
-rw-r--r-- | js/src/vm/Stack-inl.h | 2 | ||||
-rw-r--r-- | js/src/vm/Stack.cpp | 4 | ||||
-rw-r--r-- | js/src/vm/Stack.h | 3 |
9 files changed, 33 insertions, 13 deletions
diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index d68d1b75eb..b3efeb175b 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -7356,7 +7356,8 @@ DebuggerFrame::getEnvironment(JSContext* cx, HandleDebuggerFrame frame, /* static */ bool DebuggerFrame::getIsGenerator(HandleDebuggerFrame frame) { - return DebuggerFrame::getReferent(frame).script()->isGenerator(); + return DebuggerFrame::getReferent(frame).script()->isStarGenerator() || + DebuggerFrame::getReferent(frame).script()->isLegacyGenerator(); } /* static */ bool diff --git a/js/src/vm/EnvironmentObject.cpp b/js/src/vm/EnvironmentObject.cpp index c95bb0597a..7834940f14 100644 --- a/js/src/vm/EnvironmentObject.cpp +++ b/js/src/vm/EnvironmentObject.cpp @@ -2448,7 +2448,9 @@ DebugEnvironments::addDebugEnvironment(JSContext* cx, const EnvironmentIter& ei, MOZ_ASSERT(cx->compartment() == debugEnv->compartment()); // Generators should always have environments. MOZ_ASSERT_IF(ei.scope().is<FunctionScope>(), - !ei.scope().as<FunctionScope>().canonicalFunction()->isGenerator()); + !ei.scope().as<FunctionScope>().canonicalFunction()->isStarGenerator() && + !ei.scope().as<FunctionScope>().canonicalFunction()->isLegacyGenerator() && + !ei.scope().as<FunctionScope>().canonicalFunction()->isAsync()); if (!CanUseDebugEnvironmentMaps(cx)) return true; @@ -2594,8 +2596,11 @@ DebugEnvironments::onPopCall(JSContext* cx, AbstractFramePtr frame) if (!frame.environmentChain()->is<CallObject>()) return; - if (frame.callee()->isGenerator()) + if (frame.callee()->isStarGenerator() || frame.callee()->isLegacyGenerator() || + frame.callee()->isAsync()) + { return; + } CallObject& callobj = frame.environmentChain()->as<CallObject>(); envs->liveEnvs.remove(&callobj); @@ -2726,8 +2731,13 @@ DebugEnvironments::updateLiveEnvironments(JSContext* cx) if (frame.environmentChain()->compartment() != cx->compartment()) continue; - if (frame.isFunctionFrame() && frame.callee()->isGenerator()) - continue; + if (frame.isFunctionFrame()) { + if (frame.callee()->isStarGenerator() || frame.callee()->isLegacyGenerator() || + frame.callee()->isAsync()) + { + continue; + } + } if (!frame.isDebuggee()) continue; @@ -2882,7 +2892,8 @@ GetDebugEnvironmentForMissing(JSContext* cx, const EnvironmentIter& ei) if (ei.scope().is<FunctionScope>()) { RootedFunction callee(cx, ei.scope().as<FunctionScope>().canonicalFunction()); // Generators should always reify their scopes. - MOZ_ASSERT(!callee->isGenerator()); + MOZ_ASSERT(!callee->isStarGenerator() && !callee->isLegacyGenerator() && + !callee->isAsync()); JS::ExposeObjectToActiveJS(callee); Rooted<CallObject*> callobj(cx, CallObject::createHollowForDebug(cx, callee)); diff --git a/js/src/vm/GeneratorObject.cpp b/js/src/vm/GeneratorObject.cpp index ba28501e61..448bc543d1 100644 --- a/js/src/vm/GeneratorObject.cpp +++ b/js/src/vm/GeneratorObject.cpp @@ -19,7 +19,8 @@ using namespace js; JSObject* GeneratorObject::create(JSContext* cx, AbstractFramePtr frame) { - MOZ_ASSERT(frame.script()->isGenerator()); + MOZ_ASSERT(frame.script()->isStarGenerator() || frame.script()->isLegacyGenerator() || + frame.script()->isAsync()); MOZ_ASSERT(frame.script()->nfixed() == 0); Rooted<GlobalObject*> global(cx, cx->global()); diff --git a/js/src/vm/ObjectGroup.cpp b/js/src/vm/ObjectGroup.cpp index ec0a7aec19..91070b3f6b 100644 --- a/js/src/vm/ObjectGroup.cpp +++ b/js/src/vm/ObjectGroup.cpp @@ -184,7 +184,7 @@ ObjectGroup::useSingletonForNewObject(JSContext* cx, JSScript* script, jsbytecod * Sub2 lets us continue to distinguish the two subclasses and any extra * properties added to those prototype objects. */ - if (script->isGenerator()) + if (script->isStarGenerator() || script->isLegacyGenerator() || script->isAsync()) return false; if (JSOp(*pc) != JSOP_NEW) return false; diff --git a/js/src/vm/Probes-inl.h b/js/src/vm/Probes-inl.h index 347f842b8e..822a8ac598 100644 --- a/js/src/vm/Probes-inl.h +++ b/js/src/vm/Probes-inl.h @@ -41,7 +41,10 @@ probes::EnterScript(JSContext* cx, JSScript* script, JSFunction* maybeFun, if (rt->spsProfiler.enabled()) { if (!rt->spsProfiler.enter(cx, script, maybeFun)) return false; - MOZ_ASSERT_IF(!fp->script()->isGenerator(), !fp->hasPushedSPSFrame()); + MOZ_ASSERT_IF(!fp->script()->isStarGenerator() && + !fp->script()->isLegacyGenerator() && + !fp->script()->isAsync(), + !fp->hasPushedSPSFrame()); fp->setPushedSPSFrame(); } diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index e5d97c7681..2216bf91e9 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -3113,7 +3113,8 @@ JSRuntime::cloneSelfHostedFunctionScript(JSContext* cx, HandlePropertyName name, return false; // JSFunction::generatorKind can't handle lazy self-hosted functions, so we make sure there // aren't any. - MOZ_ASSERT(!sourceFun->isGenerator()); + MOZ_ASSERT(!sourceFun->isStarGenerator() && !sourceFun->isLegacyGenerator() && + !sourceFun->isAsync()); MOZ_ASSERT(targetFun->isExtended()); MOZ_ASSERT(targetFun->isInterpretedLazy()); MOZ_ASSERT(targetFun->isSelfHostedBuiltin()); diff --git a/js/src/vm/Stack-inl.h b/js/src/vm/Stack-inl.h index 11a19d1751..2f2b591e5c 100644 --- a/js/src/vm/Stack-inl.h +++ b/js/src/vm/Stack-inl.h @@ -335,7 +335,7 @@ InterpreterStack::resumeGeneratorCallFrame(JSContext* cx, InterpreterRegs& regs, HandleFunction callee, HandleValue newTarget, HandleObject envChain) { - MOZ_ASSERT(callee->isGenerator()); + MOZ_ASSERT(callee->isStarGenerator() || callee->isLegacyGenerator() || callee->isAsync()); RootedScript script(cx, JSFunction::getOrCreateScript(cx, callee)); InterpreterFrame* prev = regs.fp(); jsbytecode* prevpc = regs.pc; diff --git a/js/src/vm/Stack.cpp b/js/src/vm/Stack.cpp index c5f2cf5f34..95940eeaff 100644 --- a/js/src/vm/Stack.cpp +++ b/js/src/vm/Stack.cpp @@ -270,7 +270,9 @@ InterpreterFrame::epilogue(JSContext* cx, jsbytecode* pc) UnwindAllEnvironmentsInFrame(cx, ei); if (isFunctionFrame()) { - if (!callee().isGenerator() && + if (!callee().isStarGenerator() && + !callee().isLegacyGenerator() && + !callee().isAsync() && isConstructing() && thisArgument().isObject() && returnValue().isPrimitive()) diff --git a/js/src/vm/Stack.h b/js/src/vm/Stack.h index 23e6213444..fe04a00f26 100644 --- a/js/src/vm/Stack.h +++ b/js/src/vm/Stack.h @@ -693,7 +693,8 @@ class InterpreterFrame } void resumeGeneratorFrame(JSObject* envChain) { - MOZ_ASSERT(script()->isGenerator()); + MOZ_ASSERT(script()->isStarGenerator() || script()->isLegacyGenerator() || + script()->isAsync()); MOZ_ASSERT(isFunctionFrame()); flags_ |= HAS_INITIAL_ENV; envChain_ = envChain; |