Bug 732744 - rm AutoPreserveEnumerators (r=dvander)

--HG--
extra : rebase_source : f28eebcf3a3e14f4db0299b07b28f8e7a783b84a
This commit is contained in:
Luke Wagner 2012-03-06 00:43:45 -08:00
Родитель 224cb16d5d
Коммит 9b4021181a
2 изменённых файлов: 22 добавлений и 25 удалений

Просмотреть файл

@ -440,6 +440,21 @@ js::RunScript(JSContext *cx, JSScript *script, StackFrame *fp)
} }
} }
#ifdef DEBUG
struct CheckStackBalance {
JSContext *cx;
StackFrame *fp;
JSObject *enumerators;
CheckStackBalance(JSContext *cx)
: cx(cx), fp(cx->fp()), enumerators(cx->enumerators)
{}
~CheckStackBalance() {
JS_ASSERT(fp == cx->fp());
JS_ASSERT_IF(!fp->isGeneratorFrame(), enumerators == cx->enumerators);
}
} check(cx);
#endif
#ifdef JS_METHODJIT #ifdef JS_METHODJIT
mjit::CompileStatus status; mjit::CompileStatus status;
status = mjit::CanMethodJIT(cx, script, script->code, fp->isConstructing(), status = mjit::CanMethodJIT(cx, script, script->code, fp->isConstructing(),
@ -511,12 +526,9 @@ js::InvokeKernel(JSContext *cx, CallArgs args, MaybeConstruct construct)
return false; return false;
/* Run function until JSOP_STOP, JSOP_RETURN or error. */ /* Run function until JSOP_STOP, JSOP_RETURN or error. */
JSBool ok; JSBool ok = RunScript(cx, fun->script(), fp);
{
AutoPreserveEnumerators preserve(cx);
ok = RunScript(cx, fun->script(), fp);
}
/* Propagate the return value out. */
args.rval() = fp->returnValue(); args.rval() = fp->returnValue();
JS_ASSERT_IF(ok && construct, !args.rval().isPrimitive()); JS_ASSERT_IF(ok && construct, !args.rval().isPrimitive());
return ok; return ok;
@ -653,17 +665,17 @@ js::ExecuteKernel(JSContext *cx, JSScript *script, JSObject &scopeChain, const V
TypeScript::SetThis(cx, script, fp->thisValue()); TypeScript::SetThis(cx, script, fp->thisValue());
AutoPreserveEnumerators preserve(cx); bool ok = RunScript(cx, script, fp);
JSBool ok = RunScript(cx, script, fp);
if (result && ok)
*result = fp->returnValue();
if (fp->isStrictEvalFrame()) if (fp->isStrictEvalFrame())
js_PutCallObject(fp); js_PutCallObject(fp);
Probes::stopExecution(cx, script); Probes::stopExecution(cx, script);
return !!ok; /* Propgate the return value out. */
if (result)
*result = fp->returnValue();
return ok;
} }
bool bool

Просмотреть файл

@ -61,21 +61,6 @@
namespace js { namespace js {
class AutoPreserveEnumerators {
JSContext *cx;
JSObject *enumerators;
public:
AutoPreserveEnumerators(JSContext *cx) : cx(cx), enumerators(cx->enumerators)
{
}
~AutoPreserveEnumerators()
{
cx->enumerators = enumerators;
}
};
/* /*
* Compute the implicit |this| parameter for a call expression where the callee * Compute the implicit |this| parameter for a call expression where the callee
* funval was resolved from an unqualified name reference to a property on obj * funval was resolved from an unqualified name reference to a property on obj