зеркало из https://github.com/mozilla/pjs.git
Explicitly throw IllegalStateException to indicate code bug when hashtable scan end up in infinite loop.
This commit is contained in:
Родитель
db1253e761
Коммит
61b4dfe136
|
@ -1718,7 +1718,7 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
|
|||
if (slots != null) {
|
||||
int start = (index & 0x7fffffff) % slots.length;
|
||||
int i = start;
|
||||
do {
|
||||
for (;;) {
|
||||
Slot slot = slots[i];
|
||||
if (slot == null)
|
||||
break;
|
||||
|
@ -1730,7 +1730,9 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
|
|||
}
|
||||
if (++i == slots.length)
|
||||
i = 0;
|
||||
} while (i != start);
|
||||
if (i == start)
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -1755,10 +1757,11 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
|
|||
}
|
||||
|
||||
// Must be inside synchronized (this)
|
||||
private Slot addSlotImpl(String id, int index, Slot newSlot) {
|
||||
private Slot addSlotImpl(String id, int index, Slot newSlot)
|
||||
{
|
||||
int start = (index & 0x7fffffff) % slots.length;
|
||||
int i = start;
|
||||
do {
|
||||
for (;;) {
|
||||
Slot slot = slots[i];
|
||||
if (slot == null || slot == REMOVED) {
|
||||
if ((4 * (count + 1)) > (3 * slots.length)) {
|
||||
|
@ -1780,10 +1783,11 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
|
|||
}
|
||||
if (++i == slots.length)
|
||||
i = 0;
|
||||
} while (i != start);
|
||||
// Unreachable code
|
||||
if (Context.check) Kit.codeBug();
|
||||
return null;
|
||||
if (i == start) {
|
||||
// slots should never be full or bug in grow code
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1966,7 +1970,7 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
|
|||
transient byte wasDeleted;
|
||||
}
|
||||
|
||||
static class GetterSlot extends Slot
|
||||
private static class GetterSlot extends Slot
|
||||
{
|
||||
Object delegateTo;
|
||||
MemberBox getter;
|
||||
|
|
Загрузка…
Ссылка в новой задаче