JavaScriptCore:
[WebKit.git] / JavaScriptCore / ChangeLog
1 2006-02-03  Timothy Hatcher  <timothy@apple.com>
2
3         Reviewed by Justin.
4
5         Renamed configuration names to Debug, Release and Production.
6
7         * JavaScriptCore.xcodeproj/project.pbxproj:
8
9 2006-02-02  George Staikos <staikos@opensource.apple.com>
10
11         Reviewed by Maciej.
12
13         * kjs/lookup.h: Fix compile, merged from KDE.
14
15 2006-02-02  Darin Adler  <darin@apple.com>
16
17         Reviewed by Maciej.
18
19         - http://bugzilla.opendarwin.org/show_bug.cgi?id=7005
20           add Noncopyable, OwnPtr, OwnArrayPtr to KXMLCore
21
22         * kxmlcore/Noncopyable.h: Added.
23         * kxmlcore/OwnArrayPtr.h: Added.
24         * kxmlcore/OwnPtr.h: Added.
25
26         * JavaScriptCore.xcodeproj/project.pbxproj: Added new files.
27
28         * kjs/function.h:
29         * kjs/function.cpp: Use OwnPtr for Parameter pointers.
30
31         * kjs/internal.h: Use Noncopyable for LabelStack.
32
33         * kjs/list.cpp: Use OwnArrayPtr for overflow.
34
35         * kjs/property_map.h:
36         * kjs/property_map.cpp: Use OwnArrayPtr for SavedProperties.
37         Use Vector for some stack buffers.
38
39         * kjs/regexp_object.h:
40         * kjs/regexp_object.cpp: Use OwnArrayPtr for lastOvector.
41
42 2006-01-31  Maciej Stachowiak  <mjs@apple.com>
43
44         Reviewed by Darin.
45         
46         - fixed leak of hundreds of thousands of JS parser nodes on the layout tests, and added an exit counter
47         that would catch them
48
49         * kjs/nodes.cpp:
50         (NodeCounter::~NodeCounter): Added debug-only node counter.
51         (Node::Node):
52         (Node::~Node):
53         * kxmlcore/VectorTraits.h: Simple classes like RefPtr do in fact need destruction.
54
55 2006-01-31  Darin Adler  <darin@apple.com>
56
57         Reviewed by Maciej.
58
59         - added deleteAllValues for HashSet as well as HashMap
60         - fixed conversion from const_iterator to iterator, which I broke a while back
61
62         * kxmlcore/HashMap.h: Updated copyright date.
63         * kxmlcore/HashSet.h: (KXMLCore::deleteAllValues): Added.
64         * kxmlcore/HashTable.h: (KXMLCore::HashTableIterator::operator const_iterator): Added.
65
66 2006-01-31  Tim Omernick  <timo@apple.com>
67
68         Reviewed by Geoff Garen.
69
70         * bindings/c/c_utility.cpp:
71         (KJS::Bindings::convertUTF8ToUTF16):
72         Fixed an invalid assertion that UTF8Chars is not NULL.  It is valid for it to be NULL as long as
73         UTF8Length is 0.
74         This fixes an assertion failure on TOT at <http://www.musicindiaonline.com/p/x/tJO0OOBME9.As1NMvHdW/>,
75         where JavaScript is getting a NULL string back from some call on the Real Player plugin.
76
77 2006-01-30  Anders Carlsson  <andersca@mac.com>
78
79         Reviewed by Darin.
80
81         Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6907
82         REGRESSION: United.com menus messed up due to document.all/MSIE sniff
83         
84         * kjs/nodes.cpp:
85         (typeStringForValue):
86         Return "undefined" if the given object should masquerade as undefined.
87         
88         * kjs/object.h:
89         (KJS::JSObject::masqueradeAsUndefined):
90         Rename from isEqualToNull.
91         
92         * kjs/operations.cpp:
93         (KJS::equal):
94         Update for name change.
95
96 2006-01-29  Maciej Stachowiak  <mjs@apple.com>
97
98         Reviewed by Darin.
99         
100         - properly define Vector assignment operator; the private version was accidentally left
101         in, and the template version is not enough to replace the default
102
103         * kxmlcore/Vector.h:
104         (KXMLCore::Vector::operator=):
105
106 2006-01-29  Eric Seidel  <eseidel@apple.com>
107
108         Reviewed by darin.
109
110         Fix the build by applying a GCC-specific namespace hack.
111
112         * kjs/lookup.h:
113
114 2006-01-29  Eric Seidel <eseidel@apple.com>
115
116         Reviewed by hyatt.
117
118         Fix build on Win32.
119
120         * kjs/lookup.h: fixed ::cacheGlobalObject
121         * kxmlcore/Vector.h:
122         (KXMLCore::Vector::operator[]): use unsigned long
123
124 2006-01-29  Maciej Stachowiak  <mjs@apple.com>
125
126         Reviewed by Dave Hyatt.
127
128         * kxmlcore/Vector.h:
129         (KXMLCore::Vector::operator[]): Add unsigned overload
130
131 2006-01-28  Darin Adler  <darin@apple.com>
132
133         Reviewed by John Sullivan.
134
135         - http://bugzilla.opendarwin.org/show_bug.cgi?id=6895
136           include exception names in JavaScript form of DOM exception
137
138         * khtml/ecma/kjs_binding.cpp: (KJS::setDOMException): Include the name of the
139         exception in the error message.
140
141 2006-01-28  Maciej Stachowiak  <mjs@apple.com>
142
143         Reviewed by Darin.
144         
145         - miscellaneous Vector improvements
146
147         * kxmlcore/Vector.h:
148         (KXMLCore::Vector::at): Add range-checking asserts.
149         (KXMLCore::Vector::first): Added as a convenience.
150         (KXMLCore::Vector::last): Convenience for stack-style use.
151         (KXMLCore::Vector::removeLast): ditto
152
153 2006-01-28  Darin Adler  <darin@apple.com>
154
155         Reviewed by xxx
156
157         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6870
158           REGRESSION: JavaScript Date constructor won't accept another Date object
159
160         Test: fast/js/date-constructor.html
161
162         * kjs/date_object.cpp: (KJS::DateObjectImp::construct):
163         Added a special case for constructing one date from another (to avoid losing
164         milliseconds, which are not in the text form, to match Firefox), and changed
165         the base code to convert to primitive before checking for string to match
166         the standard. Also corrected a couple silly things in the "construct from
167         current time" code path (removed a floor that does no good, and changed
168         the constant used to convert microseconds to milliseconds to be a 1000
169         rather than "msPerSecond").
170
171 2006-01-28  Darin Adler  <darin@apple.com>
172
173         * kjs/create_hash_table: Added missing license.
174
175 2006-01-28  Maciej Stachowiak  <mjs@apple.com>
176
177         Reviewed by Dave Hyatt.
178         
179         - added a Vector class
180         http://bugzilla.opendarwin.org/show_bug.cgi?id=6894
181
182         * JavaScriptCore.xcodeproj/project.pbxproj:
183         * kjs/internal.cpp:
184         (KJS::Parser::saveNewNode): Apply Vector.
185         (KJS::clearNewNodes): ditto
186         * kjs/number_object.cpp:
187         (integer_part_noexp): ditto
188         (char_sequence): ditto
189         * kjs/ustring.cpp:
190         (KJS::UString::UTF8String): ditto
191         * kxmlcore/HashMap.h:
192         (KXMLCore::deleteAllValues): Tweaked this to only apply to HashMap,
193         other versions are useful for other containers.
194         * kxmlcore/Vector.h: Added. Implemented a Vector class, which should
195         be usable for all Array/QVector style purposes, and also as a stack buffer
196         with oversize handling. Also some helper classes to make vector operations
197         as efficient as possible for POD types and for simple non-PODs like RefPtr.
198         (KXMLCore::):
199         (KXMLCore::VectorTypeOperations::destruct):
200         (KXMLCore::VectorTypeOperations::initialize):
201         (KXMLCore::VectorTypeOperations::move):
202         (KXMLCore::VectorTypeOperations::uninitializedCopy):
203         (KXMLCore::VectorTypeOperations::uninitializedFill):
204         (KXMLCore::VectorBuffer::VectorBuffer):
205         (KXMLCore::VectorBuffer::~VectorBuffer):
206         (KXMLCore::VectorBuffer::deallocateBuffer):
207         (KXMLCore::VectorBuffer::inlineBuffer):
208         (KXMLCore::Vector::Vector):
209         (KXMLCore::Vector::~Vector):
210         (KXMLCore::Vector::size):
211         (KXMLCore::Vector::capacity):
212         (KXMLCore::Vector::isEmpty):
213         (KXMLCore::Vector::at):
214         (KXMLCore::Vector::operator[]):
215         (KXMLCore::Vector::data):
216         (KXMLCore::Vector::operator T*):
217         (KXMLCore::Vector::operator const T*):
218         (KXMLCore::Vector::begin):
219         (KXMLCore::Vector::end):
220         (KXMLCore::Vector::clear):
221         (KXMLCore::Vector::fill):
222         (KXMLCore::Vector::operator=):
223         (KXMLCore::::Vector):
224         (KXMLCore::::operator):
225         (KXMLCore::::fill):
226         (KXMLCore::::expandCapacity):
227         (KXMLCore::::resize):
228         (KXMLCore::::reserveCapacity):
229         (KXMLCore::::append):
230         (KXMLCore::deleteAllValues):
231         * kxmlcore/VectorTraits.h: Added.
232         (KXMLCore::VectorTraits): Traits to enable making Vector efficient for
233         simple types.
234
235 2006-01-28  Alexey Proskuryakov  <ap@nypop.com>
236
237         Reviewed by Darin.
238
239         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5163
240         RealPlayer.GetTitle() Crashes Safari/Dashboard
241
242         * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16):
243         Fallback to kCFStringEncodingWindowsLatin1 if the passed buffer is not valid UTF-8, preventing crashes.
244
245 2006-01-25  George Staikos <staikos@opensource.apple.com>
246
247         Reviewed by Darin.
248
249         * kxmlcore/HashFunctions.h: Merge build fix from KDE.
250
251 2006-01-25  Darin Adler  <darin@apple.com>
252
253         - removed an unused source file
254
255         * kjs/pointer_hash.h: Removed.
256         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Removed reference to pointer_hash.h.
257
258 2006-01-23  Anders Carlsson  <andersca@mac.com>
259
260         Reviewed by Maciej.
261
262         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6737
263         KJS_DEFINE_PROTOTYPE should work outside of the KJS namespace
264         
265         * kjs/lookup.h:
266         Prefix all KJS types with KJS:: in KJS_DEFINE_PROTOTYPE.
267         
268         (cacheGlobalObject):
269         Move this out of the KJS namespace.
270
271 2006-01-23  Maciej Stachowiak  <mjs@apple.com>
272
273         Reviewed by Eric.
274
275         - renamed PointerHash to PtrHash
276         - made PtrHash the default hash function for int and pointer types that aren't further specialized
277         - added an AtomicStringImpl class to make it easier and more typesafe to identity hash atomic strings
278         - did appropriate consequent cleanup (very few places now need to declare a hash function)
279         http://bugzilla.opendarwin.org/show_bug.cgi?id=6752
280         
281         * kjs/array_object.cpp:
282         (ArrayProtoFunc::callAsFunction): no need to mention PointerHash
283         * kjs/collector.cpp: ditto
284         * kjs/identifier.cpp:
285         (KXMLCore::): declare DefaultHash the new way
286         * kjs/internal.cpp: no need to mention PointerHash
287         * kjs/ustring.h:
288         * kxmlcore/HashCountedSet.h: change how we get the default hash to make it
289         easier to specialize on PtrHash
290         * kxmlcore/HashFunctions.h:
291         (KXMLCore::): renamed PointerHash to PtrHash; changed DefaultHash so that it has
292         a Hash typedef rather than being a hash function class itself; declared DefaultHash
293         for int and partializy specialized for pointer types
294         * kxmlcore/HashMapPtrSpec.h:
295         (KXMLCore::PtrHashIteratorAdapter::PtrHashIteratorAdapter): Slight tweaks for new
296         way of handling pointer hash
297         (KXMLCore::PtrHashConstIteratorAdapter::PtrHashConstIteratorAdapter): ditto
298         (KXMLCore::): ditto
299         * kxmlcore/HashMap.h: ditto
300         * kxmlcore/HashSet.h: ditto
301
302 2006-01-23  Maciej Stachowiak  <mjs@apple.com>
303
304         Reviewed by Tim Omernick.
305         
306         - use classes instead of free functions for extractors, this better matches how other
307         things work and should avoid the need for hacky workarounds on other compilers
308         http://bugzilla.opendarwin.org/show_bug.cgi?id=6748
309
310         * kjs/array_object.cpp:
311         * kjs/identifier.cpp:
312         * kjs/internal.cpp:
313         * kxmlcore/HashMap.h:
314         (KXMLCore::PairFirstExtractor::extract):
315         * kxmlcore/HashMapPtrSpec.h:
316         (KXMLCore::):
317         * kxmlcore/HashSet.h:
318         (KXMLCore::IdentityExtractor::extract):
319         * kxmlcore/HashTable.h:
320         (KXMLCore::addIterator):
321         (KXMLCore::removeIterator):
322         (KXMLCore::HashTable::add):
323         (KXMLCore::HashTable::isEmptyBucket):
324         (KXMLCore::HashTable::isDeletedBucket):
325         (KXMLCore::HashTable::HashTable):
326         (KXMLCore::HashTable::lookup):
327         (KXMLCore::HashTable::add):
328         (KXMLCore::HashTable::reinsert):
329         (KXMLCore::HashTable::find):
330         (KXMLCore::HashTable::contains):
331         (KXMLCore::HashTable::remove):
332         (KXMLCore::HashTable::allocateTable):
333         (KXMLCore::HashTable::deallocateTable):
334         (KXMLCore::HashTable::expand):
335         (KXMLCore::HashTable::rehash):
336         (KXMLCore::HashTable::clear):
337         (KXMLCore::HashTable::swap):
338         (KXMLCore::HashTable::operator):
339         (KXMLCore::HashTable::checkTableConsistency):
340         (KXMLCore::HashTable::checkTableConsistencyExceptSize):
341         (KXMLCore::HashTable::invalidateIterators):
342
343 2006-01-23  Maciej Stachowiak  <mjs@apple.com>
344
345         Rubber stamped by Tim Hatcher.
346         
347         - renamed inert() operation on HashSet, HashCountedSet and HashTable to add()
348         for consistency with HashMap
349
350         * kjs/array_object.cpp:
351         (ArrayProtoFunc::callAsFunction):
352         * kjs/collector.cpp:
353         (KJS::Collector::protect):
354         * kjs/identifier.cpp:
355         (KJS::Identifier::add):
356         * kxmlcore/HashCountedSet.h:
357         (KXMLCore::::add):
358         * kxmlcore/HashMap.h:
359         (KXMLCore::::inlineAdd):
360         * kxmlcore/HashSet.h:
361         (KXMLCore::::add):
362         * kxmlcore/HashTable.h:
363         (KXMLCore::HashTable::add):
364         (KXMLCore::::add):
365         (KXMLCore::::HashTable):
366
367 2006-01-23  Justin Garcia  <justin.garcia@apple.com>
368
369         Reviewed by thatcher
370         
371         Turned on -O2 for B&I build.
372
373         * JavaScriptCore.xcodeproj/project.pbxproj:
374
375 2006-01-23  Maciej Stachowiak  <mjs@apple.com>
376
377         Reviewed by Tim Hatcher.
378         
379         - it's "Franklin Street", not "Franklin Steet"
380
381         * kjs/array_instance.h:
382         * kjs/array_object.cpp:
383         * kjs/array_object.h:
384         * kjs/bool_object.cpp:
385         * kjs/bool_object.h:
386         * kjs/collector.cpp:
387         * kjs/collector.h:
388         * kjs/completion.h:
389         * kjs/context.h:
390         * kjs/date_object.cpp:
391         * kjs/date_object.h:
392         * kjs/debugger.cpp:
393         * kjs/debugger.h:
394         * kjs/dtoa.h:
395         * kjs/error_object.cpp:
396         * kjs/error_object.h:
397         * kjs/function.cpp:
398         * kjs/function.h:
399         * kjs/function_object.cpp:
400         * kjs/function_object.h:
401         * kjs/grammar.y:
402         * kjs/identifier.cpp:
403         * kjs/identifier.h:
404         * kjs/internal.cpp:
405         * kjs/internal.h:
406         * kjs/interpreter.cpp:
407         * kjs/interpreter.h:
408         * kjs/lexer.cpp:
409         * kjs/lexer.h:
410         * kjs/list.cpp:
411         * kjs/list.h:
412         * kjs/lookup.cpp:
413         * kjs/lookup.h:
414         * kjs/math_object.cpp:
415         * kjs/math_object.h:
416         * kjs/nodes.cpp:
417         * kjs/nodes.h:
418         * kjs/nodes2string.cpp:
419         * kjs/number_object.cpp:
420         * kjs/number_object.h:
421         * kjs/object.cpp:
422         * kjs/object.h:
423         * kjs/object_object.cpp:
424         * kjs/object_object.h:
425         * kjs/operations.cpp:
426         * kjs/operations.h:
427         * kjs/property_map.cpp:
428         * kjs/property_map.h:
429         * kjs/property_slot.cpp:
430         * kjs/property_slot.h:
431         * kjs/reference.cpp:
432         * kjs/reference.h:
433         * kjs/reference_list.cpp:
434         * kjs/reference_list.h:
435         * kjs/regexp.cpp:
436         * kjs/regexp.h:
437         * kjs/regexp_object.cpp:
438         * kjs/regexp_object.h:
439         * kjs/scope_chain.cpp:
440         * kjs/scope_chain.h:
441         * kjs/simple_number.h:
442         * kjs/string_object.cpp:
443         * kjs/string_object.h:
444         * kjs/testkjs.cpp:
445         * kjs/types.h:
446         * kjs/ustring.cpp:
447         * kjs/ustring.h:
448         * kjs/value.cpp:
449         * kjs/value.h:
450         * kxmlcore/AlwaysInline.h:
451         * kxmlcore/ListRefPtr.h:
452         * kxmlcore/PassRefPtr.h:
453         * kxmlcore/RefPtr.h:
454
455 2006-01-23  Darin Adler  <darin@apple.com>
456
457         Reviewed by John Sullivan.
458
459         - change needed for fix to http://bugzilla.opendarwin.org/show_bug.cgi?id=6617
460           REGRESSION: Crash in cloneChildNodes when clicking element
461
462         * kxmlcore/PassRefPtr.h: Fix assignment operator from RefPtr of a different
463         type by calling get() instead of going directly at m_ptr.
464         * kxmlcore/RefPtr.h: Ditto.
465
466         - other changes
467
468         * JavaScriptCore.xcodeproj/project.pbxproj: Xcode decided to change this file.
469         It's just a resorted list of keys in a dictionary.
470
471         * kjs/fpconst.cpp: Wrap this file in #if __APPLE__ since the alternate version
472         in internal.cpp is in #if !__APPLE__. This file is to give us the "no init
473         routine" property we want to have on OS X.
474
475 2006-01-22  Maciej Stachowiak  <mjs@apple.com>
476
477         Reviewed by Darin.
478
479         - Set up Page class and invert Frame / WebCoreFrameBridge ownership
480         http://bugzilla.opendarwin.org/show_bug.cgi?id=6577
481
482         * kjs/interpreter.h: make globalExec virtual so ScriptInterpreter can 
483         override it
484
485 2006-01-23  George Staikos <staikos@opensource.apple.com>
486
487         Reviewed by Maciej and Darin.
488
489         * kxmlcore/Assertions.h: This file only works with __APPLE__ right now
490         * kjs/interpreter.cpp: ditto
491         * kjs/simple_number.h: Add assert.h and remove from config.h
492         * kjs/array_object.cpp: Use relative paths for kxmlcore includes
493         * kjs/testkjs.cpp: Use relative paths for kxmlcore includes
494
495 2006-01-23  George Staikos <staikos@opensource.apple.com>
496
497         Reviewed by Maciej.
498
499         * kjs/config.h: unbreak preprocessor change
500
501 2006-01-23  George Staikos <staikos@opensource.apple.com>
502
503         Approved by Maciej and Darin.
504
505         * kjs/:
506         * kxmlcore/:
507              Update FSF address in license to make merging easier
508
509 2006-01-22  George Staikos <staikos@opensource.apple.com>
510
511         Reviewed by Maciej.
512
513         * kjs/collector.cpp: merge major speedup from KDE on Linux
514                              patch by Maks Orlovich, bug #6145
515                              Also unify cpu detection
516         * kjs/config.h: define simpler CPU macros
517
518 2006-01-22  George Staikos <staikos@opensource.apple.com>
519
520         Reviewed by Maciej.
521
522         * kjs/collector.cpp: merge FreeBSD compile fix from KDE
523                              -> requires build magic for use
524
525 2006-01-21  George Staikos <staikos@opensource.apple.com>
526
527         Reviewed by Maciej.
528
529         * kjs/nodes2string.cpp
530         * kjs/operations.h
531         * kjs/debugger.h
532           Fix pedantic compile with some gcc versions (Merge from KDE)
533
534         * kjs/create_hash_table:
535           Fix build with Perl 5.8.0 (Merge from KDE)
536
537 2006-01-18  Darin Adler  <darin@apple.com>
538
539         Reviewed by Hyatt.
540
541         - hash table fixes needed for my WebCore changes
542
543         * kxmlcore/HashTable.h: (KXMLCore::HashTableConstIterator::operator=):
544         Added a missing return statement.
545
546         * kxmlcore/HashTraits.h: Fix traits so they work properly for classes where you
547         can't instantiate with a 0 by using traits rather than ? : to select the default
548         emtpy value of hash table keys.
549
550         - small cleanup of "runtime" code left over from recent JavaScript crash fix
551
552         * bindings/runtime_root.h:
553         (KJS::Bindings::RootObject::RootObject): No explicit initialization of _imp needed
554         since it's now a ProtectedPtr.
555         (KJS::Bindings::RootObject::setRootObjectImp): Remove old code that relied on the
556         fact that _imp was 0 and replaced with use of ProtectedPtr.
557         (KJS::Bindings::RootObject::rootObjectImp): Updated since _imp is a ProtectedPtr.
558
559 2006-01-17  Darin Adler  <darin@apple.com>
560
561         Reviewed by Anders.
562
563         - http://bugzilla.opendarwin.org/show_bug.cgi?id=6611
564           add assertions to check correct use of hash table iterators
565
566         * kxmlcore/HashTable.h:
567         (KXMLCore::addIterator): Added. Helper function that adds an iterator to the list
568         maintained by the specified hash table.
569         (KXMLCore::removeIterator): Added. Helper function that removes an iterator from
570         the list maintained by the hash table it's in.
571         (KXMLCore::HashTableConstIterator::HashTableConstIterator): Added a HashTable
572         parameter, ignored when not debugging. Call addIterator.
573         (KXMLCore::HashTableConstIterator::~HashTableConstIterator):
574         (KXMLCore::HashTableConstIterator::operator=): Call removeIterator.
575         (KXMLCore::HashTableConstIterator::operator*): Call checkValidity.
576         (KXMLCore::HashTableConstIterator::operator->): Ditto.
577         (KXMLCore::HashTableConstIterator::operator++): Ditto.
578         (KXMLCore::HashTableConstIterator::operator==): Ditto.
579         (KXMLCore::HashTableConstIterator::operator!=): Ditto.
580         (KXMLCore::HashTableConstIterator::checkValidity): Checks that the hash table
581         pointer is not 0 and if there are two iterators that both point at the same table.
582         (KXMLCore::HashTableIterator::HashTableIterator): Changed to use the const iterator
583         as an implementation detail, to avoid having two separate iterator implementations.
584         (KXMLCore::HashTableIterator::operator*): Ditto.
585         (KXMLCore::HashTableIterator::operator->): Ditto.
586         (KXMLCore::HashTableIterator::operator++): Ditto.
587         (KXMLCore::HashTableIterator::operator==): Ditto.
588         (KXMLCore::HashTableIterator::operator!=): Ditto.
589         (KXMLCore::HashTable::HashTable): Initialize pointer to head of iterators list.
590         (KXMLCore::HashTable::~HashTable): Added call to invalidateIterators.
591         (KXMLCore::HashTable::makeIterator): Pass this pointer.
592         (KXMLCore::HashTable::makeConstIterator): Ditto.
593         (KXMLCore::HashTable::insert): Call invalidateIterators, since this is a public
594         entry point that modifies the hash table.
595         (KXMLCore::HashTable::remove): Ditto.
596         (KXMLCore::HashTable::clear): Ditto.
597         (KXMLCore::HashTable::swap): Ditto.
598         (KXMLCore::HashTable::invalidateIterators): Added. Walks the iterators list and
599         clears out the table, next, and previous pointers in all of them, and then clears
600         the head so we have an empty list.
601         (KXMLCore::addIterator): Added. Adds the iterator the the linked list in the
602         passed-in table, and points the iterator at the table.
603         (KXMLCore::removeIterator): Added. Removes the iterator from the linked list in
604         the passed-in table.
605
606         * kxmlcore/HashTraits.h: A bit of tweaking and formatting.
607
608 2006-01-17  Justin Garcia  <justin.garcia@apple.com>
609
610         Reviewed by eric
611         
612         Deployment builds now use -O2
613
614         * JavaScriptCore.xcodeproj/project.pbxproj:
615
616 2006-01-17  Darin Adler  <darin@apple.com>
617
618         Reviewed by Anders.
619
620         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6610
621           change RefPtr so that it works when deref ends up deleting the RefPtr
622
623         * kxmlcore/PassRefPtr.h: Always set m_ptr before calling deref.
624         * kxmlcore/RefPtr.h: Ditto.
625
626 2006-01-16  Geoffrey Garen  <ggaren@apple.com>
627
628         Reviewed by darin.
629
630         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6322
631         DateProtoFuncImp::callAsFunction can crash due to lack of type checking
632
633         * kjs/date_object.cpp:
634         (KJS::DateProtoFunc::callAsFunction): Type check calls to all methods. 
635         This matches section 15.9.5 in the spec.
636
637 2006-01-16  Tim Omernick  <timo@apple.com>
638
639         Reviewed by John Sullivan.
640
641         JavaScriptCore part of <rdar://problem/4211707> NPAPI ref count behavior differs with Mozilla
642
643         * bindings/npruntime.cpp:
644         (_NPN_ReleaseObject):
645         Refactored part of this function out into _NPN_DeallocateObject.
646         (_NPN_DeallocateObject):
647         Forcibly deallocates the passed object, even if its refcount is
648         greater than zero.
649         
650         * bindings/npruntime_impl.h:
651         Declared _NPN_DeallocateObject().
652
653 2006-01-16  Darin Adler  <darin@apple.com>
654
655         Reviewed by Maciej.
656
657         - fix problem with ++, ==, and != on const iterators in
658           HashMaps that are using the pointer specialization
659
660         * kxmlcore/HashMapPtrSpec.h:
661         (KXMLCore::PointerHashConstIteratorAdapter::operator++): Change type to const_iterator.
662         (KXMLCore::PointerHashConstIteratorAdapter::operator==): Ditto.
663         (KXMLCore::PointerHashConstIteratorAdapter::operator!=): Ditto.
664
665 2006-01-15  Alexey Proskuryakov  <ap@nypop.com>
666
667         Reviewed by Anders.
668
669         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6561
670         run-javascriptcore-tests doesn't work
671
672         * JavaScriptCore/tests/mozilla/Getopt/Mixed.pm: 
673         Changed revision number to 1.8 (broken by svn migration).
674
675 2006-01-14  David Kilzer  <ddkilzer@kilzer.net>
676
677         Reviewed and landed by Anders.
678
679         * kjs/create_hash_table: Fixed comment typo.
680
681 2006-01-13  Maks Orlovich   <maksim@kde.org>
682
683         Mostly merging work by Peter Kelly. Reviewed by Maciej, landed by ap.
684
685         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6261
686         Misc. array object fixes from KJS
687
688         * kjs/array_object.cpp: Don't treat 2^32-1 as a real array index property.
689         (ArrayInstance::getOwnPropertySlot): Ditto.
690         (ArrayInstance::deleteProperty): Ditto.
691         (ArrayInstance::put): Ditto.
692         (ArrayInstance::propList): Added a FIXME comment.
693         (ArrayInstance::put): Throw exception on trying to set invalid array length.
694         (ArrayProtoFunc::callAsFunction): Do not use a separator argument when doing toString/toLocalString.
695         * kjs/array_object.h: Added MAX_ARRAY_INDEX.
696
697 2006-01-13  Darin Adler  <darin@apple.com>
698
699         - Replaced tabs with spaces in source files that had less than 10 lines with tabs.
700         - Set allow-tabs Subversion property in source files that have more than 10 lines with tabs.
701
702 2006-01-13  Anders Carlsson  <andersca@mac.com>
703
704         Reviewed by Eric.
705
706         * kjs/create_hash_table:
707         Use correct size variables.
708
709 2006-01-13  Anders Carlsson  <andersca@mac.com>
710
711         Reviewed by Darin.
712
713         * kjs/create_hash_table:
714         Don't create an empty entry array, instead add a entry with all fields
715         set to null and set the hash table size to 1.
716         
717         * kjs/lookup.cpp:
718         (findEntry):
719         Remove the hash table size check
720
721 2006-01-12  Anders Carlsson  <andersca@mac.com>
722
723         Reviewed by Maciej.
724
725         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6494
726         Crash when assigning a new function to a DOMParser object
727         
728         * JavaScriptCore.xcodeproj/project.pbxproj:
729         Move lookup.cpp before lookup.h
730         
731         * kjs/lookup.cpp:
732         (findEntry):
733         If the hash table is empty, return 0 early.
734
735 2006-01-12  George Staikos <staikos@kde.org>
736
737         Reviewed by Darin.
738
739         * kjs/interpreter.cpp:
740         * kjs/testkjs.cpp:
741         * kjs/interpreter.h:
742         Add helper to interpreter to call the collector in order to facilitate
743         visibility rules in KDE.
744
745 2006-01-12  George Staikos <staikos@kde.org>
746
747         Reviewed by Maciej.
748
749         * kjs/kjs.pro: Updates to build the whole thing on Linux at least.
750
751         * kxmlcore/HashTable.h: Add missing assert.h
752
753 2006-01-12  Darin Adler  <darin@apple.com>
754
755         Reviewed by Geoff.
756
757         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6505
758           retire APPLE_CHANGES from JavaScriptCore
759
760         * JavaScriptCore.xcodeproj/project.pbxproj: Removed both
761         APPLE_CHANGES and HAVE_CONFIG_H from all targets.
762
763         * README: Removed. This had obsolete information in it
764         and it wasn't clear what to replace it with.
765
766         * kjs/collector.h: Removed an APPLE_CHANGES if around something
767         that's not really platform-specific (although it does use a
768         platform-specific API at the moment).
769         * kjs/collector.cpp: Removed a mistaken comment.
770
771         * kjs/grammar.y:
772         * kjs/internal.cpp:
773         * kjs/object.h:
774         * kjs/operations.cpp:
775         * kjs/operations.h:
776         * kjs/ustring.h:
777         Use __APPLE__ instead of APPLE_CHANGES for code that should be
778         used only on Mac OS X.
779
780         * kjs/interpreter.cpp: Removed APPLE_CHANGES ifdef around the include
781         of the runtime.h header. Even though that header isn't needed at the
782         moment on platforms other than Mac OS X, the conditional stuff should
783         be in the header itself, not in this one client.
784
785         * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed some
786         code inside APPLE_CHANGES. I'm pretty sure this code isn't needed on
787         any platform where pow is implemented corrrectly according to the IEEE
788         standard. If it is needed on some, we can add it back with an appropriate
789         #if for the platforms where it is needed.
790
791 2006-01-12  Justin Haygood  <justin@xiondigital.net>
792
793         Reviewed, tweaked, and landed by Darin.
794
795         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6416
796           lexer.cpp, grammar.y protect include of config.h with "HAVE_CONFIG_H"
797
798         * kjs/dtoa.cpp: Removed HAVE_CONFIG_H, changed config.h to use
799         quotes instead of angle brackets. Moved dtoa.h include to the top.
800         Changed system header includes to use angle brackets instead of quotes.
801         * kjs/grammar.y: Removed HAVE_CONFIG_H, changed config.h to use
802         quotes instead of angle brackets.
803         * kjs/lexer.cpp: Removed HAVE_CONFIG_H, changed config.h to use
804         quotes instead of angle brackets. Moved lexer.h include to the top.
805         * kjs/ustring.cpp: Removed HAVE_CONFIG_H, changed config.h to use
806         quotes instead of angle brackets. Moved ustring.h include to the top.
807
808 2006-01-12  George Staikos <staikos@kde.org>
809
810         Reviewed by Maciej
811
812         - Import initial QMake file.  Doesn't fully work yet.
813
814 2006-01-11  Ricci Adams  <ricciadams@apple.com>
815
816         Reviewed by Maciej and Darin, landed by Darin.
817
818         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5939
819           final comma in javascript object prevents parsing
820
821         * kjs/grammar.y: Added rule to allow trailing comma in
822         object construction.
823
824 2006-01-11  Ricci Adams  <ricciadams@apple.com>
825
826         Reviewed by Geoff, landed by Darin.
827
828         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5308
829           Number.toFixed doesn't include leading 0
830
831         * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
832         Fixed a "<" that should have been a "<=".
833
834 2006-01-11  Ricci Adams  <ricciadams@apple.com>
835
836         Reviewed by Geoff, landed by Darin.
837
838         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5307
839           Number.toFixed doesn't round 0.5 up
840
841         * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
842         Fixed a ">" that should have been a ">=".
843
844 2006-01-11  Justin Haygood  <justin@xiondigital.net>
845
846         Reviewed and landed by Darin.
847
848         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6486
849           JavaScriptCore should use system malloc on Windows
850
851         * kjs/config.h: Add USE_SYSTEM_MALLOC to the Win32 section.
852
853 2006-01-10  Darin Adler  <darin@apple.com>
854
855         * Makefile: Took out unneeded "export" line.
856         * <many-files>: Changed a lot of flags (cleared bogus executable bits, set
857           MIME types, other small corrections).
858
859 2006-01-09  Darin Adler  <darin@apple.com>
860
861         * Makefile.am: Removed.
862
863 2006-01-07  Anders Carlsson  <andersca@mac.com>
864
865         Reviewed by Maciej.
866         
867         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6373
868         REGRESSION: JavaScript hang when comparing large array to null
869         
870         * kjs/object.h:
871         (KJS::JSObject::isEqualToNull):
872         Add new function which returns true if an object should be treated as null when
873         doing comparisons.
874         
875         * kjs/operations.cpp:
876         (KJS::equal):
877         Use isEqualToNull.
878
879 2006-01-07  Alexey Proskuryakov  <ap@nypop.com>
880
881         Reviewed by Maciej.
882
883         - Fix WebCore development build
884         http://bugzilla.opendarwin.org/show_bug.cgi?id=6408
885
886         * kxmlcore/Assertions.h: Use __VA_ARGS__ in variadic macros.
887
888 2006-01-06  Maciej Stachowiak  <mjs@apple.com>
889
890         Reviewed by Darin.
891
892         - miscellaneous changes for 4% speedup on the JavaScript iBench
893         http://bugzilla.opendarwin.org/show_bug.cgi?id=6396
894         
895         Changes mostly thanks to Maks Orlovich, tweaked a little by me.
896
897         * kjs/create_hash_table: Use the same hash as the one used by Identifier.
898         * kjs/function.cpp:
899         (KJS::FunctionImp::processParameters): Use the new List::copyFrom
900         (KJS::ActivationImp::ActivationImp): track variable while iterating
901         * kjs/internal.cpp:
902         (KJS::StringImp::toObject): create StringInstance directly
903         * kjs/list.cpp:
904         (KJS::List::copy): implement in terms of copyFrom
905         (KJS::List::copyFrom): more efficient way to copy in another list
906         * kjs/list.h:
907         * kjs/lookup.cpp:
908         (keysMatch): updated to work with identifier hash
909         (findEntry): ditto
910         (Lookup::findEntry): ditto
911         (Lookup::find): ditto
912         * kjs/lookup.h:
913
914 2006-01-06  Maciej Stachowiak  <mjs@apple.com>
915
916         - fix development build failure from the previous checkin
917
918         * kjs/function.cpp:
919         (KJS::ActivationImp::put): Use prototype() accessor in assert.
920
921 2006-01-05  Maciej Stachowiak  <mjs@apple.com>
922
923         Reviewed by Eric.
924
925         - fix remaining performance regression from Getter/Setter change
926         http://bugzilla.opendarwin.org/show_bug.cgi?id=6249
927
928         - Activation objects should not have __proto__ property
929         http://bugzilla.opendarwin.org/show_bug.cgi?id=6395
930
931         * kjs/function.cpp:
932         (KJS::ActivationImp::getOwnPropertySlot): Implement directly, thus
933         skipping getter/setter handling and __proto__ handling, as well
934         as inlining needed superclass stuff.
935         (KJS::ActivationImp::put): Implement directly, skipping getter/setter,
936         __proto__, and do canPut directly in PropertyMap::put since there's no
937         static property table either.
938         * kjs/function.h:
939         * kjs/property_map.cpp:
940         (KJS::PropertyMap::put): Allow optionally inlining canPut check.
941         * kjs/property_map.h:
942
943 2006-01-04  Geoffrey Garen  <ggaren@apple.com>
944
945         Patch by kimmo.t.kinnunen@nokia.com, reviewed by darin, tweaked by me.
946
947         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4921
948         \u escape sequences in JavaScript identifiers
949
950         * kjs/function_object.cpp:
951         (FunctionObjectImp::construct):
952         * kjs/lexer.cpp:
953         (Lexer::shift):
954         (Lexer::lex):
955         (Lexer::isWhiteSpace):
956         (Lexer::isLineTerminator):
957         (Lexer::isIdentStart):
958         (Lexer::isIdentPart):
959         (isDecimalDigit):
960         (Lexer::scanRegExp):
961         * kjs/lexer.h:
962         (KJS::Lexer::):
963
964         * tests/mozilla/expected.html: Updated test results.
965
966 2005-12-30  Maciej Stachowiak  <mjs@apple.com>
967
968         No review, just test result update.
969
970         * tests/mozilla/expected.html: Updated for newly passing test from recent fixes.
971
972 2005-12-30  Anders Carlsson  <andersca@mac.com>
973
974         Reviewed by Maciej.
975
976         - Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6298
977         Getter setter test is failing
978                 
979         * kjs/object.cpp:
980         (KJS::JSObject::put):
981         Rework the getter setter part. We now walk the prototype chain, checking for
982         getter/setter properties and only take the slow path if any are found. 
983
984 2005-12-30  Maks Orlovich <maksim@kde.org>
985
986         Reviewed and committed by Maciej.
987
988         - Handle negative, FP numbers with non-10 radix in toString
989         http://bugzilla.opendarwin.org/show_bug.cgi?id=6259
990
991         (Merged from KJS, original work by Harri Porten)
992         
993         * kjs/number_object.cpp:
994         (NumberProtoFunc::callAsFunction): rewrote Number.toString(radix) to work with  
995         negative numbers, floating point and very large numbers.
996
997 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
998
999         Patch by Maks Orlovich, reviewed and landed by me.
1000
1001         - http://bugzilla.opendarwin.org/show_bug.cgi?id=6267
1002         Fix Number.prototype.toFixed/toExponential(undefined)
1003
1004         * kjs/number_object.cpp:
1005         (NumberProtoFunc::callAsFunction):
1006
1007 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
1008
1009         Patch by Maks Orlovich, Reviewed and landed by me.
1010
1011         - http://bugzilla.opendarwin.org/show_bug.cgi?id=6266
1012         Minor object naming updates (to match Mozilla, KJS)
1013
1014         * kjs/number_object.cpp:
1015         * kjs/regexp_object.cpp:
1016
1017 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
1018
1019         Patch by Maks Orlovich, reviewed by mjs.
1020
1021         This has 2 very minor fixes, covered by KJS testsuite:    
1022         1. Enumerates string indices in property list (with the same bug as array    
1023            object has in corresponding code). This is a mozilla emulation thing. 
1024         2. Permits properties with integer names in prototypes to be found    
1025
1026         * kjs/string_object.cpp:
1027         (StringInstance::getOwnPropertySlot):
1028         (StringInstanceImp::propList):
1029         * kjs/string_object.h:
1030
1031 2005-12-26  Geoffrey Garen  <ggaren@apple.com>
1032
1033         Reviewed by mjs.
1034
1035         - Fixed <rdar://problem/4364705> run-javascriptcore-tests crashes in 
1036         KJS::BlockNode::deref 
1037         AKA 
1038         http://bugzilla.opendarwin.org/show_bug.cgi?id=6233
1039         Reproducible stack-overflow crash in ~RefPtr<T> due to RefPtr<T> use in 
1040         linked lists
1041
1042         This patch does four things: 
1043         (1) Standardizes all our linked list nodes to use "next" as their next 
1044         pointers. 
1045         (2) Creates the ListRefPtr<T> class, a subclass of RefPtr<T> specialized
1046         to iteratively deref "next" pointers.
1047         (3) Standardizes our linked list nodes to use ListRefPtr<T> and 
1048         implement the releaseNext() function used by ~ListRefPtr<T>().
1049         (4) Adds to RefPtr<T> the release() method used by releaseNext().
1050
1051         - Modified existing mozilla test to ensure it would make deployment 
1052         builds crash as well.
1053
1054         * JavaScriptCore.xcodeproj/project.pbxproj:
1055         * kjs/nodes.cpp:
1056         (ElementNode::evaluate):
1057         (PropertyListNode::evaluate):
1058         (ArgumentListNode::evaluateList):
1059         (StatListNode::StatListNode):
1060         (StatListNode::execute):
1061         (StatListNode::processVarDecls):
1062         (VarDeclListNode::evaluate):
1063         (VarDeclListNode::processVarDecls):
1064         (VarStatementNode::execute):
1065         (VarStatementNode::processVarDecls):
1066         (BlockNode::BlockNode):
1067         (CaseClauseNode::evalStatements):
1068         (CaseClauseNode::processVarDecls):
1069         (ClauseListNode::processVarDecls):
1070         (CaseBlockNode::CaseBlockNode):
1071         (CaseBlockNode::evalBlock):
1072         (SourceElementsNode::SourceElementsNode):
1073         (SourceElementsNode::execute):
1074         (SourceElementsNode::processFuncDecl):
1075         (SourceElementsNode::processVarDecls):
1076         * kjs/nodes.h:
1077         (KJS::ElementNode::ElementNode):
1078         (KJS::ElementNode::releaseNext):
1079         (KJS::ArrayNode::ArrayNode):
1080         (KJS::PropertyListNode::PropertyListNode):
1081         (KJS::PropertyListNode::releaseNext):
1082         (KJS::ObjectLiteralNode::ObjectLiteralNode):
1083         (KJS::ArgumentListNode::ArgumentListNode):
1084         (KJS::ArgumentListNode::releaseNext):
1085         (KJS::ArgumentsNode::ArgumentsNode):
1086         (KJS::StatListNode::releaseNext):
1087         (KJS::VarDeclListNode::VarDeclListNode):
1088         (KJS::VarDeclListNode::releaseNext):
1089         (KJS::VarStatementNode::VarStatementNode):
1090         (KJS::ForNode::ForNode):
1091         (KJS::CaseClauseNode::CaseClauseNode):
1092         (KJS::ClauseListNode::ClauseListNode):
1093         (KJS::ClauseListNode::getClause):
1094         (KJS::ClauseListNode::getNext):
1095         (KJS::ClauseListNode::releaseNext):
1096         (KJS::ParameterNode::ParameterNode):
1097         (KJS::ParameterNode::releaseNext):
1098         (KJS::SourceElementsNode::releaseNext):
1099         * kjs/nodes2string.cpp:
1100         (ElementNode::streamTo):
1101         (PropertyListNode::streamTo):
1102         (ArgumentListNode::streamTo):
1103         (StatListNode::streamTo):
1104         (VarDeclListNode::streamTo):
1105         (VarStatementNode::streamTo):
1106         (CaseClauseNode::streamTo):
1107         (ClauseListNode::streamTo):
1108         (CaseBlockNode::streamTo):
1109         (SourceElementsNode::streamTo):
1110         * kxmlcore/ListRefPtr.h: Added.
1111         (KXMLCore::ListRefPtr::ListRefPtr):
1112         (KXMLCore::ListRefPtr::~ListRefPtr):
1113         (KXMLCore::ListRefPtr::operator=):
1114         * kxmlcore/RefPtr.h:
1115         (KXMLCore::RefPtr::release):
1116
1117 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
1118
1119         Reviewed by mjs.
1120
1121         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4026
1122         Math.random() not seeded.
1123
1124         Added call to sranddev() -- it executes the first time a process
1125         calls Math.random().
1126
1127         * kjs/math_object.cpp:
1128         (MathFuncImp::callAsFunction):
1129
1130 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
1131
1132         Reviewed by darin.
1133
1134         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6265
1135         Name change regression: Java doesn't know what JavaJSObject is
1136
1137         Changed strings passed to Java back to original "JSObject".
1138
1139         * bindings/jni/jni_jsobject.cpp:
1140         (JavaJSObject::convertValueToJObject):
1141         (JavaJSObject::convertJObjectToValue):
1142
1143 2005-12-28  Anders Carlsson  <andersca@mac.com>
1144
1145         Reviewed by Maciej.
1146
1147         - The JSC part of http://bugzilla.opendarwin.org/show_bug.cgi?id=6268
1148         Add undetectable document.all
1149         
1150         * kjs/operations.cpp:
1151         (KJS::equal):
1152         When comparing an object with null or undefined, call toPrimitive with 
1153         NullType as the preferred type.
1154
1155 2005-12-27  Anders Carlsson  <andersca@mac.com>
1156
1157         Reviewed by Darin.
1158
1159         * kjs/array_object.cpp:
1160         (ArrayProtoFunc::callAsFunction):
1161         Implement filter and map. Also, make the existing
1162         array iteration functions not invoke the callback for
1163         non-existing properties, just as Mozilla does now.
1164         
1165         * kjs/array_object.h:
1166         (KJS::ArrayProtoFunc::):
1167         Add filter and map.
1168         
1169         * tests/mozilla/expected.html:
1170         Update, two 1.6 tests now pass.
1171
1172 2005-12-27  Maciej Stachowiak  <mjs@apple.com>
1173
1174         - updated test results for new JS 1.6 tests
1175
1176         * tests/mozilla/expected.html:
1177
1178 2005-12-27  Anders Carlsson  <andersca@mac.com>
1179
1180         Reviewed by Maciej.
1181
1182         Add Mozilla JS 1.6 tests.
1183         
1184         * tests/mozilla/js1_6/Array/browser.js: Added.
1185         * tests/mozilla/js1_6/Array/regress-290592.js: Added.
1186         * tests/mozilla/js1_6/Array/regress-304828.js: Added.
1187         * tests/mozilla/js1_6/Array/regress-305002.js: Added.
1188         * tests/mozilla/js1_6/Array/regress-310425-01.js: Added.
1189         * tests/mozilla/js1_6/Array/regress-310425-02.js: Added.
1190         * tests/mozilla/js1_6/Array/regress-320887.js: Added.
1191         * tests/mozilla/js1_6/Array/shell.js: Added.
1192         * tests/mozilla/js1_6/README: Added.
1193         * tests/mozilla/js1_6/Regress/browser.js: Added.
1194         * tests/mozilla/js1_6/Regress/regress-301574.js: Added.
1195         * tests/mozilla/js1_6/Regress/regress-309242.js: Added.
1196         * tests/mozilla/js1_6/Regress/regress-311157-01.js: Added.
1197         * tests/mozilla/js1_6/Regress/regress-311157-02.js: Added.
1198         * tests/mozilla/js1_6/Regress/regress-314887.js: Added.
1199         * tests/mozilla/js1_6/Regress/regress-320172.js: Added.
1200         * tests/mozilla/js1_6/Regress/shell.js: Added.
1201         * tests/mozilla/js1_6/String/browser.js: Added.
1202         * tests/mozilla/js1_6/String/regress-306591.js: Added.
1203         * tests/mozilla/js1_6/String/shell.js: Added.
1204         * tests/mozilla/js1_6/browser.js: Added.
1205         * tests/mozilla/js1_6/shell.js: Added.
1206         * tests/mozilla/js1_6/template.js: Added.
1207
1208 2005-12-27  Maks Orlovich <maksim@kde.org>
1209
1210         Reviewed and landed by Maciej.
1211
1212         - fixed 6234: Can delete array index property incorrectly.
1213         http://bugzilla.opendarwin.org/show_bug.cgi?id=6234
1214
1215         * kjs/array_object.cpp:
1216         (ArrayInstance::deleteProperty): use toArrayIndex instead of toUInt32 when
1217         looking for array properties.
1218
1219 2005-12-27  Anders Carlsson  <andersca@mac.com>
1220
1221         Reviewed by Maciej.
1222
1223         * kjs/object.cpp:
1224         (KJS::JSObject::defineSetter):
1225         Remove duplicate call to putDirect.
1226
1227 2005-12-26  Maciej Stachowiak  <mjs@apple.com>
1228
1229         Reviewed by Darin and Geoff.
1230
1231         Changes by me and Anders.
1232
1233         - mostly fixed REGRESSION: 5-10% performance regression on JS iBench from getter/setter change
1234         http://bugzilla.opendarwin.org/show_bug.cgi?id=6083
1235
1236         - also fixed some warnings reported by -Winline
1237         
1238         * JavaScriptCorePrefix.h: Move new and delete definitions higher so there
1239         aren't conflicts with use in standard C++ headers
1240         * kjs/object.cpp:
1241         (KJS::throwSetterError): Moved this piece of put into a seprate function
1242         to avoid the PIC branch.
1243         (KJS::JSObject::put): Use hasGetterSetterProperties to avoid expensive stuff
1244         when not needed. Also use GetterSetter properties attribute.
1245         (KJS::JSObject::deleteProperty): Recompute whether any properties are getter/setter
1246         properties any more, if this one was one.
1247         (KJS::JSObject::defineGetter): Let the PropertyMap know that it has getter/setter
1248         properties now (and use the new attribute).
1249         (KJS::JSObject::defineSetter): Ditto.
1250         (KJS::JSObject::fillGetterPropertySlot): Out-of-line helper for getOwnPropertySlot,
1251         to avoid global variable access in the hot code path.
1252         * kjs/object.h:
1253         (KJS::): Added GetterSetter attribute.
1254         (KJS::JSCell::isObject): Moved lower to be after inline methods it uses.
1255         (KJS::JSValue::isObject): ditto
1256         (KJS::JSObject::getOwnPropertySlot): try to avoid impact of getters and setters
1257         as much as possible in the case where they are not being used
1258         * kjs/property_map.cpp:
1259         (KJS::PropertyMap::containsGettersOrSetters): New method to help with this
1260         * kjs/property_map.h:
1261         (KJS::PropertyMap::hasGetterSetterProperties): Ditto
1262         (KJS::PropertyMap::setHasGetterSetterProperties): Ditto
1263         (KJS::PropertyMap::PropertyMap): Added a crazy hack to store the
1264         global "has getter/setter properties" flag in the property map
1265         single entry, to avoid making objects any bigger.
1266         * kjs/value.h: Moved some things to object.h to make -Winline happier
1267
1268 2005-12-24  Maciej Stachowiak  <mjs@apple.com>
1269
1270         Reviewed by Eric and Dave Hyatt.
1271
1272         - make even const PassRefPtrs give transfer of ownership semantics
1273         http://bugzilla.opendarwin.org/show_bug.cgi?id=6238
1274         
1275         This is a somewhat cheesy change. Having to use PassRefPtr_Ref creates ambiguities
1276         in assignment and copy construction. And this makes life way easier and removes
1277         the need for pass(). It is not really correct, but we pretty much never need a real
1278         const PassRefPtr, and this takes care of things for PassRefPtr temporaries.
1279         
1280         * kjs/identifier.cpp:
1281         (KJS::Identifier::add): No more need for pass()
1282         * kjs/property_map.cpp:
1283         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): No more need for pass()
1284         * kjs/ustring.cpp:
1285         (KJS::UString::Rep::create): Use adoptRef
1286         (KJS::UString::UString): No more need for pass
1287         (KJS::UString::append): No more need for pass
1288         (KJS::UString::substr): No more need for pass
1289         * kxmlcore/PassRefPtr.h: made m_ptr mutable (ugh)
1290         (KXMLCore::PassRefPtr::PassRefPtr): Take a const PassRefPtr reference
1291         (KXMLCore::PassRefPtr::release): Made this a const method (ugh)
1292         (KXMLCore::PassRefPtr::operator=): clean up appropriately
1293         (KXMLCore::adoptRef): Added this to use instead of PassRefPtr<T>::adopt, I think
1294         it makes the behavior more clear and it is less verbose.
1295         (KXMLCore::static_pointer_cast): use adoptRef
1296         (KXMLCore::const_pointer_cast): use adoptRef
1297         * kxmlcore/RefPtr.h:
1298         (KXMLCore::RefPtr::RefPtr): take const PassRefPtr&
1299         (KXMLCore::PassRefPtr::operator=): take const PassRefPtr&
1300
1301 2005-12-25  Eric Seidel  <eseidel@apple.com>
1302
1303         Reviewed by mjs.
1304
1305         Unbreak HashTableConstIterator++ by returning const_iterator
1306
1307         * kxmlcore/HashTable.h:
1308         (KXMLCore::HashTableConstIterator::operator++): use const_iterator
1309
1310 2005-12-25  Eric Seidel  <eseidel@apple.com>
1311
1312         Reviewed by mjs.
1313
1314         Un-break HashTable copy constructor.
1315
1316         * kxmlcore/HashTable.h:
1317         (KXMLCore::::HashTable): use const_iterator instead
1318
1319 2005-12-23  Maciej Stachowiak  <mjs@apple.com>
1320
1321         Reviewed by Eric.
1322
1323         - fixed "HashMap does not work with const pointer keys or values"
1324         http://bugzilla.opendarwin.org/show_bug.cgi?id=6222
1325         
1326         * kxmlcore/HashMapPtrSpec.h:
1327         (KXMLCore::HashMap): In all methods, explicitly cast all pointers
1328         to void * before passing to internal implementation. Use C-style
1329         casts instead of new-style casts, because the real solution would
1330         require a combo of reinterpret_cast anc const_cast.
1331
1332
1333 2005-12-23  Maciej Stachowiak  <mjs@apple.com>
1334
1335         - this time for sure
1336
1337         * kxmlcore/RefPtr.h:
1338         (KXMLCore::::swap):
1339
1340 2005-12-22  Maciej Stachowiak  <mjs@apple.com>
1341
1342         - fix build problem from last commit.
1343
1344         * kxmlcore/RefPtr.h:
1345         (KXMLCore::::swap):
1346
1347 2005-12-21  Maciej Stachowiak  <mjs@apple.com>
1348
1349         Reviewed by Darin.
1350
1351         - Make HashMap/HashSet support non-POD types
1352         http://bugzilla.opendarwin.org/show_bug.cgi?id=5332
1353
1354         The changes for support are relatively simple, but I also made extensive changes to
1355         avoid copying, so that there isn't refcount thrash when you put RefPtrs into a HashMap.
1356
1357         * kxmlcore/HashTable.h:
1358         (KXMLCore::swap): specialize swap for pairs, to swap elements individually,
1359         so that excess copies can be avoided.
1360         (KXMLCore::Mover::move): Template function to either copy or swap, used
1361         when transferring elements from old table to new.
1362         (KXMLCore::IdentityHashTranslator::hash): The old "converting lookup" templates
1363         that took two or three function parameters now take a class parameter, this is
1364         the class used to do a normal lookup.
1365         (KXMLCore::IdentityHashTranslator::equal): Ditto.
1366         (KXMLCore::IdentityHashTranslator::translate): Ditto. Translate now takes a reference
1367         to write into instead of returning a value to avoid redundant copies.
1368         (KXMLCore::HashTable::~HashTable): Use deallocateTable instead of freeing directly.
1369         (KXMLCore::HashTable::insert): Based on HashTranslator now instead of separate
1370         functions. Added a FIXME about a remaining rare excess copy.
1371         (KXMLCore::HashTable::isEmptyBucket): Use KeyTraits directly instead of unwrapping
1372         the key from Traits, to avoid creating and destroying pair, which copies.
1373         (KXMLCore::HashTable::isDeletedBucket): ditto
1374         (KXMLCore::HashTable::lookup): Use HashTranslator now instead of separate functions.
1375         (KXMLCore::HashTable::initializeBucket): Renamed from emptyBucket. Use placement new to
1376         work right for non-POD types.
1377         (KXMLCore::HashTable::deleteBucket): Use assignDeleted to avoid excess copies.
1378         (KXMLCore::HashTable::reinsert): use Mover template to copy or swap as appropriate
1379         (KXMLCore::HashTable::allocateTable): Initialize every bucket if calloc won't do.
1380         (KXMLCore::HashTable::deallocateTable): Destruct every bucket if needed.
1381         (KXMLCore::HashTable::rehash): Avoid copy before reinserting, so that swap can do its magic.
1382         (KXMLCore::HashTable::clear): use deallocateTable instead of freeing directly.
1383         (KXMLCore::HashTable::HashTable): be more dumb when copying to ensure that non-POD types
1384         work right
1385         * kxmlcore/HashFunctions.h:
1386         (KXMLCore::PointerHash): Specialize PointerHash for RefPtr
1387         * kxmlcore/HashMap.h:
1388         (KXMLCore::extractFirst): Return a reference not a full object to avoid
1389         copies.
1390         (KXMLCore::HashMapTranslator::hash): Use a special translator for insertion
1391         to defer making the pair as long as possible, thus avoiding needless copies.
1392         (KXMLCore::HashMapTranslator::equal): ditto
1393         (KXMLCore::HashMapTranslator::translate): ditto
1394         (KXMLCore::::inlineAdd): Shared by set and add to insert using HashMapTranslator
1395         (KXMLCore::::set): Use inlineAdd
1396         (KXMLCore::::add): Use inlineAdd
1397         * kxmlcore/HashMapPtrSpec.h:
1398         (KXMLCore::): Pass KeyTraits along
1399         * kxmlcore/HashSet.h:
1400         (KXMLCore::identityExtract): Return a reference not a full object to avoid copies.
1401         (KXMLCore::HashSetTranslatorAdapter::hash): Redo adapter stuff to work with
1402         the new HashTranslator approach.
1403         (KXMLCore::HashSetTranslatorAdapter::equal): ditto
1404         (KXMLCore::HashSetTranslatorAdapter::translate): ditto
1405         (KXMLCore::::insert): ditto
1406         * kxmlcore/HashTraits.h:
1407         (KXMLCore::GenericHashTraits): This is intended be used as a base class for
1408         customized traits: sensible defaults.
1409         (KXMLCore::): Use it a bunch
1410         (KXMLCore::assignDeleted): template function to allow pairs to be assigned the
1411         deleted value w/o excess copies.
1412         (KXMLCore::PairHashTraits::emptyValue): Updated
1413         (KXMLCore::PairHashTraits::deletedValue): Updated
1414         (KXMLCore::PairHashTraits::assignDeletedValue): part of assignDeleted hack
1415         (KXMLCore::DeletedValueAssigner::assignDeletedValue): Use template magic
1416         to either use use deletedValue or assignDeletedValue for the cases where we care.
1417         * kxmlcore/RefPtr.h:
1418         (KXMLCore::RefPtr::swap): Added swap method.
1419         (KXMLCore::swap): Added swap free function.
1420         * kjs/identifier.cpp:
1421         (KJS::CStringTranslator::hash): Use new HashTranslator class approach to
1422         alternate type based insertion.
1423         (KJS::CStringTranslator::equal): ditto
1424         (KJS::CStringTranslator::translate): ditto
1425         (KJS::Identifier::add): ditto
1426         (KJS::UCharBufferTranslator::hash): ditto
1427         (KJS::UCharBufferTranslator::equal): ditto
1428         (KJS::UCharBufferTranslator::translate): ditto
1429
1430         - irrelevant change:
1431         
1432         * kjs/array_object.cpp:
1433         (ArrayProtoFunc::callAsFunction): Removed a stray space.
1434
1435 2005-12-22  Anders Carlsson  <andersca@mac.com>
1436
1437         Reviewed by Eric and Darin.
1438
1439         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6196
1440         Would like to be able to define prototypes in headers
1441         
1442         * kjs/lookup.h:
1443         Move ClassName from KJS_DECLARE_PROTOTYPE to KJS_IMPLEMENT_PROTOTYPE.
1444         Also, namespace all macros by prefixing them with KJS_. 
1445
1446 2005-12-22  Darin Adler  <darin@apple.com>
1447
1448         Reviewed by Maciej.
1449
1450         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6191
1451           RefPtr/PassRefPtr have a leak issue, operator== issues
1452
1453         * kxmlcore/PassRefPtr.h:
1454         (KXMLCore::PassRefPtr::PassRefPtr): Remove non-template constructor that takes RefPtr
1455         since the constructor template that takes RefPtr should be sufficient. Add a constructor
1456         template that takes PassRefPtr&.
1457         (KXMLCore::PassRefPtr::adopt): Use PassRefPtr_Ref to avoid setting pointer first to
1458         0 and then to the pointer.
1459         (KXMLCore::PassRefPtr::operator=): Added template versions that take PassRefPtr& and
1460         RefPtr parameters.
1461         (KXMLCore::PassRefPtr::operator PassRefPtr<U>): Changed to fix leak -- old version
1462         would release and then ref.
1463         (KXMLCore::operator==): Make templates have two parameters so you can mix types.
1464         Also remove unneeded const in raw pointer versions.
1465         (KXMLCore::operator!=): Ditto.
1466
1467         * kxmlcore/RefPtr.h:
1468         (KXMLCore::RefPtr::RefPtr): Add constructor template that takes PassRefPtr.
1469         (KXMLCore::RefPtr::operator=): Add assignment operator templates that take
1470         RefPtr and PassRefPtr.
1471         (KXMLCore::operator==): Make templates have two parameters so you can mix types.
1472         Also remove unneeded const in raw pointer versions.
1473         (KXMLCore::operator!=): Ditto.
1474
1475 2005-12-21  Timothy Hatcher  <timothy@apple.com>
1476
1477         * JavaScriptCore.xcodeproj/project.pbxproj:
1478           Set tab width to 8, indent width to 4 and uses tabs to false per file.
1479
1480 2005-12-21  Geoffrey Garen  <ggaren@apple.com>
1481
1482         Reviewed by Darin.
1483
1484         Removed evil hack for determining if a type is an integer, replaced
1485         with template metaprogramming.
1486
1487         * JavaScriptCore.xcodeproj/project.pbxproj: Set tab size to 2 for
1488         testkjs.cpp
1489         * kjs/testkjs.cpp:
1490         (main): Inserted asserts to test IsInteger. FIXME: Move these to
1491         KXMLCore unit tests directory when we create one.
1492         * kxmlcore/HashTraits.h:
1493         (KXMLCore::): Added IsInteger class for querying types.
1494
1495 2005-12-20  Maciej Stachowiak  <mjs@apple.com>
1496
1497         Reviewed by Darin.
1498
1499         - made ALWAYS_INLINE declare things inline as well as __attribute__((always_inline))
1500         http://bugzilla.opendarwin.org/show_bug.cgi?id=6159
1501
1502         * kxmlcore/AlwaysInline.h:
1503
1504 2005-12-19  Maciej Stachowiak  <mjs@apple.com>
1505
1506         Reviewed by Darin.
1507
1508         - fixed a leak in the assignment operator from PassRefPtr to RefPtr
1509         http://bugzilla.opendarwin.org/show_bug.cgi?id=6158
1510
1511         * kxmlcore/RefPtr.h:
1512         (KXMLCore::RefPtr::operator=):
1513
1514         - fix problem with PassRefPtr that darin spotted - it lacked a copy constructor
1515         and therefore was using the default one, which can lead to excess derefs
1516
1517         I fixed this by adding a copy constructor from non-const
1518         reference, and by adding a template pass() function that you have
1519         to use when raw pointer or RefPtr are passed where PassRefPtr is
1520         expected.
1521
1522         * kjs/identifier.cpp:
1523         (KJS::Identifier::add): Changed to have PassRefPtr return type and
1524         pass() the results.     
1525         * kjs/identifier.h:
1526         * kjs/property_map.cpp:
1527         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): Use pass()
1528         where required.
1529         * kjs/ustring.cpp:
1530         (KJS::UString::UString): Use pass() as needed.
1531         (KJS::UString::append): ditto
1532         (KJS::UString::substr): ditto
1533         * kjs/ustring.h:
1534         (KJS::UString::UString): Use initializer instead of assignment
1535         * kxmlcore/PassRefPtr.h:
1536         (KXMLCore::PassRefPtr::PassRefPtr): Added copy constructor
1537         (KXMLCore::pass): new template function to make it convenient to pass
1538         a PassRefPtr
1539
1540 2005-12-19  Geoffrey Garen  <ggaren@apple.com>
1541   
1542         Reviewed by Maciej.
1543
1544         Fixed <rdar://problem/4370397> Missing return statement in
1545         JSMethodNameToObjcMethodName.
1546
1547         JSMethodNameToObjcMethodName had a check for a name being too long, but
1548         the check was missing a return statement.
1549
1550         A lot of this code was confusing and some of it was wrong, so I fixed
1551         it up, added some asserts to catch this type of bug in the future, 
1552         changed some comments, and renamed some variables.
1553
1554         The two advantages of the new algorithm are (1) It makes writing past
1555         the end of the buffer virtually impossible because the test on the main
1556         loop is "while (not past end of buffer)" and (2) It's twice as fast
1557         because it doesn't call strlen. (There's no need to call strlen when
1558         we're walking the string ourselves.) 
1559         
1560         methodsNamed also supports arbitrary-length method names now. Just in 
1561         case the AppKit folks start getting REALLY verbose...
1562
1563         * bindings/objc/objc_class.mm:
1564         (KJS::Bindings::ObjcClass::methodsNamed):
1565         * bindings/objc/objc_utility.h:
1566         * bindings/objc/objc_utility.mm:
1567         (KJS::Bindings::JSMethodNameToObjcMethodName):
1568
1569 2005-12-19  Darin Adler  <darin@apple.com>
1570
1571         Originally done by both George Staikos and Alexey Proskuryakov.
1572
1573         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5706
1574           Sharedptr dependency can be removed
1575
1576         Our coding guidelines say "use 0 instead of NULL" and both RefPtr and
1577         PassRefPtr were using NULL, which required including a header that
1578         defines NULL.
1579
1580         * kxmlcore/PassRefPtr.h:
1581         (KXMLCore::PassRefPtr::PassRefPtr): Use 0 instead of NULL.
1582         (KXMLCore::PassRefPtr::operator!): Use ! instead of == NULL.
1583         * kxmlcore/RefPtr.h:
1584         (KXMLCore::RefPtr::RefPtr): Use 0 instead of NULL.
1585         (KXMLCore::RefPtr::operator!): Use ! instead of == NULL.
1586         Also did some reformatting.
1587
1588 2005-12-19  Darin Adler  <darin@apple.com>
1589
1590         Reviewed by Geoff Garen and Eric Seidel.
1591
1592         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=4923
1593           stop using <ostream> in WebCore, eliminating the <cmath> troubles it causes
1594
1595         * kjs/simple_number.h: Removed many unnecessary includes, including
1596         the <cmath> one to work around GCC library header bugs. We may have to
1597         add some includes elsewhere for platforms other than OS X, since our
1598         prefix header takes care of some things.
1599
1600         * kxmlcore/AlwaysInline.h: Added. Now clients that don't include
1601         simple_number.h can still get the ALWAYS_INLINE macro.
1602         * JavaScriptCore.xcodeproj/project.pbxproj: Added AlwaysInline.h.
1603
1604         * bindings/NP_jsobject.h: Removed a lot of unnecessary includes
1605         and removed C-specific stuff from this C++-only header.
1606         * bindings/jni/jni_jsobject.h: Removed a lot of unnecessary includes
1607         and did some reformatting.
1608         * bindings/objc/objc_runtime.h:  Removed an unnecessary include.
1609         * bindings/runtime.h: Removed some unneeded includes. Reformatted.
1610         * bindings/runtime.cpp: Updated to compile with header changes,
1611         including a lot of reformatting.
1612         * bindings/runtime_object.h: Removed an unnecessary include.
1613
1614 2005-12-13  Maciej Stachowiak  <mjs@apple.com>
1615
1616         Reviewed by Geoff and Adele
1617
1618         - replaced custom Identifier hashtable with HashSet
1619
1620         * kjs/identifier.cpp:
1621         (KXMLCore::):
1622         (KJS::identifierTable):
1623         (KJS::Identifier::equal):
1624         (KJS::hash):
1625         (KJS::equal):
1626         (KJS::convert):
1627         (KJS::Identifier::add):
1628         (KJS::Identifier::remove):
1629         * kjs/identifier.h:
1630         * kjs/internal.cpp:
1631         (KJS::InterpreterImp::initGlobalObject):
1632
1633 2005-12-18  Justin Haygood  <justin@xiondigital.net>
1634
1635         Reviewed, tweaked, and landed by Darin.
1636
1637         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5227
1638           Array indexOf() extension for JavaScript 1.5 Core
1639
1640         * kjs/array_object.h:
1641         * kjs/array_object.cpp: (ArrayProtoFunc::callAsFunction): Added implementation of indexOf.
1642
1643 2005-12-18  Anders Carlsson  <andersca@mac.com>
1644
1645         Reviewed by Darin and Geoffrey.
1646
1647         - fix for <http://bugzilla.opendarwin.org/show_bug.cgi?id=4000>
1648         Object.prototype is missing isPrototypeOf
1649         
1650         * kjs/object_object.cpp:
1651         (ObjectPrototype::ObjectPrototype):
1652         Add isPrototypeOf to object prototype.
1653         
1654         (ObjectProtoFunc::callAsFunction):
1655         Implement isPrototypeOf
1656         
1657         * kjs/object_object.h:
1658         (KJS::ObjectProtoFunc::):
1659         Add id for isPrototypeOf.
1660
1661 2005-12-17  Geoffrey Garen  <ggaren@apple.com>
1662
1663         Reviewed by Darin.
1664
1665         Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6119
1666         split() function ignores case insensitive modifier.
1667
1668         Glossary:
1669         RegExpImp: The C++ object you get when JavaScript executes
1670                    "new RegExp()".
1671         RegExp:    A C++ wrapper object that performs regular expression
1672                    matching on behalf of a RegExpImp.
1673
1674         Instead of unnecessarily constructing a RegExp which (wrongly) lacks
1675         any modifiers, String.split() now uses the RegExp built in to the 
1676         RegExpImp passed to it, which has the right modifiers already.
1677
1678         I also cleaned up other bits of the string code to standardized how
1679         we handle RegExpImp arguments.
1680
1681         * ChangeLog:
1682         * kjs/string_object.cpp:
1683         (replace):
1684         (StringProtoFunc::callAsFunction):
1685
1686 2005-12-16  David Hyatt  <hyatt@apple.com>
1687
1688         Remove unused RefPtr constructors that can create an ambiguity in ustring on some platforms.
1689         
1690         Reviewed by mjs
1691
1692         * kxmlcore/RefPtr.h:
1693         (KXMLCore::RefPtr::RefPtr):
1694
1695 2005-12-15  Darin Adler  <darin@apple.com>
1696
1697         Reviewed by Maciej.
1698
1699         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5688
1700           speed up JavaScript parsing by not creating a UString just to parse
1701
1702         * kjs/internal.h:
1703         * kjs/internal.cpp: (KJS::InterpreterImp::evaluate): Change to take a character pointer
1704         and length rather than a UString.
1705
1706         * kjs/interpreter.h:
1707         * kjs/interpreter.cpp: (Interpreter::evaluate): Ditto.
1708
1709         * kjs/protect.h: Remove uneeded "convert to bool" operator since we already have a
1710         "convert to raw pointer" operator in this class.
1711
1712 === Safari-521~5 ===
1713
1714 2005-12-13  Geoffrey Garen  <ggaren@apple.com>
1715
1716         Updated test results to match Anders's last fix.
1717
1718         * tests/mozilla/expected.html:
1719
1720 2005-12-13  Anders Carlsson  <andersca@mac.com>
1721
1722         * ChangeLog: Add titles for my bugzilla bugs.
1723
1724 2005-12-13  Anders Carlsson  <andersca@mac.com>
1725
1726         Reviewed by Darin.
1727
1728         - Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=6041>
1729         Support property getters and setters.
1730         
1731         * bindings/runtime_array.cpp:
1732         (RuntimeArray::lengthGetter):
1733         (RuntimeArray::indexGetter):
1734         * bindings/runtime_array.h:
1735         * bindings/runtime_method.cpp:
1736         (RuntimeMethod::lengthGetter):
1737         * bindings/runtime_method.h:
1738         * bindings/runtime_object.cpp:
1739         (RuntimeObjectImp::fallbackObjectGetter):
1740         (RuntimeObjectImp::fieldGetter):
1741         (RuntimeObjectImp::methodGetter):
1742         * bindings/runtime_object.h:
1743         * kjs/array_instance.h:
1744         * kjs/array_object.cpp:
1745         (ArrayInstance::lengthGetter):
1746         (getProperty):
1747         Update for changes to PropertySlot::getValue and
1748         PropertySlot::GetValueFunc.
1749         
1750         * kjs/collector.cpp:
1751         (KJS::className):
1752         Handle GetterSetterType.
1753         
1754         * kjs/function.cpp:
1755         (KJS::FunctionImp::argumentsGetter):
1756         (KJS::FunctionImp::lengthGetter):
1757         (KJS::Arguments::mappedIndexGetter):
1758         (KJS::ActivationImp::argumentsGetter):
1759         * kjs/function.h:
1760         Update for changes to PropertySlot::getValue and
1761         PropertySlot::GetValueFunc.
1762         
1763         * kjs/grammar.y:
1764         Rework grammar parts for get set declarations directly
1765         in the object literal.
1766         
1767         * kjs/internal.cpp:
1768         (KJS::GetterSetterImp::mark):
1769         (KJS::GetterSetterImp::toPrimitive):
1770         (KJS::GetterSetterImp::toBoolean):
1771         (KJS::GetterSetterImp::toNumber):
1772         (KJS::GetterSetterImp::toString):
1773         (KJS::GetterSetterImp::toObject):
1774         Add type conversion functions. These aren't meant to be called.
1775         
1776         (KJS::printInfo):
1777         Handle GetterSetterType.
1778         
1779         * kjs/lookup.h:        
1780         (KJS::staticFunctionGetter):
1781         (KJS::staticValueGetter):
1782         Update for changes to PropertySlot::GetValueFunc.
1783         
1784         * kjs/nodes.cpp:
1785         Refactor they way properties nodes are implemented.
1786         We now have a PropertyListNode which is a list of PropertyNodes.
1787         Each PropertyNode has a name (which is a PropertyNameNode) and an associated
1788         value node. PropertyNodes can be of different types. The Constant type is the
1789         old constant declaration and the Getter and Setter types are for property getters
1790         and setters.
1791         (ResolveNode::evaluate):
1792         Update for changes to PropertySlot::getValue.
1793         
1794         (PropertyListNode::evaluate):
1795         Go through all property nodes and set them on the newly created object. If the
1796         property nodes are of type Getter or Setter, define getters and setters. Otherwise,
1797         just add the properties like before.
1798         
1799         (PropertyNode::evaluate):
1800         This should never be called directly.
1801         
1802         (PropertyNameNode::evaluate):
1803         Rename from PropertyNode::evaluate.
1804         
1805         (FunctionCallResolveNode::evaluate):
1806         (FunctionCallBracketNode::evaluate):
1807         (FunctionCallDotNode::evaluate):
1808         (PostfixResolveNode::evaluate):
1809         (PostfixBracketNode::evaluate):
1810         (PostfixDotNode::evaluate):
1811         (TypeOfResolveNode::evaluate):
1812         (PrefixResolveNode::evaluate):
1813         (PrefixBracketNode::evaluate):
1814         (PrefixDotNode::evaluate):
1815         (AssignResolveNode::evaluate):
1816         (AssignDotNode::evaluate):
1817         (AssignBracketNode::evaluate):
1818         Update for changes to PropertySlot::getValue.
1819         
1820         * kjs/nodes.h:
1821         (KJS::PropertyNameNode::PropertyNameNode):
1822         Rename from PropertyNode.
1823         
1824         (KJS::PropertyNode::):
1825         (KJS::PropertyNode::PropertyNode):
1826         New class, representing a single property.
1827         
1828         (KJS::PropertyListNode::PropertyListNode):
1829         Rename from PropertyValueNode.
1830         
1831         (KJS::FuncExprNode::FuncExprNode):
1832         Put ParameterNode parameter last, and make it optional.
1833         
1834         (KJS::ObjectLiteralNode::ObjectLiteralNode):
1835         Use a PropertyListNode here now.
1836         
1837         * kjs/nodes2string.cpp:
1838         (PropertyListNode::streamTo):
1839         Iterate through all property nodes.
1840         
1841         (PropertyNode::streamTo):
1842         Print out the name and value. Doesn't handle getters and setters currently.
1843         
1844         (PropertyNameNode::streamTo):
1845         Rename from PropertyNode::streamTo.
1846         
1847         * kjs/object.cpp:
1848         (KJS::JSObject::get):
1849         Update for changes to PropertySlot::getValue.
1850         
1851         (KJS::JSObject::put):
1852         If the property already exists and has a Setter, invoke
1853         the setter function instead of setting the property directly.
1854         
1855         (KJS::JSObject::defineGetter):
1856         (KJS::JSObject::defineSetter):
1857         New functions for defining property getters and setters on the object.
1858         
1859         * kjs/object.h:
1860         (KJS::GetterSetterImp::type):
1861         (KJS::GetterSetterImp::GetterSetterImp):
1862         (KJS::GetterSetterImp::getGetter):
1863         (KJS::GetterSetterImp::setGetter):
1864         (KJS::GetterSetterImp::getSetter):
1865         (KJS::GetterSetterImp::setSetter):
1866         New class for properties which have getters and setters defined.
1867         This class is only used internally and should never be seen from the outside.
1868         
1869         (KJS::JSObject::getOwnPropertySlot):
1870          If the property is a getter, call setGetterSlot on the property slot.
1871          
1872         * kjs/object_object.cpp:
1873         (ObjectPrototype::ObjectPrototype):
1874         Add __defineGetter__, __defineSetter, __lookupGetter__, __lookupSetter__
1875         to prototype.
1876         
1877         (ObjectProtoFunc::callAsFunction):
1878         Implement handlers for new functions.
1879         
1880         * kjs/object_object.h:
1881         (KJS::ObjectProtoFunc::):
1882         Add ids for new functions.
1883         
1884         * kjs/property_slot.cpp:
1885         (KJS::PropertySlot::undefinedGetter):
1886         Update for changes to PropertySlot::GetValueFunc.
1887         
1888         (KJS::PropertySlot::functionGetter):
1889         Call the function getter object and return its value.
1890         
1891         * kjs/property_slot.h:
1892         (KJS::PropertySlot::getValue):
1893         Add a new argument which is the original object that
1894         getPropertySlot was called on.
1895         
1896         (KJS::PropertySlot::setGetterSlot):
1897         (KJS::PropertySlot::):
1898         New function which sets a getter slot. When getValue is called on a 
1899         getter slot, the getter function object is invoked.
1900         
1901         * kjs/string_object.cpp:
1902         (StringInstance::lengthGetter):
1903         (StringInstance::indexGetter):
1904         * kjs/string_object.h:
1905         Update for changes to PropertySlot::GetValueFunc.
1906         
1907         * kjs/value.h:
1908         (KJS::):
1909         Add GetterSetterType and make GetterSetterImp a friend class of JSCell.
1910
1911 2005-12-12  Maciej Stachowiak  <mjs@apple.com>
1912
1913         Reviewed by Eric.
1914
1915         - added a new HashCountedSet class for the common pattern of mapping items to counts that can change
1916         
1917         * kxmlcore/HashCountedSet.h: Added.
1918         (KXMLCore::HashCountedSet::*): Implemented, on top of HashMap.
1919         * kxmlcore/HashMap.h:
1920         (KXMLCore::HashMap::add): New method - does not replace existing value if key already present
1921         but otherwise like set().
1922         (KXMLCore::HashMap::set): Improved comments.
1923         * kxmlcore/HashMapPtrSpec.h:
1924         (KXMLCore::HashMap::add): Added to specializations too.
1925         * JavaScriptCore.xcodeproj/project.pbxproj: Add new  file.
1926         * kxmlcore/HashFunctions.h: Added include of stdint.h
1927         
1928         - replaced the custom hashtable for values protected from GC with HashCountedSet
1929
1930         * kjs/collector.cpp:
1931         (KJS::Collector::protect): Moved code here from ProtectedValues::increaseProtectCount
1932         since the code is so simple now.
1933         (KJS::Collector::unprotect): Ditto for ProtectedValues::decreaseProtectCount.
1934         (KJS::Collector::markProtectedObjects): Updated for new way of doing things, now
1935         simpler and safer.
1936         (KJS::Collector::numReferencedObjects): ditto
1937         (KJS::Collector::rootObjectClasses): ditto
1938         * kjs/collector.h: Added protect and unprotect static methods
1939         * kjs/protect.h:
1940         (KJS::gcProtect): Updated for removal of ProtectedValues class
1941         (KJS::gcUnprotect): likewise
1942         * kjs/protected_values.cpp: Removed.
1943         * kjs/protected_values.h: Removed.
1944
1945 2005-12-10  Darin Adler  <darin@apple.com>
1946
1947         Rubber stamped by Maciej.
1948
1949         - did long-promised KJS renaming:
1950         
1951             ValueImp -> JSValue
1952             ObjectImp -> JSObject
1953             AllocatedValueImp -> JSCell
1954         
1955         A renaming to get a class out of the way
1956         
1957             KJS::Bindings::JSObject -> JavaJSObject
1958  
1959         and some other "imp-reduction" renaming
1960         
1961             *InstanceImp -> *Instance
1962             *ProtoFuncImp -> *ProtoFunc
1963             *PrototypeImp -> *Prototype
1964             ArgumentsImp -> Arguments
1965             RuntimeArrayImp -> RuntimeArray
1966             RuntimeMethodImp -> RuntimeMethod
1967
1968         * most files and functions
1969
1970 2005-12-10  Darin Adler  <darin@apple.com>
1971
1972         Reviewed by Maciej.
1973
1974         - eliminated the old Undefined(), Null(), Boolean(), Number(), and String()
1975
1976         Code now uses jsUndefined(), jsNull(), jsBoolean(), jsNumber(), and jsString().
1977
1978         * bindings/NP_jsobject.cpp:
1979         (_NPN_Evaluate):
1980         * bindings/c/c_instance.cpp:
1981         (KJS::Bindings::CInstance::invokeMethod):
1982         (KJS::Bindings::CInstance::invokeDefaultMethod):
1983         * bindings/c/c_runtime.cpp:
1984         (CField::valueFromInstance):
1985         * bindings/c/c_utility.cpp:
1986         (KJS::Bindings::convertNPVariantToValue):
1987         * bindings/jni/jni_instance.cpp:
1988         (JavaInstance::invokeMethod):
1989         (JavaInstance::invokeDefaultMethod):
1990         * bindings/jni/jni_jsobject.cpp:
1991         (JSObject::eval):
1992         (JSObject::convertJObjectToValue):
1993         * bindings/jni/jni_runtime.cpp:
1994         (JavaArray::convertJObjectToArray):
1995         (JavaField::valueFromInstance):
1996         (JavaArray::valueAt):
1997         * bindings/objc/WebScriptObject.mm:
1998         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1999         (-[WebScriptObject evaluateWebScript:]):
2000         (-[WebScriptObject valueForKey:]):
2001         (-[WebScriptObject webScriptValueAtIndex:]):
2002         * bindings/objc/objc_instance.mm:
2003         (ObjcInstance::invokeMethod):
2004         (ObjcInstance::invokeDefaultMethod):
2005         (ObjcInstance::getValueOfUndefinedField):
2006         * bindings/objc/objc_runtime.mm:
2007         (ObjcField::valueFromInstance):
2008         (ObjcFallbackObjectImp::callAsFunction):
2009         * bindings/objc/objc_utility.mm:
2010         (KJS::Bindings::convertNSStringToString):
2011         (KJS::Bindings::convertObjcValueToValue):
2012         * bindings/runtime.h:
2013         (KJS::Bindings::Class::fallbackObject):
2014         (KJS::Bindings::Instance::getValueOfUndefinedField):
2015         (KJS::Bindings::Instance::valueOf):
2016         * bindings/runtime_array.cpp:
2017         (RuntimeArrayImp::lengthGetter):
2018         * bindings/runtime_method.cpp:
2019         (RuntimeMethodImp::lengthGetter):
2020         (RuntimeMethodImp::callAsFunction):
2021         (RuntimeMethodImp::execute):
2022         * kjs/array_object.cpp:
2023         (ArrayInstanceImp::lengthGetter):
2024         (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
2025         (ArrayPrototypeImp::ArrayPrototypeImp):
2026         (ArrayProtoFuncImp::ArrayProtoFuncImp):
2027         (ArrayProtoFuncImp::callAsFunction):
2028         (ArrayObjectImp::ArrayObjectImp):
2029         * kjs/bool_object.cpp:
2030         (BooleanPrototypeImp::BooleanPrototypeImp):
2031         (BooleanProtoFuncImp::callAsFunction):
2032         (BooleanObjectImp::BooleanObjectImp):
2033         (BooleanObjectImp::callAsFunction):
2034         * kjs/error_object.cpp:
2035         (ErrorPrototypeImp::ErrorPrototypeImp):
2036         (ErrorProtoFuncImp::ErrorProtoFuncImp):
2037         (ErrorProtoFuncImp::callAsFunction):
2038         (ErrorObjectImp::ErrorObjectImp):
2039         (NativeErrorImp::NativeErrorImp):
2040         * kjs/function.cpp:
2041         (KJS::FunctionImp::callAsFunction):
2042         (KJS::FunctionImp::processParameters):
2043         (KJS::FunctionImp::argumentsGetter):
2044         (KJS::FunctionImp::lengthGetter):
2045         (KJS::DeclaredFunctionImp::execute):
2046         (KJS::encode):
2047         (KJS::decode):
2048         (KJS::GlobalFuncImp::callAsFunction):
2049         * kjs/function_object.cpp:
2050         (FunctionPrototypeImp::FunctionPrototypeImp):
2051         (FunctionPrototypeImp::callAsFunction):
2052         (FunctionProtoFuncImp::callAsFunction):
2053         (FunctionObjectImp::FunctionObjectImp):
2054         * kjs/internal.cpp:
2055         (KJS::InterpreterImp::initGlobalObject):
2056         * kjs/interpreter.h:
2057         * kjs/lookup.h:
2058         * kjs/math_object.cpp:
2059         (MathObjectImp::getValueProperty):
2060         (MathFuncImp::callAsFunction):
2061         * kjs/nodes.cpp:
2062         (Node::setExceptionDetailsIfNeeded):
2063         (NullNode::evaluate):
2064         (PropertyNode::evaluate):
2065         (FunctionCallBracketNode::evaluate):
2066         (FunctionCallDotNode::evaluate):
2067         (PostfixBracketNode::evaluate):
2068         (PostfixDotNode::evaluate):
2069         (VoidNode::evaluate):
2070         (PrefixBracketNode::evaluate):
2071         (PrefixDotNode::evaluate):
2072         (ShiftNode::evaluate):
2073         (valueForReadModifyAssignment):
2074         (AssignDotNode::evaluate):
2075         (AssignBracketNode::evaluate):
2076         (VarDeclNode::evaluate):
2077         (VarDeclNode::processVarDecls):
2078         (VarDeclListNode::evaluate):
2079         (ReturnNode::execute):
2080         (CaseClauseNode::evalStatements):
2081         (ParameterNode::evaluate):
2082         (FuncDeclNode::processFuncDecl):
2083         * kjs/nodes.h:
2084         (KJS::StatementNode::evaluate):
2085         * kjs/number_object.cpp:
2086         (NumberPrototypeImp::NumberPrototypeImp):
2087         (NumberProtoFuncImp::callAsFunction):
2088         (NumberObjectImp::NumberObjectImp):
2089         (NumberObjectImp::getValueProperty):
2090         (NumberObjectImp::callAsFunction):
2091         * kjs/object.cpp:
2092         (KJS::ObjectImp::get):
2093         (KJS::Error::create):
2094         * kjs/object_object.cpp:
2095         (ObjectPrototypeImp::ObjectPrototypeImp):
2096         (ObjectProtoFuncImp::callAsFunction):
2097         (ObjectObjectImp::ObjectObjectImp):
2098         * kjs/property_slot.cpp:
2099         (KJS::PropertySlot::undefinedGetter):
2100         * kjs/regexp_object.cpp:
2101         (RegExpPrototypeImp::RegExpPrototypeImp):
2102         (RegExpProtoFuncImp::callAsFunction):
2103         (RegExpObjectImp::RegExpObjectImp):
2104         (RegExpObjectImp::arrayOfMatches):
2105         (RegExpObjectImp::getBackref):
2106         (RegExpObjectImp::getLastMatch):
2107         (RegExpObjectImp::getLastParen):
2108         (RegExpObjectImp::getLeftContext):
2109         (RegExpObjectImp::getRightContext):
2110         (RegExpObjectImp::getValueProperty):
2111         (RegExpObjectImp::construct):
2112         * kjs/string_object.cpp:
2113         (StringInstanceImp::StringInstanceImp):
2114         (StringPrototypeImp::StringPrototypeImp):
2115         (replace):
2116         (StringProtoFuncImp::callAsFunction):
2117         (StringObjectImp::StringObjectImp):
2118         (StringObjectImp::callAsFunction):
2119         (StringObjectFuncImp::StringObjectFuncImp):
2120         (StringObjectFuncImp::callAsFunction):
2121         * kjs/testkjs.cpp:
2122         (TestFunctionImp::callAsFunction):
2123         (VersionFunctionImp::callAsFunction):
2124         * kjs/value.h:
2125
2126 2005-12-10  Oliver Hunt  <ojh16@student.canterbury.ac.nz>
2127
2128         Reviewed by Maciej, landed by Darin.
2129
2130         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=3539
2131           Array join and toString methods do not support circular references
2132
2133         * kjs/array_object.cpp: (ArrayProtoFuncImp::callAsFunction):
2134         Added set of visited objects -- don't recurse if item is already in the set.
2135
2136 2005-12-08  Maciej Stachowiak  <mjs@apple.com>
2137
2138         Reviewed by John.
2139
2140         - fix major memory leak and resultant slowdown on JavaScript iBench from
2141         my PassRefPtr changes
2142         
2143         * kjs/ustring.cpp:
2144         (KJS::UString::Rep::create): I forgot to change one of the two overloads to create
2145         with a refcount of 0 instead of 1 (the smart pointer then bumps it. But instead of
2146         changing it, I changed both to start with a refcounter of 1 and use PassRefPtr::adopt
2147         to adopt the initial refcount, this may be a hair more efficient.
2148
2149         - made the assignment operators for smart pointers inline because Shark said so
2150         
2151         * kxmlcore/PassRefPtr.h:
2152         (KXMLCore::::operator=):
2153         * kxmlcore/RefPtr.h:
2154         (KXMLCore::::operator=):
2155
2156 2005-12-06  Anders Carlsson  <andersca@mac.com>
2157
2158         Reviewed by Darin.
2159
2160         - fix build when using gcc 4
2161                 
2162         * kjs/ustring.h:
2163         Make Rep public.
2164
2165         * kxmlcore/PassRefPtr.h:
2166         (KXMLCore::::operator):
2167         Fix a typo.
2168
2169 2005-12-05  Maciej Stachowiak  <mjs@apple.com>
2170
2171         Reviewed by Eric.
2172
2173         - add PassRefPtr, a smart pointer class that works in conjunction
2174         with RefPtr but has transfer-of-ownership semantics
2175         - apply RefPtr and PassRefPtr to UString
2176         - cleaned up UString a little so that it doesn't need to have so many friend classes
2177
2178         * JavaScriptCore.xcodeproj/project.pbxproj:
2179         * kjs/identifier.cpp:
2180         (KJS::Identifier::add):
2181         * kjs/identifier.h:
2182         (KJS::Identifier::Identifier):
2183         (KJS::Identifier::equal):
2184         * kjs/property_map.cpp:
2185         (KJS::PropertyMap::get):
2186         (KJS::PropertyMap::getLocation):
2187         (KJS::PropertyMap::put):
2188         (KJS::PropertyMap::remove):
2189         * kjs/ustring.cpp:
2190         (KJS::UCharReference::operator=):
2191         (KJS::UCharReference::ref):
2192         (KJS::UString::Rep::createCopying):
2193         (KJS::UString::Rep::create):
2194         (KJS::UString::usedCapacity):
2195         (KJS::UString::usedPreCapacity):
2196         (KJS::UString::expandCapacity):
2197         (KJS::UString::expandPreCapacity):
2198         (KJS::UString::UString):
2199         (KJS::UString::spliceSubstringsWithSeparators):
2200         (KJS::UString::append):
2201         (KJS::UString::operator=):
2202         (KJS::UString::toStrictUInt32):
2203         (KJS::UString::substr):
2204         (KJS::UString::copyForWriting):
2205         (KJS::operator==):
2206         * kjs/ustring.h:
2207         (KJS::UString::UString):
2208         (KJS::UString::~UString):
2209         (KJS::UString::data):
2210         (KJS::UString::isNull):
2211         (KJS::UString::isEmpty):
2212         (KJS::UString::size):
2213         (KJS::UString::rep):
2214         * kxmlcore/RefPtr.h:
2215         (KXMLCore::RefPtr::RefPtr):
2216         (KXMLCore::RefPtr::operator*):
2217         (KXMLCore::::operator):
2218         (KXMLCore::operator==):
2219         (KXMLCore::operator!=):
2220         (KXMLCore::static_pointer_cast):
2221         (KXMLCore::const_pointer_cast):
2222
2223 2005-12-04  Geoffrey Garen  <ggaren@apple.com>
2224
2225         Update test results to match Anders's last checkin.
2226
2227         * tests/mozilla/expected.html:
2228
2229 2005-12-04  Anders Carlsson  <andersca@mac.com>
2230
2231         Reviewed by Geoffrey.
2232
2233         - Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=3999>
2234         Object.prototype is missing propertyIsEnumerable
2235         
2236         * kjs/object.cpp:
2237         (KJS::ObjectImp::canPut):
2238         Refactor to use getPropertyAttributes.
2239
2240         (KJS::ObjectImp::propertyIsEnumerable):
2241         New function which checks if a property is enumerable.
2242
2243         (KJS::ObjectImp::getPropertyAttributes):
2244         * kjs/object.h:
2245         Add getPropertyAttributes and propertyIsEnumerable.
2246
2247         * kjs/object_object.cpp:
2248         (ObjectPrototypeImp::ObjectPrototypeImp):
2249         (ObjectProtoFuncImp::callAsFunction):
2250         * kjs/object_object.h:
2251         (KJS::ObjectProtoFuncImp::):
2252         Add propertyIsEnumerable to the Object prototype.
2253
2254 2005-12-01  Maciej Stachowiak  <mjs@apple.com>
2255
2256         Reviewed by Tim Hatcher.
2257
2258         - removed deprecated reset, isNull and nonNull methods
2259
2260         * kxmlcore/RefPtr.h:
2261
2262 2005-12-01  Anders Carlsson  <andersca@mac.com>
2263
2264         Reviewed by Darin.
2265
2266         - Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=3382>
2267         nodes2strings.cpp fails to print left expression of ForInNode when 'var' is not used
2268         
2269         Patch by Mark Rowe.
2270
2271         * kjs/nodes2string.cpp:
2272         (ForInNode::streamTo):
2273         Add lexpr if there's no varDecl.
2274
2275 2005-12-01  Maciej Stachowiak  <mjs@apple.com>
2276
2277         Rubber stamped by Eric.
2278
2279         - renamed SharedPtr to RefPtr via script
2280
2281         * JavaScriptCore.xcodeproj/project.pbxproj:
2282         * kjs/function.cpp:
2283         (KJS::GlobalFuncImp::callAsFunction):
2284         * kjs/function.h:
2285         * kjs/function_object.cpp:
2286         (FunctionObjectImp::construct):
2287         * kjs/internal.cpp:
2288         (KJS::Parser::parse):
2289         (KJS::InterpreterImp::checkSyntax):
2290         (KJS::InterpreterImp::evaluate):
2291         * kjs/internal.h:
2292         * kjs/nodes.h:
2293         * kjs/nodes2string.cpp:
2294         (KJS::SourceStream::operator<<):
2295         * kjs/protect.h:
2296         * kxmlcore/RefPtr.h: Added.
2297         (KXMLCore::RefPtr::RefPtr):
2298         (KXMLCore::RefPtr::~RefPtr):
2299         (KXMLCore::RefPtr::isNull):
2300         (KXMLCore::RefPtr::notNull):
2301         (KXMLCore::RefPtr::reset):
2302         (KXMLCore::RefPtr::get):
2303         (KXMLCore::RefPtr::operator*):
2304         (KXMLCore::RefPtr::operator->):
2305         (KXMLCore::RefPtr::operator!):
2306         (KXMLCore::RefPtr::operator UnspecifiedBoolType):
2307         (KXMLCore::::operator):
2308         (KXMLCore::operator==):
2309         (KXMLCore::operator!=):
2310         (KXMLCore::static_pointer_cast):
2311         (KXMLCore::const_pointer_cast):
2312         * kxmlcore/SharedPtr.h: Removed.
2313
2314 2005-11-30  Maciej Stachowiak  <mjs@apple.com>
2315
2316         Reviewed by Dave Hyatt.
2317
2318         - change idiom used for implicit bool conversion of smart pointers, because the old one gives weird error messages sometimes
2319
2320         * kjs/protect.h:
2321         (KJS::ProtectedPtr::operator UnspecifiedBoolType):
2322         * kxmlcore/SharedPtr.h:
2323         (KXMLCore::SharedPtr::operator UnspecifiedBoolType):
2324
2325 2005-11-29  Mitz Pettel  <opendarwin.org@mitzpettel.com>
2326
2327         Reviewed by ggaren.  Committed by eseidel.
2328
2329         Date conversion to local time gets the DST flag wrong sometimes
2330         http://bugzilla.opendarwin.org/show_bug.cgi?id=5514
2331
2332         * kjs/date_object.cpp:
2333         (KJS::isTime_tSigned):
2334         (KJS::DateProtoFuncImp::callAsFunction):
2335
2336 2005-11-26  Maciej Stachowiak  <mjs@apple.com>
2337
2338         Rubber stamped by Eric.
2339
2340         - renamed InterpreterLock to JSLock
2341
2342         * bindings/NP_jsobject.cpp:
2343         (_NPN_Invoke):
2344         (_NPN_Evaluate):
2345         (_NPN_GetProperty):
2346         (_NPN_SetProperty):
2347         (_NPN_RemoveProperty):
2348         (_NPN_HasProperty):
2349         (_NPN_HasMethod):
2350         (_NPN_SetException):
2351         * bindings/jni/jni_jsobject.cpp:
2352         (JSObject::call):
2353         (JSObject::eval):
2354         (JSObject::getMember):
2355         (JSObject::setMember):
2356         (JSObject::removeMember):
2357         (JSObject::getSlot):
2358         (JSObject::setSlot):
2359         (JSObject::toString):
2360         (JSObject::convertJObjectToValue):
2361         * bindings/objc/WebScriptObject.mm:
2362         (-[WebScriptObject callWebScriptMethod:withArguments:]):
2363         (-[WebScriptObject evaluateWebScript:]):
2364         (-[WebScriptObject setValue:forKey:]):
2365         (-[WebScriptObject valueForKey:]):
2366         (-[WebScriptObject removeWebScriptKey:]):
2367         (-[WebScriptObject stringRepresentation]):
2368         (-[WebScriptObject webScriptValueAtIndex:]):
2369         (-[WebScriptObject setWebScriptValueAtIndex:value:]):
2370         (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
2371         * bindings/runtime.cpp:
2372         (Instance::createRuntimeObject):
2373         * bindings/runtime_root.cpp:
2374         (KJS::Bindings::addNativeReference):
2375         (KJS::Bindings::removeNativeReference):
2376         (RootObject::removeAllNativeReferences):
2377         * bindings/runtime_root.h:
2378         (KJS::Bindings::RootObject::~RootObject):
2379         (KJS::Bindings::RootObject::setRootObjectImp):
2380         * bindings/testbindings.cpp:
2381         (main):
2382         * bindings/testbindings.mm:
2383         (main):
2384         * kjs/JSLock.cpp:
2385         (KJS::initializeJSLock):
2386         (KJS::JSLock::lock):
2387         (KJS::JSLock::unlock):
2388         (KJS::JSLock::lockCount):
2389         (KJS::JSLock::DropAllLocks::DropAllLocks):
2390         (KJS::JSLock::DropAllLocks::~DropAllLocks):
2391         * kjs/JSLock.h:
2392         (KJS::JSLock::JSLock):
2393         (KJS::JSLock::~JSLock):
2394         * kjs/collector.cpp:
2395         (KJS::Collector::allocate):
2396         (KJS::Collector::collect):
2397         * kjs/internal.cpp:
2398         (KJS::InterpreterImp::InterpreterImp):
2399         (KJS::InterpreterImp::clear):
2400         (KJS::InterpreterImp::checkSyntax):
2401         (KJS::InterpreterImp::evaluate):
2402         * kjs/interpreter.cpp:
2403         (Interpreter::evaluate):
2404         * kjs/protect.h:
2405         (KJS::::ProtectedPtr):
2406         (KJS::::~ProtectedPtr):
2407         (KJS::::operator):
2408         * kjs/protected_reference.h:
2409         (KJS::ProtectedReference::ProtectedReference):
2410         (KJS::ProtectedReference::~ProtectedReference):
2411         (KJS::ProtectedReference::operator=):
2412         * kjs/protected_values.cpp:
2413         (KJS::ProtectedValues::getProtectCount):
2414         (KJS::ProtectedValues::increaseProtectCount):
2415         (KJS::ProtectedValues::decreaseProtectCount):
2416         * kjs/testkjs.cpp:
2417         (TestFunctionImp::callAsFunction):
2418         (main):
2419
2420 2005-11-26  Darin Adler  <darin@apple.com>
2421
2422         Reviewed by eseidel.  Committed by eseidel.
2423
2424         Inline ScopeChain functions for speed.
2425         http://bugzilla.opendarwin.org/show_bug.cgi?id=5687
2426
2427         * kjs/object.h:
2428         (KJS::ScopeChain::mark):
2429         * kjs/scope_chain.cpp:
2430         * kjs/scope_chain.h:
2431         (KJS::ScopeChain::ref):
2432         (KJS::ScopeChain::operator=):
2433         (KJS::ScopeChain::bottom):
2434         (KJS::ScopeChain::push):
2435         (KJS::ScopeChain::pop):
2436
2437 2005-11-21  Maciej Stachowiak  <mjs@apple.com>
2438
2439         Reviewed by Geoff.
2440
2441         <rdar://problem/4139620> Seed: WebKit: hang when sending XMLHttpRequest if automatic proxy config is used
2442
2443         Also factored locking code completely into a separate class, and
2444         added a convenient packaged way to temporarily drop locks.
2445
2446         * JavaScriptCore.xcodeproj/project.pbxproj:
2447         * kjs/JSLock.cpp: Added.
2448         (KJS::initializeInterpreterLock):
2449         (KJS::InterpreterLock::lock):
2450         (KJS::InterpreterLock::unlock):
2451         (KJS::InterpreterLock::lockCount):
2452         (KJS::InterpreterLock::DropAllLocks::DropAllLocks):
2453         (KJS::InterpreterLock::DropAllLocks::~DropAllLocks):
2454         * kjs/JSLock.h: Added.
2455         (KJS::InterpreterLock::InterpreterLock):
2456         (KJS::InterpreterLock::~InterpreterLock):
2457         * kjs/internal.cpp:
2458         * kjs/internal.h:
2459         * kjs/interpreter.cpp:
2460         * kjs/interpreter.h:
2461         * kjs/protect.h:
2462         * kjs/testkjs.cpp:
2463         (TestFunctionImp::callAsFunction):
2464
2465 2005-11-21  Eric Seidel  <eseidel@apple.com>
2466
2467         Rubber-stamped by hyatt.
2468         
2469         Removed JavaScriptCore+SVG target.
2470
2471         * JavaScriptCore.xcodeproj/project.pbxproj:
2472
2473 2005-11-15  Geoffrey Garen  <ggaren@apple.com>
2474
2475         Reviewed by mjs.
2476         
2477         - Fixed <rdar://problem/4342216> Installer crash in 
2478           KJS::ValueImp::marked() when garbage collector runs inside call to 
2479           ConstantValues::init()
2480           
2481         I took responsibility for initializing and marking ConstantValues away 
2482         from InterpreterImp, since it's possible to reference such a value 
2483         before any interpreter has been created and after the last interpreter 
2484         has been destroyed.
2485
2486         InterpreterImp::lock now initializes ConstantValues. It's a good
2487         place for the initialization because you have to call it before
2488         creating any objects. Since ::lock can be called more than once,
2489         I added a check in ConstantValues::init to ensure that it executes 
2490         only once.
2491
2492         Collector:collect is now responsible for marking ConstantValues.
2493
2494         We no longer clear the ConstantValues since we can't guarantee that no 
2495         one has a reference to them.
2496
2497         FIXME: This is hackery. The long-term plan is to make ConstantValues
2498         use immediate values that require no initialization.
2499
2500         * ChangeLog:
2501         * kjs/collector.cpp:
2502         (KJS::Collector::collect):
2503         * kjs/internal.cpp:
2504         (KJS::InterpreterImp::InterpreterImp):
2505         (KJS::InterpreterImp::lock):
2506         (KJS::InterpreterImp::clear):
2507         (KJS::InterpreterImp::mark):
2508         * kjs/internal.h:
2509         * kjs/value.cpp:
2510         (KJS::ConstantValues::initIfNeeded):
2511         * kjs/value.h:
2512
2513 2005-11-08  Geoffrey Garen  <ggaren@apple.com>
2514
2515         Reviewed by Darin.
2516
2517         This patch fixes some naughty naughty code -- 5 crashes and 2 
2518         may-go-haywire-in-the-futures.
2519         
2520         One such crash is <rdar://problem/4247330> 8C46 Crash with with 
2521         incomplete parameter list to webScript object function.
2522         
2523         I replaced early returns from within NS_DURINGs with calls to
2524         NS_VALUERETURN because the doc says, "You cannot use goto or 
2525         return to exit an exception handling domain -- errors will result."
2526         
2527         I replaced hard-coded analyses of -[NSMethodSignature 
2528         methodReturnType] with more abstracted alternatives, since
2529         the documentation says "This encoding is implementation-specific, 
2530         so applications should use it with caution," and then emits an
2531         evil cackle.
2532         
2533         I removed the early return in the case where a JavaScript caller
2534         supplies an insufficient number of arguments, because the right
2535         thing to do in such a case is to use JavaScript's defined behavior
2536         of supplying "undefined" for any missing arguments.
2537         
2538         I also changed ObjcInstance::invokeMethod so that it no longer
2539         deletes the method passed to it. It doesn't create the method,
2540         so it shouldn't delete it. A friend of mine named
2541         KERNEL_PROTECTION_FAILURE agrees with me on this point.
2542         
2543         Finally, I changed an assert(true) to assert(false) because
2544         all the other asserts were making fun of it.
2545
2546         * bindings/objc/objc_instance.mm:
2547         (ObjcInstance::invokeMethod):
2548         (ObjcInstance::invokeDefaultMethod):
2549
2550 2005-11-06  Geoffrey Garen  <ggaren@apple.com>
2551
2552         Reviewed by Darin.
2553
2554         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5571
2555           REGRESSION (412.5-TOT): duplicated words/sentences at 
2556           shakespeer.sourceforge.net
2557
2558         Our UTF16-modified PCRE didn't work with extended character classes
2559         (classes involving characters > 255) because it used the GETCHARINC
2560         macro to read through them. In UTF16 mode, GETCHARINC expects UTF16 
2561         input, but PCRE encodes character classes in UTF8 regardless of the
2562         input mode of the subject string.
2563
2564         The fix is to explicitly define GETUTF8CHARINC, and to use it,
2565         rather than GETCHARINC, when reading extended character classes. 
2566         
2567         In UTF8 mode, we simply define GETCHARINC to be GETUTF8CHARINC.
2568
2569         * pcre/pcre_internal.h:
2570         * pcre/pcre_xclass.c:
2571         (_pcre_xclass):
2572
2573 2005-11-05  Geoffrey Garen  <ggaren@apple.com>
2574
2575         Patch by Mitz Pettel, reviewed by Maciej.
2576
2577         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5357
2578           REGRESSION: Scriptable plugin hides properties of OBJECT element
2579
2580         * bindings/objc/objc_class.mm:
2581         (KJS::Bindings::ObjcClass::fallbackObject):
2582
2583 2005-11-05  Geoffrey Garen  <ggaren@apple.com>
2584
2585         Reviewed by Darin.
2586
2587         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5409
2588         slice() testcase doesn't pass
2589
2590         Modified String.slice to deal with funky values.
2591         Updated test results. We now pass <js1_2/String/slice.js>.
2592
2593         * kjs/string_object.cpp:
2594         (StringProtoFuncImp::callAsFunction):
2595         * tests/mozilla/expected.html:
2596
2597 2005-11-04  Darin Adler  <darin@apple.com>
2598
2599         Reviewed by Tim Hatcher.
2600
2601         * kxmlcore/HashSet.h: Fixed case of "hashfunctions.h" -- needs to be "HashFunctions.h".
2602
2603 2005-11-03  Timothy Hatcher  <timothy@apple.com>
2604
2605         Reviewed by Darin and Vicki.
2606
2607         * JavaScriptCore.xcodeproj/project.pbxproj:
2608           Change to use $(SYSTEM_LIBRARY_DIR) consistently and place
2609           $(NEXT_ROOT) in a few spots to make build-root work.
2610
2611 2005-11-03  Geoffrey Garen  <ggaren@apple.com>
2612
2613         - Updated JavaScriptCore test results to reflect recent fixes.
2614
2615         * tests/mozilla/expected.html:
2616
2617 2005-11-03  Geoffrey Garen  <ggaren@apple.com>
2618
2619         Reviewed by darin.
2620
2621         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5602
2622           REGRESSION: RegExp("[^\\s$]+", "g") returns extra matches
2623
2624         We now update lastIndex relative to the start of the last match,
2625         rather than the start of the last search. We used to assume that
2626         the two were equal, but that is not the case when a pattern
2627         matches at a character after the first in the string.
2628
2629         * kjs/regexp_object.cpp:
2630         (RegExpProtoFuncImp::callAsFunction):
2631
2632 2005-10-24  John Sullivan  <sullivan@apple.com>
2633
2634         Reviewed by Darin Adler. Code changes by Alexey Proskuryakov.
2635         
2636         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4931
2637         Unicode format characters (Cf) should be removed from JavaScript source
2638
2639         * kjs/lexer.cpp:
2640         include <unicode/uchar.h>
2641         (Lexer::Lexer):
2642         use KJS::UChar instead of UChar to avoid ambiguity caused by new include
2643         (Lexer::setCode):
2644         ditto; also, use shift(4) to skip first 4 chars to take advantage of new
2645         logic there.
2646         (Lexer::shift):
2647         skip chars of type U_FORMAT_CHAR
2648         (Lexer::convertUnicode):
2649         use KJS::UChar instead of UChar to avoid ambiguity caused by new include
2650         (Lexer::record16):
2651         ditto
2652         (Lexer::makeIdentifier):
2653         ditto
2654         (Lexer::makeUString):
2655         ditto
2656         
2657         * tests/mozilla/ecma/Array/15.4.5.1-1.js:
2658         updated to skip soft hyphens
2659
2660 2005-10-24  John Sullivan  <sullivan@apple.com>
2661
2662         Reviewed by Darin Adler. Code changes by George Staikos/Geoff Garen.
2663         
2664         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4142
2665         Date object does not always adjust daylight savings correctly
2666
2667         * kjs/date_object.cpp:
2668         (KJS::makeTime):
2669         Fix the case where a time change crosses the daylight savings start/end dates.
2670
2671 2005-10-17  Maciej Stachowiak  <mjs@apple.com>
2672
2673         Reviewed by Geoff. Code changes by Darin.
2674
2675         - some micro-optimizations to FastMalloc to reduce math and branches.
2676
2677         * kxmlcore/FastMalloc.cpp:
2678         (KXMLCore::TCMalloc_Central_FreeList::Populate):
2679         (KXMLCore::fastMallocRegisterThread):
2680         (KXMLCore::TCMalloc_ThreadCache::GetCache):
2681         (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
2682
2683 2005-10-15  Maciej Stachowiak  <mjs@apple.com>
2684
2685         Reverted fix for this bug, because it was part of a time range that caused a performance
2686         regression:
2687         
2688         <rdar://problem/4260481> Remove Reference type from JavaScriptCore
2689
2690 2005-10-15  Darin Adler  <darin@apple.com>
2691
2692         * kxmlcore/HashTable.cpp: Fixed build failure (said hashtable.h instead of HashTable.h).
2693
2694 2005-10-14  Geoffrey Garen  <ggaren@apple.com>
2695
2696         Style changes recommended by Darin.
2697         
2698         Changed to camelCase, changed ValueImp* to ValueImp *.
2699
2700         * kjs/simple_number.h:
2701         (KJS::SimpleNumber::make):
2702         (KJS::SimpleNumber::value):
2703
2704 2005-10-11  Geoffrey Garen  <ggaren@apple.com>
2705
2706         Added regexp_object.lut.h build phase from JavaScriptCore
2707         to JavaScriptCore+SVG.
2708
2709         Reviewed by mitz.
2710
2711         * JavaScriptCore.xcodeproj/project.pbxproj:
2712
2713 2005-10-11  Geoffrey Garen  <ggaren@apple.com>
2714
2715         Fixed build bustage from last checkin (stray characters
2716         in the project file).
2717
2718         Reviewed by mitz.
2719
2720         * JavaScriptCore.xcodeproj/project.pbxproj:
2721
2722 2005-10-11  Geoffrey Garen  <ggaren@apple.com>
2723
2724         New JavaScriptCore test results to reflect the last change.
2725
2726         * tests/mozilla/expected.html:
2727
2728 2005-10-10  Geoffrey Garen  <ggaren@apple.com>
2729
2730         - Implemented caching of match state inside the global RegExp object
2731           (lastParen, leftContext, rightContext, lastMatch, input).
2732
2733           exec(), test(), match(), search(), and replace() now dipatch regular
2734           expression matching through the RegExp object's performMatch function, 
2735           to facilitate caching. This replaces registerRegexp and 
2736           setSubPatterns.
2737         
2738         - Implemented the special '$' aliases (e.g. RegExp.input aliases to 
2739           RegExp.$_).
2740
2741         - Moved support for backreferences into the new static hash table
2742           used for other special RegExp properties. Truncated backreferences
2743           at $9 to match IE, FF, and the "What's New in Netscape 1.2?" doc.
2744           (String.replace still supports double-digit backreferences.)
2745
2746         - Tweaked RegExp.prototype.exec to handle ginormous values in lastIndex.
2747
2748         Fixes 11 -- count em, 11 -- JavaScriptCore tests.
2749
2750         * fast/js/regexp-caching-expected.txt: Added.
2751         * fast/js/regexp-caching.html: Added.
2752
2753         Reviewed by mjs.
2754
2755         * JavaScriptCore.xcodeproj/project.pbxproj: Added regexp_object.lut.h
2756         * kjs/create_hash_table: Tweaked to allow for more exotic characters.
2757                                  We now rely on the compiler to catch illegal
2758                                  identifiers.
2759         * kjs/regexp.cpp:
2760         (KJS::RegExp::RegExp):
2761         * kjs/regexp_object.cpp:
2762         (RegExpProtoFuncImp::callAsFunction):
2763         (RegExpObjectImp::RegExpObjectImp):
2764         (RegExpObjectImp::performMatch):
2765         (RegExpObjectImp::arrayOfMatches):
2766         (RegExpObjectImp::backrefGetter):
2767         (RegExpObjectImp::getLastMatch):
2768         (RegExpObjectImp::getLastParen):
2769         (RegExpObjectImp::getLeftContext):
2770         (RegExpObjectImp::getRightContext):
2771         (RegExpObjectImp::getOwnPropertySlot):
2772         (RegExpObjectImp::getValueProperty):
2773         (RegExpObjectImp::put):
2774         (RegExpObjectImp::putValueProperty):
2775         * kjs/regexp_object.h:
2776         (KJS::RegExpObjectImp::):
2777         * kjs/string_object.cpp:
2778         (substituteBackreferences):
2779         (replace):
2780         (StringProtoFuncImp::callAsFunction):
2781
2782 2005-10-09  Darin Adler  <darin@apple.com>
2783
2784         Reviewed by Maciej; some changes done after review.
2785
2786         - fixed <rdar://problem/4092064> hanging loading page; rte.ie (works in IE and Firefox)
2787         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5280
2788           Date.setMonth fails with negative values
2789         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5154
2790           JSC should switch to _r variants of unix time/date functions
2791         - fixed a few possible overflow cases
2792
2793         Retested all tests to be sure nothing broke; added layout test for bug 5280.
2794
2795         * kjs/config.h: Removed TIME_WITH_SYS_TIME define. Also set HAVE_SYS_TIMEB_H
2796         for the __APPLE__ case (the latter is accurate but irrelevant).
2797
2798         * kjs/date_object.h: Reformatted. Removed unnecessary include of "function_object.h".
2799         Moved declarations of helper classes and functions into the cpp file.
2800
2801         * kjs/date_object.cpp: Removed code at top to define macros to use CoreFoundation instead of
2802         POSIX date functions.
2803         (KJS::styleFromArgString): Tweaked to return early instead of using a variable.
2804         (KJS::formatLocaleDate): Tweaked to check for undefined rather than checking argument count.
2805         (KJS::formatDate): Made parameter const.
2806         (KJS::formatDateUTCVariant): Ditto.
2807         (KJS::formatTime): Ditto.
2808         (KJS::DateProtoFuncImp::callAsFunction): Use gmtime_r and localtime_r instead of gmtime and
2809         localtime.
2810         (KJS::DateObjectImp::callAsFunction): Use localtime_r instead of localtime.
2811         (KJS::ymdhmsToSeconds): Renamed from ymdhms_to_seconds. Changed computation to avoid possible
2812         overflow if year is an extremely large or small number.
2813         (KJS::makeTime): Removed code to move large month numbers from tm_mon to tm_year; this was
2814         to accomodate CFGregorianDate, which is no longer used (and didn't handle negative values).
2815         (KJS::parseDate): Renamed from KRFCDate_parseDate; changed to return a value in milliseconds
2816         rather than in seconds. Reformatted the code. Changed to use UTF8String() instead of ascii(),
2817         since ascii() is not thread safe. Changed some variables back from int to long to avoid
2818         trouble if the result of strtol does not fit in an int (64-bit issue only).
2819
2820 2005-10-08  Mitz Pettel  <opendarwin.org@mitzpettel.com>
2821
2822         Reviewed by Geoff.
2823         Tweaked and landed by Darin.
2824
2825         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5266
2826           Support parenthesized comments in Date.parse()
2827
2828         * kjs/date_object.cpp:
2829         (KJS::skipSpacesAndComments): Take a pointer, and advance it past spaces,
2830         and also past anything enclosed in parentheses.
2831         (KJS::KRFCDate_parseDate): Use skipSpacesAndComments wherever we formerly had
2832         code to skip spaces.
2833
2834 2005-10-08  Justin Haygood  <justin@xiondigital.net>
2835
2836         Reviewed, tweaked, and landed by Darin.
2837
2838         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5189
2839           pcre_exec.c fails to compile using MSVC
2840         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5190
2841           KJS config.h adjustment for Win32
2842         
2843         * kjs/config.h: Make sure HAVE_MMAP and HAVE_SBRK are off for Win32.
2844         Turn HAVE_ERRNO_H on for Mac OS X. Sort defines so they are easy to compare
2845         with each other. Remove #undef of DEBUG_COLLECTOR.
2846         * pcre/pcre_exec.c: (match): Work around strange MSVC complaint by splitting
2847         the definition of a local variable into a separate declaration and
2848         initialization.
2849
2850 2005-10-05  Geoffrey Garen  <ggaren@apple.com>
2851  
2852         - Darin and I rewrote our implementation of the SimpleNumber class
2853           to store number bit patterns in their floating point formats.
2854  
2855         My tweaks reviewed by Darin.
2856         
2857         ~1% speedup on JS iBench.
2858         
2859         * kjs/internal.h: removed obsolete jsNumber declarations.
2860         * kjs/math_object.cpp:
2861         (MathFuncImp::callAsFunction): changed KJS::isNaN to isNaN
2862         * kjs/nodes.cpp:
2863         (PostfixResolveNode::evaluate): removed obsolete knownToBeInteger
2864         (PostfixBracketNode::evaluate): ditto
2865         (PostfixDotNode::evaluate): ditto
2866         (PrefixResolveNode::evaluate): ditto
2867         (PrefixBracketNode::evaluate): ditto
2868         (PrefixDotNode::evaluate): ditto
2869         (NegateNode::evaluate): ditto
2870         (valueForReadModifyAssignment): ditto
2871         * kjs/number_object.cpp: removed obsolete comment
2872         * kjs/operations.cpp:
2873         (KJS::equal): removed unnecessary isNaN checks
2874         (KJS::strictEqual): ditto
2875         (KJS::add): removed obsolete knownToBeInteger
2876         (KJS::mult): ditto
2877         * kjs/operations.h: removed include of "value.h" to prevent circular reference
2878         * kjs/simple_number.h: removed unnecessary #includes
2879         (KJS::SimpleNumber::make): see above
2880         (KJS::SimpleNumber::is): ditto
2881         (KJS::SimpleNumber::value): ditto
2882         * kjs/string_object.cpp:
2883         (StringProtoFuncImp::callAsFunction): changed KJS::isNaN to isNaN
2884         * kjs/ustring.cpp: removed unnecessary isNaN check
2885         (KJS::UString::toUInt32): ditto
2886         * kjs/value.cpp:
2887         (KJS::jsNumber): removed obsolete jsNumber definitions
2888         (KJS::ConstantValues::init): NaN is no longer a ConstantValue
2889         (KJS::ConstantValues::clear): ditto
2890         (KJS::ConstantValues::mark): ditto
2891         * kjs/value.h: removed obsolete knownToBeInteger
2892         (KJS::jsNaN): now returns a SimpleNumber
2893         (KJS::ValueImp::getUInt32): changed to account for NaN being a SimpleNumber
2894         (KJS::ValueImp::toBoolean): ditto
2895         (KJS::ValueImp::toString): changed to account for +/- 0.0
2896         (KJS::jsZero): changed to reflect that SimpleNumber::make takes a double
2897         (KJS::jsOne): ditto
2898         (KJS::jsTwo): ditto
2899         (KJS::Number): removed obsolete non-double constructor declarations
2900
2901 2005-10-05  Maciej Stachowiak  <mjs@apple.com>
2902
2903         Reviewed by Eric.
2904
2905         - fixed <rdar://problem/4260481> Remove Reference type from JavaScriptCore
2906
2907         Also fixed some bugs with for..in enumeration while I was at it. object
2908         properties now come before prototype properties and duplicates
2909         between object and prototype are listed only once.
2910
2911         * JavaScriptCore.xcodeproj/project.pbxproj:
2912         * kjs/IdentifierSequencedSet.cpp: Added.
2913         (KJS::IdentifierSequencedSet::IdentifierSequencedSet):
2914         (KJS::IdentifierSequencedSet::deallocateVector):
2915         (KJS::IdentifierSequencedSet::~IdentifierSequencedSet):
2916         (KJS::IdentifierSequencedSet::insert):
2917         * kjs/IdentifierSequencedSet.h: Added.
2918         (KJS::IdentifierSequencedSetIterator::IdentifierSequencedSetIterator):
2919         (KJS::IdentifierSequencedSetIterator::operator*):
2920         (KJS::IdentifierSequencedSetIterator::operator->):
2921         (KJS::IdentifierSequencedSetIterator::operator++):
2922         (KJS::IdentifierSequencedSetIterator::operator==):
2923         (KJS::IdentifierSequencedSetIterator::operator!=):
2924         (KJS::IdentifierSequencedSet::begin):
2925         (KJS::IdentifierSequencedSet::end):
2926         (KJS::IdentifierSequencedSet::size):
2927         * kjs/array_instance.h:
2928         * kjs/array_object.cpp:
2929         (ArrayInstanceImp::getPropertyNames):
2930         (ArrayInstanceImp::setLength):
2931         (ArrayInstanceImp::pushUndefinedObjectsToEnd):
2932         * kjs/nodes.cpp:
2933         (ForInNode::execute):
2934         * kjs/nodes.h:
2935         * kjs/object.cpp:
2936         (KJS::ObjectImp::getPropertyNames):
2937         * kjs/object.h:
2938         * kjs/property_map.cpp:
2939         (KJS::PropertyMap::getEnumerablePropertyNames):
2940         (KJS::PropertyMap::getSparseArrayPropertyNames):
2941         * kjs/property_map.h:
2942         * kjs/protect.h:
2943         * kjs/protected_reference.h: Removed.
2944         * kjs/reference.cpp: Removed.
2945         * kjs/reference.h: Removed.
2946         * kjs/reference_list.cpp: Removed.
2947         * kjs/reference_list.h: Removed.
2948         * kjs/ustring.h:
2949         (KJS::UString::impl):
2950         * kxmlcore/HashSet.h:
2951
2952 2005-10-04  Eric Seidel  <eseidel@apple.com>
2953
2954         Reviewed by mjs.
2955
2956         Code cleanup, which resulted in a small win on iBench.
2957
2958         * kjs/object.cpp:
2959         (KJS::tryGetAndCallProperty): new static inline
2960         (KJS::ObjectImp::defaultValue): code cleanup
2961
2962 2005-10-03  Maciej Stachowiak  <mjs@apple.com>
2963
2964         Patch from George Staikos <staikos@kde.org>, reviewed and tweaked a bit by me.
2965
2966         - more Linux build fixes
2967         
2968         * kjs/operations.cpp:
2969         * kxmlcore/FastMalloc.h:
2970         * kxmlcore/TCSystemAlloc.cpp:
2971         (TCMalloc_SystemAlloc):
2972
2973 2005-10-03  Maciej Stachowiak  <mjs@apple.com>
2974
2975         Patch from George Staikos <staikos@kde.org>, reviewed and tweaked a bit by me.
2976
2977         http://bugzilla.opendarwin.org/show_bug.cgi?id=5174
2978         Add support for compiling on Linux (likely to help for other POSIX systems too)
2979
2980         * kjs/collector.cpp:
2981         (KJS::Collector::markCurrentThreadConservatively):
2982         (KJS::Collector::markOtherThreadConservatively):
2983         * kjs/config.h:
2984         * kjs/date_object.cpp:
2985         (KJS::formatDate):
2986         (KJS::formatDateUTCVariant):
2987         (KJS::formatTime):
2988         (KJS::timeZoneOffset):
2989         (KJS::DateProtoFuncImp::callAsFunction):
2990         (KJS::DateObjectImp::construct):
2991         (KJS::DateObjectImp::callAsFunction):
2992         (KJS::makeTime):
2993         * kjs/identifier.cpp:
2994         * kjs/internal.cpp:
2995         (KJS::initializeInterpreterLock):
2996         (KJS::lockInterpreter):
2997         (KJS::unlockInterpreter):
2998         (KJS::UndefinedImp::toPrimitive):
2999         (KJS::UndefinedImp::toBoolean):
3000         (KJS::UndefinedImp::toNumber):
3001         (KJS::UndefinedImp::toString):
3002         (KJS::NullImp::toPrimitive):
3003         (KJS::NullImp::toBoolean):
3004         (KJS::NullImp::toNumber):
3005         (KJS::NullImp::toString):
3006         (KJS::BooleanImp::toPrimitive):
3007         (KJS::BooleanImp::toBoolean):
3008         (KJS::BooleanImp::toNumber):
3009         (KJS::BooleanImp::toString):
3010         (KJS::StringImp::toPrimitive):
3011         (KJS::StringImp::toBoolean):
3012         (KJS::StringImp::toNumber):
3013         (KJS::StringImp::toString):
3014         * kjs/internal.h:
3015         * kjs/protected_values.cpp:
3016
3017 2005-10-03  Maciej Stachowiak  <mjs@apple.com>
3018
3019         - fix Development build after last checkin
3020
3021         * kxmlcore/FastMalloc.cpp:
3022         (KXMLCore::fastMallocRegisterThread):
3023
3024 2005-10-02  Maciej Stachowiak  <mjs@apple.com>
3025
3026         Reviewed by Darin.
3027
3028         <rdar://problem/4283967> REGRESSION: 3% regression on PLT from new FastMalloc
3029         http://bugzilla.opendarwin.org/show_bug.cgi?id=5243
3030         
3031         A number of optimizations to the new threadsafe malloc that make it actually as fast
3032         as dlmalloc (I measured wrong before) and as memory-efficient as the system malloc.
3033
3034         - use fastMalloc for everything - it now gets applied to all new/delete allocations
3035         via a private inline operator new that is now included into every file via config.h.
3036
3037         - tweaked some of the numeric parameters for size classes and amount of wasted memory
3038         allowed per allocation - this saves on memory use and consequently improves speed.
3039
3040         - so long as the allocator is not being used on background threads, get the per-thread
3041         cache from a global variable instead of from pthread_getspecific, since the latter is slow.
3042
3043         - inline more functions, and force the ones GCC refuses to inline with 
3044         attribute(always_inline), nearly all of these have one call site so inlining them has 
3045         to be a win.
3046
3047         - use some tricks to calculate allocation size more efficiently and fewer times for small
3048         allocations, to avoid hitting the huge size table array.
3049
3050         - avoid hitting the per-thread cache on code paths that don't need it.
3051
3052         - implement inline assembly version of spinlock for PowerPC (was already done for x86)
3053
3054         * bindings/NP_jsobject.cpp:
3055         * bindings/c/c_class.cpp:
3056         * bindings/c/c_instance.cpp:
3057         * bindings/c/c_runtime.cpp:
3058         * bindings/c/c_utility.cpp:
3059         * bindings/jni/jni_class.cpp:
3060         * bindings/jni/jni_instance.cpp:
3061         * bindings/jni/jni_jsobject.cpp:
3062         * bindings/jni/jni_objc.mm:
3063         * bindings/jni/jni_runtime.cpp:
3064         * bindings/jni/jni_utility.cpp:
3065         * bindings/npruntime.cpp:
3066         * bindings/objc/WebScriptObject.mm:
3067         * bindings/objc/objc_class.mm:
3068         * bindings/objc/objc_instance.mm:
3069         * bindings/objc/objc_runtime.mm:
3070         * bindings/objc/objc_utility.mm:
3071         * bindings/runtime.cpp:
3072         * bindings/runtime_array.cpp:
3073         * bindings/runtime_method.cpp:
3074         * bindings/runtime_object.cpp:
3075         * bindings/runtime_root.cpp:
3076         * bindings/testbindings.cpp:
3077         * bindings/testbindings.mm:
3078         * kjs/array_object.cpp:
3079         (ArrayInstanceImp::ArrayInstanceImp):
3080         (ArrayInstanceImp::~ArrayInstanceImp):
3081         (ArrayInstanceImp::resizeStorage):
3082         * kjs/bool_object.cpp:
3083         * kjs/collector.cpp:
3084         (KJS::Collector::registerThread):
3085         * kjs/config.h:
3086         * kjs/debugger.cpp:
3087         * kjs/error_object.cpp:
3088         * kjs/function.cpp:
3089         * kjs/function_object.cpp:
3090         * kjs/identifier.cpp:
3091         (KJS::Identifier::rehash):
3092         * kjs/internal.cpp:
3093         (KJS::Parser::saveNewNode):
3094         (KJS::clearNewNodes):
3095         * kjs/interpreter.cpp:
3096         * kjs/lexer.cpp:
3097         (Lexer::doneParsing):
3098         (Lexer::makeIdentifier):
3099         (Lexer::makeUString):
3100         * kjs/list.cpp:
3101         * kjs/math_object.cpp:
3102         * kjs/nodes.cpp:
3103         * kjs/nodes.h:
3104         * kjs/nodes2string.cpp:
3105         * kjs/number_object.cpp:
3106         (integer_part_noexp):
3107         (char_sequence):
3108         * kjs/object.cpp:
3109         * kjs/object_object.cpp:
3110         * kjs/property_map.cpp:
3111         * kjs/property_slot.cpp:
3112         * kjs/protected_values.cpp:
3113         (KJS::ProtectedValues::rehash):
3114         * kjs/reference.cpp:
3115         * kjs/reference_list.cpp:
3116         * kjs/regexp.cpp:
3117         * kjs/regexp_object.cpp:
3118         * kjs/scope_chain.cpp:
3119         * kjs/scope_chain.h:
3120         * kjs/string_object.cpp:
3121         * kjs/testkjs.cpp:
3122         * kjs/ustring.h:
3123         * kjs/value.cpp:
3124         * kxmlcore/Assertions.mm:
3125         * kxmlcore/FastMalloc.cpp:
3126         (KXMLCore::InitSizeClasses):
3127         (KXMLCore::DLL_IsEmpty):
3128         (KXMLCore::DLL_Prepend):
3129         (KXMLCore::TCMalloc_Central_FreeList::Insert):
3130         (KXMLCore::TCMalloc_Central_FreeList::Remove):
3131         (KXMLCore::TCMalloc_Central_FreeList::Populate):
3132         (KXMLCore::TCMalloc_ThreadCache::Allocate):
3133         (KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
3134         (KXMLCore::fastMallocRegisterThread):
3135         (KXMLCore::TCMalloc_ThreadCache::GetCache):
3136         (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
3137         (KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
3138         (KXMLCore::do_malloc):
3139         (KXMLCore::do_free):
3140         (KXMLCore::realloc):
3141         * kxmlcore/FastMalloc.h:
3142         (operator new):
3143         (operator delete):
3144         (operator new[]):
3145         (operator delete[]):
3146         * kxmlcore/HashTable.cpp:
3147         * kxmlcore/TCSpinLock.h:
3148         (TCMalloc_SpinLock::Lock):
3149         (TCMalloc_SpinLock::Unlock):
3150         (TCMalloc_SlowLock):
3151         * kxmlcore/TCSystemAlloc.cpp:
3152
3153 2005-09-30  Geoffrey Garen  <ggaren@apple.com>
3154
3155         - Second cut at fixing <rdar://problem/4275206> Denver Regression: Seed: 
3156           Past Editions of Opinions display "NAN/Undefined" for www.washingtonpost.com
3157                 
3158         Reviewed by john.
3159
3160         * kjs/date_object.cpp:
3161         (KJS::KRFCDate_parseDate): Intead of creating a timezone when one isn't specified,
3162         just rely on the fallback logic, which will do it for you. Also, return invalidDate
3163         if the date includes trailing garbage. (Somewhat accidentally, the timezone logic
3164         used to catch trailing garbage.)
3165
3166         Added test case to fast/js/date-parse-test.html.
3167
3168 2005-09-29  Eric Seidel  <eseidel@apple.com>
3169         Fix from Mitz Pettel <opendarwin.org@mitzpettel.com>
3170
3171         Reviewed by darin.
3172
3173         Fix JSC memory smasher in TOT.
3174         http://bugzilla.opendarwin.org/show_bug.cgi?id=5176
3175
3176         * pcre/pcre_exec.c:
3177         (match):
3178
3179 2005-09-29  Eric Seidel  <eseidel@apple.com>
3180         Fix from Mitz Pettel <opendarwin.org@mitzpettel.com>
3181
3182         Reviewed by mjs.
3183
3184         * JavaScriptCore.xcodeproj/project.pbxproj:
3185         Build fix for JSC+SVG after 5161.
3186         http://bugzilla.opendarwin.org/show_bug.cgi?id=5179
3187
3188 2005-09-28  Geoffrey Garen  <ggaren@apple.com>
3189
3190         - Fixed <rdar://problem/4275206> Denver Regression: Seed: Past Editions of Opinions display 
3191           "NAN/Undefined" for www.washingtonpost.com
3192           
3193         Reviewed by darin.
3194
3195         * kjs/date_object.cpp:
3196         (KJS::KRFCDate_parseDate): If the timezone isn't specified, rather than returning
3197         invalidDate, substitute the local timezone. This matches the behavior of FF/IE.
3198
3199 2005-09-28  Maciej Stachowiak  <mjs@apple.com>
3200
3201         Patch from George Staikos, reviewed by me.
3202
3203         - fixed some compile issues on Linux
3204         
3205         * kjs/property_slot.h:
3206         * kjs/simple_number.h:
3207
3208 2005-09-27  Maciej Stachowiak  <mjs@apple.com>
3209
3210         Reviewed by Eric.
3211
3212         - move HashMap/HashSet code down to JavaScriptCore
3213         http://bugzilla.opendarwin.org/show_bug.cgi?id=5161
3214         
3215         * JavaScriptCore.xcodeproj/project.pbxproj:
3216         * kjs/internal.cpp:
3217         (KJS::interpreterMap): Function that fetches the interpreter map on demand. 
3218         (KJS::InterpreterImp::InterpreterImp): Replace use of InterpreterMap
3219         class with an appropriate HashMap.
3220         (KJS::InterpreterImp::clear): ditto
3221         (KJS::InterpreterImp::interpreterWithGlobalObject): ditto
3222         * kjs/interpreter_map.cpp: Removed.
3223         * kjs/interpreter_map.h: Removed.
3224
3225         The HashMap/HashSet code (copied and slightly tweaked from WebCore)
3226         
3227         * kxmlcore/HashFunctions.h: Added.
3228         (KXMLCore::4):
3229         (KXMLCore::8):
3230         (KXMLCore::):
3231         (KXMLCore::PointerHash::hash):
3232         (KXMLCore::PointerHash::equal):
3233         * kxmlcore/HashMap.h: Added.
3234         (KXMLCore::extractFirst):
3235         (KXMLCore::HashMap::HashMap):
3236         (KXMLCore::::size):
3237         (KXMLCore::::capacity):
3238         (KXMLCore::::isEmpty):
3239         (KXMLCore::::begin):
3240         (KXMLCore::::end):
3241         (KXMLCore::::find):
3242         (KXMLCore::::contains):
3243         (KXMLCore::::set):
3244         (KXMLCore::::get):
3245         (KXMLCore::::remove):
3246         (KXMLCore::::clear):
3247         (KXMLCore::deleteAllValues):
3248         * kxmlcore/HashMapPtrSpec.h: Added.
3249         (KXMLCore::PointerHashIteratorAdapter::PointerHashIteratorAdapter):
3250         (KXMLCore::PointerHashIteratorAdapter::operator*):
3251         (KXMLCore::PointerHashIteratorAdapter::operator->):
3252         (KXMLCore::PointerHashIteratorAdapter::operator++):
3253         (KXMLCore::PointerHashIteratorAdapter::operator==):
3254         (KXMLCore::PointerHashIteratorAdapter::operator!=):
3255         (KXMLCore::PointerHashConstIteratorAdapter::PointerHashConstIteratorAdapter):
3256         (KXMLCore::PointerHashConstIteratorAdapter::operator*):
3257         (KXMLCore::PointerHashConstIteratorAdapter::operator->):
3258         (KXMLCore::PointerHashConstIteratorAdapter::operator++):
3259         (KXMLCore::PointerHashConstIteratorAdapter::operator==):
3260         (KXMLCore::PointerHashConstIteratorAdapter::operator!=):
3261         (KXMLCore::):
3262         * kxmlcore/HashSet.h: Added.
3263         (KXMLCore::identityExtract):
3264         (KXMLCore::convertAdapter):
3265         (KXMLCore::HashSet::HashSet):
3266         (KXMLCore::::size):
3267         (KXMLCore::::capacity):
3268         (KXMLCore::::isEmpty):
3269         (KXMLCore::::begin):
3270         (KXMLCore::::end):
3271         (KXMLCore::::find):
3272         (KXMLCore::::contains):
3273         (KXMLCore::::insert):
3274         (KXMLCore::::remove):
3275         (KXMLCore::::clear):
3276         * kxmlcore/HashTable.cpp: Added.
3277         (KXMLCore::HashTableStats::~HashTableStats):
3278         (KXMLCore::HashTableStats::recordCollisionAtCount):
3279         * kxmlcore/HashTable.h: Added.
3280         (KXMLCore::HashTableIterator::skipEmptyBuckets):
3281         (KXMLCore::HashTableIterator::HashTableIterator):
3282         (KXMLCore::HashTableIterator::operator*):
3283         (KXMLCore::HashTableIterator::operator->):
3284         (KXMLCore::HashTableIterator::operator++):
3285         (KXMLCore::HashTableIterator::operator==):
3286         (KXMLCore::HashTableIterator::operator!=):
3287         (KXMLCore::HashTableConstIterator::HashTableConstIterator):
3288         (KXMLCore::HashTableConstIterator::operator*):
3289         (KXMLCore::HashTableConstIterator::operator->):
3290         (KXMLCore::HashTableConstIterator::skipEmptyBuckets):
3291         (KXMLCore::HashTableConstIterator::operator++):
3292         (KXMLCore::HashTableConstIterator::operator==):
3293         (KXMLCore::HashTableConstIterator::operator!=):
3294         (KXMLCore::HashTable::HashTable):
3295         (KXMLCore::HashTable::~HashTable):
3296         (KXMLCore::HashTable::begin):
3297         (KXMLCore::HashTable::end):
3298         (KXMLCore::HashTable::size):
3299         (KXMLCore::HashTable::capacity):
3300         (KXMLCore::HashTable::insert):
3301         (KXMLCore::HashTable::isEmptyBucket):
3302         (KXMLCore::HashTable::isDeletedBucket):
3303         (KXMLCore::HashTable::isEmptyOrDeletedBucket):
3304         (KXMLCore::HashTable::hash):
3305         (KXMLCore::HashTable::equal):
3306         (KXMLCore::HashTable::identityConvert):
3307         (KXMLCore::HashTable::extractKey):
3308         (KXMLCore::HashTable::lookup):
3309         (KXMLCore::HashTable::shouldExpand):
3310         (KXMLCore::HashTable::mustRehashInPlace):
3311         (KXMLCore::HashTable::shouldShrink):
3312         (KXMLCore::HashTable::shrink):
3313         (KXMLCore::HashTable::clearBucket):
3314         (KXMLCore::HashTable::deleteBucket):
3315         (KXMLCore::HashTable::makeLookupResult):
3316         (KXMLCore::HashTable::makeIterator):
3317         (KXMLCore::HashTable::makeConstIterator):
3318         (KXMLCore::::lookup):
3319         (KXMLCore::::insert):
3320         (KXMLCore::::reinsert):
3321         (KXMLCore::::find):
3322         (KXMLCore::::contains):
3323         (KXMLCore::::remove):
3324         (KXMLCore::::allocateTable):
3325         (KXMLCore::::expand):
3326         (KXMLCore::::rehash):
3327         (KXMLCore::::clear):
3328         (KXMLCore::::HashTable):
3329         (KXMLCore::::swap):
3330         (KXMLCore::::operator):
3331         (KXMLCore::::checkTableConsistency):
3332         (KXMLCore::::checkTableConsistencyExceptSize):
3333         * kxmlcore/HashTraits.h: Added.
3334         (KXMLCore::HashTraits::emptyValue):
3335         (KXMLCore::):
3336         (KXMLCore::PairHashTraits::emptyValue):
3337         (KXMLCore::PairHashTraits::deletedValue):
3338
3339 2005-09-27  Darin Adler  <darin@apple.com>
3340
3341         Reviewed by Maciej.
3342
3343         - update grammar to fix conflicts; fixes one of our test cases
3344           because it resolves the relationship between function expressions
3345           and declarations in the way required by the ECMA specification
3346
3347         * kjs/grammar.y: Added lots of new grammar rules so we have no conflicts.
3348         A new set of rules for "no bracket or function at start of expression" and
3349         another set of rules for "no in anywhere in expression". Also simplified the
3350         handling of try to use only a single node and used operator precedence to
3351         get rid of the conflict in handling of if and else. Also used a macro to
3352         streamline the handling of automatic semicolons and changed parenthesis
3353         handling to use a virtual function.
3354
3355         * kjs/nodes.h: Added nodeInsideAllParens, removed unused abortStatement.
3356         (KJS::TryNode::TryNode): Updated to hold catch and finally blocks directly instead
3357         of using a special node for each.
3358         * kjs/nodes.cpp:
3359         (Node::createErrorCompletion): Added. Used instead of throwError when creating errors
3360         that should not be in a completion rather than an ExecState.
3361         (Node::throwUndefinedVariableError): Added. Sets source location unlike the call it
3362         replaces.
3363         (Node::nodeInsideAllParens): Added.
3364         (GroupNode::nodeInsideAllParens): Added.
3365         (StatListNode::execute): Removed code to move exceptions into completion objects;
3366         that's now done solely by the KJS_CHECKEXCEPTION macro.
3367         (TryNode::execute): Include execution of catch and finally here rather than using
3368         separate nodes.
3369         (FuncDeclNode::execute): Moved here, no longer inline.
3370         * kjs/nodes2string.cpp:
3371         (TryNode::streamTo): Updated for change.
3372         (FuncDeclNode::streamTo): Ditto.
3373         (FuncExprNode::streamTo): Ditto.
3374
3375         * kjs/kjs-test: Removed. Was part of "make check".
3376         * kjs/kjs-test.chk: Ditto.
3377         * kjs/test.js: Ditto.
3378
3379         * tests/mozilla/expected.html: Updated because one more test succeeds.
3380
3381 2005-09-27  Adele Peterson  <adele@apple.com>
3382
3383         Reviewed by Maciej.
3384
3385         Changed ints to size_t where appropriate.
3386
3387         * kjs/collector.cpp:
3388         (KJS::Collector::allocate):
3389         (KJS::Collector::markStackObjectsConservatively):
3390         (KJS::Collector::collect):
3391         (KJS::Collector::size):
3392         (KJS::Collector::numInterpreters):
3393         (KJS::Collector::numGCNotAllowedObjects):
3394         (KJS::Collector::numReferencedObjects):
3395         * kjs/collector.h:
3396
3397 2005-09-27  Eric Seidel  <eseidel@apple.com>
3398
3399         Reviewed by kevin.
3400
3401         * JavaScriptCore.xcodeproj/project.pbxproj: fix after malloc changes.
3402
3403 2005-09-27  Eric Seidel  <eseidel@apple.com>
3404
3405         Reviewed by mjs.
3406
3407         * kjs/nodes.cpp:
3408         (FuncExprNode::evaluate): Now sets .constructor properly.
3409         Test cases added to WebCore/layout-tests.
3410         http://bugzilla.opendarwin.org/show_bug.cgi?id=3537
3411
3412 2005-09-26  Maciej Stachowiak  <mjs@apple.com>
3413
3414         Reviewed by John.
3415
3416         - replace dlmalloc with tcmalloc
3417         http://bugzilla.opendarwin.org/show_bug.cgi?id=5145
3418
3419         I also moved SharedPtr and the assertion code from WebCore into a
3420         new kxmlcore directory.
3421         
3422         * JavaScriptCore.xcodeproj/project.pbxproj:
3423         * kjs/collector.cpp:
3424         (KJS::Collector::allocate):
3425         (KJS::Collector::collect):
3426         * kjs/config.h:
3427         * kjs/fast_malloc.cpp: Removed.
3428         * kjs/fast_malloc.h: Removed.
3429         * kjs/function.cpp:
3430         * kjs/function.h:
3431         * kjs/function_object.cpp:
3432         * kjs/identifier.cpp:
3433         (KJS::Identifier::add):
3434         * kjs/internal.cpp:
3435         * kjs/internal.h:
3436         * kjs/nodes.h:
3437         * kjs/nodes2string.cpp:
3438         * kjs/property_map.cpp:
3439         (KJS::PropertyMap::~PropertyMap):
3440         (KJS::PropertyMap::rehash):
3441         * kjs/scope_chain.h:
3442         * kjs/shared_ptr.h: Removed.
3443         * kjs/string_object.cpp:
3444         (StringObjectFuncImp::callAsFunction):
3445         * kjs/ustring.cpp:
3446         (KJS::UString::Rep::createCopying):
3447         (KJS::UString::Rep::destroy):
3448         (KJS::UString::expandCapacity):
3449         (KJS::UString::expandPreCapacity):
3450         (KJS::UString::UString):
3451         (KJS::UString::spliceSubstringsWithSeparators):
3452         (KJS::UString::append):
3453         (KJS::UString::operator=):
3454         (KJS::UString::detach):
3455         * kjs/ustring.h:
3456         * kxmlcore/Assertions.h: Added.
3457         * kxmlcore/Assertions.mm: Added.
3458         * kxmlcore/FastMalloc.cpp: Added.
3459         (KXMLCore::LgFloor):
3460         (KXMLCore::SizeClass):
3461         (KXMLCore::ByteSizeForClass):
3462         (KXMLCore::InitSizeClasses):
3463         (KXMLCore::MetaDataAlloc):
3464         (KXMLCore::PageHeapAllocator::Init):
3465         (KXMLCore::PageHeapAllocator::New):
3466         (KXMLCore::PageHeapAllocator::Delete):
3467         (KXMLCore::PageHeapAllocator::inuse):
3468         (KXMLCore::pages):
3469         (KXMLCore::AllocationSize):
3470         (KXMLCore::Event):
3471         (KXMLCore::NewSpan):
3472         (KXMLCore::DeleteSpan):
3473         (KXMLCore::DLL_Init):
3474         (KXMLCore::DLL_Remove):
3475         (KXMLCore::DLL_IsEmpty):
3476         (KXMLCore::DLL_Length):
3477         (KXMLCore::DLL_Print):
3478         (KXMLCore::DLL_Prepend):
3479         (KXMLCore::DLL_InsertOrdered):
3480         (KXMLCore::):
3481         (KXMLCore::TCMalloc_PageHeap::GetDescriptor):
3482         (KXMLCore::TCMalloc_PageHeap::SystemBytes):
3483         (KXMLCore::TCMalloc_PageHeap::FreeBytes):
3484         (KXMLCore::TCMalloc_PageHeap::RecordSpan):
3485         (KXMLCore::TCMalloc_PageHeap::TCMalloc_PageHeap):
3486         (KXMLCore::TCMalloc_PageHeap::New):
3487         (KXMLCore::TCMalloc_PageHeap::Split):
3488         (KXMLCore::TCMalloc_PageHeap::Carve):
3489         (KXMLCore::TCMalloc_PageHeap::Delete):
3490         (KXMLCore::TCMalloc_PageHeap::RegisterSizeClass):
3491         (KXMLCore::TCMalloc_PageHeap::Dump):
3492         (KXMLCore::TCMalloc_PageHeap::GrowHeap):
3493         (KXMLCore::TCMalloc_PageHeap::Check):
3494         (KXMLCore::TCMalloc_PageHeap::CheckList):
3495         (KXMLCore::TCMalloc_ThreadCache_FreeList::Init):
3496         (KXMLCore::TCMalloc_ThreadCache_FreeList::length):
3497         (KXMLCore::TCMalloc_ThreadCache_FreeList::empty):
3498         (KXMLCore::TCMalloc_ThreadCache_FreeList::lowwatermark):
3499         (KXMLCore::TCMalloc_ThreadCache_FreeList::clear_lowwatermark):
3500         (KXMLCore::TCMalloc_ThreadCache_FreeList::Push):
3501         (KXMLCore::TCMalloc_ThreadCache_FreeList::Pop):
3502         (KXMLCore::TCMalloc_ThreadCache::freelist_length):
3503         (KXMLCore::TCMalloc_ThreadCache::Size):
3504         (KXMLCore::TCMalloc_Central_FreeList::length):
3505         (KXMLCore::TCMalloc_Central_FreeList::Init):
3506         (KXMLCore::TCMalloc_Central_FreeList::Insert):
3507         (KXMLCore::TCMalloc_Central_FreeList::Remove):
3508         (KXMLCore::TCMalloc_Central_FreeList::Populate):
3509         (KXMLCore::TCMalloc_ThreadCache::SampleAllocation):
3510         (KXMLCore::TCMalloc_ThreadCache::Init):
3511         (KXMLCore::TCMalloc_ThreadCache::Cleanup):
3512         (KXMLCore::TCMalloc_ThreadCache::Allocate):
3513         (KXMLCore::TCMalloc_ThreadCache::Deallocate):
3514         (KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
3515         (KXMLCore::TCMalloc_ThreadCache::ReleaseToCentralCache):
3516         (KXMLCore::TCMalloc_ThreadCache::Scavenge):
3517         (KXMLCore::TCMalloc_ThreadCache::GetCache):
3518         (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
3519         (KXMLCore::TCMalloc_ThreadCache::PickNextSample):
3520         (KXMLCore::TCMalloc_ThreadCache::InitModule):
3521         (KXMLCore::TCMalloc_ThreadCache::InitTSD):
3522         (KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
3523         (KXMLCore::TCMalloc_ThreadCache::DeleteCache):
3524         (KXMLCore::TCMalloc_ThreadCache::RecomputeThreadCacheSize):
3525         (KXMLCore::TCMalloc_ThreadCache::Print):
3526         (KXMLCore::ExtractStats):
3527         (KXMLCore::DumpStats):
3528         (KXMLCore::PrintStats):
3529         (KXMLCore::DumpStackTraces):
3530         (KXMLCore::TCMallocImplementation::GetStats):
3531         (KXMLCore::TCMallocImplementation::ReadStackTraces):
3532         (KXMLCore::TCMallocImplementation::GetNumericProperty):
3533         (KXMLCore::TCMallocImplementation::SetNumericProperty):
3534         (KXMLCore::DoSampledAllocation):
3535         (KXMLCore::do_malloc):
3536         (KXMLCore::do_free):
3537         (KXMLCore::do_memalign):
3538         (KXMLCore::TCMallocGuard::TCMallocGuard):
3539         (KXMLCore::TCMallocGuard::~TCMallocGuard):
3540         (KXMLCore::malloc):
3541         (KXMLCore::free):
3542         (KXMLCore::calloc):
3543         (KXMLCore::cfree):
3544         (KXMLCore::realloc):
3545         (KXMLCore::memalign):
3546         (KXMLCore::posix_memalign):
3547         (KXMLCore::valloc):
3548         (KXMLCore::pvalloc):
3549         (KXMLCore::malloc_stats):
3550         (KXMLCore::mallopt):
3551         (KXMLCore::mallinfo):
3552         * kxmlcore/FastMalloc.h: Added.
3553         (KXMLCore::FastAllocated::operator new):
3554         (KXMLCore::FastAllocated::operator delete):
3555         (KXMLCore::FastAllocated::operator new[]):
3556         (KXMLCore::FastAllocated::operator delete[]):
3557         * kxmlcore/SharedPtr.h: Added.
3558         (KXMLCore::SharedPtr::SharedPtr):
3559         (KXMLCore::SharedPtr::~SharedPtr):
3560         (KXMLCore::SharedPtr::isNull):
3561         (KXMLCore::SharedPtr::notNull):
3562         (KXMLCore::SharedPtr::reset):
3563         (KXMLCore::SharedPtr::get):
3564         (KXMLCore::SharedPtr::operator*):
3565         (KXMLCore::SharedPtr::operator->):
3566         (KXMLCore::SharedPtr::operator!):
3567         (KXMLCore::SharedPtr::operator bool):
3568         (KXMLCore::::operator):
3569         (KXMLCore::operator==):
3570         (KXMLCore::operator!=):
3571         (KXMLCore::static_pointer_cast):
3572         (KXMLCore::const_pointer_cast):
3573         * kxmlcore/TCPageMap.h: Added.
3574         (TCMalloc_PageMap1::TCMalloc_PageMap1):
3575         (TCMalloc_PageMap1::Ensure):
3576         (TCMalloc_PageMap1::get):
3577         (TCMalloc_PageMap1::set):
3578         (TCMalloc_PageMap2::TCMalloc_PageMap2):
3579         (TCMalloc_PageMap2::get):
3580         (TCMalloc_PageMap2::set):
3581         (TCMalloc_PageMap2::Ensure):
3582         (TCMalloc_PageMap3::NewNode):
3583         (TCMalloc_PageMap3::TCMalloc_PageMap3):
3584         (TCMalloc_PageMap3::get):
3585         (TCMalloc_PageMap3::set):
3586         (TCMalloc_PageMap3::Ensure):
3587         * kxmlcore/TCSpinLock.h: Added.