Ignore:
Timestamp:
Sep 15, 2011, 2:24:09 PM (14 years ago)
Author:
[email protected]
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 <[email protected]> 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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.