Changeset 37333 in webkit for trunk/JavaScriptCore/kjs/JSObject.h


Ignore:
Timestamp:
Oct 6, 2008, 10:50:08 AM (17 years ago)
Author:
[email protected]
Message:

2008-10-06 Maciej Stachowiak <[email protected]>

Reviewed by Sam Weinig.



1) Make JSValue::toBoolean nonvirtual and completely inline by
making use of the StructureID type field.


2) Make JSValue::toBoolean not take an ExecState; doesn't need it.


3) Make op_not, op_loop_if_true and op_jtrue not read the
ExecState (toBoolean doesn't need it any more) and not check
exceptions (toBoolean can't throw).

  • API/JSValueRef.cpp: (JSValueToBoolean):
  • JavaScriptCore.exp:
  • VM/CodeBlock.cpp: (JSC::CodeBlock::dump):
  • VM/Machine.cpp: (JSC::Machine::privateExecute): (JSC::Machine::cti_op_loop_if_true): (JSC::Machine::cti_op_not): (JSC::Machine::cti_op_jtrue):
  • kjs/ArrayPrototype.cpp: (JSC::arrayProtoFuncFilter): (JSC::arrayProtoFuncEvery): (JSC::arrayProtoFuncSome):
  • kjs/BooleanConstructor.cpp: (JSC::constructBoolean): (JSC::callBooleanConstructor):
  • kjs/GetterSetter.h:
  • kjs/JSCell.h: (JSC::JSValue::toBoolean):
  • kjs/JSNumberCell.cpp:
  • kjs/JSNumberCell.h: (JSC::JSNumberCell::toBoolean):
  • kjs/JSObject.cpp:
  • kjs/JSObject.h: (JSC::JSObject::toBoolean): (JSC::JSCell::toBoolean):
  • kjs/JSString.cpp:
  • kjs/JSString.h: (JSC::JSString::toBoolean):
  • kjs/JSValue.h:
  • kjs/RegExpConstructor.cpp: (JSC::setRegExpConstructorMultiline):
  • kjs/RegExpObject.cpp: (JSC::RegExpObject::match):
  • kjs/RegExpPrototype.cpp: (JSC::regExpProtoFuncToString):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/JSObject.h

    r37068 r37333  
    2929#include "ExecState.h"
    3030#include "JSNumberCell.h"
     31#include "JSString.h"
    3132#include "PropertyMap.h"
    3233#include "PropertySlot.h"
     
    110111        virtual JSValue* toPrimitive(ExecState*, PreferredPrimitiveType = NoPreference) const;
    111112        virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue*& value);
    112         virtual bool toBoolean(ExecState*) const;
     113        bool toBoolean() const { return true; }
    113114        virtual double toNumber(ExecState*) const;
    114115        virtual UString toString(ExecState*) const;
     
    245246    }
    246247    return false;
     248}
     249
     250inline bool JSCell::toBoolean() const
     251{
     252    JSType type = structureID()->typeInfo().type();
     253    if (type == NumberType)
     254        return static_cast<const JSNumberCell*>(this)->toBoolean();
     255    if (type == ObjectType)
     256        return static_cast<const JSObject*>(this)->toBoolean();
     257    ASSERT(type == StringType);
     258    return static_cast<const JSString*>(this)->toBoolean();
    247259}
    248260
Note: See TracChangeset for help on using the changeset viewer.