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