mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
Bug 898623 - Root StructType FieldInfo properties. r=terrence
--HG-- extra : rebase_source : 8d9c9a3da29f8289b3c1f0bd2e5bc1fc5c6eb1df
This commit is contained in:
parent
780648d5ee
commit
f8bb181a20
@ -15,6 +15,7 @@
|
||||
#include "jsobj.h"
|
||||
#include "jsutil.h"
|
||||
|
||||
#include "gc/Marking.h"
|
||||
#include "vm/TypedArrayObject.h"
|
||||
#include "vm/String.h"
|
||||
#include "vm/StringBuffer.h"
|
||||
@ -181,9 +182,16 @@ GetAlign(JSContext *cx, HandleObject type)
|
||||
|
||||
struct FieldInfo
|
||||
{
|
||||
jsid name;
|
||||
JSObject *type;
|
||||
HeapId name;
|
||||
HeapPtrObject type;
|
||||
size_t offset;
|
||||
|
||||
FieldInfo() : offset(0) {}
|
||||
|
||||
FieldInfo(const FieldInfo &o)
|
||||
: name(o.name.get()), type(o.type), offset(o.offset)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
Class js::DataClass = {
|
||||
@ -262,7 +270,7 @@ IsSameStructType(JSContext *cx, HandleObject type1, HandleObject type2)
|
||||
FieldInfo fieldInfo1 = fieldList1->at(i);
|
||||
FieldInfo fieldInfo2 = fieldList2->at(i);
|
||||
|
||||
if (fieldInfo1.name != fieldInfo2.name)
|
||||
if (fieldInfo1.name.get() != fieldInfo2.name.get())
|
||||
return false;
|
||||
|
||||
if (fieldInfo1.offset != fieldInfo2.offset)
|
||||
@ -1427,11 +1435,11 @@ Class StructType::class_ = {
|
||||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
StructType::finalize,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* hasInstance */
|
||||
BinaryStruct::construct,
|
||||
NULL
|
||||
StructType::trace
|
||||
};
|
||||
|
||||
Class BinaryStruct::class_ = {
|
||||
@ -1450,8 +1458,8 @@ Class BinaryStruct::class_ = {
|
||||
BinaryStruct::finalize,
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* hasInstance */
|
||||
NULL, /* construct */
|
||||
BinaryStruct::obj_trace,
|
||||
JS_NULL_CLASS_EXT,
|
||||
{
|
||||
@ -1690,6 +1698,17 @@ StructType::finalize(FreeOp *op, JSObject *obj)
|
||||
delete list;
|
||||
}
|
||||
|
||||
void
|
||||
StructType::trace(JSTracer *tracer, JSObject *obj)
|
||||
{
|
||||
FieldList *fieldList = static_cast<FieldList *>(obj->getPrivate());
|
||||
JS_ASSERT(fieldList);
|
||||
for (FieldList::iterator it = fieldList->begin(); it != fieldList->end(); ++it) {
|
||||
gc::MarkId(tracer, &(it->name), "structtype.field.name");
|
||||
MarkObject(tracer, &(it->type), "structtype.field.type");
|
||||
}
|
||||
}
|
||||
|
||||
JSBool
|
||||
StructType::toString(JSContext *cx, unsigned int argc, Value *vp)
|
||||
{
|
||||
|
@ -277,6 +277,7 @@ class StructType : public JSObject
|
||||
size_t offset, MutableHandleValue to);
|
||||
|
||||
static void finalize(js::FreeOp *op, JSObject *obj);
|
||||
static void trace(JSTracer *tracer, JSObject *obj);
|
||||
};
|
||||
|
||||
class BinaryStruct : public JSObject
|
||||
|
Loading…
Reference in New Issue
Block a user