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