https://bugs.webkit.org/show_bug.cgi?id=68200
Reviewed by Gavin Barraclough.
* dfg/DFGJITCompiler.h:
(JSC::DFG::JITCompiler::branchIfNotObject):
* jit/JITInlineMethods.h:
(JSC::JIT::emitJumpIfNotObject):
* runtime/JSGlobalObject.h:
(JSC::Structure::prototypeForLookup):
* runtime/JSObject.h:
(JSC::JSObject::finishCreation):
* runtime/JSType.h:
* runtime/JSTypeInfo.h:
(JSC::TypeInfo::type):
(JSC::TypeInfo::isObject):
(JSC::TypeInfo::isFinal):
(JSC::TypeInfo::prohibitsPropertyCaching):
* runtime/NativeErrorConstructor.h:
(JSC::NativeErrorConstructor::finishCreation):
* runtime/Operations.cpp:
(JSC::jsIsObjectType):
* runtime/Structure.cpp:
(JSC::Structure::addPropertyTransitionToExistingStructure):
(JSC::Structure::addPropertyTransition):
* runtime/Structure.h:
(JSC::Structure::isObject):
(JSC::JSCell::isObject):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@95326
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-09-15 Sam Weinig <sam@webkit.org>
+
+ Prepare JSTypes for more Object subtypes
+ https://bugs.webkit.org/show_bug.cgi?id=68200
+
+ Reviewed by Gavin Barraclough.
+
+ * dfg/DFGJITCompiler.h:
+ (JSC::DFG::JITCompiler::branchIfNotObject):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitJumpIfNotObject):
+ * runtime/JSGlobalObject.h:
+ (JSC::Structure::prototypeForLookup):
+ * runtime/JSObject.h:
+ (JSC::JSObject::finishCreation):
+ * runtime/JSType.h:
+ * runtime/JSTypeInfo.h:
+ (JSC::TypeInfo::type):
+ (JSC::TypeInfo::isObject):
+ (JSC::TypeInfo::isFinal):
+ (JSC::TypeInfo::prohibitsPropertyCaching):
+ * runtime/NativeErrorConstructor.h:
+ (JSC::NativeErrorConstructor::finishCreation):
+ * runtime/Operations.cpp:
+ (JSC::jsIsObjectType):
+ * runtime/Structure.cpp:
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+ (JSC::Structure::addPropertyTransition):
+ * runtime/Structure.h:
+ (JSC::Structure::isObject):
+ (JSC::JSCell::isObject):
+
2011-09-16 Geoffrey Garen <ggaren@apple.com>
Rolled back in r95201 with test failure fixed.
Jump branchIfNotObject(GPRReg structureReg)
{
- return branch8(NotEqual, Address(structureReg, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType));
+ return branch8(Below, Address(structureReg, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType));
}
// Notify the JIT of a call that does not require linking.
ALWAYS_INLINE JIT::Jump JIT::emitJumpIfNotObject(RegisterID structureReg)
{
- return branch8(NotEqual, Address(structureReg, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType));
+ return branch8(Below, Address(structureReg, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType));
}
#if ENABLE(SAMPLING_FLAGS)
inline JSValue Structure::prototypeForLookup(ExecState* exec) const
{
- if (typeInfo().type() == ObjectType)
+ if (isObject())
return m_prototype.get();
ASSERT(typeInfo().type() == StringType);
ASSERT(m_structure->isEmpty());
ASSERT(prototype().isNull() || Heap::heap(this) == Heap::heap(prototype()));
ASSERT_UNUSED(inlineStorage, static_cast<void*>(inlineStorage) == static_cast<void*>(this + 1));
- ASSERT(m_structure->typeInfo().type() == ObjectType);
+ ASSERT(m_structure->isObject());
}
static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
LeafType = 6,
// The CompoundType value must come before any JSType that may have children
CompoundType = 7,
- ObjectType = 8,
- GetterSetterType = 9,
- APIValueWrapper = 10
+ GetterSetterType = 8,
+ APIValueWrapper = 9,
+ // The ObjectType value must come before any JSType that is a subclass of JSObject
+ ObjectType = 10,
+ FinalObjectType = 11,
};
} // namespace JSC
m_flags |= ImplementsDefaultHasInstance;
}
- JSType type() const { return (JSType)m_type; }
+ JSType type() const { return static_cast<JSType>(m_type); }
+ bool isObject() const { return type() >= ObjectType; }
bool masqueradesAsUndefined() const { return m_flags & MasqueradesAsUndefined; }
bool implementsHasInstance() const { return m_flags & ImplementsHasInstance; }
bool overridesGetOwnPropertySlot() const { return m_flags & OverridesGetOwnPropertySlot; }
bool overridesVisitChildren() const { return m_flags & OverridesVisitChildren; }
bool overridesGetPropertyNames() const { return m_flags & OverridesGetPropertyNames; }
- unsigned isFinal() const { return m_flags2 & (IsJSFinalObject >> 8); }
- unsigned prohibitsPropertyCaching() const { return m_flags2 & (ProhibitsPropertyCaching >> 8); }
+ bool isFinal() const { return m_flags2 & (IsJSFinalObject >> 8); }
+ bool prohibitsPropertyCaching() const { return m_flags2 & (ProhibitsPropertyCaching >> 8); }
+
unsigned flags() const { return m_flags; }
static ptrdiff_t flagsOffset()
putDirect(exec->globalData(), exec->propertyNames().prototype, prototype, DontDelete | ReadOnly | DontEnum);
m_errorStructure.set(exec->globalData(), this, ErrorInstance::createStructure(exec->globalData(), globalObject, prototype));
ASSERT(m_errorStructure);
- ASSERT(m_errorStructure->typeInfo().type() == ObjectType);
+ ASSERT(m_errorStructure->isObject());
}
private:
JSType type = v.asCell()->structure()->typeInfo().type();
if (type == NumberType || type == StringType)
return false;
- if (type == ObjectType) {
+ if (type >= ObjectType) {
if (asObject(v)->structure()->typeInfo().masqueradesAsUndefined())
return false;
CallData callData;
Structure* Structure::addPropertyTransitionToExistingStructure(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset)
{
ASSERT(!structure->isDictionary());
- ASSERT(structure->typeInfo().type() == ObjectType);
+ ASSERT(structure->isObject());
if (Structure* existingTransition = structure->m_transitionTable.get(propertyName.impl(), attributes)) {
JSCell* specificValueInPrevious = existingTransition->m_specificValueInPrevious.get();
specificValue = 0;
ASSERT(!structure->isDictionary());
- ASSERT(structure->typeInfo().type() == ObjectType);
+ ASSERT(structure->isObject());
ASSERT(!Structure::addPropertyTransitionToExistingStructure(structure, propertyName, attributes, specificValue, offset));
if (structure->m_specificFunctionThrashCount == maxSpecificFunctionThrashCount)
bool isDictionary() const { return m_dictionaryKind != NoneDictionaryKind; }
bool isUncacheableDictionary() const { return m_dictionaryKind == UncachedDictionaryKind; }
+ // Type accessors.
const TypeInfo& typeInfo() const { ASSERT(structure()->classInfo() == &s_info); return m_typeInfo; }
+ bool isObject() const { return typeInfo().isObject(); }
+
JSGlobalObject* globalObject() const { return m_globalObject.get(); }
void setGlobalObject(JSGlobalData& globalData, JSGlobalObject* globalObject) { m_globalObject.set(globalData, this, globalObject); }
inline bool JSCell::isObject() const
{
- return m_structure->typeInfo().type() == ObjectType;
+ return m_structure->isObject();
}
inline bool JSCell::isString() const