Ignore:
Timestamp:
Oct 19, 2008, 10:58:02 PM (17 years ago)
Author:
Darin Adler
Message:

2008-10-19 Darin Adler <Darin Adler>

Reviewed by Cameron Zwarich.

Change JSValuePtr from a typedef into a class. This allows us to support
conversion from JSCell* to JSValuePtr even if JSCell isn't derived from
JSValue.

  • JavaScriptCore.exp: Updated symbols that involve JSValuePtr, since it's now a distinct type.
  • API/APICast.h: (toRef): Extract the JSValuePtr payload explicitly since we can't just cast any more.
  • VM/CTI.cpp: (JSC::CTI::asInteger): Ditto.
  • VM/CodeGenerator.cpp: (JSC::CodeGenerator::addConstant): Get at the payload directly. (JSC::CodeGenerator::emitLoad): Added an overload of JSCell* because otherwise classes derived from JSValue end up calling the bool overload instead of JSValuePtr.
  • VM/CodeGenerator.h: Ditto. Also update traits to use JSValue* and the payload functions.
  • VM/Register.h: Added a JSCell* overload and use of payload functions.
  • kjs/JSCell.h: (JSC::asCell): Use payload function. (JSC::JSValue::asCell): Use JSValue* instead of JSValuePtr. (JSC::JSValuePtr::JSValuePtr): Added. Constructor that takes JSCell* and creates a JSValuePtr.
  • kjs/JSImmediate.h: Added JSValuePtr class. Also updated makeValue and makeInt to work with JSValue* and the payload function.
  • kjs/JSValue.h: Added == and != operators for JSValuePtr. Put them here because eventually all the JSValue functions should go here except what's needed by JSImmediate. Also fix asValue to use JSValue* instead of JSValuePtr.
  • kjs/PropertySlot.h: Change constructor to take JSValuePtr.
  • kjs/protect.h: Update gcProtect functions to work with JSCell* as well as JSValuePtr. Also updated the ProtectedPtr<JSValuePtr> specialization to work more directly. Also changed all the call sites to use gcProtectNullTolerant.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/CodeGenerator.h

    r37684 r37712  
    230230        RegisterID* emitLoad(RegisterID* dst, const Identifier&);
    231231        RegisterID* emitLoad(RegisterID* dst, JSValuePtr);
     232        RegisterID* emitLoad(RegisterID* dst, JSCell*);
    232233        RegisterID* emitUnexpectedLoad(RegisterID* dst, bool);
    233234        RegisterID* emitUnexpectedLoad(RegisterID* dst, double);
     
    330331        PassRefPtr<LabelID> emitComplexJumpScopes(LabelID* target, ControlFlowContext* topScope, ControlFlowContext* bottomScope);
    331332
    332         struct JSValueHashTraits : HashTraits<JSValuePtr> {
    333             static void constructDeletedValue(JSValuePtr& slot) { slot = JSImmediate::impossibleValue(); }
    334             static bool isDeletedValue(JSValuePtr value) { return value == JSImmediate::impossibleValue(); }
     333        struct JSValueHashTraits : HashTraits<JSValue*> {
     334            static void constructDeletedValue(JSValue*& slot) { slot = JSImmediate::impossibleValue().payload(); }
     335            static bool isDeletedValue(JSValue* value) { return value == JSImmediate::impossibleValue().payload(); }
    335336        };
    336337
    337         typedef HashMap<JSValuePtr, unsigned, PtrHash<JSValuePtr>, JSValueHashTraits> JSValueMap;
     338        typedef HashMap<JSValue*, unsigned, PtrHash<JSValue*>, JSValueHashTraits> JSValueMap;
    338339
    339340        struct IdentifierMapIndexHashTraits {
     
    399400        RegisterID* addConstant(JSValuePtr);
    400401        unsigned addUnexpectedConstant(JSValuePtr);
    401         unsigned addRegExp(RegExp* r);
     402        unsigned addRegExp(RegExp*);
    402403        StructureID* addStructureID();
    403404
Note: See TracChangeset for help on using the changeset viewer.