Changeset 95229 in webkit
- Timestamp:
- Sep 15, 2011 2:24:09 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r95225 r95229 1 2011-09-15 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r95167. 4 http://trac.webkit.org/changeset/95167 5 https://bugs.webkit.org/show_bug.cgi?id=68191 6 7 Patch needs further work. (Requested by mhahnenberg on 8 #webkit). 9 10 * JavaScriptCore.exp: 11 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 12 * runtime/JSCell.cpp: 13 (JSC::JSCell::toBoolean): 14 * runtime/JSCell.h: 15 (JSC::JSCell::JSValue::toBoolean): 16 * runtime/JSNotAnObject.cpp: 17 (JSC::JSNotAnObject::toBoolean): 18 * runtime/JSNotAnObject.h: 19 * runtime/JSObject.h: 20 * runtime/JSString.h: 21 * runtime/StringObjectThatMasqueradesAsUndefined.h: 22 (JSC::StringObjectThatMasqueradesAsUndefined::toBoolean): 23 1 24 2011-09-15 Filip Pizlo <fpizlo@apple.com> 2 25 -
trunk/Source/JavaScriptCore/JavaScriptCore.exp
r95167 r95229 564 564 __ZNK3JSC6JSCell9getStringEPNS_9ExecStateE 565 565 __ZNK3JSC6JSCell9getStringEPNS_9ExecStateERNS_7UStringE 566 __ZNK3JSC6JSCell9toBooleanEPNS_9ExecStateE 566 567 __ZNK3JSC7ArgList8getSliceEiRS0_ 567 568 __ZNK3JSC7JSArray12subclassDataEv … … 585 586 __ZNK3JSC8JSObject9toBooleanEPNS_9ExecStateE 586 587 __ZNK3JSC8JSString11resolveRopeEPNS_9ExecStateE 587 __ZNK3JSC8JSString9toBooleanEPNS_9ExecStateE588 588 __ZNK3JSC9HashTable11createTableEPNS_12JSGlobalDataE 589 589 __ZNK3JSC9HashTable11deleteTableEv -
trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
r95208 r95229 347 347 ?tlsKeyCount@WTF@@YAAAJXZ 348 348 ?tlsKeys@WTF@@YAPAKXZ 349 ?toBoolean@JSCell@JSC@@UBE_NPAVExecState@2@@Z 350 ?toBoolean@JSObject@JSC@@UBE_NPAVExecState@2@@Z 351 ?toBoolean@JSString@JSC@@EBE_NPAVExecState@2@@Z 349 352 ?toInt32@JSC@@YAHN@Z 350 353 ?toInteger@JSValue@JSC@@QBENPAVExecState@2@@Z -
trunk/Source/JavaScriptCore/runtime/JSCell.cpp
r95167 r95229 130 130 } 131 131 132 bool JSCell::toBoolean(ExecState*) const 133 { 134 ASSERT_NOT_REACHED(); 135 return false; 136 } 137 132 138 double JSCell::toNumber(ExecState*) const 133 139 { -
trunk/Source/JavaScriptCore/runtime/JSCell.h
r95167 r95229 106 106 virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const; 107 107 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&); 108 bool toBoolean(ExecState*) const;108 virtual bool toBoolean(ExecState*) const; 109 109 virtual double toNumber(ExecState*) const; 110 110 virtual UString toString(ExecState*) const; … … 317 317 } 318 318 319 inline bool JSValue::toBoolean(ExecState* exec) const 320 { 321 if (isInt32()) 322 return asInt32() != 0; 323 if (isDouble()) 324 return asDouble() > 0.0 || asDouble() < 0.0; // false for NaN 325 if (isCell()) 326 return asCell()->toBoolean(exec); 327 return isTrue(); // false, null, and undefined all convert to false. 328 } 329 319 330 ALWAYS_INLINE double JSValue::toNumber(ExecState* exec) const 320 331 { -
trunk/Source/JavaScriptCore/runtime/JSNotAnObject.cpp
r95167 r95229 45 45 46 46 bool JSNotAnObject::getPrimitiveNumber(ExecState* exec, double&, JSValue&) 47 { 48 ASSERT_UNUSED(exec, exec->hadException()); 49 return false; 50 } 51 52 bool JSNotAnObject::toBoolean(ExecState* exec) const 47 53 { 48 54 ASSERT_UNUSED(exec, exec->hadException()); -
trunk/Source/JavaScriptCore/runtime/JSNotAnObject.h
r95167 r95229 66 66 virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const; 67 67 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&); 68 virtual bool toBoolean(ExecState*) const; 68 69 virtual double toNumber(ExecState*) const; 69 70 virtual UString toString(ExecState*) const; -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r95205 r95229 135 135 virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType = NoPreference) const; 136 136 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value); 137 bool toBoolean(ExecState*) const;137 virtual bool toBoolean(ExecState*) const; 138 138 virtual double toNumber(ExecState*) const; 139 139 virtual UString toString(ExecState*) const; -
trunk/Source/JavaScriptCore/runtime/JSString.h
r95167 r95229 63 63 public: 64 64 friend class JIT; 65 friend class JSCell;66 65 friend class JSGlobalData; 67 friend class JSValue;68 66 friend class SpecializedThunkJIT; 69 67 friend struct ThunkHelpers; … … 497 495 virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const; 498 496 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value); 499 bool toBoolean(ExecState*) const;497 virtual bool toBoolean(ExecState*) const; 500 498 virtual double toNumber(ExecState*) const; 501 499 virtual JSObject* toObject(ExecState*, JSGlobalObject*) const; … … 683 681 inline bool isJSString(JSGlobalData* globalData, JSValue v) { return v.isCell() && v.asCell()->vptr() == globalData->jsStringVPtr; } 684 682 685 inline bool JSCell::toBoolean(ExecState* exec) const686 {687 if (isString())688 return static_cast<const JSString*>(this)->toBoolean(exec);689 return !structure()->typeInfo().masqueradesAsUndefined();690 }691 692 683 // --- JSValue inlines ---------------------------- 693 694 inline bool JSValue::toBoolean(ExecState* exec) const695 {696 if (isInt32())697 return asInt32();698 if (isDouble())699 return asDouble() > 0.0 || asDouble() < 0.0; // false for NaN700 if (isCell())701 return asCell()->toBoolean(exec);702 return isTrue(); // false, null, and undefined all convert to false.703 }704 684 705 685 inline UString JSValue::toString(ExecState* exec) const -
trunk/Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h
r95167 r95229 54 54 55 55 static const unsigned StructureFlags = OverridesGetOwnPropertySlot | MasqueradesAsUndefined | OverridesGetPropertyNames | StringObject::StructureFlags; 56 57 virtual bool toBoolean(ExecState*) const { return false; } 56 58 }; 57 59
Note: See TracChangeset
for help on using the changeset viewer.