Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (99767 => 99768)
--- trunk/Source/_javascript_Core/ChangeLog 2011-11-09 23:14:53 UTC (rev 99767)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-11-09 23:21:56 UTC (rev 99768)
@@ -1,5 +1,28 @@
2011-11-09 Mark Hahnenberg <[email protected]>
+ De-virtualize JSVariableObject::isDynamicScope
+ https://bugs.webkit.org/show_bug.cgi?id=71933
+
+ Reviewed by Geoffrey Garen.
+
+ * runtime/JSActivation.cpp:
+ * runtime/JSActivation.h: Inlined and de-virtualized isDynamicScope
+ (JSC::JSActivation::isDynamicScope):
+ * runtime/JSGlobalObject.cpp:
+ * runtime/JSGlobalObject.h: Inlined and de-virtualized isDynamicScope
+ (JSC::JSGlobalObject::isDynamicScope):
+ * runtime/JSStaticScopeObject.cpp:
+ * runtime/JSStaticScopeObject.h: Inlined and de-virtualized isDynamicScope
+ (JSC::JSStaticScopeObject::createStructure): Changed createStructure to use new JSType
+ (JSC::JSStaticScopeObject::isDynamicScope):
+ * runtime/JSType.h: Added new type for JSStaticScopeObject
+ * runtime/JSVariableObject.cpp: De-virtualized and added an implementation that checks the
+ object's type and calls the corresponding implementation.
+ (JSC::JSVariableObject::isDynamicScope):
+ * runtime/JSVariableObject.h:
+
+2011-11-09 Mark Hahnenberg <[email protected]>
+
De-virtualize JSGlobalObject::hasOwnPropertyForWrite
https://bugs.webkit.org/show_bug.cgi?id=71934
Modified: trunk/Source/_javascript_Core/runtime/JSActivation.cpp (99767 => 99768)
--- trunk/Source/_javascript_Core/runtime/JSActivation.cpp 2011-11-09 23:14:53 UTC (rev 99767)
+++ trunk/Source/_javascript_Core/runtime/JSActivation.cpp 2011-11-09 23:21:56 UTC (rev 99768)
@@ -209,12 +209,6 @@
return exec->globalThisValue();
}
-bool JSActivation::isDynamicScope(bool& requiresDynamicChecks) const
-{
- requiresDynamicChecks = m_requiresDynamicChecks;
- return false;
-}
-
JSValue JSActivation::argumentsGetter(ExecState*, JSValue slotBase, const Identifier&)
{
JSActivation* activation = asActivation(slotBase);
Modified: trunk/Source/_javascript_Core/runtime/JSActivation.h (99767 => 99768)
--- trunk/Source/_javascript_Core/runtime/JSActivation.h 2011-11-09 23:14:53 UTC (rev 99767)
+++ trunk/Source/_javascript_Core/runtime/JSActivation.h 2011-11-09 23:21:56 UTC (rev 99768)
@@ -108,6 +108,12 @@
return asActivation(jsValue());
}
+ inline bool JSActivation::isDynamicScope(bool& requiresDynamicChecks) const
+ {
+ requiresDynamicChecks = m_requiresDynamicChecks;
+ return false;
+ }
+
} // namespace JSC
#endif // JSActivation_h
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (99767 => 99768)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2011-11-09 23:14:53 UTC (rev 99767)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2011-11-09 23:21:56 UTC (rev 99768)
@@ -395,11 +395,6 @@
return CallFrame::create(m_globalCallFrame + RegisterFile::CallFrameHeaderSize);
}
-bool JSGlobalObject::isDynamicScope(bool&) const
-{
- return true;
-}
-
void JSGlobalObject::resizeRegisters(size_t newSize)
{
// Previous duplicate symbols may have created spare capacity in m_registerArray.
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (99767 => 99768)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2011-11-09 23:14:53 UTC (rev 99767)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2011-11-09 23:21:56 UTC (rev 99768)
@@ -273,7 +273,7 @@
virtual bool allowsAccessFrom(const JSGlobalObject*) const { return true; }
- virtual bool isDynamicScope(bool& requiresDynamicChecks) const;
+ bool isDynamicScope(bool& requiresDynamicChecks) const;
void setEvalEnabled(bool enabled) { m_evalEnabled = enabled; }
bool evalEnabled() { return m_evalEnabled; }
@@ -473,6 +473,11 @@
JSGlobalObject* m_savedDynamicGlobalObject;
};
+ inline bool JSGlobalObject::isDynamicScope(bool&) const
+ {
+ return true;
+ }
+
} // namespace JSC
#endif // JSGlobalObject_h
Modified: trunk/Source/_javascript_Core/runtime/JSStaticScopeObject.cpp (99767 => 99768)
--- trunk/Source/_javascript_Core/runtime/JSStaticScopeObject.cpp 2011-11-09 23:14:53 UTC (rev 99767)
+++ trunk/Source/_javascript_Core/runtime/JSStaticScopeObject.cpp 2011-11-09 23:21:56 UTC (rev 99768)
@@ -82,11 +82,6 @@
ASSERT_NOT_REACHED();
}
-bool JSStaticScopeObject::isDynamicScope(bool&) const
-{
- return false;
-}
-
bool JSStaticScopeObject::getOwnPropertySlot(JSCell* cell, ExecState*, const Identifier& propertyName, PropertySlot& slot)
{
return static_cast<JSStaticScopeObject*>(cell)->symbolTableGet(propertyName, slot);
Modified: trunk/Source/_javascript_Core/runtime/JSStaticScopeObject.h (99767 => 99768)
--- trunk/Source/_javascript_Core/runtime/JSStaticScopeObject.h 2011-11-09 23:14:53 UTC (rev 99767)
+++ trunk/Source/_javascript_Core/runtime/JSStaticScopeObject.h 2011-11-09 23:21:56 UTC (rev 99768)
@@ -49,7 +49,7 @@
static void putWithAttributes(JSObject*, ExecState*, const Identifier&, JSValue, unsigned attributes);
- static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(globalData, globalObject, proto, TypeInfo(ObjectType, StructureFlags), &s_info); }
+ static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(globalData, globalObject, proto, TypeInfo(StaticScopeObjectType, StructureFlags), &s_info); }
static const ClassInfo s_info;
@@ -72,6 +72,11 @@
WriteBarrier<Unknown> m_registerStore;
};
+ inline bool JSStaticScopeObject::isDynamicScope(bool&) const
+ {
+ return false;
+ }
+
}
#endif // JSStaticScopeObject_h
Modified: trunk/Source/_javascript_Core/runtime/JSType.h (99767 => 99768)
--- trunk/Source/_javascript_Core/runtime/JSType.h 2011-11-09 23:14:53 UTC (rev 99767)
+++ trunk/Source/_javascript_Core/runtime/JSType.h 2011-11-09 23:21:56 UTC (rev 99768)
@@ -49,6 +49,7 @@
VariableObjectType = 16,
GlobalObjectType = 17,
ActivationObjectType = 18,
+ StaticScopeObjectType = 19,
};
} // namespace JSC
Modified: trunk/Source/_javascript_Core/runtime/JSVariableObject.cpp (99767 => 99768)
--- trunk/Source/_javascript_Core/runtime/JSVariableObject.cpp 2011-11-09 23:14:53 UTC (rev 99767)
+++ trunk/Source/_javascript_Core/runtime/JSVariableObject.cpp 2011-11-09 23:21:56 UTC (rev 99768)
@@ -29,6 +29,9 @@
#include "config.h"
#include "JSVariableObject.h"
+#include "JSActivation.h"
+#include "JSGlobalObject.h"
+#include "JSStaticScopeObject.h"
#include "PropertyNameArray.h"
#include "PropertyDescriptor.h"
@@ -74,4 +77,21 @@
ASSERT_NOT_REACHED();
}
+bool JSVariableObject::isDynamicScope(bool& requiresDynamicChecks) const
+{
+ switch (structure()->typeInfo().type()) {
+ case GlobalObjectType:
+ return static_cast<const JSGlobalObject*>(this)->isDynamicScope(requiresDynamicChecks);
+ case ActivationObjectType:
+ return static_cast<const JSActivation*>(this)->isDynamicScope(requiresDynamicChecks);
+ case StaticScopeObjectType:
+ return static_cast<const JSStaticScopeObject*>(this)->isDynamicScope(requiresDynamicChecks);
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+
+ return false;
+}
+
} // namespace JSC
Modified: trunk/Source/_javascript_Core/runtime/JSVariableObject.h (99767 => 99768)
--- trunk/Source/_javascript_Core/runtime/JSVariableObject.h 2011-11-09 23:14:53 UTC (rev 99767)
+++ trunk/Source/_javascript_Core/runtime/JSVariableObject.h 2011-11-09 23:21:56 UTC (rev 99768)
@@ -55,7 +55,7 @@
static bool deleteProperty(JSCell*, ExecState*, const Identifier&);
static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
- virtual bool isDynamicScope(bool& requiresDynamicChecks) const = 0;
+ bool isDynamicScope(bool& requiresDynamicChecks) const;
WriteBarrier<Unknown>& registerAt(int index) const { return m_registers[index]; }