Changeset 37684 in webkit for trunk/JavaScriptCore/API
- Timestamp:
- Oct 18, 2008, 6:52:42 PM (17 years ago)
- Location:
- trunk/JavaScriptCore/API
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/APICast.h
r37681 r37684 49 49 } 50 50 51 inline JSC::JSValue *toJS(JSValueRef v)51 inline JSC::JSValuePtr toJS(JSValueRef v) 52 52 { 53 return reinterpret_cast<JSC::JSValue *>(const_cast<OpaqueJSValue*>(v));53 return reinterpret_cast<JSC::JSValuePtr>(const_cast<OpaqueJSValue*>(v)); 54 54 } 55 55 … … 69 69 } 70 70 71 inline JSValueRef toRef(JSC::JSValue *v)71 inline JSValueRef toRef(JSC::JSValuePtr v) 72 72 { 73 73 return reinterpret_cast<JSValueRef>(v); 74 74 } 75 75 76 inline JSValueRef* toRef(JSC::JSValue ** v)76 inline JSValueRef* toRef(JSC::JSValuePtr* v) 77 77 { 78 78 return reinterpret_cast<JSValueRef*>(const_cast<const JSC::JSValue**>(v)); -
trunk/JavaScriptCore/API/JSCallbackConstructor.h
r36766 r37684 40 40 static const ClassInfo info; 41 41 42 static PassRefPtr<StructureID> createStructureID(JSValue *proto)42 static PassRefPtr<StructureID> createStructureID(JSValuePtr proto) 43 43 { 44 44 return StructureID::create(proto, TypeInfo(ObjectType, ImplementsHasInstance)); -
trunk/JavaScriptCore/API/JSCallbackFunction.cpp
r37257 r37684 47 47 } 48 48 49 JSValue * JSCallbackFunction::call(ExecState* exec, JSObject* functionObject, JSValue*thisValue, const ArgList& args)49 JSValuePtr JSCallbackFunction::call(ExecState* exec, JSObject* functionObject, JSValuePtr thisValue, const ArgList& args) 50 50 { 51 51 JSContextRef execRef = toRef(exec); -
trunk/JavaScriptCore/API/JSCallbackFunction.h
r36766 r37684 40 40 // InternalFunction mish-mashes constructor and function behavior -- we should 41 41 // refactor the code so this override isn't necessary 42 static PassRefPtr<StructureID> createStructureID(JSValue *proto)42 static PassRefPtr<StructureID> createStructureID(JSValuePtr proto) 43 43 { 44 44 return StructureID::create(proto, TypeInfo(ObjectType)); … … 49 49 virtual const ClassInfo* classInfo() const { return &info; } 50 50 51 static JSValue * call(ExecState*, JSObject*, JSValue*, const ArgList&);51 static JSValuePtr call(ExecState*, JSObject*, JSValuePtr, const ArgList&); 52 52 53 53 JSObjectCallAsFunctionCallback m_callback; -
trunk/JavaScriptCore/API/JSCallbackObject.h
r37681 r37684 49 49 bool inherits(JSClassRef) const; 50 50 51 static PassRefPtr<StructureID> createStructureID(JSValue *proto)51 static PassRefPtr<StructureID> createStructureID(JSValuePtr proto) 52 52 { 53 53 return StructureID::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | OverridesHasInstance)); … … 60 60 virtual bool getOwnPropertySlot(ExecState*, unsigned, PropertySlot&); 61 61 62 virtual void put(ExecState*, const Identifier&, JSValue *, PutPropertySlot&);62 virtual void put(ExecState*, const Identifier&, JSValuePtr, PutPropertySlot&); 63 63 64 64 virtual bool deleteProperty(ExecState*, const Identifier&); 65 65 virtual bool deleteProperty(ExecState*, unsigned); 66 66 67 virtual bool hasInstance(ExecState* exec, JSValue * value, JSValue*proto);67 virtual bool hasInstance(ExecState* exec, JSValuePtr value, JSValuePtr proto); 68 68 69 69 virtual void getPropertyNames(ExecState*, PropertyNameArray&); … … 78 78 void init(ExecState*); 79 79 80 static JSCallbackObject* asCallbackObject(JSValue *);80 static JSCallbackObject* asCallbackObject(JSValuePtr); 81 81 82 static JSValue * call(ExecState*, JSObject* functionObject, JSValue*thisValue, const ArgList&);82 static JSValuePtr call(ExecState*, JSObject* functionObject, JSValuePtr thisValue, const ArgList&); 83 83 static JSObject* construct(ExecState*, JSObject* constructor, const ArgList&); 84 84 85 static JSValue *cachedValueGetter(ExecState*, const Identifier&, const PropertySlot&);86 static JSValue *staticValueGetter(ExecState*, const Identifier&, const PropertySlot&);87 static JSValue *staticFunctionGetter(ExecState*, const Identifier&, const PropertySlot&);88 static JSValue *callbackGetter(ExecState*, const Identifier&, const PropertySlot&);85 static JSValuePtr cachedValueGetter(ExecState*, const Identifier&, const PropertySlot&); 86 static JSValuePtr staticValueGetter(ExecState*, const Identifier&, const PropertySlot&); 87 static JSValuePtr staticFunctionGetter(ExecState*, const Identifier&, const PropertySlot&); 88 static JSValuePtr callbackGetter(ExecState*, const Identifier&, const PropertySlot&); 89 89 90 90 struct JSCallbackObjectData { -
trunk/JavaScriptCore/API/JSCallbackObjectFunctions.h
r37681 r37684 41 41 42 42 template <class Base> 43 inline JSCallbackObject<Base>* JSCallbackObject<Base>::asCallbackObject(JSValue *value)43 inline JSCallbackObject<Base>* JSCallbackObject<Base>::asCallbackObject(JSValuePtr value) 44 44 { 45 45 ASSERT(asObject(value)->inherits(&info)); … … 161 161 162 162 template <class Base> 163 void JSCallbackObject<Base>::put(ExecState* exec, const Identifier& propertyName, JSValue *value, PutPropertySlot& slot)163 void JSCallbackObject<Base>::put(ExecState* exec, const Identifier& propertyName, JSValuePtr value, PutPropertySlot& slot) 164 164 { 165 165 JSContextRef ctx = toRef(exec); … … 281 281 282 282 template <class Base> 283 bool JSCallbackObject<Base>::hasInstance(ExecState* exec, JSValue * value, JSValue*)283 bool JSCallbackObject<Base>::hasInstance(ExecState* exec, JSValuePtr value, JSValuePtr) 284 284 { 285 285 JSContextRef execRef = toRef(exec); … … 308 308 309 309 template <class Base> 310 JSValue * JSCallbackObject<Base>::call(ExecState* exec, JSObject* functionObject, JSValue*thisValue, const ArgList& args)310 JSValuePtr JSCallbackObject<Base>::call(ExecState* exec, JSObject* functionObject, JSValuePtr thisValue, const ArgList& args) 311 311 { 312 312 JSContextRef execRef = toRef(exec); … … 431 431 432 432 template <class Base> 433 JSValue *JSCallbackObject<Base>::cachedValueGetter(ExecState*, const Identifier&, const PropertySlot& slot)434 { 435 JSValue *v = slot.slotBase();433 JSValuePtr JSCallbackObject<Base>::cachedValueGetter(ExecState*, const Identifier&, const PropertySlot& slot) 434 { 435 JSValuePtr v = slot.slotBase(); 436 436 ASSERT(v); 437 437 return v; … … 439 439 440 440 template <class Base> 441 JSValue *JSCallbackObject<Base>::staticValueGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)441 JSValuePtr JSCallbackObject<Base>::staticValueGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) 442 442 { 443 443 JSCallbackObject* thisObj = asCallbackObject(slot.slotBase()); … … 461 461 462 462 template <class Base> 463 JSValue *JSCallbackObject<Base>::staticFunctionGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)463 JSValuePtr JSCallbackObject<Base>::staticFunctionGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) 464 464 { 465 465 JSCallbackObject* thisObj = asCallbackObject(slot.slotBase()); … … 486 486 487 487 template <class Base> 488 JSValue *JSCallbackObject<Base>::callbackGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)488 JSValuePtr JSCallbackObject<Base>::callbackGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) 489 489 { 490 490 JSCallbackObject* thisObj = asCallbackObject(slot.slotBase()); -
trunk/JavaScriptCore/API/JSContextRef.cpp
r37215 r37684 74 74 JSGlobalObject* globalObject = new (globalData.get()) JSCallbackObject<JSGlobalObject>(globalData.get(), globalObjectClass); 75 75 ExecState* exec = globalObject->globalExec(); 76 JSValue *prototype = globalObjectClass->prototype(exec);76 JSValuePtr prototype = globalObjectClass->prototype(exec); 77 77 if (!prototype) 78 78 prototype = jsNull(); -
trunk/JavaScriptCore/API/JSObjectRef.cpp
r37433 r37684 104 104 JSLock lock(exec); 105 105 106 JSValue *jsPrototype = jsClass106 JSValuePtr jsPrototype = jsClass 107 107 ? jsClass->prototype(exec) 108 108 : exec->lexicalGlobalObject()->objectPrototype(); … … 234 234 { 235 235 JSObject* jsObject = toJS(object); 236 JSValue *jsValue = toJS(value);236 JSValuePtr jsValue = toJS(value); 237 237 238 238 jsObject->setPrototype(jsValue->isObject() ? jsValue : jsNull()); … … 258 258 JSObject* jsObject = toJS(object); 259 259 260 JSValue *jsValue = jsObject->get(exec, propertyName->identifier(&exec->globalData()));260 JSValuePtr jsValue = jsObject->get(exec, propertyName->identifier(&exec->globalData())); 261 261 if (exec->hadException()) { 262 262 if (exception) … … 275 275 JSObject* jsObject = toJS(object); 276 276 Identifier name(propertyName->identifier(&exec->globalData())); 277 JSValue *jsValue = toJS(value);277 JSValuePtr jsValue = toJS(value); 278 278 279 279 if (attributes && !jsObject->hasProperty(exec, name)) … … 299 299 JSObject* jsObject = toJS(object); 300 300 301 JSValue *jsValue = jsObject->get(exec, propertyIndex);301 JSValuePtr jsValue = jsObject->get(exec, propertyIndex); 302 302 if (exec->hadException()) { 303 303 if (exception) … … 316 316 317 317 JSObject* jsObject = toJS(object); 318 JSValue *jsValue = toJS(value);318 JSValuePtr jsValue = toJS(value); 319 319 320 320 jsObject->put(exec, propertyIndex, jsValue); -
trunk/JavaScriptCore/API/JSValueRef.cpp
r37337 r37684 44 44 JSType JSValueGetType(JSContextRef, JSValueRef value) 45 45 { 46 JSC::JSValue *jsValue = toJS(value);46 JSC::JSValuePtr jsValue = toJS(value); 47 47 if (jsValue->isUndefined()) 48 48 return kJSTypeUndefined; … … 63 63 bool JSValueIsUndefined(JSContextRef, JSValueRef value) 64 64 { 65 JSValue *jsValue = toJS(value);65 JSValuePtr jsValue = toJS(value); 66 66 return jsValue->isUndefined(); 67 67 } … … 69 69 bool JSValueIsNull(JSContextRef, JSValueRef value) 70 70 { 71 JSValue *jsValue = toJS(value);71 JSValuePtr jsValue = toJS(value); 72 72 return jsValue->isNull(); 73 73 } … … 75 75 bool JSValueIsBoolean(JSContextRef, JSValueRef value) 76 76 { 77 JSValue *jsValue = toJS(value);77 JSValuePtr jsValue = toJS(value); 78 78 return jsValue->isBoolean(); 79 79 } … … 81 81 bool JSValueIsNumber(JSContextRef, JSValueRef value) 82 82 { 83 JSValue *jsValue = toJS(value);83 JSValuePtr jsValue = toJS(value); 84 84 return jsValue->isNumber(); 85 85 } … … 87 87 bool JSValueIsString(JSContextRef, JSValueRef value) 88 88 { 89 JSValue *jsValue = toJS(value);89 JSValuePtr jsValue = toJS(value); 90 90 return jsValue->isString(); 91 91 } … … 93 93 bool JSValueIsObject(JSContextRef, JSValueRef value) 94 94 { 95 JSValue *jsValue = toJS(value);95 JSValuePtr jsValue = toJS(value); 96 96 return jsValue->isObject(); 97 97 } … … 99 99 bool JSValueIsObjectOfClass(JSContextRef, JSValueRef value, JSClassRef jsClass) 100 100 { 101 JSValue *jsValue = toJS(value);101 JSValuePtr jsValue = toJS(value); 102 102 103 103 if (JSObject* o = jsValue->getObject()) { … … 116 116 JSLock lock(exec); 117 117 118 JSValue *jsA = toJS(a);119 JSValue *jsB = toJS(b);118 JSValuePtr jsA = toJS(a); 119 JSValuePtr jsB = toJS(b); 120 120 121 121 bool result = equal(exec, jsA, jsB); // false if an exception is thrown … … 130 130 bool JSValueIsStrictEqual(JSContextRef, JSValueRef a, JSValueRef b) 131 131 { 132 JSValue *jsA = toJS(a);133 JSValue *jsB = toJS(b);132 JSValuePtr jsA = toJS(a); 133 JSValuePtr jsB = toJS(b); 134 134 135 135 bool result = strictEqual(jsA, jsB); … … 143 143 JSLock lock(exec); 144 144 145 JSValue *jsValue = toJS(value);145 JSValuePtr jsValue = toJS(value); 146 146 JSObject* jsConstructor = toJS(constructor); 147 147 if (!jsConstructor->structureID()->typeInfo().implementsHasInstance()) … … 192 192 { 193 193 ExecState* exec = toJS(ctx); 194 JSValue *jsValue = toJS(value);194 JSValuePtr jsValue = toJS(value); 195 195 return jsValue->toBoolean(exec); 196 196 } … … 202 202 JSLock lock(exec); 203 203 204 JSValue *jsValue = toJS(value);204 JSValuePtr jsValue = toJS(value); 205 205 206 206 double number = jsValue->toNumber(exec); … … 220 220 JSLock lock(exec); 221 221 222 JSValue *jsValue = toJS(value);222 JSValuePtr jsValue = toJS(value); 223 223 224 224 RefPtr<OpaqueJSString> stringRef(OpaqueJSString::create(jsValue->toString(exec))); … … 238 238 JSLock lock(exec); 239 239 240 JSValue *jsValue = toJS(value);240 JSValuePtr jsValue = toJS(value); 241 241 242 242 JSObjectRef objectRef = toRef(jsValue->toObject(exec)); … … 256 256 JSLock lock(exec); 257 257 258 JSValue *jsValue = toJS(value);258 JSValuePtr jsValue = toJS(value); 259 259 gcProtect(jsValue); 260 260 } … … 266 266 JSLock lock(exec); 267 267 268 JSValue *jsValue = toJS(value);268 JSValuePtr jsValue = toJS(value); 269 269 gcUnprotect(jsValue); 270 270 }
Note:
See TracChangeset
for help on using the changeset viewer.