diff --git a/mozilla/js/js2/debugger.cpp b/mozilla/js/js2/debugger.cpp index a8d9cce56df..3717778ca6e 100644 --- a/mozilla/js/js2/debugger.cpp +++ b/mozilla/js/js2/debugger.cpp @@ -154,7 +154,8 @@ namespace Debugger { ICodeModule *iCode = cx->getICode(); if (iCode->mInstructionMap->begin() == iCode->mInstructionMap->end()) - NOT_REACHED ("Instruction map is empty, waah."); + return NotABanana; + /*NOT_REACHED ("Instruction map is empty, waah.");*/ InstructionMap::iterator pos_iter = iCode->mInstructionMap->upper_bound (pc - iCode->its_iCode->begin()); @@ -184,6 +185,12 @@ namespace Debugger { } uint32 pos = getClosestSourcePosForPC(cx, pc); + if (pos == NotABanana) + { + mErr << "Map is empty, cannot display source.\n"; + return; + } + uint32 lineNum = reader->posToLineNum (pos); const char16 *lineBegin, *lineEnd; diff --git a/mozilla/js/js2/icodegenerator.cpp b/mozilla/js/js2/icodegenerator.cpp index 0dc8bfe0d51..7d8b5653cea 100644 --- a/mozilla/js/js2/icodegenerator.cpp +++ b/mozilla/js/js2/icodegenerator.cpp @@ -73,8 +73,8 @@ ICodeGenerator::ICodeGenerator(World *world, JSScope *global, JSClass *aClass, I mWorld(world), mGlobal(global), mInstructionMap(new InstructionMap()), - mFlags(flags), - mClass(aClass) + mClass(aClass), + mFlags(flags) { iCode = new InstructionStream(); iCodeOwner = true; @@ -206,7 +206,7 @@ TypedRegister ICodeGenerator::loadBoolean(bool value) return dest; } -TypedRegister ICodeGenerator::newObject(RegisterList *args) +TypedRegister ICodeGenerator::newObject(RegisterList */*args*/) { TypedRegister dest(getTempRegister(), &Any_Type); NewObject *instr = new NewObject(dest); @@ -327,7 +327,7 @@ void ICodeGenerator::setStatic(JSClass *base, const StringAtom &name, iCode->push_back(instr); } -TypedRegister ICodeGenerator::staticXcr(JSClass *base, const StringAtom &name, ICodeOp op) +TypedRegister ICodeGenerator::staticXcr(JSClass *base, const StringAtom &name, ICodeOp /*op*/) { TypedRegister dest(getTempRegister(), &Any_Type); const JSSlot& slot = base->getStatic(name); @@ -694,7 +694,7 @@ TypedRegister ICodeGenerator::handleIdentifier(IdentifierExprNode *p, ExprNode:: { ASSERT(p->getKind() == ExprNode::identifier); - JSType *vType = &Any_Type; + /*JSType *vType = &Any_Type;*/ uint32 slotIndex; TypedRegister v; @@ -834,6 +834,8 @@ TypedRegister ICodeGenerator::handleIdentifier(IdentifierExprNode *p, ExprNode:: NOT_REACHED("Bad lvalue kind"); } break; + default: + NOT_REACHED("Bad use kind"); } return ret; @@ -1447,9 +1449,9 @@ TypedRegister ICodeGenerator::genExpr(ExprNode *p, ret = genExpr(b->op1); if (b->op2->getKind() == ExprNode::identifier) { TypedRegister t; - uint32 slotIndex; + /*uint32 slotIndex;*/ const StringAtom &name = (static_cast(b->op2))->name; - LValueKind lvk = resolveIdentifier(name, t, slotIndex); + /*LValueKind lvk = resolveIdentifier(name, t, slotIndex);*/ ASSERT(t.second == &Type_Type); const JSValue &v = mGlobal->getVariable(name); ASSERT(v.isType()); @@ -2063,7 +2065,8 @@ Formatter& ICodeGenerator::print(Formatter& f) Formatter& ICodeModule::print(Formatter& f) { - f << "ICM! " << (uint32)its_iCode->size() << "\n"; + f << "ICM[" << mID << "] from source at '" << mFileName << "' " << + (uint32)its_iCode->size() << " bytecodes\n"; return VM::operator<<(f, *its_iCode); } diff --git a/mozilla/js/js2/interpreter.cpp b/mozilla/js/js2/interpreter.cpp index 88b31aa6205..fc5129affb4 100644 --- a/mozilla/js/js2/interpreter.cpp +++ b/mozilla/js/js2/interpreter.cpp @@ -198,12 +198,16 @@ static JSValue add_Default(const JSValue& r1, const JSValue& r2) return JSValue(num1.f64 + num2.f64); } } + +/* static JSValue add_String1(const JSValue& r1, const JSValue& r2) { JSValue num1(r1.toNumber()); JSValue num2(r2.toNumber()); return JSValue(num1.f64 + num2.f64); } +*/ + static JSValue subtract_Default(const JSValue& r1, const JSValue& r2) { JSValue num1(r1.toNumber()); @@ -592,7 +596,7 @@ JSValue Context::interpret(ICodeModule* iCode, const JSValues& args) src != end; ++src, ++i) { argv[i] = (*registers)[src->first]; } - JSValue result = static_cast(target)->mCode(argv); + /*JSValue result = static_cast(target)->mCode(argv);*/ break; } else { diff --git a/mozilla/js/js2/js2.cpp b/mozilla/js/js2/js2.cpp index d6413ff4a49..944ed4a8bab 100644 --- a/mozilla/js/js2/js2.cpp +++ b/mozilla/js/js2/js2.cpp @@ -104,7 +104,11 @@ const Reader *ResolveFile (const String& fileName) if (fileName == ConsoleName) return sourceReader; else + { + stdErr << "Could not locate source for file '" << fileName << "'\n"; return 0; + } + } JavaScript::Debugger::Shell jsd(world, stdin, JavaScript::stdOut, diff --git a/mozilla/js/js2/parser.cpp b/mozilla/js/js2/parser.cpp index ef78729c914..f2b201d026a 100644 --- a/mozilla/js/js2/parser.cpp +++ b/mozilla/js/js2/parser.cpp @@ -3149,7 +3149,7 @@ JS::StmtNode *JS::Parser::parseTry(uint32 pos) // // If the first token was peeked, it should be have been done with preferRegExp set to true. // After parseStatement finishes, the next token might have been peeked with preferRegExp set to true. -JS::StmtNode *JS::Parser::parseStatement(bool topLevel, bool inSwitch, SemicolonState &semicolonState) +JS::StmtNode *JS::Parser::parseStatement(bool /*topLevel*/, bool inSwitch, SemicolonState &semicolonState) { StmtNode *s; ExprNode *e = 0; diff --git a/mozilla/js/js2/utilities.cpp b/mozilla/js/js2/utilities.cpp index 0d7d601831e..b449b8745ef 100644 --- a/mozilla/js/js2/utilities.cpp +++ b/mozilla/js/js2/utilities.cpp @@ -1844,7 +1844,7 @@ void JS::Formatter::printVFormat8(const char *format, va_list args) while (true) { int n = vsnprintf(b.buffer, b.size, format, args); - if (n >= 0 && n < b.size) { + if (n >= 0 && static_cast(n) < b.size) { printStr8(b.buffer, b.buffer + n); return; } diff --git a/mozilla/js2/src/debugger.cpp b/mozilla/js2/src/debugger.cpp index a8d9cce56df..3717778ca6e 100644 --- a/mozilla/js2/src/debugger.cpp +++ b/mozilla/js2/src/debugger.cpp @@ -154,7 +154,8 @@ namespace Debugger { ICodeModule *iCode = cx->getICode(); if (iCode->mInstructionMap->begin() == iCode->mInstructionMap->end()) - NOT_REACHED ("Instruction map is empty, waah."); + return NotABanana; + /*NOT_REACHED ("Instruction map is empty, waah.");*/ InstructionMap::iterator pos_iter = iCode->mInstructionMap->upper_bound (pc - iCode->its_iCode->begin()); @@ -184,6 +185,12 @@ namespace Debugger { } uint32 pos = getClosestSourcePosForPC(cx, pc); + if (pos == NotABanana) + { + mErr << "Map is empty, cannot display source.\n"; + return; + } + uint32 lineNum = reader->posToLineNum (pos); const char16 *lineBegin, *lineEnd; diff --git a/mozilla/js2/src/icodegenerator.cpp b/mozilla/js2/src/icodegenerator.cpp index 0dc8bfe0d51..7d8b5653cea 100644 --- a/mozilla/js2/src/icodegenerator.cpp +++ b/mozilla/js2/src/icodegenerator.cpp @@ -73,8 +73,8 @@ ICodeGenerator::ICodeGenerator(World *world, JSScope *global, JSClass *aClass, I mWorld(world), mGlobal(global), mInstructionMap(new InstructionMap()), - mFlags(flags), - mClass(aClass) + mClass(aClass), + mFlags(flags) { iCode = new InstructionStream(); iCodeOwner = true; @@ -206,7 +206,7 @@ TypedRegister ICodeGenerator::loadBoolean(bool value) return dest; } -TypedRegister ICodeGenerator::newObject(RegisterList *args) +TypedRegister ICodeGenerator::newObject(RegisterList */*args*/) { TypedRegister dest(getTempRegister(), &Any_Type); NewObject *instr = new NewObject(dest); @@ -327,7 +327,7 @@ void ICodeGenerator::setStatic(JSClass *base, const StringAtom &name, iCode->push_back(instr); } -TypedRegister ICodeGenerator::staticXcr(JSClass *base, const StringAtom &name, ICodeOp op) +TypedRegister ICodeGenerator::staticXcr(JSClass *base, const StringAtom &name, ICodeOp /*op*/) { TypedRegister dest(getTempRegister(), &Any_Type); const JSSlot& slot = base->getStatic(name); @@ -694,7 +694,7 @@ TypedRegister ICodeGenerator::handleIdentifier(IdentifierExprNode *p, ExprNode:: { ASSERT(p->getKind() == ExprNode::identifier); - JSType *vType = &Any_Type; + /*JSType *vType = &Any_Type;*/ uint32 slotIndex; TypedRegister v; @@ -834,6 +834,8 @@ TypedRegister ICodeGenerator::handleIdentifier(IdentifierExprNode *p, ExprNode:: NOT_REACHED("Bad lvalue kind"); } break; + default: + NOT_REACHED("Bad use kind"); } return ret; @@ -1447,9 +1449,9 @@ TypedRegister ICodeGenerator::genExpr(ExprNode *p, ret = genExpr(b->op1); if (b->op2->getKind() == ExprNode::identifier) { TypedRegister t; - uint32 slotIndex; + /*uint32 slotIndex;*/ const StringAtom &name = (static_cast(b->op2))->name; - LValueKind lvk = resolveIdentifier(name, t, slotIndex); + /*LValueKind lvk = resolveIdentifier(name, t, slotIndex);*/ ASSERT(t.second == &Type_Type); const JSValue &v = mGlobal->getVariable(name); ASSERT(v.isType()); @@ -2063,7 +2065,8 @@ Formatter& ICodeGenerator::print(Formatter& f) Formatter& ICodeModule::print(Formatter& f) { - f << "ICM! " << (uint32)its_iCode->size() << "\n"; + f << "ICM[" << mID << "] from source at '" << mFileName << "' " << + (uint32)its_iCode->size() << " bytecodes\n"; return VM::operator<<(f, *its_iCode); } diff --git a/mozilla/js2/src/interpreter.cpp b/mozilla/js2/src/interpreter.cpp index 88b31aa6205..fc5129affb4 100644 --- a/mozilla/js2/src/interpreter.cpp +++ b/mozilla/js2/src/interpreter.cpp @@ -198,12 +198,16 @@ static JSValue add_Default(const JSValue& r1, const JSValue& r2) return JSValue(num1.f64 + num2.f64); } } + +/* static JSValue add_String1(const JSValue& r1, const JSValue& r2) { JSValue num1(r1.toNumber()); JSValue num2(r2.toNumber()); return JSValue(num1.f64 + num2.f64); } +*/ + static JSValue subtract_Default(const JSValue& r1, const JSValue& r2) { JSValue num1(r1.toNumber()); @@ -592,7 +596,7 @@ JSValue Context::interpret(ICodeModule* iCode, const JSValues& args) src != end; ++src, ++i) { argv[i] = (*registers)[src->first]; } - JSValue result = static_cast(target)->mCode(argv); + /*JSValue result = static_cast(target)->mCode(argv);*/ break; } else { diff --git a/mozilla/js2/src/parser.cpp b/mozilla/js2/src/parser.cpp index ef78729c914..f2b201d026a 100644 --- a/mozilla/js2/src/parser.cpp +++ b/mozilla/js2/src/parser.cpp @@ -3149,7 +3149,7 @@ JS::StmtNode *JS::Parser::parseTry(uint32 pos) // // If the first token was peeked, it should be have been done with preferRegExp set to true. // After parseStatement finishes, the next token might have been peeked with preferRegExp set to true. -JS::StmtNode *JS::Parser::parseStatement(bool topLevel, bool inSwitch, SemicolonState &semicolonState) +JS::StmtNode *JS::Parser::parseStatement(bool /*topLevel*/, bool inSwitch, SemicolonState &semicolonState) { StmtNode *s; ExprNode *e = 0; diff --git a/mozilla/js2/src/utilities.cpp b/mozilla/js2/src/utilities.cpp index 0d7d601831e..b449b8745ef 100644 --- a/mozilla/js2/src/utilities.cpp +++ b/mozilla/js2/src/utilities.cpp @@ -1844,7 +1844,7 @@ void JS::Formatter::printVFormat8(const char *format, va_list args) while (true) { int n = vsnprintf(b.buffer, b.size, format, args); - if (n >= 0 && n < b.size) { + if (n >= 0 && static_cast(n) < b.size) { printStr8(b.buffer, b.buffer + n); return; } diff --git a/mozilla/js2/tests/cpp/js2_shell.cpp b/mozilla/js2/tests/cpp/js2_shell.cpp index d6413ff4a49..944ed4a8bab 100644 --- a/mozilla/js2/tests/cpp/js2_shell.cpp +++ b/mozilla/js2/tests/cpp/js2_shell.cpp @@ -104,7 +104,11 @@ const Reader *ResolveFile (const String& fileName) if (fileName == ConsoleName) return sourceReader; else + { + stdErr << "Could not locate source for file '" << fileName << "'\n"; return 0; + } + } JavaScript::Debugger::Shell jsd(world, stdin, JavaScript::stdOut,