docs: public static boolean eq(Object x, Object y)
      {
          if (x == null || x == Undefined.instance) {
              if (y == null || y == Undefined.instance) {
                  return true;
              }
              if (y instanceof ScriptableObject) {
                  Object test = ((ScriptableObject)y).equivalentValues(x);
                  if (test != Scriptable.NOT_FOUND) {
                      return ((Boolean)test).booleanValue();
                  }
              }
              return false;
          } else if (x instanceof Number) {
              return eqNumber(((Number)x).doubleValue(), y);
          } else if (x == y) {
              return true;
          } else if (x instanceof CharSequence) {
              return eqString((CharSequence)x, y);
          } else if (x instanceof Boolean) {
              boolean b = ((Boolean)x).booleanValue();
              if (y instanceof Boolean) {
                  return b == ((Boolean)y).booleanValue();
              }
              if (y instanceof ScriptableObject) {
                  Object test = ((ScriptableObject)y).equivalentValues(x);
                  if (test != Scriptable.NOT_FOUND) {
                      return ((Boolean)test).booleanValue();
                  }
              }
              return eqNumber(b ? 1.0 : 0.0, y);
          } else if (x instanceof Scriptable) {
              if (y instanceof Scriptable) {
                  if (x instanceof ScriptableObject) {
                      Object test = ((ScriptableObject)x).equivalentValues(y);
                      if (test != Scriptable.NOT_FOUND) {
                          return ((Boolean)test).booleanValue();
                      }
                  }
                  if (y instanceof ScriptableObject) {
                      Object test = ((ScriptableObject)y).equivalentValues(x);
                      if (test != Scriptable.NOT_FOUND) {
                          return ((Boolean)test).booleanValue();
                      }
                  }
                  if (x instanceof Wrapper && y instanceof Wrapper) {
                      // See bug 413838. Effectively an extension to ECMA for
                      // the LiveConnect case.
                      Object unwrappedX = ((Wrapper)x).unwrap();
                      Object unwrappedY = ((Wrapper)y).unwrap();
                      return unwrappedX == unwrappedY ||
                             (isPrimitive(unwrappedX) &&
                              isPrimitive(unwrappedY) &&
                              eq(unwrappedX, unwrappedY));
                  }
                  return false;
              } else if (y instanceof Boolean) {
                  if (x instanceof ScriptableObject) {
                      Object test = ((ScriptableObject)x).equivalentValues(y);
                      if (test != Scriptable.NOT_FOUND) {
                          return ((Boolean)test).booleanValue();
                      }
                  }
                  double d = ((Boolean)y).booleanValue() ? 1.0 : 0.0;
                  return eqNumber(d, x);
              } else if (y instanceof Number) {
                  return eqNumber(((Number)y).doubleValue(), x);
              } else if (y instanceof CharSequence) {
                  return eqString((CharSequence)y, x);
              }
              // covers the case when y == Undefined.instance as well
              return false;
          } else {
              warnAboutNonJSObject(x);
              return x == y;
          }
      }