Changeset 95229 in webkit


Ignore:
Timestamp:
Sep 15, 2011 2:24:09 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

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).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2011-09-15

(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):

Location:
trunk/Source/JavaScriptCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r95225 r95229  
     12011-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
    1242011-09-15  Filip Pizlo  <fpizlo@apple.com>
    225
  • trunk/Source/JavaScriptCore/JavaScriptCore.exp

    r95167 r95229  
    564564__ZNK3JSC6JSCell9getStringEPNS_9ExecStateE
    565565__ZNK3JSC6JSCell9getStringEPNS_9ExecStateERNS_7UStringE
     566__ZNK3JSC6JSCell9toBooleanEPNS_9ExecStateE
    566567__ZNK3JSC7ArgList8getSliceEiRS0_
    567568__ZNK3JSC7JSArray12subclassDataEv
     
    585586__ZNK3JSC8JSObject9toBooleanEPNS_9ExecStateE
    586587__ZNK3JSC8JSString11resolveRopeEPNS_9ExecStateE
    587 __ZNK3JSC8JSString9toBooleanEPNS_9ExecStateE
    588588__ZNK3JSC9HashTable11createTableEPNS_12JSGlobalDataE
    589589__ZNK3JSC9HashTable11deleteTableEv
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def

    r95208 r95229  
    347347    ?tlsKeyCount@WTF@@YAAAJXZ
    348348    ?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
    349352    ?toInt32@JSC@@YAHN@Z
    350353    ?toInteger@JSValue@JSC@@QBENPAVExecState@2@@Z
  • trunk/Source/JavaScriptCore/runtime/JSCell.cpp

    r95167 r95229  
    130130}
    131131
     132bool JSCell::toBoolean(ExecState*) const
     133{
     134    ASSERT_NOT_REACHED();
     135    return false;
     136}
     137
    132138double JSCell::toNumber(ExecState*) const
    133139{
  • trunk/Source/JavaScriptCore/runtime/JSCell.h

    r95167 r95229  
    106106        virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
    107107        virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&);
    108         bool toBoolean(ExecState*) const;
     108        virtual bool toBoolean(ExecState*) const;
    109109        virtual double toNumber(ExecState*) const;
    110110        virtual UString toString(ExecState*) const;
     
    317317    }
    318318
     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
    319330    ALWAYS_INLINE double JSValue::toNumber(ExecState* exec) const
    320331    {
  • trunk/Source/JavaScriptCore/runtime/JSNotAnObject.cpp

    r95167 r95229  
    4545
    4646bool JSNotAnObject::getPrimitiveNumber(ExecState* exec, double&, JSValue&)
     47{
     48    ASSERT_UNUSED(exec, exec->hadException());
     49    return false;
     50}
     51
     52bool JSNotAnObject::toBoolean(ExecState* exec) const
    4753{
    4854    ASSERT_UNUSED(exec, exec->hadException());
  • trunk/Source/JavaScriptCore/runtime/JSNotAnObject.h

    r95167 r95229  
    6666        virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
    6767        virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&);
     68        virtual bool toBoolean(ExecState*) const;
    6869        virtual double toNumber(ExecState*) const;
    6970        virtual UString toString(ExecState*) const;
  • trunk/Source/JavaScriptCore/runtime/JSObject.h

    r95205 r95229  
    135135        virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType = NoPreference) const;
    136136        virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value);
    137         bool toBoolean(ExecState*) const;
     137        virtual bool toBoolean(ExecState*) const;
    138138        virtual double toNumber(ExecState*) const;
    139139        virtual UString toString(ExecState*) const;
  • trunk/Source/JavaScriptCore/runtime/JSString.h

    r95167 r95229  
    6363    public:
    6464        friend class JIT;
    65         friend class JSCell;
    6665        friend class JSGlobalData;
    67         friend class JSValue;
    6866        friend class SpecializedThunkJIT;
    6967        friend struct ThunkHelpers;
     
    497495        virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
    498496        virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value);
    499         bool toBoolean(ExecState*) const;
     497        virtual bool toBoolean(ExecState*) const;
    500498        virtual double toNumber(ExecState*) const;
    501499        virtual JSObject* toObject(ExecState*, JSGlobalObject*) const;
     
    683681    inline bool isJSString(JSGlobalData* globalData, JSValue v) { return v.isCell() && v.asCell()->vptr() == globalData->jsStringVPtr; }
    684682
    685     inline bool JSCell::toBoolean(ExecState* exec) const
    686     {
    687         if (isString())
    688             return static_cast<const JSString*>(this)->toBoolean(exec);
    689         return !structure()->typeInfo().masqueradesAsUndefined();
    690     }
    691 
    692683    // --- JSValue inlines ----------------------------
    693    
    694     inline bool JSValue::toBoolean(ExecState* exec) const
    695     {
    696         if (isInt32())
    697             return asInt32();
    698         if (isDouble())
    699             return asDouble() > 0.0 || asDouble() < 0.0; // false for NaN
    700         if (isCell())
    701             return asCell()->toBoolean(exec);
    702         return isTrue(); // false, null, and undefined all convert to false.
    703     }
    704684
    705685    inline UString JSValue::toString(ExecState* exec) const
  • trunk/Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h

    r95167 r95229  
    5454
    5555        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | MasqueradesAsUndefined | OverridesGetPropertyNames | StringObject::StructureFlags;
     56
     57        virtual bool toBoolean(ExecState*) const { return false; }
    5658    };
    5759 
Note: See TracChangeset for help on using the changeset viewer.