mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 15:28:39 +09:00
Issue #1742 - Part 3: use JS::PropertyResult instead of Shape*
This is the meat of the issue and switches using raw shape pointers out for PropertyResult objects where feasible.
This commit is contained in:
parent
c48b8e8932
commit
574b295d15
33 changed files with 367 additions and 328 deletions
|
|
@ -210,27 +210,27 @@ GetNameOperation(JSContext* cx, InterpreterFrame* fp, jsbytecode* pc, MutableHan
|
|||
if (IsGlobalOp(JSOp(*pc)) && !fp->script()->hasNonSyntacticScope())
|
||||
obj = &obj->global().lexicalEnvironment();
|
||||
|
||||
Shape* shape = nullptr;
|
||||
PropertyResult prop;
|
||||
JSObject* env = nullptr;
|
||||
JSObject* pobj = nullptr;
|
||||
if (LookupNameNoGC(cx, name, obj, &env, &pobj, &shape)) {
|
||||
if (FetchNameNoGC(pobj, shape, vp))
|
||||
if (LookupNameNoGC(cx, name, obj, &env, &pobj, &prop)) {
|
||||
if (FetchNameNoGC(pobj, prop, vp))
|
||||
return true;
|
||||
}
|
||||
|
||||
RootedObject objRoot(cx, obj), envRoot(cx), pobjRoot(cx);
|
||||
RootedPropertyName nameRoot(cx, name);
|
||||
RootedShape shapeRoot(cx);
|
||||
Rooted<PropertyResult> propRoot(cx);
|
||||
|
||||
if (!LookupName(cx, nameRoot, objRoot, &envRoot, &pobjRoot, &shapeRoot))
|
||||
if (!LookupName(cx, nameRoot, objRoot, &envRoot, &pobjRoot, &propRoot))
|
||||
return false;
|
||||
|
||||
/* Kludge to allow (typeof foo == "undefined") tests. */
|
||||
JSOp op2 = JSOp(pc[JSOP_GETNAME_LENGTH]);
|
||||
if (op2 == JSOP_TYPEOF)
|
||||
return FetchName<true>(cx, envRoot, pobjRoot, nameRoot, shapeRoot, vp);
|
||||
return FetchName<true>(cx, envRoot, pobjRoot, nameRoot, propRoot, vp);
|
||||
|
||||
return FetchName<false>(cx, envRoot, pobjRoot, nameRoot, shapeRoot, vp);
|
||||
return FetchName<false>(cx, envRoot, pobjRoot, nameRoot, propRoot, vp);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
|
@ -238,12 +238,12 @@ GetImportOperation(JSContext* cx, InterpreterFrame* fp, jsbytecode* pc, MutableH
|
|||
{
|
||||
RootedObject obj(cx, fp->environmentChain()), env(cx), pobj(cx);
|
||||
RootedPropertyName name(cx, fp->script()->getName(pc));
|
||||
RootedShape shape(cx);
|
||||
Rooted<PropertyResult> prop(cx);
|
||||
|
||||
MOZ_ALWAYS_TRUE(LookupName(cx, name, obj, &env, &pobj, &shape));
|
||||
MOZ_ALWAYS_TRUE(LookupName(cx, name, obj, &env, &pobj, &prop));
|
||||
MOZ_ASSERT(env && env->is<ModuleEnvironmentObject>());
|
||||
MOZ_ASSERT(env->as<ModuleEnvironmentObject>().hasImportBinding(name));
|
||||
return FetchName<false>(cx, env, pobj, name, shape, vp);
|
||||
return FetchName<false>(cx, env, pobj, name, prop, vp);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
@ -4388,12 +4388,12 @@ bool
|
|||
js::GetEnvironmentName(JSContext* cx, HandleObject envChain, HandlePropertyName name,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
RootedShape shape(cx);
|
||||
Rooted<PropertyResult> prop(cx);
|
||||
RootedObject obj(cx), pobj(cx);
|
||||
if (!LookupName(cx, name, envChain, &obj, &pobj, &shape))
|
||||
if (!LookupName(cx, name, envChain, &obj, &pobj, &prop))
|
||||
return false;
|
||||
|
||||
if (!shape)
|
||||
if (!prop)
|
||||
return ReportIsNotDefined(cx, name);
|
||||
|
||||
if (!GetProperty(cx, obj, obj, name, vp))
|
||||
|
|
@ -4415,12 +4415,12 @@ bool
|
|||
js::GetEnvironmentNameForTypeOf(JSContext* cx, HandleObject envChain, HandlePropertyName name,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
RootedShape shape(cx);
|
||||
Rooted<PropertyResult> prop(cx);
|
||||
RootedObject obj(cx), pobj(cx);
|
||||
if (!LookupName(cx, name, envChain, &obj, &pobj, &shape))
|
||||
if (!LookupName(cx, name, envChain, &obj, &pobj, &prop))
|
||||
return false;
|
||||
|
||||
if (!shape) {
|
||||
if (!prop) {
|
||||
vp.set(UndefinedValue());
|
||||
return true;
|
||||
}
|
||||
|
|
@ -4478,9 +4478,9 @@ js::DefFunOperation(JSContext* cx, HandleScript script, HandleObject envChain,
|
|||
/* ES5 10.5 (NB: with subsequent errata). */
|
||||
RootedPropertyName name(cx, fun->explicitName()->asPropertyName());
|
||||
|
||||
RootedShape shape(cx);
|
||||
Rooted<PropertyResult> prop(cx);
|
||||
RootedObject pobj(cx);
|
||||
if (!LookupProperty(cx, parent, name, &pobj, &shape))
|
||||
if (!LookupProperty(cx, parent, name, &pobj, &prop))
|
||||
return false;
|
||||
|
||||
RootedValue rval(cx, ObjectValue(*fun));
|
||||
|
|
@ -4494,7 +4494,7 @@ js::DefFunOperation(JSContext* cx, HandleScript script, HandleObject envChain,
|
|||
: JSPROP_ENUMERATE | JSPROP_PERMANENT;
|
||||
|
||||
/* Steps 5d, 5f. */
|
||||
if (!shape || pobj != parent) {
|
||||
if (!prop || pobj != parent) {
|
||||
if (!DefineProperty(cx, parent, name, rval, nullptr, nullptr, attrs))
|
||||
return false;
|
||||
|
||||
|
|
@ -4512,6 +4512,7 @@ js::DefFunOperation(JSContext* cx, HandleScript script, HandleObject envChain,
|
|||
*/
|
||||
MOZ_ASSERT(parent->isNative() || parent->is<DebugEnvironmentProxy>());
|
||||
if (parent->is<GlobalObject>()) {
|
||||
Shape* shape = prop.shape();
|
||||
if (shape->configurable()) {
|
||||
if (!DefineProperty(cx, parent, name, rval, nullptr, nullptr, attrs))
|
||||
return false;
|
||||
|
|
@ -4716,8 +4717,8 @@ js::DeleteNameOperation(JSContext* cx, HandlePropertyName name, HandleObject sco
|
|||
MutableHandleValue res)
|
||||
{
|
||||
RootedObject scope(cx), pobj(cx);
|
||||
RootedShape shape(cx);
|
||||
if (!LookupName(cx, name, scopeObj, &scope, &pobj, &shape))
|
||||
Rooted<PropertyResult> prop(cx);
|
||||
if (!LookupName(cx, name, scopeObj, &scope, &pobj, &prop))
|
||||
return false;
|
||||
|
||||
if (!scope) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue