X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Fjs%2FJSContext.java;h=ec73e94b3fad0d1f37327a3e44689462b1228baf;hb=0b0673bbc7f06c5d5418d5ab7ad5961a464e2de0;hp=e707326b5cfcc1cb75fb5cf3c9897a914a80285f;hpb=7f5df8070a5551fe66abd11a589677e285ca62f8;p=org.ibex.core.git diff --git a/src/org/xwt/js/JSContext.java b/src/org/xwt/js/JSContext.java index e707326..ec73e94 100644 --- a/src/org/xwt/js/JSContext.java +++ b/src/org/xwt/js/JSContext.java @@ -30,7 +30,21 @@ public class JSContext { Vec stack = new Vec(); ///< the object stack int pc = 0; ///< the program counter - public static void invokePauseable(JSFunction function) { new JSContext(function, true).invoke(new JSArray()); } + /** can be paused */ + public static void invokePauseable(JSFunction function) { + new JSContext(function, true).invoke(new JSArray()); + } + + /** cannot be paused */ + public static void invokeTrap(JSTrap.JSTrappable t, Object key, Object value) { + JSFunction invoker = new JSFunction("trap invoker", 0, null); + invoker.add(-1, ByteCodes.PUT, null); + JSContext cx = new JSContext(invoker, false); + cx.stack.push(t); + cx.stack.push(key); + cx.stack.push(value); + cx.resume(); + } JSContext(JSFunction f, boolean pauseable) { this.pauseable = pauseable; @@ -41,7 +55,7 @@ public class JSContext { void invoke(JSArray args) { JSFunction tf = f; f = null; - stack.push(new JSFunction.CallMarker(this)); + stack.push(new Interpreter.CallMarker(this)); f = tf; stack.push(args); resume(); @@ -65,7 +79,7 @@ public class JSContext { JSContext old = (JSContext)threadToJSContext.get(t); threadToJSContext.put(t, this); try { - JSFunction.eval(this); + Interpreter.eval(this); } finally { if (old == null) threadToJSContext.remove(t); else threadToJSContext.put(t, old);