- ErrorInstance* object = new (exec) ErrorInstance(m_errorStructure);
- if (!args.at(0).isUndefined())
- object->putDirect(exec->propertyNames().message, jsString(exec, args.at(0).toString(exec)));
- return object;
+ Base::finishCreation(vm, name);
+ ASSERT(inherits(info()));
+
+ NativeErrorPrototype* prototype = NativeErrorPrototype::create(vm, globalObject, prototypeStructure, name, this);
+
+ putDirect(vm, vm.propertyNames->length, jsNumber(1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5
+ putDirect(vm, vm.propertyNames->prototype, prototype, DontDelete | ReadOnly | DontEnum);
+ m_errorStructure.set(vm, this, ErrorInstance::createStructure(vm, globalObject, prototype));
+ ASSERT(m_errorStructure);
+ ASSERT(m_errorStructure->isObject());
+}
+
+void NativeErrorConstructor::visitChildren(JSCell* cell, SlotVisitor& visitor)
+{
+ NativeErrorConstructor* thisObject = jsCast<NativeErrorConstructor*>(cell);
+ ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+ COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
+ ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
+
+ InternalFunction::visitChildren(thisObject, visitor);
+ visitor.append(&thisObject->m_errorStructure);