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

    r37684 r37712  
    620620RegisterID* CodeGenerator::addConstant(JSValuePtr v)
    621621{
    622     pair<JSValueMap::iterator, bool> result = m_jsValueMap.add(v, m_nextConstant);
     622    pair<JSValueMap::iterator, bool> result = m_jsValueMap.add(v.payload(), m_nextConstant);
    623623    if (result.second) {
    624624        RegisterID& constant = m_calleeRegisters[m_nextConstant];
     
    806806}
    807807
     808RegisterID* CodeGenerator::emitLoad(RegisterID* dst, JSCell* cell)
     809{
     810    JSValuePtr value = cell;
     811    return emitLoad(dst, value);
     812}
     813
    808814RegisterID* CodeGenerator::emitUnexpectedLoad(RegisterID* dst, bool b)
    809815{
Note: See TracChangeset for help on using the changeset viewer.