Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (95228 => 95229)
--- trunk/Source/_javascript_Core/ChangeLog 2011-09-15 21:21:11 UTC (rev 95228)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-09-15 21:24:09 UTC (rev 95229)
@@ -1,3 +1,26 @@
+2011-09-15 Sheriff Bot <webkit.review....@gmail.com>
+
+ Unreviewed, rolling out r95167.
+ http://trac.webkit.org/changeset/95167
+ https://bugs.webkit.org/show_bug.cgi?id=68191
+
+ Patch needs further work. (Requested by mhahnenberg on
+ #webkit).
+
+ * _javascript_Core.exp:
+ * _javascript_Core.vcproj/_javascript_Core/_javascript_Core.def:
+ * runtime/JSCell.cpp:
+ (JSC::JSCell::toBoolean):
+ * runtime/JSCell.h:
+ (JSC::JSCell::JSValue::toBoolean):
+ * runtime/JSNotAnObject.cpp:
+ (JSC::JSNotAnObject::toBoolean):
+ * runtime/JSNotAnObject.h:
+ * runtime/JSObject.h:
+ * runtime/JSString.h:
+ * runtime/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::toBoolean):
+
2011-09-15 Filip Pizlo <fpi...@apple.com>
Unreviewed build fix for platforms that expect a linkable symbol
Modified: trunk/Source/_javascript_Core/_javascript_Core.exp (95228 => 95229)
--- trunk/Source/_javascript_Core/_javascript_Core.exp 2011-09-15 21:21:11 UTC (rev 95228)
+++ trunk/Source/_javascript_Core/_javascript_Core.exp 2011-09-15 21:24:09 UTC (rev 95229)
@@ -563,6 +563,7 @@
__ZNK3JSC6JSCell8toStringEPNS_9ExecStateE
__ZNK3JSC6JSCell9getStringEPNS_9ExecStateE
__ZNK3JSC6JSCell9getStringEPNS_9ExecStateERNS_7UStringE
+__ZNK3JSC6JSCell9toBooleanEPNS_9ExecStateE
__ZNK3JSC7ArgList8getSliceEiRS0_
__ZNK3JSC7JSArray12subclassDataEv
__ZNK3JSC7JSValue16toNumberSlowCaseEPNS_9ExecStateE
@@ -584,7 +585,6 @@
__ZNK3JSC8JSObject9classNameEv
__ZNK3JSC8JSObject9toBooleanEPNS_9ExecStateE
__ZNK3JSC8JSString11resolveRopeEPNS_9ExecStateE
-__ZNK3JSC8JSString9toBooleanEPNS_9ExecStateE
__ZNK3JSC9HashTable11createTableEPNS_12JSGlobalDataE
__ZNK3JSC9HashTable11deleteTableEv
__ZNK3WTF12AtomicString5lowerEv
Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def (95228 => 95229)
--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def 2011-09-15 21:21:11 UTC (rev 95228)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def 2011-09-15 21:24:09 UTC (rev 95229)
@@ -346,6 +346,9 @@
?timedWait@ThreadCondition@WTF@@QAE_NAAVMutex@2@N@Z
?tlsKeyCount@WTF@@YAAAJXZ
?tlsKeys@WTF@@YAPAKXZ
+ ?toBoolean@JSCell@JSC@@UBE_NPAVExecState@2@@Z
+ ?toBoolean@JSObject@JSC@@UBE_NPAVExecState@2@@Z
+ ?toBoolean@JSString@JSC@@EBE_NPAVExecState@2@@Z
?toInt32@JSC@@YAHN@Z
?toInteger@JSValue@JSC@@QBENPAVExecState@2@@Z
?toNumber@JSCell@JSC@@UBENPAVExecState@2@@Z
Modified: trunk/Source/_javascript_Core/runtime/JSCell.cpp (95228 => 95229)
--- trunk/Source/_javascript_Core/runtime/JSCell.cpp 2011-09-15 21:21:11 UTC (rev 95228)
+++ trunk/Source/_javascript_Core/runtime/JSCell.cpp 2011-09-15 21:24:09 UTC (rev 95229)
@@ -129,6 +129,12 @@
return false;
}
+bool JSCell::toBoolean(ExecState*) const
+{
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
double JSCell::toNumber(ExecState*) const
{
ASSERT_NOT_REACHED();
Modified: trunk/Source/_javascript_Core/runtime/JSCell.h (95228 => 95229)
--- trunk/Source/_javascript_Core/runtime/JSCell.h 2011-09-15 21:21:11 UTC (rev 95228)
+++ trunk/Source/_javascript_Core/runtime/JSCell.h 2011-09-15 21:24:09 UTC (rev 95229)
@@ -105,7 +105,7 @@
// Basic conversions.
virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&);
- bool toBoolean(ExecState*) const;
+ virtual bool toBoolean(ExecState*) const;
virtual double toNumber(ExecState*) const;
virtual UString toString(ExecState*) const;
virtual JSObject* toObject(ExecState*, JSGlobalObject*) const;
@@ -316,6 +316,17 @@
return true;
}
+ inline bool JSValue::toBoolean(ExecState* exec) const
+ {
+ if (isInt32())
+ return asInt32() != 0;
+ if (isDouble())
+ return asDouble() > 0.0 || asDouble() < 0.0; // false for NaN
+ if (isCell())
+ return asCell()->toBoolean(exec);
+ return isTrue(); // false, null, and undefined all convert to false.
+ }
+
ALWAYS_INLINE double JSValue::toNumber(ExecState* exec) const
{
if (isInt32())
Modified: trunk/Source/_javascript_Core/runtime/JSNotAnObject.cpp (95228 => 95229)
--- trunk/Source/_javascript_Core/runtime/JSNotAnObject.cpp 2011-09-15 21:21:11 UTC (rev 95228)
+++ trunk/Source/_javascript_Core/runtime/JSNotAnObject.cpp 2011-09-15 21:24:09 UTC (rev 95229)
@@ -49,6 +49,12 @@
return false;
}
+bool JSNotAnObject::toBoolean(ExecState* exec) const
+{
+ ASSERT_UNUSED(exec, exec->hadException());
+ return false;
+}
+
double JSNotAnObject::toNumber(ExecState* exec) const
{
ASSERT_UNUSED(exec, exec->hadException());
Modified: trunk/Source/_javascript_Core/runtime/JSNotAnObject.h (95228 => 95229)
--- trunk/Source/_javascript_Core/runtime/JSNotAnObject.h 2011-09-15 21:21:11 UTC (rev 95228)
+++ trunk/Source/_javascript_Core/runtime/JSNotAnObject.h 2011-09-15 21:24:09 UTC (rev 95229)
@@ -65,6 +65,7 @@
// JSValue methods
virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&);
+ virtual bool toBoolean(ExecState*) const;
virtual double toNumber(ExecState*) const;
virtual UString toString(ExecState*) const;
virtual JSObject* toObject(ExecState*, JSGlobalObject*) const;
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (95228 => 95229)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2011-09-15 21:21:11 UTC (rev 95228)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2011-09-15 21:24:09 UTC (rev 95229)
@@ -134,7 +134,7 @@
virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType = NoPreference) const;
virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value);
- bool toBoolean(ExecState*) const;
+ virtual bool toBoolean(ExecState*) const;
virtual double toNumber(ExecState*) const;
virtual UString toString(ExecState*) const;
virtual JSObject* toObject(ExecState*, JSGlobalObject*) const;
Modified: trunk/Source/_javascript_Core/runtime/JSString.h (95228 => 95229)
--- trunk/Source/_javascript_Core/runtime/JSString.h 2011-09-15 21:21:11 UTC (rev 95228)
+++ trunk/Source/_javascript_Core/runtime/JSString.h 2011-09-15 21:24:09 UTC (rev 95229)
@@ -62,9 +62,7 @@
class JS_EXPORTCLASS JSString : public JSCell {
public:
friend class JIT;
- friend class JSCell;
friend class JSGlobalData;
- friend class JSValue;
friend class SpecializedThunkJIT;
friend struct ThunkHelpers;
@@ -496,7 +494,7 @@
virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value);
- bool toBoolean(ExecState*) const;
+ virtual bool toBoolean(ExecState*) const;
virtual double toNumber(ExecState*) const;
virtual JSObject* toObject(ExecState*, JSGlobalObject*) const;
virtual UString toString(ExecState*) const;
@@ -682,25 +680,7 @@
inline bool isJSString(JSGlobalData* globalData, JSValue v) { return v.isCell() && v.asCell()->vptr() == globalData->jsStringVPtr; }
- inline bool JSCell::toBoolean(ExecState* exec) const
- {
- if (isString())
- return static_cast<const JSString*>(this)->toBoolean(exec);
- return !structure()->typeInfo().masqueradesAsUndefined();
- }
-
// --- JSValue inlines ----------------------------
-
- inline bool JSValue::toBoolean(ExecState* exec) const
- {
- if (isInt32())
- return asInt32();
- if (isDouble())
- return asDouble() > 0.0 || asDouble() < 0.0; // false for NaN
- if (isCell())
- return asCell()->toBoolean(exec);
- return isTrue(); // false, null, and undefined all convert to false.
- }
inline UString JSValue::toString(ExecState* exec) const
{
Modified: trunk/Source/_javascript_Core/runtime/StringObjectThatMasqueradesAsUndefined.h (95228 => 95229)
--- trunk/Source/_javascript_Core/runtime/StringObjectThatMasqueradesAsUndefined.h 2011-09-15 21:21:11 UTC (rev 95228)
+++ trunk/Source/_javascript_Core/runtime/StringObjectThatMasqueradesAsUndefined.h 2011-09-15 21:24:09 UTC (rev 95229)
@@ -53,6 +53,8 @@
}
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | MasqueradesAsUndefined | OverridesGetPropertyNames | StringObject::StructureFlags;
+
+ virtual bool toBoolean(ExecState*) const { return false; }
};
} // namespace JSC