Bug 883383 - Fix some more static root analysis failures in SpiderMonkey; r=sfink

--HG--
extra : rebase_source : b43a23b00233c0f53f8506eef300f941093f113d
This commit is contained in:
Terrence Cole 2013-06-14 14:28:26 -07:00
Родитель 4fea0995d3
Коммит e6082d520c
6 изменённых файлов: 11 добавлений и 12 удалений

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

@ -914,8 +914,8 @@ ShellObjectMetadataCallback(JSContext *cx)
{ {
Value thisv = UndefinedValue(); Value thisv = UndefinedValue();
Value rval; RootedValue rval(cx);
if (!Invoke(cx, thisv, ObjectValue(*objectMetadataFunction), 0, NULL, &rval)) { if (!Invoke(cx, thisv, ObjectValue(*objectMetadataFunction), 0, NULL, rval.address())) {
cx->clearPendingException(); cx->clearPendingException();
return NULL; return NULL;
} }

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

@ -1316,7 +1316,7 @@ ICTypeMonitor_TypeObject::Compiler::generateStubCode(MacroAssembler &masm)
bool bool
ICUpdatedStub::addUpdateStubForValue(JSContext *cx, HandleScript script, HandleObject obj, ICUpdatedStub::addUpdateStubForValue(JSContext *cx, HandleScript script, HandleObject obj,
jsid id, HandleValue val) HandleId id, HandleValue val)
{ {
if (numOptimizedStubs_ >= MAX_OPTIMIZED_STUBS) { if (numOptimizedStubs_ >= MAX_OPTIMIZED_STUBS) {
// TODO: if the TypeSet becomes unknown or has the AnyObject type, // TODO: if the TypeSet becomes unknown or has the AnyObject type,
@ -4215,7 +4215,7 @@ DoSetElemFallback(JSContext *cx, BaselineFrame *frame, ICSetElem_Fallback *stub,
ICUpdatedStub *denseStub = compiler.getStub(compiler.getStubSpace(script)); ICUpdatedStub *denseStub = compiler.getStub(compiler.getStubSpace(script));
if (!denseStub) if (!denseStub)
return false; return false;
if (!denseStub->addUpdateStubForValue(cx, script, obj, JSID_VOID, rhs)) if (!denseStub->addUpdateStubForValue(cx, script, obj, JS::JSID_VOIDHANDLE, rhs))
return false; return false;
stub->addNewStub(denseStub); stub->addNewStub(denseStub);
@ -4229,7 +4229,7 @@ DoSetElemFallback(JSContext *cx, BaselineFrame *frame, ICSetElem_Fallback *stub,
ICUpdatedStub *denseStub = compiler.getStub(compiler.getStubSpace(script)); ICUpdatedStub *denseStub = compiler.getStub(compiler.getStubSpace(script));
if (!denseStub) if (!denseStub)
return false; return false;
if (!denseStub->addUpdateStubForValue(cx, script, obj, JSID_VOID, rhs)) if (!denseStub->addUpdateStubForValue(cx, script, obj, JS::JSID_VOIDHANDLE, rhs))
return false; return false;
stub->addNewStub(denseStub); stub->addNewStub(denseStub);

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

@ -925,7 +925,7 @@ class ICUpdatedStub : public ICStub
public: public:
bool initUpdatingChain(JSContext *cx, ICStubSpace *space); bool initUpdatingChain(JSContext *cx, ICStubSpace *space);
bool addUpdateStubForValue(JSContext *cx, HandleScript script, HandleObject obj, jsid id, bool addUpdateStubForValue(JSContext *cx, HandleScript script, HandleObject obj, HandleId id,
HandleValue val); HandleValue val);
void addOptimizedUpdateStub(ICStub *stub) { void addOptimizedUpdateStub(ICStub *stub) {

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

@ -1655,7 +1655,7 @@ ion::CanEnterAtBranch(JSContext *cx, JSScript *script, AbstractFramePtr fp,
} }
MethodStatus MethodStatus
ion::CanEnter(JSContext *cx, JSScript *script, AbstractFramePtr fp, bool isConstructing) ion::CanEnter(JSContext *cx, HandleScript script, AbstractFramePtr fp, bool isConstructing)
{ {
JS_ASSERT(ion::IsEnabled(cx)); JS_ASSERT(ion::IsEnabled(cx));
@ -1675,13 +1675,11 @@ ion::CanEnter(JSContext *cx, JSScript *script, AbstractFramePtr fp, bool isConst
// Creating |this| is done before building Ion because it may change the // Creating |this| is done before building Ion because it may change the
// type information and invalidate compilation results. // type information and invalidate compilation results.
if (isConstructing && fp.thisValue().isPrimitive()) { if (isConstructing && fp.thisValue().isPrimitive()) {
RootedScript scriptRoot(cx, script);
RootedObject callee(cx, fp.callee()); RootedObject callee(cx, fp.callee());
RootedObject obj(cx, CreateThisForFunction(cx, callee, fp.useNewType())); RootedObject obj(cx, CreateThisForFunction(cx, callee, fp.useNewType()));
if (!obj || !ion::IsEnabled(cx)) // Note: OOM under CreateThis can disable TI. if (!obj || !ion::IsEnabled(cx)) // Note: OOM under CreateThis can disable TI.
return Method_Skipped; return Method_Skipped;
fp.thisValue().setObject(*obj); fp.thisValue().setObject(*obj);
script = scriptRoot;
} }
// Mark as forbidden if frame can't be handled. // Mark as forbidden if frame can't be handled.

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

@ -275,7 +275,7 @@ bool CanIonCompileScript(JSContext *cx, HandleScript script, bool osr);
MethodStatus CanEnterAtBranch(JSContext *cx, JSScript *script, MethodStatus CanEnterAtBranch(JSContext *cx, JSScript *script,
AbstractFramePtr fp, jsbytecode *pc, bool isConstructing); AbstractFramePtr fp, jsbytecode *pc, bool isConstructing);
MethodStatus CanEnter(JSContext *cx, JSScript *script, AbstractFramePtr fp, bool isConstructing); MethodStatus CanEnter(JSContext *cx, HandleScript script, AbstractFramePtr fp, bool isConstructing);
MethodStatus CompileFunctionForBaseline(JSContext *cx, HandleScript script, AbstractFramePtr fp, MethodStatus CompileFunctionForBaseline(JSContext *cx, HandleScript script, AbstractFramePtr fp,
bool isConstructing); bool isConstructing);
MethodStatus CanEnterUsingFastInvoke(JSContext *cx, HandleScript script, uint32_t numActualArgs); MethodStatus CanEnterUsingFastInvoke(JSContext *cx, HandleScript script, uint32_t numActualArgs);

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

@ -606,12 +606,13 @@ DoSubstr(JSContext *cx, JSString *str, size_t begin, size_t len)
size_t lhsLength = rope->leftChild()->length() - begin; size_t lhsLength = rope->leftChild()->length() - begin;
size_t rhsLength = begin + len - rope->leftChild()->length(); size_t rhsLength = begin + len - rope->leftChild()->length();
RootedString lhs(cx, js_NewDependentString(cx, rope->leftChild(), Rooted<JSRope *> ropeRoot(cx, rope);
RootedString lhs(cx, js_NewDependentString(cx, ropeRoot->leftChild(),
begin, lhsLength)); begin, lhsLength));
if (!lhs) if (!lhs)
return NULL; return NULL;
RootedString rhs(cx, js_NewDependentString(cx, rope->rightChild(), 0, rhsLength)); RootedString rhs(cx, js_NewDependentString(cx, ropeRoot->rightChild(), 0, rhsLength));
if (!rhs) if (!rhs)
return NULL; return NULL;