Bug 690645 - Make AutoScriptUntrapper not massively break invariants; tidy up decompiler a bit (r=waldo)

This commit is contained in:
Luke Wagner
2011-10-04 10:48:35 -07:00
parent 771b567cbd
commit a40af3f88b
5 changed files with 180 additions and 219 deletions

View File

@@ -563,6 +563,24 @@ FlowsIntoNext(JSOp op)
op != JSOP_GOTO && op != JSOP_GOTOX && op != JSOP_RETSUB;
}
/*
* AutoScriptUntrapper mutates the given script in place to replace JSOP_TRAP
* opcodes with the original opcode they replaced. The destructor mutates the
* script back into its original state.
*/
class AutoScriptUntrapper
{
JSContext *cx;
JSScript *origScript;
jsbytecode *origCode;
size_t nbytes;
bool saveOriginal(JSScript *script);
public:
AutoScriptUntrapper();
bool untrap(JSContext *cx, JSScript *script);
~AutoScriptUntrapper();
};
}
#endif