diff --git a/src/org/mozilla/javascript/BaseFunction.java b/src/org/mozilla/javascript/BaseFunction.java
index <HASH>..<HASH> 100644
--- a/src/org/mozilla/javascript/BaseFunction.java
+++ b/src/org/mozilla/javascript/BaseFunction.java
@@ -385,7 +385,10 @@ public class BaseFunction extends IdScriptableObject implements Function
             }
             result = (Scriptable)val;
             if (result.getPrototype() == null) {
-                result.setPrototype(getClassPrototype());
+                Scriptable proto = getClassPrototype();
+                if (result != proto) {
+                    result.setPrototype(proto);
+                }
             }
             if (result.getParentScope() == null) {
                 Scriptable parent = getParentScope();
Avoid setting cyclic prototype in BaseFunction.construct().

Fixes bug <I> - Object(Object.prototype) causes an infinite loop