Bug 708695 - Fix issues found by clang's scan-build. r=Waldo

--HG--
extra : rebase_source : 5b1970539b2f5b211ebeb97765d8c549371cb888
This commit is contained in:
Tom Schuster 2011-12-19 14:16:53 +01:00
parent 3925b84b1c
commit fdaa6f1aaa
8 changed files with 23 additions and 37 deletions

View File

@ -1841,7 +1841,6 @@ TokenStream::getTokenInternal()
case '\\':
hadUnicodeEscape = matchUnicodeEscapeIdStart(&qc);
if (hadUnicodeEscape) {
c = qc;
identStart = userbuf.addressOfNextRawChar() - 6;
goto identifier;
}

View File

@ -4174,15 +4174,17 @@ ScriptAnalysis::analyzeTypes(JSContext *cx)
detached = true;
}
/*
* Don't track for parents which add call objects or are generators,
* don't resolve NAME accesses into the parent.
*/
if (!detached &&
(nesting->parent->analysis()->addsScopeObjects() ||
JSOp(*nesting->parent->code) == JSOP_GENERATOR)) {
DetachNestingParent(script);
detached = true;
if (!detached) {
/*
* Don't track for parents which add call objects or are generators,
* don't resolve NAME accesses into the parent.
*/
if (nesting->parent->analysis()->addsScopeObjects() ||
JSOp(*nesting->parent->code) == JSOP_GENERATOR)
{
DetachNestingParent(script);
}
}
}

View File

@ -2105,14 +2105,12 @@ BEGIN_CASE(JSOP_STOP)
if (JS_LIKELY(interpReturnOK)) {
TypeScript::Monitor(cx, script, regs.pc, regs.sp[-1]);
op = JSOp(*regs.pc);
len = JSOP_CALL_LENGTH;
if (shiftResult) {
regs.sp[-2] = regs.sp[-1];
regs.sp--;
}
len = JSOP_CALL_LENGTH;
DO_NEXT_OP(len);
}

View File

@ -3197,7 +3197,7 @@ Detecting(JSContext *cx, jsbytecode *pc)
*/
if (++pc < endpc) {
op = JSOp(*pc);
return *pc == JSOP_EQ || *pc == JSOP_NE;
return op == JSOP_EQ || op == JSOP_NE;
}
return JS_FALSE;
@ -7406,7 +7406,6 @@ js_DumpStackFrame(JSContext *cx, StackFrame *start)
fprintf(stderr, "no stack for cx = %p\n", (void*) cx);
return;
}
start = i.fp();
} else {
while (!i.done() && i.fp() != start)
++i;

View File

@ -193,7 +193,6 @@ Quote(JSContext *cx, StringBuffer &sb, JSString *str)
: 't';
if (!sb.append('\\') || !sb.append(abbrev))
return false;
mark = i + 1;
} else {
JS_ASSERT(c < ' ');
if (!sb.append("\\u00"))

View File

@ -2560,10 +2560,10 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
*/
op = (JSOp) pc[oplen];
rval = PopStr(ss, op, &lastrvalpc);
lval = PopStr(ss, op, &lastlvalpc);
(void)PopStr(ss, op, &lastlvalpc);
/* Print only the right operand of the assignment-op. */
todo = SprintCString(&ss->sprinter, rval);
op = saveop;
} else if (!inXML) {
rval = PopStrPrecDupe(ss, cs->prec + !!(cs->format & JOF_LEFTASSOC), &rvalpc);
lval = PopStrPrec(ss, cs->prec + !(cs->format & JOF_LEFTASSOC), &lvalpc);
@ -4211,10 +4211,8 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
}
case JSOP_GETELEM2:
op = JSOP_GETELEM;
(void) PopOff(ss, lastop);
/* FALL THROUGH */
case JSOP_CALLELEM:
case JSOP_GETELEM:
op = JSOP_NOP; /* turn off parens */

View File

@ -3047,22 +3047,17 @@ AddInScopeNamespace(JSContext *cx, JSXML *xml, JSObject *ns)
static JSBool
Append(JSContext *cx, JSXML *list, JSXML *xml)
{
uint32_t i, j, k, n;
JSXML *kid;
JS_ASSERT(list->xml_class == JSXML_CLASS_LIST);
i = list->xml_kids.length;
n = 1;
uint32_t i = list->xml_kids.length;
if (xml->xml_class == JSXML_CLASS_LIST) {
list->xml_target = xml->xml_target;
list->xml_targetprop = xml->xml_targetprop;
n = JSXML_LENGTH(xml);
k = i + n;
if (!list->xml_kids.setCapacity(cx, k))
uint32_t n = JSXML_LENGTH(xml);
if (!list->xml_kids.setCapacity(cx, i + n))
return JS_FALSE;
for (j = 0; j < n; j++) {
kid = XMLARRAY_MEMBER(&xml->xml_kids, j, JSXML);
if (kid)
for (uint32_t j = 0; j < n; j++) {
if (JSXML *kid = XMLARRAY_MEMBER(&xml->xml_kids, j, JSXML))
XMLARRAY_SET_MEMBER(&list->xml_kids, i + j, kid);
}
return JS_TRUE;
@ -6921,7 +6916,6 @@ xml_text_helper(JSContext *cx, JSObject *obj, JSXML *xml, jsval *vp)
{
JSXML *list, *kid, *vxml;
uint32_t i, n;
JSBool ok;
JSObject *kidobj;
jsval v;
@ -6930,11 +6924,10 @@ xml_text_helper(JSContext *cx, JSObject *obj, JSXML *xml, jsval *vp)
return JS_FALSE;
if (xml->xml_class == JSXML_CLASS_LIST) {
ok = JS_TRUE;
for (i = 0, n = xml->xml_kids.length; i < n; i++) {
kid = XMLARRAY_MEMBER(&xml->xml_kids, i, JSXML);
if (kid && kid->xml_class == JSXML_CLASS_ELEMENT) {
ok = js_EnterLocalRootScope(cx);
JSBool ok = js_EnterLocalRootScope(cx);
if (!ok)
break;
kidobj = js_GetXMLObject(cx, kid);

View File

@ -1339,15 +1339,13 @@ FrameState::sync(Assembler &masm, Uses uses) const
continue;
}
FrameEntry *backing = fe;
if (!fe->isCopy()) {
if (fe->data.inRegister() && !regstate(fe->data.reg()).isPinned())
avail.putReg(fe->data.reg());
if (fe->type.inRegister() && !regstate(fe->type.reg()).isPinned())
avail.putReg(fe->type.reg());
} else {
backing = fe->copyOf();
FrameEntry *backing = fe->copyOf();
JS_ASSERT(!backing->isConstant() && !fe->isConstant());
#if defined JS_PUNBOX64