| | 1 | 2008-08-20 Alexey Proskuryakov <ap@webkit.org> |
|---|
| | 2 | |
|---|
| | 3 | Reviewed by Geoff Garen. |
|---|
| | 4 | |
|---|
| | 5 | Bring back shared JSGlobalData and implicit locking, because too many clients rely on it. |
|---|
| | 6 | |
|---|
| | 7 | * kjs/JSGlobalData.cpp: |
|---|
| | 8 | (KJS::JSGlobalData::~JSGlobalData): |
|---|
| | 9 | (KJS::JSGlobalData::JSGlobalData): Re-add shared instance. |
|---|
| | 10 | (KJS::JSGlobalData::sharedInstanceExists): Ditto. |
|---|
| | 11 | (KJS::JSGlobalData::sharedInstance): Ditto. |
|---|
| | 12 | (KJS::JSGlobalData::sharedInstanceInternal): Ditto. |
|---|
| | 13 | |
|---|
| | 14 | * API/JSContextRef.h: Deprecated JSGlobalContextCreate(). Added a very conservative |
|---|
| | 15 | description of its threading model (nothing is allowed). |
|---|
| | 16 | |
|---|
| | 17 | * API/JSContextRef.cpp: |
|---|
| | 18 | (JSGlobalContextCreate): Use shared JSGlobalData. |
|---|
| | 19 | (JSGlobalContextCreateInGroup): Support passing NULL group to request a unique one. |
|---|
| | 20 | (JSGlobalContextRetain): Added back locking. |
|---|
| | 21 | (JSGlobalContextRelease): Ditto. |
|---|
| | 22 | (JSContextGetGlobalObject): Ditto. |
|---|
| | 23 | |
|---|
| | 24 | * API/tests/minidom.c: (main): |
|---|
| | 25 | * API/tests/testapi.c: (main): |
|---|
| | 26 | Switched to JSGlobalContextCreateInGroup() to avoid deprecation warnings. |
|---|
| | 27 | |
|---|
| | 28 | * JavaScriptCore.exp: Re-added JSLock methods. Added JSGlobalContextCreateInGroup (d'oh!). |
|---|
| | 29 | |
|---|
| | 30 | * API/JSBase.cpp: |
|---|
| | 31 | (JSEvaluateScript): |
|---|
| | 32 | (JSCheckScriptSyntax): |
|---|
| | 33 | (JSGarbageCollect): |
|---|
| | 34 | * API/JSCallbackConstructor.cpp: |
|---|
| | 35 | (KJS::constructJSCallback): |
|---|
| | 36 | * API/JSCallbackFunction.cpp: |
|---|
| | 37 | (KJS::JSCallbackFunction::call): |
|---|
| | 38 | * API/JSCallbackObjectFunctions.h: |
|---|
| | 39 | (KJS::::init): |
|---|
| | 40 | (KJS::::getOwnPropertySlot): |
|---|
| | 41 | (KJS::::put): |
|---|
| | 42 | (KJS::::deleteProperty): |
|---|
| | 43 | (KJS::::construct): |
|---|
| | 44 | (KJS::::hasInstance): |
|---|
| | 45 | (KJS::::call): |
|---|
| | 46 | (KJS::::getPropertyNames): |
|---|
| | 47 | (KJS::::toNumber): |
|---|
| | 48 | (KJS::::toString): |
|---|
| | 49 | (KJS::::staticValueGetter): |
|---|
| | 50 | (KJS::::callbackGetter): |
|---|
| | 51 | * API/JSObjectRef.cpp: |
|---|
| | 52 | (JSObjectMake): |
|---|
| | 53 | (JSObjectMakeFunctionWithCallback): |
|---|
| | 54 | (JSObjectMakeConstructor): |
|---|
| | 55 | (JSObjectMakeFunction): |
|---|
| | 56 | (JSObjectHasProperty): |
|---|
| | 57 | (JSObjectGetProperty): |
|---|
| | 58 | (JSObjectSetProperty): |
|---|
| | 59 | (JSObjectGetPropertyAtIndex): |
|---|
| | 60 | (JSObjectSetPropertyAtIndex): |
|---|
| | 61 | (JSObjectDeleteProperty): |
|---|
| | 62 | (JSObjectCallAsFunction): |
|---|
| | 63 | (JSObjectCallAsConstructor): |
|---|
| | 64 | (JSObjectCopyPropertyNames): |
|---|
| | 65 | (JSPropertyNameArrayRelease): |
|---|
| | 66 | (JSPropertyNameAccumulatorAddName): |
|---|
| | 67 | * API/JSValueRef.cpp: |
|---|
| | 68 | (JSValueIsEqual): |
|---|
| | 69 | (JSValueIsInstanceOfConstructor): |
|---|
| | 70 | (JSValueMakeNumber): |
|---|
| | 71 | (JSValueMakeString): |
|---|
| | 72 | (JSValueToNumber): |
|---|
| | 73 | (JSValueToStringCopy): |
|---|
| | 74 | (JSValueToObject): |
|---|
| | 75 | (JSValueProtect): |
|---|
| | 76 | (JSValueUnprotect): |
|---|
| | 77 | * ForwardingHeaders/JavaScriptCore/JSLock.h: Added. |
|---|
| | 78 | * GNUmakefile.am: |
|---|
| | 79 | * JavaScriptCore.pri: |
|---|
| | 80 | * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: |
|---|
| | 81 | * JavaScriptCore.xcodeproj/project.pbxproj: |
|---|
| | 82 | * JavaScriptCoreSources.bkl: |
|---|
| | 83 | * kjs/AllInOneFile.cpp: |
|---|
| | 84 | * kjs/JSGlobalData.h: |
|---|
| | 85 | * kjs/JSGlobalObject.cpp: |
|---|
| | 86 | (KJS::JSGlobalObject::~JSGlobalObject): |
|---|
| | 87 | (KJS::JSGlobalObject::init): |
|---|
| | 88 | * kjs/JSLock.cpp: Added. |
|---|
| | 89 | (KJS::createJSLockCount): |
|---|
| | 90 | (KJS::JSLock::lockCount): |
|---|
| | 91 | (KJS::setLockCount): |
|---|
| | 92 | (KJS::JSLock::JSLock): |
|---|
| | 93 | (KJS::JSLock::lock): |
|---|
| | 94 | (KJS::JSLock::unlock): |
|---|
| | 95 | (KJS::JSLock::currentThreadIsHoldingLock): |
|---|
| | 96 | (KJS::JSLock::DropAllLocks::DropAllLocks): |
|---|
| | 97 | (KJS::JSLock::DropAllLocks::~DropAllLocks): |
|---|
| | 98 | * kjs/JSLock.h: Added. |
|---|
| | 99 | (KJS::JSLock::JSLock): |
|---|
| | 100 | (KJS::JSLock::~JSLock): |
|---|
| | 101 | * kjs/Shell.cpp: |
|---|
| | 102 | (functionGC): |
|---|
| | 103 | (jscmain): |
|---|
| | 104 | * kjs/collector.cpp: |
|---|
| | 105 | (KJS::Heap::~Heap): |
|---|
| | 106 | (KJS::Heap::heapAllocate): |
|---|
| | 107 | (KJS::Heap::setGCProtectNeedsLocking): |
|---|
| | 108 | (KJS::Heap::protect): |
|---|
| | 109 | (KJS::Heap::unprotect): |
|---|
| | 110 | (KJS::Heap::collect): |
|---|
| | 111 | * kjs/identifier.cpp: |
|---|
| | 112 | * kjs/interpreter.cpp: |
|---|
| | 113 | (KJS::Interpreter::checkSyntax): |
|---|
| | 114 | (KJS::Interpreter::evaluate): |
|---|
| | 115 | Re-added implicit locking. |
|---|
| | 116 | |
|---|
| | 117 | 2008-08-19 Kevin McCullough <kmccullough@apple.com> |
|---|
| | 118 | |
|---|
| | 119 | Reviewed by Tim and Mark. |
|---|
| | 120 | |
|---|
| | 121 | Implement DTrace hooks for dashcode and instruments. |
|---|
| | 122 | |
|---|
| | 123 | * API/JSProfilerPrivate.cpp: Added. Expose SPI so that profiling can be |
|---|
| | 124 | turned on from a client. The DTrace probes were added within the |
|---|
| | 125 | profiler mechanism for performance reasons so the profiler must be |
|---|
| | 126 | started to enable tracing. |
|---|
| | 127 | (JSStartProfiling): |
|---|
| | 128 | (JSEndProfiling): |
|---|
| | 129 | * API/JSProfilerPrivate.h: Added. Ditto. |
|---|
| | 130 | * JavaScriptCore.exp: Exposing the start/stop methods to clients. |
|---|
| | 131 | * JavaScriptCore.xcodeproj/project.pbxproj: |
|---|
| | 132 | * kjs/Tracing.d: Define the DTrace probes. |
|---|
| | 133 | * kjs/Tracing.h: Ditto. |
|---|
| | 134 | * profiler/ProfileGenerator.cpp: Implement the DTrace probes in the |
|---|
| | 135 | profiler. |
|---|
| | 136 | (KJS::ProfileGenerator::willExecute): |
|---|
| | 137 | (KJS::ProfileGenerator::didExecute): |
|---|
| | 138 | |
|---|
| | 139 | 2008-08-19 Steve Falkenburg <sfalken@apple.com> |
|---|
| | 140 | |
|---|
| | 141 | Build fix. |
|---|
| | 142 | |
|---|
| | 143 | * kjs/operations.cpp: |
|---|
| | 144 | (KJS::equal): |
|---|
| | 145 | |
|---|
| | 146 | 2008-08-18 Timothy Hatcher <timothy@apple.com> |
|---|
| | 147 | |
|---|
| | 148 | Fix an assertion when generating a heavy profile because the |
|---|
| | 149 | empty value and deleted value of CallIdentifier where equal. |
|---|
| | 150 | |
|---|
| | 151 | https://bugs.webkit.org/show_bug.cgi?id=20439 |
|---|
| | 152 | |
|---|
| | 153 | Reviewed by Dan Bernstein. |
|---|
| | 154 | |
|---|
| | 155 | * profiler/CallIdentifier.h: Make the emptyValue for CallIdentifier |
|---|
| | 156 | use empty strings for URL and function name. |
|---|
| | 157 | |
|---|
| | 158 | 2008-08-12 Darin Adler <darin@apple.com> |
|---|
| | 159 | |
|---|
| | 160 | Reviewed by Geoff. |
|---|
| | 161 | |
|---|
| | 162 | - eliminate JSValue::type() |
|---|
| | 163 | |
|---|
| | 164 | This will make it slightly easier to change the JSImmediate design without |
|---|
| | 165 | having to touch so many call sites. |
|---|
| | 166 | |
|---|
| | 167 | SunSpider says this change is a wash (looked like a slight speedup, but not |
|---|
| | 168 | statistically significant). |
|---|
| | 169 | |
|---|
| | 170 | * API/JSStringRef.cpp: Removed include of JSType.h. |
|---|
| | 171 | * API/JSValueRef.cpp: Removed include of JSType.h. |
|---|
| | 172 | (JSValueGetType): Replaced use of JSValue::type() with |
|---|
| | 173 | JSValue::is functions. |
|---|
| | 174 | |
|---|
| | 175 | * JavaScriptCore.exp: Updated. |
|---|
| | 176 | |
|---|
| | 177 | * VM/JSPropertyNameIterator.cpp: Removed type() implementation. |
|---|
| | 178 | (KJS::JSPropertyNameIterator::toPrimitive): Changed to take |
|---|
| | 179 | PreferredPrimitiveType argument instead of JSType. |
|---|
| | 180 | * VM/JSPropertyNameIterator.h: Ditto. |
|---|
| | 181 | |
|---|
| | 182 | * VM/Machine.cpp: |
|---|
| | 183 | (KJS::fastIsNumber): Updated for name change. |
|---|
| | 184 | (KJS::fastToInt32): Ditto. |
|---|
| | 185 | (KJS::fastToUInt32): Ditto. |
|---|
| | 186 | (KJS::jsAddSlowCase): Updated toPrimitive caller for change from |
|---|
| | 187 | JSType to PreferredPrimitiveType. |
|---|
| | 188 | (KJS::jsAdd): Replaced calls to JSValue::type() with calls to |
|---|
| | 189 | JSValue::isString(). |
|---|
| | 190 | (KJS::jsTypeStringForValue): Replaced calls to JSValue::type() |
|---|
| | 191 | with multiple calls to JSValue::is -- we could make this a |
|---|
| | 192 | virtual function instead if we want to have faster performance. |
|---|
| | 193 | (KJS::Machine::privateExecute): Renamed JSImmediate::toTruncatedUInt32 |
|---|
| | 194 | to JSImmediate::getTruncatedUInt32 for consistency with other functions. |
|---|
| | 195 | Changed two calls of JSValue::type() to JSValue::isString(). |
|---|
| | 196 | |
|---|
| | 197 | * kjs/GetterSetter.cpp: |
|---|
| | 198 | (KJS::GetterSetter::toPrimitive): Changed to take |
|---|
| | 199 | PreferredPrimitiveType argument instead of JSType. |
|---|
| | 200 | (KJS::GetterSetter::isGetterSetter): Added. |
|---|
| | 201 | * kjs/GetterSetter.h: |
|---|
| | 202 | |
|---|
| | 203 | * kjs/JSCell.cpp: |
|---|
| | 204 | (KJS::JSCell::isString): Added. |
|---|
| | 205 | (KJS::JSCell::isGetterSetter): Added. |
|---|
| | 206 | (KJS::JSCell::isObject): Added. |
|---|
| | 207 | |
|---|
| | 208 | * kjs/JSCell.h: Eliminated type function. Added isGetterSetter. |
|---|
| | 209 | Made isString and isObject virtual. Changed toPrimitive to take |
|---|
| | 210 | PreferredPrimitiveType argument instead of JSType. |
|---|
| | 211 | (KJS::JSCell::isNumber): Use Heap::isNumber for faster performance. |
|---|
| | 212 | (KJS::JSValue::isGetterSetter): Added. |
|---|
| | 213 | (KJS::JSValue::toPrimitive): Changed to take |
|---|
| | 214 | PreferredPrimitiveType argument instead of JSType. |
|---|
| | 215 | |
|---|
| | 216 | * kjs/JSImmediate.h: Removed JSValue::type() and replaced |
|---|
| | 217 | JSValue::toTruncatedUInt32 with JSValue::getTruncatedUInt32. |
|---|
| | 218 | (KJS::JSImmediate::isEitherImmediate): Added. |
|---|
| | 219 | |
|---|
| | 220 | * kjs/JSNotAnObject.cpp: |
|---|
| | 221 | (KJS::JSNotAnObject::toPrimitive): Changed to take |
|---|
| | 222 | PreferredPrimitiveType argument instead of JSType. |
|---|
| | 223 | * kjs/JSNotAnObject.h: Ditto. |
|---|
| | 224 | * kjs/JSNumberCell.cpp: |
|---|
| | 225 | (KJS::JSNumberCell::toPrimitive): Ditto. |
|---|
| | 226 | * kjs/JSNumberCell.h: |
|---|
| | 227 | (KJS::JSNumberCell::toInt32): Renamed from fastToInt32. There's no |
|---|
| | 228 | other "slow" version of this once you have a JSNumberCell, so there's |
|---|
| | 229 | no need for "fast" in the name. It's a feature that this hides the |
|---|
| | 230 | base class toInt32, which does the same job less efficiently (and has |
|---|
| | 231 | an additional ExecState argument). |
|---|
| | 232 | (KJS::JSNumberCell::toUInt32): Ditto. |
|---|
| | 233 | |
|---|
| | 234 | * kjs/JSObject.cpp: |
|---|
| | 235 | (KJS::callDefaultValueFunction): Use isGetterSetter instead of type. |
|---|
| | 236 | (KJS::JSObject::getPrimitiveNumber): Use PreferredPrimitiveType. |
|---|
| | 237 | (KJS::JSObject::defaultValue): Ditto. |
|---|
| | 238 | (KJS::JSObject::defineGetter): Use isGetterSetter. |
|---|
| | 239 | (KJS::JSObject::defineSetter): Ditto. |
|---|
| | 240 | (KJS::JSObject::lookupGetter): Ditto. |
|---|
| | 241 | (KJS::JSObject::lookupSetter): Ditto. |
|---|
| | 242 | (KJS::JSObject::toNumber): Use PreferredPrimitiveType. |
|---|
| | 243 | (KJS::JSObject::toString): Ditto. |
|---|
| | 244 | (KJS::JSObject::isObject): Added. |
|---|
| | 245 | |
|---|
| | 246 | * kjs/JSObject.h: |
|---|
| | 247 | (KJS::JSObject::inherits): Call the isObject from JSCell; it's now |
|---|
| | 248 | hidden by our override of isObject. |
|---|
| | 249 | (KJS::JSObject::getOwnPropertySlotForWrite): Use isGetterSetter |
|---|
| | 250 | instead of type. |
|---|
| | 251 | (KJS::JSObject::getOwnPropertySlot): Ditto. |
|---|
| | 252 | (KJS::JSObject::toPrimitive): Use PreferredPrimitiveType. |
|---|
| | 253 | |
|---|
| | 254 | * kjs/JSString.cpp: |
|---|
| | 255 | (KJS::JSString::toPrimitive): Use PreferredPrimitiveType. |
|---|
| | 256 | (KJS::JSString::isString): Added. |
|---|
| | 257 | * kjs/JSString.h: Ditto. |
|---|
| | 258 | |
|---|
| | 259 | * kjs/JSValue.h: Removed type(), added isGetterSetter(). Added |
|---|
| | 260 | PreferredPrimitiveType enum and used it as the argument for the |
|---|
| | 261 | toPrimitive function. |
|---|
| | 262 | (KJS::JSValue::getBoolean): Simplified a bit an removed a branch. |
|---|
| | 263 | |
|---|
| | 264 | * kjs/collector.cpp: |
|---|
| | 265 | (KJS::typeName): Changed to use JSCell::is functions instead of |
|---|
| | 266 | calling JSCell::type. |
|---|
| | 267 | |
|---|
| | 268 | * kjs/collector.h: |
|---|
| | 269 | (KJS::Heap::isNumber): Renamed from fastIsNumber. |
|---|
| | 270 | |
|---|
| | 271 | * kjs/nodes.h: Added now-needed include of JSType, since the type |
|---|
| | 272 | is used here to record types of values in the tree. |
|---|
| | 273 | |
|---|
| | 274 | * kjs/operations.cpp: |
|---|
| | 275 | (KJS::equal): Rewrote to no longer depend on type(). |
|---|
| | 276 | (KJS::strictEqual): Ditto. |
|---|
| | 277 | |
|---|
| | 278 | 2008-08-18 Kevin McCullough <kmccullough@apple.com> |
|---|
| | 279 | |
|---|
| | 280 | Reviewed by Tim. |
|---|
| | 281 | |
|---|
| | 282 | If there are no nodes in a profile all the time should be attributed to |
|---|
| | 283 | (idle) |
|---|
| | 284 | |
|---|
| | 285 | * profiler/Profile.cpp: If ther are no nodes make sure we still process |
|---|
| | 286 | the head. |
|---|
| | 287 | (KJS::Profile::forEach): |
|---|
| | 288 | * profiler/ProfileGenerator.cpp: Remove some useless code. |
|---|
| | 289 | (KJS::ProfileGenerator::stopProfiling): |
|---|
| | 290 | |
|---|
| | 291 | 2008-08-18 Alexey Proskuryakov <ap@webkit.org> |
|---|
| | 292 | |
|---|
| | 293 | Reviewed by Maciej. |
|---|
| | 294 | |
|---|
| | 295 | Make JSGlobalContextRetain/Release actually work. |
|---|
| | 296 | |
|---|
| | 297 | * API/JSContextRef.cpp: |
|---|
| | 298 | (JSGlobalContextRetain): |
|---|
| | 299 | (JSGlobalContextRelease): |
|---|
| | 300 | Ref/deref global data to give checking for globalData.refCount() some sense. |
|---|
| | 301 | |
|---|
| | 302 | * API/tests/testapi.c: (main): Added a test for this bug. |
|---|
| | 303 | |
|---|
| | 304 | * kjs/JSGlobalData.cpp: |
|---|
| | 305 | (KJS::JSGlobalData::~JSGlobalData): |
|---|
| | 306 | While checking for memory leaks, found that JSGlobalData::emptyList has changed to |
|---|
| | 307 | a pointer, but it was not destructed, causing a huge leak in run-webkit-tests --threaded. |
|---|
| | 308 | |
|---|