Recover trapped opcode in js_GetIndexFromBytecode (416665, r=igor).

This commit is contained in:
2008-02-17 17:32:12 -08:00
parent c4e59d61b5
commit 05e91d5405
3 changed files with 24 additions and 27 deletions

View File

@@ -302,10 +302,14 @@ js_puts(JSPrinter *jp, const char *s);
/*
* Get index operand from the bytecode using a bytecode analysis to deduce the
* the index register.
* the index register. This function is infallible, in spite of taking cx as
* its first parameter; it uses only cx->runtime when calling JS_GetTrapOpcode.
* The GET_*_FROM_BYTECODE macros that call it pick up cx from their caller's
* lexical environments.
*/
uintN
js_GetIndexFromBytecode(JSScript *script, jsbytecode *pc, ptrdiff_t pcoff);
js_GetIndexFromBytecode(JSContext *cx, JSScript *script, jsbytecode *pc,
ptrdiff_t pcoff);
/*
* A slower version of GET_ATOM when the caller does not want to maintain
@@ -313,13 +317,13 @@ js_GetIndexFromBytecode(JSScript *script, jsbytecode *pc, ptrdiff_t pcoff);
*/
#define GET_ATOM_FROM_BYTECODE(script, pc, pcoff, atom) \
JS_BEGIN_MACRO \
uintN index_ = js_GetIndexFromBytecode((script), (pc), (pcoff)); \
uintN index_ = js_GetIndexFromBytecode(cx, (script), (pc), (pcoff)); \
JS_GET_SCRIPT_ATOM((script), index_, atom); \
JS_END_MACRO
#define GET_OBJECT_FROM_BYTECODE(script, pc, pcoff, obj) \
JS_BEGIN_MACRO \
uintN index_ = js_GetIndexFromBytecode((script), (pc), (pcoff)); \
uintN index_ = js_GetIndexFromBytecode(cx, (script), (pc), (pcoff)); \
JS_GET_SCRIPT_OBJECT((script), index_, obj); \
JS_END_MACRO
@@ -331,7 +335,7 @@ js_GetIndexFromBytecode(JSScript *script, jsbytecode *pc, ptrdiff_t pcoff);
#define GET_REGEXP_FROM_BYTECODE(script, pc, pcoff, obj) \
JS_BEGIN_MACRO \
uintN index_ = js_GetIndexFromBytecode((script), (pc), (pcoff)); \
uintN index_ = js_GetIndexFromBytecode(cx, (script), (pc), (pcoff)); \
JS_GET_SCRIPT_REGEXP((script), index_, obj); \
JS_END_MACRO