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;
tnotes = script->trynotes; if (tnotes) { for (tn = tnotes; tn->catchStart; tn++) continue; nbytes += (tn - tnotes + 1) * sizeof *tn; }  principals = script->principals; if (principals) { JS_ASSERT(principals->refcount); pbytes = sizeof *principals; if (principals->refcount > 1) pbytes = (pbytes + principals->refcount - 1) / principals->refcount; nbytes += pbytes; }  return nbytes;
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;}