From 5771a2ef3443229ae00ce7b99f7744e2cdbd9dd6 Mon Sep 17 00:00:00 2001 From: "beard%netscape.com" Date: Fri, 12 May 2000 01:20:34 +0000 Subject: [PATCH] InterpretStage -> Context::Event. git-svn-id: svn://10.0.0.236/trunk@69306 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/js/js2/debugger.cpp | 10 ++++---- mozilla/js/js2/debugger.h | 4 ++-- mozilla/js/js2/js2.cpp | 36 +++++++++++++++-------------- mozilla/js2/src/debugger.cpp | 10 ++++---- mozilla/js2/src/debugger.h | 4 ++-- mozilla/js2/tests/cpp/js2_shell.cpp | 36 +++++++++++++++-------------- 6 files changed, 52 insertions(+), 48 deletions(-) diff --git a/mozilla/js/js2/debugger.cpp b/mozilla/js/js2/debugger.cpp index f0794af4f89..fb534b65d7e 100644 --- a/mozilla/js/js2/debugger.cpp +++ b/mozilla/js/js2/debugger.cpp @@ -174,13 +174,13 @@ registers, or set the value of a single register."}, } void - Shell::listen(Context* cx, InterpretStage stage) + Shell::listen(Context* cx, Context::Event event) { if (mTraceFlag) showCurrentOp (cx, mOut); - if (!(mStopMask & stage)) + if (!(mStopMask & event)) return; static String lastLine(widenCString("help\n")); @@ -240,11 +240,11 @@ registers, or set the value of a single register."}, case AMBIGUOUS: case AMBIGUOUS2: - mErr << "I pity the foo.\n"; + mErr << "I pity the foogoo.\n"; break; case CONTINUE: - mStopMask &= (IS_ALL ^ IS_STEP); + mStopMask &= (Context::EV_ALL ^ Context::EV_STEP); rv = false; break; @@ -261,7 +261,7 @@ registers, or set the value of a single register."}, break; case STEP: - mStopMask |= IS_STEP; + mStopMask |= Context::EV_STEP; rv = false; break; diff --git a/mozilla/js/js2/debugger.h b/mozilla/js/js2/debugger.h index 5132f1bcc48..142e0a2551b 100644 --- a/mozilla/js/js2/debugger.h +++ b/mozilla/js/js2/debugger.h @@ -116,7 +116,7 @@ namespace Debugger { public: Shell (World &aWorld, FILE *aIn, Formatter &aOut, Formatter &aErr) : mWorld(aWorld), mIn(aIn), mOut(aOut), mErr(aErr), - mStopMask(IS_ALL), mTraceFlag(true) + mStopMask(Context::EV_ALL), mTraceFlag(true) { mDebugger = new ICodeDebugger(); } @@ -126,7 +126,7 @@ namespace Debugger { delete mDebugger; } - void listen(Context *context, InterpretStage stage); + void listen(Context *context, Context::Event event); /** * install on a context diff --git a/mozilla/js/js2/js2.cpp b/mozilla/js/js2/js2.cpp index 686ec4133fc..ba87b8e6d6c 100644 --- a/mozilla/js/js2/js2.cpp +++ b/mozilla/js/js2/js2.cpp @@ -217,25 +217,27 @@ static void readEvalPrint(FILE *in, World &world) */ class Tracer : public Context::Listener { typedef InstructionStream::difference_type InstructionOffset; - void listen(Context* context, InterpretStage /*stage*/) + void listen(Context* context, Context::Event event) { - ICodeModule *iCode = context->getICode(); - JSValues ®isters = context->getRegisters(); - InstructionIterator pc = context->getPC(); - - - InstructionOffset offset = (pc - iCode->its_iCode->begin()); - printFormat(stdOut, "trace [%02u:%04u]: ", - iCode->mID, offset); + if (event & Context::EV_STEP) { + ICodeModule *iCode = context->getICode(); + JSValues ®isters = context->getRegisters(); + InstructionIterator pc = context->getPC(); + + + InstructionOffset offset = (pc - iCode->its_iCode->begin()); + printFormat(stdOut, "trace [%02u:%04u]: ", + iCode->mID, offset); - Instruction* i = *pc; - stdOut << *i; - if (i->op() != BRANCH && i->count() > 0) { - stdOut << " ["; - i->printOperands(stdOut, registers); - stdOut << "]\n"; - } else { - stdOut << '\n'; + Instruction* i = *pc; + stdOut << *i; + if (i->op() != BRANCH && i->count() > 0) { + stdOut << " ["; + i->printOperands(stdOut, registers); + stdOut << "]\n"; + } else { + stdOut << '\n'; + } } } }; diff --git a/mozilla/js2/src/debugger.cpp b/mozilla/js2/src/debugger.cpp index f0794af4f89..fb534b65d7e 100644 --- a/mozilla/js2/src/debugger.cpp +++ b/mozilla/js2/src/debugger.cpp @@ -174,13 +174,13 @@ registers, or set the value of a single register."}, } void - Shell::listen(Context* cx, InterpretStage stage) + Shell::listen(Context* cx, Context::Event event) { if (mTraceFlag) showCurrentOp (cx, mOut); - if (!(mStopMask & stage)) + if (!(mStopMask & event)) return; static String lastLine(widenCString("help\n")); @@ -240,11 +240,11 @@ registers, or set the value of a single register."}, case AMBIGUOUS: case AMBIGUOUS2: - mErr << "I pity the foo.\n"; + mErr << "I pity the foogoo.\n"; break; case CONTINUE: - mStopMask &= (IS_ALL ^ IS_STEP); + mStopMask &= (Context::EV_ALL ^ Context::EV_STEP); rv = false; break; @@ -261,7 +261,7 @@ registers, or set the value of a single register."}, break; case STEP: - mStopMask |= IS_STEP; + mStopMask |= Context::EV_STEP; rv = false; break; diff --git a/mozilla/js2/src/debugger.h b/mozilla/js2/src/debugger.h index 5132f1bcc48..142e0a2551b 100644 --- a/mozilla/js2/src/debugger.h +++ b/mozilla/js2/src/debugger.h @@ -116,7 +116,7 @@ namespace Debugger { public: Shell (World &aWorld, FILE *aIn, Formatter &aOut, Formatter &aErr) : mWorld(aWorld), mIn(aIn), mOut(aOut), mErr(aErr), - mStopMask(IS_ALL), mTraceFlag(true) + mStopMask(Context::EV_ALL), mTraceFlag(true) { mDebugger = new ICodeDebugger(); } @@ -126,7 +126,7 @@ namespace Debugger { delete mDebugger; } - void listen(Context *context, InterpretStage stage); + void listen(Context *context, Context::Event event); /** * install on a context diff --git a/mozilla/js2/tests/cpp/js2_shell.cpp b/mozilla/js2/tests/cpp/js2_shell.cpp index 686ec4133fc..ba87b8e6d6c 100644 --- a/mozilla/js2/tests/cpp/js2_shell.cpp +++ b/mozilla/js2/tests/cpp/js2_shell.cpp @@ -217,25 +217,27 @@ static void readEvalPrint(FILE *in, World &world) */ class Tracer : public Context::Listener { typedef InstructionStream::difference_type InstructionOffset; - void listen(Context* context, InterpretStage /*stage*/) + void listen(Context* context, Context::Event event) { - ICodeModule *iCode = context->getICode(); - JSValues ®isters = context->getRegisters(); - InstructionIterator pc = context->getPC(); - - - InstructionOffset offset = (pc - iCode->its_iCode->begin()); - printFormat(stdOut, "trace [%02u:%04u]: ", - iCode->mID, offset); + if (event & Context::EV_STEP) { + ICodeModule *iCode = context->getICode(); + JSValues ®isters = context->getRegisters(); + InstructionIterator pc = context->getPC(); + + + InstructionOffset offset = (pc - iCode->its_iCode->begin()); + printFormat(stdOut, "trace [%02u:%04u]: ", + iCode->mID, offset); - Instruction* i = *pc; - stdOut << *i; - if (i->op() != BRANCH && i->count() > 0) { - stdOut << " ["; - i->printOperands(stdOut, registers); - stdOut << "]\n"; - } else { - stdOut << '\n'; + Instruction* i = *pc; + stdOut << *i; + if (i->op() != BRANCH && i->count() > 0) { + stdOut << " ["; + i->printOperands(stdOut, registers); + stdOut << "]\n"; + } else { + stdOut << '\n'; + } } } };