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