2008-05-13 Kevin McCullough <kmccullough@apple.com>
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2008-05-13  Kevin McCullough  <kmccullough@apple.com>
2
3         Reviewed by Geoff.
4
5         <rdar://problem/5770054> JavaScript profiler (10928)
6         Use PassRefPtrs instead of RefPtrs when appropriate.
7
8         * profiler/FunctionCallProfile.cpp:
9         (KJS::FunctionCallProfile::addChild):
10         * profiler/FunctionCallProfile.h:
11         * profiler/Profile.h:
12         (KJS::Profile::callTree):
13
14 2008-05-13  Kevin McCullough  <kmccullough@apple.com>
15
16         Reviewed by Sam.
17
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.
21
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):
32         * profiler/Profile.h:
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):
41
42 2008-05-13  Alexey Proskuryakov  <ap@webkit.org>
43
44         Reviewed by Geoffrey Garen.
45
46         <rdar://problem/4949018> JavaScriptCore API claims to work with UTF8 strings, but only works
47         with ASCII strings
48         
49         * kjs/ustring.h:
50         * kjs/ustring.cpp:
51         (KJS::UString::Rep::createFromUTF8):
52         Added. Implementation adapted from JSStringCreateWithUTF8CString().
53
54         * API/JSStringRef.cpp:
55         (JSStringCreateWithUTF8CString):
56         * API/JSClassRef.cpp:
57         (OpaqueJSClass::OpaqueJSClass):
58         Use UString::Rep::createFromUTF8().
59
60 2008-05-12  Mark Rowe  <mrowe@apple.com>
61
62         Reviewed by Tim Hatcher.
63
64         <rdar://problem/4859666> WebKit needs availability macros in order to deprecate APIs
65
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
69         version of WebKit.
70
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.
73
74         * API/WebKitAvailability.h: Added.
75         * JavaScriptCore.xcodeproj/project.pbxproj:
76
77 2008-05-12  Alexey Proskuryakov  <ap@webkit.org>
78
79         Reviewed by Maciej.
80
81         https://bugs.webkit.org/show_bug.cgi?id=18828
82         Reproducible crash with PAC file
83
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.
87
88         * wtf/ThreadSpecific.h:
89         (WTF::::ThreadSpecific):
90         (WTF::::~ThreadSpecific):
91         (WTF::::get):
92         (WTF::::set):
93
94 2008-05-12  Alexey Proskuryakov  <ap@webkit.org>
95
96         Roll out recent  threading changes (r32807, r32810, r32819, r32822) to simplify
97         SquirrelFish merging.
98
99         * API/JSBase.cpp:
100         (JSGarbageCollect):
101         * API/JSCallbackObjectFunctions.h:
102         (KJS::::staticFunctionGetter):
103         * API/JSClassRef.cpp:
104         (OpaqueJSClass::prototype):
105         * API/JSObjectRef.cpp:
106         (JSObjectMake):
107         (JSObjectMakeFunctionWithCallback):
108         (JSObjectMakeConstructor):
109         (JSObjectMakeFunction):
110         * API/JSValueRef.cpp:
111         (JSValueMakeNumber):
112         (JSValueMakeString):
113         * JavaScriptCore.exp:
114         * kjs/ExecState.h:
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):
126         * kjs/JSLock.cpp:
127         (KJS::JSLock::registerThread):
128         * kjs/JSLock.h:
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):
158         * kjs/collector.cpp:
159         (KJS::):
160         (KJS::allocateBlock):
161         (KJS::Collector::recordExtraCost):
162         (KJS::Collector::heapAllocate):
163         (KJS::Collector::allocate):
164         (KJS::Collector::allocateNumber):
165         (KJS::Collector::registerAsMainThread):
166         (KJS::onMainThread):
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):
177         (KJS::resumeThread):
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):
196         * kjs/collector.h:
197         (KJS::):
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):
251         * kjs/function.cpp:
252         (KJS::FunctionImp::lengthGetter):
253         (KJS::FunctionImp::construct):
254         (KJS::Arguments::Arguments):
255         (KJS::ActivationImp::createArgumentsObject):
256         (KJS::encode):
257         (KJS::decode):
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):
269         * kjs/internal.cpp:
270         (KJS::StringImp::toObject):
271         * kjs/internal.h:
272         (KJS::StringImp::StringImp):
273         (KJS::NumberImp::operator new):
274         * kjs/list.cpp:
275         (KJS::List::markSet):
276         (KJS::List::markProtectedListsSlowCase):
277         (KJS::List::expandAndAppend):
278         * kjs/list.h:
279         (KJS::List::List):
280         (KJS::List::~List):
281         (KJS::List::markProtectedLists):
282         * kjs/lookup.h:
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):
305         * kjs/nodes.cpp:
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):
345         (KJS::addSlowCase):
346         (KJS::add):
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):
362         * kjs/nodes.h:
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):
374         * kjs/object.cpp:
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):
382         * kjs/object.h:
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):
396         * kjs/protect.h:
397         (KJS::gcProtect):
398         (KJS::gcUnprotect):
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):
418         (KJS::replace):
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):
456         * kjs/testkjs.cpp:
457         (GlobalObject::GlobalObject):
458         (functionGC):
459         (functionRun):
460         (functionReadline):
461         (kjsmain):
462         * kjs/ustring.h:
463         * kjs/value.cpp:
464         (KJS::JSCell::operator new):
465         (KJS::jsString):
466         (KJS::jsOwnedString):
467         (KJS::jsNumberCell):
468         * kjs/value.h:
469         (KJS::jsNaN):
470         (KJS::jsNumber):
471         (KJS::jsNumberFromAnd):
472         (KJS::JSCell::marked):
473         (KJS::JSCell::mark):
474         (KJS::JSValue::toJSNumber):
475         * wtf/ThreadSpecific.h:
476         (WTF::T):
477
478 2008-05-10  Julien Chaffraix  <jchaffraix@webkit.org>
479
480         Qt & wx build fix.
481
482         * JavaScriptCore.pri: Add profiler/Profile.cpp.
483         * JavaScriptCoreSources.bkl: Ditto.
484
485 2008-05-10  Jan Michael Alonzo  <jmalonzo@unpluggable.com>
486
487         Reviewed by Maciej.
488
489         Gtk+ build fix
490
491         * GNUmakefile.am: Add Profile.cpp in _sources
492
493 2008-05-09  Brady Eidson  <beidson@apple.com>
494
495         Build Fix.  Kevin is an idiot.  
496         ("My name is Kevin McCullough and I approve this message.")
497
498         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
499
500 2008-05-09  Kevin McCullough  <kmccullough@apple.com>
501
502         Reviewed by Tim.
503
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.
507
508         * JavaScriptCore.exp: Export the new function signatures.
509         * JavaScriptCore.xcodeproj/project.pbxproj: Add the new files to the
510         project
511         * profiler/Profile.cpp: Added. This class represents a single run of the
512         profiler.
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):
533
534 2008-05-08  Anders Carlsson  <andersca@apple.com>
535
536         Reviewed by Mark.
537
538         Enable NPAPI plug-ins on 64-bit.
539         
540         * wtf/Platform.h:
541
542 2008-05-07  Julien Chaffraix  <jchaffraix@webkit.org>
543
544         Reviewed by Adam Roben.
545
546         wx & Gtk build fix.
547
548         Add SIZE_MAX definition for the wx port.
549
550         * os-win32/stdint.h:
551
552 2008-05-07  Ariya Hidayat  <ariya.hidayat@trolltech.com>
553
554         Reviewed by Simon.
555
556         Support for isMainThread in the Qt port.
557
558         * wtf/ThreadingQt.cpp:
559         (WTF::initializeThreading): Adjusted.
560         (WTF::isMainThread): Added.
561
562 2008-05-05  Darin Adler  <darin@apple.com>
563
564         Reviewed by John Sullivan.
565
566         - fix debug-only leak seen on buildbot
567
568         * wtf/HashTable.h:
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.
571
572 2008-05-02  Alexey Proskuryakov  <ap@webkit.org>
573
574         Reviewed by Geoffrey Garen.
575
576         Get rid of static data in nodes.cpp (well, at least of non-debug one).
577
578         No measurable change on SunSpider.
579
580         * kjs/InitializeThreading.cpp:
581         (KJS::initializeThreadingOnce):
582         * kjs/nodes.cpp:
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):
591         * kjs/nodes.h:
592         Made newTrackedObjects and trackedObjectExtraRefCounts per-thread.
593
594 2008-05-02  Alexey Proskuryakov  <ap@webkit.org>
595
596         Reviewed by Darin.
597
598         Move call stack depth counter to global object.
599
600         * kjs/ExecState.h: (KJS::ExecState::functionCallDepth): Added a recursion depth counter to
601         per-thread data.
602         * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Initialize PerThreadData.functionCallDepth.
603         * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::perThreadData): Made the result non-const.
604
605         * kjs/object.cpp:
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
609         tracking.
610
611 2008-05-02  Alexey Proskuryakov  <ap@webkit.org>
612
613         Reviewed by Darin.
614
615         Make JavaScriptGlue and JavaScriptCore API functions implicitly call initializeThreading
616         for the sake of non-WebKit clients.
617
618         * API/JSBase.cpp:
619         (JSGarbageCollect):
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.
625
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.
631
632         * kjs/InitializeThreading.h:
633         * wtf/Threading.h:
634         Spell out initializeThreading contract.
635
636         * wtf/ThreadingPthreads.cpp: (WTF::isMainThread): Make sure that results are correct on
637         Darwin, even if threading was initialized from a secondary thread.
638
639 2008-05-02  Alexey Proskuryakov  <ap@webkit.org>
640
641         Reviewed by Geoffrey Garen.
642
643         https://bugs.webkit.org/show_bug.cgi?id=18826
644         Make JavaScript heap per-thread
645
646         * wtf/ThreadSpecific.h: Make sure to initialize POD thread-specific varaibles, too
647         (replaced "new T" with "new T()").
648
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.
655
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
663         use any global data.
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.
669
670         * kjs/JSLock.cpp:
671         * kjs/JSLock.h:
672         (KJS::JSLock::JSLock):
673         Removed registerThread(), as the heap no longer cares.
674
675         * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Initialize new per-thread
676         variables in Heap and JSGlobalObject.
677
678         * kjs/ExecState.h: (KJS::ExecState::heap): Added a heap pointer for faster access to
679         per-thread heap, and an accessor for it.
680
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.
691
692         * kjs/list.h:
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.
696         * kjs/list.cpp:
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.
700
701         * kjs/protect.h:
702         (KJS::gcProtect):
703         (KJS::gcUnprotect):
704         Use the newly added Heap::heap() method to find out which heap the value to be (un)protected
705         belongs to.
706
707         * kjs/property_map.h: Removed unused SavedProperty class.
708
709         * JavaScriptCore.exp:
710         * API/JSBase.cpp:
711         (JSGarbageCollect):
712         * API/JSCallbackObjectFunctions.h:
713         (KJS::::staticFunctionGetter):
714         * API/JSClassRef.cpp:
715         (OpaqueJSClass::prototype):
716         * API/JSObjectRef.cpp:
717         (JSObjectMake):
718         (JSObjectMakeFunctionWithCallback):
719         (JSObjectMakeConstructor):
720         (JSObjectMakeFunction):
721         * API/JSValueRef.cpp:
722         (JSValueMakeNumber):
723         (JSValueMakeString):
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):
800         * kjs/function.cpp:
801         (KJS::FunctionImp::lengthGetter):
802         (KJS::FunctionImp::construct):
803         (KJS::Arguments::Arguments):
804         (KJS::ActivationImp::createArgumentsObject):
805         (KJS::encode):
806         (KJS::decode):
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):
818         * kjs/internal.cpp:
819         (KJS::StringImp::toObject):
820         * kjs/internal.h:
821         (KJS::StringImp::StringImp):
822         (KJS::NumberImp::operator new):
823         * kjs/lookup.h:
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):
846         * kjs/nodes.cpp:
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):
881         (KJS::addSlowCase):
882         (KJS::add):
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):
909         * kjs/object.cpp:
910         (KJS::JSObject::defineGetter):
911         (KJS::JSObject::defineSetter):
912         (KJS::JSObject::putDirect):
913         (KJS::Error::create):
914         * kjs/object.h:
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):
940         (KJS::replace):
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):
978         * kjs/testkjs.cpp:
979         (GlobalObject::GlobalObject):
980         (functionGC):
981         (functionRun):
982         (functionReadline):
983         (kjsmain):
984         * kjs/ustring.h:
985         * kjs/value.cpp:
986         (KJS::JSCell::operator new):
987         (KJS::jsString):
988         (KJS::jsOwnedString):
989         (KJS::jsNumberCell):
990         * kjs/value.h:
991         (KJS::jsNaN):
992         (KJS::jsNumber):
993         (KJS::jsNumberFromAnd):
994         (KJS::JSCell::marked):
995         (KJS::JSCell::mark):
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.
999
1000 2008-05-02  Dan Bernstein  <mitz@apple.com>
1001
1002         Reviewed by Maciej Stachowiak.
1003
1004         - Mac build fix
1005
1006         * wtf/StrHash.h: Added header guards and removed #include "config.h".
1007
1008 2008-05-01  Ada Chan  <adachan@apple.com>
1009
1010         #include <wtf/StrHash.h> in identifier.cpp.
1011
1012         Reviewed by Maciej.
1013
1014         * kjs/identifier.cpp:
1015
1016 2008-05-01  Steve Falkenburg  <sfalken@apple.com>
1017
1018         Build fix.
1019
1020         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1021
1022 2008-05-01  Sam Weinig  <sam@webkit.org>
1023
1024         Fix build.
1025
1026         * JavaScriptCore.xcodeproj/project.pbxproj:
1027
1028 2008-05-01  Kevin McCullough  <kmccullough@apple.com>
1029
1030         Reviewed by Darin.
1031
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.
1035
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.
1062         (WTF::):
1063
1064 2008-04-29  David Kilzer  <ddkilzer@apple.com>
1065
1066         BUILD FIX for ENABLE(DASHBOARD_SUPPORT)
1067
1068         * wtf/Platform.h: Defined ENABLE(DASHBOARD_SUPPORT) to 1 only for
1069         PLATFORM(MAC) and PLATFORM(WIN).  Changed default to 0 for other
1070         ports.
1071
1072 2008-04-29  Greg Bolsinga  <bolsinga@apple.com>
1073
1074         Reviewed by Darin.
1075
1076         Wrapped Dashboard code with ENABLE(DASHBOARD_SUPPORT)
1077
1078         * wtf/Platform.h:
1079
1080 2008-04-29  Kevin McCullough  <kmccullough@apple.com>
1081
1082         Reviewed by Geoff.
1083
1084         -<rdar://problem/5770054> JavaScript profiler (10928)
1085         -Keep call count.
1086
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:
1094
1095 2008-04-29  Simon Hausmann  <hausmann@webkit.org>
1096
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.
1100
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.
1104
1105         * kjs/JSGlobalObject.cpp:
1106
1107 2008-04-28  Alexey Proskuryakov  <ap@webkit.org>
1108
1109         Windows build fix.
1110
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.
1113
1114 2008-04-28  Alexey Proskuryakov  <ap@webkit.org>
1115
1116         Reviewed by Darin.
1117
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
1121
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.
1125
1126         * kjs/lexer.cpp:
1127         (KJS::Lexer::Lexer):
1128         (KJS::Lexer::~Lexer):
1129         * kjs/lexer.h:
1130         Made mainTable a member of Lexer, so that it no longer needs to be shared between threads.
1131
1132         * kjs/object.cpp:
1133         (KJS::JSObject::deleteProperty):
1134         (KJS::JSObject::findPropertyHashEntry):
1135         (KJS::JSObject::propertyIsEnumerable):
1136         (KJS::JSObject::getPropertyAttributes):
1137         (KJS::JSObject::getPropertyNames):
1138         * kjs/object.h:
1139         (KJS::ClassInfo::propHashTable):
1140         Added a new classPropHashTableGetterFunction field to ClassInfo. If it is non-zero, the
1141         static table is not used.
1142
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
1146         instances.
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.
1160
1161         * kjs/ExecState.cpp:
1162         (KJS::ExecState::ExecState):
1163         * kjs/ExecState.h:
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.
1178
1179         * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Initialize thread-static data
1180         added to JSGlobalObject.
1181
1182         * API/JSCallbackConstructor.cpp:
1183         (KJS::):
1184         * API/JSCallbackFunction.cpp:
1185         (KJS::):
1186         * API/JSCallbackObject.cpp:
1187         (KJS::):
1188         * JavaScriptCore.exp:
1189         * kjs/JSVariableObject.cpp:
1190         (KJS::JSVariableObject::getPropertyAttributes):
1191         * kjs/JSVariableObject.h:
1192         * kjs/array_instance.cpp:
1193         (KJS::):
1194         * kjs/array_object.cpp:
1195         (KJS::):
1196         (KJS::ArrayPrototype::getOwnPropertySlot):
1197         * kjs/bool_object.cpp:
1198         (KJS::):
1199         * kjs/create_hash_table:
1200         * kjs/date_object.cpp:
1201         (KJS::):
1202         (KJS::DatePrototype::getOwnPropertySlot):
1203         (KJS::DateObjectImp::DateObjectImp):
1204         * kjs/error_object.cpp:
1205         (KJS::):
1206         * kjs/function.cpp:
1207         (KJS::):
1208         * kjs/function_object.cpp:
1209         (KJS::FunctionPrototype::FunctionPrototype):
1210         * kjs/internal.cpp:
1211         (KJS::):
1212         * kjs/lookup.h:
1213         * kjs/math_object.cpp:
1214         (KJS::):
1215         (KJS::MathObjectImp::getOwnPropertySlot):
1216         * kjs/number_object.cpp:
1217         (KJS::):
1218         (KJS::NumberObjectImp::getOwnPropertySlot):
1219         * kjs/object_object.cpp:
1220         (KJS::ObjectPrototype::ObjectPrototype):
1221         * kjs/regexp_object.cpp:
1222         (KJS::):
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:
1229         (KJS::):
1230         (KJS::StringPrototype::getOwnPropertySlot):
1231         Adjust for the above changes.
1232
1233 2008-04-28  Darin Adler  <darin@apple.com>
1234
1235         Reviewed by Adam.
1236
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
1239
1240         * wtf/HashFunctions.h: Used "using" to get the hash and equal functions
1241         from PtrHash<P*> into PtrHash<RefPtr<P>>.
1242
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.
1248
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
1253         template.
1254
1255         * wtf/HashTable.h: Tweaked formatting. Removed NeedsRef, RefCounterBase,
1256         RefCounter, HashTableRefCounterBase, HashTableRefCounter, and Assigner
1257         class templates.
1258
1259         * wtf/HashTraits.h: Removed StorageTraits, needsRef, PairBaseHashTraits,
1260         and HashKeyStorageTraits.
1261
1262         * wtf/RefPtrHashMap.h: Made all the same fixes as in HashMap. Also made
1263         the corresponding changes to RefPtrHashMapRawKeyTranslator.
1264
1265 2008-04-28  Darin Adler  <darin@apple.com>
1266
1267         Reviewed by Mitz.
1268
1269         - fix assertion hit every time you view www.apple.com
1270
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!
1274
1275 2008-04-27  Mark Rowe  <mrowe@apple.com>
1276
1277         Reviewed by Maciej Stachowiak.
1278
1279         Fix crash inside PtrHash::hash when loading a page.
1280
1281         * wtf/HashFunctions.h: Explicitly use the superclass implementation of hash to avoid infinite recursion.
1282
1283 2008-04-27  Darin Adler  <darin@apple.com>
1284
1285         Reviewed by Maciej.
1286
1287         - fix <rdar://problem/5657459> REGRESSION: JavaScriptCore no longer builds with
1288           GCC 4.2 due to pointer aliasing warnings
1289
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.
1293
1294         This increases code size. On Mac OS X we'll have to regenerate .order files to avoid
1295         slowing down Safari startup times.
1296
1297         This creates a slight slowdown in SunSpider, mitigated by the following four speedups:
1298
1299         - speed up array put slightly by moving a branch (was already done for get)
1300
1301         - speed up symbol table access by adding a function named inlineGet to HashMap
1302           and using that in symbolTableGet/Put
1303
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
1307
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
1311
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.
1314
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.
1321
1322         * kjs/JSVariableObject.cpp: Removed now-unneeded IdentifierRepHashTraits::nullRepPtr
1323         definition (see below).
1324         (KJS::JSVariableObject::getPropertyNames): Removed explicit cast to Identifier.
1325
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.
1330
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.
1335
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.
1340
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.
1346
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.
1350
1351         * kjs/function.cpp:
1352         (KJS::globalFuncKJSPrint): Changed to use the new getCString instead of cstring.
1353
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.
1358
1359         * kjs/object.cpp:
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.
1365         * kjs/ustring.cpp:
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.
1371
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.
1375
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.
1380
1381         * wtf/HashTable.h:
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.
1396
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.
1406
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.
1410
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
1414         type.
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
1421         symbol table code.
1422
1423 2008-04-25  Sam Weinig  <sam@webkit.org>
1424
1425         Rubber-stamped by Mark Rowe.
1426
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.
1429
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.
1439         * kjs/object.h:
1440         * kjs/property_map.cpp:
1441         * kjs/property_map.h:
1442
1443 2008-04-25  Mark Rowe  <mrowe@apple.com>
1444
1445         Rubber-stamped by Sam Weinig.
1446
1447         Add some content to an empty ICU header file to prevent verification errors.
1448
1449         * icu/unicode/utf_old.h:
1450
1451 2008-04-25  David Kilzer  <ddkilzer@apple.com>
1452
1453         <rdar://problem/5819422> REGRESSION: Wrong line number passed to -willLeaveCallFrame
1454
1455         Patch by George Dicker and Michael Kahl.  Reviewed by Darin.
1456
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.
1460
1461         * kjs/nodes.cpp:
1462         (KJS::FunctionBodyNodeWithDebuggerHooks::execute): Pass lastLine() instead of lineNo()
1463         when calling Debugger::returnEvent().
1464
1465 2008-04-25  Darin Adler  <darin@apple.com>
1466
1467         Done with Stephanie Lewis.
1468
1469         * JavaScriptCore.xcodeproj/project.pbxproj: Prepare for compilation with gcc 4.2 by
1470         adding -fno-strict-aliasing to CollatorICU.cpp.
1471
1472 2008-04-24  Sam Weinig  <sam@webkit.org>
1473
1474         Reviewed by Geoffrey Garen.
1475
1476         Add a #define to easily enable collecting on every allocation to aid
1477         debugging GC bugs.
1478
1479         * kjs/collector.cpp:
1480         (KJS::Collector::heapAllocate):
1481
1482 2008-04-24  Kevin McCullough  <kmccullough@apple.com>
1483
1484         Reviewed by Adam and Sam.
1485
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.
1489
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
1498         group identifier.
1499         (KJS::Profiler::startProfiling):
1500         (KJS::Profiler::willExecute):
1501         (KJS::Profiler::didExecute):
1502         * profiler/Profiler.h: Ditto.
1503         (KJS::Profiler::Profiler):
1504
1505 2008-04-24  Julien Chaffraix  <jchaffraix@webkit.org>
1506
1507         Reviewed by Simon.
1508
1509         Bug 15940: Implement threading API for Qt
1510         https://bugs.webkit.org/show_bug.cgi?id=15940
1511
1512         Original patch by Justin Haygood, tweaked by me.
1513
1514         * JavaScriptCore.pri:
1515         * wtf/ThreadingQt.cpp: Added.
1516         (WTF::threadMapMutex):
1517         (WTF::threadMap):
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):
1533         (WTF::Mutex::lock):
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):
1541
1542 2008-04-22  Darin Adler  <darin@apple.com>
1543
1544         Reviewed by Anders.
1545
1546         - simplify use of HashTraits to prepare for some upcoming hash table changes
1547
1548         * kjs/SymbolTable.h: Made SymbolTableIndexHashTraits derive from HashTraits<size_t>
1549         and specialize only the empty value.
1550
1551 2008-04-23  Holger Hans Peter Freyther  <zecke@selfish.org>
1552
1553         Reviewed by Simon.
1554
1555         Removed the #define for USE_SYSTEM_MALLOC that we set in WebKit.pri
1556         already.
1557
1558         * wtf/Platform.h:
1559
1560 2008-04-21  Kevin McCullough  <kmccullough@apple.com>
1561
1562         Reviewed by Adam.
1563
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.
1567
1568         * profiler/FunctionCallProfile.cpp:
1569         (KJS::FunctionCallProfile::didExecute):
1570         (KJS::FunctionCallProfile::stopProfiling):
1571         * profiler/FunctionCallProfile.h:
1572         * profiler/Profiler.cpp:
1573         (KJS::Profiler::stopProfiling):
1574
1575 2008-04-21  Alexey Proskuryakov  <ap@webkit.org>
1576
1577         Reviewed by Darin.
1578
1579         Move collector main thread initialization from WebKit/win to KJS::initializeThreading.
1580
1581         * kjs/InitializeThreading.cpp:
1582         (KJS::initializeThreading):
1583
1584 2008-04-21  Adam Roben  <aroben@apple.com>
1585
1586         MSVC build fix
1587
1588         Reviewed by Alexey Proskuryakov.
1589
1590         * kjs/ustring.h:
1591         (KJS::UString::cost): Disable a warning about assigning a 32-bit
1592         size_t into a 31-bit size_t.
1593
1594 2008-04-21  Simon Hausmann  <hausmann@webkit.org>
1595
1596         Reviewed by Lars.
1597
1598         Made convertValueToQVariant accessible from within WebKit/qt/Api
1599
1600         * bindings/qt/qt_runtime.h:
1601
1602 2008-04-21  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
1603
1604         Reviewed by Simon.
1605
1606         Build fix for Qt 4.3
1607
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.
1613
1614         * kjs/testkjs.pro:
1615
1616 2008-04-19  Matt Lilek  <webkit@mattlilek.com>
1617
1618         Not reviewed, Windows build fix - copy the profiler headers in all
1619         configurations, not just Debug_Internal.
1620
1621         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1622
1623 2008-04-19  Mike Hommey  <glandium@debian.org>
1624
1625         Reviewed by Alp Toker.
1626
1627         Don't build testkjs with rpath.
1628
1629         * GNUmakefile.am:
1630
1631 2008-04-18  Kevin Ollivier  <kevino@theolliviers.com>
1632
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.
1636
1637         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1638         * JavaScriptCore.xcodeproj/project.pbxproj:
1639         * jscore.bkl:
1640         * kjs/ExecState.h:
1641         * kjs/JSVariableObject.h:
1642         * kjs/LocalStorage.h: Removed.
1643         * kjs/LocalStorageEntry.h: Copied from JavaScriptCore/kjs/LocalStorage.h.
1644         * kjs/function.h:
1645
1646 2008-04-18 Jan  Michael Alonzo  <jmalonzo@unpluggable.com>
1647
1648         Reviewed by Alp Toker.
1649
1650         http://bugs.webkit.org/show_bug.cgi?id=16620
1651         [GTK] Autotools make dist and make check support
1652
1653         Cleanups.
1654
1655         * GNUmakefile.am:
1656
1657 2008-04-18  Jon Honeycutt  <jhoneycutt@apple.com>
1658
1659         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Windows
1660         build fix.
1661
1662 2008-04-11  Mark Rowe  <mrowe@apple.com>
1663
1664         Rubber-stamped by Antti Koivisto.
1665
1666         Silence GCC 4.3 warnings by removing extraneous consts.
1667
1668         * kjs/ustring.cpp:
1669         * kjs/ustring.h:
1670
1671 2008-04-18  Kevin McCullough  <kmccullough@apple.com>
1672
1673         Reviewed by Sam.
1674
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.
1678
1679         * profiler/FunctionCallProfile.h:
1680         (KJS::FunctionCallProfile::milliSecs): Corrected the name to match
1681         its output.
1682         * wtf/Deque.h:
1683         (WTF::deleteAllValues):
1684
1685 2008-04-18  Kevin McCullough  <kmccullough@apple.com>
1686
1687         Reviewed by Sam and Adam.
1688
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.
1692
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
1704         sampling profile.
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
1715         used.
1716         (KJS::getFunctionName):
1717         (KJS::Profiler::printDataInspectorStyle):
1718         * profiler/Profiler.h:
1719
1720 2008-04-18  Alexey Proskuryakov  <ap@webkit.org>
1721
1722         Reviewed by Darin.
1723
1724         Fix leaks during plugin tests (which actually excercise background JS), and potential
1725         PAC brokenness that was not reported, but very likely.
1726
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.
1730
1731         No measurable change on SunSpider total, ~1% variation on individual tests.
1732
1733         * kjs/ustring.cpp:
1734         (KJS::):
1735         (KJS::UString::Rep::create):
1736         (KJS::UString::Rep::destroy):
1737         * kjs/ustring.h:
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).
1741
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.
1750
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.
1756
1757         (KJS::CStringTranslator::translate):
1758         (KJS::UCharBufferTranslator::translate):
1759         (KJS::Identifier::addSlowCase):
1760         (KJS::Identifier::remove):
1761         * kjs/identifier.h:
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.
1765
1766 2008-04-18  Alexey Proskuryakov  <ap@webkit.org>
1767
1768         Reviewed by Darin.
1769
1770         Get rid of static compareWithCompareFunctionArguments in array_instance.cpp.
1771
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).
1775
1776         Also, made arguments a local variable - not sure why it was a member of
1777         CompareWithCompareFunctionArguments.
1778
1779         * kjs/array_instance.cpp:
1780         (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
1781         (KJS::CompareWithCompareFunctionArguments::operator()):
1782         (KJS::ArrayInstance::sort):
1783
1784 2008-04-18  Simon Hausmann  <hausmann@webkit.org>
1785
1786         Build fix for gcc 4.3. Include stdio.h for printf.
1787
1788         * profiler/FunctionCallProfile.cpp:
1789         * profiler/Profiler.cpp:
1790
1791 2008-04-17  Jon Honeycutt  <jhoneycutt@apple.com>
1792
1793         Reviewed by mrowe.
1794
1795         * wtf/Platform.h: Add HAVE_ACCESSIBILITY to Platform.h.
1796
1797 2008-04-17  Alexey Proskuryakov  <ap@webkit.org>
1798
1799         Reviewed by Maciej.
1800
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).
1804
1805         No change on SunSpider.
1806
1807         * wtf/ThreadSpecific.h:
1808         (WTF::ThreadSpecific::Data::Data):
1809         (WTF::::get):
1810         (WTF::::set):
1811         (WTF::::destroy):
1812
1813 2008-04-15  Srinivas Rao. M Hamse  <msrinirao@gmail.com>
1814
1815         Reviewed by Maciej Stachowiak.
1816
1817         - gcc 3.x build fix
1818
1819         * kjs/nodes.h: CallerType definition made public for gcc 3.x compilation
1820
1821 2008-04-16  Brady Eidson  <beidson@apple.com>
1822
1823         Reviewed by Sam Weinig
1824
1825         Change ThreadSafeShared to act like RefCounted by starting out with a single ref by default
1826
1827         * wtf/Threading.h:
1828         (WTF::ThreadSafeShared::ThreadSafeShared):
1829
1830 2008-04-16  Sam Weinig  <sam@webkit.org>
1831
1832         Reviewed by Geoffrey Garen.
1833
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].
1841
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.
1846
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.
1851
1852         * JavaScriptCore.exp:
1853         * kjs/Activation.h:
1854         * kjs/JSGlobalObject.cpp:
1855         (KJS::JSGlobalObject::putWithAttributes):
1856         * kjs/JSGlobalObject.h:
1857         * kjs/JSVariableObject.h:
1858         (KJS::JSVariableObject::symbolTablePutWithAttributes):
1859         * kjs/function.cpp:
1860         (KJS::ActivationImp::putWithAttributes):
1861         * kjs/nodes.cpp:
1862         (KJS::ConstDeclNode::handleSlowCase):
1863         (KJS::ConstDeclNode::evaluateSingle):
1864         (KJS::EvalNode::processDeclarations):
1865         * kjs/object.cpp:
1866         (KJS::JSObject::putWithAttributes):
1867         * kjs/object.h:
1868         Rename initializeVariable to putWithAttributes and move it down to JSObject so it
1869         can be used for JSObjectSetProperty.
1870
1871 2008-04-16  Kevin McCullough  <kmccullough@apple.com>
1872
1873         Reviewed by Sam and Geoff.
1874
1875         -<rdar://problem/5770054> JavaScript profiler (10928)
1876         Inital profiler prototype
1877
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().
1885         (KJS::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):
1890         * profiler: Added.
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):
1918
1919 2008-04-16  Sam Weinig  <sam@webkit.org>
1920
1921         Reviewed by Darin Adler.
1922
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.
1928
1929         * JavaScriptCore.exp:
1930         * kjs/dtoa.cpp:
1931         (KJS::ulp):
1932         (KJS::b2d):
1933         (KJS::d2b):
1934         (KJS::ratio):
1935         (KJS::):
1936         (KJS::strtod):
1937         (KJS::freedtoa):
1938         (KJS::dtoa):
1939         * kjs/dtoa.h:
1940         * kjs/function.cpp:
1941         (KJS::parseInt):
1942         * kjs/lexer.cpp:
1943         (KJS::Lexer::lex):
1944         * kjs/number_object.cpp:
1945         (KJS::integer_part_noexp):
1946         (KJS::numberProtoFuncToExponential):
1947         * kjs/ustring.cpp:
1948         (KJS::UString::from):
1949         (KJS::UString::toDouble):
1950
1951 2008-04-16  Alexey Proskuryakov  <ap@webkit.org>
1952
1953         Reviewed by Darin.
1954
1955         Get rid of static execForCompareByStringForQSort in array_instance.cpp.
1956
1957         No change on SunSpider, CelticKane or iBench JavaScript.
1958
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.
1964
1965 2008-04-16  Alexey Proskuryakov  <ap@webkit.org>
1966
1967         Reviewed by Adam Roben.
1968
1969         MSVC build fix.
1970
1971         * kjs/CommonIdentifiers.cpp:
1972         * kjs/CommonIdentifiers.h:
1973         * kjs/Parser.cpp:
1974         * kjs/Parser.h:
1975         * kjs/identifier.cpp:
1976         * kjs/lexer.h:
1977         * wtf/ThreadSpecific.h:
1978
1979 2008-04-16  Alexey Proskuryakov  <ap@webkit.org>
1980
1981         Build fix.
1982
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.
1987
1988 2008-04-16  Holger Hans Peter Freyther  <zecke@selfish.org>
1989
1990         Unreviewed build fix for MSVC. It does not want to have
1991         WTF in the KJS namespace.
1992
1993         * kjs/CommonIdentifiers.h:
1994
1995 2008-04-16  Holger Hans Peter Freyther  <zecke@selfish.org>
1996
1997         Unreviewed build fix for gcc.
1998
1999         ::msToGregorianDateTime  is not known to it.
2000
2001         * kjs/date_object.cpp:
2002         (KJS::DateInstance::msToGregorianDateTime):
2003
2004 2008-04-16  Alexey Proskuryakov  <ap@webkit.org>
2005
2006         Reviewed by Oliver Hunt.
2007
2008         Initialize threadMapMutex safely (as already done in ThreadingWin).
2009
2010         * wtf/ThreadingGtk.cpp:
2011         (WTF::threadMapMutex):
2012         (WTF::initializeThreading):
2013         * wtf/ThreadingPthreads.cpp:
2014         (WTF::threadMapMutex):
2015         (WTF::initializeThreading):
2016
2017 2008-04-16  Alexey Proskuryakov  <ap@webkit.org>
2018
2019         Reviewed by Adam Roben.
2020
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).
2023
2024         * kjs/DateMath.h:
2025         (KJS::GregorianDateTime::copyFrom): Added. It presumably makes sense to keep GregorianDateTime
2026         Noncopyable, so it's not just operator=.
2027
2028         * kjs/date_object.h: Added a per-object cache.
2029
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.
2061
2062 2008-04-16  Alexey Proskuryakov  <ap@webkit.org>
2063
2064         Reviewed by Darin.
2065
2066         Implement an abstraction for thread-specific storage, use it to get rid of some static objects.
2067
2068         SunSpider results were not conclusive, possibly up to 0.2% slowdown.
2069
2070         * JavaScriptCore.xcodeproj/project.pbxproj:
2071         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
2072         Added ThreadSpecific.h
2073
2074         * wtf/ThreadSpecific.h: Added.
2075         (WTF::::ThreadSpecific):
2076         (WTF::::~ThreadSpecific):
2077         (WTF::::get):
2078         (WTF::::set):
2079         (WTF::::destroy):
2080         (WTF::T):
2081         (WTF::::operator):
2082         Only implemented for platforms that use pthreads.
2083
2084         * kjs/CommonIdentifiers.cpp:
2085         (KJS::CommonIdentifiers::shared):
2086         * kjs/CommonIdentifiers.h:
2087         * kjs/InitializeThreading.cpp:
2088         (KJS::initializeThreading):
2089         * kjs/Parser.cpp:
2090         (KJS::parser):
2091         * kjs/Parser.h:
2092         * kjs/identifier.cpp:
2093         (KJS::identifierTable):
2094         (KJS::literalIdentifierTable):
2095         (KJS::Identifier::initializeIdentifierThreading):
2096         * kjs/identifier.h:
2097         * kjs/lexer.cpp:
2098         (KJS::lexer):
2099         * kjs/lexer.h:
2100         Make static instances per-thread.
2101
2102 2008-04-15  Anders Carlsson  <andersca@apple.com>
2103
2104         Reviewed by Adam.
2105
2106         Add ENABLE_OFFLINE_WEB_APPLICATIONS to FEATURE_DEFINES.
2107         
2108         * Configurations/JavaScriptCore.xcconfig:
2109
2110 2008-04-15  Andre Poenitz  <andre.poenitz@trolltech.com>
2111
2112         Reviewed by Simon.
2113
2114         Fix compilation with Qt namespaces
2115
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.
2118
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
2121         the namespace.
2122
2123         * wtf/unicode/qt4/UnicodeQt4.h:
2124
2125 2008-04-14  Anders Carlsson  <andersca@apple.com>
2126
2127         Reviewed by Adam.
2128
2129         Don't leak the prototype class.
2130         
2131         * API/JSClassRef.cpp:
2132         (OpaqueJSClass::create):
2133
2134 2008-04-14  Steve Falkenburg  <sfalken@apple.com>
2135
2136         Fix build.
2137
2138         * wtf/ThreadingWin.cpp:
2139
2140 2008-04-14  Alexey Proskuryakov  <ap@webkit.org>
2141
2142         Reviewed by Adam Roben.
2143
2144         https://bugs.webkit.org/show_bug.cgi?id=18488
2145         FastMalloc doesn't release thread-specific data on Windows
2146
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.
2154
2155 2008-04-14  Alexey Proskuryakov  <ap@webkit.org>
2156
2157         Touched a file to make JavaScriptCore.vcproj rebuild.
2158
2159         * wtf/MathExtras.h:
2160
2161 2008-04-14  Adam Roben  <aroben@apple.com>
2162
2163         Windows build fix
2164
2165         Rubberstamped by Alexey Proskuryakov.
2166
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.
2171
2172 2008-04-11  Antti Koivisto  <antti@apple.com>
2173
2174         Reviewed by Maciej.
2175         
2176         Add default hash for pairs of hashable types.
2177
2178         * wtf/HashFunctions.h:
2179         (WTF::PairHash::hash):
2180         (WTF::PairHash::equal):
2181         (WTF::):
2182
2183 2008-04-11  Alexey Proskuryakov  <ap@webkit.org>
2184
2185         Reviewed by Geoff.
2186
2187         Make DateMath.cpp thread safe.
2188
2189         No measurable change on SunSpider (should be a very small speedup).
2190
2191         * kjs/DateMath.cpp:
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().
2196
2197         (KJS::initDateMath): Added.
2198
2199         * kjs/DateMath.h:
2200         * kjs/InitializeThreading.cpp:
2201         (KJS::initializeThreading):
2202         Added initDateMath().
2203
2204 2008-04-11  Alexey Proskuryakov  <ap@webkit.org>
2205
2206         Windows build fix.
2207
2208         * kjs/grammar.y:
2209
2210 2008-04-11  Alexey Proskuryakov  <ap@webkit.org>
2211
2212         Tiger build fix. Forward declaring a union didn't work for whatever reason, make the
2213         parameters void*.
2214
2215         * kjs/grammar.y:
2216         * kjs/lexer.cpp:
2217         (kjsyylex):
2218         (KJS::Lexer::lex):
2219         * kjs/lexer.h:
2220
2221 2008-04-11  Alexey Proskuryakov  <ap@webkit.org>
2222
2223         Reviewed by Geoff.
2224
2225         Generate a pure (re-entrant) parser with Bison.
2226
2227         No change on SunSpider.
2228
2229         * kjs/Parser.cpp:
2230         (KJS::Parser::parse):
2231         * kjs/grammar.y:
2232         * kjs/lexer.cpp:
2233         (kjsyylex):
2234         (KJS::Lexer::lex):
2235         * kjs/lexer.h:
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.
2238
2239         * kjs/function.cpp:
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.
2243
2244 2008-04-10  Alexey Proskuryakov  <ap@webkit.org>
2245
2246         Reviewed by Geoff.
2247
2248         https://bugs.webkit.org/show_bug.cgi?id=18402
2249         REGRESSION: visited element handling is incorrect in nested join/toString calls
2250
2251         No change on SunSpider total, possibly a tiny improvement (about 0.1%).
2252
2253         Test: fast/js/array-tostring-and-join.html
2254
2255         * kjs/JSGlobalObject.h:
2256         (KJS::JSGlobalObject::visitedElements): Store visited elements HashSet here, making it
2257         common to toString/toLocalizedString/join again.
2258
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
2264         regain performance.
2265
2266         * wtf/Vector.h:
2267         (WTF::::resize):
2268         (WTF::::grow):
2269         (WTF::::reserveCapacity):
2270         (WTF::::append):
2271         (WTF::::insert):
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.
2274
2275 2008-04-10  Mark Rowe  <mrowe@apple.com>
2276
2277         Reviewed by Maciej Stachowiak.
2278
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
2281
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.
2287
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.
2292
2293         * kjs/collector.cpp:
2294         (KJS::Collector::markCurrentThreadConservativelyInternal):
2295         (KJS::Collector::markCurrentThreadConservatively):
2296         * kjs/collector.h:
2297
2298 2008-04-10  Adam Roben  <aroben@apple.com>
2299
2300         VC++ Express build fix
2301
2302         * JavaScriptCore.vcproj/WTF/WTF.vcproj: Link against user32.lib so
2303         that anyone who links against WTF.lib will get user32.lib
2304         automatically.
2305
2306 2008-04-09  Adam Roben  <aroben@apple.com>
2307
2308         VC++ Express build fix
2309
2310         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Link against
2311         user32.lib.
2312
2313 2008-04-09  Adam Roben  <aroben@apple.com>
2314
2315         Build fix
2316
2317         * JavaScriptCore.exp: Export isMainThread.
2318
2319 2008-04-09  Adam Roben  <aroben@apple.com>
2320
2321         Build fix
2322
2323         * wtf/AlwaysInline.h: Make sure to #include Platform.h before using
2324         the macros it defines.
2325
2326 2008-04-08  Mark Rowe  <mrowe@apple.com>
2327
2328         Export WTF::initializeThreading() from JavaScriptCore.
2329
2330         * JavaScriptCore.exp:
2331
2332 2008-04-04  Sam Weinig  <sam@webkit.org>
2333
2334         Reviewed by Geoffrey Garen.
2335
2336         First step in implementing the "split window"
2337
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
2344           reason.
2345         - Have PrototypeReflexiveFunction store the globalObject used
2346           to create it so that it can be used to get the correct thisObject
2347           for eval.
2348
2349         * API/JSObjectRef.cpp:
2350         (JSObjectCallAsFunction):
2351         * JavaScriptCore.exp:
2352         * kjs/Activation.h:
2353         * kjs/ExecState.cpp:
2354         (KJS::ExecState::ExecState):
2355         (KJS::GlobalExecState::GlobalExecState):
2356         * kjs/ExecState.h:
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):
2377         * kjs/function.cpp:
2378         (KJS::FunctionImp::callAsFunction):
2379         (KJS::ActivationImp::toThisObject):
2380         (KJS::globalFuncEval):
2381         (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
2382         (KJS::PrototypeReflexiveFunction::mark):
2383         * kjs/function.h:
2384         (KJS::PrototypeReflexiveFunction::cachedGlobalObject):
2385         * kjs/function_object.cpp:
2386         (KJS::functionProtoFuncApply):
2387         (KJS::functionProtoFuncCall):
2388         * kjs/nodes.cpp:
2389         (KJS::ExpressionNode::resolveAndCall):
2390         (KJS::FunctionCallValueNode::evaluate):
2391         (KJS::LocalVarFunctionCallNode::inlineEvaluate):
2392         (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
2393         (KJS::FunctionCallBracketNode::evaluate):
2394         (KJS::FunctionCallDotNode::inlineEvaluate):
2395         * kjs/object.cpp:
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):
2404         * kjs/object.h:
2405         * kjs/object_object.cpp:
2406         (KJS::objectProtoFuncLookupGetter):
2407         (KJS::objectProtoFuncLookupSetter):
2408         * kjs/string_object.cpp:
2409         (KJS::replace):
2410
2411 2008-04-08  Brady Eidson  <beidson@apple.com>
2412
2413         Encourage Windows to rebuild - AGAIN...
2414
2415         * kjs/DateMath.cpp:
2416
2417 2008-04-08  Adam Roben  <aroben@apple.com>
2418
2419         Mac build fix
2420
2421         * JavaScriptCore.exp: Add callOnMainThread, and sorted the list.
2422
2423 2008-04-08  Brady Eidson  <beidson@apple.com>
2424
2425         Rubberstamped by Adam Roben
2426         
2427         Touch some files to *strongly* encourage Windows to rebuilt with DOM_STORAGE enabled
2428
2429         * kjs/DateMath.cpp:
2430
2431 2008-04-08  Adam Roben  <aroben@apple.com>
2432
2433         Move callOnMainThread to WTF
2434
2435         Reviewed by Alexey Proskuryakov.
2436
2437         * GNUmakefile.am:
2438         * JavaScriptCore.pri:
2439         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
2440         * JavaScriptCore.xcodeproj/project.pbxproj:
2441         * JavaScriptCoreSources.bkl:
2442         Added new files.
2443
2444         * wtf/MainThread.cpp:
2445         * wtf/MainThread.h:
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"
2452         with "WTF".
2453
2454         * kjs/bool_object.cpp: Touched to force JavaScriptCore.vcproj to
2455         build.
2456         to the WTF namespace.
2457         * wtf/ThreadingWin.cpp:
2458         (WTF::initializeThreading): Call initializeMainThread.
2459
2460 2008-04-07  Brady Eidson  <beidson@apple.com>
2461
2462         Add "ENABLE_DOM_STORAGE" to keep in sync with the rest of the project
2463
2464         * Configurations/JavaScriptCore.xcconfig:
2465
2466 2008-04-07  Adam Roben  <aroben@apple.com>
2467
2468         Windows build fix
2469
2470         * wtf/ThreadingWin.cpp: Back out some changes I didn't mean to land.
2471
2472 2008-04-07  Adam Roben  <aroben@apple.com>
2473
2474         Add WTF::isMainThread
2475
2476         Reviewed by Alexey Proskuryakov.
2477
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):
2491
2492 2008-04-06  Alexey Proskuryakov  <ap@webkit.org>
2493
2494         Reviewed by Darin.
2495
2496         Make UString thread-safe.
2497
2498         No change on SunSpider total, although individual tests have changed a lot, up to 3%.
2499
2500         * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Call UString::null() to initialize
2501         a static.
2502         
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++.
2507
2508         * kjs/ustring.h:
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.
2515
2516         * kjs/ustring.cpp:
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
2519         about UChar.
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().
2529
2530 2008-04-02  Mark Rowe  <mrowe@apple.com>
2531
2532         Reviewed by Oliver Hunt.
2533
2534         Ensure that debug symbols are generated for x86_64 and ppc64 builds.
2535
2536         * Configurations/Base.xcconfig:
2537
2538 2008-04-01  Christian Dywan  <christian@imendio.com>
2539
2540         Build fix for GCC 4.3.
2541
2542         * wtf/unicode/icu/CollatorICU.cpp: include string.h
2543
2544 2008-04-01  Alexey Proskuryakov  <ap@webkit.org>
2545
2546         Rubber-stamped by Darin.
2547
2548         Turn off using 64-bit arithmetic on 32-bit hardware, as dtoa own code is faster than
2549         compiler-provided emulation.
2550
2551         1% speedup on Acid3 test 26.
2552
2553         * kjs/dtoa.cpp:
2554
2555 2008-04-01  Alexey Proskuryakov  <ap@webkit.org>
2556
2557         Reviewed by Darin.
2558
2559         Make MathExtras.h thread safe.
2560
2561         * kjs/math_object.cpp:
2562         (KJS::mathProtoFuncRandom): If threading is enabled, rely on initializeThreading to call
2563         wtf_random_init().
2564
2565         * wtf/Threading.h:
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.
2576
2577 2008-03-31  Eric Seidel  <eric@webkit.org>
2578
2579         Reviewed by darin.
2580
2581         Make matching of regexps using ^ much faster
2582         http://bugs.webkit.org/show_bug.cgi?id=18086
2583
2584         * pcre/pcre_compile.cpp:
2585         (compileBranch):
2586         (branchNeedsLineStart):
2587         * pcre/pcre_exec.cpp:
2588         (match):
2589         (jsRegExpExecute):
2590         * pcre/pcre_internal.h:
2591
2592 2008-03-29  Alexey Proskuryakov  <ap@webkit.org>
2593
2594         Reviewed by Oliver Hunt.
2595
2596         <rdar://problem/5829556> REGRESSION: Leak in KJS::initializeThreading()
2597
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.
2600
2601 2008-03-29  Oliver Hunt  <oliver@apple.com>
2602
2603         Reviewed by Geoff.
2604
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>
2608
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.
2612
2613         * kjs/nodes.cpp:
2614         (KJS::ConstDeclNode::handleSlowCase):
2615
2616 2008-03-28  Alexey Proskuryakov  <ap@webkit.org>
2617
2618         Reviewed by Sam Weinig.
2619
2620         Fix a dtoa thread safety issue.
2621
2622         WebCore can call kjs_strtod without holding JS lock, but we didn't have thread safety
2623         compiled in for dtoa.
2624
2625         This is a 0.5% regression on SunSpider, which Sam Weinig has volunteered to cover with
2626         his recent improvement.
2627
2628         * kjs/dtoa.cpp:
2629         (Bigint::Balloc):
2630         (Bigint::Bfree):
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.
2636
2637         (Bigint::rv_alloc):
2638         (Bigint::kjs_freedtoa):
2639         (Bigint::kjs_dtoa):
2640         Check for USE(MULTIPLE_THREADS), not dtoa legacy MULTIPLE_THREADS.
2641
2642         * kjs/InitializeThreading.cpp: Added.
2643         (KJS::initializeThreading):
2644         * kjs/InitializeThreading.h: Added.
2645         Initialize threading at KJS level, if enabled.
2646
2647         * kjs/dtoa.h: Expose dtoa mutex for KJS::initializeThreading.
2648
2649         * kjs/testkjs.cpp: (kjsmain): Call initializeThreading.
2650
2651         * JavaScriptCore.exp: Export KJS::initializeThreading.
2652
2653         * GNUmakefile.am:
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}.
2660
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.
2663
2664 2008-03-28  Brady Eidson  <beidson@apple.com>
2665
2666         Reviewed by Darin
2667
2668         Export Unicode/UTF8.h and convertUTF16ToUTF8() for more flexible conversion in WebCore
2669
2670         * JavaScriptCore.exp:
2671         * JavaScriptCore.xcodeproj/project.pbxproj:
2672
2673 2008-03-27  Darin Adler  <darin@apple.com>
2674
2675         Reviewed by Mark Rowe.
2676
2677         <rdar://problem/5826236> Regular expressions with large nested repetition counts can have their
2678         compiled length calculated incorrectly.
2679
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.
2684
2685 2008-03-26  Mark Rowe  <mrowe@apple.com>
2686
2687         Rubber-stamped by Brady Eidson.
2688
2689         Update FEATURE_DEFINES to be consistent with the other locations in which it is defined.
2690
2691         * Configurations/JavaScriptCore.xcconfig:
2692
2693 2008-03-26  Adam Roben  <aroben@apple.com>
2694
2695         Fix Bug 18060: Assertion failure (JSLock not held) beneath
2696         JSCallbackObject<Base>::toString
2697
2698         <http://bugs.webkit.org/show_bug.cgi?id=18060>
2699
2700         Reviewed by Geoff Garen.
2701
2702         Bug fix:
2703
2704         * API/JSCallbackObjectFunctions.h:
2705         (KJS::JSCallbackObject<Base>::toString): Make the DropAllLocks
2706         instance only be in scope while calling convertToType.
2707
2708         Test:
2709
2710         * API/testapi.c:
2711         (MyObject_convertToType): Implement type conversion to string.
2712         * API/testapi.js: Add a test for type conversion to string.
2713
2714 2008-03-26  Adam Roben  <aroben@apple.com>
2715
2716         Windows build fix
2717
2718         * kjs/array_instance.cpp: Touched this.
2719         * wtf/HashFunctions.h:
2720         (WTF::intHash): Added 8- and 16-bit versions of intHash.
2721
2722 2008-03-26  Adam Roben  <aroben@apple.com>
2723
2724         Force JSC headers to be copied by touching a file
2725
2726         * kjs/array_instance.cpp:
2727         (KJS::ArrayInstance::getPropertyNames):
2728
2729 2008-03-26  Adam Roben  <aroben@apple.com>
2730
2731         Windows build fix after r31324
2732
2733         Written with Darin.
2734
2735         Added HashTable plumbing to support using wchar_t as a key type.
2736
2737         * wtf/HashFunctions.h:
2738         * wtf/HashTraits.h:
2739         (WTF::):
2740
2741 2008-03-26  Maciej Stachowiak  <mjs@apple.com>
2742
2743         Reviewed by Darin.
2744
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
2747
2748         * wtf/HashFunctions.h:
2749         (WTF::):
2750         * wtf/HashTraits.h:
2751         (WTF::):
2752
2753 2008-03-26  Alexey Proskuryakov  <ap@webkit.org>
2754
2755         Reviewed by Darin.
2756
2757         Cache C string identifiers by address, not value, assuming that C strings can only
2758         be literals.
2759
2760         1% speedup on Acid3 test 26.
2761
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.
2767
2768         * kjs/identifier.h:
2769         (KJS::Identifier::Identifier): Added a warning.
2770
2771 2008-03-26  Alexey Proskuryakov  <ap@webkit.org>
2772
2773         Rubber-stamped by Maciej.
2774
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
2777         ASSERTs.
2778
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.
2782
2783         * kjs/dtoa.cpp: (d2b): Removed the assertion (two copies in different code paths).
2784
2785 2008-03-25  Adam Roben  <aroben@apple.com>
2786
2787         Fix Bug 18077: Integrate testapi.c into the Windows build
2788
2789         <http://bugs.webkit.org/show_bug.cgi?id=18077>
2790
2791         Reviewed by Steve Falkenburg.
2792
2793         * JavaScriptCore.vcproj/testapi/testapi.vcproj: Added.
2794
2795 2008-03-25  Adam Roben  <aroben@apple.com>
2796
2797         Make testapi.c compile under MSVC
2798
2799         Currently you must compile testapi.c as C++ code since MSVC does not
2800         support many C features that GCC does.
2801
2802         Reviewed by Steve Falkenburg.
2803
2804         * API/testapi.c:
2805         (nan): Added an implementation of this for MSVC.
2806         (assertEqualsAsUTF8String): Use malloc instead of dynamically-sized
2807         stack arrays.
2808         (assertEqualsAsCharactersPtr): Ditto.
2809         (print_callAsFunction): Ditto.
2810         (main): Ditto, and explicitly cast from UniChar* to JSChar*.
2811
2812 2008-03-25  Adam Roben  <aroben@apple.com>
2813
2814         Stop using JavaScriptCore's custom stdbool.h and stdint.h on Windows
2815
2816         We can't remove the os-win32 directory yet because other ports (at
2817         least wx) are still relying on it.
2818
2819         Reviewed by Steve Falkenburg.
2820
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
2829         directory.
2830
2831 2008-03-25  Alexey Proskuryakov  <ap@webkit.org>
2832
2833         Windows build fix.
2834
2835         * kjs/dtoa.cpp: Include stdint.h.
2836
2837 2008-03-25  Alexey Proskuryakov  <ap@webkit.org>
2838
2839         Rubber-stamped by Darin.
2840
2841         Cleanup dtoa.cpp style.
2842
2843         * kjs/dtoa.cpp:
2844         (Bigint::Balloc):
2845         (Bigint::Bfree):
2846         (Bigint::multadd):
2847         (Bigint::s2b):
2848         (Bigint::hi0bits):
2849         (Bigint::lo0bits):
2850         (Bigint::i2b):
2851         (Bigint::mult):
2852         (Bigint::pow5mult):
2853         (Bigint::lshift):
2854         (Bigint::cmp):
2855         (Bigint::diff):
2856         (Bigint::ulp):
2857         (Bigint::b2d):
2858         (Bigint::d2b):
2859         (Bigint::ratio):
2860         (Bigint::):
2861         (Bigint::match):
2862         (Bigint::hexnan):
2863         (Bigint::kjs_strtod):
2864         (Bigint::quorem):
2865         (Bigint::rv_alloc):
2866         (Bigint::nrv_alloc):
2867         (Bigint::kjs_freedtoa):
2868         (Bigint::kjs_dtoa):
2869         * kjs/dtoa.h:
2870
2871 2008-03-24  Darin Adler  <darin@apple.com>
2872
2873         Reviewed by Sam.
2874
2875         - convert a JavaScript immediate number to a string more efficiently
2876
2877         2% speedup of Acid3 test 26
2878
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.
2884
2885 2008-03-23  Sam Weinig  <sam@webkit.org>
2886
2887         Reviewed by Darin Adler.
2888
2889         Fix http://bugs.webkit.org/show_bug.cgi?id=18048
2890         The "thisObject" parameter to JSEvaluateScript is not used properly
2891
2892         Making passing a thisObject to JSEvaluateScript actually set the thisObject of the created
2893         ExecState.
2894
2895         * API/testapi.c:
2896         (main): Add tests for setting the thisObject when calling JSEvaluateScript.
2897
2898         * kjs/ExecState.cpp:
2899         (KJS::ExecState::ExecState): Assign the thisObject to m_thisValue and remove the comment. 
2900
2901 2008-03-22  Jesse Ruderman  <jruderman@gmail.com>
2902
2903         Reviewed by Sam Weinig.  Landed by eseidel.
2904         
2905         Make testkjs flush stdout after printing.
2906
2907         * JavaScriptCore.xcodeproj/project.pbxproj:
2908         * kjs/testkjs.cpp:
2909         (functionPrint):
2910
2911 2008-03-21  Oliver Hunt  <oliver@apple.com>
2912
2913         Reviewed by Maciej.
2914
2915         Optimise lookup of Math, undefined, NaN and Infinity
2916
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.
2920
2921         * kjs/JSGlobalObject.cpp:
2922         (KJS::JSGlobalObject::reset):
2923         * kjs/JSVariableObject.h:
2924         (KJS::JSVariableObject::symbolTableInsert):
2925
2926 2008-03-21  Oliver Hunt  <oliver@apple.com>
2927
2928         Reviewed by Geoff Garen.
2929
2930         Global properties that use LocalStorage are not correctly listed as enumerable.
2931
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
2935         regression.
2936
2937         * JavaScriptCore.exp:
2938         * kjs/JSVariableObject.cpp:
2939         (KJS::JSVariableObject::getPropertyNames):
2940         (KJS::JSVariableObject::getPropertyAttributes):
2941         * kjs/JSVariableObject.h:
2942         * kjs/object.h:
2943
2944 2008-03-21  Arkadiusz Miskiewicz  <arekm@maven.pl>
2945
2946         Webkit does not build on linux powerpc
2947
2948         <http://bugs.webkit.org/show_bug.cgi?id=17019>
2949
2950         Reviewed by David Kilzer.
2951
2952         * wtf/TCSpinLock.h:
2953         (TCMalloc_SpinLock::Unlock):
2954
2955 2008-03-21  Rodney Dawes  <dobey@wayofthemonkey.com>
2956
2957         Reviewed by Holger.
2958
2959         http://bugs.webkit.org/show_bug.cgi?id=17981
2960
2961         Add javascriptcore_cppflags to Programs_minidom_CPPFLAGS.
2962
2963         * GNUmakefile.am:
2964
2965 2008-03-21  Alexey Proskuryakov  <ap@webkit.org>
2966
2967         Reviewed by Oliver Hunt.
2968
2969         Consolidate static identifier initializers within CommonIdentifiers.
2970
2971         No reliably measurable change on SunSpider; maybe a tiny improvement (within 0.2%).
2972
2973         * kjs/CommonIdentifiers.h: Added static identifiers that were lazily initialized
2974         throughout the code.
2975
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. 
2985
2986         * kjs/lookup.h: Caching the identifier in a static wasn't a win on SunSpider, removed it.
2987
2988         * kjs/value.h:
2989         (KJS::jsNaN): We already have a shared NaN value, no need for a duplicate here.
2990
2991         * wtf/MathExtras.h:
2992         (wtf_atan2): Having local variables for numeric_limits constants is good for readability,
2993         but there is no reason to keep them static.
2994
2995         * JavaScriptCore.exp: Don't needlessly export JSGlobalObject::s_head.
2996
2997 2008-03-20  Oliver Hunt  <oliver@apple.com>
2998
2999         Reviewed by Maciej.
3000
3001         Fix for leak introduced by inline ScopeChainNode use
3002
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.
3007
3008         We resolve this by manually popping the inline node in the
3009         FunctionExecState destructor.
3010
3011         * JavaScriptCore.xcodeproj/project.pbxproj:
3012         * kjs/ExecStateInlines.h:
3013         (KJS::FunctionExecState::~FunctionExecState):
3014         * kjs/scope_chain.h:
3015         (KJS::ScopeChain::popInlineScopeNode):
3016
3017 2008-03-20  Mark Rowe  <mrowe@apple.com>
3018
3019         Reviewed by Sam Weinig.
3020
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
3023         command-line.
3024
3025         * Configurations/JavaScriptCore.xcconfig:
3026
3027 2008-03-20  David Krause  <david.krause@gmail.com>
3028
3029         Reviewed by David Kilzer.
3030
3031         Fix http://bugs.webkit.org/show_bug.cgi?id=17923
3032         Bug 17923: ARM platform endian defines inaccurate
3033
3034         * wtf/Platform.h: 
3035         Replaced !defined(__ARMEL__) check with !defined(__VFP_FP__)
3036         for PLATFORM(MIDDLE_ENDIAN)
3037
3038 2008-03-20  Maciej Stachowiak  <mjs@apple.com>
3039
3040         - fix build
3041
3042         * JavaScriptCore.xcodeproj/project.pbxproj: install Activation.h as private
3043
3044 2008-03-20  Maciej Stachowiak  <mjs@apple.com>
3045
3046         Reviewed by Oliver.
3047         
3048         - reduce function call overhead for 1.014x speedup on SunSpider
3049
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.
3054         
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):
3066         * kjs/function.cpp:
3067
3068 2008-03-19  Oliver Hunt  <oliver@apple.com>
3069
3070         Reviewed by Maciej.
3071
3072         Avoid heap allocating the root scope chain node for eval and closure free functions
3073
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 
3077         of other tests.
3078
3079         * kjs/ExecState.cpp:
3080         (KJS::ExecState::ExecState):
3081         * kjs/ExecState.h:
3082         * kjs/scope_chain.h:
3083         (KJS::ScopeChain::push):
3084
3085 2008-03-19  Mark Rowe  <mrowe@apple.com>
3086
3087         Reviewed by Sam Weinig.
3088
3089         Fix release build.
3090
3091         * kjs/JSGlobalObject.cpp:  Add missing #include.
3092
3093 2008-03-19  Sam Weinig  <sam@webkit.org>
3094
3095         Reviewed by Anders Carlsson.
3096
3097         Fix for <rdar://problem/5785694>
3098         Crash occurs at KJS::Collector::collect() when loading web clip widgets with a PAC file
3099
3100         Make the activeExecStates stack per JSGlobalObject instead of static to ensure
3101         thread safety.
3102
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):
3111         * kjs/ExecState.h:
3112         (KJS::):
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.
3121
3122 2008-03-19  Jasper Bryant-Greene  <jasper@unix.geek.nz>
3123
3124         Reviewed by Maciej Stachowiak.
3125
3126         Fix http://bugs.webkit.org/show_bug.cgi?id=17941
3127         Bug 17941: C++-style comments in JavaScriptCore API
3128
3129         * API/JSBase.h:
3130         Remove C++-style comments from public JavaScriptCore API, replacing
3131         with standard C90 block comments.
3132
3133 2008-03-19  Mark Rowe  <mrowe@apple.com>
3134
3135         Reviewed by Oliver Hunt.
3136
3137         Fix http://bugs.webkit.org/show_bug.cgi?id=17939
3138         Bug 17939: Crash decompiling "const a = 1, b;"
3139
3140         * kjs/nodes2string.cpp:
3141         (KJS::ConstDeclNode::streamTo): Null-check the correct variable.
3142
3143 2008-03-18  Oliver Hunt  <oliver@apple.com>
3144
3145         Reviewed by Mark Rowe.
3146
3147         Bug 17929: Incorrect decompilation with |const|, comma
3148         http://bugs.webkit.org/show_bug.cgi?id=17929
3149
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.
3153
3154         * kjs/nodes2string.cpp:
3155         (KJS::ConstDeclNode::streamTo):
3156
3157 2008-03-18  Darin Adler  <darin@apple.com>
3158
3159         Reviewed by Maciej.
3160
3161         - Speed up JavaScript built-in properties by changing the
3162           hash table to take advantage of the identifier objects
3163
3164         5% speedup for Acid3 test 26
3165
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.
3170         * kjs/lexer.cpp:
3171         (KJS::Lexer::lex): Updated for change to HashTable interface.
3172         * kjs/lookup.cpp:
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.
3178         * kjs/object.cpp:
3179         (KJS::JSObject::deleteProperty): Update for change to HashTable.
3180         (KJS::JSObject::findPropertyHashEntry): Ditto.
3181         (KJS::JSObject::getPropertyAttributes): Ditto.
3182         (KJS::JSObject::getPropertyNames): Ditto.
3183
3184 2008-03-18  Mark Rowe  <mrowe@apple.com>
3185
3186         Reviewed by Oliver Hunt.
3187
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__
3191
3192         * kjs/object.cpp:
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.
3196
3197 2008-03-18  Maciej Stachowiak  <mjs@apple.com>
3198
3199         Reviewed by Oliver.
3200         
3201         - inline ActivationImp::init for 0.8% SunSpider speedup
3202
3203         * kjs/Activation.h:
3204         (KJS::ActivationImp::init): Moved here from function.cpp
3205         * kjs/function.cpp:
3206
3207 2008-03-18  Simon Hausmann  <hausmann@webkit.org>
3208
3209         Fix the Qt build.
3210
3211         Including config.h like in the other .cpp files gets the #ifdeffery
3212         correct for rand_s.
3213
3214         * kjs/JSWrapperObject.cpp:
3215
3216 2008-03-17  Darin Adler  <darin@apple.com>
3217
3218         Reviewed by Maciej.
3219
3220         JavaScriptCore changes to support a WebCore speedup.
3221
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.
3225
3226 2008-03-18  Maciej Stachowiak  <mjs@apple.com>
3227
3228         Reviewed by Oliver.
3229         
3230         - a few micro-optimizations for 1.2% SunSpider speedup
3231
3232         * kjs/function.cpp:
3233         (KJS::FunctionImp::callAsFunction): check for Return completion before Throw,
3234         it is more likely.
3235         * kjs/object.cpp:
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
3239         prototype chain.
3240
3241 2008-03-17  Oliver Hunt  <oliver@apple.com>
3242
3243         Reviewed by Geoff.
3244
3245         Optimise multi-scope function call resolution
3246
3247         Refactor multiscope variable resolution and use to add
3248         optimised FunctionCallResolveNode subclasses.  
3249
3250         2.6% gain in sunspider performance, *25%* gain in controlflow-recursive
3251
3252         * kjs/nodes.cpp:
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):
3271         * kjs/nodes.h:
3272         (KJS::ScopedVarFunctionCallNode::):
3273         (KJS::NonLocalVarFunctionCallNode::):
3274
3275 2008-03-17  David Kilzer  <ddkilzer@apple.com>
3276
3277         Don't define PLATFORM(MIDDLE_ENDIAN) on little endian ARM.
3278
3279         Reviewed by Darin.
3280
3281         See <http://bugs.webkit.org/show_bug.cgi?id=15416#c13>.
3282
3283         * wtf/Platform.h: Added check for !defined(__ARMEL__) when defining
3284         PLATFORM(MIDDLE_ENDIAN).
3285
3286 2008-03-17  Oliver Hunt  <oliver@apple.com>
3287
3288         Reviewed by Geoff, Darin and Weinig.
3289
3290         Add fast multi-level scope lookup
3291         
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.
3295         
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.
3298
3299         * JavaScriptCore.exp:
3300         * kjs/Activation.h:
3301         * kjs/JSGlobalObject.cpp:
3302         * kjs/JSGlobalObject.h:
3303         * kjs/JSVariableObject.cpp:
3304         * kjs/JSVariableObject.h:
3305         * kjs/function.cpp:
3306         (KJS::ActivationImp::isDynamicScope):
3307         * kjs/nodes.cpp:
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):
3323         * kjs/nodes.h:
3324         (KJS::ScopedVarAccessNode::):
3325         (KJS::NonLocalVarAccessNode::):
3326         * kjs/object.h:
3327
3328  2008-03-16  weihongzeng  <weihong.zeng@hotmail.com>
3329  
3330          Reviewed by Darin Adler.
3331  
3332          http://bugs.webkit.org/show_bug.cgi?id=15416
3333          Add support for mixed-endian processors
3334  
3335          * kjs/dtoa.cpp: Add IEEE_ARM, triggered by PLATFORM(MIDDLE_ENDIAN).
3336  
3337 2008-03-16  Kevin Ollivier  <kevino@theolliviers.com>
3338
3339         Rubber stamped by Darin.
3340
3341         Add set-webkit-configuration support for wx port, and centralize
3342         build dir location setting.
3343
3344         http://bugs.webkit.org/show_bug.cgi?id=17790
3345
3346         * jscore.bkl:
3347
3348 2008-03-14  Steve Falkenburg  <sfalken@apple.com>
3349
3350         PGO build fixes.
3351
3352         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3353
3354 2008-03-14  Oliver Hunt  <oliver@apple.com>
3355
3356         Reviewed by Maciej.
3357
3358         Add logic to track whether a function uses a locally scoped eval or requires a closure
3359         
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
3363         walk.
3364
3365         * JavaScriptCore.exp:
3366         * kjs/NodeInfo.h:
3367         * kjs/Parser.cpp:
3368         (KJS::Parser::didFinishParsing):
3369         * kjs/Parser.h:
3370         (KJS::Parser::parse):
3371         * kjs/grammar.y:
3372         * kjs/nodes.cpp:
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):
3380         * kjs/nodes.h:
3381         (KJS::ScopeNode::):
3382         (KJS::ScopeNode::usesEval):
3383         (KJS::ScopeNode::needsClosure):
3384
3385 2008-03-14  Geoffrey Garen  <ggaren@apple.com>
3386
3387         Reviewed by Beth Dakin.
3388
3389         Fixed another problem with Vector::shrinkCapacity.
3390         
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.
3393
3394         * wtf/Vector.h:
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
3397         to move.
3398
3399 2008-03-14  Geoffrey Garen  <ggaren@apple.com>
3400
3401         Reviewed by Beth Dakin.
3402         
3403         Fixed a few problems with Vector::shrinkCapacity that I noticed in testing.
3404
3405         * wtf/Vector.h:
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.)
3410         
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.
3415         
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.
3421
3422 2008-03-14  Alexey Proskuryakov  <ap@webkit.org>
3423
3424         Reviewed by Darin.
3425
3426         Get rid of a localime() call on platforms that have better alternatives.
3427
3428         * kjs/DateMath.h: Added getLocalTime();
3429
3430         * kjs/DateMath.cpp:
3431         (KJS::getLocalTime):
3432         (KJS::getDSTOffsetSimple):
3433         Implementation moved from getDSTOffsetSimple().
3434
3435         * kjs/date_object.cpp:
3436         (KJS::DateObjectImp::callAsFunction): Switched to getLocalTime().
3437
3438 2008-03-14  David D. Kilzer  <ddkilzer@apple.com>
3439
3440         Unify concept of enabling the Mac Java bridge.
3441
3442         Reviewed by Darin and Anders.
3443
3444         * wtf/Platform.h: Define ENABLE_MAC_JAVA_BRIDGE here.
3445
3446 2008-03-13  Mark Mentovai  <mark@moxienet.com>
3447
3448         Reviewed by eseidel.  Landed by eseidel.
3449
3450         * wtf/FastMalloc.cpp: #include <wtf/HashSet.h> outside of any
3451         namespaces.
3452
3453 2008-03-13  Mark Mentovai  <mark@moxienet.com>
3454
3455         Reviewed by eseidel.  Landed by eseidel.
3456
3457         * pcre/pcre_exec.cpp: Fix misnamed variable, allowing -DDEBUG build
3458         to succeed.
3459         * wtf/ThreadingPthreads.cpp: #include <sys/time.h> for gettimeofday
3460         in non-pch build.
3461
3462 2008-03-13  Steve Falkenburg  <sfalken@apple.com>
3463
3464         PGO build fixes.
3465         
3466         Disable PGO for normal release builds.
3467         Added work-in-progress Release_PGOInstrument/Release_PGOOptimize targets.
3468
3469         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3470
3471 2008-03-13  Beth Dakin  <bdakin@apple.com>
3472
3473         Reviewed by Geoff.
3474
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. 
3480
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 
3483         now. 
3484
3485         * wtf/Vector.h:
3486         (WTF::VectorBufferBase::allocateBuffer):
3487         (WTF::::shrinkCapacity):
3488
3489 2008-03-13  Simon Hausmann  <hausmann@webkit.org>
3490
3491         Reviewed by Adam Roben.
3492
3493         Attempt at fixing the Qt/Windows build bot. Quote using double-quotes
3494         instead of single quotes.
3495
3496         * pcre/dftables:
3497
3498 2008-03-12  Steve Falkenburg  <sfalken@apple.com>
3499
3500         Build fix.
3501
3502         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
3503
3504 2008-03-12  Alp Toker  <alp@atoker.com>
3505
3506         Another autotools testkjs build fix attempt.
3507
3508         * GNUmakefile.am:
3509
3510 2008-03-12  Alp Toker  <alp@atoker.com>
3511
3512         Attempt to fix the autotools testkjs build on systems with
3513         non-standard include paths.
3514
3515         * GNUmakefile.am:
3516
3517 2008-03-11  Alexey Proskuryakov  <ap@webkit.org>
3518
3519         Reviewed by Darin.
3520
3521         <rdar://problem/5787743> REGRESSION: Crash at WTF::Collator::CreateCollator() running fast/js/kde/StringObject.html on Windows
3522
3523         * wtf/unicode/icu/CollatorICU.cpp:
3524         (WTF::Collator::createCollator): Check for null (== user default) m_locale before calling strcmp.
3525
3526 2008-03-11  Steve Falkenburg  <sfalken@apple.com>
3527
3528         Disable LTCG/PGO for grammar.cpp and nodes.cpp.
3529         PGO on these files causes us to hang.
3530         
3531         Copy newer vsprops files from relative WebKitLibraries path to environment variable based path.
3532         
3533         Reviewed by Oliver.
3534
3535         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3536         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
3537
3538 2008-03-10  Darin Adler  <darin@apple.com>
3539
3540         - Windows build fix
3541
3542         * kjs/function.cpp: (KJS::decode): Initialize variable.