bool RegExpObjectBuilder::getOrCreateClone(RegExpObject *proto) { JS_ASSERT(!reobj_); JSObject *clone = NewObjectWithGivenProto(cx, &RegExpClass, proto, proto->getParent()); if (!clone) return false; clone->initPrivate(NULL); reobj_ = &clone->asRegExp(); return true; }
bool RegExpObjectBuilder::getOrCreate() { if (reobj_) return true; JSObject *obj = NewBuiltinClassInstance(cx, &RegExpClass); if (!obj) return false; obj->initPrivate(NULL); reobj_ = &obj->asRegExp(); return true; }
bool RegExpObjectBuilder::getOrCreate() { if (reobj_) return true; // Note: RegExp objects are always allocated in the tenured heap. This is // not strictly required, but simplifies embedding them in jitcode. JSObject *obj = NewBuiltinClassInstance(cx, &RegExpObject::class_, TenuredObject); if (!obj) return false; obj->initPrivate(nullptr); reobj_ = &obj->as<RegExpObject>(); return true; }
bool RegExpObjectBuilder::getOrCreateClone(RegExpObject *proto) { JS_ASSERT(!reobj_); // Note: RegExp objects are always allocated in the tenured heap. This is // not strictly required, but simplifies embedding them in jitcode. JSObject *clone = NewObjectWithGivenProto(cx, &RegExpObject::class_, proto, proto->getParent(), TenuredObject); if (!clone) return false; clone->initPrivate(nullptr); reobj_ = &clone->as<RegExpObject>(); return true; }
bool RegExpObjectBuilder::getOrCreateClone(HandleTypeObject type) { JS_ASSERT(!reobj_); JS_ASSERT(type->clasp() == &RegExpObject::class_); JSObject *parent = type->proto().toObject()->getParent(); // Note: RegExp objects are always allocated in the tenured heap. This is // not strictly required, but simplifies embedding them in jitcode. JSObject *clone = NewObjectWithType(cx->asJSContext(), type, parent, TenuredObject); if (!clone) return false; clone->initPrivate(nullptr); reobj_ = &clone->as<RegExpObject>(); return true; }