1 2008-05-13 Kevin McCullough <kmccullough@apple.com>
5 <rdar://problem/5770054> JavaScript profiler (10928)
6 Use PassRefPtrs instead of RefPtrs when appropriate.
8 * profiler/FunctionCallProfile.cpp:
9 (KJS::FunctionCallProfile::addChild):
10 * profiler/FunctionCallProfile.h:
12 (KJS::Profile::callTree):
14 2008-05-13 Kevin McCullough <kmccullough@apple.com>
18 <rdar://problem/5770054> JavaScript profiler (10928)
19 - Made some functions static (as per Adam) and changed from using raw
20 pointers to RefPtr for making these JavaScript Objects.
22 * profiler/FunctionCallProfile.cpp:
23 (KJS::FunctionCallProfile::addChild):
24 (KJS::FunctionCallProfile::findChild):
25 * profiler/FunctionCallProfile.h:
26 (KJS::FunctionCallProfile::create):
27 * profiler/Profile.cpp:
28 (KJS::Profile::Profile):
29 (KJS::Profile::willExecute):
30 (KJS::Profile::didExecute):
31 (KJS::functionNameCountPairComparator):
33 (KJS::Profile::create):
34 (KJS::Profile::title):
35 (KJS::Profile::callTree):
36 * profiler/Profiler.cpp:
37 (KJS::Profiler::startProfiling):
38 * profiler/Profiler.h:
39 (KJS::Profiler::allProfiles):
40 (KJS::Profiler::clearProfiles):
42 2008-05-13 Alexey Proskuryakov <ap@webkit.org>
44 Reviewed by Geoffrey Garen.
46 <rdar://problem/4949018> JavaScriptCore API claims to work with UTF8 strings, but only works
51 (KJS::UString::Rep::createFromUTF8):
52 Added. Implementation adapted from JSStringCreateWithUTF8CString().
54 * API/JSStringRef.cpp:
55 (JSStringCreateWithUTF8CString):
57 (OpaqueJSClass::OpaqueJSClass):
58 Use UString::Rep::createFromUTF8().
60 2008-05-12 Mark Rowe <mrowe@apple.com>
62 Reviewed by Tim Hatcher.
64 <rdar://problem/4859666> WebKit needs availability macros in order to deprecate APIs
66 Create WebKit availability macros that key off the Mac OS X version being targeted to
67 determine the WebKit version being targeted. Applications can define
68 WEBKIT_VERSION_MIN_REQUIRED before including WebKit headers in order to target a specific
71 The availability header is being added to JavaScriptCore rather than WebKit as JavaScriptCore
72 is the lowest-level portion of the public WebKit API.
74 * API/WebKitAvailability.h: Added.
75 * JavaScriptCore.xcodeproj/project.pbxproj:
77 2008-05-12 Alexey Proskuryakov <ap@webkit.org>
81 https://bugs.webkit.org/show_bug.cgi?id=18828
82 Reproducible crash with PAC file
84 Naively moving JavaScriptCore into thread-specific data was inappropriate in the face of
85 exiting JavaScriptCore API clients, which expect a different therading model. Temporarily
86 disabling ThreadSpecific implementation until this can be sorted out.
88 * wtf/ThreadSpecific.h:
89 (WTF::::ThreadSpecific):
90 (WTF::::~ThreadSpecific):
94 2008-05-12 Alexey Proskuryakov <ap@webkit.org>
96 Roll out recent threading changes (r32807, r32810, r32819, r32822) to simplify
101 * API/JSCallbackObjectFunctions.h:
102 (KJS::::staticFunctionGetter):
103 * API/JSClassRef.cpp:
104 (OpaqueJSClass::prototype):
105 * API/JSObjectRef.cpp:
107 (JSObjectMakeFunctionWithCallback):
108 (JSObjectMakeConstructor):
109 (JSObjectMakeFunction):
110 * API/JSValueRef.cpp:
113 * JavaScriptCore.exp:
115 * kjs/InitializeThreading.cpp:
116 (KJS::initializeThreadingOnce):
117 * kjs/JSGlobalObject.cpp:
118 (KJS::JSGlobalObject::~JSGlobalObject):
119 (KJS::JSGlobalObject::init):
120 (KJS::JSGlobalObject::put):
121 (KJS::JSGlobalObject::reset):
122 (KJS::JSGlobalObject::tearOffActivation):
123 * kjs/JSGlobalObject.h:
124 (KJS::JSGlobalObject::head):
125 (KJS::JSGlobalObject::perThreadData):
127 (KJS::JSLock::registerThread):
129 (KJS::JSLock::JSLock):
130 * kjs/array_instance.cpp:
131 (KJS::ArrayInstance::ArrayInstance):
132 (KJS::ArrayInstance::lengthGetter):
133 * kjs/array_object.cpp:
134 (KJS::arrayProtoFuncToString):
135 (KJS::arrayProtoFuncToLocaleString):
136 (KJS::arrayProtoFuncJoin):
137 (KJS::arrayProtoFuncConcat):
138 (KJS::arrayProtoFuncPop):
139 (KJS::arrayProtoFuncPush):
140 (KJS::arrayProtoFuncShift):
141 (KJS::arrayProtoFuncSlice):
142 (KJS::arrayProtoFuncSplice):
143 (KJS::arrayProtoFuncUnShift):
144 (KJS::arrayProtoFuncFilter):
145 (KJS::arrayProtoFuncMap):
146 (KJS::arrayProtoFuncEvery):
147 (KJS::arrayProtoFuncForEach):
148 (KJS::arrayProtoFuncSome):
149 (KJS::arrayProtoFuncIndexOf):
150 (KJS::arrayProtoFuncLastIndexOf):
151 (KJS::ArrayObjectImp::ArrayObjectImp):
152 (KJS::ArrayObjectImp::construct):
153 * kjs/bool_object.cpp:
154 (KJS::BooleanPrototype::BooleanPrototype):
155 (KJS::booleanProtoFuncToString):
156 (KJS::BooleanObjectImp::BooleanObjectImp):
157 (KJS::BooleanObjectImp::construct):
160 (KJS::allocateBlock):
161 (KJS::Collector::recordExtraCost):
162 (KJS::Collector::heapAllocate):
163 (KJS::Collector::allocate):
164 (KJS::Collector::allocateNumber):
165 (KJS::Collector::registerAsMainThread):
167 (KJS::PlatformThread::PlatformThread):
168 (KJS::getCurrentPlatformThread):
169 (KJS::Collector::Thread::Thread):
170 (KJS::destroyRegisteredThread):
171 (KJS::initializeRegisteredThreadKey):
172 (KJS::Collector::registerThread):
173 (KJS::Collector::markStackObjectsConservatively):
174 (KJS::Collector::markCurrentThreadConservativelyInternal):
175 (KJS::Collector::markCurrentThreadConservatively):
176 (KJS::suspendThread):
178 (KJS::getPlatformThreadRegisters):
179 (KJS::otherThreadStackPointer):
180 (KJS::Collector::markOtherThreadConservatively):
181 (KJS::protectedValues):
182 (KJS::Collector::protect):
183 (KJS::Collector::unprotect):
184 (KJS::Collector::collectOnMainThreadOnly):
185 (KJS::Collector::markProtectedObjects):
186 (KJS::Collector::markMainThreadOnlyObjects):
187 (KJS::Collector::sweep):
188 (KJS::Collector::collect):
189 (KJS::Collector::size):
190 (KJS::Collector::globalObjectCount):
191 (KJS::Collector::protectedGlobalObjectCount):
192 (KJS::Collector::protectedObjectCount):
193 (KJS::Collector::protectedObjectTypeCounts):
194 (KJS::Collector::isBusy):
195 (KJS::Collector::reportOutOfMemoryToAllExecStates):
198 (KJS::Collector::cellBlock):
199 (KJS::Collector::cellOffset):
200 (KJS::Collector::isCellMarked):
201 (KJS::Collector::markCell):
202 (KJS::Collector::reportExtraMemoryCost):
203 * kjs/date_object.cpp:
204 (KJS::formatLocaleDate):
205 (KJS::DatePrototype::DatePrototype):
206 (KJS::DateObjectImp::DateObjectImp):
207 (KJS::DateObjectImp::construct):
208 (KJS::DateObjectImp::callAsFunction):
209 (KJS::DateObjectFuncImp::DateObjectFuncImp):
210 (KJS::DateObjectFuncImp::callAsFunction):
211 (KJS::dateProtoFuncToString):
212 (KJS::dateProtoFuncToUTCString):
213 (KJS::dateProtoFuncToDateString):
214 (KJS::dateProtoFuncToTimeString):
215 (KJS::dateProtoFuncToLocaleString):
216 (KJS::dateProtoFuncToLocaleDateString):
217 (KJS::dateProtoFuncToLocaleTimeString):
218 (KJS::dateProtoFuncValueOf):
219 (KJS::dateProtoFuncGetTime):
220 (KJS::dateProtoFuncGetFullYear):
221 (KJS::dateProtoFuncGetUTCFullYear):
222 (KJS::dateProtoFuncToGMTString):
223 (KJS::dateProtoFuncGetMonth):
224 (KJS::dateProtoFuncGetUTCMonth):
225 (KJS::dateProtoFuncGetDate):
226 (KJS::dateProtoFuncGetUTCDate):
227 (KJS::dateProtoFuncGetDay):
228 (KJS::dateProtoFuncGetUTCDay):
229 (KJS::dateProtoFuncGetHours):
230 (KJS::dateProtoFuncGetUTCHours):
231 (KJS::dateProtoFuncGetMinutes):
232 (KJS::dateProtoFuncGetUTCMinutes):
233 (KJS::dateProtoFuncGetSeconds):
234 (KJS::dateProtoFuncGetUTCSeconds):
235 (KJS::dateProtoFuncGetMilliSeconds):
236 (KJS::dateProtoFuncGetUTCMilliseconds):
237 (KJS::dateProtoFuncGetTimezoneOffset):
238 (KJS::dateProtoFuncSetTime):
239 (KJS::setNewValueFromTimeArgs):
240 (KJS::setNewValueFromDateArgs):
241 (KJS::dateProtoFuncSetYear):
242 (KJS::dateProtoFuncGetYear):
243 * kjs/error_object.cpp:
244 (KJS::ErrorPrototype::ErrorPrototype):
245 (KJS::errorProtoFuncToString):
246 (KJS::ErrorObjectImp::ErrorObjectImp):
247 (KJS::ErrorObjectImp::construct):
248 (KJS::NativeErrorPrototype::NativeErrorPrototype):
249 (KJS::NativeErrorImp::NativeErrorImp):
250 (KJS::NativeErrorImp::construct):
252 (KJS::FunctionImp::lengthGetter):
253 (KJS::FunctionImp::construct):
254 (KJS::Arguments::Arguments):
255 (KJS::ActivationImp::createArgumentsObject):
258 (KJS::globalFuncParseInt):
259 (KJS::globalFuncParseFloat):
260 (KJS::globalFuncEscape):
261 (KJS::globalFuncUnescape):
262 (KJS::PrototypeFunction::PrototypeFunction):
263 (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
264 * kjs/function_object.cpp:
265 (KJS::FunctionPrototype::FunctionPrototype):
266 (KJS::functionProtoFuncToString):
267 (KJS::FunctionObjectImp::FunctionObjectImp):
268 (KJS::FunctionObjectImp::construct):
270 (KJS::StringImp::toObject):
272 (KJS::StringImp::StringImp):
273 (KJS::NumberImp::operator new):
275 (KJS::List::markSet):
276 (KJS::List::markProtectedListsSlowCase):
277 (KJS::List::expandAndAppend):
281 (KJS::List::markProtectedLists):
283 (KJS::staticFunctionGetter):
284 (KJS::cacheGlobalObject):
285 * kjs/math_object.cpp:
286 (KJS::MathObjectImp::getValueProperty):
287 (KJS::mathProtoFuncAbs):
288 (KJS::mathProtoFuncACos):
289 (KJS::mathProtoFuncASin):
290 (KJS::mathProtoFuncATan):
291 (KJS::mathProtoFuncATan2):
292 (KJS::mathProtoFuncCeil):
293 (KJS::mathProtoFuncCos):
294 (KJS::mathProtoFuncExp):
295 (KJS::mathProtoFuncFloor):
296 (KJS::mathProtoFuncLog):
297 (KJS::mathProtoFuncMax):
298 (KJS::mathProtoFuncMin):
299 (KJS::mathProtoFuncPow):
300 (KJS::mathProtoFuncRandom):
301 (KJS::mathProtoFuncRound):
302 (KJS::mathProtoFuncSin):
303 (KJS::mathProtoFuncSqrt):
304 (KJS::mathProtoFuncTan):
306 (KJS::ParserRefCounted::ParserRefCounted):
307 (KJS::ParserRefCounted::ref):
308 (KJS::ParserRefCounted::deref):
309 (KJS::ParserRefCounted::refcount):
310 (KJS::ParserRefCounted::deleteNewObjects):
311 (KJS::Node::handleException):
312 (KJS::NumberNode::evaluate):
313 (KJS::StringNode::evaluate):
314 (KJS::ArrayNode::evaluate):
315 (KJS::PostIncResolveNode::evaluate):
316 (KJS::PostIncLocalVarNode::evaluate):
317 (KJS::PostDecResolveNode::evaluate):
318 (KJS::PostDecLocalVarNode::evaluate):
319 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
320 (KJS::PostIncBracketNode::evaluate):
321 (KJS::PostDecBracketNode::evaluate):
322 (KJS::PostIncDotNode::evaluate):
323 (KJS::PostDecDotNode::evaluate):
324 (KJS::typeStringForValue):
325 (KJS::LocalVarTypeOfNode::evaluate):
326 (KJS::TypeOfResolveNode::evaluate):
327 (KJS::TypeOfValueNode::evaluate):
328 (KJS::PreIncLocalVarNode::evaluate):
329 (KJS::PreIncResolveNode::evaluate):
330 (KJS::PreDecLocalVarNode::evaluate):
331 (KJS::PreDecResolveNode::evaluate):
332 (KJS::PreIncConstNode::evaluate):
333 (KJS::PreDecConstNode::evaluate):
334 (KJS::PostIncConstNode::evaluate):
335 (KJS::PostDecConstNode::evaluate):
336 (KJS::PreIncBracketNode::evaluate):
337 (KJS::PreDecBracketNode::evaluate):
338 (KJS::PreIncDotNode::evaluate):
339 (KJS::PreDecDotNode::evaluate):
340 (KJS::NegateNode::evaluate):
341 (KJS::BitwiseNotNode::evaluate):
342 (KJS::MultNode::evaluate):
343 (KJS::DivNode::evaluate):
344 (KJS::ModNode::evaluate):
347 (KJS::AddNumbersNode::evaluate):
348 (KJS::AddStringsNode::evaluate):
349 (KJS::AddStringLeftNode::evaluate):
350 (KJS::AddStringRightNode::evaluate):
351 (KJS::SubNode::evaluate):
352 (KJS::LeftShiftNode::evaluate):
353 (KJS::RightShiftNode::evaluate):
354 (KJS::UnsignedRightShiftNode::evaluate):
355 (KJS::BitXOrNode::evaluate):
356 (KJS::BitOrNode::evaluate):
357 (KJS::valueForReadModifyAssignment):
358 (KJS::ForInNode::execute):
359 (KJS::TryNode::execute):
360 (KJS::FuncDeclNode::makeFunction):
361 (KJS::FuncExprNode::evaluate):
363 * kjs/number_object.cpp:
364 (KJS::NumberPrototype::NumberPrototype):
365 (KJS::numberProtoFuncToString):
366 (KJS::numberProtoFuncToLocaleString):
367 (KJS::numberProtoFuncToFixed):
368 (KJS::numberProtoFuncToExponential):
369 (KJS::numberProtoFuncToPrecision):
370 (KJS::NumberObjectImp::NumberObjectImp):
371 (KJS::NumberObjectImp::getValueProperty):
372 (KJS::NumberObjectImp::construct):
373 (KJS::NumberObjectImp::callAsFunction):
375 (KJS::JSObject::call):
376 (KJS::JSObject::get):
377 (KJS::JSObject::put):
378 (KJS::JSObject::defineGetter):
379 (KJS::JSObject::defineSetter):
380 (KJS::JSObject::putDirect):
381 (KJS::Error::create):
383 * kjs/object_object.cpp:
384 (KJS::ObjectPrototype::ObjectPrototype):
385 (KJS::objectProtoFuncToLocaleString):
386 (KJS::objectProtoFuncToString):
387 (KJS::ObjectObjectImp::ObjectObjectImp):
388 (KJS::ObjectObjectImp::construct):
389 * kjs/property_map.h:
390 (KJS::SavedProperty::SavedProperty):
391 (KJS::SavedProperty::init):
392 (KJS::SavedProperty::~SavedProperty):
393 (KJS::SavedProperty::name):
394 (KJS::SavedProperty::value):
395 (KJS::SavedProperty::attributes):
399 * kjs/regexp_object.cpp:
400 (KJS::RegExpPrototype::RegExpPrototype):
401 (KJS::regExpProtoFuncToString):
402 (KJS::RegExpImp::getValueProperty):
403 (KJS::RegExpObjectImp::RegExpObjectImp):
404 (KJS::RegExpObjectImp::arrayOfMatches):
405 (KJS::RegExpObjectImp::getBackref):
406 (KJS::RegExpObjectImp::getLastParen):
407 (KJS::RegExpObjectImp::getLeftContext):
408 (KJS::RegExpObjectImp::getRightContext):
409 (KJS::RegExpObjectImp::getValueProperty):
410 (KJS::RegExpObjectImp::createRegExpImp):
411 * kjs/regexp_object.h:
412 * kjs/string_object.cpp:
413 (KJS::StringInstance::StringInstance):
414 (KJS::StringInstance::lengthGetter):
415 (KJS::StringInstance::indexGetter):
416 (KJS::stringInstanceNumericPropertyGetter):
417 (KJS::StringPrototype::StringPrototype):
419 (KJS::stringProtoFuncCharAt):
420 (KJS::stringProtoFuncCharCodeAt):
421 (KJS::stringProtoFuncConcat):
422 (KJS::stringProtoFuncIndexOf):
423 (KJS::stringProtoFuncLastIndexOf):
424 (KJS::stringProtoFuncMatch):
425 (KJS::stringProtoFuncSearch):
426 (KJS::stringProtoFuncReplace):
427 (KJS::stringProtoFuncSlice):
428 (KJS::stringProtoFuncSplit):
429 (KJS::stringProtoFuncSubstr):
430 (KJS::stringProtoFuncSubstring):
431 (KJS::stringProtoFuncToLowerCase):
432 (KJS::stringProtoFuncToUpperCase):
433 (KJS::stringProtoFuncToLocaleLowerCase):
434 (KJS::stringProtoFuncToLocaleUpperCase):
435 (KJS::stringProtoFuncLocaleCompare):
436 (KJS::stringProtoFuncBig):
437 (KJS::stringProtoFuncSmall):
438 (KJS::stringProtoFuncBlink):
439 (KJS::stringProtoFuncBold):
440 (KJS::stringProtoFuncFixed):
441 (KJS::stringProtoFuncItalics):
442 (KJS::stringProtoFuncStrike):
443 (KJS::stringProtoFuncSub):
444 (KJS::stringProtoFuncSup):
445 (KJS::stringProtoFuncFontcolor):
446 (KJS::stringProtoFuncFontsize):
447 (KJS::stringProtoFuncAnchor):
448 (KJS::stringProtoFuncLink):
449 (KJS::StringObjectImp::StringObjectImp):
450 (KJS::StringObjectImp::construct):
451 (KJS::StringObjectImp::callAsFunction):
452 (KJS::StringObjectFuncImp::StringObjectFuncImp):
453 (KJS::StringObjectFuncImp::callAsFunction):
454 * kjs/string_object.h:
455 (KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
457 (GlobalObject::GlobalObject):
464 (KJS::JSCell::operator new):
466 (KJS::jsOwnedString):
471 (KJS::jsNumberFromAnd):
472 (KJS::JSCell::marked):
474 (KJS::JSValue::toJSNumber):
475 * wtf/ThreadSpecific.h:
478 2008-05-10 Julien Chaffraix <jchaffraix@webkit.org>
482 * JavaScriptCore.pri: Add profiler/Profile.cpp.
483 * JavaScriptCoreSources.bkl: Ditto.
485 2008-05-10 Jan Michael Alonzo <jmalonzo@unpluggable.com>
491 * GNUmakefile.am: Add Profile.cpp in _sources
493 2008-05-09 Brady Eidson <beidson@apple.com>
495 Build Fix. Kevin is an idiot.
496 ("My name is Kevin McCullough and I approve this message.")
498 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
500 2008-05-09 Kevin McCullough <kmccullough@apple.com>
504 -<rdar://problem/5770054> JavaScript profiler (10928)
505 -Add Profile class so that all profiles can be stored and retrieved by
506 the WebInspector when that time comes.
508 * JavaScriptCore.exp: Export the new function signatures.
509 * JavaScriptCore.xcodeproj/project.pbxproj: Add the new files to the
511 * profiler/Profile.cpp: Added. This class represents a single run of the
513 (KJS::Profile::Profile):
514 (KJS::Profile::willExecute):
515 (KJS::Profile::didExecute):
516 (KJS::Profile::printDataInspectorStyle):
517 (KJS::functionNameCountPairComparator):
518 (KJS::Profile::printDataSampleStyle):
519 * profiler/Profile.h: Added. Ditto
520 (KJS::Profile::stopProfiling):
521 * profiler/Profiler.cpp: Now the profiler keeps track of many profiles
522 but only runs one at a time.
523 (KJS::Profiler::startProfiling):
524 (KJS::Profiler::stopProfiling):
525 (KJS::Profiler::willExecute):
526 (KJS::Profiler::didExecute):
527 (KJS::Profiler::printDataInspectorStyle):
528 (KJS::Profiler::printDataSampleStyle):
529 * profiler/Profiler.h: Ditto.
530 (KJS::Profiler::~Profiler):
531 (KJS::Profiler::allProfiles):
532 (KJS::Profiler::clearProfiles):
534 2008-05-08 Anders Carlsson <andersca@apple.com>
538 Enable NPAPI plug-ins on 64-bit.
542 2008-05-07 Julien Chaffraix <jchaffraix@webkit.org>
544 Reviewed by Adam Roben.
548 Add SIZE_MAX definition for the wx port.
552 2008-05-07 Ariya Hidayat <ariya.hidayat@trolltech.com>
556 Support for isMainThread in the Qt port.
558 * wtf/ThreadingQt.cpp:
559 (WTF::initializeThreading): Adjusted.
560 (WTF::isMainThread): Added.
562 2008-05-05 Darin Adler <darin@apple.com>
564 Reviewed by John Sullivan.
566 - fix debug-only leak seen on buildbot
569 (WTF::HashTable::checkKey): After writing an empty value in, but before constructing a
570 deleted value on top of it, call the destructor so the empty value doesn't leak.
572 2008-05-02 Alexey Proskuryakov <ap@webkit.org>
574 Reviewed by Geoffrey Garen.
576 Get rid of static data in nodes.cpp (well, at least of non-debug one).
578 No measurable change on SunSpider.
580 * kjs/InitializeThreading.cpp:
581 (KJS::initializeThreadingOnce):
583 (KJS::newTrackedObjects):
584 (KJS::trackedObjectExtraRefCounts):
585 (KJS::initializeNodesThreading):
586 (KJS::ParserRefCounted::ParserRefCounted):
587 (KJS::ParserRefCounted::ref):
588 (KJS::ParserRefCounted::deref):
589 (KJS::ParserRefCounted::refcount):
590 (KJS::ParserRefCounted::deleteNewObjects):
592 Made newTrackedObjects and trackedObjectExtraRefCounts per-thread.
594 2008-05-02 Alexey Proskuryakov <ap@webkit.org>
598 Move call stack depth counter to global object.
600 * kjs/ExecState.h: (KJS::ExecState::functionCallDepth): Added a recursion depth counter to
602 * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Initialize PerThreadData.functionCallDepth.
603 * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::perThreadData): Made the result non-const.
606 (KJS::throwStackSizeExceededError): Moved throwError to a separate function, since it is now
607 the only thing in JSObject::call that needs a PIC branch.
608 (KJS::JSObject::call): Use a per-thread variable instead of local static for recursion depth
611 2008-05-02 Alexey Proskuryakov <ap@webkit.org>
615 Make JavaScriptGlue and JavaScriptCore API functions implicitly call initializeThreading
616 for the sake of non-WebKit clients.
620 * API/JSContextRef.cpp:
621 (JSGlobalContextCreate):
622 These are the JavaScriptCore API bottlenecks. There are a few other JSStringRef
623 and JSClassRef functions that can be called earlier, but they do not do anything that
624 requires initializeThreading.
626 * kjs/InitializeThreading.cpp:
627 (KJS::doInitializeThreading):
628 (KJS::initializeThreading):
629 On Darwin, make the initialization happen under pthread_once, since there is no guarantee
630 that non-WebKit clients won't try to call this function re-entrantly.
632 * kjs/InitializeThreading.h:
634 Spell out initializeThreading contract.
636 * wtf/ThreadingPthreads.cpp: (WTF::isMainThread): Make sure that results are correct on
637 Darwin, even if threading was initialized from a secondary thread.
639 2008-05-02 Alexey Proskuryakov <ap@webkit.org>
641 Reviewed by Geoffrey Garen.
643 https://bugs.webkit.org/show_bug.cgi?id=18826
644 Make JavaScript heap per-thread
646 * wtf/ThreadSpecific.h: Make sure to initialize POD thread-specific varaibles, too
647 (replaced "new T" with "new T()").
649 * kjs/collector.h: Renamed Collector to Heap, made the heap per-thread. Removed support for
650 multithreaded access to a heap.
651 (KJS::CollectorBlock): Removed collectOnMainThreadOnly bitmap, added a reference to owner heap.
652 (KJS::SmallCellCollectorBlock): Ditto.
653 (KJS::Heap::markListSet): Moved from a static variable in List.cpp to a per-thread one here.
654 (KJS::Heap::heap): Added a method to find which heap a JSValue is allocated in.
656 * kjs/collector.cpp: Changed "const size_t" constants to #defines, to avoid a PIC branch
657 (gcc was using one to access a constant used in std::max(), because it takes a reference,
658 even though std::max() itself was inlined).
659 (KJS::Heap::threadHeap): JS heap is now per-thread.
660 (KJS::Heap::Heap): Zero-initialize the heap.
661 (KJS::allocateBlock): Added NEVER_INLINE, because this function uses a PIC branch, so
662 inlining it in Heap::heapAllocate() is bad for performance, now that the latter doesn't
664 (KJS::Heap::heapAllocate): Initialize Block::heap.
665 (KJS::Heap::markCurrentThreadConservatively): Moved into markStackObjectsConservatively(),
666 as GC only works with a current thread's heap now.
667 (KJS::Heap::sweep): Removed collectOnMainThreadOnly checks.
668 (KJS::Heap::collect): Ditto.
672 (KJS::JSLock::JSLock):
673 Removed registerThread(), as the heap no longer cares.
675 * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Initialize new per-thread
676 variables in Heap and JSGlobalObject.
678 * kjs/ExecState.h: (KJS::ExecState::heap): Added a heap pointer for faster access to
679 per-thread heap, and an accessor for it.
681 * kjs/JSGlobalObject.h: Made JSGlobalObject linked list per-thread.
682 * kjs/JSGlobalObject.cpp:
683 (KJS::JSGlobalObject::~JSGlobalObject): Fixed a bug in linked list handling. It only worked
684 right if the removed object was the head one!
685 (KJS::JSGlobalObject::head): Return a per-thread list head.
686 (KJS::JSGlobalObject::init): Store a reference to per-thread heap.
687 (KJS::JSGlobalObject::reset): Pass ExecState to functions that need it.
688 (KJS::JSGlobalObject::tearOffActivation): Ditto.
689 (KJS::JSGlobalObject::operator new): JSGlobalObject allocation cannot use an ExecState,
690 so it needs a custom operator new that directly accesses per-thread heap.
693 (KJS::List::List): Replaced m_isInMarkSet boolean with an actual pointer to the set, since it
694 is no longer a single static object.
695 (KJS::List::~List): Ditto.
697 (KJS::List::markSet): Removed, this is now stored in Heap.
698 (KJS::List::markProtectedLists): Take a reference to the list.
699 (KJS::List::expandAndAppend): Ask the current thread heap for a mark set reference.
704 Use the newly added Heap::heap() method to find out which heap the value to be (un)protected
707 * kjs/property_map.h: Removed unused SavedProperty class.
709 * JavaScriptCore.exp:
712 * API/JSCallbackObjectFunctions.h:
713 (KJS::::staticFunctionGetter):
714 * API/JSClassRef.cpp:
715 (OpaqueJSClass::prototype):
716 * API/JSObjectRef.cpp:
718 (JSObjectMakeFunctionWithCallback):
719 (JSObjectMakeConstructor):
720 (JSObjectMakeFunction):
721 * API/JSValueRef.cpp:
724 * kjs/array_instance.cpp:
725 (KJS::ArrayInstance::ArrayInstance):
726 (KJS::ArrayInstance::lengthGetter):
727 * kjs/array_object.cpp:
728 (KJS::arrayProtoFuncToString):
729 (KJS::arrayProtoFuncToLocaleString):
730 (KJS::arrayProtoFuncJoin):
731 (KJS::arrayProtoFuncConcat):
732 (KJS::arrayProtoFuncPop):
733 (KJS::arrayProtoFuncPush):
734 (KJS::arrayProtoFuncShift):
735 (KJS::arrayProtoFuncSlice):
736 (KJS::arrayProtoFuncSplice):
737 (KJS::arrayProtoFuncUnShift):
738 (KJS::arrayProtoFuncFilter):
739 (KJS::arrayProtoFuncMap):
740 (KJS::arrayProtoFuncEvery):
741 (KJS::arrayProtoFuncForEach):
742 (KJS::arrayProtoFuncSome):
743 (KJS::arrayProtoFuncIndexOf):
744 (KJS::arrayProtoFuncLastIndexOf):
745 (KJS::ArrayObjectImp::ArrayObjectImp):
746 (KJS::ArrayObjectImp::construct):
747 * kjs/bool_object.cpp:
748 (KJS::BooleanPrototype::BooleanPrototype):
749 (KJS::booleanProtoFuncToString):
750 (KJS::BooleanObjectImp::BooleanObjectImp):
751 (KJS::BooleanObjectImp::construct):
752 * kjs/date_object.cpp:
753 (KJS::formatLocaleDate):
754 (KJS::DatePrototype::DatePrototype):
755 (KJS::DateObjectImp::DateObjectImp):
756 (KJS::DateObjectImp::construct):
757 (KJS::DateObjectImp::callAsFunction):
758 (KJS::DateObjectFuncImp::DateObjectFuncImp):
759 (KJS::DateObjectFuncImp::callAsFunction):
760 (KJS::dateProtoFuncToString):
761 (KJS::dateProtoFuncToUTCString):
762 (KJS::dateProtoFuncToDateString):
763 (KJS::dateProtoFuncToTimeString):
764 (KJS::dateProtoFuncToLocaleString):
765 (KJS::dateProtoFuncToLocaleDateString):
766 (KJS::dateProtoFuncToLocaleTimeString):
767 (KJS::dateProtoFuncValueOf):
768 (KJS::dateProtoFuncGetTime):
769 (KJS::dateProtoFuncGetFullYear):
770 (KJS::dateProtoFuncGetUTCFullYear):
771 (KJS::dateProtoFuncToGMTString):
772 (KJS::dateProtoFuncGetMonth):
773 (KJS::dateProtoFuncGetUTCMonth):
774 (KJS::dateProtoFuncGetDate):
775 (KJS::dateProtoFuncGetUTCDate):
776 (KJS::dateProtoFuncGetDay):
777 (KJS::dateProtoFuncGetUTCDay):
778 (KJS::dateProtoFuncGetHours):
779 (KJS::dateProtoFuncGetUTCHours):
780 (KJS::dateProtoFuncGetMinutes):
781 (KJS::dateProtoFuncGetUTCMinutes):
782 (KJS::dateProtoFuncGetSeconds):
783 (KJS::dateProtoFuncGetUTCSeconds):
784 (KJS::dateProtoFuncGetMilliSeconds):
785 (KJS::dateProtoFuncGetUTCMilliseconds):
786 (KJS::dateProtoFuncGetTimezoneOffset):
787 (KJS::dateProtoFuncSetTime):
788 (KJS::setNewValueFromTimeArgs):
789 (KJS::setNewValueFromDateArgs):
790 (KJS::dateProtoFuncSetYear):
791 (KJS::dateProtoFuncGetYear):
792 * kjs/error_object.cpp:
793 (KJS::ErrorPrototype::ErrorPrototype):
794 (KJS::errorProtoFuncToString):
795 (KJS::ErrorObjectImp::ErrorObjectImp):
796 (KJS::ErrorObjectImp::construct):
797 (KJS::NativeErrorPrototype::NativeErrorPrototype):
798 (KJS::NativeErrorImp::NativeErrorImp):
799 (KJS::NativeErrorImp::construct):
801 (KJS::FunctionImp::lengthGetter):
802 (KJS::FunctionImp::construct):
803 (KJS::Arguments::Arguments):
804 (KJS::ActivationImp::createArgumentsObject):
807 (KJS::globalFuncParseInt):
808 (KJS::globalFuncParseFloat):
809 (KJS::globalFuncEscape):
810 (KJS::globalFuncUnescape):
811 (KJS::PrototypeFunction::PrototypeFunction):
812 (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
813 * kjs/function_object.cpp:
814 (KJS::FunctionPrototype::FunctionPrototype):
815 (KJS::functionProtoFuncToString):
816 (KJS::FunctionObjectImp::FunctionObjectImp):
817 (KJS::FunctionObjectImp::construct):
819 (KJS::StringImp::toObject):
821 (KJS::StringImp::StringImp):
822 (KJS::NumberImp::operator new):
824 (KJS::staticFunctionGetter):
825 (KJS::cacheGlobalObject):
826 * kjs/math_object.cpp:
827 (KJS::MathObjectImp::getValueProperty):
828 (KJS::mathProtoFuncAbs):
829 (KJS::mathProtoFuncACos):
830 (KJS::mathProtoFuncASin):
831 (KJS::mathProtoFuncATan):
832 (KJS::mathProtoFuncATan2):
833 (KJS::mathProtoFuncCeil):
834 (KJS::mathProtoFuncCos):
835 (KJS::mathProtoFuncExp):
836 (KJS::mathProtoFuncFloor):
837 (KJS::mathProtoFuncLog):
838 (KJS::mathProtoFuncMax):
839 (KJS::mathProtoFuncMin):
840 (KJS::mathProtoFuncPow):
841 (KJS::mathProtoFuncRandom):
842 (KJS::mathProtoFuncRound):
843 (KJS::mathProtoFuncSin):
844 (KJS::mathProtoFuncSqrt):
845 (KJS::mathProtoFuncTan):
847 (KJS::Node::handleException):
848 (KJS::NumberNode::evaluate):
849 (KJS::StringNode::evaluate):
850 (KJS::ArrayNode::evaluate):
851 (KJS::PostIncResolveNode::evaluate):
852 (KJS::PostIncLocalVarNode::evaluate):
853 (KJS::PostDecResolveNode::evaluate):
854 (KJS::PostDecLocalVarNode::evaluate):
855 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
856 (KJS::PostIncBracketNode::evaluate):
857 (KJS::PostDecBracketNode::evaluate):
858 (KJS::PostIncDotNode::evaluate):
859 (KJS::PostDecDotNode::evaluate):
860 (KJS::typeStringForValue):
861 (KJS::LocalVarTypeOfNode::evaluate):
862 (KJS::TypeOfResolveNode::evaluate):
863 (KJS::TypeOfValueNode::evaluate):
864 (KJS::PreIncLocalVarNode::evaluate):
865 (KJS::PreIncResolveNode::evaluate):
866 (KJS::PreDecLocalVarNode::evaluate):
867 (KJS::PreDecResolveNode::evaluate):
868 (KJS::PreIncConstNode::evaluate):
869 (KJS::PreDecConstNode::evaluate):
870 (KJS::PostIncConstNode::evaluate):
871 (KJS::PostDecConstNode::evaluate):
872 (KJS::PreIncBracketNode::evaluate):
873 (KJS::PreDecBracketNode::evaluate):
874 (KJS::PreIncDotNode::evaluate):
875 (KJS::PreDecDotNode::evaluate):
876 (KJS::NegateNode::evaluate):
877 (KJS::BitwiseNotNode::evaluate):
878 (KJS::MultNode::evaluate):
879 (KJS::DivNode::evaluate):
880 (KJS::ModNode::evaluate):
883 (KJS::AddNumbersNode::evaluate):
884 (KJS::AddStringsNode::evaluate):
885 (KJS::AddStringLeftNode::evaluate):
886 (KJS::AddStringRightNode::evaluate):
887 (KJS::SubNode::evaluate):
888 (KJS::LeftShiftNode::evaluate):
889 (KJS::RightShiftNode::evaluate):
890 (KJS::UnsignedRightShiftNode::evaluate):
891 (KJS::BitXOrNode::evaluate):
892 (KJS::BitOrNode::evaluate):
893 (KJS::valueForReadModifyAssignment):
894 (KJS::ForInNode::execute):
895 (KJS::TryNode::execute):
896 (KJS::FuncDeclNode::makeFunction):
897 (KJS::FuncExprNode::evaluate):
898 * kjs/number_object.cpp:
899 (KJS::NumberPrototype::NumberPrototype):
900 (KJS::numberProtoFuncToString):
901 (KJS::numberProtoFuncToLocaleString):
902 (KJS::numberProtoFuncToFixed):
903 (KJS::numberProtoFuncToExponential):
904 (KJS::numberProtoFuncToPrecision):
905 (KJS::NumberObjectImp::NumberObjectImp):
906 (KJS::NumberObjectImp::getValueProperty):
907 (KJS::NumberObjectImp::construct):
908 (KJS::NumberObjectImp::callAsFunction):
910 (KJS::JSObject::defineGetter):
911 (KJS::JSObject::defineSetter):
912 (KJS::JSObject::putDirect):
913 (KJS::Error::create):
915 * kjs/object_object.cpp:
916 (KJS::ObjectPrototype::ObjectPrototype):
917 (KJS::objectProtoFuncToLocaleString):
918 (KJS::objectProtoFuncToString):
919 (KJS::ObjectObjectImp::ObjectObjectImp):
920 (KJS::ObjectObjectImp::construct):
921 * kjs/regexp_object.cpp:
922 (KJS::RegExpPrototype::RegExpPrototype):
923 (KJS::regExpProtoFuncToString):
924 (KJS::RegExpImp::getValueProperty):
925 (KJS::RegExpObjectImp::RegExpObjectImp):
926 (KJS::RegExpObjectImp::arrayOfMatches):
927 (KJS::RegExpObjectImp::getBackref):
928 (KJS::RegExpObjectImp::getLastParen):
929 (KJS::RegExpObjectImp::getLeftContext):
930 (KJS::RegExpObjectImp::getRightContext):
931 (KJS::RegExpObjectImp::getValueProperty):
932 (KJS::RegExpObjectImp::createRegExpImp):
933 * kjs/regexp_object.h:
934 * kjs/string_object.cpp:
935 (KJS::StringInstance::StringInstance):
936 (KJS::StringInstance::lengthGetter):
937 (KJS::StringInstance::indexGetter):
938 (KJS::stringInstanceNumericPropertyGetter):
939 (KJS::StringPrototype::StringPrototype):
941 (KJS::stringProtoFuncCharAt):
942 (KJS::stringProtoFuncCharCodeAt):
943 (KJS::stringProtoFuncConcat):
944 (KJS::stringProtoFuncIndexOf):
945 (KJS::stringProtoFuncLastIndexOf):
946 (KJS::stringProtoFuncMatch):
947 (KJS::stringProtoFuncSearch):
948 (KJS::stringProtoFuncReplace):
949 (KJS::stringProtoFuncSlice):
950 (KJS::stringProtoFuncSplit):
951 (KJS::stringProtoFuncSubstr):
952 (KJS::stringProtoFuncSubstring):
953 (KJS::stringProtoFuncToLowerCase):
954 (KJS::stringProtoFuncToUpperCase):
955 (KJS::stringProtoFuncToLocaleLowerCase):
956 (KJS::stringProtoFuncToLocaleUpperCase):
957 (KJS::stringProtoFuncLocaleCompare):
958 (KJS::stringProtoFuncBig):
959 (KJS::stringProtoFuncSmall):
960 (KJS::stringProtoFuncBlink):
961 (KJS::stringProtoFuncBold):
962 (KJS::stringProtoFuncFixed):
963 (KJS::stringProtoFuncItalics):
964 (KJS::stringProtoFuncStrike):
965 (KJS::stringProtoFuncSub):
966 (KJS::stringProtoFuncSup):
967 (KJS::stringProtoFuncFontcolor):
968 (KJS::stringProtoFuncFontsize):
969 (KJS::stringProtoFuncAnchor):
970 (KJS::stringProtoFuncLink):
971 (KJS::StringObjectImp::StringObjectImp):
972 (KJS::StringObjectImp::construct):
973 (KJS::StringObjectImp::callAsFunction):
974 (KJS::StringObjectFuncImp::StringObjectFuncImp):
975 (KJS::StringObjectFuncImp::callAsFunction):
976 * kjs/string_object.h:
977 (KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
979 (GlobalObject::GlobalObject):
986 (KJS::JSCell::operator new):
988 (KJS::jsOwnedString):
993 (KJS::jsNumberFromAnd):
994 (KJS::JSCell::marked):
996 (KJS::JSValue::toJSNumber):
997 Removed collectOnMainThreadOnly, as this is the only way to collect now. Replaced calls to
998 static Collector methods with calls to per-thread Heap ones.
1000 2008-05-02 Dan Bernstein <mitz@apple.com>
1002 Reviewed by Maciej Stachowiak.
1006 * wtf/StrHash.h: Added header guards and removed #include "config.h".
1008 2008-05-01 Ada Chan <adachan@apple.com>
1010 #include <wtf/StrHash.h> in identifier.cpp.
1014 * kjs/identifier.cpp:
1016 2008-05-01 Steve Falkenburg <sfalken@apple.com>
1020 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1022 2008-05-01 Sam Weinig <sam@webkit.org>
1026 * JavaScriptCore.xcodeproj/project.pbxproj:
1028 2008-05-01 Kevin McCullough <kmccullough@apple.com>
1032 <rdar://problem/5770054> JavaScript profiler (10928)
1033 - Fix "sample" output so that it can be imported into Instruments
1034 - Also keep track of number of times a function is profiled.
1036 * JavaScriptCore.xcodeproj/project.pbxproj: Add StrHash.h which needed
1037 to be pulled out of identifier.cpp so that it could be used by the
1038 profiler and identifiers.
1039 * kjs/identifier.cpp: Ditto.
1040 * profiler/FunctionCallProfile.cpp:
1041 (KJS::FunctionCallProfile::printDataInspectorStyle): Inspector style
1042 printing should show microseconds.
1043 (KJS::FunctionCallProfile::printDataSampleStyle): Sample style printing
1044 now counts the number of times a function is in the stack tree and does
1045 not print microseconds since that does not make sense for a sampler.
1046 * profiler/FunctionCallProfile.h: Keep track of number of times a
1047 function is profiled.
1048 (KJS::FunctionCallProfile::numberOfCalls):
1049 * profiler/Profiler.cpp:
1050 (KJS::functionNameCountPairComparator): Comparator for sort function in
1051 printDataSampleStyle.
1052 (KJS::Profiler::printDataSampleStyle): Print the number of times that a
1053 function is listed in the stack tree in order of most times listed.
1054 * wtf/HashCountedSet.h: Added copyToVector since it didn't exist and is
1055 a more standard way to copy a HashSet to a Vector. I added on variant
1056 that takes a pair as the Vector's type and so the HashCountedSet simply
1057 fills in that pair with its internal pair, and another variant that
1058 takes a Vector of the type of the HashCountedSet and only fills in the
1059 Vector with the first element of the pair.
1060 (WTF::copyToVector):
1061 * wtf/StrHash.h: Added.
1064 2008-04-29 David Kilzer <ddkilzer@apple.com>
1066 BUILD FIX for ENABLE(DASHBOARD_SUPPORT)
1068 * wtf/Platform.h: Defined ENABLE(DASHBOARD_SUPPORT) to 1 only for
1069 PLATFORM(MAC) and PLATFORM(WIN). Changed default to 0 for other
1072 2008-04-29 Greg Bolsinga <bolsinga@apple.com>
1076 Wrapped Dashboard code with ENABLE(DASHBOARD_SUPPORT)
1080 2008-04-29 Kevin McCullough <kmccullough@apple.com>
1084 -<rdar://problem/5770054> JavaScript profiler (10928)
1087 * profiler/FunctionCallProfile.cpp:
1088 (KJS::FunctionCallProfile::FunctionCallProfile):
1089 (KJS::FunctionCallProfile::didExecute): Implements call count and fixed a bug where a stackIndex
1090 of 0 was causing the assert to be hit.
1091 (KJS::FunctionCallProfile::stopProfiling):
1092 (KJS::FunctionCallProfile::endAndRecordCall):
1093 * profiler/FunctionCallProfile.h:
1095 2008-04-29 Simon Hausmann <hausmann@webkit.org>
1097 Qt/Windows build fix. The externally declared hash tables are actually
1098 declared const and the const is mangled in the symbol name, so when
1099 importing they also need to be marked const.
1101 When compiling without MULTIPLE_THREADS use a const HashTable&
1102 instead of a HashTable& in ThreadClassInfoHashTables to avoid
1103 initializing the latter with a const reference.
1105 * kjs/JSGlobalObject.cpp:
1107 2008-04-28 Alexey Proskuryakov <ap@webkit.org>
1111 * kjs/ExecState.h: For whatever reason, MSVC couldn't generate a default constructor for
1112 a struct that had a "const List" member. Removing the const qulifier makes the problem go away.
1114 2008-04-28 Alexey Proskuryakov <ap@webkit.org>
1118 Fix run-webkit-tests --threading
1119 and provisionally fix <https://bugs.webkit.org/show_bug.cgi?id=18661>
1120 Proxy server issue in Sunday's Nightly
1122 Changed ClassInfo objects for built-in objects to hold a getter function returning
1123 a per-thread instance. This makes it safe to share these ClassInfo objects between threads -
1124 and these are the only ones that need to be shared.
1127 (KJS::Lexer::Lexer):
1128 (KJS::Lexer::~Lexer):
1130 Made mainTable a member of Lexer, so that it no longer needs to be shared between threads.
1133 (KJS::JSObject::deleteProperty):
1134 (KJS::JSObject::findPropertyHashEntry):
1135 (KJS::JSObject::propertyIsEnumerable):
1136 (KJS::JSObject::getPropertyAttributes):
1137 (KJS::JSObject::getPropertyNames):
1139 (KJS::ClassInfo::propHashTable):
1140 Added a new classPropHashTableGetterFunction field to ClassInfo. If it is non-zero, the
1141 static table is not used.
1143 * kjs/JSGlobalObject.cpp:
1144 (KJS::ThreadClassInfoHashTables::ThreadClassInfoHashTables): This new class holds per-thread
1145 HashTables for built-in classes. The old static structs are copied to create per-thread
1147 (KJS::JSGlobalObject::threadClassInfoHashTables): An accessor/initializer for the above.
1148 (KJS::JSGlobalObject::init): Copy per-thread data into a single structure for faster access.
1149 Also, construct globalExec.
1150 (KJS::JSGlobalObject::reset): Adapted for globalExec now being an OwnPtr.
1151 (KJS::JSGlobalObject::mark): Ditto.
1152 (KJS::JSGlobalObject::globalExec): Ditto.
1153 * kjs/JSGlobalObject.h:
1154 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Made JSGlobalObject::JSGlobalObjectData::globalExec an OwnPtr, so that it can
1155 be initialized from JSGlobalObject::init() after them. Otherwise, ExecState constructor was
1156 trying to access half-initialized JSGlobalObject to make its own copy of these table
1157 references, and failed.
1158 (KJS::JSGlobalObject::JSGlobalObject): Pass "this" value to init() to create globalExec.
1159 (KJS::JSGlobalObject::perThreadData): An accessor for per-thread data.
1161 * kjs/ExecState.cpp:
1162 (KJS::ExecState::ExecState):
1164 (KJS::ExecState::propertyNames):
1165 (KJS::ExecState::emptyList):
1166 (KJS::ExecState::arrayTable):
1167 (KJS::ExecState::dateTable):
1168 (KJS::ExecState::mathTable):
1169 (KJS::ExecState::numberTable):
1170 (KJS::ExecState::RegExpImpTable):
1171 (KJS::ExecState::RegExpObjectImpTable):
1172 (KJS::ExecState::stringTable):
1173 * kjs/ExecStateInlines.h:
1174 (KJS::ExecState::ExecState):
1175 Each ExecState holds its own reference to per-thread data, for even faster access. Moved
1176 m_emptyList and m_propertyNames to the same structure, making ExecState faster to construct
1177 and take less space on the stack.
1179 * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Initialize thread-static data
1180 added to JSGlobalObject.
1182 * API/JSCallbackConstructor.cpp:
1184 * API/JSCallbackFunction.cpp:
1186 * API/JSCallbackObject.cpp:
1188 * JavaScriptCore.exp:
1189 * kjs/JSVariableObject.cpp:
1190 (KJS::JSVariableObject::getPropertyAttributes):
1191 * kjs/JSVariableObject.h:
1192 * kjs/array_instance.cpp:
1194 * kjs/array_object.cpp:
1196 (KJS::ArrayPrototype::getOwnPropertySlot):
1197 * kjs/bool_object.cpp:
1199 * kjs/create_hash_table:
1200 * kjs/date_object.cpp:
1202 (KJS::DatePrototype::getOwnPropertySlot):
1203 (KJS::DateObjectImp::DateObjectImp):
1204 * kjs/error_object.cpp:
1208 * kjs/function_object.cpp:
1209 (KJS::FunctionPrototype::FunctionPrototype):
1213 * kjs/math_object.cpp:
1215 (KJS::MathObjectImp::getOwnPropertySlot):
1216 * kjs/number_object.cpp:
1218 (KJS::NumberObjectImp::getOwnPropertySlot):
1219 * kjs/object_object.cpp:
1220 (KJS::ObjectPrototype::ObjectPrototype):
1221 * kjs/regexp_object.cpp:
1223 (KJS::RegExpPrototype::RegExpPrototype):
1224 (KJS::RegExpImp::getOwnPropertySlot):
1225 (KJS::RegExpImp::put):
1226 (KJS::RegExpObjectImp::getOwnPropertySlot):
1227 (KJS::RegExpObjectImp::put):
1228 * kjs/string_object.cpp:
1230 (KJS::StringPrototype::getOwnPropertySlot):
1231 Adjust for the above changes.
1233 2008-04-28 Darin Adler <darin@apple.com>
1237 - make sure RefPtr's default hash doesn't ref/deref when computing the hash
1238 - remove remnants of the hash table storage type optimization
1240 * wtf/HashFunctions.h: Used "using" to get the hash and equal functions
1241 from PtrHash<P*> into PtrHash<RefPtr<P>>.
1243 * wtf/HashMap.h: Replaced uses of PairBaseHashTraits with PairHashTraits.
1244 Eliminated storage-related typedefs. Removed constructor, destructor,
1245 copy constructor, and destructor since the compiler-generated ones are
1246 fine. Removed refAll and derefAll. Took out unnnecessary typecasts.
1247 Removed use of RefCounter.
1249 * wtf/HashSet.h: Eliminated storage-related typedefs. Removed constructor,
1250 destructor, copy constructor, and destructor since the compiler-generated
1251 ones are fine. Removed refAll and derefAll. Removed unneeded template
1252 arguents from HashSetTranslatorAdapter. Eliminated unneeded HashSetTranslator
1255 * wtf/HashTable.h: Tweaked formatting. Removed NeedsRef, RefCounterBase,
1256 RefCounter, HashTableRefCounterBase, HashTableRefCounter, and Assigner
1259 * wtf/HashTraits.h: Removed StorageTraits, needsRef, PairBaseHashTraits,
1260 and HashKeyStorageTraits.
1262 * wtf/RefPtrHashMap.h: Made all the same fixes as in HashMap. Also made
1263 the corresponding changes to RefPtrHashMapRawKeyTranslator.
1265 2008-04-28 Darin Adler <darin@apple.com>
1269 - fix assertion hit every time you view www.apple.com
1271 * kjs/PropertyNameArray.cpp:
1272 (KJS::PropertyNameArray::add): Changed assertion to allow null and empty strings.
1273 Now to find out why we have a property named "" and if that's a bug!
1275 2008-04-27 Mark Rowe <mrowe@apple.com>
1277 Reviewed by Maciej Stachowiak.
1279 Fix crash inside PtrHash::hash when loading a page.
1281 * wtf/HashFunctions.h: Explicitly use the superclass implementation of hash to avoid infinite recursion.
1283 2008-04-27 Darin Adler <darin@apple.com>
1287 - fix <rdar://problem/5657459> REGRESSION: JavaScriptCore no longer builds with
1288 GCC 4.2 due to pointer aliasing warnings
1290 Fix this by removing the HashTable optimizations that allowed us to share a back end
1291 implementation between hash tables with integers, pointers, RefPtr, and String objects
1292 as keys. The way it worked was incompatible with strict aliasing.
1294 This increases code size. On Mac OS X we'll have to regenerate .order files to avoid
1295 slowing down Safari startup times.
1297 This creates a slight slowdown in SunSpider, mitigated by the following four speedups:
1299 - speed up array put slightly by moving a branch (was already done for get)
1301 - speed up symbol table access by adding a function named inlineGet to HashMap
1302 and using that in symbolTableGet/Put
1304 - speed up PropertyNameArray creation by reducing the amount of reference count
1305 churn and uniqueness checking when adding names and not doing any allocation at
1306 all when building small arrays
1308 - speed up conversion of strings to floating point numbers by eliminating the
1309 malloc/free of the buffer for the ASCII copy of the string; a way to make
1310 things even faster would be to change strtod to take a UTF-16 string
1312 Note that there is considerable unused complexity now in HashSet/Map/Table to support
1313 "storage types", which is no longer used. Will do in a separate patch.
1315 * API/JSCallbackObjectFunctions.h:
1316 (KJS::JSCallbackObject<Base>::getPropertyNames): Removed explicit cast to Identifier to
1317 take advantage of the new PropertyNameArray::add overload and avoid reference count churn.
1318 * API/JSObjectRef.cpp:
1319 (JSPropertyNameAccumulatorAddName): Ditto.
1320 * JavaScriptCore.exp: Updated PropertyNameArray::add entry point name.
1322 * kjs/JSVariableObject.cpp: Removed now-unneeded IdentifierRepHashTraits::nullRepPtr
1323 definition (see below).
1324 (KJS::JSVariableObject::getPropertyNames): Removed explicit cast to Identifier.
1326 * kjs/JSVariableObject.h:
1327 (KJS::JSVariableObject::symbolTableGet): Use inlineGet for speed. Also changed to do
1328 early exit instead of nesting the body inside an if.
1329 (KJS::JSVariableObject::symbolTablePut): Ditto.
1331 * kjs/PropertyNameArray.cpp:
1332 (KJS::PropertyNameArray::add): Changed implementation to take a raw pointer instead of
1333 a reference to an identifier. Do uniqueness checking by searching the vector when the
1334 vector is short, only building the set once the vector is large enough.
1336 * kjs/PropertyNameArray.h: Added an overload of add for a raw pointer, and made the old
1337 add function call that one. Added an addKnownUnique function for use when the new
1338 name is known to be different from any other in the array. Changed the vector to have
1339 an inline capacity of 20.
1341 * kjs/SymbolTable.h: Changed IdentifierRepHash to inherit from the default hash for
1342 a RefPtr so we don't have to define so much. Added an overload of the hash function for
1343 a raw pointer as required by the new RefPtrHashMap. Got rid of the now-unneeded
1344 IdentifierRepHashTraits -- the default traits now work fine. Added a definition of
1345 empthValueIsZero to SymbolTableIndexHashTraits; not having it was incorrect, but harmless.
1347 * kjs/array_instance.cpp:
1348 (KJS::ArrayInstance::put): Move the maxArrayIndex check inside the branch that checks
1349 the index against the length, as done in the get function.
1352 (KJS::globalFuncKJSPrint): Changed to use the new getCString instead of cstring.
1354 * kjs/internal.cpp: Removed printInfo debugging function, a client of cstring.
1355 If we need a debugging function we can easily make a better one and we haven't
1356 used this one in a long time.
1357 * kjs/internal.h: Ditto.
1360 (KJS::JSObject::getPropertyNames): Removed explicit cast to Identifier.
1361 * kjs/property_map.cpp:
1362 (KJS::PropertyMap::getEnumerablePropertyNames): Ditto. Also added a special case for
1363 the case where the propertyNames array is empty -- in that case we know we're adding
1364 a set of names that are non-overlapping so we can use addKnownUnique.
1366 (KJS::UString::getCString): Replaces cstring. Puts the C string into a CStringBuffer,
1367 which is a char Vector with an inline capacity. Also returns a boolean to indicate if
1368 the converion was lossy, which eliminates the need for a separate is8Bit call.
1369 (KJS::UString::toDouble): Changed to call getCString instead of cstring.
1370 * kjs/ustring.h: Ditto.
1372 * wtf/HashFunctions.h: Overload the hash and equal functions for RefPtr's default
1373 hash to take raw pointers. This works with the changes to RefPtrHashMap to avoid
1374 introducing refcount churn.
1376 * wtf/HashMap.h: Removed special code to convert the deleted value to the empty value
1377 when writing a new value into the map. This is now handled elsewhere.
1378 (WTF::HashMap::get): Removed code that checks for an empty hash table before calling
1379 HashTable::lookup; it's slightly more efficient to do this check inside lookup.
1382 (WTF::HashTable::isDeletedBucket): Changed to use isDeletedValue instead of using
1383 deletedValue and the equality operator.
1384 (WTF::HashTable::deleteBucket): Changed to use constructDeletedValue instead of
1385 using deletedValue and the assignment operator.
1386 (WTF::HashTable::checkKey): Added. Factors out the check for values that are empty
1387 or deleted keys that's used in various functions below.
1388 (WTF::HashTable::lookup): Changed to use checkKey, check for a 0 table, and also
1389 made public for use by RefPtrHashMap.
1390 (WTF::HashTable::lookupForWriting): Changed to use checkKey.
1391 (WTF::HashTable::fullLookupForWriting): Changed to use checkKey.
1392 (WTF::HashTable::add): Changed to use checkKey, and call initializeBucket on a
1393 deleted bucket before putting a new entry into it.
1394 (WTF::HashTable::addPassingHashCode): Ditto.
1395 (WTF::HashTable::deallocateTable): Check isDeletedBucket before calling ~ValueType.
1397 * wtf/HashTraits.h: Got ridd of all the HashTraits specialization for the integer
1398 types, since GeneicHashTraitsBase already deals with integers separately. Put the
1399 deleted value support into GenericHashTraitsBase. Changed FloatHashTraits to
1400 inherit from GenericHashTraits, and define construct/isDeletedValue rather than
1401 deletedValue. Removed the ref and deref functions from RefPtr's HashTraits, and
1402 defined construct/isDeletedValue. Eliminated DeletedValueAssigner. Changed
1403 PairHashTraits to define construct/isDeletedValue, and also merged
1404 PairBaseHashTraits in with PairHashTraits. Got rid of all specialization of
1405 HashKeyStorageTraits. We'll remove that, and the needsRef data member, later.
1407 * wtf/RefPtr.h: Added HashTableDeletedValueType, an enum type with a single value,
1408 HashTableDeletedValue. Used that type to make a new constructor to construct
1409 deleted values and also added an isHashTableDeletedValue function.
1411 * wtf/RefPtrHashMap.h: Added RefPtrHashMapRawKeyTranslator and used it to implement
1412 the raw pointer functions. This is a way to continue to avoid refcount thrash. We
1413 can't use the old way because it depended on the underlying map using a non-RefPtr
1415 (WTF::HashMap::find): Use find with RefPtrHashMapRawKeyTranslator.
1416 (WTF::HashMap::contains): Use contains with RefPtrHashMapRawKeyTranslator.
1417 (WTF::HashMap::inlineAdd): Use add with RefPtrHashMapRawKeyTranslator.
1418 (WTF::HashMap::get): Removed code that checks for an empty hash table before calling
1419 HashTable::lookup; it's slightly more efficient to do this check inside lookup.
1420 (WTF::HashMap::inlineGet): Added. Just like get, but marked inline for use in the
1423 2008-04-25 Sam Weinig <sam@webkit.org>
1425 Rubber-stamped by Mark Rowe.
1427 Remove SavedBuiltins and SavedProperties classes and the methods used to
1428 save data to them. The CachedPage now stores a the JSGlobalObject in full.
1430 * JavaScriptCore.exp:
1431 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1432 * JavaScriptCore.xcodeproj/project.pbxproj:
1433 * kjs/JSGlobalObject.cpp:
1434 * kjs/JSGlobalObject.h:
1435 * kjs/JSVariableObject.cpp:
1436 * kjs/JSVariableObject.h:
1437 (KJS::JSVariableObject::localStorage):
1438 * kjs/SavedBuiltins.h: Removed.
1440 * kjs/property_map.cpp:
1441 * kjs/property_map.h:
1443 2008-04-25 Mark Rowe <mrowe@apple.com>
1445 Rubber-stamped by Sam Weinig.
1447 Add some content to an empty ICU header file to prevent verification errors.
1449 * icu/unicode/utf_old.h:
1451 2008-04-25 David Kilzer <ddkilzer@apple.com>
1453 <rdar://problem/5819422> REGRESSION: Wrong line number passed to -willLeaveCallFrame
1455 Patch by George Dicker and Michael Kahl. Reviewed by Darin.
1457 When -[NSObject(WebScriptDebugDelegate) webView:willLeaveCallFrame:sourceId:line:forWebFrame:]
1458 is invoked, the first line number of the function is returned instead of the last
1459 line number. This regressed in r28458.
1462 (KJS::FunctionBodyNodeWithDebuggerHooks::execute): Pass lastLine() instead of lineNo()
1463 when calling Debugger::returnEvent().
1465 2008-04-25 Darin Adler <darin@apple.com>
1467 Done with Stephanie Lewis.
1469 * JavaScriptCore.xcodeproj/project.pbxproj: Prepare for compilation with gcc 4.2 by
1470 adding -fno-strict-aliasing to CollatorICU.cpp.
1472 2008-04-24 Sam Weinig <sam@webkit.org>
1474 Reviewed by Geoffrey Garen.
1476 Add a #define to easily enable collecting on every allocation to aid
1479 * kjs/collector.cpp:
1480 (KJS::Collector::heapAllocate):
1482 2008-04-24 Kevin McCullough <kmccullough@apple.com>
1484 Reviewed by Adam and Sam.
1486 -<rdar://problem/5770054> JavaScript profiler (10928)
1487 -Only profile the page group that starts profiling to avoid profiling
1488 tools that shouldn't be profiled unless explicitly requested to.
1490 * JavaScriptCore.exp: Export new signature.
1491 * kjs/JSGlobalObject.cpp: Add unique identifiers to the JSGlobalObject.
1492 (KJS::JSGlobalObject::init):
1493 * kjs/JSGlobalObject.h: Ditto.
1494 (KJS::JSGlobalObject::setPageGroupIdentifier):
1495 (KJS::JSGlobalObject::pageGroupIdentifier):
1496 * profiler/Profiler.cpp: Check the identifier of the page group of the
1497 lexical global exec state and only profile if it matches the given page
1499 (KJS::Profiler::startProfiling):
1500 (KJS::Profiler::willExecute):
1501 (KJS::Profiler::didExecute):
1502 * profiler/Profiler.h: Ditto.
1503 (KJS::Profiler::Profiler):
1505 2008-04-24 Julien Chaffraix <jchaffraix@webkit.org>
1509 Bug 15940: Implement threading API for Qt
1510 https://bugs.webkit.org/show_bug.cgi?id=15940
1512 Original patch by Justin Haygood, tweaked by me.
1514 * JavaScriptCore.pri:
1515 * wtf/ThreadingQt.cpp: Added.
1516 (WTF::threadMapMutex):
1518 (WTF::establishIdentifierForThread):
1519 (WTF::clearThreadForIdentifier):
1520 (WTF::threadForIdentifier):
1521 (WTF::initializeThreading):
1522 (WTF::ThreadPrivate::getReturnValue):
1523 (WTF::ThreadPrivate::ThreadPrivate):
1524 (WTF::ThreadPrivate::run):
1525 (WTF::createThread):
1526 (WTF::waitForThreadCompletion): return !res to return
1527 0 on success (to match the pthreads implementation).
1528 (WTF::detachThread):
1529 (WTF::identifierByQthreadHandle):
1530 (WTF::currentThread):
1531 (WTF::Mutex::Mutex):
1532 (WTF::Mutex::~Mutex):
1534 (WTF::Mutex::tryLock):
1535 (WTF::Mutex::unlock):
1536 (WTF::ThreadCondition::ThreadCondition):
1537 (WTF::ThreadCondition::~ThreadCondition):
1538 (WTF::ThreadCondition::wait):
1539 (WTF::ThreadCondition::timedWait):
1540 (WTF::ThreadCondition::signal):
1542 2008-04-22 Darin Adler <darin@apple.com>
1546 - simplify use of HashTraits to prepare for some upcoming hash table changes
1548 * kjs/SymbolTable.h: Made SymbolTableIndexHashTraits derive from HashTraits<size_t>
1549 and specialize only the empty value.
1551 2008-04-23 Holger Hans Peter Freyther <zecke@selfish.org>
1555 Removed the #define for USE_SYSTEM_MALLOC that we set in WebKit.pri
1560 2008-04-21 Kevin McCullough <kmccullough@apple.com>
1564 <rdar://problem/5770054> JavaScript profiler (10928)
1565 - When stop profiling is called we need to stop the timers on all the
1566 functions that are still running.
1568 * profiler/FunctionCallProfile.cpp:
1569 (KJS::FunctionCallProfile::didExecute):
1570 (KJS::FunctionCallProfile::stopProfiling):
1571 * profiler/FunctionCallProfile.h:
1572 * profiler/Profiler.cpp:
1573 (KJS::Profiler::stopProfiling):
1575 2008-04-21 Alexey Proskuryakov <ap@webkit.org>
1579 Move collector main thread initialization from WebKit/win to KJS::initializeThreading.
1581 * kjs/InitializeThreading.cpp:
1582 (KJS::initializeThreading):
1584 2008-04-21 Adam Roben <aroben@apple.com>
1588 Reviewed by Alexey Proskuryakov.
1591 (KJS::UString::cost): Disable a warning about assigning a 32-bit
1592 size_t into a 31-bit size_t.
1594 2008-04-21 Simon Hausmann <hausmann@webkit.org>
1598 Made convertValueToQVariant accessible from within WebKit/qt/Api
1600 * bindings/qt/qt_runtime.h:
1602 2008-04-21 Holger Hans Peter Freyther <holger.freyther@trolltech.com>
1606 Build fix for Qt 4.3
1608 * When building WebCore/internal make sure the QT_[BEGIN,END]_NAMESPACE is
1609 always defined. Do this by adding defines to the compiler line
1610 * For users of our API this is not feasible. Every public header file should
1611 include qwebkitglobal.h. Define the QT_BEGIN_NAMESPACE and QT_END_NAMESPACE
1612 when we are building everything < 4.4.0 and don't have them defined.
1616 2008-04-19 Matt Lilek <webkit@mattlilek.com>
1618 Not reviewed, Windows build fix - copy the profiler headers in all
1619 configurations, not just Debug_Internal.
1621 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1623 2008-04-19 Mike Hommey <glandium@debian.org>
1625 Reviewed by Alp Toker.
1627 Don't build testkjs with rpath.
1631 2008-04-18 Kevin Ollivier <kevino@theolliviers.com>
1633 wx build fixes. Rename LocalStorage.h to LocalStorageEntry.h
1634 to avoid header detection issues between WebCore/storage/LocalStorage.h
1635 and it, and add $(PROFILER_SOURCES) to the wx JSCore build.
1637 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1638 * JavaScriptCore.xcodeproj/project.pbxproj:
1641 * kjs/JSVariableObject.h:
1642 * kjs/LocalStorage.h: Removed.
1643 * kjs/LocalStorageEntry.h: Copied from JavaScriptCore/kjs/LocalStorage.h.
1646 2008-04-18 Jan Michael Alonzo <jmalonzo@unpluggable.com>
1648 Reviewed by Alp Toker.
1650 http://bugs.webkit.org/show_bug.cgi?id=16620
1651 [GTK] Autotools make dist and make check support
1657 2008-04-18 Jon Honeycutt <jhoneycutt@apple.com>
1659 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Windows
1662 2008-04-11 Mark Rowe <mrowe@apple.com>
1664 Rubber-stamped by Antti Koivisto.
1666 Silence GCC 4.3 warnings by removing extraneous consts.
1671 2008-04-18 Kevin McCullough <kmccullough@apple.com>
1675 -<rdar://problem/5770054> JavaScript profiler (10928)
1676 - Use Deque instead of Vector since the profiler uses prepend a lot
1677 and deque is faster at that.
1679 * profiler/FunctionCallProfile.h:
1680 (KJS::FunctionCallProfile::milliSecs): Corrected the name to match
1683 (WTF::deleteAllValues):
1685 2008-04-18 Kevin McCullough <kmccullough@apple.com>
1687 Reviewed by Sam and Adam.
1689 -<rdar://problem/5770054> JavaScript profiler (10928)
1690 - Cleaned up the header file and made some functions static, added
1691 a new, sane, printing function, and fixed a few minor bugs.
1693 * JavaScriptCore.exp:
1694 * JavaScriptCore.xcodeproj/project.pbxproj:
1695 * profiler/FunctionCallProfile.cpp:
1696 (KJS::FunctionCallProfile::didExecute): Removed assertion that time is
1697 > 0 because at ms resolution that may not be true and only cross-
1698 platform way to get time differences is in ms.
1699 (KJS::FunctionCallProfile::printDataInspectorStyle): Added a new
1700 printing function for dumping data in a sane style.
1701 (KJS::FunctionCallProfile::printDataSampleStyle): Fixed a bug where we
1702 displayed too much precision when printing our floats. Also added logic
1703 to make sure we don't display 0 because that doesn't make sense for a
1705 * profiler/FunctionCallProfile.h:
1706 * profiler/Profiler.cpp: Moved functions that could be static into the
1707 implementation, and chaned the ASSERTs to early returns. I did this
1708 because console.profile() is a JS function and so was being profiled
1709 but asserting because the profiler had not been started! In the future
1710 I would like to put the ASSERTs back and not profile the calls to
1711 console.profile() and console.profileEnd().
1712 (KJS::Profiler::willExecute):
1713 (KJS::Profiler::didExecute):
1714 (KJS::getStackNames): Fixed a bug where the wrong ExecState was being
1716 (KJS::getFunctionName):
1717 (KJS::Profiler::printDataInspectorStyle):
1718 * profiler/Profiler.h:
1720 2008-04-18 Alexey Proskuryakov <ap@webkit.org>
1724 Fix leaks during plugin tests (which actually excercise background JS), and potential
1725 PAC brokenness that was not reported, but very likely.
1727 The leaks shadowed a bigger problem with Identifier destruction. Identifier::remove involves
1728 an IdentifierTable lookup, which is now a per-thread instance. Since garbage collection can
1729 currently happen on a different thread than allocation, a wrong table was used.
1731 No measurable change on SunSpider total, ~1% variation on individual tests.
1735 (KJS::UString::Rep::create):
1736 (KJS::UString::Rep::destroy):
1738 Replaced isIdentifier with a pointer to IdentifierTable, so that destruction can be done
1739 correctly. Took one bit from reportedCost, to avoid making UString::Rep larger (performance
1740 effect was measurable on SunSpider).
1742 * kjs/identifier.cpp:
1743 (KJS::IdentifierTable::IdentifierTable):
1744 (KJS::IdentifierTable::~IdentifierTable):
1745 (KJS::IdentifierTable::add):
1746 (KJS::IdentifierTable::remove):
1747 Make IdentifierTable a real class. Its destructor needs to zero out outstanding references,
1748 because some identifiers may briefly outlive it during thread destruction, and we don't want
1749 them to use their stale pointers.
1751 (KJS::LiteralIdentifierTable):
1752 (KJS::Identifier::add):
1753 Now that LiteralIdentifierTable is per-thread and can be destroyed not just during application
1754 shutdown, it is not appropriate to simply bump refcount for strings that get there; changed
1755 the table to hold RefPtrs.
1757 (KJS::CStringTranslator::translate):
1758 (KJS::UCharBufferTranslator::translate):
1759 (KJS::Identifier::addSlowCase):
1760 (KJS::Identifier::remove):
1762 (KJS::Identifier::add):
1763 Use and update UString::Rep::identifierTable as appropriate. Updating it is now done in
1764 IdentifierTable::add, not in translators.
1766 2008-04-18 Alexey Proskuryakov <ap@webkit.org>
1770 Get rid of static compareWithCompareFunctionArguments in array_instance.cpp.
1772 No change on SunSpider, CelticKane or iBench JavaScript. It is probable that in some cases,
1773 merge sort is still faster, but more investigation is needed to determine a new cutoff.
1774 Or possibly, it would be better to do what FIXME says (change to tree sort).
1776 Also, made arguments a local variable - not sure why it was a member of
1777 CompareWithCompareFunctionArguments.
1779 * kjs/array_instance.cpp:
1780 (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
1781 (KJS::CompareWithCompareFunctionArguments::operator()):
1782 (KJS::ArrayInstance::sort):
1784 2008-04-18 Simon Hausmann <hausmann@webkit.org>
1786 Build fix for gcc 4.3. Include stdio.h for printf.
1788 * profiler/FunctionCallProfile.cpp:
1789 * profiler/Profiler.cpp:
1791 2008-04-17 Jon Honeycutt <jhoneycutt@apple.com>
1795 * wtf/Platform.h: Add HAVE_ACCESSIBILITY to Platform.h.
1797 2008-04-17 Alexey Proskuryakov <ap@webkit.org>
1801 Thread static data destructors are not guaranteed to be called in any particular order;
1802 turn ThreadSpecific into a phoenix-style singleton to avoid accessing freed memory when
1803 deleted objects are interdependent (e.g. CommonIdentifiers and internal identifier tables).
1805 No change on SunSpider.
1807 * wtf/ThreadSpecific.h:
1808 (WTF::ThreadSpecific::Data::Data):
1813 2008-04-15 Srinivas Rao. M Hamse <msrinirao@gmail.com>
1815 Reviewed by Maciej Stachowiak.
1819 * kjs/nodes.h: CallerType definition made public for gcc 3.x compilation
1821 2008-04-16 Brady Eidson <beidson@apple.com>
1823 Reviewed by Sam Weinig
1825 Change ThreadSafeShared to act like RefCounted by starting out with a single ref by default
1828 (WTF::ThreadSafeShared::ThreadSafeShared):
1830 2008-04-16 Sam Weinig <sam@webkit.org>
1832 Reviewed by Geoffrey Garen.
1834 - To keep the behavior of the WebKit and JavaScriptCore API's the same,
1835 we need to hide the fact that the global object and the window object
1836 are no longer the same thing, and the the global object now changes on
1837 navigations. To do this, only the wrapper should ever be exposed. This
1838 fixes the two remaining spots where the internal global object is exposed,
1839 the windowScriptObject returned from [WebFrame windowObject] and the object
1840 return by calling JSContextGetGlobalObject on [WebFrame globalContext].
1842 * API/JSContextRef.cpp:
1843 (JSContextGetGlobalObject):
1844 This is a bit of a hack, this returns the "this" representation of the globalObject
1845 which will be the WrapperWindow for WebCore and the globalObject for non-WebCore.
1847 * API/JSObjectRef.cpp:
1848 (JSObjectSetProperty):
1849 Call the new putWithAttributes method instead of relying on lower-level calls.
1850 This is needed so that the window wrapper can forward the calls.
1852 * JavaScriptCore.exp:
1854 * kjs/JSGlobalObject.cpp:
1855 (KJS::JSGlobalObject::putWithAttributes):
1856 * kjs/JSGlobalObject.h:
1857 * kjs/JSVariableObject.h:
1858 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1860 (KJS::ActivationImp::putWithAttributes):
1862 (KJS::ConstDeclNode::handleSlowCase):
1863 (KJS::ConstDeclNode::evaluateSingle):
1864 (KJS::EvalNode::processDeclarations):
1866 (KJS::JSObject::putWithAttributes):
1868 Rename initializeVariable to putWithAttributes and move it down to JSObject so it
1869 can be used for JSObjectSetProperty.
1871 2008-04-16 Kevin McCullough <kmccullough@apple.com>
1873 Reviewed by Sam and Geoff.
1875 -<rdar://problem/5770054> JavaScript profiler (10928)
1876 Inital profiler prototype
1878 * GNUmakefile.am: Added new files to project
1879 * JavaScriptCore.pri: Ditto
1880 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto
1881 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto
1882 * JavaScriptCoreSources.bkl: Ditto
1883 * kjs/config.h: Put compiling flag in here.
1884 * kjs/function.cpp: Instrument calling the function eval().
1886 * kjs/interpreter.cpp: Instrument evaluating global scopes.
1887 (KJS::Interpreter::evaluate):
1888 * kjs/object.cpp: Instrument JS function calls.
1889 (KJS::JSObject::call):
1891 * profiler/FunctionCallProfile.cpp: Added.
1892 (KJS::FunctionCallProfile::FunctionCallProfile):
1893 (KJS::FunctionCallProfile::~FunctionCallProfile):
1894 (KJS::FunctionCallProfile::willExecute): Call right before the JS function or executing context is executed to start the profiler's timer.
1895 (KJS::FunctionCallProfile::didExecute): Call right after the JS function or executing context is executed to stop the profiler's timer.
1896 (KJS::FunctionCallProfile::addChild): Add a child to the current FunctionCallProfile if it isn't already a child of the current FunctionalCallProfile.
1897 (KJS::FunctionCallProfile::findChild): Return the child that matches the given name if there is one.
1898 (KJS::FunctionCallProfile::printDataSampleStyle): Print the current profiled information in a format that matches sample's output.
1899 * profiler/FunctionCallProfile.h: Added.
1900 (KJS::FunctionCallProfile::FunctionCallProfile):
1901 (KJS::FunctionCallProfile::~FunctionCallProfile):
1902 (KJS::FunctionCallProfile::functionName):
1903 (KJS::FunctionCallProfile::microSecs):
1904 * profiler/Profiler.cpp: Added.
1905 (KJS::Profiler::profiler):
1906 (KJS::Profiler::sharedProfiler): Return global singleton (may change due to multi-threading concerns)
1907 (KJS::Profiler::startProfiling): Don't start collecting profiling information until the user starts the profiler. Also don't clear old prfiled data until the profiler is restarted.
1908 (KJS::Profiler::stopProfiling): Stop collecting profile information.
1909 (KJS::Profiler::willExecute): Same as above.
1910 (KJS::Profiler::didExecute): Same as above.
1911 (KJS::Profiler::insertStackNamesInTree): Follow the stack of the given names and if a sub-stack is not in the current tree, add it.
1912 (KJS::Profiler::getStackNames): Get the names from the different passed in parameters and order them as a stack.
1913 (KJS::Profiler::getFunctionName): Get the function name from the given parameter.
1914 (KJS::Profiler::printDataSampleStyle): Print the current profiled information in a format that matches sample's output.
1915 (KJS::Profiler::debugLog):
1916 * profiler/Profiler.h: Added.
1917 (KJS::Profiler::Profiler):
1919 2008-04-16 Sam Weinig <sam@webkit.org>
1921 Reviewed by Darin Adler.
1923 - Remove kjs_ prefix from strtod, dtoa, and freedtoa and put it
1924 in the KJS namespace.
1925 - Make strtod, dtoa, and freedtoa c++ functions instead of extern "C".
1926 - Remove mode switching from dtoa. ~2% improvement on test 26.
1927 - Removes all unnecessary #defines from dtoa code.
1929 * JavaScriptCore.exp:
1944 * kjs/number_object.cpp:
1945 (KJS::integer_part_noexp):
1946 (KJS::numberProtoFuncToExponential):
1948 (KJS::UString::from):
1949 (KJS::UString::toDouble):
1951 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
1955 Get rid of static execForCompareByStringForQSort in array_instance.cpp.
1957 No change on SunSpider, CelticKane or iBench JavaScript.
1959 * kjs/array_instance.cpp:
1960 (KJS::ArraySortComparator::ArraySortComparator):
1961 (KJS::ArraySortComparator::operator()):
1962 (KJS::ArrayInstance::sort):
1963 Switch slow case to std::sort, so that ExecState can be passed in a comparator.
1965 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
1967 Reviewed by Adam Roben.
1971 * kjs/CommonIdentifiers.cpp:
1972 * kjs/CommonIdentifiers.h:
1975 * kjs/identifier.cpp:
1977 * wtf/ThreadSpecific.h:
1979 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
1983 * kjs/date_object.cpp:
1984 * kjs/date_object.h:
1985 Don't include DateMath.h from date_object.h, as the latter is used from WebCore, while
1986 where the former is not available.
1988 2008-04-16 Holger Hans Peter Freyther <zecke@selfish.org>
1990 Unreviewed build fix for MSVC. It does not want to have
1991 WTF in the KJS namespace.
1993 * kjs/CommonIdentifiers.h:
1995 2008-04-16 Holger Hans Peter Freyther <zecke@selfish.org>
1997 Unreviewed build fix for gcc.
1999 ::msToGregorianDateTime is not known to it.
2001 * kjs/date_object.cpp:
2002 (KJS::DateInstance::msToGregorianDateTime):
2004 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
2006 Reviewed by Oliver Hunt.
2008 Initialize threadMapMutex safely (as already done in ThreadingWin).
2010 * wtf/ThreadingGtk.cpp:
2011 (WTF::threadMapMutex):
2012 (WTF::initializeThreading):
2013 * wtf/ThreadingPthreads.cpp:
2014 (WTF::threadMapMutex):
2015 (WTF::initializeThreading):
2017 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
2019 Reviewed by Adam Roben.
2021 Cache Gregorian date/time structure on DateInstance objects for 1.027x SunSpider speedup
2022 (1.65x on date-format-xparb, 1.13x on date-format-tofte).
2025 (KJS::GregorianDateTime::copyFrom): Added. It presumably makes sense to keep GregorianDateTime
2026 Noncopyable, so it's not just operator=.
2028 * kjs/date_object.h: Added a per-object cache.
2030 * kjs/date_object.cpp:
2031 (KJS::DateInstance::DateInstance):
2032 (KJS::DateInstance::msToGregorianDateTime):
2033 (KJS::dateProtoFuncToString):
2034 (KJS::dateProtoFuncToUTCString):
2035 (KJS::dateProtoFuncToDateString):
2036 (KJS::dateProtoFuncToTimeString):
2037 (KJS::dateProtoFuncToLocaleString):
2038 (KJS::dateProtoFuncToLocaleDateString):
2039 (KJS::dateProtoFuncToLocaleTimeString):
2040 (KJS::dateProtoFuncGetFullYear):
2041 (KJS::dateProtoFuncGetUTCFullYear):
2042 (KJS::dateProtoFuncToGMTString):
2043 (KJS::dateProtoFuncGetMonth):
2044 (KJS::dateProtoFuncGetUTCMonth):
2045 (KJS::dateProtoFuncGetDate):
2046 (KJS::dateProtoFuncGetUTCDate):
2047 (KJS::dateProtoFuncGetDay):
2048 (KJS::dateProtoFuncGetUTCDay):
2049 (KJS::dateProtoFuncGetHours):
2050 (KJS::dateProtoFuncGetUTCHours):
2051 (KJS::dateProtoFuncGetMinutes):
2052 (KJS::dateProtoFuncGetUTCMinutes):
2053 (KJS::dateProtoFuncGetSeconds):
2054 (KJS::dateProtoFuncGetUTCSeconds):
2055 (KJS::dateProtoFuncGetTimezoneOffset):
2056 (KJS::setNewValueFromTimeArgs):
2057 (KJS::setNewValueFromDateArgs):
2058 (KJS::dateProtoFuncSetYear):
2059 (KJS::dateProtoFuncGetYear):
2060 Use the cache when converting.
2062 2008-04-16 Alexey Proskuryakov <ap@webkit.org>
2066 Implement an abstraction for thread-specific storage, use it to get rid of some static objects.
2068 SunSpider results were not conclusive, possibly up to 0.2% slowdown.
2070 * JavaScriptCore.xcodeproj/project.pbxproj:
2071 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
2072 Added ThreadSpecific.h
2074 * wtf/ThreadSpecific.h: Added.
2075 (WTF::::ThreadSpecific):
2076 (WTF::::~ThreadSpecific):
2082 Only implemented for platforms that use pthreads.
2084 * kjs/CommonIdentifiers.cpp:
2085 (KJS::CommonIdentifiers::shared):
2086 * kjs/CommonIdentifiers.h:
2087 * kjs/InitializeThreading.cpp:
2088 (KJS::initializeThreading):
2092 * kjs/identifier.cpp:
2093 (KJS::identifierTable):
2094 (KJS::literalIdentifierTable):
2095 (KJS::Identifier::initializeIdentifierThreading):
2100 Make static instances per-thread.
2102 2008-04-15 Anders Carlsson <andersca@apple.com>
2106 Add ENABLE_OFFLINE_WEB_APPLICATIONS to FEATURE_DEFINES.
2108 * Configurations/JavaScriptCore.xcconfig:
2110 2008-04-15 Andre Poenitz <andre.poenitz@trolltech.com>
2114 Fix compilation with Qt namespaces
2116 Qt can be configured to have all of its classes inside a specified namespaces.
2117 This is for example used in plugin/component environments like Eclipse.
2119 This change makes it possible to let the Qt port compile against a namespaced
2120 Qt by the use of macros Qt provides to properly forward declare Qt classes in
2123 * wtf/unicode/qt4/UnicodeQt4.h:
2125 2008-04-14 Anders Carlsson <andersca@apple.com>
2129 Don't leak the prototype class.
2131 * API/JSClassRef.cpp:
2132 (OpaqueJSClass::create):
2134 2008-04-14 Steve Falkenburg <sfalken@apple.com>
2138 * wtf/ThreadingWin.cpp:
2140 2008-04-14 Alexey Proskuryakov <ap@webkit.org>
2142 Reviewed by Adam Roben.
2144 https://bugs.webkit.org/show_bug.cgi?id=18488
2145 FastMalloc doesn't release thread-specific data on Windows
2147 * wtf/ThreadingWin.cpp:
2148 (WTF::threadMapMutex): (WTF::initializeThreading): Call threadMapMutex once to initialize the static safely.
2149 (WTF::ThreadFunctionInvocation::ThreadFunctionInvocation): Added a structure to wrap thread entry point and arguments.
2150 (WTF::wtfThreadEntryPoint): Make sure to end all WTF threads with pthread_exit(), to give pthreads-win32 a chance to call
2151 destructors of thread-specific data.
2152 (WTF::createThread): Use _beginthreadex instead of CreateThread, because MSDN says so. Also removed a call to CreateEvent,
2153 for which I could see no reason at all.
2155 2008-04-14 Alexey Proskuryakov <ap@webkit.org>
2157 Touched a file to make JavaScriptCore.vcproj rebuild.
2161 2008-04-14 Adam Roben <aroben@apple.com>
2165 Rubberstamped by Alexey Proskuryakov.
2167 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
2168 the "potentially uninitialized variable" warning for grammar.cpp, as
2169 it seems to be incorrect. yylval gets initialized by the lexer, but
2170 MSVC doesn't seem to understand this.
2172 2008-04-11 Antti Koivisto <antti@apple.com>
2176 Add default hash for pairs of hashable types.
2178 * wtf/HashFunctions.h:
2179 (WTF::PairHash::hash):
2180 (WTF::PairHash::equal):
2183 2008-04-11 Alexey Proskuryakov <ap@webkit.org>
2187 Make DateMath.cpp thread safe.
2189 No measurable change on SunSpider (should be a very small speedup).
2192 (KJS::mimimumYearForDST): (KJS::equivalentYearForDST): Got rid of double caching of the
2193 same precomputed value.
2194 (KJS::calculateUTCOffset): (KJS::getUTCOffset): Factored actual UTC offset calculation code
2195 out of getUTCOffset(), and notification setup into initDateMath().
2197 (KJS::initDateMath): Added.
2200 * kjs/InitializeThreading.cpp:
2201 (KJS::initializeThreading):
2202 Added initDateMath().
2204 2008-04-11 Alexey Proskuryakov <ap@webkit.org>
2210 2008-04-11 Alexey Proskuryakov <ap@webkit.org>
2212 Tiger build fix. Forward declaring a union didn't work for whatever reason, make the
2221 2008-04-11 Alexey Proskuryakov <ap@webkit.org>
2225 Generate a pure (re-entrant) parser with Bison.
2227 No change on SunSpider.
2230 (KJS::Parser::parse):
2236 Pass state as function arguments, instead of global data. Don't call lexer() as often as
2237 before, as this function is about to become slower due to thread-specific storage.
2240 (KJS::isStrWhiteSpace): Don't call isSeparatorSpace() for 8-bit characters, as these are
2241 already taken care of. This is a small speedup, compensating for a small slowdown caused
2242 by switching Bison mode.
2244 2008-04-10 Alexey Proskuryakov <ap@webkit.org>
2248 https://bugs.webkit.org/show_bug.cgi?id=18402
2249 REGRESSION: visited element handling is incorrect in nested join/toString calls
2251 No change on SunSpider total, possibly a tiny improvement (about 0.1%).
2253 Test: fast/js/array-tostring-and-join.html
2255 * kjs/JSGlobalObject.h:
2256 (KJS::JSGlobalObject::visitedElements): Store visited elements HashSet here, making it
2257 common to toString/toLocalizedString/join again.
2259 * kjs/array_object.cpp:
2260 (KJS::arrayProtoFuncToString):
2261 (KJS::arrayProtoFuncToLocaleString):
2262 (KJS::arrayProtoFuncJoin):
2263 Got rid of static variables. Replaced UString with Vector to avoid O(n^2) behavior and
2269 (WTF::::reserveCapacity):
2272 Added null checks, so that Vector methods don't crash when out of memory. The caller should
2273 check that data pointer is not null before proceeding.
2275 2008-04-10 Mark Rowe <mrowe@apple.com>
2277 Reviewed by Maciej Stachowiak.
2279 Fix https://bugs.webkit.org/show_bug.cgi?id=18367 and the many dupes.
2280 Bug 18367: Crash during celtic kane js speed 2007 test
2282 GCC 4.2 on x86_64 Linux decided to reorder the local variables in markCurrentThreadConservatively's
2283 stack frame. This lead to the range of addresses the collector treated as stack to exclude the
2284 contents of volatile registers that markCurrentThreadConservatively forces onto the stack. This was
2285 leading to objects being prematurely collected if the only reference to them was via a register at
2286 the time a collection occurred.
2288 The fix for this is to move the calculation of the top of the stack into a NEVER_INLINE function
2289 that is called from markCurrentThreadConservatively. This forces the dummy variable we use for
2290 determining the top of stack to be in a different stack frame which prevents the compiler from
2291 reordering it relative to the registers that markCurrentThreadConservatively forces onto the stack.
2293 * kjs/collector.cpp:
2294 (KJS::Collector::markCurrentThreadConservativelyInternal):
2295 (KJS::Collector::markCurrentThreadConservatively):
2298 2008-04-10 Adam Roben <aroben@apple.com>
2300 VC++ Express build fix
2302 * JavaScriptCore.vcproj/WTF/WTF.vcproj: Link against user32.lib so
2303 that anyone who links against WTF.lib will get user32.lib
2306 2008-04-09 Adam Roben <aroben@apple.com>
2308 VC++ Express build fix
2310 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Link against
2313 2008-04-09 Adam Roben <aroben@apple.com>
2317 * JavaScriptCore.exp: Export isMainThread.
2319 2008-04-09 Adam Roben <aroben@apple.com>
2323 * wtf/AlwaysInline.h: Make sure to #include Platform.h before using
2324 the macros it defines.
2326 2008-04-08 Mark Rowe <mrowe@apple.com>
2328 Export WTF::initializeThreading() from JavaScriptCore.
2330 * JavaScriptCore.exp:
2332 2008-04-04 Sam Weinig <sam@webkit.org>
2334 Reviewed by Geoffrey Garen.
2336 First step in implementing the "split window"
2338 - Add a GlobalThisValue to ExecState which should be used
2339 in places that used to implement the "use the global object
2340 as this if null" rule.
2341 - Factor out lookupGetter/lookupSetter into virtual methods
2342 on JSObject so that they can be forwarded.
2343 - Make defineGetter/defineSetter virtual methods for the same
2345 - Have PrototypeReflexiveFunction store the globalObject used
2346 to create it so that it can be used to get the correct thisObject
2349 * API/JSObjectRef.cpp:
2350 (JSObjectCallAsFunction):
2351 * JavaScriptCore.exp:
2353 * kjs/ExecState.cpp:
2354 (KJS::ExecState::ExecState):
2355 (KJS::GlobalExecState::GlobalExecState):
2357 (KJS::ExecState::globalThisValue):
2358 * kjs/ExecStateInlines.h:
2359 (KJS::ExecState::ExecState):
2360 (KJS::FunctionExecState::FunctionExecState):
2361 * kjs/JSGlobalObject.cpp:
2362 (KJS::JSGlobalObject::reset):
2363 (KJS::JSGlobalObject::toGlobalObject):
2364 * kjs/JSGlobalObject.h:
2365 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
2366 (KJS::JSGlobalObject::JSGlobalObject):
2367 * kjs/array_instance.cpp:
2368 (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
2369 (KJS::compareWithCompareFunctionForQSort):
2370 * kjs/array_object.cpp:
2371 (KJS::arrayProtoFuncSort):
2372 (KJS::arrayProtoFuncFilter):
2373 (KJS::arrayProtoFuncMap):
2374 (KJS::arrayProtoFuncEvery):
2375 (KJS::arrayProtoFuncForEach):
2376 (KJS::arrayProtoFuncSome):
2378 (KJS::FunctionImp::callAsFunction):
2379 (KJS::ActivationImp::toThisObject):
2380 (KJS::globalFuncEval):
2381 (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
2382 (KJS::PrototypeReflexiveFunction::mark):
2384 (KJS::PrototypeReflexiveFunction::cachedGlobalObject):
2385 * kjs/function_object.cpp:
2386 (KJS::functionProtoFuncApply):
2387 (KJS::functionProtoFuncCall):
2389 (KJS::ExpressionNode::resolveAndCall):
2390 (KJS::FunctionCallValueNode::evaluate):
2391 (KJS::LocalVarFunctionCallNode::inlineEvaluate):
2392 (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
2393 (KJS::FunctionCallBracketNode::evaluate):
2394 (KJS::FunctionCallDotNode::inlineEvaluate):
2396 (KJS::JSObject::call):
2397 (KJS::JSObject::put):
2398 (KJS::tryGetAndCallProperty):
2399 (KJS::JSObject::lookupGetter):
2400 (KJS::JSObject::lookupSetter):
2401 (KJS::JSObject::toThisObject):
2402 (KJS::JSObject::toGlobalObject):
2403 (KJS::JSObject::fillGetterPropertySlot):
2405 * kjs/object_object.cpp:
2406 (KJS::objectProtoFuncLookupGetter):
2407 (KJS::objectProtoFuncLookupSetter):
2408 * kjs/string_object.cpp:
2411 2008-04-08 Brady Eidson <beidson@apple.com>
2413 Encourage Windows to rebuild - AGAIN...
2417 2008-04-08 Adam Roben <aroben@apple.com>
2421 * JavaScriptCore.exp: Add callOnMainThread, and sorted the list.
2423 2008-04-08 Brady Eidson <beidson@apple.com>
2425 Rubberstamped by Adam Roben
2427 Touch some files to *strongly* encourage Windows to rebuilt with DOM_STORAGE enabled
2431 2008-04-08 Adam Roben <aroben@apple.com>
2433 Move callOnMainThread to WTF
2435 Reviewed by Alexey Proskuryakov.
2438 * JavaScriptCore.pri:
2439 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
2440 * JavaScriptCore.xcodeproj/project.pbxproj:
2441 * JavaScriptCoreSources.bkl:
2444 * wtf/MainThread.cpp:
2446 * wtf/gtk/MainThreadGtk.cpp:
2447 * wtf/mac/MainThreadMac.mm:
2448 * wtf/qt/MainThreadQt.cpp:
2449 * wtf/win/MainThreadWin.cpp:
2450 * wtf/wx/MainThreadWx.cpp:
2451 Moved here from WebCore/platform. Replaced all instances of "WebCore"
2454 * kjs/bool_object.cpp: Touched to force JavaScriptCore.vcproj to
2456 to the WTF namespace.
2457 * wtf/ThreadingWin.cpp:
2458 (WTF::initializeThreading): Call initializeMainThread.
2460 2008-04-07 Brady Eidson <beidson@apple.com>
2462 Add "ENABLE_DOM_STORAGE" to keep in sync with the rest of the project
2464 * Configurations/JavaScriptCore.xcconfig:
2466 2008-04-07 Adam Roben <aroben@apple.com>
2470 * wtf/ThreadingWin.cpp: Back out some changes I didn't mean to land.
2472 2008-04-07 Adam Roben <aroben@apple.com>
2474 Add WTF::isMainThread
2476 Reviewed by Alexey Proskuryakov.
2478 * wtf/Threading.h: Declare the new function.
2479 * wtf/ThreadingGtk.cpp:
2480 (WTF::initializeThreading): Initialize the main thread identifier.
2481 (WTF::isMainThread): Added.
2482 * wtf/ThreadingNone.cpp: Ditto ThreadingGtk.cpp.
2483 (WTF::initializeThreading):
2484 (WTF::isMainThread):
2485 * wtf/ThreadingPthreads.cpp: Ditto.
2486 (WTF::initializeThreading):
2487 (WTF::isMainThread):
2488 * wtf/ThreadingWin.cpp: Ditto.
2489 (WTF::initializeThreading):
2490 (WTF::isMainThread):
2492 2008-04-06 Alexey Proskuryakov <ap@webkit.org>
2496 Make UString thread-safe.
2498 No change on SunSpider total, although individual tests have changed a lot, up to 3%.
2500 * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Call UString::null() to initialize
2503 * kjs/identifier.cpp:
2504 (KJS::CStringTranslator::translate):
2505 (KJS::UCharBufferTranslator::translate):
2506 Use "true" for a boolean value instead of 1, because it's C++.
2509 (KJS::CString::adopt): Added a method to create from a char* buffer without copying.
2510 (KJS::UString::Rep::ref): Removed an assertion for JSLock::lockCount, as it's no longer
2511 necessary to hold JSLock when working with strings.
2512 (KJS::UString::Rep::deref): Ditto.
2513 (KJS::UString::Rep::isStatic): Added a field to quickly determine that this is an empty
2514 or null static string.
2517 (KJS::): Removed normalStatBufferSize and statBufferSize, as there is no reason to have such
2518 an advanced implementation of a debug-only ascii() method. Removed a long-obsolete comment
2520 (KJS::UString::Rep::createCopying): Removed an assertion for JSLock::lockCount.
2521 (KJS::UString::Rep::create): Ditto.
2522 (KJS::UString::Rep::destroy): Ditto. Do not do anything for static null and empty strings,
2523 as refcounting is not reliable for those. Reordered branches for a noticeable speed gain -
2524 apparently this functiton is hot enough for SunSpider to see an effect from this!
2525 (KJS::UString::null): Moved a star, added a comment.
2526 (KJS::UString::cstring): Reimplemented to not call ascii(), which is not thread-safe.
2527 (KJS::UString::ascii): Simplified statBuffer handling logic.
2528 (KJS::UString::toDouble): Use cstring() instead of ascii().
2530 2008-04-02 Mark Rowe <mrowe@apple.com>
2532 Reviewed by Oliver Hunt.
2534 Ensure that debug symbols are generated for x86_64 and ppc64 builds.
2536 * Configurations/Base.xcconfig:
2538 2008-04-01 Christian Dywan <christian@imendio.com>
2540 Build fix for GCC 4.3.
2542 * wtf/unicode/icu/CollatorICU.cpp: include string.h
2544 2008-04-01 Alexey Proskuryakov <ap@webkit.org>
2546 Rubber-stamped by Darin.
2548 Turn off using 64-bit arithmetic on 32-bit hardware, as dtoa own code is faster than
2549 compiler-provided emulation.
2551 1% speedup on Acid3 test 26.
2555 2008-04-01 Alexey Proskuryakov <ap@webkit.org>
2559 Make MathExtras.h thread safe.
2561 * kjs/math_object.cpp:
2562 (KJS::mathProtoFuncRandom): If threading is enabled, rely on initializeThreading to call
2566 * wtf/ThreadingGtk.cpp:
2567 (WTF::initializeThreading):
2568 * wtf/ThreadingNone.cpp:
2569 (WTF::initializeThreading):
2570 * wtf/ThreadingPthreads.cpp:
2571 (WTF::initializeThreading):
2572 * wtf/ThreadingWin.cpp:
2573 (WTF::initializeThreading):
2574 Call wtf_random_init(); made the function non-inline to avoid having to include too many
2575 headers in Threading.h.
2577 2008-03-31 Eric Seidel <eric@webkit.org>
2581 Make matching of regexps using ^ much faster
2582 http://bugs.webkit.org/show_bug.cgi?id=18086
2584 * pcre/pcre_compile.cpp:
2586 (branchNeedsLineStart):
2587 * pcre/pcre_exec.cpp:
2590 * pcre/pcre_internal.h:
2592 2008-03-29 Alexey Proskuryakov <ap@webkit.org>
2594 Reviewed by Oliver Hunt.
2596 <rdar://problem/5829556> REGRESSION: Leak in KJS::initializeThreading()
2598 * kjs/InitializeThreading.cpp: (KJS::initializeThreading): There is no guarantee that
2599 initializeThreading() is called only once; check that the mutex hasn't been already allocated.
2601 2008-03-29 Oliver Hunt <oliver@apple.com>
2605 Bug 17924: Crash in KJS::ConstDeclNode::evaluate with |with| and |const|
2606 <http://bugs.webkit.org/show_bug.cgi?id=17924>
2607 <rdar://problem/5806933>
2609 It turns out this is trivially avoidable if we just match firefox's
2610 semantics and ensure that an assignment in a const declaration always
2611 writes to the variable object.
2614 (KJS::ConstDeclNode::handleSlowCase):
2616 2008-03-28 Alexey Proskuryakov <ap@webkit.org>
2618 Reviewed by Sam Weinig.
2620 Fix a dtoa thread safety issue.
2622 WebCore can call kjs_strtod without holding JS lock, but we didn't have thread safety
2623 compiled in for dtoa.
2625 This is a 0.5% regression on SunSpider, which Sam Weinig has volunteered to cover with
2626 his recent improvement.
2631 Changed to use fastMalloc/fastDelete - they are much faster than the dtoa custom version was
2632 in the presence of locking (but somewhat slower in single-threaded case).
2633 (Bigint::pow5mult): Got rid of the dreaded double-checked locking anti-pattern (had to
2634 restructure the code to avoid significant performance implications).
2635 (Bigint::lshift): Rewrote to avoid an allocation, if possible.
2638 (Bigint::kjs_freedtoa):
2640 Check for USE(MULTIPLE_THREADS), not dtoa legacy MULTIPLE_THREADS.
2642 * kjs/InitializeThreading.cpp: Added.
2643 (KJS::initializeThreading):
2644 * kjs/InitializeThreading.h: Added.
2645 Initialize threading at KJS level, if enabled.
2647 * kjs/dtoa.h: Expose dtoa mutex for KJS::initializeThreading.
2649 * kjs/testkjs.cpp: (kjsmain): Call initializeThreading.
2651 * JavaScriptCore.exp: Export KJS::initializeThreading.
2654 * JavaScriptCore.exp:
2655 * JavaScriptCore.pri:
2656 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2657 * JavaScriptCoreSources.bkl:
2658 * JavaScriptCore.xcodeproj/project.pbxproj:
2659 Added InitializeThreading.{h,cpp}.
2661 * wtf/Threading.h: Removed a using directive for WTF::initializeThreading - it is only
2662 to be called from KJS::initializeThreading, and having it in the global namespace is useless.
2664 2008-03-28 Brady Eidson <beidson@apple.com>
2668 Export Unicode/UTF8.h and convertUTF16ToUTF8() for more flexible conversion in WebCore
2670 * JavaScriptCore.exp:
2671 * JavaScriptCore.xcodeproj/project.pbxproj:
2673 2008-03-27 Darin Adler <darin@apple.com>
2675 Reviewed by Mark Rowe.
2677 <rdar://problem/5826236> Regular expressions with large nested repetition counts can have their
2678 compiled length calculated incorrectly.
2680 * pcre/pcre_compile.cpp:
2681 (multiplyWithOverflowCheck):
2682 (calculateCompiledPatternLength): Check for overflow when dealing with nested repetition counts
2683 and bail with an error rather than returning incorrect results.
2685 2008-03-26 Mark Rowe <mrowe@apple.com>
2687 Rubber-stamped by Brady Eidson.
2689 Update FEATURE_DEFINES to be consistent with the other locations in which it is defined.
2691 * Configurations/JavaScriptCore.xcconfig:
2693 2008-03-26 Adam Roben <aroben@apple.com>
2695 Fix Bug 18060: Assertion failure (JSLock not held) beneath
2696 JSCallbackObject<Base>::toString
2698 <http://bugs.webkit.org/show_bug.cgi?id=18060>
2700 Reviewed by Geoff Garen.
2704 * API/JSCallbackObjectFunctions.h:
2705 (KJS::JSCallbackObject<Base>::toString): Make the DropAllLocks
2706 instance only be in scope while calling convertToType.
2711 (MyObject_convertToType): Implement type conversion to string.
2712 * API/testapi.js: Add a test for type conversion to string.
2714 2008-03-26 Adam Roben <aroben@apple.com>
2718 * kjs/array_instance.cpp: Touched this.
2719 * wtf/HashFunctions.h:
2720 (WTF::intHash): Added 8- and 16-bit versions of intHash.
2722 2008-03-26 Adam Roben <aroben@apple.com>
2724 Force JSC headers to be copied by touching a file
2726 * kjs/array_instance.cpp:
2727 (KJS::ArrayInstance::getPropertyNames):
2729 2008-03-26 Adam Roben <aroben@apple.com>
2731 Windows build fix after r31324
2735 Added HashTable plumbing to support using wchar_t as a key type.
2737 * wtf/HashFunctions.h:
2741 2008-03-26 Maciej Stachowiak <mjs@apple.com>
2745 - JSC part of fix for "SVG multichar glyph matching matches longest instead of first (affects Acid3 test 79)"
2746 http://bugs.webkit.org/show_bug.cgi?id=18118
2748 * wtf/HashFunctions.h:
2753 2008-03-26 Alexey Proskuryakov <ap@webkit.org>
2757 Cache C string identifiers by address, not value, assuming that C strings can only
2760 1% speedup on Acid3 test 26.
2762 * kjs/identifier.cpp:
2763 (KJS::literalIdentifierTable):
2764 (KJS::Identifier::add):
2765 Added a new table to cache UString::Reps created from C strings by address. Elements are
2766 never removed from this cache, as only predefined identifiers can get there.
2769 (KJS::Identifier::Identifier): Added a warning.
2771 2008-03-26 Alexey Proskuryakov <ap@webkit.org>
2773 Rubber-stamped by Maciej.
2775 An assertion was failing in function-toString-object-literals.html when parsing 1e-500.
2776 The condition existed before, and got uncovered by turning compiled-out dtoa checks into
2779 The assertion was verifying that the caller wasn't constructing a Bigint from 0.
2780 This might have had some reason behind it originally, but I couldn't find any,
2781 and this doesn't look like a reasonable requirement.
2783 * kjs/dtoa.cpp: (d2b): Removed the assertion (two copies in different code paths).
2785 2008-03-25 Adam Roben <aroben@apple.com>
2787 Fix Bug 18077: Integrate testapi.c into the Windows build
2789 <http://bugs.webkit.org/show_bug.cgi?id=18077>
2791 Reviewed by Steve Falkenburg.
2793 * JavaScriptCore.vcproj/testapi/testapi.vcproj: Added.
2795 2008-03-25 Adam Roben <aroben@apple.com>
2797 Make testapi.c compile under MSVC
2799 Currently you must compile testapi.c as C++ code since MSVC does not
2800 support many C features that GCC does.
2802 Reviewed by Steve Falkenburg.
2805 (nan): Added an implementation of this for MSVC.
2806 (assertEqualsAsUTF8String): Use malloc instead of dynamically-sized
2808 (assertEqualsAsCharactersPtr): Ditto.
2809 (print_callAsFunction): Ditto.
2810 (main): Ditto, and explicitly cast from UniChar* to JSChar*.
2812 2008-03-25 Adam Roben <aroben@apple.com>
2814 Stop using JavaScriptCore's custom stdbool.h and stdint.h on Windows
2816 We can't remove the os-win32 directory yet because other ports (at
2817 least wx) are still relying on it.
2819 Reviewed by Steve Falkenburg.
2821 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2822 - Made all the include paths match the one for the Debug
2823 configuration (these got out of sync in r30797)
2824 - Removed os-win32 from the include path
2825 - Removed os-win32 from the directories we copy to $WebKitOutputDir.
2826 - Removed stdint.h from the project
2827 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
2828 Delete the files that we may have previously copied from the os-win32
2831 2008-03-25 Alexey Proskuryakov <ap@webkit.org>
2835 * kjs/dtoa.cpp: Include stdint.h.
2837 2008-03-25 Alexey Proskuryakov <ap@webkit.org>
2839 Rubber-stamped by Darin.
2841 Cleanup dtoa.cpp style.
2863 (Bigint::kjs_strtod):
2866 (Bigint::nrv_alloc):
2867 (Bigint::kjs_freedtoa):
2871 2008-03-24 Darin Adler <darin@apple.com>
2875 - convert a JavaScript immediate number to a string more efficiently
2877 2% speedup of Acid3 test 26
2879 * kjs/JSImmediate.cpp:
2880 (KJS::JSImmediate::toString): Take advantage of the fact that all immediate
2881 numbers are integers, and use the faster UString function for formatting integers
2882 instead of the slower one that works for floating point. I think this is a leftover
2883 from when immediate numbers were floating point.
2885 2008-03-23 Sam Weinig <sam@webkit.org>
2887 Reviewed by Darin Adler.
2889 Fix http://bugs.webkit.org/show_bug.cgi?id=18048
2890 The "thisObject" parameter to JSEvaluateScript is not used properly
2892 Making passing a thisObject to JSEvaluateScript actually set the thisObject of the created
2896 (main): Add tests for setting the thisObject when calling JSEvaluateScript.
2898 * kjs/ExecState.cpp:
2899 (KJS::ExecState::ExecState): Assign the thisObject to m_thisValue and remove the comment.
2901 2008-03-22 Jesse Ruderman <jruderman@gmail.com>
2903 Reviewed by Sam Weinig. Landed by eseidel.
2905 Make testkjs flush stdout after printing.
2907 * JavaScriptCore.xcodeproj/project.pbxproj:
2911 2008-03-21 Oliver Hunt <oliver@apple.com>
2915 Optimise lookup of Math, undefined, NaN and Infinity
2917 Added a method to JSVariableObject to allow us to inject DontDelete properties
2918 into the symbol table and localStorage. This results in a 0.4% progression in
2919 SunSpider, with a 8% gain in math-partial-sums.
2921 * kjs/JSGlobalObject.cpp:
2922 (KJS::JSGlobalObject::reset):
2923 * kjs/JSVariableObject.h:
2924 (KJS::JSVariableObject::symbolTableInsert):
2926 2008-03-21 Oliver Hunt <oliver@apple.com>
2928 Reviewed by Geoff Garen.
2930 Global properties that use LocalStorage are not correctly listed as enumerable.
2932 The problem was caused by JSObject::getPropertyAttributes not being aware
2933 of the JSVariableObject SymbolTable. The fix is to make getPropertyAttributes
2934 virtual and override in JSVariableObject. This does not produce any performance
2937 * JavaScriptCore.exp:
2938 * kjs/JSVariableObject.cpp:
2939 (KJS::JSVariableObject::getPropertyNames):
2940 (KJS::JSVariableObject::getPropertyAttributes):
2941 * kjs/JSVariableObject.h:
2944 2008-03-21 Arkadiusz Miskiewicz <arekm@maven.pl>
2946 Webkit does not build on linux powerpc
2948 <http://bugs.webkit.org/show_bug.cgi?id=17019>
2950 Reviewed by David Kilzer.
2953 (TCMalloc_SpinLock::Unlock):
2955 2008-03-21 Rodney Dawes <dobey@wayofthemonkey.com>
2959 http://bugs.webkit.org/show_bug.cgi?id=17981
2961 Add javascriptcore_cppflags to Programs_minidom_CPPFLAGS.
2965 2008-03-21 Alexey Proskuryakov <ap@webkit.org>
2967 Reviewed by Oliver Hunt.
2969 Consolidate static identifier initializers within CommonIdentifiers.
2971 No reliably measurable change on SunSpider; maybe a tiny improvement (within 0.2%).
2973 * kjs/CommonIdentifiers.h: Added static identifiers that were lazily initialized
2974 throughout the code.
2976 * kjs/date_object.cpp:
2977 (KJS::DateObjectImp::DateObjectImp):
2978 * kjs/function_object.cpp:
2979 (KJS::FunctionPrototype::FunctionPrototype):
2980 * kjs/object_object.cpp:
2981 (KJS::ObjectPrototype::ObjectPrototype):
2982 * kjs/regexp_object.cpp:
2983 (KJS::RegExpPrototype::RegExpPrototype):
2984 Use the values from CommonIdentifiers.
2986 * kjs/lookup.h: Caching the identifier in a static wasn't a win on SunSpider, removed it.
2989 (KJS::jsNaN): We already have a shared NaN value, no need for a duplicate here.
2992 (wtf_atan2): Having local variables for numeric_limits constants is good for readability,
2993 but there is no reason to keep them static.
2995 * JavaScriptCore.exp: Don't needlessly export JSGlobalObject::s_head.
2997 2008-03-20 Oliver Hunt <oliver@apple.com>
3001 Fix for leak introduced by inline ScopeChainNode use
3003 To avoid any extra branches when managing an inline ScopeChainNode
3004 in the ScopeChain the inline node gets inserted with a refcount of
3005 2. This meant than when the ScopeChain was destroyed the ScopeChainNodes
3006 above the inline node would be leaked.
3008 We resolve this by manually popping the inline node in the
3009 FunctionExecState destructor.
3011 * JavaScriptCore.xcodeproj/project.pbxproj:
3012 * kjs/ExecStateInlines.h:
3013 (KJS::FunctionExecState::~FunctionExecState):
3014 * kjs/scope_chain.h:
3015 (KJS::ScopeChain::popInlineScopeNode):
3017 2008-03-20 Mark Rowe <mrowe@apple.com>
3019 Reviewed by Sam Weinig.
3021 Ensure that the defines in FEATURE_DEFINES are sorted so that they will match the default settings of build-webkit.
3022 This will prevent the world from being rebuilt if you happen to switch between building in Xcode and with build-webkit on the
3025 * Configurations/JavaScriptCore.xcconfig:
3027 2008-03-20 David Krause <david.krause@gmail.com>
3029 Reviewed by David Kilzer.
3031 Fix http://bugs.webkit.org/show_bug.cgi?id=17923
3032 Bug 17923: ARM platform endian defines inaccurate
3035 Replaced !defined(__ARMEL__) check with !defined(__VFP_FP__)
3036 for PLATFORM(MIDDLE_ENDIAN)
3038 2008-03-20 Maciej Stachowiak <mjs@apple.com>
3042 * JavaScriptCore.xcodeproj/project.pbxproj: install Activation.h as private
3044 2008-03-20 Maciej Stachowiak <mjs@apple.com>
3048 - reduce function call overhead for 1.014x speedup on SunSpider
3050 I moved some functions from ExecState.cpp to ExecStateInline.h and
3051 from JSGlobalObject.cpp to JSGlobalObject.h, and declared them
3052 inline; machine function call overhead for these was hurting JS
3053 funcion call overhead.
3055 * kjs/ExecState.cpp:
3056 * kjs/ExecStateInlines.h: Added.
3057 (KJS::ExecState::ExecState):
3058 (KJS::ExecState::~ExecState):
3059 (KJS::FunctionExecState::FunctionExecState):
3060 (KJS::FunctionExecState::~FunctionExecState):
3061 * kjs/JSGlobalObject.cpp:
3062 * kjs/JSGlobalObject.h:
3063 (KJS::JSGlobalObject::pushActivation):
3064 (KJS::JSGlobalObject::checkActivationCount):
3065 (KJS::JSGlobalObject::popActivation):
3068 2008-03-19 Oliver Hunt <oliver@apple.com>
3072 Avoid heap allocating the root scope chain node for eval and closure free functions
3074 Maciej suggested using an inline ScopeChainNode for functions that don't use eval
3075 or closures as they are unable to ever capture the scope chain. This gives us a 2.4%
3076 win in sunspider, a 15% win in controlflow-recursive, and big (>5%) wins in a number
3079 * kjs/ExecState.cpp:
3080 (KJS::ExecState::ExecState):
3082 * kjs/scope_chain.h:
3083 (KJS::ScopeChain::push):
3085 2008-03-19 Mark Rowe <mrowe@apple.com>
3087 Reviewed by Sam Weinig.
3091 * kjs/JSGlobalObject.cpp: Add missing #include.
3093 2008-03-19 Sam Weinig <sam@webkit.org>
3095 Reviewed by Anders Carlsson.
3097 Fix for <rdar://problem/5785694>
3098 Crash occurs at KJS::Collector::collect() when loading web clip widgets with a PAC file
3100 Make the activeExecStates stack per JSGlobalObject instead of static to ensure
3103 * JavaScriptCore.exp:
3104 * kjs/ExecState.cpp:
3105 (KJS::InterpreterExecState::InterpreterExecState):
3106 (KJS::InterpreterExecState::~InterpreterExecState):
3107 (KJS::EvalExecState::EvalExecState):
3108 (KJS::EvalExecState::~EvalExecState):
3109 (KJS::FunctionExecState::FunctionExecState):
3110 (KJS::FunctionExecState::~FunctionExecState):
3113 * kjs/JSGlobalObject.cpp:
3114 (KJS::JSGlobalObject::mark):
3115 * kjs/JSGlobalObject.h:
3116 (KJS::JSGlobalObject::activeExecStates):
3117 * kjs/collector.cpp:
3118 (KJS::Collector::collect):
3119 (KJS::Collector::reportOutOfMemoryToAllExecStates): Iterate all JSGlobalObjects and report
3120 the OutOfMemory condition to all the ExecStates in each.
3122 2008-03-19 Jasper Bryant-Greene <jasper@unix.geek.nz>
3124 Reviewed by Maciej Stachowiak.
3126 Fix http://bugs.webkit.org/show_bug.cgi?id=17941
3127 Bug 17941: C++-style comments in JavaScriptCore API
3130 Remove C++-style comments from public JavaScriptCore API, replacing
3131 with standard C90 block comments.
3133 2008-03-19 Mark Rowe <mrowe@apple.com>
3135 Reviewed by Oliver Hunt.
3137 Fix http://bugs.webkit.org/show_bug.cgi?id=17939
3138 Bug 17939: Crash decompiling "const a = 1, b;"
3140 * kjs/nodes2string.cpp:
3141 (KJS::ConstDeclNode::streamTo): Null-check the correct variable.
3143 2008-03-18 Oliver Hunt <oliver@apple.com>
3145 Reviewed by Mark Rowe.
3147 Bug 17929: Incorrect decompilation with |const|, comma
3148 http://bugs.webkit.org/show_bug.cgi?id=17929
3150 There were actually two bugs here. First we weren't correctly handling const
3151 nodes with multiple declarations. The second issue was caused by us not
3152 giving the correct precedence to the initialisers.
3154 * kjs/nodes2string.cpp:
3155 (KJS::ConstDeclNode::streamTo):
3157 2008-03-18 Darin Adler <darin@apple.com>
3161 - Speed up JavaScript built-in properties by changing the
3162 hash table to take advantage of the identifier objects
3164 5% speedup for Acid3 test 26
3166 * JavaScriptCore.exp: Updated.
3167 * kjs/create_hash_table: Compute size of hash table large enough so that there
3168 are no collisions, but don't generate the hash table.
3169 * kjs/identifier.h: Made the add function that returns a PassRefPtr public.
3171 (KJS::Lexer::lex): Updated for change to HashTable interface.
3173 (KJS::HashTable::changeKeysToIdentifiers): Added. Finds the identifier for
3174 each property so the equality comparision can be done with pointer comparision.
3175 * kjs/lookup.h: Made the key be a union of char* with UString::Rep* so it can
3176 hold identifiers. Added a keysAreIdentifiers flag to the HashTable. Changed
3177 the Lookup functions to be member functions of HashTable instead.
3179 (KJS::JSObject::deleteProperty): Update for change to HashTable.
3180 (KJS::JSObject::findPropertyHashEntry): Ditto.
3181 (KJS::JSObject::getPropertyAttributes): Ditto.
3182 (KJS::JSObject::getPropertyNames): Ditto.
3184 2008-03-18 Mark Rowe <mrowe@apple.com>
3186 Reviewed by Oliver Hunt.
3188 Fix http://bugs.webkit.org/show_bug.cgi?id=17925 and http://bugs.webkit.org/show_bug.cgi?id=17927.
3189 - Bug 17925: Crash in KJS::JSObject::put after setting this.__proto__
3190 - Bug 17927: Hang after attempting to create circular __proto__
3193 (KJS::JSObject::put): Silently ignore attempts to set __proto__ to a non-object, non-null value.
3194 Return after setting the exception when an attempt to set a cyclic __proto__ is detected so that
3195 the cyclic value is not set.
3197 2008-03-18 Maciej Stachowiak <mjs@apple.com>
3201 - inline ActivationImp::init for 0.8% SunSpider speedup
3204 (KJS::ActivationImp::init): Moved here from function.cpp
3207 2008-03-18 Simon Hausmann <hausmann@webkit.org>
3211 Including config.h like in the other .cpp files gets the #ifdeffery
3214 * kjs/JSWrapperObject.cpp:
3216 2008-03-17 Darin Adler <darin@apple.com>
3220 JavaScriptCore changes to support a WebCore speedup.
3222 * JavaScriptCore.exp: Export the UString::Rep::computeHash function.
3223 * wtf/HashSet.h: Added a find and contains function that take a translator,
3224 like the add function.
3226 2008-03-18 Maciej Stachowiak <mjs@apple.com>
3230 - a few micro-optimizations for 1.2% SunSpider speedup
3233 (KJS::FunctionImp::callAsFunction): check for Return completion before Throw,
3236 (KJS::JSObject::put): When walking prototype chain, instead of
3237 checking isObject (a virtual call), compare to jsNull (compare to
3238 a constant) since null is the only non-object that can be in a
3241 2008-03-17 Oliver Hunt <oliver@apple.com>
3245 Optimise multi-scope function call resolution
3247 Refactor multiscope variable resolution and use to add
3248 optimised FunctionCallResolveNode subclasses.
3250 2.6% gain in sunspider performance, *25%* gain in controlflow-recursive
3253 (KJS::getSymbolTableEntry):
3254 (KJS::ResolveNode::optimizeVariableAccess):
3255 (KJS::getNonLocalSymbol):
3256 (KJS::ExpressionNode::resolveAndCall):
3257 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
3258 (KJS::FunctionCallResolveNode::inlineEvaluate):
3259 (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
3260 (KJS::ScopedVarFunctionCallNode::evaluate):
3261 (KJS::ScopedVarFunctionCallNode::evaluateToNumber):
3262 (KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
3263 (KJS::ScopedVarFunctionCallNode::evaluateToInt32):
3264 (KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
3265 (KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
3266 (KJS::NonLocalVarFunctionCallNode::evaluate):
3267 (KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
3268 (KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
3269 (KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
3270 (KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
3272 (KJS::ScopedVarFunctionCallNode::):
3273 (KJS::NonLocalVarFunctionCallNode::):
3275 2008-03-17 David Kilzer <ddkilzer@apple.com>
3277 Don't define PLATFORM(MIDDLE_ENDIAN) on little endian ARM.
3281 See <http://bugs.webkit.org/show_bug.cgi?id=15416#c13>.
3283 * wtf/Platform.h: Added check for !defined(__ARMEL__) when defining
3284 PLATFORM(MIDDLE_ENDIAN).
3286 2008-03-17 Oliver Hunt <oliver@apple.com>
3288 Reviewed by Geoff, Darin and Weinig.
3290 Add fast multi-level scope lookup
3292 Add logic and AST nodes to provide rapid variable resolution across
3293 static scope boundaries. This also adds logic that allows us to skip
3294 any static scopes that do not contain the variable to be resolved.
3296 This results in a ~2.5% speedup in SunSpider, and gives a 25-30% speedup
3297 in some simple and ad hoc closure and global variable access tests.
3299 * JavaScriptCore.exp:
3301 * kjs/JSGlobalObject.cpp:
3302 * kjs/JSGlobalObject.h:
3303 * kjs/JSVariableObject.cpp:
3304 * kjs/JSVariableObject.h:
3306 (KJS::ActivationImp::isDynamicScope):
3308 (KJS::ResolveNode::optimizeVariableAccess):
3309 (KJS::ScopedVarAccessNode::inlineEvaluate):
3310 (KJS::ScopedVarAccessNode::evaluate):
3311 (KJS::ScopedVarAccessNode::evaluateToNumber):
3312 (KJS::ScopedVarAccessNode::evaluateToBoolean):
3313 (KJS::ScopedVarAccessNode::evaluateToInt32):
3314 (KJS::ScopedVarAccessNode::evaluateToUInt32):
3315 (KJS::NonLocalVarAccessNode::inlineEvaluate):
3316 (KJS::NonLocalVarAccessNode::evaluate):
3317 (KJS::NonLocalVarAccessNode::evaluateToNumber):
3318 (KJS::NonLocalVarAccessNode::evaluateToBoolean):
3319 (KJS::NonLocalVarAccessNode::evaluateToInt32):
3320 (KJS::NonLocalVarAccessNode::evaluateToUInt32):
3321 (KJS::IfElseNode::optimizeVariableAccess):
3322 (KJS::ScopeNode::optimizeVariableAccess):
3324 (KJS::ScopedVarAccessNode::):
3325 (KJS::NonLocalVarAccessNode::):
3328 2008-03-16 weihongzeng <weihong.zeng@hotmail.com>
3330 Reviewed by Darin Adler.
3332 http://bugs.webkit.org/show_bug.cgi?id=15416
3333 Add support for mixed-endian processors
3335 * kjs/dtoa.cpp: Add IEEE_ARM, triggered by PLATFORM(MIDDLE_ENDIAN).
3337 2008-03-16 Kevin Ollivier <kevino@theolliviers.com>
3339 Rubber stamped by Darin.
3341 Add set-webkit-configuration support for wx port, and centralize
3342 build dir location setting.
3344 http://bugs.webkit.org/show_bug.cgi?id=17790
3348 2008-03-14 Steve Falkenburg <sfalken@apple.com>
3352 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3354 2008-03-14 Oliver Hunt <oliver@apple.com>
3358 Add logic to track whether a function uses a locally scoped eval or requires a closure
3360 Now that we limit eval we can track those uses of eval that operate
3361 in the local scope and functions that require a closure. We track
3362 this information during initial parsing to avoid yet another tree
3365 * JavaScriptCore.exp:
3368 (KJS::Parser::didFinishParsing):
3370 (KJS::Parser::parse):
3373 (KJS::ScopeNode::ScopeNode):
3374 (KJS::ProgramNode::ProgramNode):
3375 (KJS::ProgramNode::create):
3376 (KJS::EvalNode::EvalNode):
3377 (KJS::EvalNode::create):
3378 (KJS::FunctionBodyNode::FunctionBodyNode):
3379 (KJS::FunctionBodyNode::create):
3382 (KJS::ScopeNode::usesEval):
3383 (KJS::ScopeNode::needsClosure):
3385 2008-03-14 Geoffrey Garen <ggaren@apple.com>
3387 Reviewed by Beth Dakin.
3389 Fixed another problem with Vector::shrinkCapacity.
3391 moveOverlapping isn't good enough for the case where the buffer hasn't
3392 changed, because it still destroys the contents of the buffer.
3395 (WTF::::shrinkCapacity): Changed to explicitly check whether the call
3396 to allocateBuffer produced a new buffer. If it didn't, there's no need
3399 2008-03-14 Geoffrey Garen <ggaren@apple.com>
3401 Reviewed by Beth Dakin.
3403 Fixed a few problems with Vector::shrinkCapacity that I noticed in testing.
3406 (WTF::VectorBufferBase::deallocateBuffer): Clear our m_buffer pointer
3407 when we deallocate m_buffer, in case we're not asked to reallocate a new
3408 buffer. (Otherwise, we would use a stale m_buffer if we were asked to
3409 perform any operations after shrinkCapacity was called.)
3411 (WTF::VectorBuffer::allocateBuffer): Made VectorBuffer with inline
3412 capacity aware that calls to allocateBuffer might be shrinks, rather
3413 than grows, so we shouldn't allocate a new buffer on the heap unless
3414 our inline buffer is too small.
3416 (WTF::::shrinkCapacity): Call resize() instead of just setting m_size,
3417 so destructors run. Call resize before reallocating the buffer to make
3418 sure that we still have access to the objects we need to destroy. Call
3419 moveOverlapping instead of move, since a call to allocateBuffer on an
3420 inline buffer may produce identical storage.
3422 2008-03-14 Alexey Proskuryakov <ap@webkit.org>
3426 Get rid of a localime() call on platforms that have better alternatives.
3428 * kjs/DateMath.h: Added getLocalTime();
3431 (KJS::getLocalTime):
3432 (KJS::getDSTOffsetSimple):
3433 Implementation moved from getDSTOffsetSimple().
3435 * kjs/date_object.cpp:
3436 (KJS::DateObjectImp::callAsFunction): Switched to getLocalTime().
3438 2008-03-14 David D. Kilzer <ddkilzer@apple.com>
3440 Unify concept of enabling the Mac Java bridge.
3442 Reviewed by Darin and Anders.
3444 * wtf/Platform.h: Define ENABLE_MAC_JAVA_BRIDGE here.
3446 2008-03-13 Mark Mentovai <mark@moxienet.com>
3448 Reviewed by eseidel. Landed by eseidel.
3450 * wtf/FastMalloc.cpp: #include <wtf/HashSet.h> outside of any
3453 2008-03-13 Mark Mentovai <mark@moxienet.com>
3455 Reviewed by eseidel. Landed by eseidel.
3457 * pcre/pcre_exec.cpp: Fix misnamed variable, allowing -DDEBUG build
3459 * wtf/ThreadingPthreads.cpp: #include <sys/time.h> for gettimeofday
3462 2008-03-13 Steve Falkenburg <sfalken@apple.com>
3466 Disable PGO for normal release builds.
3467 Added work-in-progress Release_PGOInstrument/Release_PGOOptimize targets.
3469 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3471 2008-03-13 Beth Dakin <bdakin@apple.com>
3475 Adding new functionality to Vector. Currently all of the shrink and
3476 resize functions on Vector only shrink the size of the Vector, not
3477 the capacity. For the Vector to take up as little memory as
3478 possible, though, it is necessary to be able to shrink the capacity
3479 as well. So this patch adds that functionality.
3481 I need this for a speed up I am working on, and Geoff wants to use
3482 it in a speed up he is working on also, so he asked me to commit it
3486 (WTF::VectorBufferBase::allocateBuffer):
3487 (WTF::::shrinkCapacity):
3489 2008-03-13 Simon Hausmann <hausmann@webkit.org>
3491 Reviewed by Adam Roben.
3493 Attempt at fixing the Qt/Windows build bot. Quote using double-quotes
3494 instead of single quotes.
3498 2008-03-12 Steve Falkenburg <sfalken@apple.com>
3502 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
3504 2008-03-12 Alp Toker <alp@atoker.com>
3506 Another autotools testkjs build fix attempt.
3510 2008-03-12 Alp Toker <alp@atoker.com>
3512 Attempt to fix the autotools testkjs build on systems with
3513 non-standard include paths.
3517 2008-03-11 Alexey Proskuryakov <ap@webkit.org>
3521 <rdar://problem/5787743> REGRESSION: Crash at WTF::Collator::CreateCollator() running fast/js/kde/StringObject.html on Windows
3523 * wtf/unicode/icu/CollatorICU.cpp:
3524 (WTF::Collator::createCollator): Check for null (== user default) m_locale before calling strcmp.
3526 2008-03-11 Steve Falkenburg <sfalken@apple.com>
3528 Disable LTCG/PGO for grammar.cpp and nodes.cpp.
3529 PGO on these files causes us to hang.
3531 Copy newer vsprops files from relative WebKitLibraries path to environment variable based path.
3535 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3536 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
3538 2008-03-10 Darin Adler <darin@apple.com>
3542 * kjs/function.cpp: (KJS::decode): Initialize variable.