38 static void markObjects(
Heap::Base *base, MarkStack *stack);
39 void init() { Base::init(); }
41 const VTable *vtable()
const {
42 return internalClass->vtable;
45 const Value *inlinePropertyDataWithOffset(uint indexWithOffset)
const {
46 Q_ASSERT(indexWithOffset >= vtable()->inlinePropertyOffset && indexWithOffset < uint(vtable()->inlinePropertyOffset + vtable()->nInlineProperties));
47 return reinterpret_cast<
const Value *>(
this) + indexWithOffset;
49 const Value *inlinePropertyData(uint index)
const {
50 Q_ASSERT(index < vtable()->nInlineProperties);
51 return reinterpret_cast<
const Value *>(
this) + vtable()->inlinePropertyOffset + index;
53 void setInlinePropertyWithOffset(ExecutionEngine *e, uint indexWithOffset, Value v) {
54 Q_ASSERT(indexWithOffset >= vtable()->inlinePropertyOffset && indexWithOffset < uint(vtable()->inlinePropertyOffset + vtable()->nInlineProperties));
55 Value *prop =
reinterpret_cast<Value *>(
this) + indexWithOffset;
56 WriteBarrier::write(e,
this, prop->data_ptr(), v.asReturnedValue());
58 void setInlinePropertyWithOffset(ExecutionEngine *e, uint indexWithOffset, Heap::Base *b) {
59 Q_ASSERT(indexWithOffset >= vtable()->inlinePropertyOffset && indexWithOffset < uint(vtable()->inlinePropertyOffset + vtable()->nInlineProperties));
60 Value *prop =
reinterpret_cast<Value *>(
this) + indexWithOffset;
61 WriteBarrier::write(e,
this, prop->data_ptr(), Value::fromHeapObject(b).asReturnedValue());
64 PropertyIndex writablePropertyData(uint index) {
65 uint nInline = vtable()->nInlineProperties;
67 return PropertyIndex{
this,
reinterpret_cast<Value *>(
this) + vtable()->inlinePropertyOffset + index};
69 return PropertyIndex{ memberData, memberData->values.values + index };
72 const Value *propertyData(uint index)
const {
73 uint nInline = vtable()->nInlineProperties;
75 return reinterpret_cast<
const Value *>(
this) + vtable()->inlinePropertyOffset + index;
77 return memberData->values.data() + index;
79 void setProperty(ExecutionEngine *e, uint index, Value v) {
80 uint nInline = vtable()->nInlineProperties;
81 if (index < nInline) {
82 setInlinePropertyWithOffset(e, index + vtable()->inlinePropertyOffset, v);
86 memberData->values.set(e, index, v);
88 void setProperty(ExecutionEngine *e, uint index, Heap::Base *b) {
89 uint nInline = vtable()->nInlineProperties;
90 if (index < nInline) {
91 setInlinePropertyWithOffset(e, index + vtable()->inlinePropertyOffset, b);
95 memberData->values.set(e, index, b);
98 void setUsedAsProto();
100 Heap::Object *prototype()
const {
return internalClass->prototype; }
486inline void Object::arraySet(uint index,
const Property *p, PropertyAttributes attributes)
490 if (attributes.isAccessor() || (index > 0x1000 && index > 2*d()->arrayData->values.alloc)) {
493 arrayData()->vtable()->reallocate(
this, index + 1,
false);
495 setArrayAttributes(index, attributes);
496 ArrayData::insert(
this, index, &p->value, attributes.isAccessor());
497 if (isArrayObject() && index >= getLength())
498 setArrayLengthUnchecked(index + 1);