Windows build fixes
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2008-07-14  Adam Roben  <aroben@apple.com>
2
3         Windows build fix
4
5         * JavaScriptCore.vcproj/jsc/jsc.vcproj: Added include/pthreads to the
6         include path.
7
8 2008-07-14  Alexey Proskuryakov  <ap@webkit.org>
9
10         Reviewed by Kevin McCullough.
11
12         Make JSGlobalData refcounted in preparation to adding a way to create contexts that share
13         global data.
14
15         * JavaScriptCore.exp:
16         * kjs/JSGlobalData.cpp:
17         (KJS::JSGlobalData::create):
18         * kjs/JSGlobalData.h:
19         Made contructor private, and added a static create() method. Made the class inherit from
20         RefCounted.
21
22         * kjs/JSGlobalObject.h:
23         (KJS::JSGlobalObject::globalData):
24         JSGlobalData is now owned by JSGlobalObject (except for the shared one, and the common
25         WebCore one, which are never deleted).
26
27         * kjs/Shell.cpp: (main): Create JSGlobalData with create() method.
28
29 2008-07-14  Simon Hausmann  <hausmann@webkit.org>
30
31         Fix the single-threaded build.
32
33         * kjs/JSLock.cpp: Removed undeclared registerThread() function.
34         * kjs/collector.cpp:
35         (KJS::Heap::registerThread): Added dummy implementation.
36
37 2008-07-14  Alexey Proskuryakov  <ap@webkit.org>
38
39         Reviewed by Geoff Garen.
40
41         Eliminate per-thread JavaScript global data instance support and make arbitrary
42         global data/global object combinations possible.
43
44         * kjs/collector.cpp:
45         (KJS::Heap::Heap): Store a JSGlobalData pointer instead of multiple pointers to its members.
46         This allows for going from any JS object to its associated global data, currently used in
47         JSGlobalObject constructor to initialize its JSGlobalData pointer.
48         (KJS::Heap::registerThread): Changed thread registration data to be per-heap. Previously,
49         only the shared heap could be used from multiple threads, so it was the only one that needed
50         thread registration, but now this can happen to any heap.
51         (KJS::Heap::unregisterThread): Ditto.
52         (KJS::Heap::markStackObjectsConservatively): Adapt for the above changes.
53         (KJS::Heap::setGCProtectNeedsLocking): Ditto.
54         (KJS::Heap::protect): Ditto.
55         (KJS::Heap::unprotect): Ditto.
56         (KJS::Heap::collect): Ditto.
57         (KJS::Heap::globalObjectCount): Use global object list associated with the current heap,
58         not the late per-thread one.
59         (KJS::Heap::protectedGlobalObjectCount): Ditto.
60
61         * kjs/collector.h:
62         (KJS::Heap::ThreadRegistrar): Added a helper object that unregisters a thread when it is
63         destroyed.
64
65         * kjs/JSLock.cpp:
66         (KJS::JSLock::JSLock):
67         * kjs/JSLock.h:
68         (KJS::JSLock::JSLock):
69         Don't use JSLock to implicitly register threads. I've added registerThread() calls to most
70         places that use JSLock - we cannot guarantee absolute safety unless we always mark all
71         threads in the process, but these implicit registration calls should cover reasonable usage
72         scenarios, I hope.
73
74         * API/JSBase.cpp:
75         (JSEvaluateScript): Explicitly register the current thread.
76         (JSCheckScriptSyntax): Explicitly register the current thread.
77         (JSGarbageCollect): Changed to use the passed in context. Unfortunately, this creates a race
78         condition for clients that pass an already released context to JSGarbageCollect - but it is
79         unlikely to create real life problems.
80         To maintain compatibility, the shared heap is collected if NULL is passed.
81
82         * API/JSContextRef.cpp:
83         (JSGlobalContextCreate): Use a new syntax for JSGlobalObject allocation.
84         (JSGlobalContextRetain): Register the thread.
85         (JSContextGetGlobalObject): Register the thread.
86
87         * API/JSObjectRef.cpp:
88         (JSObjectMake):
89         (JSObjectMakeFunctionWithCallback):
90         (JSObjectMakeConstructor):
91         (JSObjectMakeFunction):
92         (JSObjectHasProperty):
93         (JSObjectGetProperty):
94         (JSObjectSetProperty):
95         (JSObjectGetPropertyAtIndex):
96         (JSObjectSetPropertyAtIndex):
97         (JSObjectDeleteProperty):
98         (JSObjectCallAsFunction):
99         (JSObjectCallAsConstructor):
100         (JSObjectCopyPropertyNames):
101         (JSPropertyNameAccumulatorAddName):
102         * API/JSValueRef.cpp:
103         (JSValueIsEqual):
104         (JSValueIsInstanceOfConstructor):
105         (JSValueMakeNumber):
106         (JSValueMakeString):
107         (JSValueToNumber):
108         (JSValueToStringCopy):
109         (JSValueToObject):
110         (JSValueProtect):
111         (JSValueUnprotect):
112         Register the thread.
113
114         * API/JSStringRef.cpp: (JSStringRelease): Changed a comment to not mention per-thread contexts.
115
116         * API/JSStringRefCF.cpp: Removed an unnecessary include of JSLock.h.
117
118         * JavaScriptCore.exp: Export JSGlobalData constructor/destructor, now that anyone can have
119         their own instances. Adapt to other changes, too.
120
121         * JavaScriptCore.xcodeproj/project.pbxproj: Made ThreadSpecific.h private, as it is now
122         included by collector.h and is thus needed in other projects.
123
124         * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Don't initialize per-thread
125         global data, as it no longer exists.
126
127         * kjs/JSGlobalData.cpp:
128         (KJS::JSGlobalData::JSGlobalData):
129         (KJS::JSGlobalData::~JSGlobalData):
130         * kjs/JSGlobalData.h:
131         Removed support for per-thread instance. Made constructor and destructor public.
132
133         * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Get to now arbitrary  JSGlobalData
134         via the heap.
135         (KJS::JSGlobalObject::operator new): Changed ot take JSGlobalDatra pointer.
136         * kjs/JSGlobalObject.h:
137
138         * kjs/Shell.cpp:
139         (main):
140         (jscmain):
141         Changed to maintain a custom JSGlobalData pointer instead of a per-thread one.
142
143 2008-07-13  Ada Chan  <adachan@apple.com>
144
145         Windows build fix: Add wtf/RefCountedLeakCounter to the project.
146
147         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
148
149 2008-07-12  Jan Michael Alonzo  <jmalonzo@webkit.org>
150
151         Gtk, Qt and Wx build fix: Add wtf/RefCountedLeakCounter in the
152         build scripts
153
154         * GNUmakefile.am:
155         * JavaScriptCore.pri:
156         * JavaScriptCoreSources.bkl:
157
158 2008-07-11  Stephanie Lewis  <slewis@apple.com>
159
160         Reviewed by Darin Adler and Oliver Hunt.
161
162         Refactor RefCounting Leak counting code into a common class.
163
164         In order to export the symbols I needed to put the debug defines inside the function names
165         
166         Before we had a separate channel for each Logging each Leak type.  Since the leak channels were only used in one location, and only at quit for simplicity I combined them all into one leak channel.
167
168         * JavaScriptCore.exp:
169         * JavaScriptCore.xcodeproj/project.pbxproj: add new class
170         * kjs/nodes.cpp: remove old leak counting code
171         * wtf/RefCountedLeakCounter.cpp: Added. create a common leak counting class
172         * wtf/RefCountedLeakCounter.h: Added.
173
174 2008-07-11  David Hyatt  <hyatt@apple.com>
175
176         Add an insertBefore method to ListHashSet to allow for insertions in the middle of the list (rather than just
177         at the end).
178
179         Reviewed by Anders
180
181         * wtf/ListHashSet.h:
182         (WTF::::insertBefore):
183         (WTF::::insertNodeBefore):
184
185 2008-07-11  Sam Weinig  <sam@webkit.org>
186
187         Rubber-stamped by Darin Adler.
188
189         Move call function to CallData.cpp and construct to ConstructData.cpp.
190
191         * GNUmakefile.am:
192         * JavaScriptCore.pri:
193         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
194         * JavaScriptCore.xcodeproj/project.pbxproj:
195         * JavaScriptCoreSources.bkl:
196         * kjs/AllInOneFile.cpp:
197         * kjs/CallData.cpp: Copied from kjs/JSValue.cpp.
198         * kjs/ConstructData.cpp: Copied from kjs/JSValue.cpp.
199         * kjs/JSValue.cpp:
200
201 2008-07-10  Mark Rowe  <mrowe@apple.com>
202
203         Reviewed by Sam Weinig.
204
205         Define WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST when building WebKit to ensure that no symbols end up with the weak_import attribute.
206
207         * Configurations/Base.xcconfig:
208
209 2008-07-10  Mark Rowe  <mrowe@apple.com>
210
211         Reviewed by Sam Weinig.
212
213         Fix the Tiger build by omitting annotations from methods declared in categories when using old versions of GCC.
214
215         * API/WebKitAvailability.h:
216
217 2008-07-10  Kevin McCullough  <kmccullough@apple.com>
218
219         Reviewed by Darin.
220
221         -Minor cleanup. Renamed callTree() to head() and no longer use m_head
222         directly but instead keep it private and access via a method().
223
224         * profiler/HeavyProfile.cpp:
225         (KJS::HeavyProfile::HeavyProfile):
226         (KJS::HeavyProfile::generateHeavyStructure):
227         (KJS::HeavyProfile::addNode):
228         * profiler/Profile.h:
229         (KJS::Profile::head):
230         * profiler/ProfileGenerator.cpp:
231         (KJS::ProfileGenerator::ProfileGenerator):
232
233 2008-07-10  Alexey Proskuryakov  <ap@webkit.org>
234
235         Reviewed by Mark Rowe.
236
237         Eliminate CollectorHeapIntrospector.
238
239         CollectorHeapIntrospector was added primarily in the hopes to improve leaks tool output,
240         a result that it didn't deliver. Also, it helped by labeling JSC heap regions as reported by
241         vmmap tool, but at the same time, it made them mislabeled as malloc'd ones - the correct
242         way to label mapped regions is to use a VM tag.
243
244         So, it makes more sense to remove it completely than to make it work with multiple heaps.
245
246         * JavaScriptCore.exp:
247         * JavaScriptCore.xcodeproj/project.pbxproj:
248         * kjs/AllInOneFile.cpp:
249         * kjs/InitializeThreading.cpp:
250         (KJS::initializeThreading):
251         * kjs/collector.cpp:
252         * kjs/collector.h:
253         * kjs/CollectorHeapIntrospector.cpp: Removed.
254         * kjs/CollectorHeapIntrospector.h: Removed.
255
256 2008-07-09  Kevin McCullough  <kmccullough@apple.com>
257
258         Reviewed by Darin.
259
260         <rdar://problem/5951532> JSProfiler: Implement heavy (or bottom-up)
261         view (19228)
262         - Implemented the time and call count portionof heavy.  Now all that we
263         need is some UI.
264
265         * profiler/CallIdentifier.h: Removed an unused constructor.
266         * profiler/HeavyProfile.cpp: 
267         (KJS::HeavyProfile::HeavyProfile): Set the initial time of the head
268         node so that percentages work correctly.
269         (KJS::HeavyProfile::mergeProfiles): Sum the times and call count of
270         nodes being merged.
271         * profiler/ProfileNode.cpp: Set the intital values of time and call
272         count when copying ProfileNodes.
273         (KJS::ProfileNode::ProfileNode):
274
275 2008-07-10  Jan Michael Alonzo  <jmalonzo@webkit.org>
276
277         Gtk build fix.
278
279         * GNUmakefile.am: Add HeavyProfile.cpp
280
281 2008-07-09  Mark Rowe  <mrowe@apple.com>
282
283         Reviewed by Geoff Garen.
284
285         Don't warn about deprecated functions in production builds.
286
287         * Configurations/Base.xcconfig:
288         * Configurations/DebugRelease.xcconfig:
289
290 2008-07-09  Darin Adler  <darin@apple.com>
291
292         * JavaScriptCore.pri: Fix Qt build by adding HeavyProfile.cpp.
293
294 2008-07-09  Kevin Ollivier  <kevino@theolliviers.com>
295
296         wx biuld fix. Add HeavyProfile.cpp to build files.
297
298         * JavaScriptCoreSources.bkl:
299
300 2008-07-09  Kevin McCullough  <kmccullough@apple.com>
301
302         - Windows build fix.
303
304         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
305
306 2008-07-09  Kevin McCullough  <kmccullough@apple.com>
307
308         - Build fix.
309
310         * profiler/HeavyProfile.cpp:
311         (KJS::HeavyProfile::mergeProfiles):
312
313 2008-07-09  Kevin McCullough  <kmccullough@apple.com>
314
315         Reviewed by Geoff and Adam.
316
317         <rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
318         - This is the plumbing for bottom-up, but does not include calculating
319         time, mostly because I'm still undclear about what the end result should
320         look like.
321         - This, obviously, does not include the UI to expose this in the
322         inspector yet.
323
324         * JavaScriptCore.xcodeproj/project.pbxproj:
325         * profiler/CallIdentifier.h:
326         (KJS::CallIdentifier::CallIdentifier):
327         (WTF::): Added HashTraits for CallIdentifiers to be used by a HashMap.
328         * profiler/HeavyProfile.cpp: Added.
329         (KJS::HeavyProfile::HeavyProfile):
330         (KJS::HeavyProfile::generateHeavyStructure):
331         (KJS::HeavyProfile::addNode):
332         (KJS::HeavyProfile::mergeProfiles):
333         (KJS::HeavyProfile::addAncestorsAsChildren):
334         * profiler/HeavyProfile.h: Added.
335         (KJS::HeavyProfile::create):
336         (KJS::HeavyProfile::heavyProfile):
337         (KJS::HeavyProfile::treeProfile):
338         * profiler/Profile.cpp: Removed old commented out includes.
339         * profiler/Profile.h: The m_head is needed by the HeavyProfile so it
340         is now protected as opposed to private.
341         * profiler/ProfileNode.cpp:
342         (KJS::ProfileNode::ProfileNode): Created a constructor to copy
343         ProfileNodes.
344         (KJS::ProfileNode::findChild): Added a null check to make HeavyProfile
345         children finding easier and avoid a potential crasher.
346         * profiler/ProfileNode.h: Mostly moved things around but also added some
347         functionality needed by HeavyProfile.
348         (KJS::ProfileNode::create):
349         (KJS::ProfileNode::functionName):
350         (KJS::ProfileNode::url):
351         (KJS::ProfileNode::lineNumber):
352         (KJS::ProfileNode::head):
353         (KJS::ProfileNode::setHead):
354         (KJS::ProfileNode::setNextSibling):
355         (KJS::ProfileNode::actualTotalTime):
356         (KJS::ProfileNode::actualSelfTime):
357         * profiler/TreeProfile.cpp: Implemented the ability to get a
358         HeavyProfile.
359         (KJS::TreeProfile::heavyProfile):
360         * profiler/TreeProfile.h:
361
362 2008-07-08  Geoffrey Garen  <ggaren@apple.com>
363
364         Reviewed by Oliver Hunt.
365         
366         Added support for checking if an object has custom properties in its
367         property map. WebCore uses this to optimize marking DOM wrappers.
368
369 2008-07-08  Simon Hausmann  <hausmann@webkit.org>
370
371         Prospective Gtk/Wx build fixes, add ProfileGenerator.cpp to the build.
372
373         * GNUmakefile.am:
374         * JavaScriptCoreSources.bkl:
375
376 2008-07-08  Simon Hausmann  <hausmann@webkit.org>
377
378         Fix the Qt build, add ProfileGenerator.cpp to the build.
379
380         * JavaScriptCore.pri:
381
382 2008-07-07  David Kilzer  <ddkilzer@apple.com>
383
384         releaseFastMallocFreeMemory() should always be defined
385
386         Reviewed by Darin.
387
388         * JavaScriptCore.exp: Changed to export C++ binding for
389         WTF::releaseFastMallocFreeMemory() instead of C binding for
390         releaseFastMallocFreeMemory().
391         * wtf/FastMalloc.cpp: Moved definitions of
392         releaseFastMallocFreeMemory() to be in the WTF namespace
393         regardless whether FORCE_SYSTEM_MALLOC is defined.
394         * wtf/FastMalloc.h: Moved releaseFastMallocFreeMemory() from
395         extern "C" binding to WTF::releaseFastMallocFreeMemory().
396
397 2008-07-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
398
399         Reviewed by Geoff.
400
401         Bug 19926: URL causes crash within a minute
402         <https://bugs.webkit.org/show_bug.cgi?id=19926>
403
404         Add a check that lastGlobalObject is non-null in Machine::execute()
405         before copying its globals to the current register file.
406
407         In theory, it is possible to make a test case for this, but it will
408         take a while to get it right.
409
410         * VM/Machine.cpp:
411         (KJS::Machine::execute):
412
413 2008-07-07  Darin Adler  <darin@apple.com>
414
415         Rubber stamped by Adele.
416
417         * VM/Machine.cpp:
418         (KJS::Machine::privateExecute): Fix a typo in a comment.
419
420 2008-07-07  Steve Falkenburg  <sfalken@apple.com>
421
422         Build fixes.
423
424         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
425         * JavaScriptCore.vcproj/testapi/testapi.vcproj:
426
427 2008-07-07  Kevin McCullough  <kmccullough@apple.com>
428
429         Reviewed by Darin.
430
431         When the profiler is running it gathers information and creates a
432         Profile.  After it finishes the Profile can be sorted and have other
433         data refinements run over it.  Both of these were done in the same class
434         before.  Now I split the gathering operations into a new class called
435         ProfileGenerator.
436
437         * JavaScriptCore.xcodeproj/project.pbxproj:
438         * profiler/Profile.cpp: Removed code related to the gather stage of a
439         Profile's creation.  
440         (KJS::Profile::create):
441         (KJS::Profile::Profile):
442         * profiler/Profile.h: Ditto.
443         (KJS::Profile::title):
444         (KJS::Profile::callTree):
445         (KJS::Profile::setHead):
446         * profiler/ProfileGenerator.cpp: Added. This is the class that will
447         handle the stage of creating a Profile.  Once the Profile is finished
448         being created, this class goes away.
449         (KJS::ProfileGenerator::create):
450         (KJS::ProfileGenerator::ProfileGenerator):
451         (KJS::ProfileGenerator::title):
452         (KJS::ProfileGenerator::willExecute):
453         (KJS::ProfileGenerator::didExecute):
454         (KJS::ProfileGenerator::stopProfiling):
455         (KJS::ProfileGenerator::didFinishAllExecution):
456         (KJS::ProfileGenerator::removeProfileStart):
457         (KJS::ProfileGenerator::removeProfileEnd):
458         * profiler/ProfileGenerator.h: Added.
459         (KJS::ProfileGenerator::profile):
460         (KJS::ProfileGenerator::originatingGlobalExec):
461         (KJS::ProfileGenerator::pageGroupIdentifier):
462         (KJS::ProfileGenerator::client):
463         (KJS::ProfileGenerator::stoppedProfiling):
464         * profiler/Profiler.cpp: Now operates with the ProfileGenerator instead
465         of the Profile.
466         (KJS::Profiler::startProfiling):
467         (KJS::Profiler::stopProfiling):
468         (KJS::Profiler::didFinishAllExecution): It is here that the Profile is
469         handed off to its client and the Profile Generator is no longer needed.
470         (KJS::dispatchFunctionToProfiles):
471         (KJS::Profiler::willExecute):
472         (KJS::Profiler::didExecute):
473         * profiler/Profiler.h: Cleaned up the includes and subsequently the
474         forward declarations.  Also use the new ProfileGenerator.
475         (KJS::ProfilerClient::~ProfilerClient):
476         (KJS::Profiler::currentProfiles):
477         * profiler/TreeProfile.cpp: Use Profile's new interface.
478         (KJS::TreeProfile::create):
479         (KJS::TreeProfile::TreeProfile):
480         * profiler/TreeProfile.h:
481
482 2008-07-07  Sam Weinig  <sam@webkit.org>
483
484         Reviewed by Cameron Zwarich.
485
486         Third step in broad cleanup effort.
487
488         [ File list elided ]
489
490 2008-07-06  Sam Weinig  <sam@webkit.org>
491
492         Reviewed by Cameron Zwarich.
493
494         Second step in broad cleanup effort.
495
496         [ File list elided ]
497
498 2008-07-05  Sam Weinig  <sam@webkit.org>
499
500         Reviewed by Cameron Zwarich.
501
502         First step in broad cleanup effort.
503
504         [ File list elided ]
505
506 2008-07-05  Sam Weinig  <sam@webkit.org>
507
508         Rubber-stamped by Cameron Zwarich.
509
510         Rename list.h/cpp to ArgList.h/cpp.
511
512         * GNUmakefile.am:
513         * JavaScriptCore.pri:
514         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
515         * JavaScriptCore.xcodeproj/project.pbxproj:
516         * JavaScriptCoreSources.bkl:
517         * VM/Machine.h:
518         * kjs/AllInOneFile.cpp:
519         * kjs/ArgList.cpp: Copied from JavaScriptCore/kjs/list.cpp.
520         * kjs/ArgList.h: Copied from JavaScriptCore/kjs/list.h.
521         * kjs/IndexToNameMap.cpp:
522         * kjs/JSGlobalData.cpp:
523         * kjs/JSGlobalData.h:
524         * kjs/JSObject.h:
525         * kjs/collector.cpp:
526         * kjs/list.cpp: Removed.
527         * kjs/list.h: Removed.
528
529 2008-07-05  Sam Weinig  <sam@webkit.org>
530
531         Fix non-AllInOne builds again.
532
533         * kjs/BooleanPrototype.cpp:
534         * kjs/ErrorPrototype.cpp:
535         * kjs/FunctionPrototype.cpp:
536         * kjs/NumberPrototype.cpp:
537         * kjs/ObjectPrototype.cpp:
538
539 2008-07-05  Sam Weinig  <sam@webkit.org>
540
541         Fix build on case-sensitive build systems.
542
543         * kjs/IndexToNameMap.cpp:
544
545 2008-07-05  Sam Weinig  <sam@webkit.org>
546
547         Fix build.
548
549         * kjs/Arguments.cpp:
550         * kjs/BooleanPrototype.cpp:
551         * kjs/DateConstructor.cpp:
552         * kjs/ErrorPrototype.cpp:
553         * kjs/FunctionPrototype.cpp:
554         * kjs/NumberPrototype.cpp:
555         * kjs/ObjectPrototype.cpp:
556         * kjs/RegExpPrototype.cpp:
557         * kjs/StringConstructor.cpp:
558         * kjs/lookup.cpp:
559
560 2008-07-05  Sam Weinig  <sam@webkit.org>
561
562         Fix non-AllInOne build.
563
564         * kjs/JSGlobalObject.cpp:
565
566 2008-07-05  Sam Weinig  <sam@webkit.org>
567
568         Rubber-stamped by Cameron Zwarich.
569
570         Split Arguments, IndexToNameMap, PrototypeFunction, GlobalEvalFunction and 
571         the functions on the global object out of JSFunction.h/cpp.
572
573         * GNUmakefile.am:
574         * JavaScriptCore.pri:
575         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
576         * JavaScriptCore.xcodeproj/project.pbxproj:
577         * JavaScriptCoreSources.bkl:
578         * VM/Machine.cpp:
579         * kjs/AllInOneFile.cpp:
580         * kjs/Arguments.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
581         * kjs/Arguments.h: Copied from JavaScriptCore/kjs/JSFunction.h.
582         * kjs/GlobalEvalFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
583         * kjs/GlobalEvalFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
584         * kjs/IndexToNameMap.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
585         * kjs/IndexToNameMap.h: Copied from JavaScriptCore/kjs/JSFunction.h.
586         * kjs/JSActivation.cpp:
587         * kjs/JSFunction.cpp:
588         * kjs/JSFunction.h:
589         * kjs/JSGlobalObject.cpp:
590         * kjs/JSGlobalObjectFunctions.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
591         * kjs/JSGlobalObjectFunctions.h: Copied from JavaScriptCore/kjs/JSFunction.h.
592         The functions on the global object should be in JSGlobalObject.cpp, but putting them there
593         was a 0.5% regression.
594
595         * kjs/PrototypeFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
596         * kjs/PrototypeFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
597         * kjs/Shell.cpp:
598         * kjs/lexer.cpp:
599         * kjs/ustring.cpp:
600
601 2008-07-04  Sam Weinig  <sam@webkit.org>
602
603         Really fix the mac build.
604
605         * JavaScriptCore.xcodeproj/project.pbxproj:
606
607 2008-07-04  Sam Weinig  <sam@webkit.org>
608
609         Fix mac build.
610
611         * JavaScriptCore.xcodeproj/project.pbxproj:
612
613 2008-07-04  Sam Weinig  <sam@webkit.org>
614
615         Fix non-AllInOne builds.
616
617         * kjs/Error.cpp:
618         * kjs/GetterSetter.cpp:
619         * kjs/JSImmediate.cpp:
620         * kjs/operations.cpp:
621
622 2008-07-04  Sam Weinig  <sam@webkit.org>
623
624         Rubber-stamped by Dan Bernstein.
625
626         Split Error and GetterSetter out of JSObject.h.
627
628         * API/JSCallbackObjectFunctions.h:
629         * GNUmakefile.am:
630         * JavaScriptCore.pri:
631         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
632         * JavaScriptCore.xcodeproj/project.pbxproj:
633         * JavaScriptCoreSources.bkl:
634         * kjs/AllInOneFile.cpp:
635         * kjs/ClassInfo.h: Copied from JavaScriptCore/kjs/JSObject.h.
636         * kjs/Error.cpp: Copied from JavaScriptCore/kjs/JSObject.cpp.
637         * kjs/Error.h: Copied from JavaScriptCore/kjs/JSObject.h.
638         * kjs/GetterSetter.cpp:
639         * kjs/GetterSetter.h: Copied from JavaScriptCore/kjs/JSObject.h.
640         * kjs/JSObject.cpp:
641         * kjs/JSObject.h:
642         * kjs/nodes.h:
643
644 2008-07-04  Simon Hausmann  <hausmann@webkit.org>
645
646         Fix the Wx build, added TreeProfile.cpp to the build.
647
648         * JavaScriptCoreSources.bkl:
649
650 2008-07-03  Mark Rowe  <mrowe@apple.com>
651
652         Reviewed by Oliver Hunt.
653
654         Fix output path of recently-added script phase to reference the correct file.
655         This prevents Xcode from running the script phase unnecessarily, which caused
656         the generated header to be recreated and lead to AllInOneFile.cpp rebuilding.
657
658         * JavaScriptCore.xcodeproj/project.pbxproj:
659
660 2008-07-03  Mark Rowe  <mrowe@apple.com>
661
662         Follow-up to the 64-bit build fix.  Use intptr_t rather than ssize_t as
663         the latter is non-standard and does not exist on Windows.
664
665         * kjs/JSLock.cpp:
666         (KJS::JSLock::lockCount):
667         (KJS::JSLock::lock):
668         (KJS::JSLock::unlock):
669         (KJS::JSLock::DropAllLocks::DropAllLocks):
670         * kjs/JSLock.h:
671
672 2008-07-02  Mark Rowe  <mrowe@apple.com>
673
674         Fix the 64-bit build.  pthread_getspecific works with pointer-sized values,
675         so use ssize_t rather than int to track the lock count to avoid warnings about
676         truncating the result of pthread_getspecific.
677
678         * kjs/JSLock.cpp:
679         (KJS::JSLock::lockCount):
680         (KJS::JSLock::lock):
681         (KJS::JSLock::unlock):
682         (KJS::JSLock::DropAllLocks::DropAllLocks):
683         * kjs/JSLock.h:
684
685 2008-07-03  Geoffrey Garen  <ggaren@apple.com>
686
687         Reviewed by Sam Weinig.
688         
689         Removed checking for the array get/put fast case from the array code.
690         Callers who want the fast case should call getIndex and/or setIndex
691         instead. (get_by_val and put_by_val already do this.)
692         
693         SunSpider reports no change overall, but a 1.4% speedup on fannkuch and
694         a 3.6% speedup on nsieve.
695
696 2008-07-03  Dan Bernstein  <mitz@apple.com>
697
698         - Windows build fix
699
700         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added TreeProfile.{h,cpp}.
701
702 2008-07-03  Dan Bernstein  <mitz@apple.com>
703
704         Reviewed by Anders Carlsson.
705
706         - Windows build fix
707
708         * VM/Machine.cpp:
709         (KJS::Machine::Machine):
710
711 2008-07-03  Simon Hausmann  <hausmann@webkit.org>
712
713         Reviewed by Alexey Proskuryakov.
714
715         Fix the non-threaded build.
716
717         * kjs/JSGlobalData.cpp:
718         (KJS::JSGlobalData::threadInstanceInternal):
719
720 2008-07-03  Simon Hausmann  <hausmann@webkit.org>
721
722         Fix the Qt build, added TreeProfile to the build.
723
724         * JavaScriptCore.pri:
725
726 2008-07-02  Alexey Proskuryakov  <ap@webkit.org>
727
728         Reviewed by Geoff.
729
730         Don't create unnecessary JSGlobalData instances.
731
732         * kjs/JSGlobalData.h:
733         * kjs/JSGlobalData.cpp:
734         (KJS::JSGlobalData::threadInstanceExists):
735         (KJS::JSGlobalData::sharedInstanceExists):
736         (KJS::JSGlobalData::threadInstance):
737         (KJS::JSGlobalData::sharedInstance):
738         (KJS::JSGlobalData::threadInstanceInternal):
739         (KJS::JSGlobalData::sharedInstanceInternal):
740         Added methods to query instance existence.
741
742         * kjs/InitializeThreading.cpp:
743         (KJS::initializeThreadingOnce):
744         Initialize thread instance static in a new way.
745
746         * API/JSBase.cpp:
747         (JSGarbageCollect):
748         * kjs/collector.cpp:
749         (KJS::Heap::collect):
750         Check for instance existence before accessing it.
751
752 2008-07-02  Geoffrey Garen  <ggaren@apple.com>
753
754         Reviewed by Cameron Zwarich.
755         
756         Fixed https://bugs.webkit.org/show_bug.cgi?id=19862
757         REGRESSION (r34907): Gmail crashes in JavaScriptCore code while editing drafts
758         
759         I was never able to reproduce this issue, but Cameron could, and he says
760         that this patch fixes it.
761         
762         The crash seems tied to a timer or event handler callback. In such a case,
763         the sole reference to the global object may be in the current call frame,
764         so we can't depend on the global object to mark the call frame area in
765         the register file.
766         
767         The new GC marking rule is: the global object is not responsible for
768         marking the whole register file -- it's just responsible for the globals
769         section it's tied to. The heap is responsible for marking the call frame area.
770
771 2008-07-02  Mark Rowe  <mrowe@apple.com>
772
773         Reviewed by Sam Weinig.
774
775         Add the ability to trace JavaScriptCore garabge collections using dtrace.
776
777         * JavaScriptCore.xcodeproj/project.pbxproj: Generate the dtrace probe header
778         file when building on a new enough version of Mac OS X.
779         * JavaScriptCorePrefix.h: Add our standard Mac OS X version detection macros.
780         * kjs/Tracing.d: Declare three dtrace probes.
781         * kjs/Tracing.h: Include the generated dtrace macros if dtrace is available,
782         otherwise provide versions that do nothing.
783         * kjs/collector.cpp:
784         (KJS::Heap::collect): Fire dtrace probes when starting a collection, after the
785         mark phase has completed, and when the collection is complete.
786         * wtf/Platform.h: Define HAVE_DTRACE when building on a new enough version of Mac OS X.
787
788 2008-07-02  Geoffrey Garen  <ggaren@apple.com>
789
790         Rubber stamped by Oliver Hunt.
791         
792         Reduced the max register file size from 8MB to 2MB.
793
794         We still allow about 20,000 levels of recursion.
795
796 2008-07-02  Alp Toker  <alp@nuanti.com>
797
798         Build fix for r34960. Add TreeProfile.cpp to build.
799
800         * GNUmakefile.am:
801
802 2008-07-02  Geoffrey Garen  <ggaren@apple.com>
803
804         Reviewed by Oliver Hunt.
805
806         Optimized a[n] get for cases when a is an array or a string. When a is
807         an array, we optimize both get and put. When a is a string, we only
808         optimize get, since you can't put to a string.
809         
810         SunSpider says 3.4% faster.
811
812 2008-07-02  Kevin McCullough  <kmccullough@apple.com>
813
814         Reviewed by Darin.
815
816         -Small cleanup in preparation for implementing Bottom-up.
817
818         * profiler/CallIdentifier.h: Rename debug function to make it clear of
819         its output and intention to be debug only.
820         (KJS::CallIdentifier::operator const char* ): Implement in terms of
821         c_str.
822         (KJS::CallIdentifier::c_str):
823         * profiler/ProfileNode.cpp: Impelment findChild() which will be needed
824         by the bottom-up implementation.
825         (KJS::ProfileNode::findChild):
826         * profiler/ProfileNode.h: Added comments to make the collections of
827         functions more clear.
828         (KJS::ProfileNode::operator==):
829         (KJS::ProfileNode::c_str):
830
831 2008-07-02  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
832
833         Reviewed by Darin.
834
835         Bug 19776: Number.toExponential() is incorrect for numbers between 0.1 and 1
836         <https://bugs.webkit.org/show_bug.cgi?id=19776>
837
838         Perform the sign check for the exponent on the actual exponent value,
839         which is 1 less than the value of decimalPoint, instead of on the value
840         of decimalPoint itself.
841
842         * kjs/NumberPrototype.cpp:
843         (KJS::exponentialPartToString):
844
845 2008-07-02  Kevin McCullough  <kmccullough@apple.com>
846
847         Reviewed by Darin.
848
849         <rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
850         - Subclass TreeProfile as I prepare for a HeavyProfile to be comming
851         later.
852
853         * JavaScriptCore.xcodeproj/project.pbxproj:
854         * profiler/Profile.cpp: By default we create a TreeProfile.
855         (KJS::Profile::create):
856         * profiler/Profile.h: Changes to the Profile class to make it amenable
857         to be inherited from.
858         (KJS::Profile::~Profile):
859         * profiler/TreeProfile.cpp: Added.
860         (KJS::TreeProfile::create):
861         (KJS::TreeProfile::TreeProfile):
862         (KJS::TreeProfile::heavyProfile):
863         * profiler/TreeProfile.h: Added.
864         (KJS::TreeProfile::treeProfile):
865
866 2008-07-02  Kevin McCullough  <kmccullough@apple.com>
867
868         Reviewed by Dan.
869
870         Broke CallIdentifier out into its own file. I did this because it's
871         going to grow a lot soon and I wanted this to be a separate patch.
872
873         * JavaScriptCore.xcodeproj/project.pbxproj:
874         * profiler/CallIdentifier.h: Added.
875         (KJS::CallIdentifier::CallIdentifier):
876         (KJS::CallIdentifier::operator==):
877         (KJS::CallIdentifier::operator!=):
878         (KJS::CallIdentifier::operator const char* ):
879         (KJS::CallIdentifier::toString):
880         * profiler/ProfileNode.h:
881
882 2008-07-02  Simon Hausmann  <hausmann@webkit.org>
883
884         Build fix. Implemented missing functions for single-threaded build.
885
886         * kjs/JSLock.cpp:
887         (KJS::JSLock::JSLock):
888         (KJS::JSLock::lock):
889         (KJS::JSLock::unlock):
890         (KJS::JSLock::DropAllLocks::DropAllLocks):
891
892 2008-07-02  Alexey Proskuryakov  <ap@webkit.org>
893
894         Another non-AllInOne build fix.
895
896         * kjs/JSGlobalObject.cpp: Include JSLock.h here, too.
897
898 2008-07-02  Alexey Proskuryakov  <ap@webkit.org>
899
900         Non-AllInOne build fix.
901
902         * kjs/interpreter.cpp: Include JSLock.h.
903
904 2008-06-30  Alexey Proskuryakov  <ap@webkit.org>
905
906         Reviewed by Darin.
907
908         Disable JSLock for per-thread contexts.
909
910         No change on SunSpider.
911
912         * kjs/JSGlobalData.h:
913         * kjs/JSGlobalData.cpp:
914         (KJS::JSGlobalData::JSGlobalData):
915         (KJS::JSGlobalData::sharedInstance):
916         Added isSharedInstance as a better way to tell whether the instance is shared (legacy).
917
918         * kjs/JSLock.cpp:
919         (KJS::createJSLockCount):
920         (KJS::JSLock::lockCount):
921         (KJS::setLockCount):
922         (KJS::JSLock::JSLock):
923         (KJS::JSLock::lock):
924         (KJS::JSLock::unlock):
925         (KJS::JSLock::currentThreadIsHoldingLock):
926         (KJS::JSLock::DropAllLocks::DropAllLocks):
927         (KJS::JSLock::DropAllLocks::~DropAllLocks):
928         * kjs/JSLock.h:
929         (KJS::JSLock::JSLock):
930         (KJS::JSLock::~JSLock):
931         Made JSLock and JSLock::DropAllLocks constructors take a parameter to decide whether to
932         actually lock a mutex, or only to increment recursion count. We cannot turn it into no-op
933         if we want to keep existing assertions working.
934         Made recursion count per-thread, now that locks may not lock.
935
936         * API/JSBase.cpp:
937         (JSEvaluateScript): Take JSLock after casting JSContextRef to ExecState* (which doesn't need
938         locking in any case), so that a decision whether to actually lock can be made.
939         (JSCheckScriptSyntax): Ditto.
940         (JSGarbageCollect): Only lock while collecting the shared heap, not the per-thread one.
941
942         * API/JSObjectRef.cpp:
943         (JSClassCreate): Don't lock, as there is no reason to.
944         (JSClassRetain): Ditto.
945         (JSClassRelease): Ditto.
946         (JSPropertyNameArrayRetain): Ditto.
947         (JSPropertyNameArrayRelease): Only lock while deleting the array, as that may touch
948         identifier table.
949         (JSPropertyNameAccumulatorAddName): Adding a string also involves an identifier table
950         lookup, and possibly modification.
951
952         * API/JSStringRef.cpp:
953         (JSStringCreateWithCharacters):
954         (JSStringCreateWithUTF8CString):
955         (JSStringRetain):
956         (JSStringRelease):
957         (JSStringGetUTF8CString):
958         (JSStringIsEqual):
959         * API/JSStringRefCF.cpp:
960         (JSStringCreateWithCFString):
961         JSStringRef operations other than releasing do not need locking.
962
963         * VM/Machine.cpp: Don't include unused JSLock.h.
964
965         * kjs/CollectorHeapIntrospector.cpp: (KJS::CollectorHeapIntrospector::statistics):
966         Don't take the lock for real, as heap introspection pauses the process anyway. It seems that
967         the existing code could cause deadlocks.
968
969         * kjs/Shell.cpp:
970         (functionGC):
971         (main):
972         (jscmain):
973         The test tool uses a per-thread context, so no real locking is required.
974
975         * kjs/collector.h:
976         (KJS::Heap::setGCProtectNeedsLocking): Optionally protect m_protectedValues access with a
977         per-heap mutex. This is only needed for WebCore Database code, which violates the "no data
978         migration between threads" by using ProtectedPtr on a background thread.
979         (KJS::Heap::isShared): Keep a shared flag here, as well.
980
981         * kjs/protect.h:
982         (KJS::::ProtectedPtr):
983         (KJS::::~ProtectedPtr):
984         (KJS::::operator):
985         (KJS::operator==):
986         (KJS::operator!=):
987         ProtectedPtr is ony used from WebCore, so it doesn't need to take JSLock. An assertion in
988         Heap::protect/unprotect guards agains possible future unlocked uses of ProtectedPtr in JSC.
989
990         * kjs/collector.cpp:
991         (KJS::Heap::Heap): Initialize m_isShared.
992         (KJS::Heap::~Heap): No need to lock for real during destruction, but must keep assertions
993         in sweep() working.
994         (KJS::destroyRegisteredThread): Registered thread list is only accessed for shared heap,
995         so locking is always needed here.
996         (KJS::Heap::registerThread): Ditto.
997         (KJS::Heap::markStackObjectsConservatively): Use m_isShared instead of comparing to a shared
998         instance for a small speedup.
999         (KJS::Heap::setGCProtectNeedsLocking): Create m_protectedValuesMutex. There is currently no
1000         way to undo this - and ideally, Database code will be fixed to lo longer require this quirk.
1001         (KJS::Heap::protect): Take m_protectedValuesMutex (if it exists) while accessing
1002         m_protectedValues.
1003         (KJS::Heap::unprotect): Ditto.
1004         (KJS::Heap::markProtectedObjects): Ditto.
1005         (KJS::Heap::protectedGlobalObjectCount): Ditto.
1006         (KJS::Heap::protectedObjectCount): Ditto.
1007         (KJS::Heap::protectedObjectTypeCounts): Ditto.
1008
1009         * kjs/ustring.cpp:
1010         * kjs/ustring.h:
1011         Don't include JSLock.h, which is no longer used here. As a result, an explicit include had
1012         to be added to many files in JavaScriptGlue, WebCore and WebKit.
1013
1014         * kjs/JSGlobalObject.cpp:
1015         (KJS::JSGlobalObject::init):
1016         * API/JSCallbackConstructor.cpp:
1017         (KJS::constructJSCallback):
1018         * API/JSCallbackFunction.cpp:
1019         (KJS::JSCallbackFunction::call):
1020         * API/JSCallbackObjectFunctions.h:
1021         (KJS::::init):
1022         (KJS::::getOwnPropertySlot):
1023         (KJS::::put):
1024         (KJS::::deleteProperty):
1025         (KJS::::construct):
1026         (KJS::::hasInstance):
1027         (KJS::::call):
1028         (KJS::::getPropertyNames):
1029         (KJS::::toNumber):
1030         (KJS::::toString):
1031         (KJS::::staticValueGetter):
1032         (KJS::::callbackGetter):
1033         * API/JSContextRef.cpp:
1034         (JSGlobalContextCreate):
1035         (JSGlobalContextRetain):
1036         (JSGlobalContextRelease):
1037         * API/JSValueRef.cpp:
1038         (JSValueIsEqual):
1039         (JSValueIsStrictEqual):
1040         (JSValueIsInstanceOfConstructor):
1041         (JSValueMakeNumber):
1042         (JSValueMakeString):
1043         (JSValueToNumber):
1044         (JSValueToStringCopy):
1045         (JSValueToObject):
1046         (JSValueProtect):
1047         (JSValueUnprotect):
1048         * JavaScriptCore.exp:
1049         * kjs/PropertyNameArray.h:
1050         (KJS::PropertyNameArray::globalData):
1051         * kjs/interpreter.cpp:
1052         (KJS::Interpreter::checkSyntax):
1053         (KJS::Interpreter::evaluate):
1054         Pass a parameter to JSLock/JSLock::DropAllLocks to decide whether the lock needs to be taken.
1055
1056 2008-07-01  Alexey Proskuryakov  <ap@webkit.org>
1057
1058         Reviewed by Darin.
1059
1060         https://bugs.webkit.org/show_bug.cgi?id=19834
1061         Failed assertion in JavaScriptCore/VM/SegmentedVector.h:82
1062
1063         Creating a global object with a custom prototype resets it twice (wasteful!).
1064         So, addStaticGlobals() was called twice, but JSGlobalObject::reset() didn't reset
1065         the register array.        
1066
1067         * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::reset): Call setRegisterArray(0, 0).
1068
1069         * kjs/JSVariableObject.h: Changed registerArray to OwnArrayPtr. Also, added private copy
1070         constructor and operator= to ensure that no one attempts to copy this object (for whatever
1071         reason, I couldn't make Noncopyable work).
1072
1073         * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::addStaticGlobals): Allocate registerArray
1074         with new[].
1075
1076         * kjs/JSVariableObject.cpp:
1077         (KJS::JSVariableObject::copyRegisterArray): Allocate registerArray with new[].
1078         (KJS::JSVariableObject::setRegisterArray): Avoid hitting an assertion in OwnArrayPtr when
1079         "changing" the value from 0 to 0.
1080
1081 2008-07-01  Geoffrey Garen  <ggaren@apple.com>
1082
1083         Reviewed by Oliver Hunt.
1084         
1085         Removed and/or reordered exception checks in array-style a[n] access.
1086         
1087         SunSpider says 1.4% faster.
1088
1089         * VM/Machine.cpp:
1090         (KJS::Machine::privateExecute): No need to check for exceptions before
1091         calling toString, toNumber and/or get. If the call ends up being observable
1092         through toString, valueOf, or a getter, we short-circuit it there, instead.
1093         In the op_del_by_val case, I removed the incorrect comment without actually
1094         removing the code, since I didn't want to tempt the GCC fates!
1095
1096         * kjs/JSObject.cpp:
1097         (KJS::callDefaultValueFunction): Added exception check to prevent
1098         toString and valueOf functions from observing execution after an exception
1099         has been thrown. This removes some of the burden of exception checking
1100         from the machine.
1101
1102         (KJS::JSObject::defaultValue): Removed redundant exception check here.
1103
1104         * kjs/PropertySlot.cpp:
1105         (KJS::PropertySlot::functionGetter): Added exception check to prevent
1106         getter functions from observing execution after an exception has been
1107         thrown. This removes some of the burden of exception checking from the
1108         machine.
1109
1110 2008-07-01  Geoffrey Garen  <ggaren@apple.com>
1111
1112         Reviewed by Oliver Hunt.
1113         
1114         Optimized a[n] get and put for cases where n is an immediate unsigned
1115         value.
1116         
1117         SunSpider says 3.5% faster.
1118
1119 2008-07-01  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1120
1121         Reviewed by Darin.
1122
1123         Bug 19844: JavaScript Switch statement modifies "this"
1124         <https://bugs.webkit.org/show_bug.cgi?id=19844>
1125
1126         Use a temporary when generating code for switch clauses to avoid
1127         overwriting 'this' or a local variable.
1128
1129         * kjs/nodes.cpp:
1130         (KJS::CaseBlockNode::emitCodeForBlock):
1131
1132 2008-07-01  Christian Dywan  <christian@twotoasts.de>
1133
1134         Gtk+ build fix.
1135
1136         * kjs/list.cpp: Include "JSCell.h"
1137
1138 2008-07-01  Kevin McCullough  <kmccullough@apple.com>
1139
1140         Build fix.
1141
1142         * JavaScriptCore.xcodeproj/project.pbxproj:
1143
1144 2008-07-01  Dan Bernstein  <mitz@apple.com>
1145
1146         Reviewed by Anders Carlsson.
1147
1148         - Mac release build fix
1149
1150         * JavaScriptCore.exp:
1151
1152 2008-07-01  Sam Weinig  <sam@webkit.org>
1153
1154         Try and fix mac builds.
1155
1156         * JavaScriptCore.exp:
1157
1158 2008-07-01  Sam Weinig  <sam@webkit.org>
1159
1160         Fix non-AllInOne builds.
1161
1162         * kjs/DateMath.cpp:
1163
1164 2008-07-01  Sam Weinig  <sam@webkit.org>
1165
1166         Reviewed by Darin Adler.
1167
1168         Split JSCell and JSNumberCell class declarations out of JSValue.h
1169
1170         * GNUmakefile.am:
1171         * JavaScriptCore.pri:
1172         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1173         * JavaScriptCore.xcodeproj/project.pbxproj:
1174         * JavaScriptCoreSources.bkl:
1175         * VM/JSPropertyNameIterator.h:
1176         * kjs/AllInOneFile.cpp:
1177         * kjs/JSCell.cpp: Copied from JavaScriptCore/kjs/JSValue.cpp.
1178         * kjs/JSCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
1179         (KJS::JSValue::getJSNumber):
1180         * kjs/JSNumberCell.cpp:
1181         * kjs/JSNumberCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
1182         * kjs/JSObject.h:
1183         * kjs/JSString.cpp:
1184         (KJS::jsString):
1185         (KJS::jsOwnedString):
1186         * kjs/JSString.h:
1187         (KJS::JSValue::toThisJSString):
1188         * kjs/JSValue.cpp:
1189         * kjs/JSValue.h:
1190
1191 2008-07-01  Anders Carlsson  <andersca@apple.com>
1192
1193         Build fixes.
1194         
1195         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1196         * kjs/JSGlobalObject.h:
1197         (KJS::JSGlobalObject::addStaticGlobals):
1198
1199 2008-07-01  Simon Hausmann  <hausmann@webkit.org>
1200
1201         Build fix, include OwnPtr.h.
1202
1203         * kjs/RegExpConstructor.h:
1204
1205 2008-06-30  Geoffrey Garen  <ggaren@apple.com>
1206
1207         Reviewed by Oliver Hunt.
1208         
1209         Fixed a global object leak caused by the switch to one register file.
1210         
1211         Don't unconditionally mark the register file, since that logically
1212         makes all global variables GC roots, even when their global object is
1213         no longer reachable.
1214         
1215         Instead, make the global object associated with the register file
1216         responsible for marking the register file.
1217
1218 2008-06-30  Geoffrey Garen  <ggaren@apple.com>
1219
1220         Reviewed by Oliver Hunt.
1221         
1222         Removed the "registerBase" abstraction. Since the register file never
1223         reallocates, we can keep direct pointers into it, instead of
1224         <registerBase, offset> tuples.
1225         
1226         SunSpider says 0.8% faster.
1227         
1228 2008-06-30  Oliver Hunt  <oliver@apple.com>
1229
1230         Reviewed by NOBODY (build fix).
1231
1232         Fix build by adding all (hopefully) the missing includes.
1233
1234         * kjs/BooleanPrototype.cpp:
1235         * kjs/DateConstructor.cpp:
1236         * kjs/ErrorPrototype.cpp:
1237         * kjs/FunctionPrototype.cpp:
1238         * kjs/NativeErrorConstructor.cpp:
1239         * kjs/NumberPrototype.cpp:
1240         * kjs/ObjectPrototype.cpp:
1241         * kjs/RegExpConstructor.cpp:
1242         * kjs/StringConstructor.cpp:
1243         * kjs/StringPrototype.cpp:
1244
1245 2008-06-30  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1246
1247         Reviewed by Oliver.
1248
1249         Bug 19830: REGRESSION (r34883): Google Reader doesn't show up feed list on sidebar
1250         <https://bugs.webkit.org/show_bug.cgi?id=19830>
1251
1252         Ensure that we do not eliminate a write to a local register when doing
1253         peephole optimizations.
1254
1255         * VM/CodeGenerator.cpp:
1256         (KJS::CodeGenerator::emitJumpIfTrue):
1257         (KJS::CodeGenerator::emitJumpIfFalse):
1258
1259 2008-06-30  Sam Weinig  <sam@webkit.org>
1260
1261         Rubber-stamped by Darin Alder.
1262
1263         Split InternalFunction into its own header file.
1264
1265         * API/JSCallbackFunction.h:
1266         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1267         * JavaScriptCore.xcodeproj/project.pbxproj:
1268         * kjs/ArrayConstructor.h:
1269         * kjs/BooleanConstructor.h:
1270         * kjs/DateConstructor.h:
1271         * kjs/ErrorConstructor.h:
1272         * kjs/FunctionConstructor.h:
1273         * kjs/FunctionPrototype.h:
1274         * kjs/InternalFunction.h: Copied from kjs/JSFunction.h.
1275         * kjs/JSFunction.h:
1276         * kjs/NativeErrorConstructor.h:
1277         * kjs/NumberConstructor.h:
1278         * kjs/ObjectConstructor.h:
1279         * kjs/RegExpConstructor.h:
1280         * kjs/StringConstructor.h:
1281         * profiler/Profiler.cpp:
1282
1283 2008-06-30  Sam Weinig  <sam@webkit.org>
1284
1285         Reviewed by Kevin McCullough.
1286
1287         Remove empty files Instruction.cpp, LabelID.cpp, Register.cpp and RegisterID.cpp.
1288
1289         * GNUmakefile.am:
1290         * JavaScriptCore.pri:
1291         * JavaScriptCore.xcodeproj/project.pbxproj:
1292         * JavaScriptCoreSources.bkl:
1293         * VM/Instruction.cpp: Removed.
1294         * VM/LabelID.cpp: Removed.
1295         * VM/Register.cpp: Removed.
1296         * VM/RegisterID.cpp: Removed.
1297
1298 2008-06-30  Sam Weinig  <sam@webkit.org>
1299
1300         Rubber-stamped (reluctantly) by Kevin McCullough.
1301
1302         Rename date_object.h/cpp to DateInstance.h/cpp
1303
1304         * GNUmakefile.am:
1305         * JavaScriptCore.pri:
1306         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1307         * JavaScriptCore.xcodeproj/project.pbxproj:
1308         * JavaScriptCoreSources.bkl:
1309         * kjs/AllInOneFile.cpp:
1310         * kjs/DateConstructor.cpp:
1311         * kjs/DateInstance.cpp: Copied from kjs/date_object.cpp.
1312         * kjs/DateInstance.h: Copied from kjs/date_object.h.
1313         * kjs/DatePrototype.cpp:
1314         * kjs/DatePrototype.h:
1315         * kjs/date_object.cpp: Removed.
1316         * kjs/date_object.h: Removed.
1317
1318 2008-06-30  Sam Weinig  <sam@webkit.org>
1319
1320         Rubber-stamped by Darin Adler.
1321
1322         Remove internal.cpp and move its contents to there own .cpp files.
1323
1324         * GNUmakefile.am:
1325         * JavaScriptCore.pri:
1326         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1327         * JavaScriptCore.xcodeproj/project.pbxproj:
1328         * JavaScriptCoreSources.bkl:
1329         * kjs/AllInOneFile.cpp:
1330         * kjs/GetterSetter.cpp: Copied from kjs/internal.cpp.
1331         * kjs/InternalFunction.cpp: Copied from kjs/internal.cpp.
1332         * kjs/JSNumberCell.cpp: Copied from kjs/internal.cpp.
1333         * kjs/JSString.cpp: Copied from kjs/internal.cpp.
1334         * kjs/JSString.h:
1335         * kjs/LabelStack.cpp: Copied from kjs/internal.cpp.
1336         * kjs/NumberConstructor.cpp:
1337         * kjs/NumberObject.cpp:
1338         (KJS::constructNumber):
1339         (KJS::constructNumberFromImmediateNumber):
1340         * kjs/internal.cpp: Removed.
1341
1342 2008-06-30  Adam Roben  <aroben@apple.com>
1343
1344         Fix <rdar://5954749> Assertion failure due to HashTable's use of
1345         operator&
1346
1347         HashTable was passing &value to constructDeletedValue, which in
1348         classes like WebCore::COMPtr would cause an assertion. We now pass
1349         value by reference instead of by address so that the HashTraits
1350         implementations have more flexibility in constructing the deleted
1351         value.
1352
1353         Reviewed by Ada Chan.
1354
1355         * VM/CodeGenerator.h: Updated for changes to HashTraits.
1356         * wtf/HashTable.h:
1357         (WTF::::deleteBucket): Changed to pass bucket by reference instead of
1358         by address.
1359         (WTF::::checkKey): Ditto.
1360         * wtf/HashTraits.h:
1361         (WTF::): Updated HashTraits for HashTable change.
1362
1363 2008-07-01  Alexey Proskuryakov  <ap@webkit.org>
1364
1365         Reviewed by Cameron Zwarich.
1366
1367         Make RegisterFile really unmap memory on destruction.
1368
1369         This fixes run-webkit-tests --threaded, which ran out of address space in a few seconds.
1370
1371         * VM/RegisterFile.cpp: (KJS::RegisterFile::~RegisterFile): Unmap all the memory, not just
1372         1/4 of it.
1373
1374         * kjs/JSGlobalObject.h: Don't include RegisterFile.h, so that changes to it don't make
1375         half of WebCore rebuild.
1376
1377         * VM/Machine.h: Don't forward declare RegisterFile, as RegisterFile.h is included already.
1378
1379         * VM/RegisterFile.h: (KJS::RegisterFile::RegisterFile): Assert that the allocation succeeded.
1380
1381 2008-06-30  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1382
1383         Rubber-stamped by Oliver.
1384
1385         Correct the documentation for op_put_by_index.
1386
1387         * VM/Machine.cpp:
1388         (KJS::Machine::privateExecute):
1389
1390 2008-06-29  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1391
1392         Reviewed by Oliver.
1393
1394         Bug 19821: Merge the instruction pair (less, jfalse)
1395         <https://bugs.webkit.org/show_bug.cgi?id=19821>
1396         
1397         This is a 2.4% win on SunSpider. I needed to add an ALWAYS_INLINE
1398         intrinisc to CodeGenerator::rewindBinaryOp() to avoid a massive
1399         regression in regexp-dna.
1400
1401         * VM/CodeBlock.cpp:
1402         (KJS::CodeBlock::dump):
1403         * VM/CodeGenerator.cpp:
1404         (KJS::CodeGenerator::rewindBinaryOp):
1405         (KJS::CodeGenerator::emitJumpIfFalse):
1406         * VM/Machine.cpp:
1407         (KJS::Machine::privateExecute):
1408         * VM/Opcode.cpp:
1409         (KJS::):
1410         * VM/Opcode.h:
1411
1412 2008-06-29  Sam Weinig  <sam@webkit.org>
1413
1414         Fix non-AllInOne builds.
1415
1416         * kjs/JSObject.cpp:
1417         * kjs/JSValue.cpp:
1418
1419 2008-06-29  Sam Weinig  <sam@webkit.org>
1420
1421         Build fix for Qt.
1422
1423         * kjs/DateMath.cpp:
1424         * kjs/DatePrototype.cpp:
1425
1426 2008-06-29  Sam Weinig  <sam@webkit.org>
1427
1428         Rubber-stamped by Cameron Zwarich.
1429
1430         Splits ErrorConstructor, ErrorPrototype,  NativeErrorConstructor and
1431         NativeErrorPrototype out of error_object.h/cpp and renames it ErrorInstance.
1432
1433         * GNUmakefile.am:
1434         * JavaScriptCore.pri:
1435         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1436         * JavaScriptCore.xcodeproj/project.pbxproj:
1437         * JavaScriptCoreSources.bkl:
1438         * kjs/AllInOneFile.cpp:
1439         * kjs/ArrayConstructor.cpp:
1440         * kjs/ArrayPrototype.cpp:
1441         * kjs/BooleanPrototype.cpp:
1442         * kjs/DatePrototype.cpp:
1443         * kjs/ErrorConstructor.cpp: Copied from kjs/error_object.cpp.
1444         * kjs/ErrorConstructor.h: Copied from kjs/error_object.h.
1445         * kjs/ErrorInstance.cpp: Copied from kjs/error_object.cpp.
1446         * kjs/ErrorInstance.h: Copied from kjs/error_object.h.
1447         * kjs/ErrorPrototype.cpp: Copied from kjs/error_object.cpp.
1448         * kjs/ErrorPrototype.h: Copied from kjs/error_object.h.
1449         * kjs/JSGlobalObject.cpp:
1450         * kjs/JSObject.cpp:
1451         * kjs/JSValue.cpp:
1452         * kjs/NativeErrorConstructor.cpp: Copied from kjs/error_object.cpp.
1453         * kjs/NativeErrorConstructor.h: Copied from kjs/error_object.h.
1454         * kjs/NativeErrorPrototype.cpp: Copied from kjs/error_object.cpp.
1455         * kjs/NativeErrorPrototype.h: Copied from kjs/error_object.h.
1456         * kjs/NumberPrototype.cpp:
1457         * kjs/RegExpConstructor.cpp:
1458         * kjs/RegExpObject.cpp:
1459         * kjs/RegExpPrototype.cpp:
1460         * kjs/StringPrototype.cpp:
1461         * kjs/error_object.cpp: Removed.
1462         * kjs/error_object.h: Removed.
1463         * kjs/internal.cpp:
1464
1465 2008-06-29  Sam Weinig  <sam@webkit.org>
1466
1467         Fix non-AllInOne build.
1468
1469         * kjs/DateConstructor.cpp:
1470         * kjs/DateMath.cpp:
1471         * kjs/JSObject.cpp:
1472
1473 2008-06-29  Sam Weinig  <sam@webkit.org>
1474
1475         Rubber-stamped by Oliver Hunt.
1476
1477         Splits DateConstructor and DatePrototype out of date_object.h/cpp
1478         Moves shared Date code into DateMath.
1479
1480         * DerivedSources.make:
1481         * GNUmakefile.am:
1482         * JavaScriptCore.pri:
1483         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1484         * JavaScriptCore.xcodeproj/project.pbxproj:
1485         * JavaScriptCoreSources.bkl:
1486         * kjs/AllInOneFile.cpp:
1487         * kjs/DateConstructor.cpp: Copied from kjs/date_object.cpp.
1488         * kjs/DateConstructor.h: Copied from kjs/date_object.h.
1489         * kjs/DateMath.cpp:
1490         (KJS::ymdhmsToSeconds):
1491         (KJS::):
1492         (KJS::skipSpacesAndComments):
1493         (KJS::findMonth):
1494         (KJS::parseDate):
1495         (KJS::timeClip):
1496         (KJS::formatDate):
1497         (KJS::formatDateUTCVariant):
1498         (KJS::formatTime):
1499         * kjs/DateMath.h:
1500         (KJS::gmtoffset):
1501         * kjs/DatePrototype.cpp: Copied from kjs/date_object.cpp.
1502         * kjs/DatePrototype.h: Copied from kjs/date_object.h.
1503         * kjs/JSGlobalObject.cpp:
1504         * kjs/JSObject.cpp:
1505         * kjs/date_object.cpp:
1506         * kjs/date_object.h:
1507         * kjs/internal.cpp:
1508
1509 2008-06-29  Jan Michael Alonzo  <jmalonzo@webkit.org>
1510
1511         Rubber-stamped by Cameron Zwarich
1512
1513         Fix Gtk non-AllInOne build
1514
1515         * GNUmakefile.am: include JSVariableObject.cpp
1516         * kjs/RegExpConstructor.cpp: include RegExpObject.h
1517         * kjs/RegExpObject.h: forward declare RegExpPrototype
1518
1519 2008-06-28  Darin Adler  <darin@apple.com>
1520
1521         Reviewed by Sam and Cameron.
1522
1523         - fix https://bugs.webkit.org/show_bug.cgi?id=19805
1524           Array.concat turns missing array elements into "undefined"
1525
1526         Test: fast/js/array-holes.html
1527
1528         * JavaScriptCore.exp: No longer export JSArray::getItem.
1529
1530         * kjs/ArrayPrototype.cpp:
1531         (KJS::arrayProtoFuncConcat): Changed to use getProperty instead of
1532         JSArray::getItem -- need to handle properties from the prototype chain
1533         instead of ignoring them.
1534
1535         * kjs/JSArray.cpp: Removed getItem.
1536         * kjs/JSArray.h: Ditto.
1537
1538 2008-06-28  Darin Adler  <darin@apple.com>
1539
1540         Reviewed by Cameron.
1541
1542         - https://bugs.webkit.org/show_bug.cgi?id=19804
1543           optimize access to arrays without "holes"
1544
1545         SunSpider says 1.8% faster.
1546
1547         * kjs/JSArray.cpp:
1548         (KJS::JSArray::JSArray): Initialize m_fastAccessCutoff when creating
1549         arrays. Also updated for new location of m_vectorLength.
1550         (KJS::JSArray::getItem): Updated for new location of m_vectorLength.
1551         (KJS::JSArray::getSlowCase): Added. Broke out the non-hot parts of
1552         getOwnPropertySlot to make the hot part faster.
1553         (KJS::JSArray::getOwnPropertySlot): Added a new faster case for
1554         indices lower than m_fastAccessCutoff. We can do theese with no
1555         additional checks or branches.
1556         (KJS::JSArray::put): Added a new faster case for indices lower than
1557         m_fastAccessCutoff. We can do theese with no additional checks or
1558         branches. Moved the maxArrayIndex handling out of this function.
1559         Added code to set m_fastAccessCutoff when the very last hole in
1560         an array is filled; this is how the cutoff gets set for most arrays.
1561         (KJS::JSArray::putSlowCase): Moved the rest of the put function logic
1562         in here, to make the hot part of the put function faster.
1563         (KJS::JSArray::deleteProperty): Added code to lower m_fastAccessCutoff
1564         when a delete makes a new hole in the array.
1565         (KJS::JSArray::getPropertyNames): Updated for new location of
1566         m_vectorLength.
1567         (KJS::JSArray::increaseVectorLength): Ditto.
1568         (KJS::JSArray::setLength): Added code to lower m_fastAccessCutoff
1569         when setLength makes the array smaller.
1570         (KJS::JSArray::mark): Updated for new location of m_vectorLength.
1571         (KJS::JSArray::sort): Ditto. Set m_fastAccessCutoff after moving
1572         all the holes to the end of the array.
1573         (KJS::JSArray::compactForSorting): Ditto.
1574         (KJS::JSArray::checkConsistency): Added consistency checks fro
1575         m_fastAccessCutoff and updated for the new location of m_vectorLength.
1576
1577         * kjs/JSArray.h: Added declarations for slow case functions.
1578         Replaced m_vectorLength with m_fastAccessCutoff.
1579
1580 2008-06-28  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1581
1582         Reviewed by Sam.
1583
1584         When executing a native call, check for an exception before writing the
1585         return value.
1586
1587         * VM/Machine.cpp:
1588         (KJS::Machine::privateExecute):
1589
1590 2008-06-28  Mark Rowe  <mrowe@apple.com>
1591
1592         Build fix.  Flag headers as private or public as is appropriate.
1593         These settings were accidentally removed during some project file cleanup.
1594
1595         * JavaScriptCore.xcodeproj/project.pbxproj:
1596
1597 2008-06-28  Sam Weinig  <sam@webkit.org>
1598
1599         Rubber-stamped by Darin Adler.
1600
1601         Splits RegExpConstructor and RegExpPrototype out of RegExpObject.h/cpp
1602
1603         * DerivedSources.make:
1604         * GNUmakefile.am:
1605         * JavaScriptCore.pri:
1606         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1607         * JavaScriptCore.xcodeproj/project.pbxproj:
1608         * JavaScriptCoreSources.bkl:
1609         * VM/Machine.cpp:
1610         * kjs/AllInOneFile.cpp:
1611         * kjs/JSGlobalObject.cpp:
1612         * kjs/RegExpConstructor.cpp: Copied from kjs/RegExpObject.cpp.
1613         * kjs/RegExpConstructor.h: Copied from kjs/RegExpObject.h.
1614         * kjs/RegExpObject.cpp:
1615         * kjs/RegExpObject.h:
1616         * kjs/RegExpPrototype.cpp: Copied from kjs/RegExpObject.cpp.
1617         * kjs/RegExpPrototype.h: Copied from kjs/RegExpObject.h.
1618         * kjs/StringPrototype.cpp:
1619         * kjs/internal.cpp:
1620
1621 2008-06-28  Sam Weinig  <sam@webkit.org>
1622
1623         Fix non-AllInOne builds.
1624
1625         * kjs/StringConstructor.cpp:
1626
1627 2008-06-28  Sam Weinig  <sam@webkit.org>
1628
1629         Rubber-stamped by Darin Adler.
1630
1631         Rename string_object.h/cpp to StringObject.h/cpp and split out StringObjectThatMasqueradesAsUndefined,
1632         StringConstructor and StringPrototype.
1633
1634         * DerivedSources.make:
1635         * GNUmakefile.am:
1636         * JavaScriptCore.pri:
1637         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1638         * JavaScriptCore.xcodeproj/project.pbxproj:
1639         * JavaScriptCoreSources.bkl:
1640         * kjs/AllInOneFile.cpp:
1641         * kjs/JSGlobalObject.cpp:
1642         * kjs/StringConstructor.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
1643         * kjs/StringConstructor.h: Copied from JavaScriptCore/kjs/string_object.h.
1644         * kjs/StringObject.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
1645         * kjs/StringObject.h: Copied from JavaScriptCore/kjs/string_object.h.
1646         * kjs/StringObjectThatMasqueradesAsUndefined.h: Copied from JavaScriptCore/kjs/string_object.h.
1647         * kjs/StringPrototype.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
1648         * kjs/StringPrototype.h: Copied from JavaScriptCore/kjs/string_object.h.
1649         * kjs/internal.cpp:
1650         * kjs/string_object.cpp: Removed.
1651         * kjs/string_object.h: Removed.
1652
1653 2008-06-28  Jan Michael Alonzo  <jmalonzo@webkit.org>
1654
1655         Gtk build fix: JSVariableObject is now part of AllInOne
1656
1657         * GNUmakefile.am:
1658
1659 2008-06-28  Darin Adler  <darin@apple.com>
1660
1661         Reviewed by Oliver.
1662
1663         - https://bugs.webkit.org/show_bug.cgi?id=19801
1664           add a feature so we can tell what regular expressions are taking time
1665
1666         * pcre/pcre_compile.cpp:
1667         (jsRegExpCompile): Compile in the string if REGEXP_HISTOGRAM is on.
1668
1669         * pcre/pcre_exec.cpp:
1670         (jsRegExpExecute): Add hook to time execution.
1671         (Histogram::~Histogram): Print a sorted list of what took time.
1672         (Histogram::add): Accumulate records of what took time.
1673         (HistogramTimeLogger::~HistogramTimeLogger): Hook that calls
1674         Histogram::add at the right moment and creates the global histogram
1675         object.
1676
1677         * pcre/pcre_internal.h: Define REGEXP_HISTOGRAM.
1678
1679         * pcre/pcre_tables.cpp: Added missing include of "config.h". Not needed
1680         any more, but an omissions an earlier version of this patch detected.
1681         * pcre/pcre_ucp_searchfuncs.cpp: Ditto.
1682         * pcre/pcre_xclass.cpp: Ditto.
1683
1684 2008-06-28  Sam Weinig  <sam@webkit.org>
1685
1686         Try and fix the Windows build again.
1687
1688         * kjs/RegExpObject.cpp:
1689         * kjs/date_object.cpp:
1690         * kjs/error_object.cpp:
1691
1692 2008-06-28  Sam Weinig  <sam@webkit.org>
1693
1694         Rubber-stamped by Darin Adler.
1695
1696         Remove unused StringConstructorFunction class.
1697
1698         * kjs/string_object.h:
1699
1700 2008-06-28  Sam Weinig  <sam@webkit.org>
1701
1702         Fix windows build.
1703
1704         * kjs/ArrayPrototype.cpp:
1705         * kjs/BooleanPrototype.cpp:
1706         * kjs/BooleanPrototype.h:
1707         * kjs/FunctionPrototype.cpp:
1708         * kjs/JSImmediate.cpp:
1709         * kjs/JSObject.cpp:
1710         * kjs/MathObject.cpp:
1711         * kjs/NumberPrototype.cpp:
1712         * kjs/NumberPrototype.h:
1713         * kjs/ObjectConstructor.cpp:
1714         * kjs/RegExpObject.h:
1715         * kjs/error_object.h:
1716         * kjs/string_object.cpp:
1717
1718 2008-06-28  Sam Weinig  <sam@webkit.org>
1719
1720         Rubber-stamped by Oliver Hunt.
1721
1722         Splits FunctionConstructor out of FunctionPrototype.h/cpp
1723         Splits NumberConstructor and NumberPrototype out of NumberObject.h/cpp
1724         Rename object_object.h/cpp to ObjectPrototype.h/cpp and split out ObjectConstructor.
1725
1726         * API/JSCallbackConstructor.cpp:
1727         * API/JSClassRef.cpp:
1728         * API/JSObjectRef.cpp:
1729         * DerivedSources.make:
1730         * GNUmakefile.am:
1731         * JavaScriptCore.pri:
1732         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1733         * JavaScriptCore.xcodeproj/project.pbxproj:
1734         * JavaScriptCoreSources.bkl:
1735         * VM/Machine.cpp:
1736         * kjs/AllInOneFile.cpp:
1737         * kjs/ArrayConstructor.cpp:
1738         * kjs/ArrayConstructor.h:
1739         * kjs/FunctionConstructor.cpp: Copied from JavaScriptCore/kjs/FunctionPrototype.cpp.
1740         * kjs/FunctionConstructor.h: Copied from JavaScriptCore/kjs/FunctionPrototype.h.
1741         * kjs/FunctionPrototype.cpp:
1742         * kjs/FunctionPrototype.h:
1743         * kjs/JSFunction.cpp:
1744         * kjs/JSGlobalObject.cpp:
1745         * kjs/JSImmediate.cpp:
1746         * kjs/MathObject.h:
1747         * kjs/NumberConstructor.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
1748         * kjs/NumberConstructor.h: Copied from JavaScriptCore/kjs/NumberObject.h.
1749         * kjs/NumberObject.cpp:
1750         * kjs/NumberObject.h:
1751         * kjs/NumberPrototype.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
1752         * kjs/NumberPrototype.h: Copied from JavaScriptCore/kjs/NumberObject.h.
1753         * kjs/ObjectConstructor.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
1754         * kjs/ObjectConstructor.h: Copied from JavaScriptCore/kjs/object_object.h.
1755         * kjs/ObjectPrototype.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
1756         * kjs/ObjectPrototype.h: Copied from JavaScriptCore/kjs/object_object.h.
1757         * kjs/RegExpObject.h:
1758         * kjs/Shell.cpp:
1759         * kjs/error_object.h:
1760         * kjs/internal.cpp:
1761         * kjs/nodes.cpp:
1762         * kjs/object_object.cpp: Removed.
1763         * kjs/object_object.h: Removed.
1764         * kjs/string_object.h:
1765
1766 2008-06-28  Darin Adler  <darin@apple.com>
1767
1768         Reviewed by Oliver.
1769
1770         - fix https://bugs.webkit.org/show_bug.cgi?id=19796
1771           optimize expressions with ignored results (especially post-increment)
1772
1773         SunSpider says 0.9% faster.
1774
1775         * VM/CodeGenerator.h:
1776         (KJS::CodeGenerator::tempDestination): Create a new temporary for
1777         ignoredResult() too, just as we would for 0.
1778         (KJS::CodeGenerator::finalDestination): Use the temporary if the
1779         register passed in is ignoredResult() too, just as we would for 0.
1780         (KJS::CodeGenerator::destinationForAssignResult): Return 0 if the
1781         passed in register is ignoredResult(), just as we would for 0.
1782         (KJS::CodeGenerator::moveToDestinationIfNeeded): Return 0 if the
1783         register passed in is ignoredResult(). What matters is that we
1784         don't want to emit a move. The return value won't be looked at.
1785         (KJS::CodeGenerator::emitNode): Allow ignoredResult() and pass it
1786         through to the node's emitCode function.
1787
1788         * VM/RegisterID.h:
1789         (KJS::ignoredResult): Added. Special value to indicate the result of
1790         a node will be ignored and need not be put in any register.
1791
1792         * kjs/nodes.cpp:
1793         (KJS::NullNode::emitCode): Do nothing if dst == ignoredResult().
1794         (KJS::BooleanNode::emitCode): Ditto.
1795         (KJS::NumberNode::emitCode): Ditto.
1796         (KJS::StringNode::emitCode): Ditto.
1797         (KJS::RegExpNode::emitCode): Ditto.
1798         (KJS::ThisNode::emitCode): Ditto.
1799         (KJS::ResolveNode::emitCode): Do nothing if dst == ignoredResult() and
1800         the identifier resolves to a local variable.
1801         (KJS::ObjectLiteralNode::emitCode): Do nothing if dst == ignoredResult()
1802         and the object is empty.
1803         (KJS::PostIncResolveNode::emitCode): If dst == ignoredResult(), then do
1804         nothing for the local constant case, and do a pre-increment in all the
1805         other cases.
1806         (KJS::PostDecResolveNode::emitCode): Ditto.
1807         (KJS::PostIncBracketNode::emitCode): Ditto.
1808         (KJS::PostDecBracketNode::emitCode): Ditto.
1809         (KJS::PostIncDotNode::emitCode): Ditto.
1810         (KJS::PostDecDotNode::emitCode): Ditto.
1811         (KJS::DeleteValueNode::emitCode): Pass ignoredResult() when evaluating
1812         the expression.
1813         (KJS::VoidNode::emitCode): Ditto.
1814         (KJS::TypeOfResolveNode::emitCode): If dst == ignoredResult(), do nothing
1815         if the identifier resolves to a local variable, and don't bother generating
1816         a typeof opcode in the other case.
1817         (KJS::TypeOfValueNode::emitCode): Ditto.
1818         (KJS::PreIncResolveNode::emitCode): Do nothing if dst == ignoredResult() and
1819         the identifier resolves to a local constant.
1820         (KJS::PreDecResolveNode::emitCode): Ditto.
1821         (KJS::AssignResolveNode::emitCode): Turn ignoredResult() into 0 in a couple
1822         places, because we need to put the result into a register so we can assign
1823         it. At other sites this is taken care of by functions like finalDestination.
1824         (KJS::CommaNode::emitCode): Pass ignoredResult() when evaluating the first
1825         expression.
1826         (KJS::ForNode::emitCode): Pass ignoredResult() when evaluating the first and
1827         third expressions.
1828         (KJS::ForInNode::emitCode): Pass ignoredResult() when evaluating the first
1829         expression.
1830
1831 2008-06-28  Darin Adler  <darin@apple.com>
1832
1833         Reviewed by Oliver.
1834
1835         - https://bugs.webkit.org/show_bug.cgi?id=19787
1836           create most arrays from values in registers rather than with multiple put operations
1837
1838         SunSpider says 0.8% faster.
1839
1840         * VM/CodeBlock.cpp:
1841         (KJS::CodeBlock::dump): Added argv and argc parameters to new_array.
1842         * VM/Machine.cpp:
1843         (KJS::Machine::privateExecute): Ditto.
1844
1845         * VM/CodeGenerator.cpp:
1846         (KJS::CodeGenerator::emitNewArray): Added.
1847         * VM/CodeGenerator.h: Added ElementNode* argument to emitNewArray.
1848
1849         * kjs/nodes.cpp:
1850         (KJS::ArrayNode::emitCode): Pass the ElementNode to emitNewArray so it can be
1851         initialized with as many elements as possible. If the array doesn't have any
1852         holes in it, that's all that's needed. If there are holes, then emit some separate
1853         put operations for the other values in the array and for the length as needed.
1854
1855         * kjs/nodes.h: Added some accessors to ElementNode so the code generator can
1856         iterate through elements and generate code to evaluate them. Now ArrayNode does
1857         not need to be a friend. Also took out some unused PlacementNewAdoptType
1858         constructors.
1859
1860 2008-06-28  Darin Adler  <darin@apple.com>
1861
1862         Reviewed by Oliver.
1863
1864         * kjs/nodes.h: Remove obsolete PlacementNewAdopt constructors.
1865         We no longer mutate the AST in place.
1866
1867 2008-06-28  Jan Michael Alonzo  <jmalonzo@webkit.org>
1868
1869         Reviewed by Oliver Hunt.
1870
1871         Build fix
1872
1873         * VM/Machine.cpp: include stdio.h for printf
1874
1875 2008-06-27  Sam Weinig  <sam@webkit.org>
1876
1877         Reviewed by Oliver Hunt.
1878
1879         Fix platforms that don't use AllInOne.cpp
1880
1881         * kjs/BooleanConstructor.h:
1882         * kjs/BooleanPrototype.h:
1883         * kjs/FunctionPrototype.cpp:
1884
1885 2008-06-27  Sam Weinig  <sam@webkit.org>
1886
1887         Rubber-stamped by Oliver Hunt.
1888
1889         Splits ArrayConstructor out of ArrayPrototype.h/cpp
1890         Splits BooleanConstructor and BooleanPrototype out of BooleanObject.h/cpp
1891
1892         * GNUmakefile.am:
1893         * JavaScriptCore.pri:
1894         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1895         * JavaScriptCore.xcodeproj/project.pbxproj:
1896         * JavaScriptCoreSources.bkl:
1897         * VM/Machine.cpp:
1898         * kjs/AllInOneFile.cpp:
1899         * kjs/ArrayConstructor.cpp: Copied from kjs/ArrayPrototype.cpp.
1900         * kjs/ArrayConstructor.h: Copied from kjs/ArrayPrototype.h.
1901         * kjs/ArrayPrototype.cpp:
1902         * kjs/ArrayPrototype.h:
1903         * kjs/BooleanConstructor.cpp: Copied from kjs/BooleanObject.cpp.
1904         * kjs/BooleanConstructor.h: Copied from kjs/BooleanObject.h.
1905         * kjs/BooleanObject.cpp:
1906         * kjs/BooleanObject.h:
1907         * kjs/BooleanPrototype.cpp: Copied from kjs/BooleanObject.cpp.
1908         * kjs/BooleanPrototype.h: Copied from kjs/BooleanObject.h.
1909         * kjs/CommonIdentifiers.h:
1910         * kjs/FunctionPrototype.cpp:
1911         * kjs/JSArray.cpp:
1912         * kjs/JSGlobalObject.cpp:
1913         * kjs/JSImmediate.cpp:
1914         * kjs/Shell.cpp:
1915         * kjs/internal.cpp:
1916         * kjs/nodes.cpp:
1917         * kjs/string_object.cpp:
1918
1919 2008-06-27  Oliver Hunt  <oliver@apple.com>
1920
1921         Reviewed by Sam.
1922
1923         Bug 18626: SQUIRRELFISH: support the "slow script" dialog <https://bugs.webkit.org/show_bug.cgi?id=18626>
1924         <rdar://problem/5973931> Slow script dialog needs to be reimplemented for squirrelfish
1925
1926         Adds support for the slow script dialog in squirrelfish.  This requires the addition
1927         of three new op codes, op_loop, op_loop_if_true, and op_loop_if_less which have the
1928         same behaviour as their simple jump equivalents but have an additional time out check.
1929
1930         Additional assertions were added to other jump instructions to prevent accidentally
1931         creating loops with jump types that do not support time out checks.
1932
1933         Sunspider does not report a regression, however this appears very sensitive to code
1934         layout and hardware, so i would expect up to a 1% regression on other systems.
1935
1936         Part of this required moving the old timeout logic from JSGlobalObject and into Machine
1937         which is the cause of a number of the larger diff blocks.
1938
1939         * JavaScriptCore.exp:
1940         * VM/CodeBlock.cpp:
1941         (KJS::CodeBlock::dump):
1942         * VM/CodeGenerator.cpp:
1943         (KJS::CodeGenerator::emitJumpIfTrue):
1944         (KJS::CodeGenerator::emitJumpScopes):
1945         * VM/ExceptionHelpers.cpp:
1946         (KJS::InterruptedExecutionError::isWatchdogException):
1947         (KJS::createInterruptedExecutionException):
1948         * VM/ExceptionHelpers.h:
1949         * VM/LabelID.h:
1950         * VM/Machine.cpp:
1951         (KJS::Machine::Machine):
1952         (KJS::Machine::throwException):
1953         (KJS::Machine::resetTimeoutCheck):
1954         (KJS::getCurrentTime):
1955         (KJS::Machine::checkTimeout):
1956         (KJS::Machine::privateExecute):
1957         * VM/Machine.h:
1958         (KJS::Machine::setTimeoutTime):
1959         (KJS::Machine::startTimeoutCheck):
1960         (KJS::Machine::stopTimeoutCheck):
1961         (KJS::Machine::initTimeout):
1962         * VM/Opcode.cpp:
1963         (KJS::):
1964         * VM/Opcode.h:
1965         * kjs/JSGlobalObject.cpp:
1966         (KJS::JSGlobalObject::init):
1967         (KJS::JSGlobalObject::setTimeoutTime):
1968         (KJS::JSGlobalObject::startTimeoutCheck):
1969         * kjs/JSGlobalObject.h:
1970         * kjs/JSObject.h:
1971         * kjs/interpreter.cpp:
1972         (KJS::Interpreter::evaluate):
1973
1974 2008-06-27  Jan Michael Alonzo  <jmalonzo@webkit.org>
1975
1976         Gtk and Qt build fix: Remove RegisterFileStack from the build
1977         scripts.
1978
1979         * GNUmakefile.am:
1980         * JavaScriptCore.pri:
1981
1982 2008-06-27  Adele Peterson  <adele@apple.com>
1983
1984         Reviewed by Geoff.
1985
1986         Build fixes. 
1987
1988         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1989         * VM/RegisterFile.h:
1990         (KJS::RegisterFile::RegisterFile):
1991         * kjs/JSGlobalObject.cpp:
1992         * kjs/collector.cpp:
1993
1994 2008-06-27  Geoffrey Garen  <ggaren@apple.com>
1995
1996         Reviewed by Oliver Hunt.
1997         
1998         One RegisterFile to rule them all!
1999         
2000         SunSpider reports a 0.2% speedup.
2001
2002         This patch removes the RegisterFileStack abstraction and replaces it with
2003         a single register file that
2004         
2005         (a) allocates a fixed storage area, including a fixed area for global
2006         vars, so that no operation may cause the register file to reallocate
2007         
2008         and
2009
2010         (b) swaps between global storage areas when executing code in different 
2011         global objects.
2012         
2013         This patch also changes the layout of the register file so that all call
2014         frames, including call frames for global code, get a header. This is
2015         required to support re-entrant global code. It also just makes things simpler.
2016         
2017         * VM/CodeGenerator.cpp:
2018         (KJS::CodeGenerator::addGlobalVar): New function. Differs from addVar in
2019         that
2020         
2021         (a) global vars don't contribute to a CodeBlock's numLocals count, since
2022         global storage is fixed and allocated at startup
2023         
2024         and
2025         
2026         (b) references to global vars get shifted to elide intermediate stack
2027         between "r" and the global storage area.
2028         
2029         * VM/Machine.cpp:
2030         (KJS::Machine::dumpRegisters): Updated this function to match the new
2031         register file layout, and added the ability to dump exact identifiers
2032         for the different parts of a call frame.
2033         
2034         (KJS::Machine::unwindCallFrame): Updated this function to match the new
2035         register file layout.
2036          
2037         (KJS::Machine::execute): Updated this function to initialize a call frame
2038         header for global code, and to swap global storage areas when switching
2039         to execution in a new global object.
2040         
2041         (KJS::Machine::privateExecute): Got rid of "safeForReentry" and re-reading
2042         of registerBase because the register file is always safe for reentry now,
2043         and registerBase never changes.
2044         
2045         * VM/Machine.h: Moved the call frame header enum from Machine to RegisterFile,
2046         to resolve a header dependency problem (a good sign that the enum belonged
2047         in RegisterFile all along!)
2048
2049         * VM/RegisterFile.cpp:
2050         * VM/RegisterFile.h: Changed RegisterFile to mmap a fixed size register
2051         area. This allows us to avoid re-allocting the register file later on.
2052         Instead, we rely on the OS to allocate physical pages to the register
2053         file as necessary.
2054
2055         * VM/RegisterFileStack.cpp: Removed. Tada!
2056         * VM/RegisterFileStack.h: Removed. Tada!
2057
2058         * kjs/DebuggerCallFrame.cpp: Updated this class to match the new
2059         register file layout, greatly simplifying it in the process.
2060
2061         * kjs/JSActivation.h:
2062         * kjs/JSActivation.cpp: Moved some of this logic up to JSVariableObject,
2063         since the global object now needs to be able to tear off its registers
2064         just like the activation object.
2065
2066         * kjs/JSFunction.cpp: No need to fiddle with the register file anymore.
2067
2068         * kjs/JSGlobalObject.h:
2069         * kjs/JSGlobalObject.cpp: Updated JSGlobalObject to support moving its
2070         global storage area into and out of the register file.
2071
2072         * kjs/PropertySlot.cpp: No need to fiddle with the register file anymore.
2073
2074         * kjs/collector.cpp: Renamed markStackObjectConservatively to
2075         markConservatively, since we don't just mark stack objects this way.
2076         
2077         Also, added code to mark the machine's register file.
2078
2079         * kjs/config.h: Moved some platforms #defines from here...
2080         * wtf/Platform.h: ...to here, to support mmap/VirtualAlloc detection
2081         in RegisterFile.h.
2082
2083 2008-06-26  Mark Rowe  <mrowe@apple.com>
2084
2085         Speculative fix for the Windows build.
2086
2087         * kjs/JSImmediate.cpp:
2088
2089 2008-06-26  Mark Rowe  <mrowe@apple.com>
2090
2091         Reviewed by Darin Adler and Geoff Garen.
2092
2093         Fix the malloc zone introspection functions so that malloc_zone_statistics does not give
2094         bogus output in an application that uses JavaScriptCore.
2095
2096         * kjs/CollectorHeapIntrospector.cpp:
2097         (KJS::CollectorHeapIntrospector::statistics): Return statistics about memory allocated by the collector.
2098         * kjs/CollectorHeapIntrospector.h:
2099         * wtf/FastMalloc.cpp: Zero out the statistics.  FastMalloc doesn't track this information at present.
2100         Returning zero for all values is preferable to returning bogus data.
2101
2102 2008-06-26  Darin Adler  <darin@apple.com>
2103
2104         Reviewed by Geoff.
2105
2106         - https://bugs.webkit.org/show_bug.cgi?id=19721
2107           speed up JavaScriptCore by not wrapping strings in objects just
2108           to call functions on them
2109
2110         - optimize UString append and the replace function a bit
2111
2112         SunSpider says 1.8% faster.
2113
2114         * JavaScriptCore.exp: Updated.
2115
2116         * VM/JSPropertyNameIterator.cpp: Added include of JSString.h, now needed
2117         because jsString returns a JSString*.
2118
2119         * VM/Machine.cpp:
2120         (KJS::Machine::privateExecute): Removed the toObject call from native
2121         function calls. Also removed code to put the this value into a register.
2122
2123         * kjs/BooleanObject.cpp:
2124         (KJS::booleanProtoFuncToString): Rewrite to handle false and true
2125         separately.
2126
2127         * kjs/FunctionPrototype.cpp:
2128         (KJS::constructFunction): Use single-character append rather than building
2129         a string for each character.
2130         * kjs/JSFunction.cpp:
2131         (KJS::globalFuncUnescape): Ditto.
2132
2133         * kjs/JSImmediate.cpp:
2134         (KJS::JSImmediate::prototype): Added. Gets the appropriate prototype for
2135         use with an immediate value. To be used instead of toObject when doing a
2136         get on an immediate value.
2137         * kjs/JSImmediate.h: Added prototype.
2138
2139         * kjs/JSObject.cpp:
2140         (KJS::JSObject::toString): Tweaked formatting.
2141
2142         * kjs/JSObject.h:
2143         (KJS::JSValue::get): Use prototype instead of toObject to avoid creating
2144         an object wrapper just to search for properties. This also saves an
2145         unnecessary hash table lookup since the object wrappers themselves don't
2146         have any properties.
2147
2148         * kjs/JSString.h: Added toThisString and toThisJSString.
2149
2150         * kjs/JSValue.cpp:
2151         (KJS::JSCell::toThisString): Added.
2152         (KJS::JSCell::toThisJSString): Added.
2153         (KJS::JSCell::getJSNumber): Added.
2154         (KJS::jsString): Changed return type to JSString*.
2155         (KJS::jsOwnedString): Ditto.
2156
2157         * kjs/JSValue.h:
2158         (KJS::JSValue::toThisString): Added.
2159         (KJS::JSValue::toThisJSString): Added.
2160         (KJS::JSValue::getJSNumber): Added.
2161
2162         * kjs/NumberObject.cpp:
2163         (KJS::NumberObject::getJSNumber): Added.
2164         (KJS::integer_part_noexp): Append C string directly rather than first
2165         turning it into a UString.
2166         (KJS::numberProtoFuncToString): Use getJSNumber to check if the value
2167         is a number rather than isObject(&NumberObject::info). This works for
2168         immediate numbers, number cells, and NumberObject instances.
2169         (KJS::numberProtoFuncToLocaleString): Ditto.
2170         (KJS::numberProtoFuncValueOf): Ditto.
2171         (KJS::numberProtoFuncToFixed): Ditto.
2172         (KJS::numberProtoFuncToExponential): Ditto.
2173         (KJS::numberProtoFuncToPrecision): Ditto.
2174         * kjs/NumberObject.h: Added getJSNumber.
2175
2176         * kjs/PropertySlot.cpp: Tweaked comment.
2177
2178         * kjs/internal.cpp:
2179         (KJS::JSString::toThisString): Added.
2180         (KJS::JSString::toThisJSString): Added.
2181         (KJS::JSString::getOwnPropertySlot): Changed code that searches the
2182         prototype chain to start with the string prototype and not create a
2183         string object.
2184         (KJS::JSNumberCell::toThisString): Added.
2185         (KJS::JSNumberCell::getJSNumber): Added.
2186
2187         * kjs/lookup.cpp:
2188         (KJS::staticFunctionGetter): Moved here, because there's no point in
2189         having a function that's only used for a function pointer be inline.
2190         (KJS::setUpStaticFunctionSlot): New function for getStaticFunctionSlot.
2191
2192         * kjs/lookup.h:
2193         (KJS::staticValueGetter): Don't mark this inline. It doesn't make sense
2194         to have a function that's only used for a function pointer be inline.
2195         (KJS::getStaticFunctionSlot): Changed to get properties from the parent
2196         first before doing any handling of functions. This is the fastest way
2197         to return the function once the initial setup is done.
2198
2199         * kjs/string_object.cpp:
2200         (KJS::StringObject::getPropertyNames): Call value() instead of getString(),
2201         avoiding an unnecessary virtual function call (the call to the type()
2202         function in the implementation of the isString() function).
2203         (KJS::StringObject::toString): Added.
2204         (KJS::StringObject::toThisString): Added.
2205         (KJS::StringObject::toThisJSString): Added.
2206         (KJS::substituteBackreferences): Rewrote to use a appending algorithm
2207         instead of a the old one that tried to replace in place.
2208         (KJS::stringProtoFuncReplace): Merged this function and the replace function.
2209         Replaced the hand-rolled dynamic arrays for source ranges and replacements
2210         with Vector.
2211         (KJS::stringProtoFuncToString): Handle JSString as well as StringObject.
2212         Removed the separate valueOf implementation, since it can just share this.
2213         (KJS::stringProtoFuncCharAt): Use toThisString, which handles JSString as
2214         well as StringObject, and is slightly more efficient than the old code too.
2215         (KJS::stringProtoFuncCharCodeAt): Ditto.
2216         (KJS::stringProtoFuncConcat): Ditto.
2217         (KJS::stringProtoFuncIndexOf): Ditto.
2218         (KJS::stringProtoFuncLastIndexOf): Ditto.
2219         (KJS::stringProtoFuncMatch): Ditto.
2220         (KJS::stringProtoFuncSearch): Ditto.
2221         (KJS::stringProtoFuncSlice): Ditto.
2222         (KJS::stringProtoFuncSplit): Ditto.
2223         (KJS::stringProtoFuncSubstr): Ditto.
2224         (KJS::stringProtoFuncSubstring): Ditto.
2225         (KJS::stringProtoFuncToLowerCase): Use toThisJSString.
2226         (KJS::stringProtoFuncToUpperCase): Ditto.
2227         (KJS::stringProtoFuncToLocaleLowerCase): Ditto.
2228         (KJS::stringProtoFuncToLocaleUpperCase): Ditto.
2229         (KJS::stringProtoFuncLocaleCompare): Ditto.
2230         (KJS::stringProtoFuncBig): Use toThisString.
2231         (KJS::stringProtoFuncSmall): Ditto.
2232         (KJS::stringProtoFuncBlink): Ditto.
2233         (KJS::stringProtoFuncBold): Ditto.
2234         (KJS::stringProtoFuncFixed): Ditto.
2235         (KJS::stringProtoFuncItalics): Ditto.
2236         (KJS::stringProtoFuncStrike): Ditto.
2237         (KJS::stringProtoFuncSub): Ditto.
2238         (KJS::stringProtoFuncSup): Ditto.
2239         (KJS::stringProtoFuncFontcolor): Ditto.
2240         (KJS::stringProtoFuncFontsize): Ditto.
2241         (KJS::stringProtoFuncAnchor): Ditto.
2242         (KJS::stringProtoFuncLink): Ditto.
2243
2244         * kjs/string_object.h: Added toString, toThisString, and toThisJSString.
2245
2246         * kjs/ustring.cpp:
2247         (KJS::UString::append): Added a version that takes a character pointer and
2248         size, so we don't have to create a UString just to append to another UString.
2249         * kjs/ustring.h:
2250
2251 2008-06-26  Alexey Proskuryakov  <ap@webkit.org>
2252
2253         Reviewed by Maciej.
2254
2255         Make JSGlobalData per-thread.
2256
2257         No change on SunSpider total.
2258
2259         * wtf/ThreadSpecific.h: Re-enabled the actual implementation.
2260
2261         * kjs/JSGlobalObject.cpp:
2262         (KJS::JSGlobalObject::~JSGlobalObject): Re-added a JSLock-related assertion. We'll probably
2263         want to preserve these somehow to keep legacy behavior in working condition.
2264         (KJS::JSGlobalObject::init): Initialize globalData pointer earlier, so that it is ready
2265         when updating JSGlobalObject linked list.
2266
2267         * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::head): Changed head() to be non-static, and
2268         to use JSGlobalData associated with the current object.
2269
2270         * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Removed a no longer needed
2271         Heap::registerAsMainThread() call.
2272
2273         * kjs/JSGlobalData.h: Removed a lying lie comment - parserObjectExtraRefCounts is not
2274         transient, and while newParserObjects may conceptually be such, there is still some node
2275         manipulation going on outside Parser::parse which touches it.
2276
2277         * kjs/JSGlobalData.cpp:
2278         (KJS::JSGlobalData::~JSGlobalData): Delete recently added members.
2279         (KJS::JSGlobalData::sharedInstance): Actually use a separate instance.
2280
2281         * kjs/collector.cpp:
2282         (KJS::Heap::Heap):
2283         (KJS::Heap::~Heap): Added a destructor, which unconditionally deletes everything.
2284         (KJS::Heap::sweep): Removed code related to "collect on main thread only" logic.
2285         (KJS::Heap::collect): Ditto.
2286         (KJS::Heap::globalObjectCount): Explicitly use per-thread instance of JSGlobalObject linked
2287         list now that JSGlobalObject::head() is not static. Curently, WebCoreStatistics methods only
2288         work with the main thread currently anyway.
2289         (KJS::Heap::protectedGlobalObjectCount): Ditto.
2290
2291         * kjs/collector.h: Removed code related to "collect on main thread only" logic.
2292
2293         * JavaScriptCore.exp: Removed Heap::collectOnMainThreadOnly.
2294
2295 2008-06-26  Alexey Proskuryakov  <ap@webkit.org>
2296
2297         Reviewed by Darin.
2298
2299         https://bugs.webkit.org/show_bug.cgi?id=19767
2300         REGRESSION: Crash in sort() when visiting http://www.onnyturf.com/subway/
2301
2302         * kjs/JSArray.cpp: (KJS::AVLTreeAbstractorForArrayCompare::set_balance_factor):
2303         Made changing balance factor from -1 to +1 work correctly.
2304
2305         * wtf/AVLTree.h: (KJS::AVLTreeDefaultBSet::operator[]): Added an assertion that catches
2306         this slightly earlier.
2307
2308 2008-06-25  Timothy Hatcher  <timothy@apple.com>
2309
2310         Fixes an ASSERT in the profiler when starting multiple profiles
2311         with the same name inside the same function/program.
2312
2313         Reviewed by Kevin McCullough.
2314
2315         * profiler/Profile.cpp:
2316         (KJS::Profile::Profile): Initialize m_stoppedCallDepth to zero.
2317         (KJS::Profile::stopProfiling): Set the current node to the parent,
2318         because we are in a call that will not get a didExecute call.
2319         (KJS::Profile::removeProfile): Increment m_stoppedCallDepth to
2320         account for didExecute not being called for profile.
2321         (KJS::Profile::willExecute): Increment m_stoppedCallDepth if stopped.
2322         (KJS::Profile::didExecute): Decrement m_stoppedCallDepth if stopped and
2323         greater than zero, and return early.
2324         * profiler/Profile.h: Added stoppedProfiling().
2325         * profiler/Profiler.cpp:
2326         (KJS::Profiler::findProfile): Removed.
2327         (KJS::Profiler::startProfiling): Don't return early for stopped profiles.
2328         (KJS::Profiler::stopProfiling): Skipp stopped profiles.
2329         (KJS::Profiler::didFinishAllExecution): Code clean-up.
2330         * profiler/Profiler.h: Removed findProfile.
2331
2332 2008-06-25  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2333
2334         Reviewed by Alexey Proskuryakov.
2335
2336         Attempt to fix Windows debug build. The compiler gives a warning when
2337         Structured Exception Handling and destructors are used in the same
2338         function. Using manual locking and unlocking instead of constructors
2339         and destructors should fix the warning.
2340
2341         * kjs/Shell.cpp:
2342         (main):
2343
2344 2008-06-25  Alexey Proskuryakov  <ap@webkit.org>
2345
2346         Forgot to address a review comment about better names for tracked objects, doing it now.
2347
2348         * kjs/JSGlobalData.cpp:
2349         (KJS::JSGlobalData::JSGlobalData):
2350         * kjs/JSGlobalData.h:
2351         * kjs/nodes.cpp:
2352         (KJS::ParserRefCounted::ParserRefCounted):
2353         (KJS::ParserRefCounted::ref):
2354         (KJS::ParserRefCounted::deref):
2355         (KJS::ParserRefCounted::hasOneRef):
2356         (KJS::ParserRefCounted::deleteNewObjects):
2357
2358 2008-06-25  Alexey Proskuryakov  <ap@webkit.org>
2359
2360         Reviewed by Geoff.
2361
2362         Remove more threadInstance() calls.
2363
2364         * kjs/JSFunction.cpp:
2365         (KJS::JSFunction::getParameterName):
2366         (KJS::IndexToNameMap::unMap):
2367         (KJS::Arguments::deleteProperty):
2368         * kjs/JSFunction.h:
2369         Access nullIdentifier without going to thread specific storage.
2370
2371         * JavaScriptCore.exp:
2372         * kjs/JSGlobalData.cpp:
2373         (KJS::JSGlobalData::JSGlobalData):
2374         * kjs/JSGlobalData.h:
2375         * kjs/Parser.cpp:
2376         (KJS::Parser::parse):
2377         * kjs/Parser.h:
2378         (KJS::ParserRefCountedData::ParserRefCountedData):
2379         (KJS::Parser::parse):
2380         * kjs/grammar.y:
2381         * kjs/nodes.cpp:
2382         (KJS::ParserRefCounted::ParserRefCounted):
2383         (KJS::ParserRefCounted::ref):
2384         (KJS::ParserRefCounted::deref):
2385         (KJS::ParserRefCounted::hasOneRef):
2386         (KJS::ParserRefCounted::deleteNewObjects):
2387         (KJS::Node::Node):
2388         (KJS::StatementNode::StatementNode):
2389         (KJS::BreakpointCheckStatement::BreakpointCheckStatement):
2390         (KJS::ConstDeclNode::ConstDeclNode):
2391         (KJS::BlockNode::BlockNode):
2392         (KJS::ForInNode::ForInNode):
2393         (KJS::ScopeNode::ScopeNode):
2394         (KJS::ProgramNode::ProgramNode):
2395         (KJS::ProgramNode::create):
2396         (KJS::EvalNode::EvalNode):
2397         (KJS::EvalNode::create):
2398         (KJS::FunctionBodyNode::FunctionBodyNode):
2399         (KJS::FunctionBodyNode::create):
2400         * kjs/nodes.h:
2401         (KJS::ExpressionNode::):
2402         (KJS::NullNode::):
2403         (KJS::BooleanNode::):
2404         (KJS::NumberNode::):
2405         (KJS::ImmediateNumberNode::):
2406         (KJS::StringNode::):
2407         (KJS::RegExpNode::):
2408         (KJS::ThisNode::):
2409         (KJS::ResolveNode::):
2410         (KJS::ElementNode::):
2411         (KJS::ArrayNode::):
2412         (KJS::PropertyNode::):
2413         (KJS::PropertyListNode::):
2414         (KJS::ObjectLiteralNode::):
2415         (KJS::BracketAccessorNode::):
2416         (KJS::DotAccessorNode::):
2417         (KJS::ArgumentListNode::):
2418         (KJS::ArgumentsNode::):
2419         (KJS::NewExprNode::):
2420         (KJS::EvalFunctionCallNode::):
2421         (KJS::FunctionCallValueNode::):
2422         (KJS::FunctionCallResolveNode::):
2423         (KJS::FunctionCallBracketNode::):
2424         (KJS::FunctionCallDotNode::):
2425         (KJS::PrePostResolveNode::):
2426         (KJS::PostIncResolveNode::):
2427         (KJS::PostDecResolveNode::):
2428         (KJS::PostfixBracketNode::):
2429         (KJS::PostIncBracketNode::):
2430         (KJS::PostDecBracketNode::):
2431         (KJS::PostfixDotNode::):
2432         (KJS::PostIncDotNode::):
2433         (KJS::PostDecDotNode::):
2434         (KJS::PostfixErrorNode::):
2435         (KJS::DeleteResolveNode::):
2436         (KJS::DeleteBracketNode::):
2437         (KJS::DeleteDotNode::):
2438         (KJS::DeleteValueNode::):
2439         (KJS::VoidNode::):
2440         (KJS::TypeOfResolveNode::):
2441         (KJS::TypeOfValueNode::):
2442         (KJS::PreIncResolveNode::):
2443         (KJS::PreDecResolveNode::):
2444         (KJS::PrefixBracketNode::):
2445         (KJS::PreIncBracketNode::):
2446         (KJS::PreDecBracketNode::):
2447         (KJS::PrefixDotNode::):
2448         (KJS::PreIncDotNode::):
2449         (KJS::PreDecDotNode::):
2450         (KJS::PrefixErrorNode::):
2451         (KJS::UnaryOpNode::UnaryOpNode):
2452         (KJS::UnaryPlusNode::):
2453         (KJS::NegateNode::):
2454         (KJS::BitwiseNotNode::):
2455         (KJS::LogicalNotNode::):
2456         (KJS::BinaryOpNode::BinaryOpNode):
2457         (KJS::ReverseBinaryOpNode::ReverseBinaryOpNode):
2458         (KJS::MultNode::):
2459         (KJS::DivNode::):
2460         (KJS::ModNode::):
2461         (KJS::AddNode::):
2462         (KJS::SubNode::):
2463         (KJS::LeftShiftNode::):
2464         (KJS::RightShiftNode::):
2465         (KJS::UnsignedRightShiftNode::):
2466         (KJS::LessNode::):
2467         (KJS::GreaterNode::):
2468         (KJS::LessEqNode::):
2469         (KJS::GreaterEqNode::):
2470         (KJS::InstanceOfNode::):
2471         (KJS::InNode::):
2472         (KJS::EqualNode::):
2473         (KJS::NotEqualNode::):
2474         (KJS::StrictEqualNode::):
2475         (KJS::NotStrictEqualNode::):
2476         (KJS::BitAndNode::):
2477         (KJS::BitOrNode::):
2478         (KJS::BitXOrNode::):
2479         (KJS::LogicalAndNode::):
2480         (KJS::LogicalOrNode::):
2481         (KJS::ConditionalNode::):
2482         (KJS::ReadModifyResolveNode::):
2483         (KJS::AssignResolveNode::):
2484         (KJS::ReadModifyBracketNode::):
2485         (KJS::AssignBracketNode::):
2486         (KJS::AssignDotNode::):
2487         (KJS::ReadModifyDotNode::):
2488         (KJS::AssignErrorNode::):
2489         (KJS::CommaNode::):
2490         (KJS::VarDeclCommaNode::):
2491         (KJS::ConstStatementNode::):
2492         (KJS::SourceElements::SourceElements):
2493         (KJS::EmptyStatementNode::):
2494         (KJS::DebuggerStatementNode::):
2495         (KJS::ExprStatementNode::):
2496         (KJS::VarStatementNode::):
2497         (KJS::IfNode::):
2498         (KJS::IfElseNode::):
2499         (KJS::DoWhileNode::):
2500         (KJS::WhileNode::):
2501         (KJS::ForNode::):
2502         (KJS::ContinueNode::):
2503         (KJS::BreakNode::):
2504         (KJS::ReturnNode::):
2505         (KJS::WithNode::):
2506         (KJS::LabelNode::):
2507         (KJS::ThrowNode::):
2508         (KJS::TryNode::):
2509         (KJS::ParameterNode::):
2510         (KJS::FuncExprNode::):
2511         (KJS::FuncDeclNode::):
2512         (KJS::CaseClauseNode::):
2513         (KJS::ClauseListNode::):
2514         (KJS::CaseBlockNode::):
2515         (KJS::SwitchNode::):
2516         Changed ParserRefCounted to hold a JSGlobalData pointer, and used it to replace
2517         threadInstance calls.
2518
2519 2008-06-24  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2520
2521         Reviewed by Alexey Proskuryakov.
2522
2523         Make the JavaScript shell collect the heap from main() instead of
2524         jscmain() to suppress leak messages in debug builds.
2525
2526         * kjs/Shell.cpp:
2527         (main):
2528         (jscmain):
2529
2530 2008-06-24  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2531
2532         Reviewed by Maciej.
2533
2534         Make the conversion of the pair (less, jtrue) to jless use register
2535         reference counting information for safety instead of requiring callers
2536         to decide whether it is safe.
2537
2538         No changes on SunSpider codegen.
2539
2540         * VM/CodeGenerator.cpp:
2541         (KJS::CodeGenerator::emitJumpIfTrue):
2542         * VM/CodeGenerator.h:
2543         * kjs/nodes.cpp:
2544         (KJS::DoWhileNode::emitCode):
2545         (KJS::WhileNode::emitCode):
2546         (KJS::ForNode::emitCode):
2547         (KJS::CaseBlockNode::emitCodeForBlock):
2548
2549 2008-06-24  Kevin McCullough  <kmccullough@apple.com>
2550
2551         Reviewed by Tim.
2552
2553         <rdar://problem/6031594> JSProfiler: Profiler goes into an infinite
2554         loop sometimes.
2555         <rdar://problem/6031603> JSProfiler: Profiler asserts in debug and
2556         give the wrong times in release
2557
2558         Fixed two issues found by Tim in the same test.
2559
2560         * profiler/Profile.cpp:
2561         (KJS::Profile::removeProfileStart): No longer take profile's time from
2562         all ancestors, but instead attribute it to its parent.  Also add an
2563         Assert to ensure we only delete the child we mean to.
2564         (KJS::Profile::removeProfileEnd): Ditto for profileEnd.
2565         (KJS::Profile::didExecute): Cleaned up the execution order and correctly
2566         attribute all of the parent's time to the new node.
2567         * profiler/ProfileNode.cpp: If this node does not have a startTime it
2568         should not get a giant total time, but instead be 0.
2569         (KJS::ProfileNode::endAndRecordCall):
2570         * profiler/ProfileNode.h:
2571         (KJS::ProfileNode::removeChild): Should reset the sibling pointers since
2572         one of them has been removed.
2573
2574 2008-06-24  Darin Adler  <darin@apple.com>
2575
2576         Reviewed by Cameron.
2577
2578         - fix https://bugs.webkit.org/show_bug.cgi?id=19739
2579           REGRESSION: fast/js/property-getters-and-setters.html fails
2580
2581         * kjs/JSObject.cpp:
2582         (KJS::JSObject::put): Remove an untested optimization I checked in by accident.
2583         The two loops up the prototype chain both need to start from this; instead the
2584         second loop was starting where the first loop left off.
2585
2586 2008-06-24  Steve Falkenburg  <sfalken@apple.com>
2587
2588         Build fix.
2589
2590         * kjs/nodes.cpp:
2591
2592 2008-06-24  Joerg Bornemann  <joerg.bornemann@trolltech.com>
2593
2594         Reviewed by Simon.
2595
2596         For the Qt build on Windows don't depend on the presence of GNU CPP
2597         but use MSVC's preprocessor instead.
2598         dftables accepts a --preprocessor option which is set in pcre.pri for MSVC platforms.
2599
2600         * pcre/dftables: Added support for specifying the preprocessor command
2601         to use via --preprocessor, similar to
2602         WebCore/bindings/scripts/generate-bindings.pl.
2603         * pcre/pcre.pri: Pass --preprocessor='cl /e' to dftables, or more
2604         generally speaking QMAKE_CC /E for the win32-msvc buildspecs.
2605
2606 2008-06-24  Simon Hausmann  <hausmann@webkit.org>
2607
2608         Fix the Qt build, added missing include.
2609
2610         * kjs/PropertySlot.cpp:
2611
2612 2008-06-24  Alexey Proskuryakov  <ap@webkit.org>
2613
2614         Reviewed by Cameron Zwarich.
2615
2616         Make ParserRefCountedCounter actually perform a leak check.
2617
2618         * kjs/nodes.cpp:
2619         (KJS::ParserRefCountedCounter::~ParserRefCountedCounter): Check for leaks in destructor,
2620         not in constructor.
2621         (KJS::ParserRefCountedCounter::increment):
2622         (KJS::ParserRefCountedCounter::decrement):
2623         (KJS::ParserRefCounted::ParserRefCounted):
2624         (KJS::ParserRefCounted::~ParserRefCounted):
2625         While at it, also made counting thread-safe.
2626
2627 2008-06-24  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2628
2629         Reviewed by Oliver.
2630
2631         Bug 19730: REGRESSION (r34497): Text in alerts in "Leisure suit Larry" is not wrapped
2632         <https://bugs.webkit.org/show_bug.cgi?id=19730>
2633
2634         Do not convert the pair (less, jtrue) to jless when jtrue is a jump
2635         target. An example of this is when the condition of a while loop is a
2636         LogicalOrNode.
2637
2638         * VM/CodeGenerator.cpp:
2639         (KJS::CodeGenerator::emitLabel):
2640
2641 2008-06-20  Ariya Hidayat  <ariya.hidayat@trolltech.com>
2642
2643         Reviewed by Adam Roben.
2644
2645         Fix compile with MinGW.
2646
2647         * kjs/Shell.cpp:
2648         * wtf/Threading.h:
2649         (WTF::atomicIncrement):
2650         (WTF::atomicDecrement):
2651
2652 2008-06-23  Mark Rowe  <mrowe@apple.com>
2653
2654         Reviewed by Oliver Hunt.
2655
2656         Prepration for returning memory to the OS on Windows.  Track whether a portion of a span of memory was returned to the OS.
2657         If it was, ask that it be recommitted before returning it to the application as an allocated region.
2658
2659         * wtf/FastMalloc.cpp:
2660         (WTF::TCMalloc_PageHeap::New):  If the span was decommitted, ask that it be recommitted before returning it.
2661         (WTF::TCMalloc_PageHeap::AllocLarge):  Ditto.
2662         (WTF::TCMalloc_PageHeap::Carve):  When splitting a span, ensure that the decommitted state propogates to the two new spans.
2663         (WTF::TCMalloc_PageHeap::Delete):  When merging a span, ensure that the resulting span is marked as decommitted if any of the
2664         spans being merged were marked as decommitted.
2665         (WTF::TCMalloc_PageHeap::IncrementalScavenge):  Mark as decommitted after releasing the span.
2666         (WTF::TCMalloc_Central_FreeList::FetchFromSpans): Add an assertion to catch a decommitted span being returned to the application
2667         without first being recommitted.
2668         (WTF::TCMalloc_Central_FreeList::Populate): Ditto.
2669         * wtf/TCSystemAlloc.cpp: Stub out TCMalloc_SystemCommit.
2670         * wtf/TCSystemAlloc.h:
2671
2672 2008-06-23  Mark Rowe  <mrowe@apple.com>
2673
2674         Reviewed by Sam Weinig.
2675
2676         Remove the sample member of Span when NO_TCMALLOC_SAMPLES is defined.
2677
2678         * wtf/FastMalloc.cpp:
2679         (WTF::TCMalloc_PageHeap::Delete): Only update Span::sample if NO_TCMALLOC_SAMPLES is not defined.
2680         (WTF::TCMallocStats::do_free):  Ditto.
2681
2682 2008-06-23  Darin Adler  <darin@apple.com>
2683
2684         Reviewed by Geoff.
2685
2686         - work toward https://bugs.webkit.org/show_bug.cgi?id=19721
2687
2688         More preparation toward making functions work on primitive types without
2689         creating wrapper objects. No speedup this time, but prepares for a future
2690         speedup without slowing things down.
2691
2692         SunSpider reports no change.
2693
2694         - Eliminated the implementsCall, callAsFunction and construct virtual
2695           functions from JSObject. Instead, the CallData and ConstructData for
2696           a native function includes a function pointer that the caller can use
2697           directly. Changed all call sites to use CallData and ConstructData.
2698
2699         - Changed the "this" argument to native functions to be a JSValue rather
2700           than a JSObject. This prepares us for passing primitives into these
2701           functions. The conversion to an object now must be done inside the
2702           function. Critically, if it's a function that can be called on a DOM
2703           window object, then we have to be sure to call toThisObject on the
2704           argument before we use it for anything even if it's already an object.
2705
2706         - Eliminated the practice of using constructor objects in the global
2707           object to make objects of the various basic types. Since these
2708           constructors can't be replaced by script, there's no reason to involve
2709           a constructor object at all. Added functions to do the construction
2710           directly.
2711
2712         - Made some more class members private and protected, including virtual
2713           function overrides. This can catch code using unnecessarily slow virtual
2714           function code paths when the type of an object is known statically. If we
2715           later find a new reason use the members outside the class it's easy to
2716           make them public again.
2717
2718         - Moved the declarations of the native implementations for functions out
2719           of header files. These can have internal linkage and be declared inside
2720           the source file.
2721
2722         - Changed PrototypeFunction to take function pointers with the right
2723           arguments to be put directly into CallData. This eliminates the
2724           need to have a separate PrototypeReflexiveFunction, and reveals that the
2725           real purpose of that class included something else specific to eval --
2726           storage of a cached global object. So renamed PrototypeReflexiveFunction
2727           to GlobalEvalFunction.
2728
2729         * API/JSCallbackConstructor.cpp:
2730         (KJS::constructJSCallback):
2731         (KJS::JSCallbackConstructor::getConstructData):
2732         * API/JSCallbackConstructor.h:
2733         * API/JSCallbackFunction.cpp:
2734         (KJS::JSCallbackFunction::implementsHasInstance):
2735         (KJS::JSCallbackFunction::call):
2736         (KJS::JSCallbackFunction::getCallData):
2737         * API/JSCallbackFunction.h:
2738         (KJS::JSCallbackFunction::classInfo):
2739         * API/JSCallbackObject.h:
2740         (KJS::JSCallbackObject::classRef):
2741         (KJS::JSCallbackObject::classInfo):
2742         * API/JSCallbackObjectFunctions.h:
2743         (KJS::::getConstructData):
2744         (KJS::::construct):
2745         (KJS::::getCallData):
2746         (KJS::::call):
2747         * API/JSObjectRef.cpp:
2748         (JSObjectMakeFunction):
2749         (JSObjectIsFunction):
2750         (JSObjectCallAsFunction):
2751         (JSObjectCallAsConstructor):
2752         * JavaScriptCore.exp:
2753         * VM/Machine.cpp:
2754         (KJS::jsTypeStringForValue):
2755         (KJS::Machine::privateExecute):
2756         * kjs/ArrayPrototype.cpp:
2757         (KJS::arrayProtoFuncToString):
2758         (KJS::arrayProtoFuncToLocaleString):
2759         (KJS::arrayProtoFuncJoin):
2760         (KJS::arrayProtoFuncConcat):
2761         (KJS::arrayProtoFuncPop):
2762         (KJS::arrayProtoFuncPush):
2763         (KJS::arrayProtoFuncReverse):
2764         (KJS::arrayProtoFuncShift):
2765         (KJS::arrayProtoFuncSlice):
2766         (KJS::arrayProtoFuncSort):
2767         (KJS::arrayProtoFuncSplice):
2768         (KJS::arrayProtoFuncUnShift):
2769         (KJS::arrayProtoFuncFilter):
2770         (KJS::arrayProtoFuncMap):
2771         (KJS::arrayProtoFuncEvery):
2772         (KJS::arrayProtoFuncForEach):
2773         (KJS::arrayProtoFuncSome):
2774         (KJS::arrayProtoFuncIndexOf):
2775         (KJS::arrayProtoFuncLastIndexOf):
2776         (KJS::ArrayConstructor::ArrayConstructor):
2777         (KJS::constructArrayWithSizeQuirk):
2778         (KJS::constructWithArrayConstructor):
2779         (KJS::ArrayConstructor::getConstructData):
2780         (KJS::callArrayConstructor):
2781         (KJS::ArrayConstructor::getCallData):
2782         * kjs/ArrayPrototype.h:
2783         * kjs/BooleanObject.cpp:
2784         (KJS::booleanProtoFuncToString):
2785         (KJS::booleanProtoFuncValueOf):
2786         (KJS::constructBoolean):
2787         (KJS::constructWithBooleanConstructor):
2788         (KJS::BooleanConstructor::getConstructData):
2789         (KJS::callBooleanConstructor):
2790         (KJS::BooleanConstructor::getCallData):
2791         (KJS::constructBooleanFromImmediateBoolean):
2792         * kjs/BooleanObject.h:
2793         * kjs/CallData.h:
2794         (KJS::):
2795         * kjs/ConstructData.h:
2796         (KJS::):
2797         * kjs/FunctionPrototype.cpp:
2798         (KJS::callFunctionPrototype):
2799         (KJS::FunctionPrototype::getCallData):
2800         (KJS::functionProtoFuncToString):
2801         (KJS::functionProtoFuncApply):
2802         (KJS::functionProtoFuncCall):
2803         (KJS::constructWithFunctionConstructor):
2804         (KJS::FunctionConstructor::getConstructData):
2805         (KJS::callFunctionConstructor):
2806         (KJS::FunctionConstructor::getCallData):
2807         (KJS::constructFunction):
2808         * kjs/FunctionPrototype.h:
2809         * kjs/JSArray.cpp:
2810         (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key):
2811         (KJS::JSArray::sort):
2812         (KJS::constructEmptyArray):
2813         (KJS::constructArray):
2814         * kjs/JSArray.h:
2815         (KJS::JSArray::classInfo):
2816         * kjs/JSFunction.cpp:
2817         (KJS::JSFunction::call):
2818         (KJS::globalFuncEval):
2819         (KJS::globalFuncParseInt):
2820         (KJS::globalFuncParseFloat):
2821         (KJS::globalFuncIsNaN):
2822         (KJS::globalFuncIsFinite):
2823         (KJS::globalFuncDecodeURI):
2824         (KJS::globalFuncDecodeURIComponent):
2825         (KJS::globalFuncEncodeURI):
2826         (KJS::globalFuncEncodeURIComponent):
2827         (KJS::globalFuncEscape):
2828         (KJS::globalFuncUnescape):
2829         (KJS::globalFuncKJSPrint):
2830         (KJS::PrototypeFunction::PrototypeFunction):
2831         (KJS::PrototypeFunction::getCallData):
2832         (KJS::GlobalEvalFunction::GlobalEvalFunction):
2833         (KJS::GlobalEvalFunction::mark):
2834         * kjs/JSFunction.h:
2835         (KJS::InternalFunction::classInfo):
2836         (KJS::InternalFunction::functionName):
2837         (KJS::JSFunction::classInfo):
2838         (KJS::GlobalEvalFunction::cachedGlobalObject):
2839         * kjs/JSGlobalObject.cpp:
2840         (KJS::JSGlobalObject::reset):
2841         (KJS::JSGlobalObject::mark):
2842         * kjs/JSGlobalObject.h:
2843         (KJS::JSGlobalObject::JSGlobalObject):
2844         (KJS::JSGlobalObject::evalFunction):
2845         * kjs/JSImmediate.cpp:
2846         (KJS::JSImmediate::toObject):
2847         * kjs/JSNotAnObject.cpp:
2848         * kjs/JSNotAnObject.h:
2849         * kjs/JSObject.cpp:
2850         (KJS::JSObject::put):
2851         (KJS::callDefaultValueFunction):
2852         (KJS::JSObject::defaultValue):
2853         (KJS::JSObject::lookupGetter):
2854         (KJS::JSObject::lookupSetter):
2855         (KJS::JSObject::hasInstance):
2856         (KJS::JSObject::fillGetterPropertySlot):
2857         (KJS::Error::create):
2858         (KJS::constructEmptyObject):
2859         * kjs/JSObject.h:
2860         (KJS::GetterSetter::GetterSetter):
2861         (KJS::GetterSetter::getter):
2862         (KJS::GetterSetter::setGetter):
2863         (KJS::GetterSetter::setter):
2864         (KJS::GetterSetter::setSetter):
2865         * kjs/JSValue.cpp:
2866         (KJS::JSCell::deleteProperty):
2867         (KJS::call):
2868         (KJS::construct):
2869         * kjs/JSValue.h:
2870         * kjs/MathObject.cpp:
2871         (KJS::mathProtoFuncAbs):
2872         (KJS::mathProtoFuncACos):
2873         (KJS::mathProtoFuncASin):
2874         (KJS::mathProtoFuncATan):
2875         (KJS::mathProtoFuncATan2):
2876         (KJS::mathProtoFuncCeil):
2877         (KJS::mathProtoFuncCos):
2878         (KJS::mathProtoFuncExp):
2879         (KJS::mathProtoFuncFloor):
2880         (KJS::mathProtoFuncLog):
2881         (KJS::mathProtoFuncMax):
2882         (KJS::mathProtoFuncMin):
2883         (KJS::mathProtoFuncPow):
2884         (KJS::mathProtoFuncRandom):
2885         (KJS::mathProtoFuncRound):
2886         (KJS::mathProtoFuncSin):
2887         (KJS::mathProtoFuncSqrt):
2888         (KJS::mathProtoFuncTan):
2889         * kjs/MathObject.h:
2890         * kjs/NumberObject.cpp:
2891         (KJS::numberProtoFuncToString):
2892         (KJS::numberProtoFuncToLocaleString):
2893         (KJS::numberProtoFuncValueOf):
2894         (KJS::numberProtoFuncToFixed):
2895         (KJS::numberProtoFuncToExponential):
2896         (KJS::numberProtoFuncToPrecision):
2897         (KJS::NumberConstructor::NumberConstructor):
2898         (KJS::constructWithNumberConstructor):
2899         (KJS::NumberConstructor::getConstructData):
2900         (KJS::callNumberConstructor):
2901         (KJS::NumberConstructor::getCallData):
2902         (KJS::constructNumber):
2903         (KJS::constructNumberFromImmediateNumber):
2904         * kjs/NumberObject.h:
2905         (KJS::NumberObject::classInfo):
2906         (KJS::NumberConstructor::classInfo):
2907         * kjs/PropertySlot.cpp:
2908         (KJS::PropertySlot::functionGetter):
2909         * kjs/RegExpObject.cpp:
2910         (KJS::regExpProtoFuncTest):
2911         (KJS::regExpProtoFuncExec):
2912         (KJS::regExpProtoFuncCompile):
2913         (KJS::regExpProtoFuncToString):
2914         (KJS::callRegExpObject):
2915         (KJS::RegExpObject::getCallData):
2916         (KJS::constructRegExp):
2917         (KJS::constructWithRegExpConstructor):
2918         (KJS::RegExpConstructor::getConstructData):
2919         (KJS::callRegExpConstructor):
2920         (KJS::RegExpConstructor::getCallData):
2921         * kjs/RegExpObject.h:
2922         (KJS::RegExpConstructor::classInfo):
2923         * kjs/Shell.cpp:
2924         (GlobalObject::GlobalObject):
2925         (functionPrint):
2926         (functionDebug):
2927         (functionGC):
2928         (functionVersion):
2929         (functionRun):
2930         (functionLoad):
2931         (functionReadline):
2932         (functionQuit):
2933         * kjs/date_object.cpp:
2934         (KJS::gmtoffset):
2935         (KJS::formatLocaleDate):
2936         (KJS::fillStructuresUsingDateArgs):
2937         (KJS::DateInstance::getTime):
2938         (KJS::DateInstance::getUTCTime):
2939         (KJS::DateConstructor::DateConstructor):
2940         (KJS::constructDate):
2941         (KJS::DateConstructor::getConstructData):
2942         (KJS::callDate):
2943         (KJS::DateConstructor::getCallData):
2944         (KJS::dateParse):
2945         (KJS::dateNow):
2946         (KJS::dateUTC):
2947         (KJS::dateProtoFuncToString):
2948         (KJS::dateProtoFuncToUTCString):
2949         (KJS::dateProtoFuncToDateString):
2950         (KJS::dateProtoFuncToTimeString):
2951         (KJS::dateProtoFuncToLocaleString):
2952         (KJS::dateProtoFuncToLocaleDateString):
2953         (KJS::dateProtoFuncToLocaleTimeString):
2954         (KJS::dateProtoFuncValueOf):
2955         (KJS::dateProtoFuncGetTime):
2956         (KJS::dateProtoFuncGetFullYear):
2957         (KJS::dateProtoFuncGetUTCFullYear):
2958         (KJS::dateProtoFuncToGMTString):
2959         (KJS::dateProtoFuncGetMonth):
2960         (KJS::dateProtoFuncGetUTCMonth):
2961         (KJS::dateProtoFuncGetDate):
2962         (KJS::dateProtoFuncGetUTCDate):
2963         (KJS::dateProtoFuncGetDay):
2964         (KJS::dateProtoFuncGetUTCDay):
2965         (KJS::dateProtoFuncGetHours):
2966         (KJS::dateProtoFuncGetUTCHours):
2967         (KJS::dateProtoFuncGetMinutes):
2968         (KJS::dateProtoFuncGetUTCMinutes):
2969         (KJS::dateProtoFuncGetSeconds):
2970         (KJS::dateProtoFuncGetUTCSeconds):
2971         (KJS::dateProtoFuncGetMilliSeconds):
2972         (KJS::dateProtoFuncGetUTCMilliseconds):
2973         (KJS::dateProtoFuncGetTimezoneOffset):
2974         (KJS::dateProtoFuncSetTime):
2975         (KJS::setNewValueFromTimeArgs):
2976         (KJS::setNewValueFromDateArgs):
2977         (KJS::dateProtoFuncSetMilliSeconds):
2978         (KJS::dateProtoFuncSetUTCMilliseconds):
2979         (KJS::dateProtoFuncSetSeconds):
2980         (KJS::dateProtoFuncSetUTCSeconds):
2981         (KJS::dateProtoFuncSetMinutes):
2982         (KJS::dateProtoFuncSetUTCMinutes):
2983         (KJS::dateProtoFuncSetHours):
2984         (KJS::dateProtoFuncSetUTCHours):
2985         (KJS::dateProtoFuncSetDate):
2986         (KJS::dateProtoFuncSetUTCDate):
2987         (KJS::dateProtoFuncSetMonth):
2988         (KJS::dateProtoFuncSetUTCMonth):
2989         (KJS::dateProtoFuncSetFullYear):
2990         (KJS::dateProtoFuncSetUTCFullYear):
2991         (KJS::dateProtoFuncSetYear):
2992         (KJS::dateProtoFuncGetYear):
2993         * kjs/date_object.h:
2994         (KJS::DateInstance::internalNumber):
2995         (KJS::DateInstance::classInfo):
2996         * kjs/error_object.cpp:
2997         (KJS::errorProtoFuncToString):
2998         (KJS::constructError):
2999         (KJS::constructWithErrorConstructor):
3000         (KJS::ErrorConstructor::getConstructData):
3001         (KJS::callErrorConstructor):
3002         (KJS::ErrorConstructor::getCallData):
3003         (KJS::NativeErrorConstructor::construct):
3004         (KJS::constructWithNativeErrorConstructor):
3005         (KJS::NativeErrorConstructor::getConstructData):
3006         (KJS::callNativeErrorConstructor):
3007         (KJS::NativeErrorConstructor::getCallData):
3008         * kjs/error_object.h:
3009         (KJS::NativeErrorConstructor::classInfo):
3010         * kjs/internal.cpp:
3011         (KJS::JSNumberCell::toObject):
3012         (KJS::JSNumberCell::toThisObject):
3013         (KJS::GetterSetter::mark):
3014         (KJS::GetterSetter::toPrimitive):
3015         (KJS::GetterSetter::toBoolean):
3016         (KJS::GetterSetter::toNumber):
3017         (KJS::GetterSetter::toString):
3018         (KJS::GetterSetter::toObject):
3019         (KJS::InternalFunction::InternalFunction):
3020         (KJS::InternalFunction::implementsHasInstance):
3021         * kjs/lookup.h:
3022         (KJS::HashEntry::):
3023         * kjs/nodes.cpp:
3024         (KJS::FuncDeclNode::makeFunction):
3025         (KJS::FuncExprNode::makeFunction):
3026         * kjs/object_object.cpp:
3027         (KJS::objectProtoFuncValueOf):
3028         (KJS::objectProtoFuncHasOwnProperty):
3029         (KJS::objectProtoFuncIsPrototypeOf):
3030         (KJS::objectProtoFuncDefineGetter):
3031         (KJS::objectProtoFuncDefineSetter):
3032         (KJS::objectProtoFuncLookupGetter):
3033         (KJS::objectProtoFuncLookupSetter):
3034         (KJS::objectProtoFuncPropertyIsEnumerable):
3035         (KJS::objectProtoFuncToLocaleString):
3036         (KJS::objectProtoFuncToString):
3037         (KJS::ObjectConstructor::ObjectConstructor):
3038         (KJS::constructObject):
3039         (KJS::constructWithObjectConstructor):
3040         (KJS::ObjectConstructor::getConstructData):
3041         (KJS::callObjectConstructor):
3042         (KJS::ObjectConstructor::getCallData):
3043         * kjs/object_object.h:
3044         * kjs/string_object.cpp:
3045         (KJS::replace):
3046         (KJS::stringProtoFuncToString):
3047         (KJS::stringProtoFuncValueOf):
3048         (KJS::stringProtoFuncCharAt):
3049         (KJS::stringProtoFuncCharCodeAt):
3050         (KJS::stringProtoFuncConcat):
3051         (KJS::stringProtoFuncIndexOf):
3052         (KJS::stringProtoFuncLastIndexOf):
3053         (KJS::stringProtoFuncMatch):
3054         (KJS::stringProtoFuncSearch):
3055         (KJS::stringProtoFuncReplace):
3056         (KJS::stringProtoFuncSlice):
3057         (KJS::stringProtoFuncSplit):
3058         (KJS::stringProtoFuncSubstr):
3059         (KJS::stringProtoFuncSubstring):
3060         (KJS::stringProtoFuncToLowerCase):
3061         (KJS::stringProtoFuncToUpperCase):
3062         (KJS::stringProtoFuncToLocaleLowerCase):
3063         (KJS::stringProtoFuncToLocaleUpperCase):
3064         (KJS::stringProtoFuncLocaleCompare):
3065         (KJS::stringProtoFuncBig):
3066         (KJS::stringProtoFuncSmall):
3067         (KJS::stringProtoFuncBlink):
3068         (KJS::stringProtoFuncBold):
3069         (KJS::stringProtoFuncFixed):
3070         (KJS::stringProtoFuncItalics):
3071         (KJS::stringProtoFuncStrike):
3072         (KJS::stringProtoFuncSub):
3073         (KJS::stringProtoFuncSup):
3074         (KJS::stringProtoFuncFontcolor):
3075         (KJS::stringProtoFuncFontsize):
3076         (KJS::stringProtoFuncAnchor):
3077         (KJS::stringProtoFuncLink):
3078         (KJS::stringFromCharCode):
3079         (KJS::StringConstructor::StringConstructor):
3080         (KJS::constructWithStringConstructor):
3081         (KJS::StringConstructor::getConstructData):
3082         (KJS::callStringConstructor):
3083         (KJS::StringConstructor::getCallData):
3084         * kjs/string_object.h:
3085
3086 2008-06-23  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3087
3088         Reviewed by Oliver.
3089
3090         Bug 19716: REGRESSION (SquirrelFish): Reproducible crash after entering a username at mint.com
3091         <https://bugs.webkit.org/show_bug.cgi?id=19716>
3092
3093         When unwinding callframes for exceptions, check whether the callframe
3094         was created by a reentrant native call to JavaScript after tearing off
3095         the local variables instead of before.
3096
3097         * VM/Machine.cpp:
3098         (KJS::Machine::unwindCallFrame):
3099
3100 2008-06-23  Mark Rowe  <mrowe@apple.com>
3101
3102         Reviewed by Oliver Hunt.
3103
3104         Get testapi passing again in a debug build.
3105
3106         * API/testapi.c:
3107         (main): Update the expected output of calling JSValueMakeString on a function object.
3108
3109 2008-06-21  Mark Rowe  <mrowe@apple.com>
3110
3111         Reviewed by Sam Weinig.
3112
3113         Print a blank line when exiting the jsc interactive mode to ensure that the shell
3114         prompt will start on a new line.
3115
3116         * kjs/Shell.cpp:
3117         (runInteractive):
3118
3119 2008-06-21  Mark Rowe  <mrowe@apple.com>
3120
3121         Rubber-stamped by Sam Weinig.
3122
3123         Tweak the paths of the items in the "tests" group to clean things up a little.
3124
3125         * JavaScriptCore.xcodeproj/project.pbxproj:
3126
3127 2008-06-21  Mark Rowe  <mrowe@apple.com>
3128
3129         Rubber-stamped by Sam Weinig.
3130
3131         Fix jsc to link against libedit.dylib rather than libedit.2.dylib.
3132
3133         * JavaScriptCore.xcodeproj/project.pbxproj:
3134
3135 2008-06-21  Mark Rowe  <mrowe@apple.com>
3136
3137         Reviewed by Sam Weinig.
3138
3139         Copy the JavaScriptCore shell (jsc) into JavaScriptCore.framework so that it will
3140         be included in nightly builds.
3141         https://bugs.webkit.org/show_bug.cgi?id=19691
3142
3143         * JavaScriptCore.xcodeproj/project.pbxproj:
3144
3145 2008-06-21  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3146
3147         Reviewed by Mark Rowe.
3148
3149         Fix the build for non-Mac Darwin platforms by disabling their support
3150         for readline in the JavaScript shell.
3151
3152         * kjs/config.h:
3153
3154 2008-06-20  Timothy Hatcher  <timothy@apple.com>
3155
3156         Use member function pointers for the Profile::forEach function.
3157         Eliminating a few static functions and simplified things a little.
3158
3159         Reviewed by Alexey Proskuryakov.
3160
3161         * JavaScriptCore.exp: Change the symbol for forEach.
3162         * profiler/Profile.cpp:
3163         (KJS::Profile::forEach): Use a member function pointer.
3164         * profiler/Profile.h:
3165         (KJS::Profile::sortTotalTimeDescending): Pass a function pointer.
3166         (KJS::Profile::sortTotalTimeAscending): Ditto.
3167         (KJS::Profile::sortSelfTimeDescending): Ditto.
3168         (KJS::Profile::sortSelfTimeAscending): Ditto.
3169         (KJS::Profile::sortCallsDescending): Ditto.
3170         * profiler/ProfileNode.h:
3171         (KJS::ProfileNode::sortTotalTimeDescending): No longer static.
3172         (KJS::ProfileNode::sortTotalTimeAscending): Ditto.
3173         (KJS::ProfileNode::sortSelfTimeDescending): Ditto.
3174         (KJS::ProfileNode::sortSelfTimeAscending): Ditto.
3175         (KJS::ProfileNode::sortCallsDescending): Ditto.
3176
3177 2008-06-20  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3178
3179         Reviewed by Oliver.
3180
3181         Remove unused destructors.
3182
3183         * kjs/nodes.cpp:
3184         * kjs/nodes.h:
3185
3186 2008-06-20  Timothy Hatcher  <timothy@apple.com>
3187
3188         Fixed an ASSERT(m_actualSelfTime <= m_actualTotalTime) when starting
3189         and stopping a profile from the Develop menu. Also prevents
3190         inserting an incorrect parent node as the new head after profiling
3191         is stopped from the Develop menu.
3192
3193         Reviewed by Dan Bernstein.
3194
3195         * profiler/Profile.cpp:
3196         (KJS::Profile::stopProfiling): If the current node is already the head
3197         then there is no more need to record future nodes in didExecute.
3198         (KJS::Profile::didExecute): Move the code of setupCurrentNodeAsStopped
3199         into here since this was the only caller. When setting the total time
3200         keep any current total time while adding the self time of the head.
3201         (KJS::Profile::setupCurrentNodeAsStopped): Removed.
3202         * profiler/Profile.h: Removed setupCurrentNodeAsStopped.
3203
3204 2008-06-20  Kevin Ollivier  <kevino@theolliviers.com>
3205
3206         !USE(MULTIPLE_THREADS) on Darwin build fix
3207
3208         * kjs/InitializeThreading.cpp:
3209         (KJS::initializeThreading):
3210         * kjs/collector.h:
3211
3212 2008-06-20  Kevin McCullough  <kmccullough@apple.com>
3213
3214         -Leopard Build Fix.
3215
3216         * profiler/Profile.cpp:
3217         (KJS::Profile::removeProfileStart):
3218         (KJS::Profile::removeProfileEnd):
3219
3220 2008-06-20  Kevin McCullough  <kmccullough@apple.com>
3221
3222         Just giving credit.
3223
3224         * ChangeLog:
3225
3226 2008-06-20  Kevin McCullough  <kmccullough@apple.com>
3227
3228         Reviewed by Tim and Dan.
3229
3230         <rdar://problem/6024846> JSProfiler: ASSERT hit in Profiler.
3231         - Because InspectorController can call startProfiling() and
3232         stopProfiling() we cannot assert that console.profile() and
3233         console.profileEnd() will be in the profile tree.
3234
3235         * profiler/Profile.cpp:
3236         (KJS::Profile::removeProfileStart):
3237         (KJS::Profile::removeProfileEnd):
3238
3239 2008-06-20  Kevin McCullough  <kmccullough@apple.com>
3240
3241         Reviewed by Tim.
3242
3243         <rdar://problem/5958770> JSProfiler: Time incorrectly given to (idle)
3244         if profiling is started and finished within the same function. (19230)
3245         - Now we profile one more stack frame up from the last frame to allocate
3246         the time spent in it, if it exists.
3247
3248         * JavaScriptCore.exp:
3249         * VM/Machine.cpp: We need to let the profiler know when the JS program 
3250         has finished since that is what will actually stop the profiler instead
3251         of just calling stopProfiling().
3252         (KJS::Machine::execute):
3253         * profiler/Profile.cpp:
3254         (KJS::Profile::create): Moved from Profile.h since it was getting pretty
3255         long.
3256         (KJS::Profile::Profile): We now have a client, which is a listener who
3257         we will return this profile to, once it has actually finished.
3258         (KJS::Profile::stopProfiling): Instead of fully stopping the profiler
3259         here, we set the flag and keep it profiling in the background.
3260         (KJS::Profile::didFinishAllExecution): This is where the profiler
3261         actually finishes and creates the (idle) node if one should be made.
3262         (KJS::Profile::removeProfileStart): Don't use m_currentNode since it is
3263         needed by the profiler as it runs silently in the background.
3264         (KJS::Profile::removeProfileEnd): Ditto.
3265         (KJS::Profile::willExecute): Don't profile new functions if we have
3266         stopped profiling.
3267         (KJS::Profile::didExecute): Only record one more return as all the
3268         remaining time will be attributed to that function.
3269         (KJS::Profile::setupCurrentNodeAsStopped): Sets the current node's time.
3270         * profiler/Profile.h: Added functions and variables for the above
3271         changes.
3272         (KJS::Profile::client):
3273         * profiler/ProfileNode.h:
3274         (KJS::CallIdentifier::toString): Debug method.
3275         * profiler/Profiler.cpp: Added support for the ProfilerClient.
3276         (KJS::Profiler::startProfiling):
3277         (KJS::Profiler::stopProfiling): No longer return sthe profile.
3278         (KJS::Profiler::didFinishAllExecution): Now returns the profile to the
3279         client instead of stopProfiling.
3280         * profiler/Profiler.h:
3281         (KJS::ProfilerClient::~ProfilerClient): Clients will implement this
3282         interface.
3283
3284 2008-06-19  Ariya Hidayat  <ariya.hidayat@trolltech.com>
3285
3286         Reviewed by Simon.
3287
3288         Surpress compiler warning (int vs unsigned comparison).
3289
3290         * wtf/unicode/qt4/UnicodeQt4.h:
3291         (WTF::Unicode::toLower):
3292
3293 2008-06-19  Ariya Hidayat  <ariya.hidayat@trolltech.com>
3294
3295         Reviewed by Timothy Hatcher.
3296
3297         Introduce compiler define for MinGW, to have COMPILER(MINGW).
3298
3299         * wtf/Platform.h:
3300
3301 2008-06-19  Alexey Proskuryakov  <ap@webkit.org>
3302
3303         Reviewed by Geoff.
3304
3305         Make Machine per-JSGlobalData.
3306
3307         * VM/CodeBlock.cpp:
3308         (KJS::CodeBlock::dump):
3309         * VM/CodeGenerator.cpp:
3310         (KJS::CodeGenerator::emitOpcode):
3311         * VM/Machine.cpp:
3312         (KJS::callEval):
3313         (KJS::Machine::unwindCallFrame):
3314         (KJS::Machine::throwException):
3315         (KJS::Machine::execute):
3316         (KJS::Machine::debug):
3317         * VM/Machine.h:
3318         * kjs/DebuggerCallFrame.cpp:
3319         (KJS::DebuggerCallFrame::evaluate):
3320         * kjs/DebuggerCallFrame.h:
3321         (KJS::DebuggerCallFrame::DebuggerCallFrame):
3322         * kjs/ExecState.cpp:
3323         (KJS::ExecState::ExecState):
3324         * kjs/ExecState.h:
3325         (KJS::ExecState::machine):
3326         * kjs/JSFunction.cpp:
3327         (KJS::JSFunction::callAsFunction):
3328         (KJS::JSFunction::argumentsGetter):
3329         (KJS::JSFunction::callerGetter):
3330         (KJS::JSFunction::construct):
3331         (KJS::globalFuncEval):
3332         * kjs/JSGlobalData.cpp:
3333         (KJS::JSGlobalData::JSGlobalData):
3334         * kjs/JSGlobalData.h:
3335         * kjs/interpreter.cpp:
3336         (KJS::Interpreter::evaluate):
3337
3338 2008-06-19  Alp Toker  <alp@nuanti.com>
3339
3340         GTK+/autotools build fix. JSGlobalObject.cpp in now in
3341         AllInOneFile.cpp and shouldn't be built separately.
3342
3343         * GNUmakefile.am:
3344
3345 2008-06-19  Alexey Proskuryakov  <ap@webkit.org>
3346
3347         Reviewed by Darin.
3348
3349         Get rid of some threadInstance calls.
3350
3351         * kjs/JSGlobalObject.cpp:
3352         (KJS::JSGlobalObject::init):
3353         * kjs/Parser.cpp:
3354         (KJS::Parser::parse):
3355         * kjs/Shell.cpp:
3356         (jscmain):
3357
3358 2008-06-19  Alexey Proskuryakov  <ap@webkit.org>
3359
3360         Reviewed by Sam.
3361
3362         Fix an assertion failure at startup.
3363
3364         * kjs/JSObject.h: (KJS::JSObject::JSObject): Allow jsNull prototype in an assertion (I had
3365         it fixed in a wrong copy of the file, so I wasn't getting the failure).
3366
3367 2008-06-19  Alexey Proskuryakov  <ap@webkit.org>
3368
3369         Build fix.
3370
3371         * kjs/collector.cpp:
3372         (KJS::Heap::Heap):
3373         (KJS::allocateBlock):
3374         * kjs/collector.h:
3375         No, #if PLATFORM(UNIX) was not right. I've just moved the unsafe initialization back for now,
3376         as the platforms that use that code path do not use multiple threads yet.
3377
3378 2008-06-19  Alexey Proskuryakov  <ap@webkit.org>
3379
3380         Windows and Qt build fixes.
3381
3382         * kjs/collector.h: 
3383         * kjs/collector.cpp:
3384         (KJS::Heap::Heap):
3385         Wrapped m_pagesize in #if PLATFORM(UNIX), which should better match the sequence of #elifs
3386         in allocateBlock(). Changed MIN_ARRAY_SIZE to be explicitly size_t, as this type is different
3387         on different platforms.
3388
3389 2008-06-17  Alexey Proskuryakov  <ap@webkit.org>
3390
3391         Reviewed by Darin.
3392
3393         Prepare JavaScript heap for being per-thread.
3394
3395         * kjs/ExecState.h: Shuffle includes, making it possible to include ExecState.h in JSValue.h.
3396         (KJS::ExecState::heap): Added an accessor.
3397
3398         * API/JSBase.cpp: (JSGarbageCollect): Collect both shared and per-thread heaps.
3399
3400         * API/JSContextRef.cpp: (JSGlobalContextCreate): When allocating JSGlobalObject, indicate
3401         that it belongs to a shared heap.
3402
3403         * JavaScriptCore.xcodeproj/project.pbxproj:
3404         * kjs/AllInOneFile.cpp:
3405         Moved JSGlobalObject.cpp to AllInOneFile, as a build fix for inlineAllocate magic.
3406
3407         * VM/CodeGenerator.h: (KJS::CodeGenerator::globalExec): Added an accessor (working via
3408         m_scopeChain).
3409
3410         * VM/RegisterFile.h:
3411         (KJS::RegisterFile::mark):
3412         * VM/RegisterFileStack.h:
3413         (KJS::RegisterFileStack::mark):
3414         Made these pseudo-mark functions take Heap*.
3415
3416         * kjs/InitializeThreading.cpp:
3417         (KJS::initializeThreading): Initialize heap introspector.
3418
3419         * kjs/JSGlobalData.h: Added Heap to the structure.
3420
3421         * kjs/JSGlobalData.cpp:
3422         (KJS::JSGlobalData::JSGlobalData): Initialize Heap.
3423         (KJS::JSGlobalData::sharedInstance): Added a method to access shared global data instance
3424         for legacy clients.
3425
3426         * kjs/JSGlobalObject.cpp:
3427         (KJS::JSGlobalObject::~JSGlobalObject): Changed to work with per-thread head; fixed list
3428         maintenance logic.
3429         (KJS::JSGlobalObject::init): Changed to work with per-thread head.
3430         (KJS::JSGlobalObject::put): Assert that a cross-heap operation is not being attempted.
3431         (KJS::JSGlobalObject::reset): Pass ExecState* where now required.
3432         (KJS::JSGlobalObject::mark): Pass the current heap to RegisterFileStack::mark.
3433         (KJS::JSGlobalObject::operator new): Overload operator new to use per-thread or shared heap.
3434         * kjs/JSGlobalObject.h: Removed static s_head member.
3435
3436         * kjs/PropertyMap.h: (KJS::PropertyMap::PropertyMap): Removed unused SavedProperty.
3437
3438         * kjs/collector.h: Turned Collector into an actual object with its own data, renamed to Heap.
3439         (KJS::Heap::initializeHeapIntrospector): Added.
3440         (KJS::Heap::heap): Added a method to determine which heap a JSValue is in, if any.
3441         (KJS::Heap::allocate): Made non-static.
3442         (KJS::Heap::inlineAllocateNumber): Ditto.
3443         (KJS::Heap::markListSet): Ditto.
3444         (KJS::Heap::cellBlock): Ditto.
3445         (KJS::Heap::cellOffset): Ditto.
3446         (KJS::Heap::isCellMarked): Ditto.
3447         (KJS::Heap::markCell): Ditto.
3448         (KJS::Heap::reportExtraMemoryCost): Ditto.
3449         (KJS::CollectorBlock): Added a back-reference to Heap for Heap::heap() method.
3450         (KJS::SmallCellCollectorBlock): Ditto.
3451
3452         * kjs/collector.cpp: Changed MIN_ARRAY_SIZE to a #define to avoid a PIC branch. Removed
3453         main thread related machinery.
3454         (KJS::Heap::Heap): Initialize the newly added data members.
3455         (KJS::allocateBlock): Marked NEVER_INLINE, as this is a rare case that uses a PIC branch.
3456         Moved static pagesize to the class to make it safely initialized.
3457         (KJS::Heap::heapAllocate): Initialize heap back reference after a new block is allocated.
3458         (KJS::Heap::registerThread): Removed introspector initialization, as it is now performed
3459         in InitializeThreading.cpp.
3460         (KJS::Heap::markOtherThreadConservatively): Assert that the "other thread" case only occurs
3461         for legacy clients using a shared heap.
3462         (KJS::Heap::markStackObjectsConservatively): Moved fastMallocForbid/Allow down here, since
3463         it doesn't need to be forbidden during other GC phases.
3464
3465         * kjs/JSImmediate.h:
3466         (KJS::jsUndefined):
3467         (KJS::jsNull):
3468         (KJS::jsBoolean):
3469         Moved from JSvalue.h, to make these usable in files that cannot include JSValue.h (such
3470         as list.h).
3471
3472         * API/JSCallbackObjectFunctions.h:
3473         (KJS::::staticFunctionGetter):
3474         * API/JSClassRef.cpp:
3475         (OpaqueJSClass::prototype):
3476         * API/JSObjectRef.cpp:
3477         (JSObjectMake):
3478         (JSObjectMakeFunctionWithCallback):
3479         (JSObjectMakeConstructor):
3480         (JSObjectMakeFunction):
3481         * API/JSValueRef.cpp:
3482         (JSValueMakeNumber):
3483         (JSValueMakeString):
3484         * JavaScriptCore.exp:
3485         * VM/CodeGenerator.cpp:
3486         (KJS::CodeGenerator::emitLoad):
3487         * VM/JSPropertyNameIterator.cpp:
3488         (KJS::JSPropertyNameIterator::create):
3489         (KJS::JSPropertyNameIterator::next):
3490         * VM/Machine.cpp:
3491         (KJS::jsAddSlowCase):
3492         (KJS::jsAdd):
3493         (KJS::jsTypeStringForValue):
3494         (KJS::scopeChainForCall):
3495         (KJS::Machine::throwException):
3496         (KJS::Machine::execute):
3497         (KJS::Machine::privateExecute):
3498         (KJS::Machine::retrieveArguments):
3499         * kjs/ArrayPrototype.cpp:
3500         (KJS::arrayProtoFuncToString):
3501         (KJS::arrayProtoFuncToLocaleString):
3502         (KJS::arrayProtoFuncJoin):
3503         (KJS::arrayProtoFuncConcat):
3504         (KJS::arrayProtoFuncPop):
3505         (KJS::arrayProtoFuncPush):
3506         (KJS::arrayProtoFuncShift):
3507         (KJS::arrayProtoFuncSlice):
3508         (KJS::arrayProtoFuncSplice):
3509         (KJS::arrayProtoFuncUnShift):
3510         (KJS::arrayProtoFuncFilter):
3511         (KJS::arrayProtoFuncMap):
3512         (KJS::arrayProtoFuncEvery):
3513         (KJS::arrayProtoFuncForEach):
3514         (KJS::arrayProtoFuncSome):
3515         (KJS::arrayProtoFuncIndexOf):
3516         (KJS::arrayProtoFuncLastIndexOf):
3517         (KJS::ArrayConstructor::ArrayConstructor):
3518         (KJS::ArrayConstructor::construct):
3519         (KJS::ArrayConstructor::callAsFunction):
3520         * kjs/BooleanObject.cpp:
3521         (KJS::BooleanPrototype::BooleanPrototype):
3522         (KJS::booleanProtoFuncToString):
3523         (KJS::BooleanConstructor::BooleanConstructor):
3524         (KJS::BooleanConstructor::construct):
3525         * kjs/FunctionPrototype.cpp:
3526         (KJS::FunctionPrototype::FunctionPrototype):
3527         (KJS::functionProtoFuncToString):