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
parent 2e6611eca0
commit b6c4408d8f
6 changed files with 11 additions and 12 deletions

View File

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

View File

@ -1316,7 +1316,7 @@ ICTypeMonitor_TypeObject::Compiler::generateStubCode(MacroAssembler &masm)
bool
ICUpdatedStub::addUpdateStubForValue(JSContext *cx, HandleScript script, HandleObject obj,
jsid id, HandleValue val)
HandleId id, HandleValue val)
{
if (numOptimizedStubs_ >= MAX_OPTIMIZED_STUBS) {
// 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));
if (!denseStub)
return false;
if (!denseStub->addUpdateStubForValue(cx, script, obj, JSID_VOID, rhs))
if (!denseStub->addUpdateStubForValue(cx, script, obj, JS::JSID_VOIDHANDLE, rhs))
return false;
stub->addNewStub(denseStub);
@ -4229,7 +4229,7 @@ DoSetElemFallback(JSContext *cx, BaselineFrame *frame, ICSetElem_Fallback *stub,
ICUpdatedStub *denseStub = compiler.getStub(compiler.getStubSpace(script));
if (!denseStub)
return false;
if (!denseStub->addUpdateStubForValue(cx, script, obj, JSID_VOID, rhs))
if (!denseStub->addUpdateStubForValue(cx, script, obj, JS::JSID_VOIDHANDLE, rhs))
return false;
stub->addNewStub(denseStub);

View File

@ -925,7 +925,7 @@ class ICUpdatedStub : public ICStub
public:
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);
void addOptimizedUpdateStub(ICStub *stub) {

View File

@ -1655,7 +1655,7 @@ ion::CanEnterAtBranch(JSContext *cx, JSScript *script, AbstractFramePtr fp,
}
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));
@ -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
// type information and invalidate compilation results.
if (isConstructing && fp.thisValue().isPrimitive()) {
RootedScript scriptRoot(cx, script);
RootedObject callee(cx, fp.callee());
RootedObject obj(cx, CreateThisForFunction(cx, callee, fp.useNewType()));
if (!obj || !ion::IsEnabled(cx)) // Note: OOM under CreateThis can disable TI.
return Method_Skipped;
fp.thisValue().setObject(*obj);
script = scriptRoot;
}
// Mark as forbidden if frame can't be handled.

View File

@ -275,7 +275,7 @@ bool CanIonCompileScript(JSContext *cx, HandleScript script, bool osr);
MethodStatus CanEnterAtBranch(JSContext *cx, JSScript *script,
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,
bool isConstructing);
MethodStatus CanEnterUsingFastInvoke(JSContext *cx, HandleScript script, uint32_t numActualArgs);

View File

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