/**
     * Array.prototype.pop()
	 * TRANSFERABLE: Needs to support generic objects as well as Array objects
     */
	/*static*/ Atom ArrayClass::generic_pop(Toplevel* toplevel, Atom thisAtom)
    {
        ArrayObject *a = isArray(toplevel, thisAtom);

		if (a)
			return a->pop();

		if (!AvmCore::isObject(thisAtom))
			return undefinedAtom;

		// Different than Rhino (because of delete) but matches 262.pdf
		ScriptObject *d = AvmCore::atomToScriptObject(thisAtom);
		uint32 len = getLengthHelper(toplevel, d);
		if (!len)
		{
			setLengthHelper(toplevel, d, 0);
			return undefinedAtom;
		}
		else
		{
			Atom outAtom = d->getUintProperty (len-1); 
			d->delUintProperty (len - 1);
			setLengthHelper(toplevel, d, len - 1);
			return outAtom;
		}
    }
	/**
     * Array.prototype.shift()
	 * TRANSFERABLE: Needs to support generic objects as well as Array objects
     */
	/*static*/ Atom ArrayClass::generic_shift(Toplevel* toplevel, Atom thisAtom)
	{
		ArrayObject *a = isArray(toplevel, thisAtom);

		if (a && a->isSimpleDense())
		{
			if (!a->m_length)
				return undefinedAtom;

			a->m_length--;
			return (a->m_denseArr.shift());
		}

		if (!AvmCore::isObject(thisAtom))
			return undefinedAtom;

		Atom outAtom;
		ScriptObject *d = AvmCore::atomToScriptObject(thisAtom);
		uint32 len = getLengthHelper(toplevel, d);

		if (len == 0)
		{
			// set len to 0 (ecmascript spec)
			setLengthHelper(toplevel, d, 0);
			outAtom = undefinedAtom;
		}
		else
		{
			// Get the 0th element to return
			outAtom = d->getUintProperty(0);

			// Move all of the elements down
			for (uint32 i=0; i<len-1; i++) {
				d->setUintProperty(i, d->getUintProperty(i+1));
			}
			
			d->delUintProperty (len - 1);
			setLengthHelper(toplevel, d, len - 1);
		}

		return outAtom;
	}