MCPcopy Create free account
hub / github.com/mozilla/rhino / ACallFrame

Class ACallFrame

rhino/src/main/java/org/mozilla/javascript/ACallFrame.java:19–218  ·  view source on GitHub ↗

Interface representing a call frame in the interpreter. This abstraction allows both the original interpreter's CallFrame and InterpreterV2's CallFrameV2 to be used interchangeably for stack traces and debugging purposes.

Source from the content-addressed store, hash-verified

17 * traces and debugging purposes.
18 */
19public abstract class ACallFrame<T extends ACallFrame<T, U>, U extends ACompilerData<?, U>>
20 implements Serializable {
21 private static final long serialVersionUID = 6100049821156242226L;
22
23 public final T parentFrame;
24 public final short frameIndex;
25 public final ACallFrame<?, ?> previousInterpreterFrame;
26 public final int parentPC;
27 public boolean frozen;
28
29 public ScriptOrFn<?> fnOrScript;
30 public U compilerData;
31
32 public final Object[] stack;
33 public final byte[] stackAttributes;
34 public final double[] doubleStack;
35
36 public Object result;
37 public double resultDbl;
38 public int pc;
39 public int stackTop = -1;
40 public VarScope scope;
41
42 // `this' might seem like it should be final, but is actually set
43 // by a call to a super constructor and so must be mutable.
44 public Scriptable thisObj;
45
46 public final DebugFrame debuggerFrame;
47 public final boolean useActivation;
48
49 public ACallFrame<T, U> varSource;
50 public final int localShift;
51 public final short emptyStackTop;
52 public Object throwable;
53 final boolean parentStrictness;
54
55 ACallFrame(
56 Context cx,
57 Scriptable thisObj,
58 ScriptOrFn<?> fnOrScript,
59 U code,
60 T parentFrame,
61 ACallFrame<?, ?> previousInterpreterFrame) {
62 compilerData = code;
63 debuggerFrame =
64 cx.debugger != null ? cx.debugger.getFrame(cx, fnOrScript.getDescriptor()) : null;
65 useActivation = fnOrScript.getDescriptor().requiresActivationFrame();
66
67 emptyStackTop = (short) (compilerData.maxVars + compilerData.maxLocals - 1);
68 int maxFrameArray = compilerData.maxFrameSize;
69 if (maxFrameArray != emptyStackTop + compilerData.maxStack + 1) Kit.codeBug();
70
71 stack = new Object[maxFrameArray];
72 stackAttributes = new byte[maxFrameArray];
73 doubleStack = new double[maxFrameArray];
74
75 this.fnOrScript = fnOrScript;
76 localShift = compilerData.maxVars;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected