rt = cx->runtime; trap = FindTrap(rt, script, pc); if (trap) {  *pc = (jsbytecode)trap->op; } else { trap = (JSTrap *) JS_malloc(cx, sizeof *trap); if (!trap || !js_AddRoot(cx, &trap->closure, "trap->closure")) { if (trap) JS_free(cx, trap); return JS_FALSE; }
nbytes = sizeof *script; obj = script->object; if (obj) nbytes += JS_GetObjectTotalSize(cx, obj);  nbytes += script->length * sizeof script->code[0]; nbytes += script->atomMap.length * sizeof script->atomMap.vector[0]; for (i = 0; i < script->atomMap.length; i++) nbytes += GetAtomTotalSize(cx, script->atomMap.vector[i]);  if (script->filename) nbytes += strlen(script->filename) + 1;  notes = script->notes; if (notes) { for (sn = notes; !SN_IS_TERMINATOR(sn); sn += SN_LENGTH(sn)) continue; nbytes += (sn - notes + 1) * sizeof *sn;
JS_PUBLIC_API(JSBool)JS_SetTrap(JSContext *cx, JSScript *script, jsbytecode *pc,	   JSTrapHandler handler, void *closure){    JSRuntime *rt;    JSTrap *trap;    rt = cx->runtime;    trap = FindTrap(rt, script, pc);    if (trap) {	/* Restore opcode at pc so it can be saved again. */	*pc = (jsbytecode)trap->op;    } else {	trap = (JSTrap *) JS_malloc(cx, sizeof *trap);	if (!trap || !js_AddRoot(cx, &trap->closure, "trap->closure")) {	    if (trap)		JS_free(cx, trap);	    return JS_FALSE;	}    }    JS_APPEND_LINK(&trap->links, &rt->trapList);    trap->script = script;    trap->pc = pc;    trap->op = (JSOp)*pc;    trap->handler = handler;    trap->closure = closure;    *pc = JSOP_TRAP;    return JS_TRUE;}