e150d2f3c4eb714ec1282ad3cf8932d6b3b04f89
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2008-05-15  Kevin McCullough  <kmccullough@apple.com>
2
3         - Build fix.
4
5         * JavaScriptCore.exp:
6
7 2008-05-15  Kevin McCullough  <kmccullough@apple.com>
8
9         Reviewed by Tim.
10
11         <rdar://problem/5770054> JavaScript profiler (10928)
12         - Cache some values to save on computing them repetitively. This will be
13         a big savings when we sort since we won't have to walk the tree for
14         every comparison!
15         - We cache these values when we end profiling because otherwise we won't
16         know which profile to get the totalTime for the whole profile from without
17         retaining a reference to the head profile or looking up the profile from
18         the list of all profiles.
19         - Also it's safe to assume we won't be asked for these values while we
20         are still profiling since the WebInspector only get's profileNodes from
21         profiles that are in the allProfiles() list and a profile is only added
22         to that list after it has finished and these values will no longer
23         change.
24
25         * JavaScriptCore.exp:
26         * profiler/ProfileNode.cpp:
27         (KJS::ProfileNode::ProfileNode):
28         (KJS::ProfileNode::stopProfiling):
29         (KJS::ProfileNode::printDataInspectorStyle):
30         (KJS::ProfileNode::printDataSampleStyle):
31         (KJS::ProfileNode::endAndRecordCall):
32         * profiler/ProfileNode.h:
33         (KJS::ProfileNode::totalTime):
34         (KJS::ProfileNode::selfTime):
35         (KJS::ProfileNode::totalPercent):
36         (KJS::ProfileNode::selfPercent):
37         * profiler/Profiler.cpp:
38         (KJS::Profiler::stopProfiling):
39
40 2008-05-15  Simon Hausmann  <shausman@trolltech.com>
41
42         Reviewed by Holger.
43
44         Fix compilation when compiling with MSVC and wchar_t support.
45
46         * wtf/unicode/qt4/UnicodeQt4.h:
47         (WTF::Unicode::foldCase):
48         (WTF::Unicode::umemcasecmp):
49
50 2008-05-14  Kevin McCullough  <kmccullough@apple.com>
51
52         Reviewed by Tim.
53
54         <rdar://problem/5770054> JavaScript profiler (10928)
55         - Turn on the profiler.
56
57         * kjs/config.h:
58
59 2008-05-14  Kevin McCullough  <kmccullough@apple.com>
60
61         Reviewed by Tim.
62
63         <rdar://problem/5770054> JavaScript profiler (10928)
64         - Expose the new profiler functions to the WebInspector.
65
66         * JavaScriptCore.exp:
67
68 2008-05-14  Kevin McCullough  <kmccullough@apple.com>
69
70         Giving credit where credit is due.
71
72         * ChangeLog:
73
74 2008-05-14  Kevin McCullough  <kmccullough@apple.com>
75
76         Reviewed by Geoff and Sam.
77
78         <rdar://problem/5770054> JavaScript profiler (10928)
79         Add the ability to get percentages of total and self time for displaying
80         in the WebInspector.
81
82         * profiler/Profile.h:
83         (KJS::Profile::totalProfileTime):
84         * profiler/ProfileNode.cpp:
85         (KJS::ProfileNode::totalPercent):
86         (KJS::ProfileNode::selfPercent):
87         * profiler/ProfileNode.h:
88         * profiler/Profiler.h:
89         (KJS::Profiler::currentProfile):
90
91 2008-05-14  Kevin McCullough  <kmccullough@apple.com>
92
93         Reviewed by Sam.
94
95         <rdar://problem/5770054> JavaScript profiler (10928)
96         - Rename FunctionCallProfile to ProfileNode.
97
98         * GNUmakefile.am:
99         * JavaScriptCore.exp:
100         * JavaScriptCore.pri:
101         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
102         * JavaScriptCore.xcodeproj/project.pbxproj:
103         * JavaScriptCoreSources.bkl:
104         * profiler/FunctionCallProfile.cpp: Removed.
105         * profiler/FunctionCallProfile.h: Removed.
106         * profiler/Profile.cpp:
107         (KJS::Profile::Profile):
108         (KJS::Profile::willExecute):
109         * profiler/Profile.h:
110         (KJS::Profile::callTree):
111         * profiler/ProfileNode.cpp: Copied from profiler/FunctionCallProfile.cpp.
112         (KJS::ProfileNode::ProfileNode):
113         (KJS::ProfileNode::willExecute):
114         (KJS::ProfileNode::didExecute):
115         (KJS::ProfileNode::addChild):
116         (KJS::ProfileNode::findChild):
117         (KJS::ProfileNode::stopProfiling):
118         (KJS::ProfileNode::selfTime):
119         (KJS::ProfileNode::printDataInspectorStyle):
120         (KJS::ProfileNode::printDataSampleStyle):
121         (KJS::ProfileNode::endAndRecordCall):
122         * profiler/ProfileNode.h: Copied from profiler/FunctionCallProfile.h.
123         (KJS::ProfileNode::create):
124         (KJS::ProfileNode::children):
125         * profiler/Profiler.cpp:
126
127 2008-05-14  Kevin McCullough  <kmccullough@apple.com>
128
129         Reviewed by John.
130
131         <rdar://problem/5770054> JavaScript profiler (10928)
132         - Have each FunctionCallProfile be able to return it's total and self time.
133
134         * JavaScriptCore.exp:
135         * profiler/FunctionCallProfile.cpp:
136         (KJS::FunctionCallProfile::selfTime):
137         * profiler/FunctionCallProfile.h:
138         (KJS::FunctionCallProfile::totalTime):
139
140 2008-05-14  Alexey Proskuryakov  <ap@webkit.org>
141
142         Reviewed by Darin.
143
144         <rdar://problem/5934376> REGRESSION: A script fails because of a straw BOM character in it.
145
146         <https://bugs.webkit.org/show_bug.cgi?id=4931>
147         Unicode format characters (Cf) should be removed from JavaScript source
148
149         Of all Cf characters, we are only removing BOM, because this is what Firefox trunk has
150         settled upon, after extensive discussion and investigation.
151
152         Based on Darin's work on this bug.
153
154         Test: fast/js/removing-Cf-characters.html
155
156         * kjs/lexer.cpp:
157         (KJS::Lexer::setCode): Tweak formatting. Use a call to shift(4) to read in the
158         first characters, instead of having special case code here.
159         (KJS::Lexer::shift): Add a loop when reading a character to skip BOM characters.
160
161 2008-05-13  Matt Lilek  <webkit@mattlilek.com>
162
163         Not reviewed, build fix.
164
165         * kjs/date_object.cpp:
166         (KJS::DateObjectFuncImp::callAsFunction):
167
168 2008-05-13  Anders Carlsson  <andersca@apple.com>
169
170         Reviewed by Sam.
171
172         <rdar://problem/5933644> Implement Date.now
173         
174         Implement Date.now which returns the number of milliseconds since the epoch.
175         
176         * kjs/CommonIdentifiers.h:
177         * kjs/date_object.cpp:
178         (KJS::DateObjectFuncImp::):
179         (KJS::DateObjectImp::DateObjectImp):
180         (KJS::DateObjectFuncImp::callAsFunction):
181
182 2008-05-13  Kevin McCullough  <kmccullough@apple.com>
183
184         Giving credit where credit is due.
185
186         * ChangeLog:
187
188 2008-05-13  Kevin McCullough  <kmccullough@apple.com>
189
190         Reviewed by Adam and Geoff.
191
192         <rdar://problem/5770054> JavaScript profiler (10928)
193         Use PassRefPtrs instead of RefPtrs when appropriate.
194
195         * profiler/FunctionCallProfile.cpp:
196         (KJS::FunctionCallProfile::addChild):
197         * profiler/FunctionCallProfile.h:
198         * profiler/Profile.h:
199         (KJS::Profile::callTree):
200
201 2008-05-13  Kevin McCullough  <kmccullough@apple.com>
202
203         Reviewed by Sam.
204
205         <rdar://problem/5770054> JavaScript profiler (10928)
206         - Made some functions static (as per Adam) and changed from using raw
207         pointers to RefPtr for making these JavaScript Objects.
208
209         * profiler/FunctionCallProfile.cpp:
210         (KJS::FunctionCallProfile::addChild):
211         (KJS::FunctionCallProfile::findChild):
212         * profiler/FunctionCallProfile.h:
213         (KJS::FunctionCallProfile::create):
214         * profiler/Profile.cpp:
215         (KJS::Profile::Profile):
216         (KJS::Profile::willExecute):
217         (KJS::Profile::didExecute):
218         (KJS::functionNameCountPairComparator):
219         * profiler/Profile.h:
220         (KJS::Profile::create):
221         (KJS::Profile::title):
222         (KJS::Profile::callTree):
223         * profiler/Profiler.cpp:
224         (KJS::Profiler::startProfiling):
225         * profiler/Profiler.h:
226         (KJS::Profiler::allProfiles):
227         (KJS::Profiler::clearProfiles):
228
229 2008-05-13  Alexey Proskuryakov  <ap@webkit.org>
230
231         Reviewed by Geoffrey Garen.
232
233         <rdar://problem/4949018> JavaScriptCore API claims to work with UTF8 strings, but only works
234         with ASCII strings
235         
236         * kjs/ustring.h:
237         * kjs/ustring.cpp:
238         (KJS::UString::Rep::createFromUTF8):
239         Added. Implementation adapted from JSStringCreateWithUTF8CString().
240
241         * API/JSStringRef.cpp:
242         (JSStringCreateWithUTF8CString):
243         * API/JSClassRef.cpp:
244         (OpaqueJSClass::OpaqueJSClass):
245         Use UString::Rep::createFromUTF8().
246
247 2008-05-12  Mark Rowe  <mrowe@apple.com>
248
249         Reviewed by Tim Hatcher.
250
251         <rdar://problem/4859666> WebKit needs availability macros in order to deprecate APIs
252
253         Create WebKit availability macros that key off the Mac OS X version being targeted to
254         determine the WebKit version being targeted.  Applications can define
255         WEBKIT_VERSION_MIN_REQUIRED before including WebKit headers in order to target a specific
256         version of WebKit.
257
258         The availability header is being added to JavaScriptCore rather than WebKit as JavaScriptCore
259         is the lowest-level portion of the public WebKit API.
260
261         * API/WebKitAvailability.h: Added.
262         * JavaScriptCore.xcodeproj/project.pbxproj:
263
264 2008-05-12  Alexey Proskuryakov  <ap@webkit.org>
265
266         Reviewed by Maciej.
267
268         https://bugs.webkit.org/show_bug.cgi?id=18828
269         Reproducible crash with PAC file
270
271         Naively moving JavaScriptCore into thread-specific data was inappropriate in the face of
272         exiting JavaScriptCore API clients, which expect a different therading model. Temporarily
273         disabling ThreadSpecific implementation until this can be sorted out.
274
275         * wtf/ThreadSpecific.h:
276         (WTF::::ThreadSpecific):
277         (WTF::::~ThreadSpecific):
278         (WTF::::get):
279         (WTF::::set):
280
281 2008-05-12  Alexey Proskuryakov  <ap@webkit.org>
282
283         Roll out recent  threading changes (r32807, r32810, r32819, r32822) to simplify
284         SquirrelFish merging.
285
286         * API/JSBase.cpp:
287         (JSGarbageCollect):
288         * API/JSCallbackObjectFunctions.h:
289         (KJS::::staticFunctionGetter):
290         * API/JSClassRef.cpp:
291         (OpaqueJSClass::prototype):
292         * API/JSObjectRef.cpp:
293         (JSObjectMake):
294         (JSObjectMakeFunctionWithCallback):
295         (JSObjectMakeConstructor):
296         (JSObjectMakeFunction):
297         * API/JSValueRef.cpp:
298         (JSValueMakeNumber):
299         (JSValueMakeString):
300         * JavaScriptCore.exp:
301         * kjs/ExecState.h:
302         * kjs/InitializeThreading.cpp:
303         (KJS::initializeThreadingOnce):
304         * kjs/JSGlobalObject.cpp:
305         (KJS::JSGlobalObject::~JSGlobalObject):
306         (KJS::JSGlobalObject::init):
307         (KJS::JSGlobalObject::put):
308         (KJS::JSGlobalObject::reset):
309         (KJS::JSGlobalObject::tearOffActivation):
310         * kjs/JSGlobalObject.h:
311         (KJS::JSGlobalObject::head):
312         (KJS::JSGlobalObject::perThreadData):
313         * kjs/JSLock.cpp:
314         (KJS::JSLock::registerThread):
315         * kjs/JSLock.h:
316         (KJS::JSLock::JSLock):
317         * kjs/array_instance.cpp:
318         (KJS::ArrayInstance::ArrayInstance):
319         (KJS::ArrayInstance::lengthGetter):
320         * kjs/array_object.cpp:
321         (KJS::arrayProtoFuncToString):
322         (KJS::arrayProtoFuncToLocaleString):
323         (KJS::arrayProtoFuncJoin):
324         (KJS::arrayProtoFuncConcat):
325         (KJS::arrayProtoFuncPop):
326         (KJS::arrayProtoFuncPush):
327         (KJS::arrayProtoFuncShift):
328         (KJS::arrayProtoFuncSlice):
329         (KJS::arrayProtoFuncSplice):
330         (KJS::arrayProtoFuncUnShift):
331         (KJS::arrayProtoFuncFilter):
332         (KJS::arrayProtoFuncMap):
333         (KJS::arrayProtoFuncEvery):
334         (KJS::arrayProtoFuncForEach):
335         (KJS::arrayProtoFuncSome):
336         (KJS::arrayProtoFuncIndexOf):
337         (KJS::arrayProtoFuncLastIndexOf):
338         (KJS::ArrayObjectImp::ArrayObjectImp):
339         (KJS::ArrayObjectImp::construct):
340         * kjs/bool_object.cpp:
341         (KJS::BooleanPrototype::BooleanPrototype):
342         (KJS::booleanProtoFuncToString):
343         (KJS::BooleanObjectImp::BooleanObjectImp):
344         (KJS::BooleanObjectImp::construct):
345         * kjs/collector.cpp:
346         (KJS::):
347         (KJS::allocateBlock):
348         (KJS::Collector::recordExtraCost):
349         (KJS::Collector::heapAllocate):
350         (KJS::Collector::allocate):
351         (KJS::Collector::allocateNumber):
352         (KJS::Collector::registerAsMainThread):
353         (KJS::onMainThread):
354         (KJS::PlatformThread::PlatformThread):
355         (KJS::getCurrentPlatformThread):
356         (KJS::Collector::Thread::Thread):
357         (KJS::destroyRegisteredThread):
358         (KJS::initializeRegisteredThreadKey):
359         (KJS::Collector::registerThread):
360         (KJS::Collector::markStackObjectsConservatively):
361         (KJS::Collector::markCurrentThreadConservativelyInternal):
362         (KJS::Collector::markCurrentThreadConservatively):
363         (KJS::suspendThread):
364         (KJS::resumeThread):
365         (KJS::getPlatformThreadRegisters):
366         (KJS::otherThreadStackPointer):
367         (KJS::Collector::markOtherThreadConservatively):
368         (KJS::protectedValues):
369         (KJS::Collector::protect):
370         (KJS::Collector::unprotect):
371         (KJS::Collector::collectOnMainThreadOnly):
372         (KJS::Collector::markProtectedObjects):
373         (KJS::Collector::markMainThreadOnlyObjects):
374         (KJS::Collector::sweep):
375         (KJS::Collector::collect):
376         (KJS::Collector::size):
377         (KJS::Collector::globalObjectCount):
378         (KJS::Collector::protectedGlobalObjectCount):
379         (KJS::Collector::protectedObjectCount):
380         (KJS::Collector::protectedObjectTypeCounts):
381         (KJS::Collector::isBusy):
382         (KJS::Collector::reportOutOfMemoryToAllExecStates):
383         * kjs/collector.h:
384         (KJS::):
385         (KJS::Collector::cellBlock):
386         (KJS::Collector::cellOffset):
387         (KJS::Collector::isCellMarked):
388         (KJS::Collector::markCell):
389         (KJS::Collector::reportExtraMemoryCost):
390         * kjs/date_object.cpp:
391         (KJS::formatLocaleDate):
392         (KJS::DatePrototype::DatePrototype):
393         (KJS::DateObjectImp::DateObjectImp):
394         (KJS::DateObjectImp::construct):
395         (KJS::DateObjectImp::callAsFunction):
396         (KJS::DateObjectFuncImp::DateObjectFuncImp):
397         (KJS::DateObjectFuncImp::callAsFunction):
398         (KJS::dateProtoFuncToString):
399         (KJS::dateProtoFuncToUTCString):
400         (KJS::dateProtoFuncToDateString):
401         (KJS::dateProtoFuncToTimeString):
402         (KJS::dateProtoFuncToLocaleString):
403         (KJS::dateProtoFuncToLocaleDateString):
404         (KJS::dateProtoFuncToLocaleTimeString):
405         (KJS::dateProtoFuncValueOf):
406         (KJS::dateProtoFuncGetTime):
407         (KJS::dateProtoFuncGetFullYear):
408         (KJS::dateProtoFuncGetUTCFullYear):
409         (KJS::dateProtoFuncToGMTString):
410         (KJS::dateProtoFuncGetMonth):
411         (KJS::dateProtoFuncGetUTCMonth):
412         (KJS::dateProtoFuncGetDate):
413         (KJS::dateProtoFuncGetUTCDate):
414         (KJS::dateProtoFuncGetDay):
415         (KJS::dateProtoFuncGetUTCDay):
416         (KJS::dateProtoFuncGetHours):
417         (KJS::dateProtoFuncGetUTCHours):
418         (KJS::dateProtoFuncGetMinutes):
419         (KJS::dateProtoFuncGetUTCMinutes):
420         (KJS::dateProtoFuncGetSeconds):
421         (KJS::dateProtoFuncGetUTCSeconds):
422         (KJS::dateProtoFuncGetMilliSeconds):
423         (KJS::dateProtoFuncGetUTCMilliseconds):
424         (KJS::dateProtoFuncGetTimezoneOffset):
425         (KJS::dateProtoFuncSetTime):
426         (KJS::setNewValueFromTimeArgs):
427         (KJS::setNewValueFromDateArgs):
428         (KJS::dateProtoFuncSetYear):
429         (KJS::dateProtoFuncGetYear):
430         * kjs/error_object.cpp:
431         (KJS::ErrorPrototype::ErrorPrototype):
432         (KJS::errorProtoFuncToString):
433         (KJS::ErrorObjectImp::ErrorObjectImp):
434         (KJS::ErrorObjectImp::construct):
435         (KJS::NativeErrorPrototype::NativeErrorPrototype):
436         (KJS::NativeErrorImp::NativeErrorImp):
437         (KJS::NativeErrorImp::construct):
438         * kjs/function.cpp:
439         (KJS::FunctionImp::lengthGetter):
440         (KJS::FunctionImp::construct):
441         (KJS::Arguments::Arguments):
442         (KJS::ActivationImp::createArgumentsObject):
443         (KJS::encode):
444         (KJS::decode):
445         (KJS::globalFuncParseInt):
446         (KJS::globalFuncParseFloat):
447         (KJS::globalFuncEscape):
448         (KJS::globalFuncUnescape):
449         (KJS::PrototypeFunction::PrototypeFunction):
450         (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
451         * kjs/function_object.cpp:
452         (KJS::FunctionPrototype::FunctionPrototype):
453         (KJS::functionProtoFuncToString):
454         (KJS::FunctionObjectImp::FunctionObjectImp):
455         (KJS::FunctionObjectImp::construct):
456         * kjs/internal.cpp:
457         (KJS::StringImp::toObject):
458         * kjs/internal.h:
459         (KJS::StringImp::StringImp):
460         (KJS::NumberImp::operator new):
461         * kjs/list.cpp:
462         (KJS::List::markSet):
463         (KJS::List::markProtectedListsSlowCase):
464         (KJS::List::expandAndAppend):
465         * kjs/list.h:
466         (KJS::List::List):
467         (KJS::List::~List):
468         (KJS::List::markProtectedLists):
469         * kjs/lookup.h:
470         (KJS::staticFunctionGetter):
471         (KJS::cacheGlobalObject):
472         * kjs/math_object.cpp:
473         (KJS::MathObjectImp::getValueProperty):
474         (KJS::mathProtoFuncAbs):
475         (KJS::mathProtoFuncACos):
476         (KJS::mathProtoFuncASin):
477         (KJS::mathProtoFuncATan):
478         (KJS::mathProtoFuncATan2):
479         (KJS::mathProtoFuncCeil):
480         (KJS::mathProtoFuncCos):
481         (KJS::mathProtoFuncExp):
482         (KJS::mathProtoFuncFloor):
483         (KJS::mathProtoFuncLog):
484         (KJS::mathProtoFuncMax):
485         (KJS::mathProtoFuncMin):
486         (KJS::mathProtoFuncPow):
487         (KJS::mathProtoFuncRandom):
488         (KJS::mathProtoFuncRound):
489         (KJS::mathProtoFuncSin):
490         (KJS::mathProtoFuncSqrt):
491         (KJS::mathProtoFuncTan):
492         * kjs/nodes.cpp:
493         (KJS::ParserRefCounted::ParserRefCounted):
494         (KJS::ParserRefCounted::ref):
495         (KJS::ParserRefCounted::deref):
496         (KJS::ParserRefCounted::refcount):
497         (KJS::ParserRefCounted::deleteNewObjects):
498         (KJS::Node::handleException):
499         (KJS::NumberNode::evaluate):
500         (KJS::StringNode::evaluate):
501         (KJS::ArrayNode::evaluate):
502         (KJS::PostIncResolveNode::evaluate):
503         (KJS::PostIncLocalVarNode::evaluate):
504         (KJS::PostDecResolveNode::evaluate):
505         (KJS::PostDecLocalVarNode::evaluate):
506         (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
507         (KJS::PostIncBracketNode::evaluate):
508         (KJS::PostDecBracketNode::evaluate):
509         (KJS::PostIncDotNode::evaluate):
510         (KJS::PostDecDotNode::evaluate):
511         (KJS::typeStringForValue):
512         (KJS::LocalVarTypeOfNode::evaluate):
513         (KJS::TypeOfResolveNode::evaluate):
514         (KJS::TypeOfValueNode::evaluate):
515         (KJS::PreIncLocalVarNode::evaluate):
516         (KJS::PreIncResolveNode::evaluate):
517         (KJS::PreDecLocalVarNode::evaluate):
518         (KJS::PreDecResolveNode::evaluate):
519         (KJS::PreIncConstNode::evaluate):
520         (KJS::PreDecConstNode::evaluate):
521         (KJS::PostIncConstNode::evaluate):
522         (KJS::PostDecConstNode::evaluate):
523         (KJS::PreIncBracketNode::evaluate):
524         (KJS::PreDecBracketNode::evaluate):
525         (KJS::PreIncDotNode::evaluate):
526         (KJS::PreDecDotNode::evaluate):
527         (KJS::NegateNode::evaluate):
528         (KJS::BitwiseNotNode::evaluate):
529         (KJS::MultNode::evaluate):
530         (KJS::DivNode::evaluate):
531         (KJS::ModNode::evaluate):
532         (KJS::addSlowCase):
533         (KJS::add):
534         (KJS::AddNumbersNode::evaluate):
535         (KJS::AddStringsNode::evaluate):
536         (KJS::AddStringLeftNode::evaluate):
537         (KJS::AddStringRightNode::evaluate):
538         (KJS::SubNode::evaluate):
539         (KJS::LeftShiftNode::evaluate):
540         (KJS::RightShiftNode::evaluate):
541         (KJS::UnsignedRightShiftNode::evaluate):
542         (KJS::BitXOrNode::evaluate):
543         (KJS::BitOrNode::evaluate):
544         (KJS::valueForReadModifyAssignment):
545         (KJS::ForInNode::execute):
546         (KJS::TryNode::execute):
547         (KJS::FuncDeclNode::makeFunction):
548         (KJS::FuncExprNode::evaluate):
549         * kjs/nodes.h:
550         * kjs/number_object.cpp:
551         (KJS::NumberPrototype::NumberPrototype):
552         (KJS::numberProtoFuncToString):
553         (KJS::numberProtoFuncToLocaleString):
554         (KJS::numberProtoFuncToFixed):
555         (KJS::numberProtoFuncToExponential):
556         (KJS::numberProtoFuncToPrecision):
557         (KJS::NumberObjectImp::NumberObjectImp):
558         (KJS::NumberObjectImp::getValueProperty):
559         (KJS::NumberObjectImp::construct):
560         (KJS::NumberObjectImp::callAsFunction):
561         * kjs/object.cpp:
562         (KJS::JSObject::call):
563         (KJS::JSObject::get):
564         (KJS::JSObject::put):
565         (KJS::JSObject::defineGetter):
566         (KJS::JSObject::defineSetter):
567         (KJS::JSObject::putDirect):
568         (KJS::Error::create):
569         * kjs/object.h:
570         * kjs/object_object.cpp:
571         (KJS::ObjectPrototype::ObjectPrototype):
572         (KJS::objectProtoFuncToLocaleString):
573         (KJS::objectProtoFuncToString):
574         (KJS::ObjectObjectImp::ObjectObjectImp):
575         (KJS::ObjectObjectImp::construct):
576         * kjs/property_map.h:
577         (KJS::SavedProperty::SavedProperty):
578         (KJS::SavedProperty::init):
579         (KJS::SavedProperty::~SavedProperty):
580         (KJS::SavedProperty::name):
581         (KJS::SavedProperty::value):
582         (KJS::SavedProperty::attributes):
583         * kjs/protect.h:
584         (KJS::gcProtect):
585         (KJS::gcUnprotect):
586         * kjs/regexp_object.cpp:
587         (KJS::RegExpPrototype::RegExpPrototype):
588         (KJS::regExpProtoFuncToString):
589         (KJS::RegExpImp::getValueProperty):
590         (KJS::RegExpObjectImp::RegExpObjectImp):
591         (KJS::RegExpObjectImp::arrayOfMatches):
592         (KJS::RegExpObjectImp::getBackref):
593         (KJS::RegExpObjectImp::getLastParen):
594         (KJS::RegExpObjectImp::getLeftContext):
595         (KJS::RegExpObjectImp::getRightContext):
596         (KJS::RegExpObjectImp::getValueProperty):
597         (KJS::RegExpObjectImp::createRegExpImp):
598         * kjs/regexp_object.h:
599         * kjs/string_object.cpp:
600         (KJS::StringInstance::StringInstance):
601         (KJS::StringInstance::lengthGetter):
602         (KJS::StringInstance::indexGetter):
603         (KJS::stringInstanceNumericPropertyGetter):
604         (KJS::StringPrototype::StringPrototype):
605         (KJS::replace):
606         (KJS::stringProtoFuncCharAt):
607         (KJS::stringProtoFuncCharCodeAt):
608         (KJS::stringProtoFuncConcat):
609         (KJS::stringProtoFuncIndexOf):
610         (KJS::stringProtoFuncLastIndexOf):
611         (KJS::stringProtoFuncMatch):
612         (KJS::stringProtoFuncSearch):
613         (KJS::stringProtoFuncReplace):
614         (KJS::stringProtoFuncSlice):
615         (KJS::stringProtoFuncSplit):
616         (KJS::stringProtoFuncSubstr):
617         (KJS::stringProtoFuncSubstring):
618         (KJS::stringProtoFuncToLowerCase):
619         (KJS::stringProtoFuncToUpperCase):
620         (KJS::stringProtoFuncToLocaleLowerCase):
621         (KJS::stringProtoFuncToLocaleUpperCase):
622         (KJS::stringProtoFuncLocaleCompare):
623         (KJS::stringProtoFuncBig):
624         (KJS::stringProtoFuncSmall):
625         (KJS::stringProtoFuncBlink):
626         (KJS::stringProtoFuncBold):
627         (KJS::stringProtoFuncFixed):
628         (KJS::stringProtoFuncItalics):
629         (KJS::stringProtoFuncStrike):
630         (KJS::stringProtoFuncSub):
631         (KJS::stringProtoFuncSup):
632         (KJS::stringProtoFuncFontcolor):
633         (KJS::stringProtoFuncFontsize):
634         (KJS::stringProtoFuncAnchor):
635         (KJS::stringProtoFuncLink):
636         (KJS::StringObjectImp::StringObjectImp):
637         (KJS::StringObjectImp::construct):
638         (KJS::StringObjectImp::callAsFunction):
639         (KJS::StringObjectFuncImp::StringObjectFuncImp):
640         (KJS::StringObjectFuncImp::callAsFunction):
641         * kjs/string_object.h:
642         (KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
643         * kjs/testkjs.cpp:
644         (GlobalObject::GlobalObject):
645         (functionGC):
646         (functionRun):
647         (functionReadline):
648         (kjsmain):
649         * kjs/ustring.h:
650         * kjs/value.cpp:
651         (KJS::JSCell::operator new):
652         (KJS::jsString):
653         (KJS::jsOwnedString):
654         (KJS::jsNumberCell):
655         * kjs/value.h:
656         (KJS::jsNaN):
657         (KJS::jsNumber):
658         (KJS::jsNumberFromAnd):
659         (KJS::JSCell::marked):
660         (KJS::JSCell::mark):
661         (KJS::JSValue::toJSNumber):
662         * wtf/ThreadSpecific.h:
663         (WTF::T):
664
665 2008-05-10  Julien Chaffraix  <jchaffraix@webkit.org>
666
667         Qt & wx build fix.
668
669         * JavaScriptCore.pri: Add profiler/Profile.cpp.
670         * JavaScriptCoreSources.bkl: Ditto.
671
672 2008-05-10  Jan Michael Alonzo  <jmalonzo@unpluggable.com>
673
674         Reviewed by Maciej.
675
676         Gtk+ build fix
677
678         * GNUmakefile.am: Add Profile.cpp in _sources
679
680 2008-05-09  Brady Eidson  <beidson@apple.com>
681
682         Build Fix.  Kevin is an idiot.  
683         ("My name is Kevin McCullough and I approve this message.")
684
685         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
686
687 2008-05-09  Kevin McCullough  <kmccullough@apple.com>
688
689         Reviewed by Tim.
690
691         -<rdar://problem/5770054> JavaScript profiler (10928)
692         -Add Profile class so that all profiles can be stored and retrieved by
693         the WebInspector when that time comes.
694
695         * JavaScriptCore.exp: Export the new function signatures.
696         * JavaScriptCore.xcodeproj/project.pbxproj: Add the new files to the
697         project
698         * profiler/Profile.cpp: Added. This class represents a single run of the
699         profiler.
700         (KJS::Profile::Profile):
701         (KJS::Profile::willExecute):
702         (KJS::Profile::didExecute):
703         (KJS::Profile::printDataInspectorStyle):
704         (KJS::functionNameCountPairComparator):
705         (KJS::Profile::printDataSampleStyle):
706         * profiler/Profile.h: Added. Ditto
707         (KJS::Profile::stopProfiling):
708         * profiler/Profiler.cpp: Now the profiler keeps track of many profiles
709         but only runs one at a time.
710         (KJS::Profiler::startProfiling):
711         (KJS::Profiler::stopProfiling):
712         (KJS::Profiler::willExecute):
713         (KJS::Profiler::didExecute):
714         (KJS::Profiler::printDataInspectorStyle):
715         (KJS::Profiler::printDataSampleStyle):
716         * profiler/Profiler.h: Ditto.
717         (KJS::Profiler::~Profiler):
718         (KJS::Profiler::allProfiles):
719         (KJS::Profiler::clearProfiles):
720
721 2008-05-08  Anders Carlsson  <andersca@apple.com>
722
723         Reviewed by Mark.
724
725         Enable NPAPI plug-ins on 64-bit.
726         
727         * wtf/Platform.h:
728
729 2008-05-07  Julien Chaffraix  <jchaffraix@webkit.org>
730
731         Reviewed by Adam Roben.
732
733         wx & Gtk build fix.
734
735         Add SIZE_MAX definition for the wx port.
736
737         * os-win32/stdint.h:
738
739 2008-05-07  Ariya Hidayat  <ariya.hidayat@trolltech.com>
740
741         Reviewed by Simon.
742
743         Support for isMainThread in the Qt port.
744
745         * wtf/ThreadingQt.cpp:
746         (WTF::initializeThreading): Adjusted.
747         (WTF::isMainThread): Added.
748
749 2008-05-05  Darin Adler  <darin@apple.com>
750
751         Reviewed by John Sullivan.
752
753         - fix debug-only leak seen on buildbot
754
755         * wtf/HashTable.h:
756         (WTF::HashTable::checkKey): After writing an empty value in, but before constructing a
757         deleted value on top of it, call the destructor so the empty value doesn't leak.
758
759 2008-05-02  Alexey Proskuryakov  <ap@webkit.org>
760
761         Reviewed by Geoffrey Garen.
762
763         Get rid of static data in nodes.cpp (well, at least of non-debug one).
764
765         No measurable change on SunSpider.
766
767         * kjs/InitializeThreading.cpp:
768         (KJS::initializeThreadingOnce):
769         * kjs/nodes.cpp:
770         (KJS::newTrackedObjects):
771         (KJS::trackedObjectExtraRefCounts):
772         (KJS::initializeNodesThreading):
773         (KJS::ParserRefCounted::ParserRefCounted):
774         (KJS::ParserRefCounted::ref):
775         (KJS::ParserRefCounted::deref):
776         (KJS::ParserRefCounted::refcount):
777         (KJS::ParserRefCounted::deleteNewObjects):
778         * kjs/nodes.h:
779         Made newTrackedObjects and trackedObjectExtraRefCounts per-thread.
780
781 2008-05-02  Alexey Proskuryakov  <ap@webkit.org>
782
783         Reviewed by Darin.
784
785         Move call stack depth counter to global object.
786
787         * kjs/ExecState.h: (KJS::ExecState::functionCallDepth): Added a recursion depth counter to
788         per-thread data.
789         * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Initialize PerThreadData.functionCallDepth.
790         * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::perThreadData): Made the result non-const.
791
792         * kjs/object.cpp:
793         (KJS::throwStackSizeExceededError): Moved throwError to a separate function, since it is now
794         the only thing in JSObject::call that needs a PIC branch.
795         (KJS::JSObject::call): Use a per-thread variable instead of local static for recursion depth
796         tracking.
797
798 2008-05-02  Alexey Proskuryakov  <ap@webkit.org>
799
800         Reviewed by Darin.
801
802         Make JavaScriptGlue and JavaScriptCore API functions implicitly call initializeThreading
803         for the sake of non-WebKit clients.
804
805         * API/JSBase.cpp:
806         (JSGarbageCollect):
807         * API/JSContextRef.cpp:
808         (JSGlobalContextCreate):
809         These are the JavaScriptCore API bottlenecks. There are a few other JSStringRef
810         and JSClassRef functions that can be called earlier, but they do not do anything that
811         requires initializeThreading.
812
813         * kjs/InitializeThreading.cpp:
814         (KJS::doInitializeThreading):
815         (KJS::initializeThreading):
816         On Darwin, make the initialization happen under pthread_once, since there is no guarantee
817         that non-WebKit clients won't try to call this function re-entrantly.
818
819         * kjs/InitializeThreading.h:
820         * wtf/Threading.h:
821         Spell out initializeThreading contract.
822
823         * wtf/ThreadingPthreads.cpp: (WTF::isMainThread): Make sure that results are correct on
824         Darwin, even if threading was initialized from a secondary thread.
825
826 2008-05-02  Alexey Proskuryakov  <ap@webkit.org>
827
828         Reviewed by Geoffrey Garen.
829
830         https://bugs.webkit.org/show_bug.cgi?id=18826
831         Make JavaScript heap per-thread
832
833         * wtf/ThreadSpecific.h: Make sure to initialize POD thread-specific varaibles, too
834         (replaced "new T" with "new T()").
835
836         * kjs/collector.h: Renamed Collector to Heap, made the heap per-thread. Removed support for
837         multithreaded access to a heap.
838         (KJS::CollectorBlock): Removed collectOnMainThreadOnly bitmap, added a reference to owner heap.
839         (KJS::SmallCellCollectorBlock): Ditto.
840         (KJS::Heap::markListSet): Moved from a static variable in List.cpp to a per-thread one here.
841         (KJS::Heap::heap): Added a method to find which heap a JSValue is allocated in.
842
843         * kjs/collector.cpp: Changed "const size_t" constants to #defines, to avoid a PIC branch
844         (gcc was using one to access a constant used in std::max(), because it takes a reference,
845         even though std::max() itself was inlined).
846         (KJS::Heap::threadHeap): JS heap is now per-thread.
847         (KJS::Heap::Heap): Zero-initialize the heap.
848         (KJS::allocateBlock): Added NEVER_INLINE, because this function uses a PIC branch, so
849         inlining it in Heap::heapAllocate() is bad for performance, now that the latter doesn't
850         use any global data.
851         (KJS::Heap::heapAllocate): Initialize Block::heap.
852         (KJS::Heap::markCurrentThreadConservatively): Moved into markStackObjectsConservatively(),
853         as GC only works with a current thread's heap now.
854         (KJS::Heap::sweep): Removed collectOnMainThreadOnly checks.
855         (KJS::Heap::collect): Ditto.
856
857         * kjs/JSLock.cpp:
858         * kjs/JSLock.h:
859         (KJS::JSLock::JSLock):
860         Removed registerThread(), as the heap no longer cares.
861
862         * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Initialize new per-thread
863         variables in Heap and JSGlobalObject.
864
865         * kjs/ExecState.h: (KJS::ExecState::heap): Added a heap pointer for faster access to
866         per-thread heap, and an accessor for it.
867
868         * kjs/JSGlobalObject.h: Made JSGlobalObject linked list per-thread.
869         * kjs/JSGlobalObject.cpp:
870         (KJS::JSGlobalObject::~JSGlobalObject): Fixed a bug in linked list handling. It only worked
871         right if the removed object was the head one!
872         (KJS::JSGlobalObject::head): Return a per-thread list head.
873         (KJS::JSGlobalObject::init): Store a reference to per-thread heap.
874         (KJS::JSGlobalObject::reset): Pass ExecState to functions that need it.
875         (KJS::JSGlobalObject::tearOffActivation): Ditto.
876         (KJS::JSGlobalObject::operator new): JSGlobalObject allocation cannot use an ExecState,
877         so it needs a custom operator new that directly accesses per-thread heap.
878
879         * kjs/list.h:
880         (KJS::List::List): Replaced m_isInMarkSet boolean with an actual pointer to the set, since it
881         is no longer a single static object.
882         (KJS::List::~List): Ditto.
883         * kjs/list.cpp:
884         (KJS::List::markSet): Removed, this is now stored in Heap.
885         (KJS::List::markProtectedLists): Take a reference to the list.
886         (KJS::List::expandAndAppend): Ask the current thread heap for a mark set reference.
887
888         * kjs/protect.h:
889         (KJS::gcProtect):
890         (KJS::gcUnprotect):
891         Use the newly added Heap::heap() method to find out which heap the value to be (un)protected
892         belongs to.
893
894         * kjs/property_map.h: Removed unused SavedProperty class.
895
896         * JavaScriptCore.exp:
897         * API/JSBase.cpp:
898         (JSGarbageCollect):
899         * API/JSCallbackObjectFunctions.h:
900         (KJS::::staticFunctionGetter):
901         * API/JSClassRef.cpp:
902         (OpaqueJSClass::prototype):
903         * API/JSObjectRef.cpp:
904         (JSObjectMake):
905         (JSObjectMakeFunctionWithCallback):
906         (JSObjectMakeConstructor):
907         (JSObjectMakeFunction):
908         * API/JSValueRef.cpp:
909         (JSValueMakeNumber):
910         (JSValueMakeString):
911         * kjs/array_instance.cpp:
912         (KJS::ArrayInstance::ArrayInstance):
913         (KJS::ArrayInstance::lengthGetter):
914         * kjs/array_object.cpp:
915         (KJS::arrayProtoFuncToString):
916         (KJS::arrayProtoFuncToLocaleString):
917         (KJS::arrayProtoFuncJoin):
918         (KJS::arrayProtoFuncConcat):
919         (KJS::arrayProtoFuncPop):
920         (KJS::arrayProtoFuncPush):
921         (KJS::arrayProtoFuncShift):
922         (KJS::arrayProtoFuncSlice):
923         (KJS::arrayProtoFuncSplice):
924         (KJS::arrayProtoFuncUnShift):
925         (KJS::arrayProtoFuncFilter):
926         (KJS::arrayProtoFuncMap):
927         (KJS::arrayProtoFuncEvery):
928         (KJS::arrayProtoFuncForEach):
929         (KJS::arrayProtoFuncSome):
930         (KJS::arrayProtoFuncIndexOf):
931         (KJS::arrayProtoFuncLastIndexOf):
932         (KJS::ArrayObjectImp::ArrayObjectImp):
933         (KJS::ArrayObjectImp::construct):
934         * kjs/bool_object.cpp:
935         (KJS::BooleanPrototype::BooleanPrototype):
936         (KJS::booleanProtoFuncToString):
937         (KJS::BooleanObjectImp::BooleanObjectImp):
938         (KJS::BooleanObjectImp::construct):
939         * kjs/date_object.cpp:
940         (KJS::formatLocaleDate):
941         (KJS::DatePrototype::DatePrototype):
942         (KJS::DateObjectImp::DateObjectImp):
943         (KJS::DateObjectImp::construct):
944         (KJS::DateObjectImp::callAsFunction):
945         (KJS::DateObjectFuncImp::DateObjectFuncImp):
946         (KJS::DateObjectFuncImp::callAsFunction):
947         (KJS::dateProtoFuncToString):
948         (KJS::dateProtoFuncToUTCString):
949         (KJS::dateProtoFuncToDateString):
950         (KJS::dateProtoFuncToTimeString):
951         (KJS::dateProtoFuncToLocaleString):
952         (KJS::dateProtoFuncToLocaleDateString):
953         (KJS::dateProtoFuncToLocaleTimeString):
954         (KJS::dateProtoFuncValueOf):
955         (KJS::dateProtoFuncGetTime):
956         (KJS::dateProtoFuncGetFullYear):
957         (KJS::dateProtoFuncGetUTCFullYear):
958         (KJS::dateProtoFuncToGMTString):
959         (KJS::dateProtoFuncGetMonth):
960         (KJS::dateProtoFuncGetUTCMonth):
961         (KJS::dateProtoFuncGetDate):
962         (KJS::dateProtoFuncGetUTCDate):
963         (KJS::dateProtoFuncGetDay):
964         (KJS::dateProtoFuncGetUTCDay):
965         (KJS::dateProtoFuncGetHours):
966         (KJS::dateProtoFuncGetUTCHours):
967         (KJS::dateProtoFuncGetMinutes):
968         (KJS::dateProtoFuncGetUTCMinutes):
969         (KJS::dateProtoFuncGetSeconds):
970         (KJS::dateProtoFuncGetUTCSeconds):
971         (KJS::dateProtoFuncGetMilliSeconds):
972         (KJS::dateProtoFuncGetUTCMilliseconds):
973         (KJS::dateProtoFuncGetTimezoneOffset):
974         (KJS::dateProtoFuncSetTime):
975         (KJS::setNewValueFromTimeArgs):
976         (KJS::setNewValueFromDateArgs):
977         (KJS::dateProtoFuncSetYear):
978         (KJS::dateProtoFuncGetYear):
979         * kjs/error_object.cpp:
980         (KJS::ErrorPrototype::ErrorPrototype):
981         (KJS::errorProtoFuncToString):
982         (KJS::ErrorObjectImp::ErrorObjectImp):
983         (KJS::ErrorObjectImp::construct):
984         (KJS::NativeErrorPrototype::NativeErrorPrototype):
985         (KJS::NativeErrorImp::NativeErrorImp):
986         (KJS::NativeErrorImp::construct):
987         * kjs/function.cpp:
988         (KJS::FunctionImp::lengthGetter):
989         (KJS::FunctionImp::construct):
990         (KJS::Arguments::Arguments):
991         (KJS::ActivationImp::createArgumentsObject):
992         (KJS::encode):
993         (KJS::decode):
994         (KJS::globalFuncParseInt):
995         (KJS::globalFuncParseFloat):
996         (KJS::globalFuncEscape):
997         (KJS::globalFuncUnescape):
998         (KJS::PrototypeFunction::PrototypeFunction):
999         (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
1000         * kjs/function_object.cpp:
1001         (KJS::FunctionPrototype::FunctionPrototype):
1002         (KJS::functionProtoFuncToString):
1003         (KJS::FunctionObjectImp::FunctionObjectImp):
1004         (KJS::FunctionObjectImp::construct):
1005         * kjs/internal.cpp:
1006         (KJS::StringImp::toObject):
1007         * kjs/internal.h:
1008         (KJS::StringImp::StringImp):
1009         (KJS::NumberImp::operator new):
1010         * kjs/lookup.h:
1011         (KJS::staticFunctionGetter):
1012         (KJS::cacheGlobalObject):
1013         * kjs/math_object.cpp:
1014         (KJS::MathObjectImp::getValueProperty):
1015         (KJS::mathProtoFuncAbs):
1016         (KJS::mathProtoFuncACos):
1017         (KJS::mathProtoFuncASin):
1018         (KJS::mathProtoFuncATan):
1019         (KJS::mathProtoFuncATan2):
1020         (KJS::mathProtoFuncCeil):
1021         (KJS::mathProtoFuncCos):
1022         (KJS::mathProtoFuncExp):
1023         (KJS::mathProtoFuncFloor):
1024         (KJS::mathProtoFuncLog):
1025         (KJS::mathProtoFuncMax):
1026         (KJS::mathProtoFuncMin):
1027         (KJS::mathProtoFuncPow):
1028         (KJS::mathProtoFuncRandom):
1029         (KJS::mathProtoFuncRound):
1030         (KJS::mathProtoFuncSin):
1031         (KJS::mathProtoFuncSqrt):
1032         (KJS::mathProtoFuncTan):
1033         * kjs/nodes.cpp:
1034         (KJS::Node::handleException):
1035         (KJS::NumberNode::evaluate):
1036         (KJS::StringNode::evaluate):
1037         (KJS::ArrayNode::evaluate):
1038         (KJS::PostIncResolveNode::evaluate):
1039         (KJS::PostIncLocalVarNode::evaluate):
1040         (KJS::PostDecResolveNode::evaluate):
1041         (KJS::PostDecLocalVarNode::evaluate):
1042         (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
1043         (KJS::PostIncBracketNode::evaluate):
1044         (KJS::PostDecBracketNode::evaluate):
1045         (KJS::PostIncDotNode::evaluate):
1046         (KJS::PostDecDotNode::evaluate):
1047         (KJS::typeStringForValue):
1048         (KJS::LocalVarTypeOfNode::evaluate):
1049         (KJS::TypeOfResolveNode::evaluate):
1050         (KJS::TypeOfValueNode::evaluate):
1051         (KJS::PreIncLocalVarNode::evaluate):
1052         (KJS::PreIncResolveNode::evaluate):
1053         (KJS::PreDecLocalVarNode::evaluate):
1054         (KJS::PreDecResolveNode::evaluate):
1055         (KJS::PreIncConstNode::evaluate):
1056         (KJS::PreDecConstNode::evaluate):
1057         (KJS::PostIncConstNode::evaluate):
1058         (KJS::PostDecConstNode::evaluate):
1059         (KJS::PreIncBracketNode::evaluate):
1060         (KJS::PreDecBracketNode::evaluate):
1061         (KJS::PreIncDotNode::evaluate):
1062         (KJS::PreDecDotNode::evaluate):
1063         (KJS::NegateNode::evaluate):
1064         (KJS::BitwiseNotNode::evaluate):
1065         (KJS::MultNode::evaluate):
1066         (KJS::DivNode::evaluate):
1067         (KJS::ModNode::evaluate):
1068         (KJS::addSlowCase):
1069         (KJS::add):
1070         (KJS::AddNumbersNode::evaluate):
1071         (KJS::AddStringsNode::evaluate):
1072         (KJS::AddStringLeftNode::evaluate):
1073         (KJS::AddStringRightNode::evaluate):
1074         (KJS::SubNode::evaluate):
1075         (KJS::LeftShiftNode::evaluate):
1076         (KJS::RightShiftNode::evaluate):
1077         (KJS::UnsignedRightShiftNode::evaluate):
1078         (KJS::BitXOrNode::evaluate):
1079         (KJS::BitOrNode::evaluate):
1080         (KJS::valueForReadModifyAssignment):
1081         (KJS::ForInNode::execute):
1082         (KJS::TryNode::execute):
1083         (KJS::FuncDeclNode::makeFunction):
1084         (KJS::FuncExprNode::evaluate):
1085         * kjs/number_object.cpp:
1086         (KJS::NumberPrototype::NumberPrototype):
1087         (KJS::numberProtoFuncToString):
1088         (KJS::numberProtoFuncToLocaleString):
1089         (KJS::numberProtoFuncToFixed):
1090         (KJS::numberProtoFuncToExponential):
1091         (KJS::numberProtoFuncToPrecision):
1092         (KJS::NumberObjectImp::NumberObjectImp):
1093         (KJS::NumberObjectImp::getValueProperty):
1094         (KJS::NumberObjectImp::construct):
1095         (KJS::NumberObjectImp::callAsFunction):
1096         * kjs/object.cpp:
1097         (KJS::JSObject::defineGetter):
1098         (KJS::JSObject::defineSetter):
1099         (KJS::JSObject::putDirect):
1100         (KJS::Error::create):
1101         * kjs/object.h:
1102         * kjs/object_object.cpp:
1103         (KJS::ObjectPrototype::ObjectPrototype):
1104         (KJS::objectProtoFuncToLocaleString):
1105         (KJS::objectProtoFuncToString):
1106         (KJS::ObjectObjectImp::ObjectObjectImp):
1107         (KJS::ObjectObjectImp::construct):
1108         * kjs/regexp_object.cpp:
1109         (KJS::RegExpPrototype::RegExpPrototype):
1110         (KJS::regExpProtoFuncToString):
1111         (KJS::RegExpImp::getValueProperty):
1112         (KJS::RegExpObjectImp::RegExpObjectImp):
1113         (KJS::RegExpObjectImp::arrayOfMatches):
1114         (KJS::RegExpObjectImp::getBackref):
1115         (KJS::RegExpObjectImp::getLastParen):
1116         (KJS::RegExpObjectImp::getLeftContext):
1117         (KJS::RegExpObjectImp::getRightContext):
1118         (KJS::RegExpObjectImp::getValueProperty):
1119         (KJS::RegExpObjectImp::createRegExpImp):
1120         * kjs/regexp_object.h:
1121         * kjs/string_object.cpp:
1122         (KJS::StringInstance::StringInstance):
1123         (KJS::StringInstance::lengthGetter):
1124         (KJS::StringInstance::indexGetter):
1125         (KJS::stringInstanceNumericPropertyGetter):
1126         (KJS::StringPrototype::StringPrototype):
1127         (KJS::replace):
1128         (KJS::stringProtoFuncCharAt):
1129         (KJS::stringProtoFuncCharCodeAt):
1130         (KJS::stringProtoFuncConcat):
1131         (KJS::stringProtoFuncIndexOf):
1132         (KJS::stringProtoFuncLastIndexOf):
1133         (KJS::stringProtoFuncMatch):
1134         (KJS::stringProtoFuncSearch):
1135         (KJS::stringProtoFuncReplace):
1136         (KJS::stringProtoFuncSlice):
1137         (KJS::stringProtoFuncSplit):
1138         (KJS::stringProtoFuncSubstr):
1139         (KJS::stringProtoFuncSubstring):
1140         (KJS::stringProtoFuncToLowerCase):
1141         (KJS::stringProtoFuncToUpperCase):
1142         (KJS::stringProtoFuncToLocaleLowerCase):
1143         (KJS::stringProtoFuncToLocaleUpperCase):
1144         (KJS::stringProtoFuncLocaleCompare):
1145         (KJS::stringProtoFuncBig):
1146         (KJS::stringProtoFuncSmall):
1147         (KJS::stringProtoFuncBlink):
1148         (KJS::stringProtoFuncBold):
1149         (KJS::stringProtoFuncFixed):
1150         (KJS::stringProtoFuncItalics):
1151         (KJS::stringProtoFuncStrike):
1152         (KJS::stringProtoFuncSub):
1153         (KJS::stringProtoFuncSup):
1154         (KJS::stringProtoFuncFontcolor):
1155         (KJS::stringProtoFuncFontsize):
1156         (KJS::stringProtoFuncAnchor):
1157         (KJS::stringProtoFuncLink):
1158         (KJS::StringObjectImp::StringObjectImp):
1159         (KJS::StringObjectImp::construct):
1160         (KJS::StringObjectImp::callAsFunction):
1161         (KJS::StringObjectFuncImp::StringObjectFuncImp):
1162         (KJS::StringObjectFuncImp::callAsFunction):
1163         * kjs/string_object.h:
1164         (KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
1165         * kjs/testkjs.cpp:
1166         (GlobalObject::GlobalObject):
1167         (functionGC):
1168         (functionRun):
1169         (functionReadline):
1170         (kjsmain):
1171         * kjs/ustring.h:
1172         * kjs/value.cpp:
1173         (KJS::JSCell::operator new):
1174         (KJS::jsString):
1175         (KJS::jsOwnedString):
1176         (KJS::jsNumberCell):
1177         * kjs/value.h:
1178         (KJS::jsNaN):
1179         (KJS::jsNumber):
1180         (KJS::jsNumberFromAnd):
1181         (KJS::JSCell::marked):
1182         (KJS::JSCell::mark):
1183         (KJS::JSValue::toJSNumber):
1184         Removed collectOnMainThreadOnly, as this is the only way to collect now. Replaced calls to
1185         static Collector methods with calls to per-thread Heap ones.
1186
1187 2008-05-02  Dan Bernstein  <mitz@apple.com>
1188
1189         Reviewed by Maciej Stachowiak.
1190
1191         - Mac build fix
1192
1193         * wtf/StrHash.h: Added header guards and removed #include "config.h".
1194
1195 2008-05-01  Ada Chan  <adachan@apple.com>
1196
1197         #include <wtf/StrHash.h> in identifier.cpp.
1198
1199         Reviewed by Maciej.
1200
1201         * kjs/identifier.cpp:
1202
1203 2008-05-01  Steve Falkenburg  <sfalken@apple.com>
1204
1205         Build fix.
1206
1207         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1208
1209 2008-05-01  Sam Weinig  <sam@webkit.org>
1210
1211         Fix build.
1212
1213         * JavaScriptCore.xcodeproj/project.pbxproj:
1214
1215 2008-05-01  Kevin McCullough  <kmccullough@apple.com>
1216
1217         Reviewed by Darin.
1218
1219         <rdar://problem/5770054> JavaScript profiler (10928)
1220         - Fix "sample" output so that it can be imported into Instruments
1221         - Also keep track of number of times a function is profiled.
1222
1223         * JavaScriptCore.xcodeproj/project.pbxproj: Add StrHash.h which needed
1224         to be pulled out of identifier.cpp so that it could be used by the
1225         profiler and identifiers.
1226         * kjs/identifier.cpp: Ditto.
1227         * profiler/FunctionCallProfile.cpp:
1228         (KJS::FunctionCallProfile::printDataInspectorStyle): Inspector style
1229         printing should show microseconds.
1230         (KJS::FunctionCallProfile::printDataSampleStyle): Sample style printing
1231         now counts the number of times a function is in the stack tree and does
1232         not print microseconds since that does not make sense for a sampler.
1233         * profiler/FunctionCallProfile.h: Keep track of number of times a
1234         function is profiled.
1235         (KJS::FunctionCallProfile::numberOfCalls):
1236         * profiler/Profiler.cpp:
1237         (KJS::functionNameCountPairComparator): Comparator for sort function in
1238         printDataSampleStyle.
1239         (KJS::Profiler::printDataSampleStyle): Print the number of times that a
1240         function is listed in the stack tree in order of most times listed.
1241         * wtf/HashCountedSet.h: Added copyToVector since it didn't exist and is
1242         a more standard way to copy a HashSet to a Vector. I added on variant
1243         that takes a pair as the Vector's type and so the HashCountedSet simply
1244         fills in that pair with its internal pair, and another variant that
1245         takes a Vector of the type of the HashCountedSet and only fills in the
1246         Vector with the first element of the pair.
1247         (WTF::copyToVector):
1248         * wtf/StrHash.h: Added.
1249         (WTF::):
1250
1251 2008-04-29  David Kilzer  <ddkilzer@apple.com>
1252
1253         BUILD FIX for ENABLE(DASHBOARD_SUPPORT)
1254
1255         * wtf/Platform.h: Defined ENABLE(DASHBOARD_SUPPORT) to 1 only for
1256         PLATFORM(MAC) and PLATFORM(WIN).  Changed default to 0 for other
1257         ports.
1258
1259 2008-04-29  Greg Bolsinga  <bolsinga@apple.com>
1260
1261         Reviewed by Darin.
1262
1263         Wrapped Dashboard code with ENABLE(DASHBOARD_SUPPORT)
1264
1265         * wtf/Platform.h:
1266
1267 2008-04-29  Kevin McCullough  <kmccullough@apple.com>
1268
1269         Reviewed by Geoff.
1270
1271         -<rdar://problem/5770054> JavaScript profiler (10928)
1272         -Keep call count.
1273
1274         * profiler/FunctionCallProfile.cpp:
1275         (KJS::FunctionCallProfile::FunctionCallProfile):
1276         (KJS::FunctionCallProfile::didExecute): Implements call count and fixed a bug where a stackIndex
1277         of 0 was causing the assert to be hit.
1278         (KJS::FunctionCallProfile::stopProfiling):
1279         (KJS::FunctionCallProfile::endAndRecordCall):
1280         * profiler/FunctionCallProfile.h:
1281
1282 2008-04-29  Simon Hausmann  <hausmann@webkit.org>
1283
1284         Qt/Windows build fix. The externally declared hash tables are actually
1285         declared const and the const is mangled in the symbol name, so when
1286         importing they also need to be marked const.
1287
1288         When compiling without MULTIPLE_THREADS use a const HashTable&
1289         instead of a HashTable& in ThreadClassInfoHashTables to avoid
1290         initializing the latter with a const reference.
1291
1292         * kjs/JSGlobalObject.cpp:
1293
1294 2008-04-28  Alexey Proskuryakov  <ap@webkit.org>
1295
1296         Windows build fix.
1297
1298         * kjs/ExecState.h: For whatever reason, MSVC couldn't generate a default constructor for
1299         a struct that had a "const List" member. Removing the const qulifier makes the problem go away.
1300
1301 2008-04-28  Alexey Proskuryakov  <ap@webkit.org>
1302
1303         Reviewed by Darin.
1304
1305         Fix run-webkit-tests --threading
1306         and provisionally fix <https://bugs.webkit.org/show_bug.cgi?id=18661>
1307         Proxy server issue in Sunday's Nightly
1308
1309         Changed ClassInfo objects for built-in objects to hold a getter function returning
1310         a per-thread instance. This makes it safe to share these ClassInfo objects between threads -
1311         and these are the only ones that need to be shared.
1312
1313         * kjs/lexer.cpp:
1314         (KJS::Lexer::Lexer):
1315         (KJS::Lexer::~Lexer):
1316         * kjs/lexer.h:
1317         Made mainTable a member of Lexer, so that it no longer needs to be shared between threads.
1318
1319         * kjs/object.cpp:
1320         (KJS::JSObject::deleteProperty):
1321         (KJS::JSObject::findPropertyHashEntry):
1322         (KJS::JSObject::propertyIsEnumerable):
1323         (KJS::JSObject::getPropertyAttributes):
1324         (KJS::JSObject::getPropertyNames):
1325         * kjs/object.h:
1326         (KJS::ClassInfo::propHashTable):
1327         Added a new classPropHashTableGetterFunction field to ClassInfo. If it is non-zero, the
1328         static table is not used.
1329
1330         * kjs/JSGlobalObject.cpp:
1331         (KJS::ThreadClassInfoHashTables::ThreadClassInfoHashTables): This new class holds per-thread
1332         HashTables for built-in classes. The old static structs are copied to create per-thread
1333         instances.
1334         (KJS::JSGlobalObject::threadClassInfoHashTables): An accessor/initializer for the above.
1335         (KJS::JSGlobalObject::init): Copy per-thread data into a single structure for faster access.
1336         Also, construct globalExec.
1337         (KJS::JSGlobalObject::reset): Adapted for globalExec now being an OwnPtr.
1338         (KJS::JSGlobalObject::mark): Ditto.
1339         (KJS::JSGlobalObject::globalExec): Ditto.
1340         * kjs/JSGlobalObject.h:
1341         (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Made JSGlobalObject::JSGlobalObjectData::globalExec an OwnPtr, so that it can
1342         be initialized from JSGlobalObject::init() after them. Otherwise, ExecState constructor was
1343         trying to access half-initialized JSGlobalObject to make its own copy of these table
1344         references, and failed.
1345         (KJS::JSGlobalObject::JSGlobalObject): Pass "this" value to init() to create globalExec.
1346         (KJS::JSGlobalObject::perThreadData): An accessor for per-thread data.
1347
1348         * kjs/ExecState.cpp:
1349         (KJS::ExecState::ExecState):
1350         * kjs/ExecState.h:
1351         (KJS::ExecState::propertyNames):
1352         (KJS::ExecState::emptyList):
1353         (KJS::ExecState::arrayTable):
1354         (KJS::ExecState::dateTable):
1355         (KJS::ExecState::mathTable):
1356         (KJS::ExecState::numberTable):
1357         (KJS::ExecState::RegExpImpTable):
1358         (KJS::ExecState::RegExpObjectImpTable):
1359         (KJS::ExecState::stringTable):
1360         * kjs/ExecStateInlines.h:
1361         (KJS::ExecState::ExecState):
1362         Each ExecState holds its own reference to per-thread data, for even faster access. Moved
1363         m_emptyList and m_propertyNames to the same structure, making ExecState faster to construct
1364         and take less space on the stack.
1365
1366         * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Initialize thread-static data
1367         added to JSGlobalObject.
1368
1369         * API/JSCallbackConstructor.cpp:
1370         (KJS::):
1371         * API/JSCallbackFunction.cpp:
1372         (KJS::):
1373         * API/JSCallbackObject.cpp:
1374         (KJS::):
1375         * JavaScriptCore.exp:
1376         * kjs/JSVariableObject.cpp:
1377         (KJS::JSVariableObject::getPropertyAttributes):
1378         * kjs/JSVariableObject.h:
1379         * kjs/array_instance.cpp:
1380         (KJS::):
1381         * kjs/array_object.cpp:
1382         (KJS::):
1383         (KJS::ArrayPrototype::getOwnPropertySlot):
1384         * kjs/bool_object.cpp:
1385         (KJS::):
1386         * kjs/create_hash_table:
1387         * kjs/date_object.cpp:
1388         (KJS::):
1389         (KJS::DatePrototype::getOwnPropertySlot):
1390         (KJS::DateObjectImp::DateObjectImp):
1391         * kjs/error_object.cpp:
1392         (KJS::):
1393         * kjs/function.cpp:
1394         (KJS::):
1395         * kjs/function_object.cpp:
1396         (KJS::FunctionPrototype::FunctionPrototype):
1397         * kjs/internal.cpp:
1398         (KJS::):
1399         * kjs/lookup.h:
1400         * kjs/math_object.cpp:
1401         (KJS::):
1402         (KJS::MathObjectImp::getOwnPropertySlot):
1403         * kjs/number_object.cpp:
1404         (KJS::):
1405         (KJS::NumberObjectImp::getOwnPropertySlot):
1406         * kjs/object_object.cpp:
1407         (KJS::ObjectPrototype::ObjectPrototype):
1408         * kjs/regexp_object.cpp:
1409         (KJS::):
1410         (KJS::RegExpPrototype::RegExpPrototype):
1411         (KJS::RegExpImp::getOwnPropertySlot):
1412         (KJS::RegExpImp::put):
1413         (KJS::RegExpObjectImp::getOwnPropertySlot):
1414         (KJS::RegExpObjectImp::put):
1415         * kjs/string_object.cpp:
1416         (KJS::):
1417         (KJS::StringPrototype::getOwnPropertySlot):
1418         Adjust for the above changes.
1419
1420 2008-04-28  Darin Adler  <darin@apple.com>
1421
1422         Reviewed by Adam.
1423
1424         - make sure RefPtr's default hash doesn't ref/deref when computing the hash
1425         - remove remnants of the hash table storage type optimization
1426
1427         * wtf/HashFunctions.h: Used "using" to get the hash and equal functions
1428         from PtrHash<P*> into PtrHash<RefPtr<P>>.
1429
1430         * wtf/HashMap.h: Replaced uses of PairBaseHashTraits with PairHashTraits.
1431         Eliminated storage-related typedefs. Removed constructor, destructor,
1432         copy constructor, and destructor since the compiler-generated ones are
1433         fine. Removed refAll and derefAll. Took out unnnecessary typecasts.
1434         Removed use of RefCounter.
1435
1436         * wtf/HashSet.h: Eliminated storage-related typedefs. Removed constructor,
1437         destructor, copy constructor, and destructor since the compiler-generated
1438         ones are fine. Removed refAll and derefAll. Removed unneeded template
1439         arguents from HashSetTranslatorAdapter. Eliminated unneeded HashSetTranslator
1440         template.
1441
1442         * wtf/HashTable.h: Tweaked formatting. Removed NeedsRef, RefCounterBase,
1443         RefCounter, HashTableRefCounterBase, HashTableRefCounter, and Assigner
1444         class templates.
1445
1446         * wtf/HashTraits.h: Removed StorageTraits, needsRef, PairBaseHashTraits,
1447         and HashKeyStorageTraits.
1448
1449         * wtf/RefPtrHashMap.h: Made all the same fixes as in HashMap. Also made
1450         the corresponding changes to RefPtrHashMapRawKeyTranslator.
1451
1452 2008-04-28  Darin Adler  <darin@apple.com>
1453
1454         Reviewed by Mitz.
1455
1456         - fix assertion hit every time you view www.apple.com
1457
1458         * kjs/PropertyNameArray.cpp:
1459         (KJS::PropertyNameArray::add): Changed assertion to allow null and empty strings.
1460         Now to find out why we have a property named "" and if that's a bug!
1461
1462 2008-04-27  Mark Rowe  <mrowe@apple.com>
1463
1464         Reviewed by Maciej Stachowiak.
1465
1466         Fix crash inside PtrHash::hash when loading a page.
1467
1468         * wtf/HashFunctions.h: Explicitly use the superclass implementation of hash to avoid infinite recursion.
1469
1470 2008-04-27  Darin Adler  <darin@apple.com>
1471
1472         Reviewed by Maciej.
1473
1474         - fix <rdar://problem/5657459> REGRESSION: JavaScriptCore no longer builds with
1475           GCC 4.2 due to pointer aliasing warnings
1476
1477         Fix this by removing the HashTable optimizations that allowed us to share a back end
1478         implementation between hash tables with integers, pointers, RefPtr, and String objects
1479         as keys. The way it worked was incompatible with strict aliasing.
1480
1481         This increases code size. On Mac OS X we'll have to regenerate .order files to avoid
1482         slowing down Safari startup times.
1483
1484         This creates a slight slowdown in SunSpider, mitigated by the following four speedups:
1485
1486         - speed up array put slightly by moving a branch (was already done for get)
1487
1488         - speed up symbol table access by adding a function named inlineGet to HashMap
1489           and using that in symbolTableGet/Put
1490
1491         - speed up PropertyNameArray creation by reducing the amount of reference count
1492           churn and uniqueness checking when adding names and not doing any allocation at
1493           all when building small arrays
1494
1495         - speed up conversion of strings to floating point numbers by eliminating the
1496           malloc/free of the buffer for the ASCII copy of the string; a way to make
1497           things even faster would be to change strtod to take a UTF-16 string
1498
1499         Note that there is considerable unused complexity now in HashSet/Map/Table to support
1500         "storage types", which is no longer used. Will do in a separate patch.
1501
1502         * API/JSCallbackObjectFunctions.h:
1503         (KJS::JSCallbackObject<Base>::getPropertyNames): Removed explicit cast to Identifier to
1504         take advantage of the new PropertyNameArray::add overload and avoid reference count churn.
1505         * API/JSObjectRef.cpp:
1506         (JSPropertyNameAccumulatorAddName): Ditto.
1507         * JavaScriptCore.exp: Updated PropertyNameArray::add entry point name.
1508
1509         * kjs/JSVariableObject.cpp: Removed now-unneeded IdentifierRepHashTraits::nullRepPtr
1510         definition (see below).
1511         (KJS::JSVariableObject::getPropertyNames): Removed explicit cast to Identifier.
1512
1513         * kjs/JSVariableObject.h:
1514         (KJS::JSVariableObject::symbolTableGet): Use inlineGet for speed. Also changed to do
1515         early exit instead of nesting the body inside an if.
1516         (KJS::JSVariableObject::symbolTablePut): Ditto.
1517
1518         * kjs/PropertyNameArray.cpp:
1519         (KJS::PropertyNameArray::add): Changed implementation to take a raw pointer instead of
1520         a reference to an identifier. Do uniqueness checking by searching the vector when the
1521         vector is short, only building the set once the vector is large enough.
1522
1523         * kjs/PropertyNameArray.h: Added an overload of add for a raw pointer, and made the old
1524         add function call that one. Added an addKnownUnique function for use when the new
1525         name is known to be different from any other in the array. Changed the vector to have
1526         an inline capacity of 20.
1527
1528         * kjs/SymbolTable.h: Changed IdentifierRepHash to inherit from the default hash for
1529         a RefPtr so we don't have to define so much. Added an overload of the hash function for
1530         a raw pointer as required by the new RefPtrHashMap. Got rid of the now-unneeded
1531         IdentifierRepHashTraits -- the default traits now work fine. Added a definition of
1532         empthValueIsZero to SymbolTableIndexHashTraits; not having it was incorrect, but harmless.
1533
1534         * kjs/array_instance.cpp:
1535         (KJS::ArrayInstance::put): Move the maxArrayIndex check inside the branch that checks
1536         the index against the length, as done in the get function.
1537
1538         * kjs/function.cpp:
1539         (KJS::globalFuncKJSPrint): Changed to use the new getCString instead of cstring.
1540
1541         * kjs/internal.cpp: Removed printInfo debugging function, a client of cstring.
1542         If we need a debugging function we can easily make a better one and we haven't
1543         used this one in a long time.
1544         * kjs/internal.h: Ditto.
1545
1546         * kjs/object.cpp:
1547         (KJS::JSObject::getPropertyNames): Removed explicit cast to Identifier.
1548         * kjs/property_map.cpp:
1549         (KJS::PropertyMap::getEnumerablePropertyNames): Ditto. Also added a special case for
1550         the case where the propertyNames array is empty -- in that case we know we're adding
1551         a set of names that are non-overlapping so we can use addKnownUnique.
1552         * kjs/ustring.cpp:
1553         (KJS::UString::getCString): Replaces cstring. Puts the C string into a CStringBuffer,
1554         which is a char Vector with an inline capacity. Also returns a boolean to indicate if
1555         the converion was lossy, which eliminates the need for a separate is8Bit call.
1556         (KJS::UString::toDouble): Changed to call getCString instead of cstring.
1557         * kjs/ustring.h: Ditto.
1558
1559         * wtf/HashFunctions.h: Overload the hash and equal functions for RefPtr's default
1560         hash to take raw pointers. This works with the changes to RefPtrHashMap to avoid
1561         introducing refcount churn.
1562
1563         * wtf/HashMap.h: Removed special code to convert the deleted value to the empty value
1564         when writing a new value into the map. This is now handled elsewhere.
1565         (WTF::HashMap::get): Removed code that checks for an empty hash table before calling
1566         HashTable::lookup; it's slightly more efficient to do this check inside lookup.
1567
1568         * wtf/HashTable.h:
1569         (WTF::HashTable::isDeletedBucket): Changed to use isDeletedValue instead of using
1570         deletedValue and the equality operator.
1571         (WTF::HashTable::deleteBucket): Changed to use constructDeletedValue instead of
1572         using deletedValue and the assignment operator.
1573         (WTF::HashTable::checkKey): Added. Factors out the check for values that are empty
1574         or deleted keys that's used in various functions below.
1575         (WTF::HashTable::lookup): Changed to use checkKey, check for a 0 table, and also
1576         made public for use by RefPtrHashMap.
1577         (WTF::HashTable::lookupForWriting): Changed to use checkKey.
1578         (WTF::HashTable::fullLookupForWriting): Changed to use checkKey.
1579         (WTF::HashTable::add): Changed to use checkKey, and call initializeBucket on a
1580         deleted bucket before putting a new entry into it.
1581         (WTF::HashTable::addPassingHashCode): Ditto.
1582         (WTF::HashTable::deallocateTable): Check isDeletedBucket before calling ~ValueType.
1583
1584         * wtf/HashTraits.h: Got ridd of all the HashTraits specialization for the integer
1585         types, since GeneicHashTraitsBase already deals with integers separately. Put the
1586         deleted value support into GenericHashTraitsBase. Changed FloatHashTraits to
1587         inherit from GenericHashTraits, and define construct/isDeletedValue rather than
1588         deletedValue. Removed the ref and deref functions from RefPtr's HashTraits, and
1589         defined construct/isDeletedValue. Eliminated DeletedValueAssigner. Changed
1590         PairHashTraits to define construct/isDeletedValue, and also merged
1591         PairBaseHashTraits in with PairHashTraits. Got rid of all specialization of
1592         HashKeyStorageTraits. We'll remove that, and the needsRef data member, later.
1593
1594         * wtf/RefPtr.h: Added HashTableDeletedValueType, an enum type with a single value,
1595         HashTableDeletedValue. Used that type to make a new constructor to construct
1596         deleted values and also added an isHashTableDeletedValue function.
1597
1598         * wtf/RefPtrHashMap.h: Added RefPtrHashMapRawKeyTranslator and used it to implement
1599         the raw pointer functions. This is a way to continue to avoid refcount thrash. We
1600         can't use the old way because it depended on the underlying map using a non-RefPtr
1601         type.
1602         (WTF::HashMap::find): Use find with RefPtrHashMapRawKeyTranslator.
1603         (WTF::HashMap::contains): Use contains with RefPtrHashMapRawKeyTranslator.
1604         (WTF::HashMap::inlineAdd): Use add with RefPtrHashMapRawKeyTranslator.
1605         (WTF::HashMap::get): Removed code that checks for an empty hash table before calling
1606         HashTable::lookup; it's slightly more efficient to do this check inside lookup.
1607         (WTF::HashMap::inlineGet): Added. Just like get, but marked inline for use in the
1608         symbol table code.
1609
1610 2008-04-25  Sam Weinig  <sam@webkit.org>
1611
1612         Rubber-stamped by Mark Rowe.
1613
1614         Remove SavedBuiltins and SavedProperties classes and the methods used to
1615         save data to them.  The CachedPage now stores a the JSGlobalObject in full.
1616
1617         * JavaScriptCore.exp:
1618         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1619         * JavaScriptCore.xcodeproj/project.pbxproj:
1620         * kjs/JSGlobalObject.cpp:
1621         * kjs/JSGlobalObject.h:
1622         * kjs/JSVariableObject.cpp:
1623         * kjs/JSVariableObject.h:
1624         (KJS::JSVariableObject::localStorage):
1625         * kjs/SavedBuiltins.h: Removed.
1626         * kjs/object.h:
1627         * kjs/property_map.cpp:
1628         * kjs/property_map.h:
1629
1630 2008-04-25  Mark Rowe  <mrowe@apple.com>
1631
1632         Rubber-stamped by Sam Weinig.
1633
1634         Add some content to an empty ICU header file to prevent verification errors.
1635
1636         * icu/unicode/utf_old.h:
1637
1638 2008-04-25  David Kilzer  <ddkilzer@apple.com>
1639
1640         <rdar://problem/5819422> REGRESSION: Wrong line number passed to -willLeaveCallFrame
1641
1642         Patch by George Dicker and Michael Kahl.  Reviewed by Darin.
1643
1644         When -[NSObject(WebScriptDebugDelegate) webView:willLeaveCallFrame:sourceId:line:forWebFrame:]
1645         is invoked, the first line number of the function is returned instead of the last
1646         line number.  This regressed in r28458.
1647
1648         * kjs/nodes.cpp:
1649         (KJS::FunctionBodyNodeWithDebuggerHooks::execute): Pass lastLine() instead of lineNo()
1650         when calling Debugger::returnEvent().
1651
1652 2008-04-25  Darin Adler  <darin@apple.com>
1653
1654         Done with Stephanie Lewis.
1655
1656         * JavaScriptCore.xcodeproj/project.pbxproj: Prepare for compilation with gcc 4.2 by
1657         adding -fno-strict-aliasing to CollatorICU.cpp.
1658
1659 2008-04-24  Sam Weinig  <sam@webkit.org>
1660
1661         Reviewed by Geoffrey Garen.
1662
1663         Add a #define to easily enable collecting on every allocation to aid
1664         debugging GC bugs.
1665
1666         * kjs/collector.cpp:
1667         (KJS::Collector::heapAllocate):
1668
1669 2008-04-24  Kevin McCullough  <kmccullough@apple.com>
1670
1671         Reviewed by Adam and Sam.
1672
1673         -<rdar://problem/5770054> JavaScript profiler (10928)
1674         -Only profile the page group that starts profiling to avoid profiling
1675         tools that shouldn't be profiled unless explicitly requested to.
1676
1677         * JavaScriptCore.exp: Export new signature.
1678         * kjs/JSGlobalObject.cpp: Add unique identifiers to the JSGlobalObject.
1679         (KJS::JSGlobalObject::init):
1680         * kjs/JSGlobalObject.h: Ditto.
1681         (KJS::JSGlobalObject::setPageGroupIdentifier):
1682         (KJS::JSGlobalObject::pageGroupIdentifier):
1683         * profiler/Profiler.cpp: Check the identifier of the page group of the
1684         lexical global exec state and only profile if it matches the given page
1685         group identifier.
1686         (KJS::Profiler::startProfiling):
1687         (KJS::Profiler::willExecute):
1688         (KJS::Profiler::didExecute):
1689         * profiler/Profiler.h: Ditto.
1690         (KJS::Profiler::Profiler):
1691
1692 2008-04-24  Julien Chaffraix  <jchaffraix@webkit.org>
1693
1694         Reviewed by Simon.
1695
1696         Bug 15940: Implement threading API for Qt
1697         https://bugs.webkit.org/show_bug.cgi?id=15940
1698
1699         Original patch by Justin Haygood, tweaked by me.
1700
1701         * JavaScriptCore.pri:
1702         * wtf/ThreadingQt.cpp: Added.
1703         (WTF::threadMapMutex):
1704         (WTF::threadMap):
1705         (WTF::establishIdentifierForThread):
1706         (WTF::clearThreadForIdentifier):
1707         (WTF::threadForIdentifier):
1708         (WTF::initializeThreading):
1709         (WTF::ThreadPrivate::getReturnValue):
1710         (WTF::ThreadPrivate::ThreadPrivate):
1711         (WTF::ThreadPrivate::run):
1712         (WTF::createThread):
1713         (WTF::waitForThreadCompletion): return !res to return
1714         0 on success (to match the pthreads implementation).
1715         (WTF::detachThread):
1716         (WTF::identifierByQthreadHandle):
1717         (WTF::currentThread):
1718         (WTF::Mutex::Mutex):
1719         (WTF::Mutex::~Mutex):
1720         (WTF::Mutex::lock):
1721         (WTF::Mutex::tryLock):
1722         (WTF::Mutex::unlock):
1723         (WTF::ThreadCondition::ThreadCondition):
1724         (WTF::ThreadCondition::~ThreadCondition):
1725         (WTF::ThreadCondition::wait):
1726         (WTF::ThreadCondition::timedWait):
1727         (WTF::ThreadCondition::signal):
1728
1729 2008-04-22  Darin Adler  <darin@apple.com>
1730
1731         Reviewed by Anders.
1732
1733         - simplify use of HashTraits to prepare for some upcoming hash table changes
1734
1735         * kjs/SymbolTable.h: Made SymbolTableIndexHashTraits derive from HashTraits<size_t>
1736         and specialize only the empty value.
1737
1738 2008-04-23  Holger Hans Peter Freyther  <zecke@selfish.org>
1739
1740         Reviewed by Simon.
1741
1742         Removed the #define for USE_SYSTEM_MALLOC that we set in WebKit.pri
1743         already.
1744
1745         * wtf/Platform.h:
1746
1747 2008-04-21  Kevin McCullough  <kmccullough@apple.com>
1748
1749         Reviewed by Adam.
1750
1751         <rdar://problem/5770054> JavaScript profiler (10928)
1752         - When stop profiling is called we need to stop the timers on all the
1753         functions that are still running.
1754
1755         * profiler/FunctionCallProfile.cpp:
1756         (KJS::FunctionCallProfile::didExecute):
1757         (KJS::FunctionCallProfile::stopProfiling):
1758         * profiler/FunctionCallProfile.h:
1759         * profiler/Profiler.cpp:
1760         (KJS::Profiler::stopProfiling):
1761
1762 2008-04-21  Alexey Proskuryakov  <ap@webkit.org>
1763
1764         Reviewed by Darin.
1765
1766         Move collector main thread initialization from WebKit/win to KJS::initializeThreading.
1767
1768         * kjs/InitializeThreading.cpp:
1769         (KJS::initializeThreading):
1770
1771 2008-04-21  Adam Roben  <aroben@apple.com>
1772
1773         MSVC build fix
1774
1775         Reviewed by Alexey Proskuryakov.
1776
1777         * kjs/ustring.h:
1778         (KJS::UString::cost): Disable a warning about assigning a 32-bit
1779         size_t into a 31-bit size_t.
1780
1781 2008-04-21  Simon Hausmann  <hausmann@webkit.org>
1782
1783         Reviewed by Lars.
1784
1785         Made convertValueToQVariant accessible from within WebKit/qt/Api
1786
1787         * bindings/qt/qt_runtime.h:
1788
1789 2008-04-21  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
1790
1791         Reviewed by Simon.
1792
1793         Build fix for Qt 4.3
1794
1795         * When building WebCore/internal make sure the QT_[BEGIN,END]_NAMESPACE is
1796         always defined. Do this by adding defines to the compiler line
1797         * For users of our API this is not feasible. Every public header file should
1798         include qwebkitglobal.h. Define the QT_BEGIN_NAMESPACE and QT_END_NAMESPACE
1799         when we are building everything < 4.4.0 and don't have them defined.
1800
1801         * kjs/testkjs.pro:
1802
1803 2008-04-19  Matt Lilek  <webkit@mattlilek.com>
1804
1805         Not reviewed, Windows build fix - copy the profiler headers in all
1806         configurations, not just Debug_Internal.
1807
1808         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1809
1810 2008-04-19  Mike Hommey  <glandium@debian.org>
1811
1812         Reviewed by Alp Toker.
1813
1814         Don't build testkjs with rpath.
1815
1816         * GNUmakefile.am:
1817
1818 2008-04-18  Kevin Ollivier  <kevino@theolliviers.com>
1819
1820         wx build fixes. Rename LocalStorage.h to LocalStorageEntry.h
1821         to avoid header detection issues between WebCore/storage/LocalStorage.h 
1822         and it, and add $(PROFILER_SOURCES) to the wx JSCore build.
1823
1824         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1825         * JavaScriptCore.xcodeproj/project.pbxproj:
1826         * jscore.bkl:
1827         * kjs/ExecState.h:
1828         * kjs/JSVariableObject.h:
1829         * kjs/LocalStorage.h: Removed.
1830         * kjs/LocalStorageEntry.h: Copied from JavaScriptCore/kjs/LocalStorage.h.
1831         * kjs/function.h:
1832
1833 2008-04-18 Jan  Michael Alonzo  <jmalonzo@unpluggable.com>
1834
1835         Reviewed by Alp Toker.
1836
1837         http://bugs.webkit.org/show_bug.cgi?id=16620
1838         [GTK] Autotools make dist and make check support
1839
1840         Cleanups.
1841
1842         * GNUmakefile.am:
1843
1844 2008-04-18  Jon Honeycutt  <jhoneycutt@apple.com>
1845
1846         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Windows
1847         build fix.
1848
1849 2008-04-11  Mark Rowe  <mrowe@apple.com>
1850
1851         Rubber-stamped by Antti Koivisto.
1852
1853         Silence GCC 4.3 warnings by removing extraneous consts.
1854
1855         * kjs/ustring.cpp:
1856         * kjs/ustring.h:
1857
1858 2008-04-18  Kevin McCullough  <kmccullough@apple.com>
1859
1860         Reviewed by Sam.
1861
1862         -<rdar://problem/5770054> JavaScript profiler (10928)
1863         - Use Deque instead of Vector since the profiler uses prepend a lot
1864         and deque is faster at that.
1865
1866         * profiler/FunctionCallProfile.h:
1867         (KJS::FunctionCallProfile::milliSecs): Corrected the name to match
1868         its output.
1869         * wtf/Deque.h:
1870         (WTF::deleteAllValues):
1871
1872 2008-04-18  Kevin McCullough  <kmccullough@apple.com>
1873
1874         Reviewed by Sam and Adam.
1875
1876         -<rdar://problem/5770054> JavaScript profiler (10928)
1877         - Cleaned up the header file and made some functions static, added
1878         a new, sane, printing function, and fixed a few minor bugs.
1879
1880         * JavaScriptCore.exp:
1881         * JavaScriptCore.xcodeproj/project.pbxproj:
1882         * profiler/FunctionCallProfile.cpp:
1883         (KJS::FunctionCallProfile::didExecute): Removed assertion that time is
1884         > 0 because at ms resolution that may not be true and only cross-
1885         platform way to get time differences is in ms.
1886         (KJS::FunctionCallProfile::printDataInspectorStyle): Added a new
1887         printing function for dumping data in a sane style.
1888         (KJS::FunctionCallProfile::printDataSampleStyle): Fixed a bug where we
1889         displayed too much precision when printing our floats. Also added logic
1890         to make sure we don't display 0 because that doesn't make sense for a
1891         sampling profile.
1892         * profiler/FunctionCallProfile.h:
1893         * profiler/Profiler.cpp: Moved functions that could be static into the
1894         implementation, and chaned the ASSERTs to early returns.  I did this
1895         because console.profile() is a JS function and so was being profiled
1896         but asserting because the profiler had not been started! In the future
1897         I would like to put the ASSERTs back and not profile the calls to
1898         console.profile() and console.profileEnd().
1899         (KJS::Profiler::willExecute):
1900         (KJS::Profiler::didExecute):
1901         (KJS::getStackNames): Fixed a bug where the wrong ExecState was being
1902         used.
1903         (KJS::getFunctionName):
1904         (KJS::Profiler::printDataInspectorStyle):
1905         * profiler/Profiler.h:
1906
1907 2008-04-18  Alexey Proskuryakov  <ap@webkit.org>
1908
1909         Reviewed by Darin.
1910
1911         Fix leaks during plugin tests (which actually excercise background JS), and potential
1912         PAC brokenness that was not reported, but very likely.
1913
1914         The leaks shadowed a bigger problem with Identifier destruction. Identifier::remove involves
1915         an IdentifierTable lookup, which is now a per-thread instance. Since garbage collection can
1916         currently happen on a different thread than allocation, a wrong table was used.
1917
1918         No measurable change on SunSpider total, ~1% variation on individual tests.
1919
1920         * kjs/ustring.cpp:
1921         (KJS::):
1922         (KJS::UString::Rep::create):
1923         (KJS::UString::Rep::destroy):
1924         * kjs/ustring.h:
1925         Replaced isIdentifier with a pointer to IdentifierTable, so that destruction can be done
1926         correctly. Took one bit from reportedCost, to avoid making UString::Rep larger (performance
1927         effect was measurable on SunSpider).
1928
1929         * kjs/identifier.cpp:
1930         (KJS::IdentifierTable::IdentifierTable):
1931         (KJS::IdentifierTable::~IdentifierTable):
1932         (KJS::IdentifierTable::add):
1933         (KJS::IdentifierTable::remove):
1934         Make IdentifierTable a real class. Its destructor needs to zero out outstanding references,
1935         because some identifiers may briefly outlive it during thread destruction, and we don't want
1936         them to use their stale pointers.
1937
1938         (KJS::LiteralIdentifierTable):
1939         (KJS::Identifier::add):
1940         Now that LiteralIdentifierTable is per-thread and can be destroyed not just during application
1941         shutdown, it is not appropriate to simply bump refcount for strings that get there; changed
1942         the table to hold RefPtrs.
1943
1944         (KJS::CStringTranslator::translate):
1945         (KJS::UCharBufferTranslator::translate):
1946         (KJS::Identifier::addSlowCase):
1947         (KJS::Identifier::remove):
1948         * kjs/identifier.h:
1949         (KJS::Identifier::add):
1950         Use and update UString::Rep::identifierTable as appropriate. Updating it is now done in
1951         IdentifierTable::add, not in translators.
1952
1953 2008-04-18  Alexey Proskuryakov  <ap@webkit.org>
1954
1955         Reviewed by Darin.
1956
1957         Get rid of static compareWithCompareFunctionArguments in array_instance.cpp.
1958
1959         No change on SunSpider, CelticKane or iBench JavaScript. It is probable that in some cases,
1960         merge sort is still faster, but more investigation is needed to determine a new cutoff.
1961         Or possibly, it would be better to do what FIXME says (change to tree sort).
1962
1963         Also, made arguments a local variable - not sure why it was a member of
1964         CompareWithCompareFunctionArguments.
1965
1966         * kjs/array_instance.cpp:
1967         (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
1968         (KJS::CompareWithCompareFunctionArguments::operator()):
1969         (KJS::ArrayInstance::sort):
1970
1971 2008-04-18  Simon Hausmann  <hausmann@webkit.org>
1972
1973         Build fix for gcc 4.3. Include stdio.h for printf.
1974
1975         * profiler/FunctionCallProfile.cpp:
1976         * profiler/Profiler.cpp:
1977
1978 2008-04-17  Jon Honeycutt  <jhoneycutt@apple.com>
1979
1980         Reviewed by mrowe.
1981
1982         * wtf/Platform.h: Add HAVE_ACCESSIBILITY to Platform.h.
1983
1984 2008-04-17  Alexey Proskuryakov  <ap@webkit.org>
1985
1986         Reviewed by Maciej.
1987
1988         Thread static data destructors are not guaranteed to be called in any particular order;
1989         turn ThreadSpecific into a phoenix-style singleton to avoid accessing freed memory when
1990         deleted objects are interdependent (e.g. CommonIdentifiers and internal identifier tables).
1991
1992         No change on SunSpider.
1993
1994         * wtf/ThreadSpecific.h:
1995         (WTF::ThreadSpecific::Data::Data):
1996         (WTF::::get):
1997         (WTF::::set):
1998         (WTF::::destroy):
1999
2000 2008-04-15  Srinivas Rao. M Hamse  <msrinirao@gmail.com>
2001
2002         Reviewed by Maciej Stachowiak.
2003
2004         - gcc 3.x build fix
2005
2006         * kjs/nodes.h: CallerType definition made public for gcc 3.x compilation
2007
2008 2008-04-16  Brady Eidson  <beidson@apple.com>
2009
2010         Reviewed by Sam Weinig
2011
2012         Change ThreadSafeShared to act like RefCounted by starting out with a single ref by default
2013
2014         * wtf/Threading.h:
2015         (WTF::ThreadSafeShared::ThreadSafeShared):
2016
2017 2008-04-16  Sam Weinig  <sam@webkit.org>
2018
2019         Reviewed by Geoffrey Garen.
2020
2021         - To keep the behavior of the WebKit and JavaScriptCore API's the same,
2022           we need to hide the fact that the global object and the window object
2023           are no longer the same thing, and the the global object now changes on
2024           navigations.  To do this, only the wrapper should ever be exposed.  This
2025           fixes the two remaining spots where the internal global object is exposed,
2026           the windowScriptObject returned from [WebFrame windowObject] and the object
2027           return by calling JSContextGetGlobalObject on [WebFrame globalContext].
2028
2029         * API/JSContextRef.cpp:
2030         (JSContextGetGlobalObject):
2031         This is a bit of a hack, this returns the "this" representation of the globalObject
2032         which will be the WrapperWindow for WebCore and the globalObject for non-WebCore.
2033
2034         * API/JSObjectRef.cpp:
2035         (JSObjectSetProperty):
2036         Call the new putWithAttributes method instead of relying on lower-level calls.
2037         This is needed so that the window wrapper can forward the calls.
2038
2039         * JavaScriptCore.exp:
2040         * kjs/Activation.h:
2041         * kjs/JSGlobalObject.cpp:
2042         (KJS::JSGlobalObject::putWithAttributes):
2043         * kjs/JSGlobalObject.h:
2044         * kjs/JSVariableObject.h:
2045         (KJS::JSVariableObject::symbolTablePutWithAttributes):
2046         * kjs/function.cpp:
2047         (KJS::ActivationImp::putWithAttributes):
2048         * kjs/nodes.cpp:
2049         (KJS::ConstDeclNode::handleSlowCase):
2050         (KJS::ConstDeclNode::evaluateSingle):
2051         (KJS::EvalNode::processDeclarations):
2052         * kjs/object.cpp:
2053         (KJS::JSObject::putWithAttributes):
2054         * kjs/object.h:
2055         Rename initializeVariable to putWithAttributes and move it down to JSObject so it
2056         can be used for JSObjectSetProperty.
2057
2058 2008-04-16  Kevin McCullough  <kmccullough@apple.com>
2059
2060         Reviewed by Sam and Geoff.
2061
2062         -<rdar://problem/5770054> JavaScript profiler (10928)
2063         Inital profiler prototype
2064
2065         * GNUmakefile.am: Added new files to project
2066         * JavaScriptCore.pri: Ditto
2067         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto
2068         * JavaScriptCore.xcodeproj/project.pbxproj: Ditto
2069         * JavaScriptCoreSources.bkl: Ditto
2070         * kjs/config.h: Put compiling flag in here.
2071         * kjs/function.cpp: Instrument calling the function eval().
2072         (KJS::eval):
2073         * kjs/interpreter.cpp: Instrument evaluating global scopes.
2074         (KJS::Interpreter::evaluate):
2075         * kjs/object.cpp: Instrument JS function calls.
2076         (KJS::JSObject::call):
2077         * profiler: Added.
2078         * profiler/FunctionCallProfile.cpp: Added.
2079         (KJS::FunctionCallProfile::FunctionCallProfile):
2080         (KJS::FunctionCallProfile::~FunctionCallProfile):
2081         (KJS::FunctionCallProfile::willExecute): Call right before the JS function or executing context is executed to start the profiler's timer.
2082         (KJS::FunctionCallProfile::didExecute): Call right after the JS function or executing context is executed to stop the profiler's timer.
2083         (KJS::FunctionCallProfile::addChild): Add a child to the current FunctionCallProfile if it isn't already a child of the current FunctionalCallProfile.
2084         (KJS::FunctionCallProfile::findChild): Return the child that matches the given name if there is one.
2085         (KJS::FunctionCallProfile::printDataSampleStyle): Print the current profiled information in a format that matches sample's output.
2086         * profiler/FunctionCallProfile.h: Added.
2087         (KJS::FunctionCallProfile::FunctionCallProfile):
2088         (KJS::FunctionCallProfile::~FunctionCallProfile):
2089         (KJS::FunctionCallProfile::functionName):
2090         (KJS::FunctionCallProfile::microSecs):
2091         * profiler/Profiler.cpp: Added.
2092         (KJS::Profiler::profiler):
2093         (KJS::Profiler::sharedProfiler): Return global singleton (may change due to multi-threading concerns)
2094         (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.
2095         (KJS::Profiler::stopProfiling): Stop collecting profile information.
2096         (KJS::Profiler::willExecute): Same as above. 
2097         (KJS::Profiler::didExecute): Same as above.
2098         (KJS::Profiler::insertStackNamesInTree): Follow the stack of the given names and if a sub-stack is not in the current tree, add it.
2099         (KJS::Profiler::getStackNames): Get the names from the different passed in parameters and order them as a stack.
2100         (KJS::Profiler::getFunctionName): Get the function name from the given parameter.
2101         (KJS::Profiler::printDataSampleStyle): Print the current profiled information in a format that matches sample's output.
2102         (KJS::Profiler::debugLog):
2103         * profiler/Profiler.h: Added.
2104         (KJS::Profiler::Profiler):
2105
2106 2008-04-16  Sam Weinig  <sam@webkit.org>
2107
2108         Reviewed by Darin Adler.
2109
2110         - Remove kjs_ prefix from strtod, dtoa, and freedtoa and put it
2111           in the KJS namespace.
2112         - Make strtod, dtoa, and freedtoa c++ functions instead of extern "C".
2113         - Remove mode switching from dtoa.  ~2% improvement on test 26. 
2114         - Removes all unnecessary #defines from dtoa code.
2115
2116         * JavaScriptCore.exp:
2117         * kjs/dtoa.cpp:
2118         (KJS::ulp):
2119         (KJS::b2d):
2120         (KJS::d2b):
2121         (KJS::ratio):
2122         (KJS::):
2123         (KJS::strtod):
2124         (KJS::freedtoa):
2125         (KJS::dtoa):
2126         * kjs/dtoa.h:
2127         * kjs/function.cpp:
2128         (KJS::parseInt):
2129         * kjs/lexer.cpp:
2130         (KJS::Lexer::lex):
2131         * kjs/number_object.cpp:
2132         (KJS::integer_part_noexp):
2133         (KJS::numberProtoFuncToExponential):
2134         * kjs/ustring.cpp:
2135         (KJS::UString::from):
2136         (KJS::UString::toDouble):
2137
2138 2008-04-16  Alexey Proskuryakov  <ap@webkit.org>
2139
2140         Reviewed by Darin.
2141
2142         Get rid of static execForCompareByStringForQSort in array_instance.cpp.
2143
2144         No change on SunSpider, CelticKane or iBench JavaScript.
2145
2146         * kjs/array_instance.cpp:
2147         (KJS::ArraySortComparator::ArraySortComparator):
2148         (KJS::ArraySortComparator::operator()):
2149         (KJS::ArrayInstance::sort):
2150         Switch slow case to std::sort, so that ExecState can be passed in a comparator.
2151
2152 2008-04-16  Alexey Proskuryakov  <ap@webkit.org>
2153
2154         Reviewed by Adam Roben.
2155
2156         MSVC build fix.
2157
2158         * kjs/CommonIdentifiers.cpp:
2159         * kjs/CommonIdentifiers.h:
2160         * kjs/Parser.cpp:
2161         * kjs/Parser.h:
2162         * kjs/identifier.cpp:
2163         * kjs/lexer.h:
2164         * wtf/ThreadSpecific.h:
2165
2166 2008-04-16  Alexey Proskuryakov  <ap@webkit.org>
2167
2168         Build fix.
2169
2170         * kjs/date_object.cpp:
2171         * kjs/date_object.h:
2172         Don't include DateMath.h from date_object.h, as the latter is used from WebCore, while
2173         where the former is not available.
2174
2175 2008-04-16  Holger Hans Peter Freyther  <zecke@selfish.org>
2176
2177         Unreviewed build fix for MSVC. It does not want to have
2178         WTF in the KJS namespace.
2179
2180         * kjs/CommonIdentifiers.h:
2181
2182 2008-04-16  Holger Hans Peter Freyther  <zecke@selfish.org>
2183
2184         Unreviewed build fix for gcc.
2185
2186         ::msToGregorianDateTime  is not known to it.
2187
2188         * kjs/date_object.cpp:
2189         (KJS::DateInstance::msToGregorianDateTime):
2190
2191 2008-04-16  Alexey Proskuryakov  <ap@webkit.org>
2192
2193         Reviewed by Oliver Hunt.
2194
2195         Initialize threadMapMutex safely (as already done in ThreadingWin).
2196
2197         * wtf/ThreadingGtk.cpp:
2198         (WTF::threadMapMutex):
2199         (WTF::initializeThreading):
2200         * wtf/ThreadingPthreads.cpp:
2201         (WTF::threadMapMutex):
2202         (WTF::initializeThreading):
2203
2204 2008-04-16  Alexey Proskuryakov  <ap@webkit.org>
2205
2206         Reviewed by Adam Roben.
2207
2208         Cache Gregorian date/time structure on DateInstance objects for 1.027x SunSpider speedup
2209         (1.65x on date-format-xparb, 1.13x on date-format-tofte).
2210
2211         * kjs/DateMath.h:
2212         (KJS::GregorianDateTime::copyFrom): Added. It presumably makes sense to keep GregorianDateTime
2213         Noncopyable, so it's not just operator=.
2214
2215         * kjs/date_object.h: Added a per-object cache.
2216
2217         * kjs/date_object.cpp:
2218         (KJS::DateInstance::DateInstance):
2219         (KJS::DateInstance::msToGregorianDateTime):
2220         (KJS::dateProtoFuncToString):
2221         (KJS::dateProtoFuncToUTCString):
2222         (KJS::dateProtoFuncToDateString):
2223         (KJS::dateProtoFuncToTimeString):
2224         (KJS::dateProtoFuncToLocaleString):
2225         (KJS::dateProtoFuncToLocaleDateString):
2226         (KJS::dateProtoFuncToLocaleTimeString):
2227         (KJS::dateProtoFuncGetFullYear):
2228         (KJS::dateProtoFuncGetUTCFullYear):
2229         (KJS::dateProtoFuncToGMTString):
2230         (KJS::dateProtoFuncGetMonth):
2231         (KJS::dateProtoFuncGetUTCMonth):
2232         (KJS::dateProtoFuncGetDate):
2233         (KJS::dateProtoFuncGetUTCDate):
2234         (KJS::dateProtoFuncGetDay):
2235         (KJS::dateProtoFuncGetUTCDay):
2236         (KJS::dateProtoFuncGetHours):
2237         (KJS::dateProtoFuncGetUTCHours):
2238         (KJS::dateProtoFuncGetMinutes):
2239         (KJS::dateProtoFuncGetUTCMinutes):
2240         (KJS::dateProtoFuncGetSeconds):
2241         (KJS::dateProtoFuncGetUTCSeconds):
2242         (KJS::dateProtoFuncGetTimezoneOffset):
2243         (KJS::setNewValueFromTimeArgs):
2244         (KJS::setNewValueFromDateArgs):
2245         (KJS::dateProtoFuncSetYear):
2246         (KJS::dateProtoFuncGetYear):
2247         Use the cache when converting.
2248
2249 2008-04-16  Alexey Proskuryakov  <ap@webkit.org>
2250
2251         Reviewed by Darin.
2252
2253         Implement an abstraction for thread-specific storage, use it to get rid of some static objects.
2254
2255         SunSpider results were not conclusive, possibly up to 0.2% slowdown.
2256
2257         * JavaScriptCore.xcodeproj/project.pbxproj:
2258         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
2259         Added ThreadSpecific.h
2260
2261         * wtf/ThreadSpecific.h: Added.
2262         (WTF::::ThreadSpecific):
2263         (WTF::::~ThreadSpecific):
2264         (WTF::::get):
2265         (WTF::::set):
2266         (WTF::::destroy):
2267         (WTF::T):
2268         (WTF::::operator):
2269         Only implemented for platforms that use pthreads.
2270
2271         * kjs/CommonIdentifiers.cpp:
2272         (KJS::CommonIdentifiers::shared):
2273         * kjs/CommonIdentifiers.h:
2274         * kjs/InitializeThreading.cpp:
2275         (KJS::initializeThreading):
2276         * kjs/Parser.cpp:
2277         (KJS::parser):
2278         * kjs/Parser.h:
2279         * kjs/identifier.cpp:
2280         (KJS::identifierTable):
2281         (KJS::literalIdentifierTable):
2282         (KJS::Identifier::initializeIdentifierThreading):
2283         * kjs/identifier.h:
2284         * kjs/lexer.cpp:
2285         (KJS::lexer):
2286         * kjs/lexer.h:
2287         Make static instances per-thread.
2288
2289 2008-04-15  Anders Carlsson  <andersca@apple.com>
2290
2291         Reviewed by Adam.
2292
2293         Add ENABLE_OFFLINE_WEB_APPLICATIONS to FEATURE_DEFINES.
2294         
2295         * Configurations/JavaScriptCore.xcconfig:
2296
2297 2008-04-15  Andre Poenitz  <andre.poenitz@trolltech.com>
2298
2299         Reviewed by Simon.
2300
2301         Fix compilation with Qt namespaces
2302
2303         Qt can be configured to have all of its classes inside a specified namespaces.
2304         This is for example used in plugin/component environments like Eclipse.
2305
2306         This change makes it possible to let the Qt port compile against a namespaced
2307         Qt by the use of macros Qt provides to properly forward declare Qt classes in
2308         the namespace.
2309
2310         * wtf/unicode/qt4/UnicodeQt4.h:
2311
2312 2008-04-14  Anders Carlsson  <andersca@apple.com>
2313
2314         Reviewed by Adam.
2315
2316         Don't leak the prototype class.
2317         
2318         * API/JSClassRef.cpp:
2319         (OpaqueJSClass::create):
2320
2321 2008-04-14  Steve Falkenburg  <sfalken@apple.com>
2322
2323         Fix build.
2324
2325         * wtf/ThreadingWin.cpp:
2326
2327 2008-04-14  Alexey Proskuryakov  <ap@webkit.org>
2328
2329         Reviewed by Adam Roben.
2330
2331         https://bugs.webkit.org/show_bug.cgi?id=18488
2332         FastMalloc doesn't release thread-specific data on Windows
2333
2334         * wtf/ThreadingWin.cpp:
2335         (WTF::threadMapMutex): (WTF::initializeThreading): Call threadMapMutex once to initialize the static safely.
2336         (WTF::ThreadFunctionInvocation::ThreadFunctionInvocation): Added a structure to wrap thread entry point and arguments.
2337         (WTF::wtfThreadEntryPoint): Make sure to end all WTF threads with pthread_exit(), to give pthreads-win32 a chance to call
2338         destructors of thread-specific data.
2339         (WTF::createThread): Use _beginthreadex instead of CreateThread, because MSDN says so. Also removed a call to CreateEvent,
2340         for which I could see no reason at all.
2341
2342 2008-04-14  Alexey Proskuryakov  <ap@webkit.org>
2343
2344         Touched a file to make JavaScriptCore.vcproj rebuild.
2345
2346         * wtf/MathExtras.h:
2347
2348 2008-04-14  Adam Roben  <aroben@apple.com>
2349
2350         Windows build fix
2351
2352         Rubberstamped by Alexey Proskuryakov.
2353
2354         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
2355         the "potentially uninitialized variable" warning for grammar.cpp, as
2356         it seems to be incorrect. yylval gets initialized by the lexer, but
2357         MSVC doesn't seem to understand this.
2358
2359 2008-04-11  Antti Koivisto  <antti@apple.com>
2360
2361         Reviewed by Maciej.
2362         
2363         Add default hash for pairs of hashable types.
2364
2365         * wtf/HashFunctions.h:
2366         (WTF::PairHash::hash):
2367         (WTF::PairHash::equal):
2368         (WTF::):
2369
2370 2008-04-11  Alexey Proskuryakov  <ap@webkit.org>
2371
2372         Reviewed by Geoff.
2373
2374         Make DateMath.cpp thread safe.
2375
2376         No measurable change on SunSpider (should be a very small speedup).
2377
2378         * kjs/DateMath.cpp:
2379         (KJS::mimimumYearForDST): (KJS::equivalentYearForDST): Got rid of double caching of the
2380         same precomputed value.
2381         (KJS::calculateUTCOffset): (KJS::getUTCOffset): Factored actual UTC offset calculation code
2382         out of getUTCOffset(), and notification setup into initDateMath().
2383
2384         (KJS::initDateMath): Added.
2385
2386         * kjs/DateMath.h:
2387         * kjs/InitializeThreading.cpp:
2388         (KJS::initializeThreading):
2389         Added initDateMath().
2390
2391 2008-04-11  Alexey Proskuryakov  <ap@webkit.org>
2392
2393         Windows build fix.
2394
2395         * kjs/grammar.y:
2396
2397 2008-04-11  Alexey Proskuryakov  <ap@webkit.org>
2398
2399         Tiger build fix. Forward declaring a union didn't work for whatever reason, make the
2400         parameters void*.
2401
2402         * kjs/grammar.y:
2403         * kjs/lexer.cpp:
2404         (kjsyylex):
2405         (KJS::Lexer::lex):
2406         * kjs/lexer.h:
2407
2408 2008-04-11  Alexey Proskuryakov  <ap@webkit.org>
2409
2410         Reviewed by Geoff.
2411
2412         Generate a pure (re-entrant) parser with Bison.
2413
2414         No change on SunSpider.
2415
2416         * kjs/Parser.cpp:
2417         (KJS::Parser::parse):
2418         * kjs/grammar.y:
2419         * kjs/lexer.cpp:
2420         (kjsyylex):
2421         (KJS::Lexer::lex):
2422         * kjs/lexer.h:
2423         Pass state as function arguments, instead of global data. Don't call lexer() as often as
2424         before, as this function is about to become slower due to thread-specific storage.
2425
2426         * kjs/function.cpp:
2427         (KJS::isStrWhiteSpace): Don't call isSeparatorSpace() for 8-bit characters, as these are
2428         already taken care of. This is a small speedup, compensating for a small slowdown caused
2429         by switching Bison mode.
2430
2431 2008-04-10  Alexey Proskuryakov  <ap@webkit.org>
2432
2433         Reviewed by Geoff.
2434
2435         https://bugs.webkit.org/show_bug.cgi?id=18402
2436         REGRESSION: visited element handling is incorrect in nested join/toString calls
2437
2438         No change on SunSpider total, possibly a tiny improvement (about 0.1%).
2439
2440         Test: fast/js/array-tostring-and-join.html
2441
2442         * kjs/JSGlobalObject.h:
2443         (KJS::JSGlobalObject::visitedElements): Store visited elements HashSet here, making it
2444         common to toString/toLocalizedString/join again.
2445
2446         * kjs/array_object.cpp:
2447         (KJS::arrayProtoFuncToString):
2448         (KJS::arrayProtoFuncToLocaleString):
2449         (KJS::arrayProtoFuncJoin):
2450         Got rid of static variables. Replaced UString with Vector to avoid O(n^2) behavior and
2451         regain performance.
2452
2453         * wtf/Vector.h:
2454         (WTF::::resize):
2455         (WTF::::grow):
2456         (WTF::::reserveCapacity):
2457         (WTF::::append):
2458         (WTF::::insert):
2459         Added null checks, so that Vector methods don't crash when out of memory. The caller should
2460         check that data pointer is not null before proceeding.
2461
2462 2008-04-10  Mark Rowe  <mrowe@apple.com>
2463
2464         Reviewed by Maciej Stachowiak.
2465
2466         Fix https://bugs.webkit.org/show_bug.cgi?id=18367 and the many dupes.
2467         Bug 18367: Crash during celtic kane js speed 2007 test
2468
2469         GCC 4.2 on x86_64 Linux decided to reorder the local variables in markCurrentThreadConservatively's
2470         stack frame.  This lead to the range of addresses the collector treated as stack to exclude the
2471         contents of volatile registers that markCurrentThreadConservatively forces onto the stack.  This was
2472         leading to objects being prematurely collected if the only reference to them was via a register at
2473         the time a collection occurred.
2474
2475         The fix for this is to move the calculation of the top of the stack into a NEVER_INLINE function
2476         that is called from markCurrentThreadConservatively.  This forces the dummy variable we use for
2477         determining the top of stack to be in a different stack frame which prevents the compiler from
2478         reordering it relative to the registers that markCurrentThreadConservatively forces onto the stack.
2479
2480         * kjs/collector.cpp:
2481         (KJS::Collector::markCurrentThreadConservativelyInternal):
2482         (KJS::Collector::markCurrentThreadConservatively):
2483         * kjs/collector.h:
2484
2485 2008-04-10  Adam Roben  <aroben@apple.com>
2486
2487         VC++ Express build fix
2488
2489         * JavaScriptCore.vcproj/WTF/WTF.vcproj: Link against user32.lib so
2490         that anyone who links against WTF.lib will get user32.lib
2491         automatically.
2492
2493 2008-04-09  Adam Roben  <aroben@apple.com>
2494
2495         VC++ Express build fix
2496
2497         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Link against
2498         user32.lib.
2499
2500 2008-04-09  Adam Roben  <aroben@apple.com>
2501
2502         Build fix
2503
2504         * JavaScriptCore.exp: Export isMainThread.
2505
2506 2008-04-09  Adam Roben  <aroben@apple.com>
2507
2508         Build fix
2509
2510         * wtf/AlwaysInline.h: Make sure to #include Platform.h before using
2511         the macros it defines.
2512
2513 2008-04-08  Mark Rowe  <mrowe@apple.com>
2514
2515         Export WTF::initializeThreading() from JavaScriptCore.
2516
2517         * JavaScriptCore.exp:
2518
2519 2008-04-04  Sam Weinig  <sam@webkit.org>
2520
2521         Reviewed by Geoffrey Garen.
2522
2523         First step in implementing the "split window"
2524
2525         - Add a GlobalThisValue to ExecState which should be used 
2526           in places that used to implement the "use the global object
2527           as this if null" rule.
2528         - Factor out lookupGetter/lookupSetter into virtual methods 
2529           on JSObject so that they can be forwarded.
2530         - Make defineGetter/defineSetter virtual methods for the same
2531           reason.
2532         - Have PrototypeReflexiveFunction store the globalObject used
2533           to create it so that it can be used to get the correct thisObject
2534           for eval.
2535
2536         * API/JSObjectRef.cpp:
2537         (JSObjectCallAsFunction):
2538         * JavaScriptCore.exp:
2539         * kjs/Activation.h:
2540         * kjs/ExecState.cpp:
2541         (KJS::ExecState::ExecState):
2542         (KJS::GlobalExecState::GlobalExecState):
2543         * kjs/ExecState.h:
2544         (KJS::ExecState::globalThisValue):
2545         * kjs/ExecStateInlines.h:
2546         (KJS::ExecState::ExecState):
2547         (KJS::FunctionExecState::FunctionExecState):
2548         * kjs/JSGlobalObject.cpp:
2549         (KJS::JSGlobalObject::reset):
2550         (KJS::JSGlobalObject::toGlobalObject):
2551         * kjs/JSGlobalObject.h:
2552         (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
2553         (KJS::JSGlobalObject::JSGlobalObject):
2554         * kjs/array_instance.cpp:
2555         (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
2556         (KJS::compareWithCompareFunctionForQSort):
2557         * kjs/array_object.cpp:
2558         (KJS::arrayProtoFuncSort):
2559         (KJS::arrayProtoFuncFilter):
2560         (KJS::arrayProtoFuncMap):
2561         (KJS::arrayProtoFuncEvery):
2562         (KJS::arrayProtoFuncForEach):
2563         (KJS::arrayProtoFuncSome):
2564         * kjs/function.cpp:
2565         (KJS::FunctionImp::callAsFunction):
2566         (KJS::ActivationImp::toThisObject):
2567         (KJS::globalFuncEval):
2568         (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
2569         (KJS::PrototypeReflexiveFunction::mark):
2570         * kjs/function.h:
2571         (KJS::PrototypeReflexiveFunction::cachedGlobalObject):
2572         * kjs/function_object.cpp:
2573         (KJS::functionProtoFuncApply):
2574         (KJS::functionProtoFuncCall):
2575         * kjs/nodes.cpp:
2576         (KJS::ExpressionNode::resolveAndCall):
2577         (KJS::FunctionCallValueNode::evaluate):
2578         (KJS::LocalVarFunctionCallNode::inlineEvaluate):
2579         (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
2580         (KJS::FunctionCallBracketNode::evaluate):
2581         (KJS::FunctionCallDotNode::inlineEvaluate):
2582         * kjs/object.cpp:
2583         (KJS::JSObject::call):
2584         (KJS::JSObject::put):
2585         (KJS::tryGetAndCallProperty):
2586         (KJS::JSObject::lookupGetter):
2587         (KJS::JSObject::lookupSetter):
2588         (KJS::JSObject::toThisObject):
2589         (KJS::JSObject::toGlobalObject):
2590         (KJS::JSObject::fillGetterPropertySlot):
2591         * kjs/object.h:
2592         * kjs/object_object.cpp:
2593         (KJS::objectProtoFuncLookupGetter):
2594         (KJS::objectProtoFuncLookupSetter):
2595         * kjs/string_object.cpp:
2596         (KJS::replace):
2597
2598 2008-04-08  Brady Eidson  <beidson@apple.com>
2599
2600         Encourage Windows to rebuild - AGAIN...
2601
2602         * kjs/DateMath.cpp:
2603
2604 2008-04-08  Adam Roben  <aroben@apple.com>
2605
2606         Mac build fix
2607
2608         * JavaScriptCore.exp: Add callOnMainThread, and sorted the list.
2609
2610 2008-04-08  Brady Eidson  <beidson@apple.com>
2611
2612         Rubberstamped by Adam Roben
2613         
2614         Touch some files to *strongly* encourage Windows to rebuilt with DOM_STORAGE enabled
2615
2616         * kjs/DateMath.cpp:
2617
2618 2008-04-08  Adam Roben  <aroben@apple.com>
2619
2620         Move callOnMainThread to WTF
2621
2622         Reviewed by Alexey Proskuryakov.
2623
2624         * GNUmakefile.am:
2625         * JavaScriptCore.pri:
2626         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
2627         * JavaScriptCore.xcodeproj/project.pbxproj:
2628         * JavaScriptCoreSources.bkl:
2629         Added new files.
2630
2631         * wtf/MainThread.cpp:
2632         * wtf/MainThread.h:
2633         * wtf/gtk/MainThreadGtk.cpp:
2634         * wtf/mac/MainThreadMac.mm:
2635         * wtf/qt/MainThreadQt.cpp:
2636         * wtf/win/MainThreadWin.cpp:
2637         * wtf/wx/MainThreadWx.cpp:
2638         Moved here from WebCore/platform. Replaced all instances of "WebCore"
2639         with "WTF".
2640
2641         * kjs/bool_object.cpp: Touched to force JavaScriptCore.vcproj to
2642         build.
2643         to the WTF namespace.
2644         * wtf/ThreadingWin.cpp:
2645         (WTF::initializeThreading): Call initializeMainThread.
2646
2647 2008-04-07  Brady Eidson  <beidson@apple.com>
2648
2649         Add "ENABLE_DOM_STORAGE" to keep in sync with the rest of the project
2650
2651         * Configurations/JavaScriptCore.xcconfig:
2652
2653 2008-04-07  Adam Roben  <aroben@apple.com>
2654
2655         Windows build fix
2656
2657         * wtf/ThreadingWin.cpp: Back out some changes I didn't mean to land.
2658
2659 2008-04-07  Adam Roben  <aroben@apple.com>
2660
2661         Add WTF::isMainThread
2662
2663         Reviewed by Alexey Proskuryakov.
2664
2665         * wtf/Threading.h: Declare the new function.
2666         * wtf/ThreadingGtk.cpp:
2667         (WTF::initializeThreading): Initialize the main thread identifier.
2668         (WTF::isMainThread): Added.
2669         * wtf/ThreadingNone.cpp: Ditto ThreadingGtk.cpp.
2670         (WTF::initializeThreading):
2671         (WTF::isMainThread):
2672         * wtf/ThreadingPthreads.cpp: Ditto.
2673         (WTF::initializeThreading):
2674         (WTF::isMainThread):
2675         * wtf/ThreadingWin.cpp: Ditto.
2676         (WTF::initializeThreading):
2677         (WTF::isMainThread):
2678
2679 2008-04-06  Alexey Proskuryakov  <ap@webkit.org>
2680
2681         Reviewed by Darin.
2682
2683         Make UString thread-safe.
2684
2685         No change on SunSpider total, although individual tests have changed a lot, up to 3%.
2686
2687         * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Call UString::null() to initialize
2688         a static.
2689         
2690         * kjs/identifier.cpp:
2691         (KJS::CStringTranslator::translate):
2692         (KJS::UCharBufferTranslator::translate):
2693         Use "true" for a boolean value instead of 1, because it's C++.
2694
2695         * kjs/ustring.h:
2696         (KJS::CString::adopt): Added a method to create from a char* buffer without copying.
2697         (KJS::UString::Rep::ref): Removed an assertion for JSLock::lockCount, as it's no longer
2698         necessary to hold JSLock when working with strings.
2699         (KJS::UString::Rep::deref): Ditto.
2700         (KJS::UString::Rep::isStatic): Added a field to quickly determine that this is an empty
2701         or null static string.
2702
2703         * kjs/ustring.cpp:
2704         (KJS::): Removed normalStatBufferSize and statBufferSize, as there is no reason to have such
2705         an advanced implementation of a debug-only ascii() method. Removed a long-obsolete comment
2706         about UChar.
2707         (KJS::UString::Rep::createCopying): Removed an assertion for JSLock::lockCount.
2708         (KJS::UString::Rep::create): Ditto.
2709         (KJS::UString::Rep::destroy): Ditto. Do not do anything for static null and empty strings,
2710         as refcounting is not reliable for those. Reordered branches for a noticeable speed gain -
2711         apparently this functiton is hot enough for SunSpider to see an effect from this!
2712         (KJS::UString::null): Moved a star, added a comment.
2713         (KJS::UString::cstring): Reimplemented to not call ascii(), which is not thread-safe.
2714         (KJS::UString::ascii): Simplified statBuffer handling logic.
2715         (KJS::UString::toDouble): Use cstring() instead of ascii().
2716
2717 2008-04-02  Mark Rowe  <mrowe@apple.com>
2718
2719         Reviewed by Oliver Hunt.
2720
2721         Ensure that debug symbols are generated for x86_64 and ppc64 builds.
2722
2723         * Configurations/Base.xcconfig:
2724
2725 2008-04-01  Christian Dywan  <christian@imendio.com>
2726
2727         Build fix for GCC 4.3.
2728
2729         * wtf/unicode/icu/CollatorICU.cpp: include string.h
2730
2731 2008-04-01  Alexey Proskuryakov  <ap@webkit.org>
2732
2733         Rubber-stamped by Darin.
2734
2735         Turn off using 64-bit arithmetic on 32-bit hardware, as dtoa own code is faster than
2736         compiler-provided emulation.
2737
2738         1% speedup on Acid3 test 26.
2739
2740         * kjs/dtoa.cpp:
2741
2742 2008-04-01  Alexey Proskuryakov  <ap@webkit.org>
2743
2744         Reviewed by Darin.
2745
2746         Make MathExtras.h thread safe.
2747
2748         * kjs/math_object.cpp:
2749         (KJS::mathProtoFuncRandom): If threading is enabled, rely on initializeThreading to call
2750         wtf_random_init().
2751
2752         * wtf/Threading.h:
2753         * wtf/ThreadingGtk.cpp:
2754         (WTF::initializeThreading):
2755         * wtf/ThreadingNone.cpp:
2756         (WTF::initializeThreading):
2757         * wtf/ThreadingPthreads.cpp:
2758         (WTF::initializeThreading):
2759         * wtf/ThreadingWin.cpp:
2760         (WTF::initializeThreading):
2761         Call wtf_random_init(); made the function non-inline to avoid having to include too many
2762         headers in Threading.h.
2763
2764 2008-03-31  Eric Seidel  <eric@webkit.org>
2765
2766         Reviewed by darin.
2767
2768         Make matching of regexps using ^ much faster
2769         http://bugs.webkit.org/show_bug.cgi?id=18086
2770
2771         * pcre/pcre_compile.cpp:
2772         (compileBranch):
2773         (branchNeedsLineStart):
2774         * pcre/pcre_exec.cpp:
2775         (match):
2776         (jsRegExpExecute):
2777         * pcre/pcre_internal.h:
2778
2779 2008-03-29  Alexey Proskuryakov  <ap@webkit.org>
2780
2781         Reviewed by Oliver Hunt.
2782
2783         <rdar://problem/5829556> REGRESSION: Leak in KJS::initializeThreading()
2784
2785         * kjs/InitializeThreading.cpp: (KJS::initializeThreading): There is no guarantee that
2786         initializeThreading() is called only once; check that the mutex hasn't been already allocated.
2787
2788 2008-03-29  Oliver Hunt  <oliver@apple.com>
2789
2790         Reviewed by Geoff.
2791
2792         Bug 17924: Crash in KJS::ConstDeclNode::evaluate with |with| and |const|
2793         <http://bugs.webkit.org/show_bug.cgi?id=17924>
2794         <rdar://problem/5806933>
2795
2796         It turns out this is trivially avoidable if we just match firefox's
2797         semantics and ensure that an assignment in a const declaration always
2798         writes to the variable object.
2799
2800         * kjs/nodes.cpp:
2801         (KJS::ConstDeclNode::handleSlowCase):
2802
2803 2008-03-28  Alexey Proskuryakov  <ap@webkit.org>
2804
2805         Reviewed by Sam Weinig.
2806
2807         Fix a dtoa thread safety issue.
2808
2809         WebCore can call kjs_strtod without holding JS lock, but we didn't have thread safety
2810         compiled in for dtoa.
2811
2812         This is a 0.5% regression on SunSpider, which Sam Weinig has volunteered to cover with
2813         his recent improvement.
2814
2815         * kjs/dtoa.cpp:
2816         (Bigint::Balloc):
2817         (Bigint::Bfree):
2818         Changed to use fastMalloc/fastDelete - they are much faster than the dtoa custom version was
2819         in the presence of locking (but somewhat slower in single-threaded case).
2820         (Bigint::pow5mult): Got rid of the dreaded double-checked locking anti-pattern (had to
2821         restructure the code to avoid significant performance implications).
2822         (Bigint::lshift): Rewrote to avoid an allocation, if possible.
2823
2824         (Bigint::rv_alloc):
2825         (Bigint::kjs_freedtoa):
2826         (Bigint::kjs_dtoa):
2827         Check for USE(MULTIPLE_THREADS), not dtoa legacy MULTIPLE_THREADS.
2828
2829         * kjs/InitializeThreading.cpp: Added.
2830         (KJS::initializeThreading):
2831         * kjs/InitializeThreading.h: Added.
2832         Initialize threading at KJS level, if enabled.
2833
2834         * kjs/dtoa.h: Expose dtoa mutex for KJS::initializeThreading.
2835
2836         * kjs/testkjs.cpp: (kjsmain): Call initializeThreading.
2837
2838         * JavaScriptCore.exp: Export KJS::initializeThreading.
2839
2840         * GNUmakefile.am:
2841         * JavaScriptCore.exp:
2842         * JavaScriptCore.pri:
2843         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2844         * JavaScriptCoreSources.bkl:
2845         * JavaScriptCore.xcodeproj/project.pbxproj:
2846         Added InitializeThreading.{h,cpp}.
2847
2848         * wtf/Threading.h: Removed a using directive for WTF::initializeThreading - it is only
2849         to be called from KJS::initializeThreading, and having it in the global namespace is useless.
2850
2851 2008-03-28  Brady Eidson  <beidson@apple.com>
2852
2853         Reviewed by Darin
2854
2855         Export Unicode/UTF8.h and convertUTF16ToUTF8() for more flexible conversion in WebCore
2856
2857         * JavaScriptCore.exp:
2858         * JavaScriptCore.xcodeproj/project.pbxproj:
2859
2860 2008-03-27  Darin Adler  <darin@apple.com>
2861
2862         Reviewed by Mark Rowe.
2863
2864         <rdar://problem/5826236> Regular expressions with large nested repetition counts can have their
2865         compiled length calculated incorrectly.
2866
2867         * pcre/pcre_compile.cpp:
2868         (multiplyWithOverflowCheck):
2869         (calculateCompiledPatternLength): Check for overflow when dealing with nested repetition counts
2870         and bail with an error rather than returning incorrect results.
2871
2872 2008-03-26  Mark Rowe  <mrowe@apple.com>
2873
2874         Rubber-stamped by Brady Eidson.
2875
2876         Update FEATURE_DEFINES to be consistent with the other locations in which it is defined.
2877
2878         * Configurations/JavaScriptCore.xcconfig:
2879
2880 2008-03-26  Adam Roben  <aroben@apple.com>
2881
2882         Fix Bug 18060: Assertion failure (JSLock not held) beneath
2883         JSCallbackObject<Base>::toString
2884
2885         <http://bugs.webkit.org/show_bug.cgi?id=18060>
2886
2887         Reviewed by Geoff Garen.
2888
2889         Bug fix:
2890
2891         * API/JSCallbackObjectFunctions.h:
2892         (KJS::JSCallbackObject<Base>::toString): Make the DropAllLocks
2893         instance only be in scope while calling convertToType.
2894
2895         Test:
2896
2897         * API/testapi.c:
2898         (MyObject_convertToType): Implement type conversion to string.
2899         * API/testapi.js: Add a test for type conversion to string.
2900
2901 2008-03-26  Adam Roben  <aroben@apple.com>
2902
2903         Windows build fix
2904
2905         * kjs/array_instance.cpp: Touched this.
2906         * wtf/HashFunctions.h:
2907         (WTF::intHash): Added 8- and 16-bit versions of intHash.
2908
2909 2008-03-26  Adam Roben  <aroben@apple.com>
2910
2911         Force JSC headers to be copied by touching a file
2912
2913         * kjs/array_instance.cpp:
2914         (KJS::ArrayInstance::getPropertyNames):
2915
2916 2008-03-26  Adam Roben  <aroben@apple.com>
2917
2918         Windows build fix after r31324
2919
2920         Written with Darin.
2921
2922         Added HashTable plumbing to support using wchar_t as a key type.
2923
2924         * wtf/HashFunctions.h:
2925         * wtf/HashTraits.h:
2926         (WTF::):
2927
2928 2008-03-26  Maciej Stachowiak  <mjs@apple.com>
2929
2930         Reviewed by Darin.
2931
2932         - JSC part of fix for "SVG multichar glyph matching matches longest instead of first (affects Acid3 test 79)"
2933         http://bugs.webkit.org/show_bug.cgi?id=18118
2934
2935         * wtf/HashFunctions.h:
2936         (WTF::):
2937         * wtf/HashTraits.h:
2938         (WTF::):
2939
2940 2008-03-26  Alexey Proskuryakov  <ap@webkit.org>
2941
2942         Reviewed by Darin.
2943
2944         Cache C string identifiers by address, not value, assuming that C strings can only
2945         be literals.
2946
2947         1% speedup on Acid3 test 26.
2948
2949         * kjs/identifier.cpp:
2950         (KJS::literalIdentifierTable):
2951         (KJS::Identifier::add):
2952         Added a new table to cache UString::Reps created from C strings by address. Elements are
2953         never removed from this cache, as only predefined identifiers can get there.
2954
2955         * kjs/identifier.h:
2956         (KJS::Identifier::Identifier): Added a warning.
2957
2958 2008-03-26  Alexey Proskuryakov  <ap@webkit.org>
2959
2960         Rubber-stamped by Maciej.
2961
2962         An assertion was failing in function-toString-object-literals.html when parsing 1e-500.
2963         The condition existed before, and got uncovered by turning compiled-out dtoa checks into
2964         ASSERTs.
2965
2966         The assertion was verifying that the caller wasn't constructing a Bigint from 0.
2967         This might have had some reason behind it originally, but I couldn't find any,
2968         and this doesn't look like a reasonable requirement.
2969
2970         * kjs/dtoa.cpp: (d2b): Removed the assertion (two copies in different code paths).
2971
2972 2008-03-25  Adam Roben  <aroben@apple.com>
2973
2974         Fix Bug 18077: Integrate testapi.c into the Windows build
2975
2976         <http://bugs.webkit.org/show_bug.cgi?id=18077>
2977
2978         Reviewed by Steve Falkenburg.
2979
2980         * JavaScriptCore.vcproj/testapi/testapi.vcproj: Added.
2981
2982 2008-03-25  Adam Roben  <aroben@apple.com>
2983
2984         Make testapi.c compile under MSVC
2985
2986         Currently you must compile testapi.c as C++ code since MSVC does not
2987         support many C features that GCC does.
2988
2989         Reviewed by Steve Falkenburg.
2990
2991         * API/testapi.c:
2992         (nan): Added an implementation of this for MSVC.
2993         (assertEqualsAsUTF8String): Use malloc instead of dynamically-sized
2994         stack arrays.
2995         (assertEqualsAsCharactersPtr): Ditto.
2996         (print_callAsFunction): Ditto.
2997         (main): Ditto, and explicitly cast from UniChar* to JSChar*.
2998
2999 2008-03-25  Adam Roben  <aroben@apple.com>
3000
3001         Stop using JavaScriptCore's custom stdbool.h and stdint.h on Windows
3002
3003         We can't remove the os-win32 directory yet because other ports (at
3004         least wx) are still relying on it.
3005
3006         Reviewed by Steve Falkenburg.
3007
3008         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3009           - Made all the include paths match the one for the Debug
3010             configuration (these got out of sync in r30797)
3011           - Removed os-win32 from the include path
3012           - Removed os-win32 from the directories we copy to $WebKitOutputDir.
3013           - Removed stdint.h from the project
3014         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
3015         Delete the files that we may have previously copied from the os-win32
3016         directory.
3017
3018 2008-03-25  Alexey Proskuryakov  <ap@webkit.org>
3019
3020         Windows build fix.
3021
3022         * kjs/dtoa.cpp: Include stdint.h.
3023
3024 2008-03-25  Alexey Proskuryakov  <ap@webkit.org>
3025
3026         Rubber-stamped by Darin.
3027
3028         Cleanup dtoa.cpp style.
3029
3030         * kjs/dtoa.cpp:
3031         (Bigint::Balloc):
3032         (Bigint::Bfree):
3033         (Bigint::multadd):
3034         (Bigint::s2b):
3035         (Bigint::hi0bits):
3036         (Bigint::lo0bits):
3037         (Bigint::i2b):
3038         (Bigint::mult):
3039         (Bigint::pow5mult):
3040         (Bigint::lshift):
3041         (Bigint::cmp):
3042         (Bigint::diff):
3043         (Bigint::ulp):
3044         (Bigint::b2d):
3045         (Bigint::d2b):
3046         (Bigint::ratio):
3047         (Bigint::):
3048         (Bigint::match):
3049         (Bigint::hexnan):
3050         (Bigint::kjs_strtod):
3051         (Bigint::quorem):
3052         (Bigint::rv_alloc):
3053         (Bigint::nrv_alloc):
3054         (Bigint::kjs_freedtoa):
3055         (Bigint::kjs_dtoa):
3056         * kjs/dtoa.h:
3057
3058 2008-03-24  Darin Adler  <darin@apple.com>
3059
3060         Reviewed by Sam.
3061
3062         - convert a JavaScript immediate number to a string more efficiently
3063
3064         2% speedup of Acid3 test 26
3065
3066         * kjs/JSImmediate.cpp:
3067         (KJS::JSImmediate::toString): Take advantage of the fact that all immediate
3068         numbers are integers, and use the faster UString function for formatting integers
3069         instead of the slower one that works for floating point. I think this is a leftover
3070         from when immediate numbers were floating point.
3071
3072 2008-03-23  Sam Weinig  <sam@webkit.org>
3073
3074         Reviewed by Darin Adler.
3075
3076         Fix http://bugs.webkit.org/show_bug.cgi?id=18048
3077         The "thisObject" parameter to JSEvaluateScript is not used properly
3078
3079         Making passing a thisObject to JSEvaluateScript actually set the thisObject of the created
3080         ExecState.
3081
3082         * API/testapi.c:
3083         (main): Add tests for setting the thisObject when calling JSEvaluateScript.
3084
3085         * kjs/ExecState.cpp:
3086         (KJS::ExecState::ExecState): Assign the thisObject to m_thisValue and remove the comment. 
3087
3088 2008-03-22  Jesse Ruderman  <jruderman@gmail.com>
3089
3090         Reviewed by Sam Weinig.  Landed by eseidel.
3091         
3092         Make testkjs flush stdout after printing.
3093
3094         * JavaScriptCore.xcodeproj/project.pbxproj:
3095         * kjs/testkjs.cpp:
3096         (functionPrint):
3097
3098 2008-03-21  Oliver Hunt  <oliver@apple.com>
3099
3100         Reviewed by Maciej.
3101
3102         Optimise lookup of Math, undefined, NaN and Infinity
3103
3104         Added a method to JSVariableObject to allow us to inject DontDelete properties
3105         into the symbol table and localStorage.  This results in a 0.4% progression in
3106         SunSpider, with a 8% gain in math-partial-sums.
3107
3108         * kjs/JSGlobalObject.cpp:
3109         (KJS::JSGlobalObject::reset):
3110         * kjs/JSVariableObject.h:
3111         (KJS::JSVariableObject::symbolTableInsert):
3112
3113 2008-03-21  Oliver Hunt  <oliver@apple.com>
3114
3115         Reviewed by Geoff Garen.
3116
3117         Global properties that use LocalStorage are not correctly listed as enumerable.
3118
3119         The problem was caused by JSObject::getPropertyAttributes not being aware
3120         of the JSVariableObject SymbolTable.  The fix is to make getPropertyAttributes
3121         virtual and override in JSVariableObject.  This does not produce any performance
3122         regression.
3123
3124         * JavaScriptCore.exp:
3125         * kjs/JSVariableObject.cpp:
3126         (KJS::JSVariableObject::getPropertyNames):
3127         (KJS::JSVariableObject::getPropertyAttributes):
3128         * kjs/JSVariableObject.h:
3129         * kjs/object.h:
3130
3131 2008-03-21  Arkadiusz Miskiewicz  <arekm@maven.pl>
3132
3133         Webkit does not build on linux powerpc
3134
3135         <http://bugs.webkit.org/show_bug.cgi?id=17019>
3136
3137         Reviewed by David Kilzer.
3138
3139         * wtf/TCSpinLock.h:
3140         (TCMalloc_SpinLock::Unlock):
3141
3142 2008-03-21  Rodney Dawes  <dobey@wayofthemonkey.com>
3143
3144         Reviewed by Holger.
3145
3146         http://bugs.webkit.org/show_bug.cgi?id=17981
3147
3148         Add javascriptcore_cppflags to Programs_minidom_CPPFLAGS.
3149
3150         * GNUmakefile.am:
3151
3152 2008-03-21  Alexey Proskuryakov  <ap@webkit.org>
3153
3154         Reviewed by Oliver Hunt.
3155
3156         Consolidate static identifier initializers within CommonIdentifiers.
3157
3158         No reliably measurable change on SunSpider; maybe a tiny improvement (within 0.2%).
3159
3160         * kjs/CommonIdentifiers.h: Added static identifiers that were lazily initialized
3161         throughout the code.
3162
3163         * kjs/date_object.cpp:
3164         (KJS::DateObjectImp::DateObjectImp):
3165         * kjs/function_object.cpp:
3166         (KJS::FunctionPrototype::FunctionPrototype):
3167         * kjs/object_object.cpp:
3168         (KJS::ObjectPrototype::ObjectPrototype):
3169         * kjs/regexp_object.cpp:
3170         (KJS::RegExpPrototype::RegExpPrototype):
3171         Use the values from CommonIdentifiers. 
3172
3173         * kjs/lookup.h: Caching the identifier in a static wasn't a win on SunSpider, removed it.
3174
3175         * kjs/value.h:
3176         (KJS::jsNaN): We already have a shared NaN value, no need for a duplicate here.
3177
3178         * wtf/MathExtras.h:
3179         (wtf_atan2): Having local variables for numeric_limits constants is good for readability,
3180         but there is no reason to keep them static.
3181
3182         * JavaScriptCore.exp: Don't needlessly export JSGlobalObject::s_head.
3183
3184 2008-03-20  Oliver Hunt  <oliver@apple.com>
3185
3186         Reviewed by Maciej.
3187
3188         Fix for leak introduced by inline ScopeChainNode use
3189
3190         To avoid any extra branches when managing an inline ScopeChainNode
3191         in the ScopeChain the inline node gets inserted with a refcount of
3192         2.  This meant than when the ScopeChain was destroyed the ScopeChainNodes
3193         above the inline node would be leaked.
3194
3195         We resolve this by manually popping the inline node in the
3196         FunctionExecState destructor.
3197
3198         * JavaScriptCore.xcodeproj/project.pbxproj:
3199         * kjs/ExecStateInlines.h:
3200         (KJS::FunctionExecState::~FunctionExecState):
3201         * kjs/scope_chain.h:
3202         (KJS::ScopeChain::popInlineScopeNode):
3203
3204 2008-03-20  Mark Rowe  <mrowe@apple.com>
3205
3206         Reviewed by Sam Weinig.
3207
3208         Ensure that the defines in FEATURE_DEFINES are sorted so that they will match the default settings of build-webkit.
3209         This will prevent the world from being rebuilt if you happen to switch between building in Xcode and with build-webkit on the
3210         command-line.
3211
3212         * Configurations/JavaScriptCore.xcconfig:
3213
3214 2008-03-20  David Krause  <david.krause@gmail.com>
3215
3216         Reviewed by David Kilzer.
3217
3218         Fix http://bugs.webkit.org/show_bug.cgi?id=17923
3219         Bug 17923: ARM platform endian defines inaccurate
3220
3221         * wtf/Platform.h: 
3222         Replaced !defined(__ARMEL__) check with !defined(__VFP_FP__)
3223         for PLATFORM(MIDDLE_ENDIAN)
3224
3225 2008-03-20  Maciej Stachowiak  <mjs@apple.com>
3226
3227         - fix build
3228
3229         * JavaScriptCore.xcodeproj/project.pbxproj: install Activation.h as private
3230
3231 2008-03-20  Maciej Stachowiak  <mjs@apple.com>
3232
3233         Reviewed by Oliver.
3234         
3235         - reduce function call overhead for 1.014x speedup on SunSpider
3236
3237         I moved some functions from ExecState.cpp to ExecStateInline.h and
3238         from JSGlobalObject.cpp to JSGlobalObject.h, and declared them
3239         inline; machine function call overhead for these was hurting JS
3240         funcion call overhead.
3241         
3242         * kjs/ExecState.cpp:
3243         * kjs/ExecStateInlines.h: Added.
3244         (KJS::ExecState::ExecState):
3245         (KJS::ExecState::~ExecState):
3246         (KJS::FunctionExecState::FunctionExecState):
3247         (KJS::FunctionExecState::~FunctionExecState):
3248         * kjs/JSGlobalObject.cpp:
3249         * kjs/JSGlobalObject.h:
3250         (KJS::JSGlobalObject::pushActivation):
3251         (KJS::JSGlobalObject::checkActivationCount):
3252         (KJS::JSGlobalObject::popActivation):
3253         * kjs/function.cpp:
3254
3255 2008-03-19  Oliver Hunt  <oliver@apple.com>
3256
3257         Reviewed by Maciej.
3258
3259         Avoid heap allocating the root scope chain node for eval and closure free functions
3260
3261         Maciej suggested using an inline ScopeChainNode for functions that don't use eval
3262         or closures as they are unable to ever capture the scope chain.  This gives us a 2.4%
3263         win in sunspider, a 15% win in controlflow-recursive, and big (>5%) wins in a number 
3264         of other tests.
3265
3266         * kjs/ExecState.cpp:
3267         (KJS::ExecState::ExecState):
3268         * kjs/ExecState.h:
3269         * kjs/scope_chain.h:
3270         (KJS::ScopeChain::push):
3271
3272 2008-03-19  Mark Rowe  <mrowe@apple.com>
3273
3274         Reviewed by Sam Weinig.
3275
3276         Fix release build.
3277
3278         * kjs/JSGlobalObject.cpp:  Add missing #include.
3279
3280 2008-03-19  Sam Weinig  <sam@webkit.org>
3281
3282         Reviewed by Anders Carlsson.
3283
3284         Fix for <rdar://problem/5785694>
3285         Crash occurs at KJS::Collector::collect() when loading web clip widgets with a PAC file
3286
3287         Make the activeExecStates stack per JSGlobalObject instead of static to ensure
3288         thread safety.
3289
3290         * JavaScriptCore.exp:
3291         * kjs/ExecState.cpp:
3292         (KJS::InterpreterExecState::InterpreterExecState):
3293         (KJS::InterpreterExecState::~InterpreterExecState):
3294         (KJS::EvalExecState::EvalExecState):
3295         (KJS::EvalExecState::~EvalExecState):
3296         (KJS::FunctionExecState::FunctionExecState):
3297         (KJS::FunctionExecState::~FunctionExecState):
3298         * kjs/ExecState.h:
3299         (KJS::):
3300         * kjs/JSGlobalObject.cpp:
3301         (KJS::JSGlobalObject::mark):
3302         * kjs/JSGlobalObject.h:
3303         (KJS::JSGlobalObject::activeExecStates):
3304         * kjs/collector.cpp:
3305         (KJS::Collector::collect):
3306         (KJS::Collector::reportOutOfMemoryToAllExecStates): Iterate all JSGlobalObjects and report
3307         the OutOfMemory condition to all the ExecStates in each.
3308
3309 2008-03-19  Jasper Bryant-Greene  <jasper@unix.geek.nz>
3310
3311         Reviewed by Maciej Stachowiak.
3312
3313         Fix http://bugs.webkit.org/show_bug.cgi?id=17941
3314         Bug 17941: C++-style comments in JavaScriptCore API
3315
3316         * API/JSBase.h:
3317         Remove C++-style comments from public JavaScriptCore API, replacing
3318         with standard C90 block comments.
3319
3320 2008-03-19  Mark Rowe  <mrowe@apple.com>
3321
3322         Reviewed by Oliver Hunt.
3323
3324         Fix http://bugs.webkit.org/show_bug.cgi?id=17939
3325         Bug 17939: Crash decompiling "const a = 1, b;"
3326
3327         * kjs/nodes2string.cpp:
3328         (KJS::ConstDeclNode::streamTo): Null-check the correct variable.
3329
3330 2008-03-18  Oliver Hunt  <oliver@apple.com>
3331
3332         Reviewed by Mark Rowe.
3333
3334         Bug 17929: Incorrect decompilation with |const|, comma
3335         http://bugs.webkit.org/show_bug.cgi?id=17929
3336
3337         There were actually two bugs here. First we weren't correctly handling const
3338         nodes with multiple declarations. The second issue was caused by us not 
3339         giving the correct precedence to the initialisers.
3340
3341         * kjs/nodes2string.cpp:
3342         (KJS::ConstDeclNode::streamTo):
3343
3344 2008-03-18  Darin Adler  <darin@apple.com>
3345
3346         Reviewed by Maciej.
3347
3348         - Speed up JavaScript built-in properties by changing the
3349           hash table to take advantage of the identifier objects
3350
3351         5% speedup for Acid3 test 26
3352
3353         * JavaScriptCore.exp: Updated.
3354         * kjs/create_hash_table: Compute size of hash table large enough so that there
3355         are no collisions, but don't generate the hash table.
3356         * kjs/identifier.h: Made the add function that returns a PassRefPtr public.
3357         * kjs/lexer.cpp:
3358         (KJS::Lexer::lex): Updated for change to HashTable interface.
3359         * kjs/lookup.cpp:
3360         (KJS::HashTable::changeKeysToIdentifiers): Added. Finds the identifier for
3361         each property so the equality comparision can be done with pointer comparision.
3362         * kjs/lookup.h: Made the key be a union of char* with UString::Rep* so it can
3363         hold identifiers. Added a keysAreIdentifiers flag to the HashTable. Changed
3364         the Lookup functions to be member functions of HashTable instead.
3365         * kjs/object.cpp:
3366         (KJS::JSObject::deleteProperty): Update for change to HashTable.
3367         (KJS::JSObject::findPropertyHashEntry): Ditto.
3368         (KJS::JSObject::getPropertyAttributes): Ditto.
3369         (KJS::JSObject::getPropertyNames): Ditto.
3370
3371 2008-03-18  Mark Rowe  <mrowe@apple.com>
3372
3373         Reviewed by Oliver Hunt.
3374
3375         Fix http://bugs.webkit.org/show_bug.cgi?id=17925 and http://bugs.webkit.org/show_bug.cgi?id=17927.
3376         - Bug 17925: Crash in KJS::JSObject::put after setting this.__proto__
3377         - Bug 17927: Hang after attempting to create circular __proto__
3378
3379         * kjs/object.cpp:
3380         (KJS::JSObject::put): Silently ignore attempts to set __proto__ to a non-object, non-null value.
3381         Return after setting the exception when an attempt to set a cyclic __proto__ is detected so that
3382         the cyclic value is not set.
3383
3384 2008-03-18  Maciej Stachowiak  <mjs@apple.com>
3385
3386         Reviewed by Oliver.
3387         
3388         - inline ActivationImp::init for 0.8% SunSpider speedup
3389
3390         * kjs/Activation.h:
3391         (KJS::ActivationImp::init): Moved here from function.cpp
3392         * kjs/function.cpp:
3393
3394 2008-03-18  Simon Hausmann  <hausmann@webkit.org>
3395
3396         Fix the Qt build.
3397
3398         Including config.h like in the other .cpp files gets the #ifdeffery
3399         correct for rand_s.
3400
3401         * kjs/JSWrapperObject.cpp:
3402
3403 2008-03-17  Darin Adler  <darin@apple.com>
3404
3405         Reviewed by Maciej.
3406
3407         JavaScriptCore changes to support a WebCore speedup.
3408
3409         * JavaScriptCore.exp: Export the UString::Rep::computeHash function.
3410         * wtf/HashSet.h: Added a find and contains function that take a translator,
3411         like the add function.
3412
3413 2008-03-18  Maciej Stachowiak  <mjs@apple.com>
3414
3415         Reviewed by Oliver.
3416         
3417         - a few micro-optimizations for 1.2% SunSpider speedup
3418
3419         * kjs/function.cpp:
3420         (KJS::FunctionImp::callAsFunction): check for Return completion before Throw,
3421         it is more likely.
3422         * kjs/object.cpp:
3423         (KJS::JSObject::put): When walking prototype chain, instead of
3424         checking isObject (a virtual call), compare to jsNull (compare to
3425         a constant) since null is the only non-object that can be in a
3426         prototype chain.
3427
3428 2008-03-17  Oliver Hunt  <oliver@apple.com>
3429
3430         Reviewed by Geoff.
3431
3432         Optimise multi-scope function call resolution
3433
3434         Refactor multiscope variable resolution and use to add
3435         optimised FunctionCallResolveNode subclasses.  
3436
3437         2.6% gain in sunspider performance, *25%* gain in controlflow-recursive
3438
3439         * kjs/nodes.cpp:
3440         (KJS::getSymbolTableEntry):
3441         (KJS::ResolveNode::optimizeVariableAccess):
3442         (KJS::getNonLocalSymbol):
3443         (KJS::ExpressionNode::resolveAndCall):
3444         (KJS::FunctionCallResolveNode::optimizeVariableAccess):
3445         (KJS::FunctionCallResolveNode::inlineEvaluate):
3446         (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
3447         (KJS::ScopedVarFunctionCallNode::evaluate):
3448         (KJS::ScopedVarFunctionCallNode::evaluateToNumber):
3449         (KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
3450         (KJS::ScopedVarFunctionCallNode::evaluateToInt32):
3451         (KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
3452         (KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
3453         (KJS::NonLocalVarFunctionCallNode::evaluate):
3454         (KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
3455         (KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
3456         (KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
3457         (KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
3458         * kjs/nodes.h:
3459         (KJS::ScopedVarFunctionCallNode::):
3460         (KJS::NonLocalVarFunctionCallNode::):
3461
3462 2008-03-17  David Kilzer  <ddkilzer@apple.com>
3463
3464         Don't define PLATFORM(MIDDLE_ENDIAN) on little endian ARM.
3465
3466         Reviewed by Darin.
3467
3468         See <http://bugs.webkit.org/show_bug.cgi?id=15416#c13>.
3469
3470         * wtf/Platform.h: Added check for !defined(__ARMEL__) when defining
3471         PLATFORM(MIDDLE_ENDIAN).
3472
3473 2008-03-17  Oliver Hunt  <oliver@apple.com>
3474
3475         Reviewed by Geoff, Darin and Weinig.
3476
3477         Add fast multi-level scope lookup
3478         
3479         Add logic and AST nodes to provide rapid variable resolution across
3480         static scope boundaries.  This also adds logic that allows us to skip
3481         any static scopes that do not contain the variable to be resolved.
3482         
3483         This results in a ~2.5% speedup in SunSpider, and gives a 25-30% speedup
3484         in some simple and ad hoc closure and global variable access tests.
3485
3486         * JavaScriptCore.exp:
3487         * kjs/Activation.h:
3488         * kjs/JSGlobalObject.cpp:
3489         * kjs/JSGlobalObject.h:
3490         * kjs/JSVariableObject.cpp:
3491         * kjs/JSVariableObject.h:
3492         * kjs/function.cpp:
3493         (KJS::ActivationImp::isDynamicScope):
3494         * kjs/nodes.cpp:
3495         (KJS::ResolveNode::optimizeVariableAccess):
3496         (KJS::ScopedVarAccessNode::inlineEvaluate):
3497         (KJS::ScopedVarAccessNode::evaluate):
3498         (KJS::ScopedVarAccessNode::evaluateToNumber):
3499         (KJS::ScopedVarAccessNode::evaluateToBoolean):
3500         (KJS::ScopedVarAccessNode::evaluateToInt32):
3501         (KJS::ScopedVarAccessNode::evaluateToUInt32):
3502         (KJS::NonLocalVarAccessNode::inlineEvaluate):
3503         (KJS::NonLocalVarAccessNode::evaluate):
3504         (KJS::NonLocalVarAccessNode::evaluateToNumber):
3505         (KJS::NonLocalVarAccessNode::evaluateToBoolean):
3506         (KJS::NonLocalVarAccessNode::evaluateToInt32):
3507         (KJS::NonLocalVarAccessNode::evaluateToUInt32):
3508         (KJS::IfElseNode::optimizeVariableAccess):
3509         (KJS::ScopeNode::optimizeVariableAccess):
3510         * kjs/nodes.h:
3511         (KJS::ScopedVarAccessNode::):
3512         (KJS::NonLocalVarAccessNode::):
3513         * kjs/object.h:
3514
3515  2008-03-16  weihongzeng  <weihong.zeng@hotmail.com>
3516  
3517          Reviewed by Darin Adler.
3518  
3519          http://bugs.webkit.org/show_bug.cgi?id=15416
3520          Add support for mixed-endian processors
3521  
3522          * kjs/dtoa.cpp: Add IEEE_ARM, triggered by PLATFORM(MIDDLE_ENDIAN).
3523  
3524 2008-03-16  Kevin Ollivier  <kevino@theolliviers.com>
3525
3526         Rubber stamped by Darin.
3527
3528         Add set-webkit-configuration support for wx port, and centralize
3529         build dir location setting.
3530
3531         http://bugs.webkit.org/show_bug.cgi?id=17790
3532
3533         * jscore.bkl:
3534
3535 2008-03-14  Steve Falkenburg  <sfalken@apple.com>
3536
3537         PGO build fixes.
3538
3539         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3540
3541 2008-03-14  Oliver Hunt  <oliver@apple.com>
3542
3543         Reviewed by Maciej.
3544
3545         Add logic to track whether a function uses a locally scoped eval or requires a closure
3546         
3547         Now that we limit eval we can&nbs