зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1083482 part 5 - Clean up CloseIterator, remove UnwindIteratorForException. r=arai
This commit is contained in:
Родитель
eb82e60199
Коммит
65a01dd0f9
|
@ -4274,16 +4274,15 @@ ICIteratorMore_Native::Compiler::generateStubCode(MacroAssembler& masm)
|
|||
// IteratorClose_Fallback
|
||||
//
|
||||
|
||||
static bool
|
||||
static void
|
||||
DoIteratorCloseFallback(JSContext* cx, ICIteratorClose_Fallback* stub, HandleValue iterValue)
|
||||
{
|
||||
FallbackICSpew(cx, stub, "IteratorClose");
|
||||
|
||||
RootedObject iteratorObject(cx, &iterValue.toObject());
|
||||
return CloseIterator(cx, iteratorObject);
|
||||
CloseIterator(&iterValue.toObject());
|
||||
}
|
||||
|
||||
typedef bool (*DoIteratorCloseFallbackFn)(JSContext*, ICIteratorClose_Fallback*, HandleValue);
|
||||
typedef void (*DoIteratorCloseFallbackFn)(JSContext*, ICIteratorClose_Fallback*, HandleValue);
|
||||
static const VMFunction DoIteratorCloseFallbackInfo =
|
||||
FunctionInfo<DoIteratorCloseFallbackFn>(DoIteratorCloseFallback, "DoIteratorCloseFallback",
|
||||
TailCall);
|
||||
|
|
|
@ -9291,9 +9291,9 @@ CodeGenerator::visitIsNoIterAndBranch(LIsNoIterAndBranch* lir)
|
|||
masm.jump(ifFalse);
|
||||
}
|
||||
|
||||
typedef bool (*CloseIteratorFn)(JSContext*, HandleObject);
|
||||
static const VMFunction CloseIteratorInfo =
|
||||
FunctionInfo<CloseIteratorFn>(CloseIterator, "CloseIterator");
|
||||
typedef void (*CloseIteratorFromIonFn)(JSContext*, JSObject*);
|
||||
static const VMFunction CloseIteratorFromIonInfo =
|
||||
FunctionInfo<CloseIteratorFromIonFn>(CloseIteratorFromIon, "CloseIteratorFromIon");
|
||||
|
||||
void
|
||||
CodeGenerator::visitIteratorEnd(LIteratorEnd* lir)
|
||||
|
@ -9303,7 +9303,7 @@ CodeGenerator::visitIteratorEnd(LIteratorEnd* lir)
|
|||
const Register temp2 = ToRegister(lir->temp2());
|
||||
const Register temp3 = ToRegister(lir->temp3());
|
||||
|
||||
OutOfLineCode* ool = oolCallVM(CloseIteratorInfo, lir, ArgList(obj), StoreNothing());
|
||||
OutOfLineCode* ool = oolCallVM(CloseIteratorFromIonInfo, lir, ArgList(obj), StoreNothing());
|
||||
|
||||
LoadNativeIterator(masm, obj, temp1, ool->entry());
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ CloseLiveIteratorIon(JSContext* cx, const InlineFrameIterator& frame, JSTryNote*
|
|||
|
||||
if (cx->isExceptionPending()) {
|
||||
if (tn->kind == JSTRY_FOR_IN)
|
||||
UnwindIteratorForException(cx, iterObject);
|
||||
CloseIterator(iterObject);
|
||||
else
|
||||
IteratorCloseForException(cx, iterObject);
|
||||
} else {
|
||||
|
@ -429,14 +429,8 @@ ProcessTryNotesBaseline(JSContext* cx, const JSJitFrameIter& frame, EnvironmentI
|
|||
uint8_t* stackPointer;
|
||||
BaselineFrameAndStackPointersFromTryNote(tn, frame, &framePointer, &stackPointer);
|
||||
Value iterValue(*reinterpret_cast<Value*>(stackPointer));
|
||||
RootedObject iterObject(cx, &iterValue.toObject());
|
||||
if (!UnwindIteratorForException(cx, iterObject)) {
|
||||
// See comment in the JSTRY_FOR_IN case in Interpreter.cpp's
|
||||
// ProcessTryNotes.
|
||||
SettleOnTryNote(cx, tn, frame, ei, rfe, pc);
|
||||
MOZ_ASSERT(**pc == JSOP_ENDITER);
|
||||
return false;
|
||||
}
|
||||
JSObject* iterObject = &iterValue.toObject();
|
||||
CloseIterator(iterObject);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1835,6 +1835,12 @@ GetPrototypeOf(JSContext* cx, HandleObject target, MutableHandleValue rval)
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CloseIteratorFromIon(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
CloseIterator(obj);
|
||||
}
|
||||
|
||||
typedef bool (*SetObjectElementFn)(JSContext*, HandleObject, HandleValue,
|
||||
HandleValue, HandleValue, bool);
|
||||
const VMFunction SetObjectElementInfo =
|
||||
|
|
|
@ -894,6 +894,9 @@ TypeOfObject(JSObject* obj, JSRuntime* rt);
|
|||
bool
|
||||
GetPrototypeOf(JSContext* cx, HandleObject target, MutableHandleValue rval);
|
||||
|
||||
void
|
||||
CloseIteratorFromIon(JSContext* cx, JSObject* obj);
|
||||
|
||||
extern const VMFunction SetObjectElementInfo;
|
||||
|
||||
} // namespace jit
|
||||
|
|
|
@ -1263,8 +1263,8 @@ js::ValueToIterator(JSContext* cx, unsigned flags, HandleValue vp)
|
|||
return GetIterator(cx, obj, flags);
|
||||
}
|
||||
|
||||
bool
|
||||
js::CloseIterator(JSContext* cx, HandleObject obj)
|
||||
void
|
||||
js::CloseIterator(JSObject* obj)
|
||||
{
|
||||
if (obj->is<PropertyIteratorObject>()) {
|
||||
/* Remove enumerators from the active list, which is a stack. */
|
||||
|
@ -1283,22 +1283,6 @@ js::CloseIterator(JSContext* cx, HandleObject obj)
|
|||
ni->props_cursor = ni->props_array;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
js::UnwindIteratorForException(JSContext* cx, HandleObject obj)
|
||||
{
|
||||
RootedValue v(cx);
|
||||
bool getOk = cx->getPendingException(&v);
|
||||
cx->clearPendingException();
|
||||
if (!CloseIterator(cx, obj))
|
||||
return false;
|
||||
if (!getOk)
|
||||
return false;
|
||||
cx->setPendingException(v);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -182,11 +182,8 @@ NewEmptyPropertyIterator(JSContext* cx, unsigned flags);
|
|||
JSObject*
|
||||
ValueToIterator(JSContext* cx, unsigned flags, HandleValue vp);
|
||||
|
||||
bool
|
||||
CloseIterator(JSContext* cx, HandleObject iterObj);
|
||||
|
||||
bool
|
||||
UnwindIteratorForException(JSContext* cx, HandleObject obj);
|
||||
void
|
||||
CloseIterator(JSObject* obj);
|
||||
|
||||
bool
|
||||
IteratorCloseForException(JSContext* cx, HandleObject obj);
|
||||
|
|
|
@ -266,17 +266,16 @@ CanReify(HandleObject obj)
|
|||
|
||||
struct AutoCloseIterator
|
||||
{
|
||||
AutoCloseIterator(JSContext* cx, PropertyIteratorObject* obj) : cx(cx), obj(cx, obj) {}
|
||||
AutoCloseIterator(JSContext* cx, PropertyIteratorObject* obj) : obj(cx, obj) {}
|
||||
|
||||
~AutoCloseIterator() {
|
||||
if (obj)
|
||||
MOZ_ALWAYS_TRUE(CloseIterator(cx, obj));
|
||||
CloseIterator(obj);
|
||||
}
|
||||
|
||||
void clear() { obj = nullptr; }
|
||||
|
||||
private:
|
||||
JSContext* cx;
|
||||
Rooted<PropertyIteratorObject*> obj;
|
||||
};
|
||||
|
||||
|
@ -314,7 +313,7 @@ Reify(JSContext* cx, JSCompartment* origin, HandleObject objp)
|
|||
}
|
||||
|
||||
close.clear();
|
||||
MOZ_ALWAYS_TRUE(CloseIterator(cx, iterObj));
|
||||
CloseIterator(iterObj);
|
||||
|
||||
obj = EnumeratedIdVectorToIterator(cx, obj, ni->flags, keys);
|
||||
}
|
||||
|
|
|
@ -1270,16 +1270,8 @@ ProcessTryNotes(JSContext* cx, EnvironmentIter& ei, InterpreterRegs& regs)
|
|||
DebugOnly<jsbytecode*> pc = regs.fp()->script()->main() + tn->start + tn->length;
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_ENDITER);
|
||||
Value* sp = regs.spForStackDepth(tn->stackDepth);
|
||||
RootedObject obj(cx, &sp[-1].toObject());
|
||||
if (!UnwindIteratorForException(cx, obj)) {
|
||||
// We should only settle on the note only if
|
||||
// UnwindIteratorForException itself threw, as
|
||||
// onExceptionUnwind should be called anew with the new
|
||||
// location of the throw (the iterator). Indeed, we must
|
||||
// settle to avoid infinitely handling the same exception.
|
||||
SettleOnTryNote(cx, tn, ei, regs);
|
||||
return ErrorReturnContinuation;
|
||||
}
|
||||
JSObject* obj = &sp[-1].toObject();
|
||||
CloseIterator(obj);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2280,11 +2272,8 @@ CASE(JSOP_ENDITER)
|
|||
{
|
||||
MOZ_ASSERT(REGS.stackDepth() >= 1);
|
||||
COUNT_COVERAGE();
|
||||
ReservedRooted<JSObject*> obj(&rootObject0, ®S.sp[-1].toObject());
|
||||
bool ok = CloseIterator(cx, obj);
|
||||
CloseIterator(®S.sp[-1].toObject());
|
||||
REGS.sp--;
|
||||
if (!ok)
|
||||
goto error;
|
||||
}
|
||||
END_CASE(JSOP_ENDITER)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче