Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (95325 => 95326)
--- trunk/Source/_javascript_Core/ChangeLog 2011-09-16 21:12:03 UTC (rev 95325)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-09-16 21:34:20 UTC (rev 95326)
@@ -1,3 +1,35 @@
+2011-09-15 Sam Weinig <s...@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 <gga...@apple.com>
Rolled back in r95201 with test failure fixed.
Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h (95325 => 95326)
--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h 2011-09-16 21:12:03 UTC (rev 95325)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h 2011-09-16 21:34:20 UTC (rev 95326)
@@ -187,7 +187,7 @@
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.
Modified: trunk/Source/_javascript_Core/jit/JITInlineMethods.h (95325 => 95326)
--- trunk/Source/_javascript_Core/jit/JITInlineMethods.h 2011-09-16 21:12:03 UTC (rev 95325)
+++ trunk/Source/_javascript_Core/jit/JITInlineMethods.h 2011-09-16 21:34:20 UTC (rev 95326)
@@ -315,7 +315,7 @@
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)
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (95325 => 95326)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2011-09-16 21:12:03 UTC (rev 95325)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2011-09-16 21:34:20 UTC (rev 95326)
@@ -348,7 +348,7 @@
inline JSValue Structure::prototypeForLookup(ExecState* exec) const
{
- if (typeInfo().type() == ObjectType)
+ if (isObject())
return m_prototype.get();
ASSERT(typeInfo().type() == StringType);
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (95325 => 95326)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2011-09-16 21:12:03 UTC (rev 95325)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2011-09-16 21:34:20 UTC (rev 95326)
@@ -245,7 +245,7 @@
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)
Modified: trunk/Source/_javascript_Core/runtime/JSType.h (95325 => 95326)
--- trunk/Source/_javascript_Core/runtime/JSType.h 2011-09-16 21:12:03 UTC (rev 95325)
+++ trunk/Source/_javascript_Core/runtime/JSType.h 2011-09-16 21:34:20 UTC (rev 95326)
@@ -36,9 +36,11 @@
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
Modified: trunk/Source/_javascript_Core/runtime/JSTypeInfo.h (95325 => 95326)
--- trunk/Source/_javascript_Core/runtime/JSTypeInfo.h 2011-09-16 21:12:03 UTC (rev 95325)
+++ trunk/Source/_javascript_Core/runtime/JSTypeInfo.h 2011-09-16 21:34:20 UTC (rev 95326)
@@ -60,7 +60,8 @@
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; }
@@ -69,8 +70,9 @@
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()
Modified: trunk/Source/_javascript_Core/runtime/NativeErrorConstructor.h (95325 => 95326)
--- trunk/Source/_javascript_Core/runtime/NativeErrorConstructor.h 2011-09-16 21:12:03 UTC (rev 95325)
+++ trunk/Source/_javascript_Core/runtime/NativeErrorConstructor.h 2011-09-16 21:34:20 UTC (rev 95326)
@@ -62,7 +62,7 @@
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:
Modified: trunk/Source/_javascript_Core/runtime/Operations.cpp (95325 => 95326)
--- trunk/Source/_javascript_Core/runtime/Operations.cpp 2011-09-16 21:12:03 UTC (rev 95325)
+++ trunk/Source/_javascript_Core/runtime/Operations.cpp 2011-09-16 21:34:20 UTC (rev 95326)
@@ -88,7 +88,7 @@
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;
Modified: trunk/Source/_javascript_Core/runtime/Structure.cpp (95325 => 95326)
--- trunk/Source/_javascript_Core/runtime/Structure.cpp 2011-09-16 21:12:03 UTC (rev 95325)
+++ trunk/Source/_javascript_Core/runtime/Structure.cpp 2011-09-16 21:34:20 UTC (rev 95326)
@@ -280,7 +280,7 @@
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();
@@ -307,7 +307,7 @@
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)
Modified: trunk/Source/_javascript_Core/runtime/Structure.h (95325 => 95326)
--- trunk/Source/_javascript_Core/runtime/Structure.h 2011-09-16 21:12:03 UTC (rev 95325)
+++ trunk/Source/_javascript_Core/runtime/Structure.h 2011-09-16 21:34:20 UTC (rev 95326)
@@ -119,8 +119,11 @@
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); }
@@ -304,7 +307,7 @@
inline bool JSCell::isObject() const
{
- return m_structure->typeInfo().type() == ObjectType;
+ return m_structure->isObject();
}
inline bool JSCell::isString() const