From b6c4408d8fc0056660222cb190989c6cabadee58 Mon Sep 17 00:00:00 2001 From: Terrence Cole Date: Fri, 14 Jun 2013 14:28:26 -0700 Subject: [PATCH] Bug 883383 - Fix some more static root analysis failures in SpiderMonkey; r=sfink --HG-- extra : rebase_source : b43a23b00233c0f53f8506eef300f941093f113d --- js/src/builtin/TestingFunctions.cpp | 4 ++-- js/src/ion/BaselineIC.cpp | 6 +++--- js/src/ion/BaselineIC.h | 2 +- js/src/ion/Ion.cpp | 4 +--- js/src/ion/Ion.h | 2 +- js/src/jsstr.cpp | 5 +++-- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 1dbd5eef229..eb1b2b0d7e9 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -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; } diff --git a/js/src/ion/BaselineIC.cpp b/js/src/ion/BaselineIC.cpp index 491e3ceedb5..1c5f34747a9 100644 --- a/js/src/ion/BaselineIC.cpp +++ b/js/src/ion/BaselineIC.cpp @@ -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); diff --git a/js/src/ion/BaselineIC.h b/js/src/ion/BaselineIC.h index 6afd51f216b..87536cc44e7 100644 --- a/js/src/ion/BaselineIC.h +++ b/js/src/ion/BaselineIC.h @@ -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) { diff --git a/js/src/ion/Ion.cpp b/js/src/ion/Ion.cpp index 3f30a358b12..aa9f138ad04 100644 --- a/js/src/ion/Ion.cpp +++ b/js/src/ion/Ion.cpp @@ -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. diff --git a/js/src/ion/Ion.h b/js/src/ion/Ion.h index 9cbadd81488..ccf550b7f47 100644 --- a/js/src/ion/Ion.h +++ b/js/src/ion/Ion.h @@ -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); diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index f0753ce1ae8..2839d15ba1b 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -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 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;