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