private static void EnumChangeObject(ScriptRuntime.IdEnumeration x) { object[] ids = null; while (x.obj != null) { ids = x.obj.GetIds(); if (ids.Length != 0) { break; } x.obj = x.obj.GetPrototype(); } if (x.obj != null && x.ids != null) { object[] previous = x.ids; int L = previous.Length; if (x.used == null) { x.used = new ObjToIntMap(L); } for (int i = 0; i != L; ++i) { x.used.Intern(previous[i]); } } x.ids = ids; x.index = 0; }
/// <summary>Call __noSuchMethod__.</summary> /// <remarks>Call __noSuchMethod__.</remarks> private static Interpreter.CallFrame InitFrameForNoSuchMethod(Context cx, Interpreter.CallFrame frame, int indexReg, object[] stack, double[] sDbl, int stackTop, int op, Scriptable funThisObj, Scriptable calleeScope, ScriptRuntime.NoSuchMethodShim noSuchMethodShim, InterpretedFunction ifun) { // create an args array from the stack object[] argsArray = null; // exactly like getArgsArray except that the first argument // is the method name from the shim int shift = stackTop + 2; object[] elements = new object[indexReg]; for (int i = 0; i < indexReg; ++i, ++shift) { object val = stack[shift]; if (val == UniqueTag.DOUBLE_MARK) { val = ScriptRuntime.WrapNumber(sDbl[shift]); } elements[i] = val; } argsArray = new object[2]; argsArray[0] = noSuchMethodShim.methodName; argsArray[1] = cx.NewArray(calleeScope, elements); // exactly the same as if it's a regular InterpretedFunction Interpreter.CallFrame callParentFrame = frame; Interpreter.CallFrame calleeFrame = new Interpreter.CallFrame(); if (op == Icode_TAIL_CALL) { callParentFrame = frame.parentFrame; ExitFrame(cx, frame, null); } // init the frame with the underlying method with the // adjusted args array and shim's function InitFrame(cx, calleeScope, funThisObj, argsArray, null, 0, 2, ifun, callParentFrame, calleeFrame); if (op != Icode_TAIL_CALL) { frame.savedStackTop = stackTop; frame.savedCallOp = op; } return calleeFrame; }