uint numAccessors = qMin((int)context()->function->formalParameterCount(), context()->realArgumentCount);
if (pd && index < (uint)numAccessors)
isMapped = arrayData()->attributes(index).isAccessor() &&
- pd->getter()->d() == context()->engine->argumentsAccessors[index].getter()->d();
+ pd->getter() == context()->engine->argumentsAccessors[index].getter();
if (isMapped) {
Q_ASSERT(arrayData());
if (isMapped && attrs.isData()) {
Q_ASSERT(arrayData());
+ ScopedFunctionObject setter(scope, map.setter());
ScopedCallData callData(scope, 1);
callData->thisObject = this->asReturnedValue();
callData->args[0] = desc.value;
- map.setter()->call(callData);
+ setter->call(callData);
if (attrs.isWritable()) {
setArrayAttributes(index, mapAttrs);
for (int i = 0; i < nArgumentsAccessors; ++i) {
const Property &pd = argumentsAccessors[i];
- if (FunctionObject *getter = pd.getter())
+ if (Heap::FunctionObject *getter = pd.getter())
getter->mark(this);
- if (FunctionObject *setter = pd.setter())
+ if (Heap::FunctionObject *setter = pd.setter())
setter->mark(this);
}
Object *o = object->objectValue();
if (l->classList[0] == o->internalClass()) {
Scope scope(o->engine());
- FunctionObject *getter = o->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
if (l->classList[0] == o->internalClass &&
l->classList[1] == o->prototype->internalClass) {
Scope scope(o->internalClass->engine);
- FunctionObject *getter = o->prototype->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->prototype->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
o = o->prototype;
if (l->classList[2] == o->internalClass) {
Scope scope(o->internalClass->engine);
- FunctionObject *getter = o->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
Object *o = l->proto;
if (l->classList[0] == o->internalClass()) {
Scope scope(o->engine());
- FunctionObject *getter = o->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
if (l->classList[0] == o->internalClass() &&
l->classList[1] == o->prototype()->internalClass) {
Scope scope(o->engine());
- FunctionObject *getter = o->prototype()->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->prototype()->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
Object *o = engine->globalObject();
if (l->classList[0] == o->internalClass()) {
Scope scope(o->engine());
- FunctionObject *getter = o->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
if (l->classList[0] == o->internalClass() &&
l->classList[1] == o->prototype()->internalClass) {
Scope scope(o->engine());
- FunctionObject *getter = o->prototype()->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->prototype()->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
o = o->prototype;
if (l->classList[2] == o->internalClass) {
Scope scope(o->internalClass->engine);
- FunctionObject *getter = o->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
{
if (!attrs.isAccessor())
return p->value.asReturnedValue();
- FunctionObject *getter = p->getter();
- if (!getter)
+ if (!p->getter())
return Encode::undefined();
- Scope scope(getter->engine());
+ Scope scope(p->getter()->internalClass->engine);
+ ScopedFunctionObject getter(scope, p->getter());
ScopedCallData callData(scope);
callData->thisObject = *thisObject;
return getter->call(callData);
return;
if (attrs.isAccessor()) {
- if (FunctionObject *set = pd->setter()) {
- Scope scope(set->engine());
+ if (Heap::FunctionObject *set = pd->setter()) {
+ Scope scope(set->internalClass->engine);
+ ScopedFunctionObject setter(scope, set);
ScopedCallData callData(scope, 1);
callData->args[0] = *value;
callData->thisObject = this;
- set->call(callData);
+ setter->call(callData);
return;
}
goto reject;
assert(pd->setter() != 0);
Scope scope(engine());
+ ScopedFunctionObject setter(scope, pd->setter());
ScopedCallData callData(scope, 1);
callData->args[0] = *value;
callData->thisObject = this;
- pd->setter()->call(callData);
+ setter->call(callData);
return;
}
assert(pd->setter() != 0);
Scope scope(engine());
+ ScopedFunctionObject setter(scope, pd->setter());
ScopedCallData callData(scope, 1);
callData->args[0] = *value;
callData->thisObject = this;
- pd->setter()->call(callData);
+ setter->call(callData);
return;
}
inline bool isSubset(const PropertyAttributes &attrs, const Property &other, PropertyAttributes otherAttrs) const;
inline void merge(PropertyAttributes &attrs, const Property &other, PropertyAttributes otherAttrs);
- inline FunctionObject *getter() const { return reinterpret_cast<FunctionObject *>(value.asManaged()); }
- inline FunctionObject *setter() const { return reinterpret_cast<FunctionObject *>(set.asManaged()); }
+ inline Heap::FunctionObject *getter() const { return value.isManaged() ? reinterpret_cast<Heap::FunctionObject *>(value.heapObject()) : 0; }
+ inline Heap::FunctionObject *setter() const { return set.isManaged() ? reinterpret_cast<Heap::FunctionObject *>(set.heapObject()) : 0; }
inline void setGetter(FunctionObject *g) { value = Primitive::fromManaged(reinterpret_cast<Managed *>(g)); }
- inline void setSetter(FunctionObject *s) { set = Primitive::fromManaged(reinterpret_cast<Managed *>(s)); }
+ inline void setSetter(FunctionObject *s) { set = s ? Primitive::fromManaged(reinterpret_cast<Managed *>(s)) : Value::fromHeapObject(0); }
void copy(const Property &other, PropertyAttributes attrs) {
value = other.value;
set = other.set;
}
- explicit Property() { value = Encode::undefined(); set = Encode::undefined(); }
- explicit Property(Value v) : value(v) { set = Encode::undefined(); }
+ explicit Property() { value = Encode::undefined(); set = Value::fromHeapObject(0); }
+ explicit Property(Value v) : value(v) { set = Value::fromHeapObject(0); }
Property(FunctionObject *getter, FunctionObject *setter) {
value = Primitive::fromManaged(reinterpret_cast<Managed *>(getter));
set = Primitive::fromManaged(reinterpret_cast<Managed *>(setter));
if (attrs.type() == PropertyAttributes::Data && !value.sameValue(other.value))
return false;
if (attrs.type() == PropertyAttributes::Accessor) {
- if (value.asManaged() != other.value.asManaged())
+ if (value.heapObject() != other.value.heapObject())
return false;
- if (set.asManaged() != other.set.asManaged())
+ if (set.heapObject() != other.set.heapObject())
return false;
}
return true;