author | Steve Fink <sfink@mozilla.com> |
Wed, 15 Dec 2010 21:44:26 -0800 | |
changeset 59886 | df86d5999fefca6cb56e40aaaf4e3013fa57e299 |
parent 59885 | ac952c471f5925330aae300dff4e892b1338c4b8 |
child 59887 | 9ca89fc6beef8174a9c10a2e84f179201af29383 |
push id | 17820 |
push user | cleary@mozilla.com |
push date | Tue, 04 Jan 2011 21:40:57 +0000 |
treeherder | mozilla-central@969691cfe40e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 619369 |
milestone | 2.0b8pre |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -234,16 +234,48 @@ js_GetEnterBlockStackDefs(JSContext *cx, { JSObject *obj; JS_ASSERT(*pc == JSOP_ENTERBLOCK || *pc == JSOP_TRAP); GET_OBJECT_FROM_BYTECODE(script, pc, 0, obj); return OBJ_BLOCK_COUNT(cx, obj); } +class AutoScriptUntrapper { + JSContext *cx; + JSScript *script; + jsbytecode *origPC; + jsbytecode *newPC; + +public: + AutoScriptUntrapper(JSContext *cx, JSScript *script, jsbytecode **pc) + : cx(cx), script(script), origPC(*pc) + { + jsbytecode *newCode = js_UntrapScriptCode(cx, script); + if (newCode == script->code) { + // No change needed + newPC = origPC; + } else { + script->main += newCode - script->code; + *pc = newPC = origPC + (newCode - script->code); + script->code = newCode; + } + } + ~AutoScriptUntrapper() + { + ptrdiff_t delta = newPC - origPC; + if (delta) { + jsbytecode *oldCode = script->code - delta; + cx->free(script->code); + script->code = oldCode; + script->main -= delta; + } + } +}; + #ifdef DEBUG /* If pc != NULL, includes a prefix indicating whether the PC is at the current line. */ JS_FRIEND_API(JSBool) js_DisassembleAtPC(JSContext *cx, JSScript *script, JSBool lines, FILE *fp, jsbytecode *pc) { jsbytecode *next, *end; uintN len; @@ -335,48 +367,16 @@ ToDisassemblySource(JSContext *cx, jsval return false; return bytes->encode(cx, JSVAL_TO_STRING(Jsvalify(tvr.value()))); } } return !!js_ValueToPrintable(cx, Valueify(v), bytes, true); } -class AutoScriptUntrapper { - JSContext *cx; - JSScript *script; - jsbytecode *origPC; - jsbytecode *newPC; - -public: - AutoScriptUntrapper(JSContext *cx, JSScript *script, jsbytecode **pc) - : cx(cx), script(script), origPC(*pc) - { - jsbytecode *newCode = js_UntrapScriptCode(cx, script); - if (newCode == script->code) { - // No change needed - newPC = origPC; - } else { - script->main += newCode - script->code; - *pc = newPC = origPC + (newCode - script->code); - script->code = newCode; - } - } - ~AutoScriptUntrapper() - { - ptrdiff_t delta = newPC - origPC; - if (delta) { - jsbytecode *oldCode = script->code - delta; - cx->free(script->code); - script->code = oldCode; - script->main -= delta; - } - } -}; - JS_FRIEND_API(uintN) js_Disassemble1(JSContext *cx, JSScript *script, jsbytecode *pc, uintN loc, JSBool lines, FILE *fp) { JSOp op; const JSCodeSpec *cs; ptrdiff_t len, off, jmplen; uint32 type;