lookups = parent->lookups;
compilationUnit = parent->compilationUnit;
- withObject = with->d();
+ withObject = with ? with->d() : 0;
}
Heap::CatchContext::CatchContext(ExecutionEngine *engine, QV4::String *exceptionVarName, const ValueRef exceptionValue)
c->function->mark(engine);
} else if (ctx->type == Heap::ExecutionContext::Type_WithContext) {
WithContext::Data *w = static_cast<WithContext::Data *>(ctx);
- w->withObject->mark(engine);
+ if (w->withObject)
+ w->withObject->mark(engine);
} else if (ctx->type == Heap::ExecutionContext::Type_CatchContext) {
CatchContext::Data *c = static_cast<CatchContext::Data *>(ctx);
c->exceptionVarName->mark(engine);
variantPrototype = memoryManager->alloc<VariantPrototype>(InternalClass::create(this, VariantPrototype::staticVTable()), objectPrototype.asObject());
variantClass = InternalClass::create(this, VariantObject::staticVTable());
- Q_ASSERT(variantPrototype.asObject()->prototype() == objectPrototype.asObject());
+ Q_ASSERT(variantPrototype.asObject()->prototype() == objectPrototype.asObject()->d());
sequencePrototype = ScopedValue(scope, memoryManager->alloc<SequencePrototype>(arrayClass, arrayPrototype.asObject()));
using namespace QV4;
-ReturnedValue Lookup::lookup(ValueRef thisObject, Object *obj, PropertyAttributes *attrs)
+ReturnedValue Lookup::lookup(ValueRef thisObject, Object *o, PropertyAttributes *attrs)
{
- ExecutionEngine *engine = obj->engine();
+ ExecutionEngine *engine = o->engine();
Identifier *name = engine->currentContext()->d()->compilationUnit->runtimeStrings[nameIndex]->identifier;
int i = 0;
+ Heap::Object *obj = o->d();
while (i < Size && obj) {
- classList[i] = obj->internalClass();
+ classList[i] = obj->internalClass;
- index = obj->internalClass()->find(name);
+ index = obj->internalClass->find(name);
if (index != UINT_MAX) {
level = i;
- *attrs = obj->internalClass()->propertyData.at(index);
- return !attrs->isAccessor() ? obj->memberData()->data[index].asReturnedValue() : obj->getValue(thisObject, obj->propertyAt(index), *attrs);
+ *attrs = obj->internalClass->propertyData.at(index);
+ return !attrs->isAccessor() ? obj->memberData->data[index].asReturnedValue() : Object::getValue(thisObject, obj->propertyAt(index), *attrs);
}
- obj = obj->prototype();
+ obj = obj->prototype;
++i;
}
level = Size;
while (obj) {
- index = obj->internalClass()->find(name);
+ index = obj->internalClass->find(name);
if (index != UINT_MAX) {
- *attrs = obj->internalClass()->propertyData.at(index);
- return !attrs->isAccessor() ? obj->memberData()->data[index].asReturnedValue() : obj->getValue(thisObject, obj->propertyAt(index), *attrs);
+ *attrs = obj->internalClass->propertyData.at(index);
+ return !attrs->isAccessor() ? obj->memberData->data[index].asReturnedValue() : Object::getValue(thisObject, obj->propertyAt(index), *attrs);
}
- obj = obj->prototype();
+ obj = obj->prototype;
}
return Primitive::emptyValue().asReturnedValue();
}
-ReturnedValue Lookup::lookup(Object *obj, PropertyAttributes *attrs)
+ReturnedValue Lookup::lookup(Object *thisObject, PropertyAttributes *attrs)
{
- Object *thisObject = obj;
- ExecutionEngine *engine = obj->engine();
+ Heap::Object *obj = thisObject->d();
+ ExecutionEngine *engine = thisObject->engine();
Identifier *name = engine->currentContext()->d()->compilationUnit->runtimeStrings[nameIndex]->identifier;
int i = 0;
while (i < Size && obj) {
- classList[i] = obj->internalClass();
+ classList[i] = obj->internalClass;
- index = obj->internalClass()->find(name);
+ index = obj->internalClass->find(name);
if (index != UINT_MAX) {
level = i;
- *attrs = obj->internalClass()->propertyData.at(index);
- return !attrs->isAccessor() ? obj->memberData()->data[index].asReturnedValue() : thisObject->getValue(obj->propertyAt(index), *attrs);
+ *attrs = obj->internalClass->propertyData.at(index);
+ return !attrs->isAccessor() ? obj->memberData->data[index].asReturnedValue() : thisObject->getValue(obj->propertyAt(index), *attrs);
}
- obj = obj->prototype();
+ obj = obj->prototype;
++i;
}
level = Size;
while (obj) {
- index = obj->internalClass()->find(name);
+ index = obj->internalClass->find(name);
if (index != UINT_MAX) {
- *attrs = obj->internalClass()->propertyData.at(index);
- return !attrs->isAccessor() ? obj->memberData()->data[index].asReturnedValue() : thisObject->getValue(obj->propertyAt(index), *attrs);
+ *attrs = obj->internalClass->propertyData.at(index);
+ return !attrs->isAccessor() ? obj->memberData->data[index].asReturnedValue() : thisObject->getValue(obj->propertyAt(index), *attrs);
}
- obj = obj->prototype();
+ obj = obj->prototype;
}
return Primitive::emptyValue().asReturnedValue();
}
// the internal class won't match
Object *o = object->objectValue();
if (l->classList[0] == o->internalClass() &&
- l->classList[1] == o->prototype()->internalClass())
- return o->prototype()->memberData()->data[l->index].asReturnedValue();
+ l->classList[1] == o->prototype()->internalClass)
+ return o->prototype()->memberData->data[l->index].asReturnedValue();
}
return getterTwoClasses(l, engine, object);
}
// the internal class won't match
Object *o = object->objectValue();
if (l->classList[0] == o->internalClass()) {
- o = o->prototype();
- if (l->classList[1] == o->internalClass()) {
- o = o->prototype();
- if (l->classList[2] == o->internalClass())
- return o->memberData()->data[l->index].asReturnedValue();
+ Heap::Object *p = o->prototype();
+ if (l->classList[1] == p->internalClass) {
+ p = p->prototype;
+ if (l->classList[2] == p->internalClass)
+ return p->memberData->data[l->index].asReturnedValue();
}
}
}
if (l->classList[0] == o->internalClass())
return o->memberData()->data[l->index].asReturnedValue();
if (l->classList[2] == o->internalClass() &&
- l->classList[3] == o->prototype()->internalClass())
- return o->prototype()->memberData()->data[l->index2].asReturnedValue();
+ l->classList[3] == o->prototype()->internalClass)
+ return o->prototype()->memberData->data[l->index2].asReturnedValue();
}
l->getter = getterFallback;
return getterFallback(l, engine, object);
// the internal class won't match
Object *o = object->objectValue();
if (l->classList[0] == o->internalClass() &&
- l->classList[1] == o->prototype()->internalClass())
- return o->prototype()->memberData()->data[l->index].asReturnedValue();
+ l->classList[1] == o->prototype()->internalClass)
+ return o->prototype()->memberData->data[l->index].asReturnedValue();
if (l->classList[2] == o->internalClass() &&
- l->classList[3] == o->prototype()->internalClass())
- return o->prototype()->memberData()->data[l->index2].asReturnedValue();
+ l->classList[3] == o->prototype()->internalClass)
+ return o->prototype()->memberData->data[l->index2].asReturnedValue();
return getterFallback(l, engine, object);
}
l->getter = getterFallback;
if (object->isManaged()) {
// we can safely cast to a QV4::Object here. If object is actually a string,
// the internal class won't match
- Object *o = object->objectValue();
- if (l->classList[0] == o->internalClass() &&
- l->classList[1] == o->prototype()->internalClass()) {
- Scope scope(o->engine());
- FunctionObject *getter = o->prototype()->propertyAt(l->index)->getter();
+ Heap::Object *o = object->objectValue()->d();
+ 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();
if (!getter)
return Encode::undefined();
if (object->isManaged()) {
// we can safely cast to a QV4::Object here. If object is actually a string,
// the internal class won't match
- Object *o = object->objectValue();
- if (l->classList[0] == o->internalClass()) {
- o = o->prototype();
- if (l->classList[1] == o->internalClass()) {
- o = o->prototype();
- if (l->classList[2] == o->internalClass()) {
- Scope scope(o->engine());
+ Heap::Object *o = object->objectValue()->d();
+ if (l->classList[0] == o->internalClass) {
+ o = o->prototype;
+ if (l->classList[1] == o->internalClass) {
+ o = o->prototype;
+ if (l->classList[2] == o->internalClass) {
+ Scope scope(o->internalClass->engine);
FunctionObject *getter = o->propertyAt(l->index)->getter();
if (!getter)
return Encode::undefined();
if (object->type() == l->type) {
Object *o = l->proto;
if (l->classList[0] == o->internalClass() &&
- l->classList[1] == o->prototype()->internalClass())
- return o->prototype()->memberData()->data[l->index].asReturnedValue();
+ l->classList[1] == o->prototype()->internalClass)
+ return o->prototype()->memberData->data[l->index].asReturnedValue();
}
l->getter = getterGeneric;
return getterGeneric(l, engine, object);
if (object->type() == l->type) {
Object *o = l->proto;
if (l->classList[0] == o->internalClass() &&
- l->classList[1] == o->prototype()->internalClass()) {
+ l->classList[1] == o->prototype()->internalClass) {
Scope scope(o->engine());
FunctionObject *getter = o->prototype()->propertyAt(l->index)->getter();
if (!getter)
{
Object *o = engine->globalObject();
if (l->classList[0] == o->internalClass() &&
- l->classList[1] == o->prototype()->internalClass())
- return o->prototype()->memberData()->data[l->index].asReturnedValue();
+ l->classList[1] == o->prototype()->internalClass)
+ return o->prototype()->memberData->data[l->index].asReturnedValue();
l->globalGetter = globalGetterGeneric;
return globalGetterGeneric(l, engine);
ReturnedValue Lookup::globalGetter2(Lookup *l, ExecutionEngine *engine)
{
- Object *o = engine->globalObject();
- if (l->classList[0] == o->internalClass()) {
- o = o->prototype();
- if (l->classList[1] == o->internalClass()) {
- o = o->prototype();
- if (l->classList[2] == o->internalClass()) {
- return o->prototype()->memberData()->data[l->index].asReturnedValue();
+ Heap::Object *o = engine->globalObject()->d();
+ if (l->classList[0] == o->internalClass) {
+ o = o->prototype;
+ if (l->classList[1] == o->internalClass) {
+ o = o->prototype;
+ if (l->classList[2] == o->internalClass) {
+ return o->prototype->memberData->data[l->index].asReturnedValue();
}
}
}
{
Object *o = engine->globalObject();
if (l->classList[0] == o->internalClass() &&
- l->classList[1] == o->prototype()->internalClass()) {
+ l->classList[1] == o->prototype()->internalClass) {
Scope scope(o->engine());
FunctionObject *getter = o->prototype()->propertyAt(l->index)->getter();
if (!getter)
ReturnedValue Lookup::globalGetterAccessor2(Lookup *l, ExecutionEngine *engine)
{
- Object *o = engine->globalObject();
- if (l->classList[0] == o->internalClass()) {
- o = o->prototype();
- if (l->classList[1] == o->internalClass()) {
- o = o->prototype();
- if (l->classList[2] == o->internalClass()) {
- Scope scope(o->engine());
+ Heap::Object *o = engine->globalObject()->d();
+ if (l->classList[0] == o->internalClass) {
+ o = o->prototype;
+ if (l->classList[1] == o->internalClass) {
+ o = o->prototype;
+ if (l->classList[2] == o->internalClass) {
+ Scope scope(o->internalClass->engine);
FunctionObject *getter = o->propertyAt(l->index)->getter();
if (!getter)
return Encode::undefined();
{
Object *o = static_cast<Object *>(object->asManaged());
if (o && o->internalClass() == l->classList[0]) {
- Object *p = o->prototype();
- if (p && p->internalClass() == l->classList[1]) {
+ Heap::Object *p = o->prototype();
+ if (p && p->internalClass == l->classList[1]) {
if (!o->memberData() || l->index >= o->memberData()->size)
o->ensureMemberIndex(l->index);
o->memberData()->data[l->index] = *value;
{
Object *o = static_cast<Object *>(object->asManaged());
if (o && o->internalClass() == l->classList[0]) {
- Object *p = o->prototype();
- if (p && p->internalClass() == l->classList[1]) {
- p = p->prototype();
- if (p && p->internalClass() == l->classList[2]) {
+ Heap::Object *p = o->prototype();
+ if (p && p->internalClass == l->classList[1]) {
+ p = p->prototype;
+ if (p && p->internalClass == l->classList[2]) {
if (!o->memberData() || l->index >= o->memberData()->size)
o->ensureMemberIndex(l->index);
o->memberData()->data[l->index] = *value;
static const QV4::ManagedVTable static_vtbl; \
static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl; } \
V4_MANAGED_SIZE_TEST \
- const QV4::Heap::DataClass *d() const { return &static_cast<const QV4::Heap::DataClass &>(Managed::data); } \
- QV4::Heap::DataClass *d() { return &static_cast<QV4::Heap::DataClass &>(Managed::data); }
+ QV4::Heap::DataClass *d() const { return &static_cast<QV4::Heap::DataClass &>(const_cast<QV4::Heap::Base &>(Managed::data)); }
#define V4_OBJECT(superClass) \
public: \
static const QV4::ObjectVTable static_vtbl; \
static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl.managedVTable; } \
V4_MANAGED_SIZE_TEST \
- const Data *d() const { return &static_cast<const Data &>(Managed::data); } \
- Data *d() { return &static_cast<Data &>(Managed::data); }
+ Data *d() const { return &static_cast<Data &>(const_cast<QV4::Heap::Base &>(Managed::data)); }
#define V4_OBJECT2(DataClass, superClass) \
public: \
static const QV4::ObjectVTable static_vtbl; \
static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl.managedVTable; } \
V4_MANAGED_SIZE_TEST \
- const QV4::Heap::DataClass *d() const { return &static_cast<const QV4::Heap::DataClass &>(Managed::data); } \
- QV4::Heap::DataClass *d() { return &static_cast<QV4::Heap::DataClass &>(Managed::data); }
+ QV4::Heap::DataClass *d() const { return &static_cast<QV4::Heap::DataClass &>(const_cast<QV4::Heap::Base &>(Managed::data)); }
#define Q_MANAGED_TYPE(type) \
public: \
return __getPropertyDescriptor__(idx, attrs);
- const Object *o = this;
+ const Heap::Object *o = d();
while (o) {
- uint idx = o->internalClass()->find(name);
+ uint idx = o->internalClass->find(name);
if (idx < UINT_MAX) {
if (attrs)
- *attrs = o->internalClass()->propertyData[idx];
+ *attrs = o->internalClass->propertyData[idx];
return const_cast<Property *>(o->propertyAt(idx));
}
- o = o->prototype();
+ o = o->prototype;
}
if (attrs)
*attrs = Attr_Invalid;
Property *Object::__getPropertyDescriptor__(uint index, PropertyAttributes *attrs) const
{
- const Object *o = this;
+ const Heap::Object *o = d();
while (o) {
- Property *p = o->arrayData() ? o->arrayData()->getProperty(index) : 0;
+ Property *p = o->arrayData ? o->arrayData->getProperty(index) : 0;
if (p) {
if (attrs)
- *attrs = o->arrayData()->attributes(index);
+ *attrs = o->arrayData->attributes(index);
return p;
}
- if (o->isStringObject()) {
- Property *p = static_cast<const StringObject *>(o)->getIndex(index);
+ if (o->internalClass->vtable->type == Type_StringObject) {
+ Property *p = static_cast<const Heap::StringObject *>(o)->getIndex(index);
if (p) {
if (attrs)
*attrs = (Attr_NotWritable|Attr_NotConfigurable);
return p;
}
}
- o = o->prototype();
+ o = o->prototype;
}
if (attrs)
*attrs = Attr_Invalid;
if (idx != UINT_MAX)
return hasProperty(idx);
- const Object *o = this;
+ Scope scope(engine());
+ ScopedObject o(scope, d());
while (o) {
if (o->hasOwnProperty(name))
return true;
bool Object::hasProperty(uint index) const
{
- const Object *o = this;
+ Scope scope(engine());
+ ScopedObject o(scope, d());
while (o) {
if (o->hasOwnProperty(index))
return true;
name->makeIdentifier();
- Object *o = this;
+ Scope scope(engine());
+ ScopedObject o(scope, this);
while (o) {
uint idx = o->internalClass()->find(name);
if (idx < UINT_MAX) {
{
Property *pd = 0;
PropertyAttributes attrs;
- Object *o = this;
+ Scope scope(engine());
+ ScopedObject o(scope, this);
while (o) {
Property *p = o->arrayData() ? o->arrayData()->getProperty(index) : 0;
if (p) {
break;
}
if (o->isStringObject()) {
- pd = static_cast<StringObject *>(o)->getIndex(index);
+ pd = static_cast<StringObject *>(o.getPointer())->getIndex(index);
if (pd) {
attrs = (Attr_NotWritable|Attr_NotConfigurable);
break;
goto reject;
} else {
// clause 4
- if ((pd = prototype()->__getPropertyDescriptor__(name, &attrs))) {
+ Scope scope(engine());
+ if ((pd = ScopedObject(scope, prototype())->__getPropertyDescriptor__(name, &attrs))) {
if (attrs.isAccessor()) {
if (!pd->setter())
goto reject;
goto reject;
} else {
// clause 4
- if ((pd = prototype()->__getPropertyDescriptor__(index, &attrs))) {
+ Scope scope(engine());
+ if ((pd = ScopedObject(scope, prototype())->__getPropertyDescriptor__(index, &attrs))) {
if (attrs.isAccessor()) {
if (!pd->setter())
goto reject;
}
Object(InternalClass *internal, QV4::Object *prototype);
+ const Property *propertyAt(uint index) const { return reinterpret_cast<const Property *>(memberData->data + index); }
+ Property *propertyAt(uint index) { return reinterpret_cast<Property *>(memberData->data + index); }
+
Heap::Object *prototype;
MemberData *memberData;
ArrayData *arrayData;
Heap::ArrayData *arrayData() const { return d()->arrayData; }
void setArrayData(ArrayData *a) { d()->arrayData = a->d(); }
- const Property *propertyAt(uint index) const { return reinterpret_cast<const Property *>(memberData()->data + index); }
- Property *propertyAt(uint index) { return reinterpret_cast<Property *>(memberData()->data + index); }
+ const Property *propertyAt(uint index) const { return d()->propertyAt(index); }
+ Property *propertyAt(uint index) { return d()->propertyAt(index); }
const ObjectVTable *vtable() const { return reinterpret_cast<const ObjectVTable *>(internalClass()->vtable); }
- // ### GC
- Object *prototype() const { return reinterpret_cast<Object *>(d()->prototype); }
+ Heap::Object *prototype() const { return d()->prototype; }
bool setPrototype(Object *proto);
Property *__getOwnProperty__(String *name, PropertyAttributes *attrs = 0);
using namespace QV4;
-ObjectIterator::ObjectIterator(Value *scratch1, Value *scratch2, Object *o, uint flags)
- : object(scratch1)
+ObjectIterator::ObjectIterator(ExecutionEngine *e, Value *scratch1, Value *scratch2, Object *o, uint flags)
+ : engine(e)
+ , object(scratch1)
, current(scratch2)
, arrayNode(0)
, arrayIndex(0)
}
ObjectIterator::ObjectIterator(Scope &scope, Object *o, uint flags)
- : object(scope.alloc(1))
+ : engine(scope.engine)
+ , object(scope.alloc(1))
, current(scope.alloc(1))
, arrayNode(0)
, arrayIndex(0)
init(o);
}
-ObjectIterator::ObjectIterator(Value *scratch1, Value *scratch2, uint flags)
- : object(scratch1)
- , current(scratch2)
- , arrayNode(0)
- , arrayIndex(0)
- , memberIndex(0)
- , flags(flags)
-{
- object->m = 0;
- current->m = 0;
- // Caller needs to call init!
-}
-
void ObjectIterator::init(Object *o)
{
object->m = o ? &o->data : 0;
*attrs = PropertyAttributes();
return;
}
+ Scope scope(engine);
+ ScopedObject o(scope);
while (1) {
if (!current->asObject())
break;
// check the property is not already defined earlier in the proto chain
if (current->asObject() != object->asObject()) {
- Object *o = object->asObject();
+ o = object->asObject();
bool shadowed = false;
while (o != current->asObject()) {
if ((!!name && o->hasOwnProperty(name)) ||
return;
}
- if (flags & WithProtoChain) {
- Object *proto = current->objectValue()->prototype();
- current->m = proto ? &proto->data : 0;
- } else
+ if (flags & WithProtoChain)
+ current->m = current->objectValue()->prototype();
+ else
current->m = (Heap::Base *)0;
arrayIndex = 0;
WithProtoChain = 0x2,
};
+ ExecutionEngine *engine;
Value *object;
Value *current;
SparseArrayNode *arrayNode;
uint memberIndex;
uint flags;
- ObjectIterator(Value *scratch1, Value *scratch2, Object *o, uint flags);
+ ObjectIterator(ExecutionEngine *e, Value *scratch1, Value *scratch2, Object *o, uint flags);
ObjectIterator(Scope &scope, Object *o, uint flags);
void init(Object *o);
void next(String *&name, uint *index, Property *pd, PropertyAttributes *attributes = 0);
ReturnedValue nextPropertyName(ValueRef value);
ReturnedValue nextPropertyNameAsString(ValueRef value);
ReturnedValue nextPropertyNameAsString();
-private:
- friend struct ForEachIteratorObject;
- ObjectIterator(Value *scratch1, Value *scratch2, uint flags); // Constructor that requires calling init()
};
namespace Heap {
inline
Heap::ForEachIteratorObject::ForEachIteratorObject(QV4::ExecutionEngine *engine, QV4::Object *o)
: Heap::Object(engine)
- , it(workArea, workArea + 1, o, ObjectIterator::EnumerableOnly|ObjectIterator::WithProtoChain)
+ , it(engine, workArea, workArea + 1, o, ObjectIterator::EnumerableOnly|ObjectIterator::WithProtoChain)
{
setVTable(QV4::ForEachIteratorObject::staticVTable());
}
Scoped<Object> p(scope, ctx->d()->callData->args[0]);
bool ok = false;
if (!!p) {
- if (o->prototype() == p.getPointer()) {
+ if (o->prototype() == p->d()) {
ok = true;
} else if (o->isExtensible()) {
ok = o->setPrototype(p.getPointer());
QV4::ReturnedValue Runtime::instanceof(ExecutionEngine *engine, const ValueRef left, const ValueRef right)
{
- // As nothing in this method can call into the memory manager, avoid using a Scope
- // for performance reasons
-
Scope scope(engine);
ScopedFunctionObject f(scope, right->asFunctionObject());
if (!f)
if (f->subtype() == Heap::FunctionObject::BoundFunction)
f = static_cast<BoundFunction *>(f.getPointer())->target();
- Object *v = left->asObject();
+ ScopedObject v(scope, left->asObject());
if (!v)
return Encode(false);
- Object *o = QV4::Value::fromReturnedValue(f->protoProperty()).asObject();
+ ScopedObject o(scope, QV4::Value::fromReturnedValue(f->protoProperty()).asObject());
if (!o)
return engine->throwTypeError();
if (!v)
break;
- else if (o == v)
+ else if (o->d() == v->d())
return Encode(true);
}
return Runtime::typeofValue(engine, prop);
}
-void Runtime::pushWithScope(const ValueRef o, NoThrowEngine *engine)
+void Runtime::pushWithScope(const ValueRef o, ExecutionEngine *engine)
{
Scope scope(engine);
ScopedObject obj(scope, o->toObject(engine));
// exceptions & scopes
static void throwException(ExecutionEngine *engine, const ValueRef value);
static ReturnedValue unwindException(ExecutionEngine *engine);
- static void pushWithScope(const ValueRef o, NoThrowEngine *engine);
+ static void pushWithScope(const ValueRef o, ExecutionEngine *engine);
static void pushCatchScope(NoThrowEngine *engine, int exceptionVarNameIndex);
static void popScope(ExecutionEngine *engine);
s->defineReadonlyProperty(engine->id_length, Primitive::fromUInt32(value.stringValue()->toQString().length()));
}
-Property *StringObject::getIndex(uint index) const
+Property *Heap::StringObject::getIndex(uint index) const
{
- QString str = d()->value.stringValue()->toQString();
+ QString str = value.stringValue()->toQString();
if (index >= (uint)str.length())
return 0;
- d()->tmpProperty.value = Encode(internalClass()->engine->newString(str.mid(index, 1)));
- return &d()->tmpProperty;
+ tmpProperty.value = Encode(internalClass->engine->newString(str.mid(index, 1)));
+ return &tmpProperty;
}
bool StringObject::deleteIndexedProperty(Managed *m, uint index)
StringObject(InternalClass *ic, QV4::Object *prototype);
StringObject(ExecutionEngine *engine, const ValueRef value);
Value value;
+
+ Property *getIndex(uint index) const;
// ### get rid of tmpProperty
mutable Property tmpProperty;
};
V4_OBJECT2(StringObject, Object)
Q_MANAGED_TYPE(StringObject)
- Property *getIndex(uint index) const;
+ Property *getIndex(uint index) const {
+ return d()->getIndex(index);
+ }
static bool deleteIndexedProperty(Managed *m, uint index);
MOTH_END_INSTR(CallBuiltinPushCatchScope)
MOTH_BEGIN_INSTR(CallBuiltinPushScope)
- Runtime::pushWithScope(VALUEPTR(instr.arg), static_cast<QV4::NoThrowEngine*>(engine));
+ Runtime::pushWithScope(VALUEPTR(instr.arg), engine);
context = engine->currentContext();
+ CHECK_EXCEPTION;
MOTH_END_INSTR(CallBuiltinPushScope)
MOTH_BEGIN_INSTR(CallBuiltinPopScope)