initial import
[vuplus_webkit] / Source / JavaScriptCore / ChangeLog-2007-10-14
1 === Start merge of feature-branch 2007-10-12 ===
2
3 2007-10-11  Andrew Wellington  <proton@wiretapped.net>
4
5         Reviewed by Eric Seidel.
6         
7         Fix for http://bugs.webkit.org/show_bug.cgi?id=15076
8         "deg2rad has multiple definitions"
9         
10         Define deg2rad, rad2deg, deg2grad, grad2deg, rad2grad, grad2rad
11         These are used through WebKit.
12         
13         Change based on original patch by Rob Buis.
14
15         * wtf/MathExtras.h:
16         (deg2rad):
17         (rad2deg):
18         (deg2grad):
19         (grad2deg):
20         (rad2grad):
21         (grad2rad):
22
23 2007-10-10  Maciej Stachowiak  <mjs@apple.com>
24
25         Reviewed by Eric.
26         
27         - fix assertion failures on quit.
28
29         * kjs/array_object.cpp:
30         (ArrayProtoFunc::callAsFunction): Dynamically alocate function-scope static
31         UStrings to avoid the static destructor getting called later.
32         * kjs/lookup.h: Dynamically alocate function-scope static
33         Identifiers to avoid the static destructor getting called later.
34
35 2007-10-07  Ed Schouten  <ed@fxq.nl>
36
37         Reviewed and landed by Alexey Proskuryakov.
38
39         Add PLATFORM(FREEBSD), so we can fix the build on FreeBSD-like
40         systems by including <pthread_np.h>. Also fix some (disabled)
41         regcomp()/regexec() code; it seems some variable names have
42         changed.
43
44         * kjs/config.h:
45         * kjs/regexp.cpp:
46         (KJS::RegExp::RegExp):
47         * wtf/Platform.h:
48
49 2007-10-02  Alexey Proskuryakov  <ap@webkit.org>
50
51         Reviewed by Darin.
52
53         http://bugs.webkit.org/show_bug.cgi?id=10370
54         RegExp fails to match non-ASCII characters against [\S\s]
55
56         Test: fast/js/regexp-negative-special-characters.html
57
58         * pcre/pcre_compile.c:
59         (compile_branch): Adjust opcode and bitmap as necessary to include (or exclude)
60         character codes >255. Fix suggested by Philip Hazel.
61
62         * pcre/pcre_exec.c:
63         (match): Merged fix for PCRE bug 580 (\S\S vs. \S{2}).
64
65         * tests/mozilla/expected.html: One test was fixed.
66         * pcre/MERGING: Added information about this fix.
67
68 2007-10-02  Maciej Stachowiak  <mjs@apple.com>
69
70         Reviewed by Oliver.
71         
72         - skip extra hash lookup and avoid converting char* to UString for 19% speedup on CK JS array test 
73         http://bugs.webkit.org/show_bug.cgi?id=15350
74
75         * kjs/array_object.cpp:
76         (ArrayProtoFunc::callAsFunction): Implement the two mentioned optimizations.
77
78 2007-10-02  Maciej Stachowiak  <mjs@apple.com>
79
80         Reviewed by Mark.
81         
82         - Efficiently handle regexp property identifiers for 19% speedup on Celtic Kane regexp test
83         http://bugs.webkit.org/show_bug.cgi?id=15337
84
85         * kjs/CommonIdentifiers.h:
86         * kjs/regexp_object.cpp:
87         (RegExpProtoFunc::callAsFunction):
88         (RegExpObjectImp::arrayOfMatches):
89         (RegExpObjectImp::construct):
90
91 2007-10-02  Maciej Stachowiak  <mjs@apple.com>
92
93         Reviewed by Mark.
94         
95         - Cache global prorotypes more efficiently for 10% speedup on CK AJAX benchmark
96         http://bugs.webkit.org/show_bug.cgi?id=15335
97
98         * kjs/lookup.h:
99
100 2007-10-01  Oliver Hunt  <oliver@apple.com>
101
102         Reviewed by Mark.
103
104         Enable Experimental SVG features by default when building from Xcode
105
106         * Configurations/JavaScriptCore.xcconfig:
107
108 2007-09-29  Rob Buis  <buis@kde.org>
109
110         Reviewed by Adam.
111
112         http://bugs.webkit.org/show_bug.cgi?id=13472
113         Misparsing date in javascript leads to year value of -1
114         http://bugs.webkit.org/show_bug.cgi?id=14176
115         Some date values not handled consistently with IE/Firefox
116
117         Allow an optional comma between month and year, and year and time.
118
119         * kjs/date_object.cpp:
120         (KJS::parseDate):
121
122 2007-07-11  Nikolas Zimmermann  <zimmermann@kde.org>
123
124         Reviewed by Mark.
125
126         Forwardport the hash table fix from CodeGeneratorJS.pm to create_hash_table.
127         Reran run-jsc-tests, couldn't find any regressions. Suggested by Darin.
128
129         * kjs/create_hash_table:
130
131 2007-06-25  Antti Koivisto  <antti@apple.com>
132
133         Reviewed by Maciej.
134         
135         Use intHash to hash floats and doubles too.
136
137         * ChangeLog:
138         * wtf/HashFunctions.h:
139         (WTF::FloatHash::hash):
140         (WTF::FloatHash::equal):
141         (WTF::):
142         * wtf/HashTraits.h:
143         (WTF::FloatHashTraits::emptyValue):
144         (WTF::FloatHashTraits::deletedValue):
145         (WTF::):
146
147 === End merge of feature-branch 2007-10-12 ===
148
149 2007-10-11  Mark Rowe  <mrowe@apple.com>
150
151         Reviewed by Tim Hatcher.
152
153         Fix for <rdar://problem/5488678>.  Disable debugging symbols in production builds for 10.4
154         PowerPC to prevent a huge STABS section from being generated.
155
156         * Configurations/Base.xcconfig:
157
158 2007-10-08  George Staikos  <staikos@kde.org>
159
160         Reviewed by Adam Roben.
161
162         Fix Qt build on Win32.
163
164         * kjs/testkjs.cpp:
165         (main):
166
167 2007-10-10  Simon Hausmann  <hausmann@kde.org>
168
169         Reviewed by Lars.
170
171         Fix compilation using gcc 4.3. Header files have been reorganized and as a result some extra
172         includes are needed for INT_MAX, std::auto_ptr and the like.
173
174         * kjs/collector.cpp:
175         * kjs/collector.h:
176         * kjs/lexer.cpp:
177         * kjs/scope_chain.cpp:
178         * kjs/ustring.cpp:
179         * wtf/Vector.h:
180
181 2007-10-09  Lars Knoll  <lars@trolltech.com>
182
183         Reviewed by Simon.
184
185         fix the invokation of slots with return types. Add a JSLock around the conversion from QVariant to JSValue.
186
187         * bindings/qt/qt_instance.cpp:
188         (KJS::Bindings::QtInstance::invokeMethod):
189         * bindings/qt/qt_runtime.cpp:
190         (KJS::Bindings::convertValueToQVariant):
191         (KJS::Bindings::convertQVariantToValue):
192
193 2007-10-05  Geoffrey Garen  <ggaren@apple.com>
194
195         Reviewed by Sam Weinig.
196         
197         Added JSObject::removeDirect, to support the fix for 
198         <rdar://problem/5522487> REGRESSION: With JavaScript disabled, any 
199         page load causes a crash in PropertyMap::put
200
201         * kjs/object.cpp:
202         (KJS::JSObject::removeDirect):
203         * kjs/object.h:
204
205 2007-10-04  Mark Rowe  <mrowe@apple.com>
206
207         Reviewed by Oliver.
208
209         Switch to default level of debugging symbols to resolve <rdar://problem/5488678>.
210         The "full" level appears to offer no observable benefits even though the documentation
211         suggests it be used for dead code stripping.  This should also decrease link times.
212
213         * Configurations/Base.xcconfig:
214
215 2007-10-03  Lars Knoll  <lars@trolltech.com>
216
217         Reviewed by Rob.
218
219         Fix a stupid bug in Unicode::toUpper/toLower.
220         Fixes all three test failures in the JavaScriptCore test
221         suite.
222
223         * wtf/unicode/qt4/UnicodeQt4.h:
224         (WTF::Unicode::toLower):
225         (WTF::Unicode::toUpper):
226
227 2007-10-02  Darin Adler  <darin@apple.com>
228
229         Reviewed by Adam.
230
231         - add support for GDI objects to OwnPtr; I plan to use this
232           to fix some GDI handle leaks
233
234         * kjs/grammar.y: Change parser to avoid macros that conflict
235         with macros defined in Windows system headers: THIS, DELETE,
236         VOID, IN, and CONST. This is needed because OwnPtr.h will now
237         include <windows.h>.
238         * kjs/keywords.table: Ditto.
239
240         * wtf/OwnPtr.h: For PLATFORM(WIN), add support so that OwnPtr can be
241         a GDI handle, and it will call DeleteObject. Also change to use the
242         RemovePointer technique used by RetainPtr, so you can say OwnPtr<HBITMAP>
243         rather than having to pass in the type pointed to by HBITMAP.
244
245         * wtf/OwnPtrWin.cpp: Added.
246         (WebCore::deleteOwnedPtr): Put this in a separate file so that we
247         don't have to include <windows.h> in OwnPtr.h.
248
249         * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added OwnPtrWin.cpp.
250
251 2007-09-29  Holger Hans Peter Freyther  <zecke@selfish.org>
252
253         Reviewed by Mark.
254
255         -Fix http://bugs.webkit.org/show_bug.cgi?id=13226.
256         Remove Bakefiles from svn.
257
258         * JavaScriptCoreSources.bkl: Removed.
259         * jscore.bkl: Removed.
260
261 2007-09-27  Kevin Decker  <kdecker@apple.com>
262
263         Rubber stamped by John Sullivan.
264
265         <rdar://problem/5493093>
266         
267         * JavaScriptCore.order: Added.
268         * JavaScriptCore.xcodeproj/project.pbxproj: We're changing from using an order file built by
269          another team to using one we actually check into our project repository. Linker settings for
270          Symbol Ordering Flags have been updated accordingly.
271
272 2007-09-26  Adam Roben  <aroben@apple.com>
273
274         Make testkjs delay-load WebKit.dll so WebKitInitializer can work its magic
275
276         Rubberstamped by Anders.
277
278         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
279
280 2007-09-25  Adam Roben  <aroben@apple.com>
281
282         Make testkjs delay-load its dependencies
283
284         This lets WebKitInitializer re-route the dependencies to be loaded out
285         of the Safari installation directory.
286
287         Rubberstamped by Sam.
288
289         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
290
291 2007-09-25  David Kilzer  <ddkilzer@webkit.org>
292
293         Reviewed by Adam.
294
295         - Fix http://bugs.webkit.org/show_bug.cgi?id=14885
296           LGPL'ed files contain incorrect FSF address
297
298         * COPYING.LIB:
299         * bindings/testbindings.cpp:
300         * kjs/AllInOneFile.cpp:
301         * kjs/DateMath.cpp:
302         * kjs/PropertyNameArray.cpp:
303         * kjs/PropertyNameArray.h:
304         * kjs/config.h:
305
306 2007-09-25  Sam Weinig  <sam@webkit.org>
307
308         Fix location for build products for Debug_Internal.
309
310         Reviewed by Adam Roben.
311
312         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
313
314 2007-09-25  Adam Roben  <aroben@apple.com>
315
316         Make testkjs use WebKitInitializer
317
318         Reviewed by Sam.
319
320         * JavaScriptCore.vcproj/JavaScriptCore.sln: Add WebKitInitializer and
321         make testkjs depend on it.
322         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Link against
323         WebKitInitializer.lib.
324         * kjs/testkjs.cpp:
325         (main): Call initializeWebKit.
326
327 2007-09-24  Kevin McCullough  <kmccullough@apple.com>
328
329         Reviewed by Sam.
330
331         - Continued to update project files to not use Edit and Continue for Debug Information since it doesn't work and breaks some functionality.
332
333         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
334         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
335
336 2007-09-21  Kevin McCullough  <kmccullough@apple.com>
337
338         Reviewed by Sam.
339
340         - Updated project files to not use Edit and Continue for Debug Information since it doesn't work and breaks some functionality.
341
342         * JavaScriptCore.vcproj/dftables/dftables.vcproj:
343         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
344
345 2007-09-20  Holger Hans Peter Freyther  <zecke@selfish.org>
346
347         Rubber stamped by Adam.
348
349         Renamed files from *Gdk to *Gtk (see #14732) using the
350         work of Juan A. Suarez Romero as a base.
351
352         GDK -> GTK 
353
354         * JavaScriptCore.pri:
355         * kjs/testkjs.pro:
356         * pcre/dftables.pro:
357         * wtf/Platform.h: PLATFORM(GDK) to PLATFORM(GTK)
358
359 2007-09-21  Mark Rowe  <mrowe@apple.com>
360
361         Reviewed by Antti Koivisto.
362
363         http://bugs.webkit.org/show_bug.cgi?id=15250
364         <rdar://problem/5496942> REGRESSION: Reproducible crash in Safari when evaluating script in Drosera console (15250)
365
366         * kjs/function.cpp:
367         (KJS::GlobalFuncImp::callAsFunction): Null-check thisObj before passing it to interpreterForGlobalObject.
368
369 2007-09-19  Holger Hans Peter Freyther  <zecke@selfish.org>
370
371         Rubber stamped by Adam.
372
373         Make the guard/#if use the same name (ENABLE_FTPDIR) as the #define. This follows
374         the ENABLE_ICONDATABASE example from a couple of lines above.
375
376         * wtf/Platform.h:
377
378 2007-09-19  Mark Rowe  <mrowe@apple.com>
379
380         Reviewed by Maciej.
381
382         <rdar://problem/5487107> NULL dereference crash in FastMallocZone::enumerate when running leaks against Safari
383
384         Storing remote pointers to their local equivalents in mapped memory was leading to the local pointer being
385         interpreted as a remote pointer.  This caused a crash when using the result of mapping this invalid remote pointer.
386         The fix is to follow the pattern used elsewhere in FastMallocZone by always doing the mapping after reading and
387         never storing the mapped pointer.
388
389         * wtf/FastMalloc.cpp:
390         (WTF::FastMallocZone::enumerate):
391
392 2007-09-15  Darin Adler  <darin@apple.com>
393
394         - fix Mac build
395
396         * JavaScriptCore.exp: Export WTFLogVerbose.
397
398 2007-09-14  Kevin McCullough  <kmccullough@apple.com>
399
400         Reviewed by Sam.
401
402         - Copy JSRetainPtr to include folder.
403
404         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
405
406 2007-09-13  Geoffrey Garen  <ggaren@apple.com>
407
408         Try to fix GDK build.
409
410         * wtf/MathExtras.h:
411         (wtf_random_init):
412
413 2007-09-12  Geoff Garen  <ggaren@apple.com>
414
415         Reviewed by Sam Weinig.
416         
417         Fixed <rdar://problem/5429064> 141885 Safari JavaScript: Math.random() slightly less randomly distributed than on Safari / Mac
418
419         Math.random was skewed slightly upward because it assumed that RAND_MAX was outside the range of
420         values that rand() might return. This problem was particularly pronounced on Windows because
421         the range of values returned by rand() on Windows is 2^16 smaller than the range of values
422         return by rand() on Mac.
423         
424         Fixed by accounting for RAND_MAX return values. Also, switched Windows over to rand_s, which has
425         a range that's equal to rand()'s range on Mac.
426         
427         * kjs/config.h:
428
429         * kjs/math_object.cpp:
430         (MathFuncImp::callAsFunction): Use the new new thing.
431
432         * wtf/MathExtras.h: Platform abstraction for random numbers, to cover over differences on Windows.
433         (wtf_random_init):
434         (wtf_random):
435
436 2007-09-13  Antti Koivisto  <antti@apple.com>
437
438         Reviewed by Maciej.
439         
440         Small addition to previous path to cover
441         http://bugs.webkit.org/show_bug.cgi?id=11399
442         window.eval runs in the global scope of the calling window
443         
444         Switch variable scope as well.
445
446         * kjs/function.cpp:
447         (KJS::GlobalFuncImp::callAsFunction):
448
449 2007-09-12  Antti Koivisto  <antti@apple.com>
450
451         Reviewed by Geoff, Maciej.
452         
453         Fix <rdar://problem/5445058>
454         REGRESSION: Unable to upload picture to eBay auction due to domain security check
455         
456         eBay uses window.eval() between windows. In Firefox window.eval() switches execution
457         and security context to the target window, something WebKit did not do. With WebKit
458         security tightening in r24781, this broke picture uploads.
459         
460         Fix by making WebKit switch context in window.eval().
461         
462         * kjs/Context.cpp:
463         (KJS::Context::Context):
464         (KJS::Context::~Context):
465         * kjs/context.h:
466         Save and restore interpreter context independently from calling context.
467         
468         * kjs/function.cpp:
469         (KJS::GlobalFuncImp::callAsFunction):
470         If eval is called for global object different than current one, switch execution context
471         to that object and push it to scope.
472
473 2007-09-12  Sam Weinig  <sam@webkit.org>
474
475         Reviewed by Geoffrey Garen.
476
477         <rdar://problem/5478717> JSStringCreateWithCFString leaks when passed a zero length CFStringRef
478
479         * API/JSStringRefCF.cpp:
480         (JSStringCreateWithCFString): Special case the zero length string and remove the
481         UTF16 optimized path since it will always leak due to the fact that we won't be 
482         able to free the backing store that the CFStringRef provides.
483
484 2007-09-10  Timothy Hatcher  <timothy@apple.com>
485
486         Reviewed by Darin Adler.
487
488         <rdar://problem/5456224> CrashTracer: [USER] 2 crashes in Toast Titanium at com.apple.CoreServices.CarbonCore: CSMemDisposePtr + 37
489
490         Removed the implementation of these malloc zone functions. We do not have the ability to 
491         check if a pointer is valid or not, so we can't correctly implement them. The system free 
492         does not fail if you pass in a bad pointer.
493
494         * wtf/FastMalloc.cpp:
495         (WTF::FastMallocZone::size):
496         (WTF::FastMallocZone::zoneMalloc):
497         (WTF::FastMallocZone::zoneCalloc):
498         (WTF::FastMallocZone::zoneFree):
499         (WTF::FastMallocZone::zoneRealloc):
500
501 2007-09-07  Darin Adler  <darin@apple.com>
502
503         Reviewed by Steve Falkenburg.
504
505         - fix crash seen on Windows release builds
506
507         * wtf/FastMalloc.cpp: Change pthread_getspecific optimization to be done only
508         on the DARWIN platform. Also correct a couple reinterpret_cast that should be
509         static_cast instead.
510
511 2007-09-06  Kevin McCullough  <kmccullough@apple.com>
512
513         Reviewed by Maciej.
514
515         - Moved JSRetainPtr to the API.
516
517         * API/JSRetainPtr.h: Copied from kjs/JSRetainPtr.h.
518         (JSRetain):
519         (JSRelease):
520         (JSRetainPtr::JSRetainPtr):
521         (JSRetainPtr::~JSRetainPtr):
522         (JSRetainPtr::get):
523         (JSRetainPtr::releaseRef):
524         (JSRetainPtr::operator->):
525         (JSRetainPtr::operator!):
526         (JSRetainPtr::operator UnspecifiedBoolType):
527         (::operator):
528         (::adopt):
529         (::swap):
530         (swap):
531         (operator==):
532         (operator!=):
533         * JavaScriptCore.xcodeproj/project.pbxproj:
534         * kjs/JSRetainPtr.h: Removed.
535
536 2007-09-05  Maciej Stachowiak  <mjs@apple.com>
537
538         Reviewed by Darin.
539         
540         - Remove single-threaded optimization for FastMalloc. 
541         
542         It does not appear to help anywhere but Mac OS X on PPC, due to
543         pthread_getspecific being slow there. On Intel, removing the
544         optimization results in a ~1.5% PLT speedup, a ~1-5% JS iBench
545         speedup, and a ~1.5% HTML iBench speedup. On PPC this change is a
546         speedup on some benchmarks, a slight hit on others.
547
548         * JavaScriptCore.xcodeproj/project.pbxproj:
549         * kjs/collector.cpp:
550         (KJS::Collector::registerThread):
551         * wtf/FastMalloc.cpp:
552         (WTF::TCMalloc_ThreadCache::GetCache):
553         (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
554         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
555         (WTF::do_malloc):
556         * wtf/FastMallocInternal.h: Removed.
557
558 2007-09-05  Kevin McCullough  <kmccullough@apple.com>
559
560         Reviewed by Adam, Sam, Darin.
561
562         - Created a JSRetainPtr specifically for JSStringRefs so they can be automatically refed and derefed.
563
564         * JavaScriptCore.xcodeproj/project.pbxproj:
565         * kjs/JSRetainPtr.h: Copied from wtf/RetainPtr.h.
566         (KJS::JSRetain):
567         (KJS::JSRelease):
568         (KJS::):
569         (KJS::JSRetainPtr::JSRetainPtr):
570         (KJS::JSRetainPtr::~JSRetainPtr):
571         (KJS::JSRetainPtr::get):
572         (KJS::JSRetainPtr::releaseRef):
573         (KJS::JSRetainPtr::operator->):
574         (KJS::JSRetainPtr::operator UnspecifiedBoolType):
575         (KJS::::operator):
576         (KJS::::adopt):
577         (KJS::::swap):
578         (KJS::swap):
579         (KJS::operator==):
580         (KJS::operator!=):
581
582 2007-09-05  Mark Rowe  <mrowe@apple.com>
583
584         Unreviewed Qt build fix.
585
586         * wtf/unicode/qt4/UnicodeQt4.h: Fix the constness of the src argument to toUpper to prevent build failures.
587
588 2007-09-04  Maciej Stachowiak  <mjs@apple.com>
589
590         Back out accidentally committed change.
591
592         * JavaScriptCore.xcodeproj/project.pbxproj:
593         * kjs/collector.cpp:
594         (KJS::Collector::registerThread):
595         * wtf/FastMalloc.cpp:
596         (WTF::fastMallocSetIsMultiThreaded):
597         (WTF::TCMalloc_ThreadCache::GetCache):
598         (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
599         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
600         (WTF::do_malloc):
601         * wtf/FastMallocInternal.h: Added.
602
603 2007-09-04  Maciej Stachowiak  <mjs@apple.com>
604
605         Reviewed by Darin.
606         
607         - Added Vector::appendRange(), which appends to a vector based on a given start and end iterator
608         - Added keys() and values() functions to HashMap iterators, which give keys-only and values-only iterators
609         
610         Together, these allow easy copying of a set, or the keys or values of a map, into a Vector. Examples:
611         
612         HashMap<int, int> map;
613         HashSet<int> set;
614         Vector<int> vec;
615         // ...
616         vec.appendRange(set.begin(), set.end());
617         vec.appendRange(map.begin().keys(), map.end().keys());
618         vec.appendRange(map.begin().values(), map.end().values());
619
620         This also allows for a slightly nicer syntax when iterating a map. Instead of saying 
621         (*it)->first, you can say *it.values(). Similarly for keys. Example:
622         
623         HashMap<int, int>::const_iterator end = map.end();
624         for (HashMap<int, int>::const_iterator it = map.begin(); it != end; ++it)
625         printf(" [%d => %d]", *it.keys(), *it.values());
626
627         * JavaScriptCore.xcodeproj/project.pbxproj:
628         * wtf/HashIterators.h: Added.
629         (WTF::):
630         (WTF::HashTableConstKeysIterator::HashTableConstKeysIterator):
631         (WTF::HashTableConstKeysIterator::get):
632         (WTF::HashTableConstKeysIterator::operator*):
633         (WTF::HashTableConstKeysIterator::operator->):
634         (WTF::HashTableConstKeysIterator::operator++):
635         (WTF::HashTableConstValuesIterator::HashTableConstValuesIterator):
636         (WTF::HashTableConstValuesIterator::get):
637         (WTF::HashTableConstValuesIterator::operator*):
638         (WTF::HashTableConstValuesIterator::operator->):
639         (WTF::HashTableConstValuesIterator::operator++):
640         (WTF::HashTableKeysIterator::HashTableKeysIterator):
641         (WTF::HashTableKeysIterator::get):
642         (WTF::HashTableKeysIterator::operator*):
643         (WTF::HashTableKeysIterator::operator->):
644         (WTF::HashTableKeysIterator::operator++):
645         (WTF::HashTableKeysIterator::operator HashTableConstKeysIterator<HashTableType, KeyType, MappedType>):
646         (WTF::HashTableValuesIterator::HashTableValuesIterator):
647         (WTF::HashTableValuesIterator::get):
648         (WTF::HashTableValuesIterator::operator*):
649         (WTF::HashTableValuesIterator::operator->):
650         (WTF::HashTableValuesIterator::operator++):
651         (WTF::HashTableValuesIterator::operator HashTableConstValuesIterator<HashTableType, KeyType, MappedType>):
652         (WTF::operator==):
653         (WTF::operator!=):
654         * wtf/HashTable.h:
655         * wtf/Vector.h:
656         (WTF::::appendRange):
657
658 2007-09-04  Maciej Stachowiak  <mjs@apple.com>
659
660         Reviewed by Darin.
661         
662         - Remove single-threaded optimization for FastMalloc. 
663         
664         It does not appear to help anywhere but Mac OS X on PPC, due to
665         pthread_getspecific being slow there. On Intel, removing the
666         optimization results in a 1% PLT speedup, a 2% JS iBench speedup,
667         and no measurable effect on HTML iBench (maybe a slight speedup).
668
669         * JavaScriptCore.xcodeproj/project.pbxproj:
670         * kjs/collector.cpp:
671         (KJS::Collector::registerThread):
672         * wtf/FastMalloc.cpp:
673         (WTF::TCMalloc_ThreadCache::GetCache):
674         (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
675         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
676         (WTF::do_malloc):
677         * wtf/FastMallocInternal.h: Removed.
678
679 2007-09-03  Mark Rowe  <mrowe@apple.com>
680
681         Reviewed by Tim Hatcher.
682
683         <rdar://problem/5452164> Production build with in symbols directory has no debug info
684
685         Enable debug symbol generation on all build configurations.  Production builds are stripped
686         of symbols by Xcode during deployment post-processing.
687
688         * Configurations/Base.xcconfig:
689         * JavaScriptCore.xcodeproj/project.pbxproj:
690
691 2007-08-30  Riku Voipio  <riku.voipio@iki.fi>
692
693         Reviewed by Dave Kilzer.
694
695         Better ARM defines.
696
697         * kjs/ustring.h: Update comments to reflect the change and update test
698         to fit changes to Platform.h.
699         * wtf/Platform.h: Forced packing is only needed on oldabi ARM.
700         Set middle-endian floats only for little-endian oldabi ARM.
701         Set big-endian define for big-endian ARM.
702
703 2007-08-29  Ryan Leavengood <leavengood@gmail.com>
704
705         Reviewed by Maciej.
706
707         http://bugs.webkit.org/show_bug.cgi?id=15043
708         - posix_memalign takes a void** as its first parameter. My port makes use of this function call.
709
710         * kjs/collector.cpp:
711         (KJS::allocateBlock):
712
713 2007-08-26  Darin Adler  <darin@apple.com>
714
715         - quick follow on to that last check-in
716
717         * API/JSCallbackObject.cpp: (KJS::JSCallbackObject::JSCallbackObject):
718         Need to initialize m_class to 0.
719
720 2007-08-26  Mark Rowe  <mrowe@apple.com>
721
722         Reviewed by Darin Adler.
723
724         <rdar://problem/4949002> JSGlobalContextCreate can cause crashes because it passes a NULL JSContextRef to the globalObjectClass's initialize callback
725
726         JSCallbackObject now tracks whether it was constructed with a null ExecState.  This will happen when the object is being used as the global object,
727         as the Interpreter needs to be created after the global object.  In this situation the initialization is deferred until after the Interpreter's
728         ExecState is available to be passed down to the initialize callbacks.
729
730         * API/JSCallbackObject.cpp:
731         (KJS::JSCallbackObject::init): Track whether we successfully initialized.
732         (KJS::JSCallbackObject::initializeIfNeeded): Attempt to initialize with the new ExecState.
733         * API/JSCallbackObject.h:
734         * API/JSContextRef.cpp:
735         (JSGlobalContextCreate): Initialize the JSCallbackObject with the Interpreter's ExecState.
736         * API/testapi.c:
737         (testInitializeOfGlobalObjectClassHasNonNullContext):
738         (main): Verify that the context passed to the initialize callback is non-null.
739
740 2007-08-26  Mark Rowe  <mrowe@apple.com>
741
742         Reviewed by Darin Adler.
743
744         <rdar://problem/5438496> JSGlobalContextCreate crashes when passed a custom class
745
746         * API/JSContextRef.cpp:
747         (JSGlobalContextCreate): Specify jsNull() as the prototype and let Interpreter's constructor fix it up to point at builtinObjectPrototype().
748         * API/testapi.c:
749         (main): Use an instance of a custom class as the global object to ensure the code path is exercised in the test.
750
751 2007-08-26  Mike Hommey  <glandium@debian.org>
752
753         Reviewed by Mark Rowe and David Kilzer.
754
755         Fix build failure on arm.
756
757         * wtf/Platform.h: Also test if __arm__ is defined.
758
759 2007-08-25  Peter Kasting <pkasting@google.com>
760
761         Reviewed by Maciej Stachowiak.
762
763         Part 3 of http://bugs.webkit.org/show_bug.cgi?id=14967
764         Bug 14967: Reduce wtf::Vector::operator[]() overloads
765
766         * wtf/Vector.h:
767         (WTF::Vector::operator[]): Only provide versions of operator[] that takes a size_t argument.
768
769 2007-08-25  Peter Kasting <pkasting@google.com>
770
771         Reviewed by Sam Weinig.
772
773         Part 2 of http://bugs.webkit.org/show_bug.cgi?id=14967.
774         Eliminate all remaining implicit conversions of wtf::Vector<T> to T*.  Where code was
775         previously checking that the Vector's data pointer was non-NULL, check !Vector::isEmpty()
776         instead.
777
778         * wtf/Vector.h:
779         (WTF::Vector::data):
780
781 2007-08-16  Kevin McCullough  <kmccullough@apple.com>
782
783         Reviewed by Geoff and Adam.
784
785         - Changing stack depth to 500 (from 100 on mac and win) to help out some apps specifically gmail.  <rdar://problem/3590522> JavaScript call stack limit of 99 is too small for some applications; needs to be closer to 500 (4045)
786
787         * kjs/object.cpp:
788
789 2007-08-15  Peter Kasting  <pkasting@google.com>
790
791         Reviewed by Darin.
792         
793         http://bugs.webkit.org/show_bug.cgi?id=14967 part 1 - Eliminate most implicit
794         conversions of wtf::Vector<T> to T* by explicitly calling .data()
795
796         * API/JSCallbackConstructor.cpp:
797         (KJS::JSCallbackConstructor::construct):
798         * API/JSCallbackFunction.cpp:
799         (KJS::JSCallbackFunction::callAsFunction):
800         * API/JSCallbackObject.cpp:
801         (KJS::JSCallbackObject::construct):
802         (KJS::JSCallbackObject::callAsFunction):
803         * bindings/c/c_instance.cpp:
804         (KJS::Bindings::CInstance::invokeMethod):
805         (KJS::Bindings::CInstance::invokeDefaultMethod):
806         * kjs/number_object.cpp:
807         (integer_part_noexp):
808         (char_sequence):
809         * kjs/ustring.cpp:
810         (KJS::UString::UTF8String):
811
812 2007-08-14  Darin Adler  <darin@apple.com>
813
814         Reviewed by Sam.
815
816         - fix <rdar://problem/5410570> Global initializer introduced by use of std::numeric_limits in r24919
817
818         * kjs/ustring.cpp:
819         (KJS::overflowIndicator): Turned into a function.
820         (KJS::maxUChars): Ditto.
821         (KJS::allocChars): Use the functions.
822         (KJS::reallocChars): Ditto.
823         (KJS::UString::expandedSize): Ditto.
824
825 2007-08-12  Darin Adler  <darin@apple.com>
826
827         Reviewed by Maciej.
828
829         - fix http://bugs.webkit.org/show_bug.cgi?id=14931
830           <rdar://problem/5403816> JavaScript regular expression non-participating capturing parentheses
831           fail in 3 different ways
832
833         Test: fast/js/regexp-non-capturing-groups.html
834
835         * kjs/string_object.cpp:
836         (KJS::replace): Add missing code to handle undefined backreferences; before we'd get the empty string
837         instead of a JavaScript "undefined" value.
838         (KJS::StringProtoFunc::callAsFunction): Implemented backreference support for split.
839         * pcre/pcre_exec.c: (match): Made backreferences to undefined groups match the empty string instead
840         of always failing. Only in JAVASCRIPT mode.
841
842         * tests/mozilla/expected.html: Add a new expected test success, since this fixed one test result.
843
844 2007-08-10  Timothy Hatcher  <timothy@apple.com>
845
846         Reviewed by Adam.
847
848         <rdar://problem/5394449> Stop using some Carbon UI APIs for 64 bit
849
850         Disable the NPAPI for 64-bit on Mac OS X.
851
852         * Configurations/JavaScriptCore.xcconfig: Use the 64-bit export file.
853         * JavaScriptCore.xcodeproj/project.pbxproj: Create a 64-bit export file
854         that filters out the NPN fnctions.
855         * bindings/NP_jsobject.cpp: #ifdef out this for 64-bit on Mac OS X
856         * bindings/NP_jsobject.h: Ditto.
857         * bindings/c/c_class.cpp: Ditto.
858         * bindings/c/c_class.h: Ditto.
859         * bindings/c/c_instance.cpp: Ditto.
860         * bindings/c/c_instance.h: Ditto.
861         * bindings/c/c_runtime.cpp: Ditto.
862         * bindings/c/c_runtime.h: Ditto.
863         * bindings/c/c_utility.cpp: Ditto.
864         * bindings/c/c_utility.h: Ditto.
865         * bindings/npapi.h: Ditto.
866         * bindings/npruntime.cpp: Ditto.
867         * bindings/npruntime.h: Ditto.
868         * bindings/npruntime_impl.h: Ditto.
869         * bindings/npruntime_priv.h: Ditto.
870         * bindings/runtime.cpp:
871         (KJS::Bindings::Instance::createBindingForLanguageInstance):
872          don't creat an NPObject on Mac OS X in 64-bit.
873
874 2007-08-09  Mark Rowe  <mrowe@apple.com>
875
876         Reviewed by Antti.
877
878         <rdar://problem/5400709> Versioning in debug and release builds should include minor and tiny version before +
879
880         * Configurations/Version.xcconfig:
881         * JavaScriptCore.xcodeproj/project.pbxproj: Add a shell script phase to make to dependency between
882         Version.xcconfig and Info.plist explicit to Xcode.
883
884 2007-08-08  George Staikos  <staikos@kde.org>
885
886         Make it compile with Qt again.
887
888         * wtf/unicode/qt4/UnicodeQt4.h:
889         (WTF::Unicode::toUpper):
890
891 2007-08-07  Sam Weinig  <sam@webkit.org>
892
893         Reviewed by Oliver.
894
895         Fix for http://bugs.webkit.org/show_bug.cgi?id=14897
896         Decompilation of double negation fails and produces invalid or incorrect code
897
898         Test: fast/js/function-decompilation-operators.html
899
900         * kjs/nodes2string.cpp:
901         (UnaryPlusNode::streamTo): Put space after unary operator.  Matches Firefox.
902         (NegateNode::streamTo): Diito.
903         (MultNode::streamTo): Put spaces around binary operator.  Matches Firefox.
904         (AddNode::streamTo): Ditto.
905
906 2007-08-07  Darin Adler  <darin@apple.com>
907
908         Reviewed by Adele.
909
910         - fix <rdar://problem/5383104> REGRESSION: XHR.responseText is null instead of empty string
911           in http/tests/xmlhttprequest/zero-length-response.html
912
913         The new code to handle out of memory conditions was turning a "" into a null string.
914
915         * kjs/ustring.h: Removed UCharReference, which has long been obsolete and unused.
916         Removed copyForWriting, which was only used for the upper/lowercasing code and for
917         UCharReference.
918         * kjs/ustring.cpp:
919         (KJS::allocChars): Removed special case that made this fail (return 0) when passed 0.
920         Instead assert that we're not passed 0. Also added an overflow check for two reasons:
921         1) for sizes that aren't checked this prevents us from allocating a buffer that's too
922         small, and 2) for sizes where we overflowed in the expandedSize function and returned
923         overflowIndicator, it guarantees we fail.
924         (KJS::reallocChars): Ditto.
925         (KJS::UString::expandedSize): Return a large number, overflowIndicator, rather than 0
926         for cases where we overflow.
927         (KJS::UString::spliceSubstringsWithSeparators): Added a special case for empty string so
928         we don't call allocChars with a length of 0.
929         (KJS::UString::operator=): Added special characters for both 0 and empty string so we
930         match the behavior of the constructor. This avoids calling allocChars with a length of 0
931         and making a null string rather than an empty string in that case, and also matches the
932         pattern used in the rest of the functions.
933         (KJS::UString::operator[]): Made the return value const so code that tries to use the
934         operator to modify the string will fail.
935
936         * kjs/string_object.cpp: (KJS::StringProtoFunc::callAsFunction): Rewrote uppercasing and
937         lowercasing functions so they don't need copyForWriting any more -- it wasn't really doing
938         any good for optimization purposes. Instead use a Vector and releaseBuffer.
939
940         * wtf/unicode/icu/UnicodeIcu.h: Eliminate one of the versions of toLower/toUpper -- we now
941         only need the version where both a source and destination buffer is passed in, not the one
942         that works in place.
943         * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
944
945 2007-08-06  Sam Weinig  <sam@webkit.org>
946
947         Reviewed by Oliver.
948
949         Fix for http://bugs.webkit.org/show_bug.cgi?id=14891
950         Decompilation of try block immediately following "else" fails
951
952         Test: fast/js/toString-try-else.html
953
954         * kjs/nodes2string.cpp:
955         (TryNode::streamTo): Add newline before "try".
956
957 2007-08-07  Mark Rowe  <mrowe@apple.com>
958
959         Reviewed by Maciej.
960
961         <rdar://problem/5388774> REGRESSION: Hang occurs after clicking "Attach a file " link in a new .Mac message
962
963         Attempting to acquire the JSLock inside CollectorHeap::forceLock can lead to a deadlock if the thread currently
964         holding the lock is waiting on the thread that is forking.  It is not considered safe to use system frameworks
965         after a fork without first execing[*] so it is not particularly important to ensure that the collector and
966         fastMalloc allocators are unlocked in the child process.  If the child process wishes to use JavaScriptCore it
967         should exec after forking like it would to use any other system framework.
968         [*]: <http://lists.apple.com/archives/Cocoa-dev/2005/Jan/msg00676.html>
969
970         * kjs/CollectorHeapIntrospector.cpp: Remove forceLock and forceUnlock implementations.
971         * kjs/CollectorHeapIntrospector.h: Stub out forceLock and forceUnlock methods.
972         * wtf/FastMalloc.cpp: Ditto.
973
974 2007-08-06  Darin Adler  <darin@apple.com>
975
976         Rubber stamped by Geoff.
977
978         * kjs/ustring.h: Added an assertion which would have helped us find the
979         previous bug more easily.
980
981 2007-08-06  Darin Adler  <darin@apple.com>
982
983         Reviewed by Anders.
984
985         - fix <rdar://problem/5387589> 9A514: Quartz Composer crash on launch in KJS::jsString
986
987         * API/JSBase.cpp:
988         (JSEvaluateScript): Turn NULL for sourceURL into UString::null(), just as JSObjectMakeFunction already does.
989         (JSCheckScriptSyntax): Ditto.
990
991 2007-08-06  Matt Lilek  <pewtermoose@gmail.com>
992
993         Not reviewed, build fix.
994
995         * kjs/string_object.cpp:
996         (KJS::StringProtoFunc::callAsFunction):
997
998 2007-08-04  Darin Adler  <darin@apple.com>
999
1000         Reviewed by Maciej.
1001
1002         - fix <rdar://problem/5371862> crash in Dashcode due to Quartz Composer JavaScript garbage collector reentrancy
1003
1004         * API/JSBase.cpp: (JSGarbageCollect): Don't call collector() if isBusy() returns true.
1005
1006         * kjs/collector.h: Added isBusy(), removed the unused return value from collect()
1007         * kjs/collector.cpp: Added an "operation in progress" flag to the allocator.
1008         (KJS::Collector::allocate): Call abort() if an operation is already in progress. Set the new flag instead
1009         of using the debug-only GCLock.
1010         (KJS::Collector::collect): Ditto.
1011         (KJS::Collector::isBusy): Added.
1012
1013 2007-08-04  Maciej Stachowiak  <mjs@apple.com>
1014
1015         Reviewed by Darin and Adam.
1016         
1017         <rdar://problem/5368990> REGRESSION: newsgator.com sign-on 6x slower than Safari 3 beta due to GC changes (14808)
1018
1019         * kjs/string_object.cpp:
1020         (KJS::replace): if the string didn't change (very common in some cases) reuse the original string value.
1021         (KJS::StringProtoFunc::callAsFunction): Pass in the StringImp* when replacing, not just the UString.
1022         * kjs/string_object.h:
1023         (KJS::StringInstance::internalValue): covariant override to return StringImp for convenience
1024
1025 2007-08-04  Mark Rowe  <mrowe@apple.com>
1026
1027         Reviewed by Oliver Hunt.
1028
1029         <rdar://problem/5385145> r24843 introduces a crash on calling fork() (14878)
1030         http://bugs.webkit.org/show_bug.cgi?id=14878
1031
1032         Provide no-op functions for all members of the malloc_zone_t and malloc_introspection_t structures that we
1033         register to avoid crashes in system code that assumes they will be non-null.
1034
1035         * kjs/CollectorHeapIntrospector.cpp:
1036         (KJS::CollectorHeapIntrospector::CollectorHeapIntrospector):
1037         (KJS::CollectorHeapIntrospector::forceLock): Grab the lock.
1038         (KJS::CollectorHeapIntrospector::forceUnlock): Release the lock.
1039         * kjs/CollectorHeapIntrospector.h:
1040         (KJS::CollectorHeapIntrospector::goodSize):
1041         (KJS::CollectorHeapIntrospector::check):
1042         (KJS::CollectorHeapIntrospector::print):
1043         (KJS::CollectorHeapIntrospector::log):
1044         (KJS::CollectorHeapIntrospector::statistics):
1045         (KJS::CollectorHeapIntrospector::size):
1046         (KJS::CollectorHeapIntrospector::zoneMalloc):
1047         (KJS::CollectorHeapIntrospector::zoneCalloc):
1048         (KJS::CollectorHeapIntrospector::zoneFree):
1049         * wtf/FastMalloc.cpp:
1050         (WTF::FastMallocZone::goodSize):
1051         (WTF::FastMallocZone::check):
1052         (WTF::FastMallocZone::print):
1053         (WTF::FastMallocZone::log):
1054         (WTF::FastMallocZone::forceLock): Grab the TCMalloc locks.
1055         (WTF::FastMallocZone::forceUnlock): Release the TCMalloc locks.
1056         (WTF::FastMallocZone::FastMallocZone):
1057
1058 2007-08-04  Mark Rowe  <mrowe@apple.com>
1059
1060         Rubber-stamped by Anders.
1061
1062         * pcre/pcre_compile.c: Remove non-ASCII character from a comment.
1063
1064 2007-08-02  Mark Rowe  <mrowe@apple.com>
1065
1066         Reviewed by Geoff Garen.
1067
1068         <rdar://problem/4212199> 'leaks' reports false leaks in WebKit (because the WTF allocator uses mmap?)
1069
1070         Implement malloc zone introspection routines to allow leaks, heap, and friends to request information
1071         about specific memory regions that were allocated by FastMalloc or the JavaScriptCore collector.
1072
1073         This requires tool-side support before the regions will be displayed.  The addition of that support is
1074         tracked by <rdar://problems/5353057&5353060>.
1075
1076         * JavaScriptCore.exp: Export the two variables that are used by leaks to introspect the allocators.
1077         * JavaScriptCore.xcodeproj/project.pbxproj:
1078         * kjs/AllInOneFile.cpp:
1079         * kjs/CollectorHeapIntrospector.cpp: Added.
1080         (KJS::):
1081         (KJS::CollectorHeapIntrospector::init): 
1082         (KJS::CollectorHeapIntrospector::CollectorHeapIntrospector): Create and register our zone with the system.
1083         (KJS::CollectorHeapIntrospector::enumerate): Iterate over the CollectorBlocks that are in use and report them to the caller as being used.
1084         * kjs/CollectorHeapIntrospector.h: Added.
1085         (KJS::CollectorHeapIntrospector::size): Return zero to indicate the specified pointer does not belong to this zone.
1086         * kjs/collector.cpp:
1087         (KJS::Collector::registerThread): Register the CollectorHeapIntrospector with the system when the first thread is registered with the collector.
1088         * wtf/FastMalloc.cpp:
1089         (WTF::TCMalloc_PageHeap::GetDescriptorEnsureSafe):
1090         (WTF::TCMalloc_ThreadCache_FreeList::enumerateFreeObjects): Enumerate the objects on the free list.
1091         (WTF::TCMalloc_ThreadCache::enumerateFreeObjects): Ditto.
1092         (WTF::TCMalloc_Central_FreeList::enumerateFreeObjects): Ditto.
1093         (WTF::TCMalloc_ThreadCache::InitModule): Register the FastMallocZone with the system when initializing TCMalloc.
1094         (WTF::FreeObjectFinder::FreeObjectFinder):
1095         (WTF::FreeObjectFinder::visit): Add an object to the free list.
1096         (WTF::FreeObjectFinder::isFreeObject):
1097         (WTF::FreeObjectFinder::freeObjectCount):
1098         (WTF::FreeObjectFinder::findFreeObjects): Find the free objects within a thread cache or free list.
1099         (WTF::PageMapFreeObjectFinder::PageMapFreeObjectFinder): Find the free objects within a TC_PageMap.
1100         (WTF::PageMapFreeObjectFinder::visit): Called once per allocated span.  Record whether the span or any subobjects are free.
1101         (WTF::PageMapMemoryUsageRecorder::PageMapMemoryUsageRecorder):
1102         (WTF::PageMapMemoryUsageRecorder::visit): Called once per allocated span.  Report the range of memory as being allocated, and the span or
1103         its subobjects as being used if they do not appear on the free list.
1104         (WTF::FastMallocZone::enumerate): Map the key remote TCMalloc data structures into our address space.  We then locate all free memory ranges
1105         before reporting the other ranges as being in use.
1106         (WTF::FastMallocZone::size): Determine whether the given pointer originates from within our allocation zone.  If so,
1107         we return its allocation size.
1108         (WTF::FastMallocZone::zoneMalloc):
1109         (WTF::FastMallocZone::zoneCalloc):
1110         (WTF::FastMallocZone::zoneFree):
1111         (WTF::FastMallocZone::zoneRealloc):
1112         (WTF::):
1113         (WTF::FastMallocZone::FastMallocZone): Create and register our zone with the system.
1114         (WTF::FastMallocZone::init):
1115         * wtf/MallocZoneSupport.h: Added.
1116         (WTF::RemoteMemoryReader::RemoteMemoryReader): A helper class to ease the process of mapping memory in a different process into
1117         our local address space
1118         (WTF::RemoteMemoryReader::operator()):
1119         * wtf/TCPageMap.h:
1120         (TCMalloc_PageMap2::visit): Walk over the heap and visit each allocated span.
1121         (TCMalloc_PageMap3::visit): Ditto.
1122
1123 2007-08-02  Mark Rowe  <mrowe@apple.com>
1124
1125         Build fix.
1126
1127         * kjs/ustring.cpp:
1128         (KJS::UString::expandedSize):  Use std::numeric_limits<size_t>::max() rather than the non-portable SIZE_T_MAX.
1129
1130 2007-08-02  Mark Rowe  <mrowe@apple.com>
1131
1132         Reviewed by Maciej.
1133
1134         <rdar://problem/5352887> "Out of memory" error during repeated JS string concatenation leaks hundreds of MBs of RAM
1135
1136         A call to fastRealloc was failing which lead to UString::expandCapacity leaking the buffer it was trying to reallocate.
1137         It also resulted in the underlying UString::rep having both a null baseString and buf field, which meant that attempting
1138         to access the contents of the string after the failed memory reallocation would crash.
1139
1140         A third issue is that expandedSize size was calculating the new length in a way that led to an integer overflow occurring.
1141         Attempting to allocate a string more than 190,000,000 characters long would fail a the integer overflow would lead to a
1142         memory allocation of around 3.6GB being attempted rather than the expected 390MB.  Sizes that would lead to an overflow
1143         are now  returned as zero and callers are updated to treat this as though the memory allocation has failed.
1144
1145         * kjs/array_object.cpp:
1146         (ArrayProtoFunc::callAsFunction): Check whether the append failed and raise an "Out of memory" exception if it did.
1147         * kjs/ustring.cpp:
1148         (KJS::allocChars): Wrapper around fastMalloc that takes a length in characters.  It will return 0 when asked to allocate a zero-length buffer.
1149         (KJS::reallocChars): Wrapper around fastRealloc that takes a length in characters.  It will return 0 when asked to allocate a zero-length buffer.
1150         (KJS::UString::expandedSize): Split the size calculation in two and guard against overflow during each step.
1151         (KJS::UString::expandCapacity): Don't leak r->buf if reallocation fails.  Instead free the memory and use the null representation.
1152         (KJS::UString::expandPreCapacity): If fastMalloc fails then use the null representation rather than crashing in memcpy.
1153         (KJS::UString::UString): If calls to expandCapacity, expandPreCapacity or fastMalloc fail then use the null representation rather than crashing in memcpy.
1154         (KJS::UString::append): Ditto.
1155         (KJS::UString::operator=): Ditto.
1156         * kjs/ustring.h: Change return type of expandedSize from int to size_t.
1157
1158 2007-08-01  Darin Adler  <darin@apple.com>
1159
1160         Reviewed by Kevin McCullough.
1161
1162         - fix <rdar://problem/5375186> pointers to pieces of class definition passed to JSClassCreate should all be const
1163
1164         * API/JSObjectRef.h: Added const.
1165
1166         * API/JSClassRef.cpp:
1167         (OpaqueJSClass::OpaqueJSClass): Added const.
1168         (OpaqueJSClass::create): Added const.
1169         * API/JSObjectRef.cpp:
1170         (JSClassCreate): Added const.
1171
1172 2007-08-01  Steve Falkenburg  <sfalken@apple.com>
1173
1174         Build mod: Fix sln to match configs in vcproj.
1175         
1176         Reviewed by Adam.
1177
1178         * JavaScriptCore.vcproj/JavaScriptCore.make:
1179         * JavaScriptCore.vcproj/JavaScriptCore.sln:
1180
1181 2007-07-30  Simon Hausmann  <hausmann@kde.org>
1182
1183         Done with and reviewed by Lars.
1184
1185         Removed the __BUILDING_QT ifdef in JSStringRef.h and changed UChar for the Qt build to use wchar_t on Windows.
1186
1187         * API/JSStringRef.h:
1188         * wtf/unicode/qt4/UnicodeQt4.h:
1189
1190 2007-07-27  Simon Hausmann  <hausmann@kde.org>
1191
1192         Done with and reviewed by Lars and Zack.
1193
1194         Always define JSChar to be unsigned short for the Qt builds, to ensure compatibility with UChar.
1195
1196         * API/JSStringRef.h:
1197
1198 2007-07-27  Simon Hausmann  <hausmann@kde.org>
1199
1200         Done with and reviewed by Lars and Zack.
1201
1202         Fix compilation with Qt on Windows with MingW: Implemented currentThreadStackBase() for this platform.
1203
1204         * kjs/collector.cpp:
1205         (KJS::currentThreadStackBase):
1206
1207 2007-07-27  Simon Hausmann  <hausmann@kde.org>
1208
1209         Done with and reviewed by Lars and Zack.
1210
1211         Fix compilation with Qt on Windows with MingW: The MingW headers do not provide a prototype for a reentrant version of localtime. But since we don't use multiple threads for the Qt build we can use the plain localtime() function.
1212
1213         * kjs/DateMath.cpp:
1214         (KJS::getDSTOffsetSimple):
1215
1216 2007-07-27  Simon Hausmann  <hausmann@kde.org>
1217
1218         Done with and reviewed by Lars and Zack.
1219
1220         Use $(MOVE) instead of mv to eliminated the shell dependency and replaced the long shell line to call bison and modify the css grammar file with a few lines of portable perl code.
1221
1222         * JavaScriptCore.pri:
1223
1224 2007-07-27  Simon Hausmann  <hausmann@kde.org>
1225
1226         Done with and reviewed by Lars and Zack.
1227
1228         Implemented currentTime() in the interpreter by using QDateTime, so that we don't need timeGetTime() on Windows and therefore also don't need to link against Winmm.dll.
1229
1230         * kjs/interpreter.cpp:
1231         (KJS::getCurrentTime):
1232         * kjs/testkjs.cpp:
1233         (StopWatch::start):
1234         (StopWatch::stop):
1235
1236 2007-07-27  Simon Hausmann  <hausmann@kde.org>
1237
1238         Done with and reviewed by Lars and Zack.
1239
1240         Replace the use of snprintf with QByteArray to compile under msvc 2005 express.
1241
1242         * bindings/qt/qt_instance.cpp:
1243         (KJS::Bindings::QtInstance::stringValue):
1244
1245 2007-07-27  Simon Hausmann  <hausmann@kde.org>
1246
1247         Done with and reviewed by Lars and Zack.
1248
1249         Don't use pthread.h unless thread support is enabled.
1250
1251         * kjs/collector.cpp:
1252         (KJS::Collector::registerAsMainThread):
1253         (KJS::onMainThread):
1254
1255 2007-07-27  Simon Hausmann  <hausmann@kde.org>
1256
1257         Done with and reviewed by Lars and Zack.
1258
1259         Removed TCSystemMalloc from the Qt build, it's not necessary it seems.
1260
1261         * JavaScriptCore.pri:
1262
1263 2007-07-27  Simon Hausmann  <hausmann@kde.org>
1264
1265         Done with and reviewed by Lars and Zack.
1266
1267         Added os-win32 to the include search path for the Qt windows build in order to provide the fake stdint.h header file.
1268
1269         * JavaScriptCore.pri:
1270
1271 2007-07-25  Maciej Stachowiak  <mjs@apple.com>
1272
1273         Reviewed by Mark.
1274
1275         - follow-up to previous change
1276         
1277         * kjs/ustring.cpp:
1278         (KJS::UString::operator=): Make sure to reset the length when
1279         replacing the buffer contents for a single-owned string.
1280
1281 2007-07-25  Maciej Stachowiak  <mjs@apple.com>
1282
1283         Reviewed by Darin.
1284         
1285         - JavaScriptCore part of fix for <rdar://problem/5300291> Optimize GC to reclaim big, temporary objects (like XMLHttpRequest.responseXML) quickly
1286         
1287         Also, as a side effect of optimizations included in this patch:
1288         - 7% speedup on JavaScript iBench
1289         - 4% speedup on "Celtic Kane" JS benchmark
1290         
1291         The basic idea is explained in a big comment in collector.cpp. When unusually 
1292         large objecs are allocated, we push the next GC closer on the assumption that
1293         most objects are short-lived.
1294         
1295         I also did the following two optimizations in the course of tuning
1296         this not to be a performance regression:
1297
1298         1) Change UString::Rep to hold a self-pointer as the baseString in
1299         the unshared case, instead of a null pointer; this removes a
1300         number of null checks in hot code because many places already
1301         wanted to use the rep itself or the baseString as appropriate.
1302         
1303         2) Avoid creating duplicate StringImpls when creating a
1304         StringInstance (the object wrapper for a JS string) or calling
1305         their methods. Since a temporary wrapper object is made every time
1306         a string method is called, this resulted in two useless extra
1307         StringImpls being allocated for no reason whenever a String method
1308         was invoked on a string value. Now we bypass those.
1309         
1310         * kjs/collector.cpp:
1311         (KJS::):
1312         (KJS::Collector::recordExtraCost): Basics of the extra cost mechanism.
1313         (KJS::Collector::allocate): ditto
1314         (KJS::Collector::collect): ditto
1315         * kjs/collector.h:
1316         (KJS::Collector::reportExtraMemoryCost): ditto
1317         * kjs/array_object.cpp:
1318         (ArrayInstance::ArrayInstance): record extra cost
1319         * kjs/internal.cpp:
1320         (KJS::StringImp::toObject): don't create a whole new StringImpl just
1321         to be the internal value of a StringInstance! StringImpls are immutable
1322         so there's no point tot his.
1323         * kjs/internal.h:
1324         (KJS::StringImp::StringImp): report extra cost
1325         * kjs/string_object.cpp:
1326         (KJS::StringInstance::StringInstance): new version that takes a StringImp
1327         (KJS::StringProtoFunc::callAsFunction): don't create a whole new StringImpl
1328         just to convert self to string! we already have one in the internal value
1329         * kjs/string_object.h: report extra cost        
1330         * kjs/ustring.cpp: All changes to handle baseString being self instead of null in the 
1331         unshared case.
1332         (KJS::):
1333         (KJS::UString::Rep::create):
1334         (KJS::UString::Rep::destroy):
1335         (KJS::UString::usedCapacity):
1336         (KJS::UString::usedPreCapacity):
1337         (KJS::UString::expandCapacity):
1338         (KJS::UString::expandPreCapacity):
1339         (KJS::UString::UString):
1340         (KJS::UString::append):
1341         (KJS::UString::operator=):
1342         (KJS::UString::copyForWriting):
1343         * kjs/ustring.h:
1344         (KJS::UString::Rep::baseIsSelf): new method, now that baseString is
1345         self instead of null in the unshared case we can't just null check.
1346         (KJS::UString::Rep::data): adjusted as mentioned above
1347         (KJS::UString::cost): new method to compute the cost for a UString, for
1348         use by StringImpl.
1349
1350         * kjs/value.cpp:
1351         (KJS::jsString): style fixups.
1352         (KJS::jsOwnedString): new method, use this for strings allocated from UStrings
1353         held by the parse tree. Tracking their cost as part of string cost is pointless,
1354         because garbage collecting them will not actually free the relevant string buffer.
1355         * kjs/value.h: prototyped jsOwnedString.
1356         * kjs/nodes.cpp:
1357         (StringNode::evaluate): use jsOwnedString as appropriate
1358         (RegExpNode::evaluate): ditto
1359         (PropertyNameNode::evaluate): ditto
1360         (ForInNode::execute): ditto
1361         
1362         * JavaScriptCore.exp: Exported some new symbols.
1363
1364 2007-07-23  Anders Carlsson  <andersca@apple.com>
1365
1366         Reviewed by Geoff.
1367
1368         <rdar://problem/5121461> REGRESSION: Unable to load JigZone puzzle
1369         
1370         * bindings/jni/jni_jsobject.cpp:
1371         (JavaJSObject::createNative):
1372         
1373         Call RootObject::gcProtect on the global object, thereby putting it in the
1374         "protect count" set which is used for checking if a native handle is valid.
1375         
1376 2007-07-23  Darin Adler  <darin@apple.com>
1377
1378         * pcre/pcre_compile.c: Roll back a tiny accidental change in the unused !JAVASCRIPT
1379         side of an #ifdef. This has no effect when using PCRE in JAVASCRIPT mode as we do,
1380         but seems worth rolling back.
1381
1382 2007-07-23  Maciej Stachowiak  <mjs@apple.com>
1383
1384         Reviewed by Oliver.
1385         
1386         - fix remaining problems with Window shadowing
1387
1388         * kjs/nodes.cpp:
1389         (VarDeclNode::evaluate): Tweak the special case a little.
1390
1391 2007-07-23  Maciej Stachowiak  <mjs@apple.com>
1392
1393         Reviewed by Oliver.
1394         
1395         - fix Window shadowing regressions caused by the previous commit.
1396
1397         * kjs/nodes.cpp:
1398         (VarDeclNode::evaluate): Handle the case of global scope specially.
1399
1400 2007-07-22  Maciej Stachowiak  <mjs@apple.com>
1401
1402         Reviewed by Darin.
1403
1404         -fixed <rdar://problem/5353293> REGRESSION (r24287): 1% i-Bench JS slowdown from JavaScript compatibility fix (14719)
1405         http://bugs.webkit.org/show_bug.cgi?id=14719
1406         
1407         My fix for this actually resulted in JS iBench being 1% faster than before the regression
1408         and the Celtic Kane benchmark being 5% faster than before the regression.
1409         
1410         * kjs/nodes.cpp:
1411         (VarDeclNode::handleSlowCase): factored out the slow code path to be out of line.
1412         (VarDeclNode::evaluate): I did a couple of things:
1413         (1) Don't check if the variable is already declared by looking for the property in
1414         the variable object, that code path was dead code.
1415         (2) Special-case the common case where the top of the scope and the variable object
1416         are the same; in that case the variable must always be in the variable object.
1417         (3) Don't return a jsString() of the variable name, nothing uses the return value
1418         from this node types evaluate method.
1419         * kjs/nodes.h:
1420
1421 2007-07-22  Darin Adler  <darin@apple.com>
1422
1423         Reviewed by Kevin Decker.
1424
1425         - fix <rdar://problem/5126394> REGRESSION: Crash after clicking back button in test application (13250)
1426           http://bugs.webkit.org/show_bug.cgi?id=13250
1427
1428         * bindings/objc/objc_utility.mm: (KJS::Bindings::convertObjcValueToValue):
1429         If the object returns 0 for _imp, convert that to "undefined", since callers
1430         can't cope with a JSValue of 0.
1431
1432 2007-07-19  Geoffrey Garen  <ggaren@apple.com>
1433
1434         Reviewed by Darin Adler.
1435         
1436         Fixed http://bugs.webkit.org/show_bug.cgi?id=10880 | <rdar://problem/5335694>
1437         REGRESSION: JavaScript menu doesn't appear on pricepoint.com (14595)
1438         
1439         Though the ECMA spec says auto-semicolon insertion should not occur
1440         without a newline or '}', Firefox treats do-while specially, and the
1441         library used by pricepoint.com requires that special treatment.
1442         
1443         * JavaScriptCore.xcodeproj/project.pbxproj:
1444         * kjs/grammar.y:
1445
1446 2007-07-19  Darin Adler  <darin@apple.com>
1447
1448         Reviewed by Geoff.
1449
1450         - fix <rdar://problem/5345440> PCRE computes wrong length for expressions with quantifiers
1451           on named recursion or subexpressions
1452
1453         It's challenging to implement proper preflighting for compiling these advanced features.
1454         But we don't want them in the JavaScript engine anyway.
1455
1456         Turned off the following features of PCRE (some of these are simply parsed and not implemented):
1457
1458             \C \E \G \L \N \P \Q \U \X \Z
1459             \e \l \p \u \z
1460             [::] [..] [==]
1461             (?#) (?<=) (?<!) (?>)
1462             (?C) (?P) (?R)
1463             (?0) (and 1-9)
1464             (?imsxUX)
1465
1466         Added the following:
1467
1468             \u \v
1469
1470         Because of \v, the js1_2/regexp/special_characters.js test now passes.
1471
1472         To be conservative, I left some features that JavaScript doesn't want, such as
1473         \012 and \x{2013}, in place. We can revisit these later; they're not directly-enough
1474         related to avoiding the incorrect preflighting.
1475
1476         I also didn't try to remove unused opcodes and remove code from the execution engine.
1477         That could save code size and speed things up a bit, but it would require more changes.
1478
1479         * kjs/regexp.h:
1480         * kjs/regexp.cpp: (KJS::RegExp::RegExp): Remove the sanitizePattern workaround for
1481         lack of \u support, since the PCRE code now has \u support.
1482
1483         * pcre/pcre-config.h: Set JAVASCRIPT to 1.
1484         * pcre/pcre_internal.h: Added ESC_v.
1485
1486         * pcre/pcre_compile.c: Added a different escape table for when JAVASCRIPT is set that
1487         omits all the escapes we don't want interpreted and includes '\v'.
1488         (check_escape): Put !JAVASCRIPT around the code for '\l', '\L', '\N', '\u', and '\U',
1489         and added code to handle '\u2013' inside JAVASCRIPT.
1490         (compile_branch): Put !JAVASCRIPT if around all the code implementing the features we
1491         don't want.
1492         (pcre_compile2): Ditto.
1493
1494         * tests/mozilla/expected.html: Updated since js1_2/regexp/special_characters.js now
1495         passes.
1496
1497 2007-07-18  Darin Adler  <darin@apple.com>
1498
1499         Reviewed by Oliver Hunt.
1500
1501         - fix <rdar://problem/5345432> PCRE computes length wrong for expressions such as "[**]"
1502
1503         Test: fast/js/regexp-charclass-crash.html
1504
1505         * pcre/pcre_compile.c: (pcre_compile2): Fix the preflight code that calls
1506         check_posix_syntax to match the actual regular expression compilation code;
1507         before it was missing the check of the first character.
1508
1509 2007-07-19  Holger Hans Peter Freyther  <zecke@selfish.org>
1510
1511         Reviewed by Mark.
1512
1513         Define __BUILDING_GDK when building for Gdk to fix building testkjs on OSX.
1514
1515         * JavaScriptCore.pri:
1516
1517 2007-07-18  Simon Hausmann  <hausmann@kde.org>
1518
1519         * Fix the Qt build, call dftables from the right directory.
1520
1521         Reviewed by Adam Treat.
1522
1523         * pcre/pcre.pri:
1524
1525 2007-07-18  Simon Hausmann  <hausmann@kde.org>
1526
1527         Reviewed by Zack.
1528
1529         Don't call gcc directly when building the dftables tool but use a separate .pro file for the Qt build.
1530
1531         * pcre/dftables.pro: Added.
1532         * pcre/pcre.pri:
1533
1534 2007-07-17  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1535
1536         Reviewed by Darin, Maciej, and Adam.
1537
1538         Fixes <http://bugs.webkit.org/show_bug.cgi?id=9697>,
1539               the failure of ecma/GlobalObject/15.1.2.2-2.js,
1540               the failure of ecma/LexicalConventions/7.7.3-1.js,
1541               and most of the failures of tests in ecma/TypeConversion/9.3.1-3.js.
1542
1543         Bug 9697: parseInt results may be inaccurate for numbers greater than 2^53
1544
1545         This patch also fixes similar issues in the lexer and UString::toDouble().
1546
1547         * kjs/function.cpp:
1548         (KJS::parseIntOverflow):
1549         (KJS::parseInt):
1550         * kjs/function.h:
1551         * kjs/lexer.cpp:
1552         (KJS::Lexer::lex):
1553         * kjs/ustring.cpp:
1554         (KJS::UString::toDouble):
1555         * tests/mozilla/expected.html:
1556
1557 2007-07-16  Sam Weinig  <sam@webkit.org>
1558
1559         Reviewed by Oliver.
1560
1561         Turn off -Wshorten-64-to-32 warning for 64-bit builds.
1562
1563         * Configurations/Base.xcconfig:
1564
1565 2007-07-14  Brady Eidson  <beidson@apple.com>
1566
1567         Reviewed by Sam Weinig
1568
1569         Initial check-in for <rdar://problem/3154486> - Supporting FTP directory listings in the browser
1570
1571         * wtf/Platform.h: Add ENABLE_FTPDIR feature to handle building on platforms that don't have the
1572           proper network-layer support
1573
1574 2007-07-14  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1575
1576         Reviewed by Darin.
1577
1578         Fixes http://bugs.webkit.org/show_bug.cgi?id=13517,
1579               http://bugs.webkit.org/show_bug.cgi?id=14237, and
1580               the failure of test js1_5/Scope/regress-185485.js
1581
1582         Bug 13517: DOM Exception 8 in finance.aol.com sub-page
1583         Bug 14237: Javascript "var" statement interprets initialization in the topmost function scope
1584
1585         * kjs/nodes.cpp:
1586         (VarDeclNode::evaluate):
1587         * tests/mozilla/expected.html:
1588
1589 2007-07-12  Alexey Proskuryakov  <ap@webkit.org>
1590
1591         Reviewed by Mitz.
1592
1593         http://bugs.webkit.org/show_bug.cgi?id=14596
1594         Fix JSC compilation with KJS_VERBOSE.
1595
1596         * kjs/function.cpp:
1597         (KJS::FunctionImp::passInParameters):
1598
1599 2007-07-11  George Staikos  <staikos@kde.org>
1600
1601         Make it compile.
1602
1603         * ForwardingHeaders: Added.
1604         * ForwardingHeaders/JavaScriptCore: Added.
1605         * ForwardingHeaders/JavaScriptCore/APICast.h: Added.
1606         * ForwardingHeaders/JavaScriptCore/JSBase.h: Added.
1607         * ForwardingHeaders/JavaScriptCore/JSContextRef.h: Added.
1608         * ForwardingHeaders/JavaScriptCore/JSLock.h: Added.
1609         * ForwardingHeaders/JavaScriptCore/JSObjectRef.h: Added.
1610         * ForwardingHeaders/JavaScriptCore/JSStringRef.h: Added.
1611         * ForwardingHeaders/JavaScriptCore/JSStringRefCF.h: Added.
1612         * ForwardingHeaders/JavaScriptCore/JSValueRef.h: Added.
1613         * ForwardingHeaders/JavaScriptCore/JavaScriptCore.h: Added.
1614
1615 2007-07-11  Holger Hans Peter Freyther  <zecke@selfish.org>
1616
1617         Reviewed by Darin.
1618
1619         As of http://bugs.webkit.org/show_bug.cgi?id=14527 move the
1620         WebCore/ForwardingHeader/JavaScriptCore to JavaScriptCore
1621
1622         * ForwardingHeaders: Added.
1623         * ForwardingHeaders/JavaScriptCore: Copied from WebCore/ForwardingHeaders/JavaScriptCore.
1624
1625 2007-07-11  Nikolas Zimmermann  <zimmermann@kde.org>
1626
1627         Reviewed by Mark.
1628
1629         Forwardport the hash table fix from CodeGeneratorJS.pm to create_hash_table.
1630         Reran run-jsc-tests, couldn't find any regressions. Suggested by Darin.
1631
1632         * kjs/create_hash_table:
1633
1634 2007-07-09  Maciej Stachowiak  <mjs@apple.com>
1635
1636         Reviewed by Oliver.
1637         
1638         - JavaScriptCore part of fix for: <rdar://problem/5295734> Repro crash closing tab/window @ maps.google.com in WTF::HashSet<KJS::RuntimeObjectImp*, WTF::PtrHash<KJS::RuntimeObjectImp*>, WTF::HashTraits<KJS::RuntimeObjectImp*> >::add + 11
1639         
1640         * JavaScriptCore.exp: Added needed export.
1641
1642 2007-07-06  Maciej Stachowiak  <mjs@apple.com>
1643
1644         Reviewed by Antti.
1645
1646         - <rdar://problem/5311093> JavaScriptCore fails to build with strict-aliasing warnings
1647         
1648         * Configurations/Base.xcconfig: Re-enable -Wstrict-aliasing
1649         * bindings/jni/jni_utility.cpp:
1650         (KJS::Bindings::getJNIEnv): Type-pun via a union instead of a pointer cast.
1651         * wtf/HashMap.h:
1652         (WTF::): Instead of doing type-punned assignments via pointer cast, do one of three things:
1653         (1) assign directly w/o cast if storage type matches real type; (2) assign using cast
1654         via union if type does not need reffing; (3) copy with memcpy and ref/deref manually if type
1655         needs reffing. This is ok peref-wise because memcpy of a constant length gets optomized.
1656         HashTraits are now expected to make ref()/deref() take the storage type, not the true type.
1657         * wtf/HashSet.h:
1658         (WTF::): Same basic idea.
1659         * wtf/HashTable.h:
1660         (WTF::): Added Assigner template for use by HashMap/HashSet. Change RefCounter to call ref()
1661         and deref() via storage type, avoiding the need to
1662         type-pun.
1663         (WTF::RefCounter::ref): ditto
1664         (WTF::RefCounter::deref): ditto
1665         * wtf/HashTraits.h:
1666         (WTF::): Change ref() and deref() for RefPtr HashTraits to take the storage type; cast
1667         via union to pointer type.
1668         * wtf/FastMalloc.cpp:
1669         (WTF::TCMalloc_PageHeap::init): Changed from constructor to init function so this can go in a union.
1670         (WTF::): redefine pageheap macro in terms of getPageHeap().
1671         (WTF::getPageHeap): new inline function, helper for pageheap macro. This hides the cast in a union.
1672         (WTF::TCMalloc_ThreadCache::InitModule): Call init() instead of using placement new to initialize page
1673         heap.
1674         * wtf/TCPageMap.h:
1675         (TCMalloc_PageMap1::init): Changed from constructor to init function.
1676         (TCMalloc_PageMap2::init): ditto
1677         (TCMalloc_PageMap3::init): ditto
1678
1679
1680 2007-07-06  George Staikos  <staikos@kde.org>
1681
1682         Reviewed by Maciej.
1683
1684         Switch USE(ICONDATABASE) to ENABLE(ICONDATABASE)
1685
1686         * wtf/Platform.h:
1687
1688 2007-07-03  Sam Weinig  <sam@webkit.org>
1689
1690         Reviewed by Darin.
1691
1692         Eleventh round of fixes for implicit 64-32 bit conversion errors.
1693         <rdar://problem/5292262>
1694
1695         - Fixes a real bug where where we were setting long long and unsigned long long
1696           values to a long field.
1697
1698         * bindings/objc/objc_utility.mm:
1699         (KJS::Bindings::convertValueToObjcValue):
1700
1701 2007-07-03  Sam Weinig  <sam@webkit.org>
1702
1703         Reviewed by Brady Eidson.
1704
1705         Tenth round of fixes for implicit 64-32 bit conversion errors.
1706         <rdar://problem/5292262>
1707
1708         - Add explicit casts.
1709
1710         * kjs/dtoa.cpp:
1711         (Bigint::):
1712
1713 2007-07-02  Sam Weinig  <sam@webkit.org>
1714
1715         Reviewed by Kevin McCullough.
1716
1717         Fourth round of fixes for implicit 64-32 bit conversion errors.
1718         <rdar://problem/5292262>
1719
1720         Add custom piDouble and piFloat constants to use instead of M_PI.
1721
1722         * kjs/math_object.cpp:
1723         (MathObjectImp::getValueProperty):
1724         * wtf/MathExtras.h:
1725         (wtf_atan2):
1726
1727 2007-06-29  Sam Weinig  <sam@webkit.org>
1728
1729         Reviewed by Darin.
1730
1731         Second pass at fixing implicit 64-32 bit conversion errors.
1732         <rdar://problem/5292262>
1733
1734         - Add a toFloat() method to JSValue for float conversion.
1735
1736         * JavaScriptCore.exp:
1737         * kjs/value.cpp:
1738         (KJS::JSValue::toFloat):
1739         * kjs/value.h:
1740
1741 2007-06-27  Kevin McCullough  <kmccullough@apple.com>
1742
1743         Reviewed by Darin.
1744
1745         - <rdar://problem/5271937> REGRESSION: Apparent WebKit JavaScript memory smasher when submitting comment to iWeb site (crashes in kjs_pcre_compile2)
1746         - Correctly evaluate the return value of _pcre_ucp_findchar.
1747
1748         * pcre/pcre_compile.c:
1749         (compile_branch):
1750         * pcre/pcre_exec.c:
1751         (match):
1752
1753 2007-06-27  Sam Weinig  <sam@webkit.org>
1754
1755         Reviewed by Darin.
1756
1757         First pass at fixing implicit 64-32 bit conversion errors.
1758         <rdar://problem/5292262>
1759
1760         - Add 'f' suffix where necessary.
1761
1762         * kjs/testkjs.cpp:
1763         (StopWatch::getElapsedMS):
1764
1765 2007-06-26  Geoffrey Garen  <ggaren@apple.com>
1766
1767         Reviewed by Maciej Stachowiak.
1768         
1769         Fixed <rdar://problem/5296627> JSGarbageCollect headerdoc suggests that 
1770         using JavaScriptCore requires leaking memory
1771
1772         * API/JSBase.h: Changed documentation to explain that you can pass NULL
1773         to JSGarbageCollect.
1774
1775 2007-06-26  Adam Treat  <adam@staikos.net>
1776
1777         Reviewed by Adam Roben.
1778
1779         Make the SQLite icon database optional.
1780
1781         * wtf/Platform.h:
1782
1783 2007-06-15  George Staikos  <staikos@kde.org>
1784
1785         More missing files for Qt.
1786
1787         * JavaScriptCore.pri:
1788         * kjs/testkjs.pro:
1789
1790 2007-06-15  George Staikos  <staikos@kde.org>
1791
1792         Another Qt build fix.
1793
1794         * JavaScriptCore.pri:
1795         * kjs/testkjs.pro:
1796
1797 2007-06-15  George Staikos  <staikos@kde.org>
1798
1799         Fixing Qt build.
1800
1801         * JavaScriptCore.pri:
1802
1803 2007-06-20  Mark Rowe  <mrowe@apple.com>
1804
1805         Reviewed by Mitz.
1806
1807         Fix http://bugs.webkit.org/show_bug.cgi?id=14244
1808         Bug 14244: Data corruption when using a replace() callback function with data containing "$"
1809
1810         * kjs/string_object.cpp:
1811         (KJS::replace):  When 'replacement' is a function, do not replace $n placeholders in its return value.
1812         This matches the behaviour described in ECMA 262 3rd Ed section 15.5.4.1, and as implemented in Firefox.
1813
1814 2007-06-14  Anders Carlsson  <andersca@apple.com>
1815
1816         Fix Windows build.
1817         
1818         * bindings/runtime_object.cpp:
1819         (RuntimeObjectImp::canPut):
1820
1821 2007-06-14  Anders Carlsson  <andersca@apple.com>
1822
1823         Reviewed by Darin.
1824
1825         <rdar://problem/5103077> 
1826         Crash at _NPN_ReleaseObject when quitting page at http://eshop.macsales.com/shop/ModBook
1827         
1828         <rdar://problem/5183692>
1829         http://bugs.webkit.org/show_bug.cgi?id=13547
1830         REGRESSION: Crash in _NPN_ReleaseObject when closing Safari on nba.com (13547)
1831         
1832         <rdar://problem/5261499>
1833         CrashTracer: [USER] 75 crashes in Safari at com.apple.JavaScriptCore: KJS::Bindings::CInstance::~CInstance + 40
1834         
1835         Have the root object track all live instances of RuntimeObjectImp. When invalidating 
1836         the root object, also invalidate all live runtime objects by zeroing out their instance ivar.
1837         This prevents instances from outliving their plug-ins which lead to crashes.
1838         
1839         * bindings/c/c_utility.cpp:
1840         (KJS::Bindings::convertValueToNPVariant):
1841         * bindings/jni/jni_jsobject.cpp:
1842         (JavaJSObject::convertValueToJObject):
1843         * bindings/jni/jni_utility.cpp:
1844         (KJS::Bindings::convertValueToJValue):
1845         * bindings/objc/objc_runtime.mm:
1846         (ObjcFallbackObjectImp::callAsFunction):
1847         * bindings/runtime_array.cpp:
1848         (RuntimeArray::RuntimeArray):
1849         * bindings/runtime_array.h:
1850         (KJS::RuntimeArray::getConcreteArray):
1851         * bindings/runtime_method.cpp:
1852         (RuntimeMethod::callAsFunction):
1853         * bindings/runtime_method.h:
1854         * bindings/runtime_object.cpp:
1855         (RuntimeObjectImp::RuntimeObjectImp):
1856         (RuntimeObjectImp::~RuntimeObjectImp):
1857         (RuntimeObjectImp::invalidate):
1858         (RuntimeObjectImp::fallbackObjectGetter):
1859         (RuntimeObjectImp::fieldGetter):
1860         (RuntimeObjectImp::methodGetter):
1861         (RuntimeObjectImp::getOwnPropertySlot):
1862         (RuntimeObjectImp::put):
1863         (RuntimeObjectImp::canPut):
1864         (RuntimeObjectImp::defaultValue):
1865         (RuntimeObjectImp::implementsCall):
1866         (RuntimeObjectImp::callAsFunction):
1867         (RuntimeObjectImp::getPropertyNames):
1868         (RuntimeObjectImp::throwInvalidAccessError):
1869         * bindings/runtime_object.h:
1870         * bindings/runtime_root.cpp:
1871         (KJS::Bindings::RootObject::invalidate):
1872         (KJS::Bindings::RootObject::addRuntimeObject):
1873         (KJS::Bindings::RootObject::removeRuntimeObject):
1874         * bindings/runtime_root.h:
1875
1876 2007-06-14  Anders Carlsson  <andersca@apple.com>
1877
1878         Reviewed by Mitz.
1879
1880         <rdar://problem/5244948>
1881         Safari keeps on complaining about slow script playing NBC TV video (14133)
1882
1883         http://bugs.webkit.org/show_bug.cgi?id=14133
1884         Runaway JavaScript timer fires when spinning around in Google Maps street view
1885
1886         Make sure to start and stop the timeout checker around calls to JS.
1887         
1888         * bindings/NP_jsobject.cpp:
1889         (_NPN_InvokeDefault):
1890         (_NPN_Invoke):
1891         (_NPN_Evaluate):
1892         * bindings/jni/jni_jsobject.cpp:
1893         (JavaJSObject::call):
1894         (JavaJSObject::eval):
1895
1896 2007-06-13  Darin Adler  <darin@apple.com>
1897
1898         Reviewed by Mark Rowe.
1899
1900         - fix http://bugs.webkit.org/show_bug.cgi?id=14132
1901           array sort with > 10000 elements sets elements > 10000 undefined
1902
1903         Test: fast/js/sort-large-array.html
1904
1905         * kjs/array_instance.h: Replaced pushUndefinedObjectsToEnd with
1906         compactForSorting, and removed ExecState parameters.
1907
1908         * kjs/array_object.cpp:
1909         (ArrayInstance::sort): Changed to call compactForSorting.
1910         (ArrayInstance::compactForSorting): Do the get and delete of the
1911         properties directly on the property map instead of using public
1912         calls from JSObject. The public calls would just read the undefined
1913         values from the compacted sort results array!
1914
1915 2007-06-13  George Staikos  <staikos@kde.org>
1916
1917         Reviewed by Lars.
1918
1919         Fix Mac OS X build after last checkin.
1920
1921         * wtf/FastMalloc.h:
1922
1923 2007-06-14  Lars Knoll <lars@trolltech.com>
1924
1925         Reviewed by Maciej.
1926
1927         Disable FastMalloc for the Qt build and make sure we
1928         don't reimplement the global new/delete operators
1929         when using the system malloc.
1930
1931         * wtf/FastMalloc.cpp:
1932         * wtf/FastMalloc.h:
1933         * wtf/Platform.h:
1934
1935 2007-06-13  Anders Carlsson  <andersca@apple.com>
1936
1937         Reviewed by Geoff.
1938
1939         Make sure that bindings instances get correct root objects.
1940         
1941         * JavaScriptCore.exp:
1942         * bindings/NP_jsobject.cpp:
1943         (listFromVariantArgs):
1944         (_NPN_InvokeDefault):
1945         (_NPN_Invoke):
1946         (_NPN_SetProperty):
1947         * bindings/c/c_instance.cpp:
1948         (KJS::Bindings::CInstance::invokeMethod):
1949         (KJS::Bindings::CInstance::invokeDefaultMethod):
1950         * bindings/c/c_runtime.cpp:
1951         (KJS::Bindings::CField::valueFromInstance):
1952         * bindings/c/c_utility.cpp:
1953         (KJS::Bindings::convertNPVariantToValue):
1954         * bindings/c/c_utility.h:
1955         * bindings/objc/objc_instance.mm:
1956         (ObjcInstance::invokeMethod):
1957         (ObjcInstance::invokeDefaultMethod):
1958         (ObjcInstance::getValueOfUndefinedField):
1959         * bindings/objc/objc_runtime.mm:
1960         (ObjcField::valueFromInstance):
1961         (ObjcArray::valueAt):
1962         * bindings/objc/objc_utility.h:
1963         * bindings/objc/objc_utility.mm:
1964         (KJS::Bindings::convertObjcValueToValue):
1965         * bindings/runtime.h:
1966
1967 2007-06-13  Simon Hausmann  <hausmann@kde.org>
1968
1969         Reviewed by Lars.
1970
1971         * kjs/testkjs.pro: WebKitQt is now called QtWebKit.
1972
1973 2007-06-12  Anders Carlsson  <andersca@apple.com>
1974
1975         Another build fix.
1976         
1977         * bindings/qt/qt_instance.cpp:
1978         (KJS::Bindings::QtInstance::invokeMethod):
1979
1980 2007-06-12  Anders Carlsson  <andersca@apple.com>
1981
1982         Reviewed by Geoff.
1983
1984         Move the notion of field type to the JNI runtime since that's the only 
1985         one that was actually using it.
1986         
1987         * bindings/c/c_runtime.h:
1988         (KJS::Bindings::CField::CField):
1989         * bindings/jni/jni_runtime.h:
1990         * bindings/objc/objc_runtime.h:
1991         * bindings/objc/objc_runtime.mm:
1992         * bindings/qt/qt_runtime.h:
1993         * bindings/runtime.h:
1994         * bindings/runtime_method.cpp:
1995
1996 2007-06-12  Anders Carlsson  <andersca@apple.com>
1997
1998         Build fix.
1999         
2000         * bindings/qt/qt_class.cpp:
2001         (KJS::Bindings::QtClass::methodsNamed):
2002         * bindings/qt/qt_instance.cpp:
2003         (KJS::Bindings::QtInstance::invokeMethod):
2004
2005 2007-06-12  Anders Carlsson  <andersca@apple.com>
2006
2007         Reviewed by Oliver.
2008         
2009         Get rid of the MethodList class and use a good ol' Vector instead.
2010
2011         * bindings/c/c_class.cpp:
2012         (KJS::Bindings::CClass::methodsNamed):
2013         * bindings/c/c_instance.cpp:
2014         (KJS::Bindings::CInstance::invokeMethod):
2015         * bindings/jni/jni_class.cpp:
2016         (JavaClass::JavaClass):
2017         (JavaClass::~JavaClass):
2018         * bindings/jni/jni_instance.cpp:
2019         (JavaInstance::invokeMethod):
2020         * bindings/objc/objc_class.mm:
2021         (KJS::Bindings::ObjcClass::methodsNamed):
2022         * bindings/objc/objc_instance.mm:
2023         (ObjcInstance::invokeMethod):
2024         * bindings/objc/objc_runtime.mm:
2025         (ObjcFallbackObjectImp::callAsFunction):
2026         * bindings/runtime.cpp:
2027         * bindings/runtime.h:
2028         * bindings/runtime_method.cpp:
2029         (RuntimeMethod::lengthGetter):
2030         (RuntimeMethod::callAsFunction):
2031         * bindings/runtime_object.cpp:
2032         (RuntimeObjectImp::getOwnPropertySlot):
2033
2034 2007-06-12  Anders Carlsson  <andersca@apple.com>
2035
2036         Reviewed by Geoff.
2037
2038         Make RuntimeMethod's method list a pointer so that the object size doesn't
2039         grow beyond 32 bytes when we later will replace MethodList with a Vector.
2040         
2041         * bindings/runtime_method.cpp:
2042         (RuntimeMethod::RuntimeMethod):
2043         (RuntimeMethod::lengthGetter):
2044         (RuntimeMethod::callAsFunction):
2045         * bindings/runtime_method.h:
2046
2047 2007-06-12  Anders Carlsson  <andersca@apple.com>
2048
2049         Reviewed by Geoff.
2050
2051         Get rid of the Parameter class.
2052         
2053         * bindings/jni/jni_instance.cpp:
2054         (JavaInstance::invokeMethod):
2055         * bindings/jni/jni_runtime.cpp:
2056         (JavaMethod::signature):
2057         * bindings/jni/jni_runtime.h:
2058         (KJS::Bindings::JavaParameter::JavaParameter):
2059         (KJS::Bindings::JavaParameter::~JavaParameter):
2060         (KJS::Bindings::JavaParameter::type):
2061         (KJS::Bindings::JavaMethod::parameterAt):
2062         (KJS::Bindings::JavaMethod::numParameters):
2063         * bindings/runtime.h:
2064
2065 2007-06-12  Anders Carlsson  <andersca@apple.com>
2066
2067         Build fix.
2068         
2069         * bindings/qt/qt_class.h:
2070
2071 2007-06-12  Mark Rowe  <mrowe@apple.com>
2072
2073         Build fix.
2074
2075         * bindings/objc/objc_runtime.h:
2076
2077 2007-06-12  Anders Carlsson  <andersca@apple.com>
2078
2079         Reviewed by Geoff.
2080
2081         Get rid of Constructor and its only subclass JavaConstructor.
2082         
2083         * bindings/c/c_class.h:
2084         * bindings/jni/jni_class.cpp:
2085         (JavaClass::JavaClass):
2086         (JavaClass::~JavaClass):
2087         * bindings/jni/jni_class.h:
2088         * bindings/jni/jni_runtime.cpp:
2089         * bindings/jni/jni_runtime.h:
2090         * bindings/objc/objc_class.h:
2091         * bindings/runtime.h:
2092
2093 2007-06-12  Anders Carlsson  <andersca@apple.com>
2094
2095         Reviewed by Geoff.
2096
2097         Use RetainPtr throughout the bindings code.
2098         
2099         * bindings/objc/objc_class.h:
2100         * bindings/objc/objc_class.mm:
2101         (KJS::Bindings::ObjcClass::ObjcClass):
2102         (KJS::Bindings::ObjcClass::methodsNamed):
2103         (KJS::Bindings::ObjcClass::fieldNamed):
2104         * bindings/objc/objc_instance.h:
2105         (KJS::Bindings::ObjcInstance::getObject):
2106         * bindings/objc/objc_instance.mm:
2107         (ObjcInstance::ObjcInstance):
2108         (ObjcInstance::~ObjcInstance):
2109         (ObjcInstance::implementsCall):
2110         (ObjcInstance::invokeMethod):
2111         (ObjcInstance::invokeDefaultMethod):
2112         (ObjcInstance::defaultValue):
2113         * bindings/objc/objc_runtime.h:
2114         (KJS::Bindings::ObjcMethod::setJavaScriptName):
2115         (KJS::Bindings::ObjcMethod::javaScriptName):
2116         (KJS::Bindings::ObjcArray::getObjcArray):
2117         * bindings/objc/objc_runtime.mm:
2118         (ObjcField::name):
2119         (ObjcArray::ObjcArray):
2120         (ObjcArray::setValueAt):
2121         (ObjcArray::valueAt):
2122         (ObjcArray::getLength):
2123         * wtf/RetainPtr.h:
2124
2125 2007-06-12  Anders Carlsson  <andersca@apple.com>
2126
2127         Reviewed by Maciej.
2128
2129         Have JSCell inherit from Noncopyable.
2130         
2131         * bindings/objc/objc_runtime.h:
2132         * bindings/runtime_object.h:
2133         * kjs/value.h:
2134
2135 2007-06-12  Anders Carlsson  <andersca@apple.com>
2136
2137         Reviewed by Darin and Maciej.
2138
2139         More cleanup. Use our Noncopyable WTF class, add a root object member
2140         to the Array class.
2141         
2142         * bindings/c/c_class.h:
2143         * bindings/jni/jni_class.h:
2144         * bindings/jni/jni_instance.h:
2145         * bindings/jni/jni_runtime.cpp:
2146         (JavaArray::JavaArray):
2147         * bindings/jni/jni_runtime.h:
2148         * bindings/objc/objc_class.h:
2149         * bindings/objc/objc_runtime.h:
2150         * bindings/objc/objc_runtime.mm:
2151         (ObjcArray::ObjcArray):
2152         * bindings/objc/objc_utility.mm:
2153         (KJS::Bindings::convertObjcValueToValue):
2154         * bindings/runtime.cpp:
2155         (KJS::Bindings::Array::Array):
2156         (KJS::Bindings::Array::~Array):
2157         * bindings/runtime.h:
2158         * bindings/runtime_object.h:
2159         * bindings/runtime_root.h:
2160
2161 2007-06-08  Zack Rusin  <zrusin@trolltech.com>
2162
2163         Fix the Qt build
2164
2165         * bindings/qt/qt_instance.cpp:
2166         (KJS::Bindings::QtInstance::QtInstance):
2167         * bindings/qt/qt_instance.h:
2168
2169 2007-06-07  Anders Carlsson  <andersca@apple.com>
2170
2171         Reviewed by Geoff.
2172
2173         Get rid of Instance::setRootObject and pass the root object to the instance constructor instead.
2174         
2175         * bindings/c/c_instance.cpp:
2176         (KJS::Bindings::CInstance::CInstance):
2177         * bindings/c/c_instance.h:
2178         * bindings/jni/jni_instance.cpp:
2179         (JavaInstance::JavaInstance):
2180         * bindings/jni/jni_instance.h:
2181         * bindings/jni/jni_jsobject.cpp:
2182         (JavaJSObject::convertJObjectToValue):
2183         * bindings/objc/objc_instance.h:
2184         * bindings/objc/objc_instance.mm:
2185         (ObjcInstance::ObjcInstance):
2186         * bindings/runtime.cpp:
2187         (KJS::Bindings::Instance::Instance):
2188         (KJS::Bindings::Instance::createBindingForLanguageInstance):
2189         * bindings/runtime.h:
2190
2191 2007-06-07  Anders Carlsson  <andersca@apple.com>
2192
2193         Reviewed by Adam.
2194
2195         Don't use a JavaInstance to store the field when all we want to do is to keep the field
2196         from being garbage collected. Instead, use a JObjectWrapper.
2197         
2198         * bindings/jni/jni_instance.h:
2199         * bindings/jni/jni_runtime.cpp:
2200         (JavaField::JavaField):
2201         (JavaField::dispatchValueFromInstance):
2202         (JavaField::dispatchSetValueToInstance):
2203         * bindings/jni/jni_runtime.h:
2204         (KJS::Bindings::JavaField::JavaField):
2205         (KJS::Bindings::JavaField::operator=):
2206
2207 2007-05-30  Alp Toker  <alp.toker@collabora.co.uk>
2208
2209         Reviewed by Brady.
2210
2211         Enable logging in the Gdk port.
2212         http://bugs.webkit.org/show_bug.cgi?id=13936
2213
2214         * wtf/Assertions.cpp:
2215         * wtf/Assertions.h: Add WTFLogVerbose which also logs
2216         the file, line number and function.
2217
2218 2007-05-30  Mark Rowe  <mrowe@apple.com>
2219
2220         Mac build fix.  Update #include.
2221
2222         * API/JSCallbackFunction.h:
2223
2224 2007-05-30  Luciano Montanaro  <mikelima@cirulla.net>
2225
2226         Reviewed by Maciej.
2227
2228         - cross-port Harri Porten's commits 636099 and 636108 from KJS: 
2229         "publish a class anyway public already" and "class is being used from
2230         outside for quite some time" in preparation for further syncronizations
2231
2232         * kjs/context.h:
2233         * kjs/date_object.cpp:
2234         * kjs/date_object.h:
2235         * kjs/function.h:
2236         (KJS::):
2237         (KJS::InternalFunctionImp::classInfo):
2238         (KJS::InternalFunctionImp::functionName):
2239         * kjs/function_object.h:
2240         * kjs/internal.h:
2241         * kjs/lookup.h:
2242         (KJS::getStaticPropertySlot):
2243         (KJS::getStaticFunctionSlot):
2244         (KJS::getStaticValueSlot):
2245         * kjs/object_object.h:
2246
2247 2007-05-29  Sam Weinig  <sam@webkit.org>
2248
2249         Reviewed by Adam Roben.
2250
2251         Cleanup function and fix to match comparison API.
2252
2253         * kjs/string_object.cpp:
2254         (KJS::substituteBackreferences):
2255         (KJS::localeCompare):
2256
2257 2007-05-28  Geoffrey Garen  <ggaren@apple.com>
2258
2259         Slight clarification to an exception message.
2260
2261         * API/JSCallbackObject.cpp:
2262         (KJS::JSCallbackObject::put):
2263
2264 2007-05-27  Holger Freyther  <zecke@selfish.org>
2265
2266         Reviewed by Mark Rowe.
2267
2268         * wtf/Platform.h: Move Gdk up to allow building WebKit/Gdk on Darwin
2269
2270 2007-05-27  Darin Adler  <darin@apple.com>
2271
2272         - fix a couple ifdefs that said WIN instead of WIN_OS
2273
2274         * kjs/collector.cpp:
2275         (KJS::allocateBlock): WIN -> WIN_OS
2276         (KJS::freeBlock): Ditto.
2277
2278 2007-05-26  Sam Weinig  <sam@webkit.org>
2279
2280         Reviewed by Darin.
2281
2282         Patch for http://bugs.webkit.org/show_bug.cgi?id=13854
2283         Port of commit 667785 from kjs
2284
2285         - special case calling String.localeCompare() with no parameters to return 0.
2286
2287         * kjs/string_object.cpp:
2288         (KJS::StringProtoFunc::callAsFunction):
2289
2290 2007-05-25  Kimmo Kinnunen  <kimmok@iki.fi>
2291
2292         Reviewed by Darin.
2293
2294         - Fix for http://bugs.webkit.org/show_bug.cgi?id=13456
2295         REGRESSION: setTimeout "arguments" object gets shadowed by a local variable
2296
2297         - Add a explicit check for arguments. Previously check was done with getDirect,
2298         but since the arguments is created on-demand in ActivationImp, it doesn't
2299         show up in the test. 'arguments' should always be in the VarDeclNode's
2300         evaluation scope.
2301
2302         * kjs/nodes.cpp:
2303         (VarDeclNode::evaluate): Additional check if the var decl identifier is 'arguments'
2304
2305 2007-05-25  George Staikos  <staikos@kde.org>
2306
2307         Reviewed by Maciej.
2308
2309         - Use COMPILER(GCC), not PLATFORM(GCC) - as Platform.h defines
2310
2311         * wtf/FastMalloc.h:
2312
2313 2007-05-25  Kimmo Kinnunen  <kimmok@iki.fi>
2314
2315         Reviewed by Darin.
2316
2317         - http://bugs.webkit.org/show_bug.cgi?id=13623 (Decompilation of function
2318           doesn't compile with "++(x,y)")
2319         - Create the error node based on the actual node, not the node inside
2320           parenthesis
2321         - Fix applies to postfix, prefix and typeof operators
2322         - Produces run-time ReferenceError like other non-lvalue assignments etc.
2323
2324         * kjs/grammar.y: Create {Prefix,Postfix}ErrorNode based on the actual node,
2325         not the based on the node returned by "nodeInsideAllParens()". Same for
2326         TypeOfValueNode.
2327
2328 2007-05-25  Simon Hausmann  <hausmann@kde.org>
2329
2330         Reviewed by Zack.
2331
2332         Fix crash in Qt JavaScript bindings when the arguments used on the Qt side are not
2333         registered with QMetaType.
2334
2335         * bindings/qt/qt_instance.cpp:
2336         (KJS::Bindings::QtInstance::invokeMethod):
2337         * bindings/qt/qt_runtime.cpp:
2338
2339 2007-05-24  Luciano Montanaro  <mikelima@cirulla.net>
2340
2341         Reviewed by Darin
2342
2343         Patch for http://bugs.webkit.org/show_bug.cgi?id=13855
2344         Port patch 666176 to JavaScriptCore
2345
2346         - Renamed JSValue::downcast() to JSValue::asCell() which makes the
2347         function meaning cleaner. It's modeled after Harri Porten change in 
2348         KDE trunk.
2349
2350         * kjs/collector.cpp:
2351         (KJS::Collector::protect):
2352         (KJS::Collector::unprotect):
2353         (KJS::Collector::collectOnMainThreadOnly):
2354         * kjs/object.h:
2355         (KJS::JSValue::isObject):
2356         * kjs/string_object.cpp:
2357         (KJS::StringProtoFunc::callAsFunction):
2358         * kjs/value.h:
2359         (KJS::JSValue::asCell):
2360         (KJS::JSValue::isNumber):
2361         (KJS::JSValue::isString):
2362         (KJS::JSValue::isObject):
2363         (KJS::JSValue::getNumber):
2364         (KJS::JSValue::getString):
2365         (KJS::JSValue::getObject):
2366         (KJS::JSValue::getUInt32):
2367         (KJS::JSValue::mark):
2368         (KJS::JSValue::marked):
2369         (KJS::JSValue::type):
2370         (KJS::JSValue::toPrimitive):
2371         (KJS::JSValue::toBoolean):
2372         (KJS::JSValue::toNumber):
2373         (KJS::JSValue::toString):
2374         (KJS::JSValue::toObject):
2375
2376 2007-05-18  Holger Hans Peter Freyther  <zecke@selfish.org>
2377
2378         Reviewed by Mark Rowe.
2379
2380         * kjs/testkjs.pro: Make the Gdk port link to icu
2381
2382 2007-05-15  Geoffrey Garen  <ggaren@apple.com>
2383
2384         Reviewed by Adele Peterson.
2385         
2386         It helps if you swap the right variable.
2387
2388         * wtf/HashSet.h:
2389         (WTF::::operator):
2390
2391 2007-05-15  Lars Knoll <lars@trolltech.com>
2392
2393         Reviewed by Zack
2394
2395         Extend the QObject JavaScript bindings to work for slots with
2396         arguments.
2397
2398         * bindings/qt/qt_instance.cpp:
2399         (KJS::Bindings::QtInstance::invokeMethod):
2400
2401 2007-05-14  Kimmo Kinnunen  <kimmok@iki.fi>
2402
2403         Reviewed by Darin.
2404
2405         - Fixes http://bugs.webkit.org/show_bug.cgi?id=13622 (Decompiler
2406           omits trailing comma in array literal)
2407
2408          * kjs/nodes2string.cpp:
2409          (ArrayNode::streamTo): print extra ',' in case there was elision
2410          commas (check opt member var) and array elements present
2411          in the array expression
2412
2413 2007-05-14  Geoffrey Garen  <ggaren@apple.com>
2414
2415         Reviewed by Oliver Hunt.
2416         
2417         Added HashMap::swap and HashSet::swap. WebCore now uses HashSet::swap.
2418         I figured while I was in the neighborhood I might as well add HashMap::swap,
2419         too.
2420
2421         * wtf/HashMap.h:
2422         (WTF::::operator):
2423         (WTF::::swap):
2424         * wtf/HashSet.h:
2425         (WTF::::operator):
2426         (WTF::::swap):
2427
2428 2007-05-11  Kimmo Kinnunen  <kimmok@iki.fi>
2429
2430         Reviewed by Darin.
2431
2432         - Fix for bug http://bugs.webkit.org/show_bug.cgi?id=13620
2433           Bogus decompilation of "for (var j = 1 in [])"
2434         - ForInNode toString()'ed to syntax error if there was var decl
2435           and initializer
2436         - ForNode toStringed()'ed lost 'var ' if it was present
2437
2438         * kjs/nodes2string.cpp:
2439         (VarDeclListNode::streamTo): Print "var " here
2440         (VarStatementNode::streamTo): Don't print "var " here
2441         (ForNode::streamTo): Remove TODO comment, VarDeclListNode will
2442         stream the "var "
2443         (ForInNode::streamTo): ForIn initializer is printed by VarDeclNode
2444
2445 2007-05-11  Kimmo Kinnunen  <kimmok@iki.fi>
2446
2447         Reviewed by Darin.
2448
2449         - Fixes http://bugs.webkit.org/show_bug.cgi?id=10878
2450           (Incorrect decompilation for "4..x")
2451         - Group numbers in dotted expressions in toString() output, so we
2452           avoid the 4.x constructs  when the original input is 4..x.
2453           4..x means the same as 4. .x or (4).x or Number(4).x
2454
2455         * kjs/nodes2string.cpp:
2456         (KJS::SourceStream::):
2457         Add boolean flag to indicate that if next item is a number, it should be grouped.
2458         Add new formatting enum which turns on the boolean flag.
2459         (KJS::SourceStream::SourceStream): Added. Initialize the flag.
2460         (SourceStream::operator<<): Added. New overloaded operator with double value as parameter.
2461         (NumberNode::streamTo): Use the double operator
2462         (ArrayNode::streamTo):
2463         (DotAccessorNode::streamTo):
2464         (FunctionCallDotNode::streamTo):
2465         (FunctionCallParenDotNode::streamTo):
2466         (PostfixDotNode::streamTo):
2467         (DeleteDotNode::streamTo):
2468         (PrefixDotNode::streamTo):
2469         (AssignDotNode::streamTo): Use the new formatting enum to turn on the grouping flag.
2470
2471 2007-05-10  Lars Knoll <lars@trolltech.com>
2472
2473         Reviewed by Zack
2474
2475         Fix our last three test failures in the JavaScript
2476         tests.
2477
2478         * wtf/unicode/qt4/UnicodeQt4.h:
2479         (WTF::Unicode::toLower):
2480         (WTF::Unicode::toUpper):
2481
2482 2007-05-08  Geoffrey Garen  <ggaren@apple.com>
2483
2484         Reviewed by Darin Adler.
2485         
2486         Fixed #includes of JSStringRefCF.h and use of CF datatypes. I think I 
2487         misunderstood this issue before.
2488
2489         * API/JavaScriptCore.h: #include JSStringRefCF.h. Platforms that don't
2490         want this behavior can just #include individual headers, instead of the
2491         umbrella framework header. But we definitely want Mac OS X clients to
2492         get the #include of JSStringRefCF.h "for free."
2493         * API/minidom.c: Don't #include JSStringRefCF.h. (Don't need to #include
2494         JavaScriptCore.h, either.)
2495         * API/testapi.c: Don't #include JSStringRefCF.h. Do use CF datatypes
2496         regardless of whether __APPLE__ is defined. Platforms that don't support
2497         CF just shouldn't compile this file.
2498         (main):
2499
2500 2007-05-09  Eric Seidel  <eric@webkit.org>
2501
2502         Reviewed by mjs.
2503         
2504         http://bugs.webkit.org/show_bug.cgi?id=6985
2505         Cyclic __proto__ values cause WebKit to hang
2506
2507         * kjs/object.cpp:
2508         (KJS::JSObject::put): do a cycle check before setting __proto__
2509
2510 2007-05-08  Kimmo Kinnunen  <kimmok@iki.fi>
2511
2512         Reviewed by darin.  Landed by eseidel.
2513
2514         - http://bugs.webkit.org/show_bug.cgi?id=10880 (Do..while loop gains 
2515         a semicolon each time it is toStringed)
2516         Grammar in Ecma-66262, 12.6: "do Statement while ( Expression );"
2517         EmptyStatement was created after every do..while(expr) which
2518         had semicolon at the end.
2519
2520         * kjs/grammar.y: Require semicolon at the end of do..while
2521
2522 2007-05-08  Geoffrey Garen  <ggaren@apple.com>
2523
2524         Build fix -- this time for sure.
2525         
2526         APICast.h, being private, ends up in a different folder than JSValueRef.h,
2527         so we can't include one from the other using "". Instead, just forward
2528         declare the relevant data types.
2529
2530         * API/APICast.h:
2531
2532 2007-05-08  Geoffrey Garen  <ggaren@apple.com>
2533
2534         Build fix: export APICast.h for WebCore and WebKit.
2535
2536         * JavaScriptCore.xcodeproj/project.pbxproj:
2537
2538 2007-05-04  Darin Adler  <darin@apple.com>
2539
2540         Reviewed by Adele.
2541
2542         - fix http://bugs.webkit.org/show_bug.cgi?id=12821
2543           <rdar://problem/5007921> Number.toExponential doesn't work for negative numbers
2544
2545         * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
2546         Added a call to fabs before calling log10.
2547
2548 2007-05-03  Holger Freyther <freyther@kde.org>
2549
2550         Reviewed by Zack, landed by Simon.
2551         This is bugzilla bug 13499.
2552
2553         * JavaScriptCore.pri: Place Qt into the qt-port scope
2554         * bindings/testbindings.pro: Place Qt into the qt-port scope
2555         * kjs/testkjs.pro: Place Qt into the qt-port scope
2556         * pcre/pcre.pri: Place Qt into the qt-port scope
2557
2558 2007-05-02  David Harrison  <harrison@apple.com>
2559
2560         Reviewed by Antti.
2561
2562         <rdar://problem/5174862> Crash resulting from DeprecatedString::insert()
2563
2564         Added insertion support for more than one value.
2565         
2566         * wtf/Vector.h:
2567         (WTF::::insert):
2568         Added support for inserting multiple values.
2569         
2570         (WTF::::prepend):
2571         New. Insert at the start of vectors. Convenient for vectors used as strings.
2572
2573 2007-05-01  Jungshik Shin  <jungshik.shin@gmail.com>
2574
2575         Reviewed by Alexey.
2576
2577         - get rid of non-ASCII lteral characters : suppress compiler warnings
2578         http://bugs.webkit.org/show_bug.cgi?id=13551
2579          
2580         * kjs/testkjs.cpp:
2581         * pcre/pcre_compile.c:
2582
2583 2007-04-28  Jungshik Shin  <jungshik.shin@gmail.com>
2584
2585         Reviewed by Sam Weinig.
2586
2587         - Replace copyright sign in Latin-1 (0xA9) with '(C)'
2588         http://bugs.webkit.org/show_bug.cgi?id=13531
2589
2590         * bindings/npruntime.h:
2591     
2592 2007-04-28  Darin Adler  <darin@apple.com>
2593
2594         Reviewed by Maciej.
2595
2596         - fix <rdar://problem/5154144> Hamachi test fails: assertion failure in ListHashSet
2597
2598         Test: fast/forms/add-remove-form-elements-stress-test.html
2599
2600         * wtf/ListHashSet.h:
2601         (WTF::ListHashSetNodeAllocator::ListHashSetNodeAllocator): Initialize
2602         m_isDoneWithInitialFreeList to false.
2603         (WTF::ListHashSetNodeAllocator::allocate): Added assertions based on a debug-only
2604         m_isAllocated flag that make sure we don't allocate a block that's already allocated.
2605         These assertions helped pinpoint the bug. Set m_isDoneWithInitialFreeList when we
2606         allocate the last block of the initial free list. Once we're done with the initial
2607         free list, turn off the rule that says that the next node in the pool after the last
2608         node in the free list is also free. This rule works because any free nodes are added
2609         to the head of the free list, so a node that hasn't been allocated even once is always
2610         at the tail of the free list and all the nodes after it also haven't been allocated
2611         even once. But it doesn't work any longer once the entire pool has been used at least
2612         once, because there's nothing special about the last node on the free list any more.
2613         (WTF::ListHashSetNodeAllocator::deallocate): Set the node's m_isAllocated to false.
2614         (WTF::ListHashSetNodeAllocator::pastPool): Added. Used above.
2615         (WTF::ListHashSetNodeAllocator::inPool): Changed to use the pastPool function.
2616         (WTF::ListHashSetNode::ListHashSetNode): Initialize m_isAllocated to true.
2617         (WTF::ListHashSetNode::operator new): Removed variable name for unused size
2618         parameter.
2619         (WTF::ListHashSetNode::destroy): Changed to call the destructor rather than
2620         delete -- this gets rid of the need to define an operator delete.
2621
2622 2007-04-27  Christopher Brichford  <chrisb@adobe.com>
2623
2624         Reviewed by Timothy Hatcher.
2625
2626         Fix for: Bug 13211: Move JavaScriptCore mac project files for apollo port
2627         http://bugs.webkit.org/show_bug.cgi?id=13211
2628
2629         * JavaScriptCore.apolloproj/mac/JavaScriptCore.Debug.xcconfig: Added.
2630         * JavaScriptCore.apolloproj/mac/JavaScriptCore.Release.xcconfig: Added.
2631         * JavaScriptCore.apolloproj/mac/JavaScriptCore.xcconfig: Added.
2632         * JavaScriptCore.apolloproj/mac/JavaScriptCore.xcodeproj/project.pbxproj: Added.
2633         * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Debug.xcconfig: Removed.
2634         * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Release.xcconfig: Removed.
2635         * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcconfig: Removed.
2636         * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: Removed.
2637
2638 2007-04-27  Holger Freyther <freyther@kde.org>
2639
2640         Reviewed by Maciej.
2641
2642         Remove unmaintained CMake build system.
2643
2644         * CMakeLists.txt: Removed.
2645         * pcre/CMakeLists.txt: Removed.
2646
2647 2007-04-27  Mark Rowe  <mrowe@apple.com>
2648
2649         Reviewed by Oliver.
2650
2651         * JavaScriptCore.xcodeproj/project.pbxproj: Improve dependencies in Xcode project
2652         by marking dftables as a dependency of Generate Derived Sources rather than of
2653         JavaScriptCore itself.
2654
2655 2007-04-26  Geoffrey Garen  <ggaren@apple.com>
2656
2657         Build fix -- added #includes that we used to get implicitly through
2658         JSStringRef.h.
2659
2660         * API/JSNode.c:
2661         * API/JSNodeList.c:
2662         * API/minidom.c:
2663         * API/testapi.c:
2664
2665 2007-04-26  Geoffrey Garen  <ggaren@apple.com>
2666
2667         Reviewed by Maciej Stachowiak, Adam Roben.
2668         
2669         Fixed 
2670         <rdar://problem/4885130> Remove #include of JSStringRefCF.h from JSStringRef.h
2671         <rdar://problem/4885123> JavaScriptCore is not cross-platform -- JSStringRef.h references CF datatypes
2672
2673         * API/JSStringRef.h: Removed #include -- no clients need it anymore.
2674
2675 2007-04-25  David Kilzer  <ddkilzer@apple.com>
2676
2677         Reviewed by Maciej.
2678
2679         Add assertions for debug builds.
2680
2681         * kjs/JSLock.cpp:
2682         (KJS::JSLock::lock): Assert the return value of pthread_mutex_lock() in debug builds.
2683         (KJS::JSLock::unlock): Assert the return value of pthread_mutex_unlock() in debug builds.
2684
2685 2007-04-25  Maciej Stachowiak  <mjs@apple.com>
2686
2687         Reviewed by Anders.
2688         
2689         - fix build problems
2690
2691         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable warning that
2692         gives often downright incorrect results based on guessing what will happen in 64-bit.
2693
2694 2007-04-25  Darin Adler  <darin@apple.com>
2695
2696         Reviewed by Geoff.
2697
2698         - tweak the allocator for a small speedup -- Shark showed this was a win, but I can't
2699           measure an improvement right now, but it's also clear these changes do no harm
2700
2701         * wtf/FastMalloc.cpp:
2702         (WTF::LgFloor): Use ALWAYS_INLINE here; in testing I did a while back this was necessary
2703         to get this single-instruction function to be inlined.
2704         (WTF::SizeClass): Use ALWAYS_INLINE here too for the same reason. Also change the special
2705         case for a size of 0 to work without a branch for a bit of extra speed.
2706         (WTF::ByteSizeForClass): Use ALWAYS_INLINE here too for the same reason.
2707
2708 2007-04-24  Maciej Stachowiak  <mjs@apple.com>
2709
2710         Reviewed by Oliver.
2711         
2712         - use custom calling convention for everything in nodes.cpp on intel gcc for 1.5% speed boost
2713
2714         Nearly all functions in nodes.cpp were marked up to use the
2715         regparm(3) calling convention under GCC for x86, since this is
2716         faster and they are all guaranteed to be called only internally to
2717         kjs.
2718         
2719         The only exception is destructors, since delete doesn't know how to use a custom calling convention.
2720         
2721         * kjs/nodes.cpp:
2722         (dotExprDoesNotAllowCallsString):
2723         * kjs/nodes.h:
2724         (KJS::Node::):
2725         (KJS::StatementNode::):
2726         (KJS::NullNode::):
2727         (KJS::BooleanNode::):
2728         (KJS::NumberNode::):
2729         (KJS::StringNode::):
2730         (KJS::RegExpNode::):
2731         (KJS::ThisNode::):
2732         (KJS::ResolveNode::):
2733         (KJS::GroupNode::):
2734         (KJS::ElementNode::):
2735         (KJS::ArrayNode::):
2736         (KJS::PropertyNameNode::):
2737         (KJS::PropertyNode::):
2738         (KJS::PropertyListNode::):
2739         (KJS::ObjectLiteralNode::):
2740         (KJS::BracketAccessorNode::):
2741         (KJS::DotAccessorNode::):
2742         (KJS::ArgumentListNode::):
2743         (KJS::ArgumentsNode::):
2744         (KJS::NewExprNode::):
2745         (KJS::FunctionCallValueNode::):
2746         (KJS::FunctionCallResolveNode::):
2747         (KJS::FunctionCallBracketNode::):
2748         (KJS::FunctionCallParenBracketNode::):
2749         (KJS::FunctionCallDotNode::):
2750         (KJS::FunctionCallParenDotNode::):
2751         (KJS::PostfixResolveNode::):
2752         (KJS::PostfixBracketNode::):
2753         (KJS::PostfixDotNode::):
2754         (KJS::PostfixErrorNode::):
2755         (KJS::DeleteResolveNode::):
2756         (KJS::DeleteBracketNode::):
2757         (KJS::DeleteDotNode::):
2758         (KJS::DeleteValueNode::):
2759         (KJS::VoidNode::):
2760         (KJS::TypeOfResolveNode::):
2761         (KJS::TypeOfValueNode::):
2762         (KJS::PrefixResolveNode::):
2763         (KJS::PrefixBracketNode::):
2764         (KJS::PrefixDotNode::):
2765         (KJS::PrefixErrorNode::):
2766         (KJS::UnaryPlusNode::):
2767         (KJS::NegateNode::):
2768         (KJS::BitwiseNotNode::):
2769         (KJS::LogicalNotNode::):
2770         (KJS::MultNode::):
2771         (KJS::AddNode::):
2772         (KJS::ShiftNode::):
2773         (KJS::RelationalNode::):
2774         (KJS::EqualNode::):
2775         (KJS::BitOperNode::):
2776         (KJS::BinaryLogicalNode::):
2777         (KJS::ConditionalNode::):
2778         (KJS::AssignResolveNode::):
2779         (KJS::AssignBracketNode::):
2780         (KJS::AssignDotNode::):
2781         (KJS::AssignErrorNode::):
2782         (KJS::CommaNode::):
2783         (KJS::AssignExprNode::):
2784         (KJS::VarDeclListNode::):
2785         (KJS::VarStatementNode::):
2786         (KJS::EmptyStatementNode::):
2787         (KJS::ExprStatementNode::):
2788         (KJS::IfNode::):
2789         (KJS::DoWhileNode::):
2790         (KJS::WhileNode::):
2791         (KJS::ForNode::):
2792         (KJS::ContinueNode::):
2793         (KJS::BreakNode::):
2794         (KJS::ReturnNode::):
2795         (KJS::WithNode::):
2796         (KJS::LabelNode::):
2797         (KJS::ThrowNode::):
2798         (KJS::TryNode::):
2799         (KJS::ParameterNode::):
2800         (KJS::Parameter::):
2801         (KJS::FunctionBodyNode::):
2802         (KJS::FuncExprNode::):
2803         (KJS::FuncDeclNode::):
2804         (KJS::SourceElementsNode::):
2805         (KJS::CaseClauseNode::):
2806         (KJS::ClauseListNode::):
2807         (KJS::SwitchNode::):
2808
2809 2007-04-24  Oliver Hunt  <oliver@apple.com>
2810
2811         GTK Build fix, ::findEntry->KJS::findEntry
2812
2813         * kjs/lookup.cpp:
2814         (KJS::Lookup::findEntry):
2815         (KJS::Lookup::find):
2816
2817 2007-04-23  Maciej Stachowiak  <mjs@apple.com>
2818
2819         Reviewed by Geoff.
2820         
2821         - compile most of JavaScriptCore as one file for 4% JS iBench speed improvement 
2822
2823         * JavaScriptCore.xcodeproj/project.pbxproj: Add AllInOneFile.cpp, and remove files it includes
2824         from the build.
2825         * kjs/AllInOneFile.cpp: Added.
2826         * kjs/dtoa.cpp: Renamed CONST to CONST_ to avoid conflict.
2827         (Bigint::):
2828         (Bigint::nrv_alloc):
2829         * kjs/lookup.cpp: Use "namspace KJS { ... }" instead of "using namespace KJS;" 
2830
2831 2007-04-23  Maciej Stachowiak  <mjs@apple.com>
2832
2833         Build fix, not reviewed.
2834
2835         * kjs/collector.h: Fix struct/class mismatch.
2836
2837 2007-04-23  Maciej Stachowiak  <mjs@apple.com>
2838
2839         Reviewed by Darin.
2840
2841         - raise ALLOCATIONS_PER_COLLECTION to 4000, for 3.7% iBench speed improvement
2842          
2843         Now that the cell size is smaller and the block size is bigger, we can fit 4000 objects in
2844         the two spare cells the collector is willing to keep around, so collect a bit less often.
2845         
2846         * kjs/collector.cpp:
2847
2848 2007-04-23  Maciej Stachowiak  <mjs@apple.com>
2849
2850         Reviewed by Darin and Geoff.
2851         
2852         - move mark and collectOnMainThreadOnly bits into separate bitmaps
2853         
2854         This saves 4 bytes per cell, allowing shrink of cell size to 32,
2855         which leads to a .8% speed improvement on iBench.
2856         
2857         This is only feasible because of all the previous changes on the branch.
2858
2859         * kjs/collector.cpp:
2860         (KJS::allocateBlock): Adjust for some renames of constants. 
2861         (KJS::Collector::markStackObjectsConservatively): Now that cells are 32 bytes (64 
2862         bytes on 64-bit) the cell alignment check can be made much more strict, and also
2863         obsoletes the need for a % sizeof(CollectorCell) check. Also, we can mask off the low
2864         bits of the pointer to have a potential block pointer to look for.
2865         (KJS::Collector::collectOnMainThreadOnly): Use bitmap.
2866         (KJS::Collector::markMainThreadOnlyObjects): Use bitmap.
2867         (KJS::Collector::collect): When sweeping, use bitmaps directly to find mark bits.
2868         * kjs/collector.h:
2869         (KJS::): Move needed constants and type declarations here.
2870         (KJS::CollectorBitmap::get): Bit twiddling to get a bitmap value.
2871         (KJS::CollectorBitmap::set): Bit twiddling to set a bitmap bit to true.
2872         (KJS::CollectorBitmap::clear): Bit twiddling to set a bitmap bit to false.
2873         (KJS::CollectorBitmap::clearAll): Clear whole bitmap at one go.
2874         (KJS::Collector::cellBlock): New operation, compute the block pointer for
2875         a cell by masking off low bits.
2876         (KJS::Collector::cellOffset): New operation, compute the cell offset for a
2877         cell by masking off high bits and dividing (actually a shift).
2878         (KJS::Collector::isCellMarked): Check mark bit in bitmap
2879         (KJS::Collector::markCell): Set mark bit in bitmap.
2880         * kjs/value.h:
2881         (KJS::JSCell::JSCell): No more bits.
2882         (KJS::JSCell::marked): Let collector handle it.
2883         (KJS::JSCell::mark): Let collector handle it.
2884
2885 2007-04-23  Anders Carlsson  <andersca@apple.com>
2886
2887         Build fix.
2888         
2889         * kjs/regexp_object.h:
2890         RegExpObjectImpPrivate is a struct, not a class.
2891         
2892 2007-04-23  Maciej Stachowiak  <mjs@apple.com>
2893
2894         Reviewed by Darin.
2895         
2896         - shrink FunctionImp / DeclaredFunctionImp by 4 bytes, by moving parameter list to function body
2897         
2898         I reconciled this with a similar change in KDE kjs by Maks Orlovich <maksim@kde.org>.
2899
2900         * kjs/function.cpp:
2901         (KJS::FunctionImp::callAsFunction):
2902         (KJS::FunctionImp::passInParameters):
2903         (KJS::FunctionImp::lengthGetter):
2904         (KJS::FunctionImp::getParameterName):
2905         * kjs/function.h:
2906         * kjs/function_object.cpp:
2907         (FunctionProtoFunc::callAsFunction):
2908         (FunctionObjectImp::construct):
2909         * kjs/nodes.cpp:
2910         (FunctionBodyNode::addParam):
2911         (FunctionBodyNode::paramString):
2912         (FuncDeclNode::addParams):
2913         (FuncDeclNode::processFuncDecl):
2914         (FuncExprNode::addParams):
2915         (FuncExprNode::evaluate):
2916         * kjs/nodes.h:
2917         (KJS::Parameter::Parameter):
2918         (KJS::FunctionBodyNode::numParams):
2919         (KJS::FunctionBodyNode::paramName):
2920         (KJS::FunctionBodyNode::parameters):
2921         (KJS::FuncExprNode::FuncExprNode):
2922         (KJS::FuncDeclNode::FuncDeclNode):
2923         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable 64-bit warnings because
2924         they handle size_t badly.
2925
2926 2007-04-23  Maciej Stachowiak  <mjs@apple.com>
2927  
2928         Reviewed by Darin.
2929
2930         - shrink RegexpObjectImp by 4 bytes
2931         
2932         Somewhat inexplicably, this seems to be a .33% speedup on JS iBench.
2933         
2934         * kjs/regexp_object.cpp:
2935         (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate):
2936         (RegExpObjectImp::RegExpObjectImp):
2937         (RegExpObjectImp::performMatch):
2938         (RegExpObjectImp::arrayOfMatches):
2939         (RegExpObjectImp::getBackref):
2940         (RegExpObjectImp::getLastMatch):
2941         (RegExpObjectImp::getLastParen):
2942         (RegExpObjectImp::getLeftContext):
2943         (RegExpObjectImp::getRightContext):
2944         (RegExpObjectImp::getValueProperty):
2945         (RegExpObjectImp::putValueProperty):
2946         * kjs/regexp_object.h:
2947
2948 2007-04-23  Maciej Stachowiak  <mjs@apple.com>
2949
2950         Reviewed by Oliver.
2951         
2952         - change to 1-bit bitfields instead of 8-bit, this turns out to lead to a .51% speedup on JS iBench
2953         
2954         The 1-bit bitfields are actually faster than just plain bools, at least on Intel (go figure).
2955
2956         * kjs/property_map.h:
2957
2958 2007-04-23  Maciej Stachowiak  <mjs@apple.com>
2959
2960         Reviewed by Darin.
2961        
2962         - shrink ArrayInstance objects by 4 bytes
2963         http://bugs.webkit.org/show_bug.cgi?id=13386
2964         
2965         I did this by storing the capacity before the beginning of the storage array. It turns out
2966         it is rarely needed and is by definition 0 when the storage array is null.
2967  
2968         * kjs/array_instance.h:
2969         (KJS::ArrayInstance::capacity): Get it from the secret stash
2970         * kjs/array_object.cpp:
2971         (allocateStorage): New function to encapsulate allocating the storage with extra space ahead
2972         for the capacity.
2973         (reallocateStorage): ditto for realloc
2974         (ArrayInstance::ArrayInstance):
2975         (ArrayInstance::~ArrayInstance):
2976         (ArrayInstance::resizeStorage):
2977
2978 2007-04-23  Darin Adler  <darin@apple.com>
2979
2980         Reviewed by Maciej.
2981
2982         - fix <rdar://problem/4840688> REGRESSION (r10588, r10621): JavaScript won't parse
2983           modifications of non-references (breaks 300themovie.warnerbros.com, fedex.com)
2984
2985         Despite the ECMAScript specification's claim that you can treat these as syntax
2986         errors, doing so creates some website incompatibilities. So this patch turns them back
2987         into evaluation errors instead.
2988
2989         Test: fast/js/modify-non-references.html
2990
2991         * kjs/grammar.y: Change makeAssignNode, makePrefixNode, and makePostfixNode so that they
2992         never fail to parse. Update rules that use them. Fix a little bit of indenting. Use
2993         new PostfixErrorNode, PrefixErrorNode, and AssignErrorNode classes.
2994
2995         * kjs/nodes.h: Added an overload of throwError that takes a char* argument.
2996         Replaced setExceptionDetailsIfNeeded and debugExceptionIfNeeded with handleException,
2997         which does both. Added PostfixErrorNode, PrefixErrorNode, and AssignErrorNode classes.
2998
2999         * kjs/nodes.cpp: Changed exception macros to use handleException; simpler and smaller
3000         code size than the two functions that we used before.
3001         (Node::throwError): Added the overload mentioned above.
3002         (Node::handleException): Added. Contains the code from both setExceptionDetailsIfNeeded
3003         and debugExceptionIfNeeded.
3004         (PostfixErrorNode::evaluate): Added. Throws an exception.
3005         (PrefixErrorNode::evaluate): Ditto.
3006         (AssignErrorNode::evaluate): Ditto.
3007         (ThrowNode::execute): Call handleException instead of debugExceptionIfNeeded; this
3008         effectively adds a call to setExceptionDetailsIfNeeded, which may help with getting
3009         the correct file and line number for these exceptions.
3010
3011         * kjs/nodes2string.cpp:
3012         (PostfixErrorNode::streamTo): Added.
3013         (PrefixErrorNode::streamTo): Added.
3014         (AssignErrorNode::streamTo): Added.
3015
3016 2007-04-23  Maciej Stachowiak  <mjs@apple.com>
3017
3018         Reviewed by Darin.
3019         
3020         - fix test failures / crashes on PPC
3021
3022         * kjs/property_map.h: Make the bool fields explicitly 8-bit bitfields, since bool is a full
3023         word there otherwise :-(
3024
3025 2007-04-23  Maciej Stachowiak  <mjs@apple.com>
3026
3027         Reviewed by Darin.
3028         
3029         - fix more test case failures
3030
3031         * bindings/runtime_array.cpp:
3032         (RuntimeArray::RuntimeArray): inherit from JSObject instead of ArrayInstance; it turns
3033         out that this class only needs the prototype and classInfo from ArrayInstance, not the
3034         actual class itself, and it was too big otherwise.
3035         (RuntimeArray::getOwnPropertySlot):
3036         * bindings/runtime_array.h:
3037
3038 2007-04-23  Maciej Stachowiak  <mjs@apple.com>
3039
3040         Reviewed by Darin.
3041         
3042         - fix some test failures
3043
3044         * bindings/runtime_method.cpp:
3045         (RuntimeMethod::RuntimeMethod): inherit from InternalFunctionImp instead of FunctionImpl,
3046         otherwise this is too big
3047         (RuntimeMethod::getOwnPropertySlot):
3048         * bindings/runtime_method.h:
3049
3050 2007-04-22  Maciej Stachowiak  <mjs@apple.com>
3051
3052         Reviewed by Darin.
3053         
3054         - discard the arguments List for an ActivationImp when the corresponding Context is destroyed (1.7% speedup)
3055         http://bugs.webkit.org/show_bug.cgi?id=13385
3056
3057         Based an idea by Christopher E. Hyde <C.Hyde@parableuk.force9.co.uk>. His patch to do 
3058         this also had many other List changes and I found this much simpler subset of the changes
3059         was actually a hair faster.
3060         
3061         This optimization is valid because the arguments list is only kept around to
3062         lazily make the arguments object. If it's not made by the time the function
3063         exits, it never will be, since any function that captures the continuation will
3064         have its own local arguments variable in scope.
3065         
3066         Besides the 1.7% speed improvement, it shrinks List by 4 bytes
3067         (which in turn shrinks ActivationImp by 4 bytes).
3068         
3069         * kjs/Context.cpp:
3070         (KJS::Context::~Context): Clear the activation's arguments list.
3071         * kjs/function.cpp:
3072         (KJS::ActivationImp::ActivationImp): Adjusted for list changes.
3073         (KJS::ActivationImp::mark): No need to mark, lists are always protected (this doesn't
3074         cause a ref-cycle for reasons stated above).
3075         (KJS::ActivationImp::createArgumentsObject): Clear arguments list.
3076         * kjs/function.h:
3077         * kjs/list.cpp:
3078         (KJS::List::List): No more needsMarking boolean
3079         (KJS::List::operator=): ditto
3080         * kjs/list.h:
3081         (KJS::List::List): ditto
3082         (KJS::List::reset): ditto
3083         (KJS::List::deref): ditto
3084
3085 2007-04-22  Maciej Stachowiak  <mjs@apple.com>
3086
3087         Reviewed by Darin.
3088         
3089         - shrink PropertyMap by 8 bytes and therefore shrink CELL_SIZE to 40 (for 32-bit; 
3090         similar shrinkage for 64-bit)
3091         http://bugs.webkit.org/show_bug.cgi?id=13384
3092
3093         Inspired by similar changes by Christopher E. Hyde <C.Hyde@parableuk.force9.co.uk>
3094         done in the kjs-tweaks branch of KDE's kjs. However, this version is somewhat 
3095         cleaner style-wise and avoids some of the negative speed impact (at least on gcc/x86) 
3096         of his version.
3097         
3098         This is nearly a wash performance-wise, maybe a slight slowdown, but worth doing
3099         to eventually reach cell size 32.
3100         
3101         * kjs/collector.cpp:
3102         (KJS::):
3103         * kjs/property_map.cpp:
3104         (KJS::PropertyMap::~PropertyMap):
3105         (KJS::PropertyMap::clear):
3106         (KJS::PropertyMap::get):
3107         (KJS::PropertyMap::getLocation):
3108         (KJS::PropertyMap::put):
3109         (KJS::PropertyMap::insert):
3110         (KJS::PropertyMap::expand):
3111         (KJS::PropertyMap::rehash):
3112         (KJS::PropertyMap::remove):
3113         (KJS::PropertyMap::mark):
3114         (KJS::PropertyMap::containsGettersOrSetters):
3115         (KJS::PropertyMap::getEnumerablePropertyNames):
3116         (KJS::PropertyMap::getSparseArrayPropertyNames):
3117         (KJS::PropertyMap::save):
3118         (KJS::PropertyMap::checkConsistency):
3119         * kjs/property_map.h:
3120         (KJS::PropertyMap::hasGetterSetterProperties):
3121         (KJS::PropertyMap::setHasGetterSetterProperties):
3122         (KJS::PropertyMap::):
3123         (KJS::PropertyMap::PropertyMap):
3124
3125 2007-04-22  Maciej Stachowiak  <mjs@apple.com>
3126
3127         Reviewed by Darin.
3128         
3129         - change blocks to 64k in size, and use various platform-specific calls to allocate at 64k-aligned addresses
3130         http://bugs.webkit.org/show_bug.cgi?id=13383
3131         
3132         * kjs/collector.cpp:
3133         (KJS::allocateBlock): New function to allocate 64k of 64k-aligned memory
3134         (KJS::freeBlock): Corresponding free
3135         (KJS::Collector::allocate):
3136         (KJS::Collector::collect):
3137
3138 2007-04-22  Maciej Stachowiak  <mjs@apple.com>
3139
3140         Reviewed by Darin and Geoff.
3141         
3142         - remove the concept of oversize objects, now that there aren't any (for now
3143         only enforced with an assert).
3144         http://bugs.webkit.org/show_bug.cgi?id=13382
3145
3146         This change is a .66% speedup on JS iBench for 32-bit platforms, probably much more
3147         for 64-bit since it finally gives a reasonable cell size, but I did not test that.
3148         
3149         * kjs/collector.cpp:
3150         (KJS::): Use different cell size for 32-bit and 64-bit, now that there is no
3151         oversize allocation.
3152         (KJS::Collector::allocate): Remove oversize allocator.
3153         (KJS::Collector::markStackObjectsConservatively): Don't check oversize objects.
3154         (KJS::Collector::markMainThreadOnlyObjects): Ditto.
3155         (KJS::Collector::collect): Ditto.
3156
3157 2007-04-21  Mitz Pettel  <mitz@webkit.org>
3158
3159         Reviewed by Adam.
3160
3161         - fix http://bugs.webkit.org/show_bug.cgi?id=13428
3162           REGRESSION (r20973-r20976): Failing ecma/Array/15.4.4.5-3.js
3163
3164         - fix http://bugs.webkit.org/show_bug.cgi?id=13429
3165           REGRESSION (r20973-r20976): Crashing in fast/dom/plugin-attributes-enumeration.html
3166
3167         * kjs/array_object.cpp:
3168         (ArrayInstance::sort): Free the old storage, not the new one.
3169
3170 2007-04-20  Maciej Stachowiak  <mjs@apple.com>
3171
3172         Not reviewed, build fix.
3173
3174         - fix build problem with last change - -O3 complains more about uninitialized variables
3175         
3176         * pcre/pcre_compile.c:
3177         (compile_branch):
3178         (pcre_compile2):
3179
3180 2007-04-20  Maciej Stachowiak  <mjs@apple.com>
3181
3182         Reviewed by Darin.
3183         
3184         - <rdar://problem/5149915> use mergesort when possible, since it leads to fewer compares (2% JS iBench speedup)
3185
3186         * kjs/array_object.cpp:
3187         (ArrayInstance::sort): Use mergesort(3) on platforms that have it, since it tends
3188         to do fewer compares than qsort; but avoid it very on large arrays since it uses extra
3189         memory. Also added comments identifying possibly even better sorting algorithms
3190         for sort by string value and sort by compare function.
3191         * kjs/config.h:
3192
3193 2007-04-20  Maciej Stachowiak  <mjs@apple.com>
3194
3195         Reviewed by Darin.
3196         
3197         - bump optimization flags up to -O3 for 1% JS iBench speed improvement 
3198
3199         * Configurations/Base.xcconfig:
3200
3201 2007-04-20  Mark Rowe  <mrowe@apple.com>
3202
3203         Reviewed by Maciej.
3204
3205         Fix bogus optimisation in the generic pthread code path.
3206
3207         * kjs/collector.cpp:
3208         (KJS::currentThreadStackBase):
3209
3210 2007-04-20  Mark Rowe  <mrowe@apple.com>
3211
3212         Reviewed by Anders.
3213
3214         Improve FreeBSD compatibility, as suggested by Alexander Botero-Lowry.
3215
3216         * kjs/collector.cpp:
3217         (KJS::currentThreadStackBase): FreeBSD requires that pthread_attr_t's are
3218         initialized via pthread_attr_init before being used in any context.
3219
3220 2007-04-19  Mark Rowe  <mrowe@apple.com>
3221
3222         Reviewed by Darin.
3223
3224         Fix http://bugs.webkit.org/show_bug.cgi?id=13401
3225         Bug 13401: Reproducible crash calling myArray.sort(compareFn) from within
3226         a sort comparison function
3227
3228         * kjs/array_object.cpp:
3229         (ArrayInstance::sort): Save/restore the static variables around calls to qsort
3230         to ensure nested calls to ArrayInstance::sort behave correctly.
3231
3232 2007-04-12  Deneb Meketa  <dmeketa@adobe.com>
3233
3234         Reviewed by Darin Adler.
3235
3236         http://bugs.webkit.org/show_bug.cgi?id=13029
3237         rdar://problem/4994849
3238         Bug 13029: Permit NPAPI plug-ins to see HTTP response headers.
3239         This doesn't actually change JavaScriptCore, but that's where npapi.h is.
3240
3241         * bindings/npapi.h:
3242         Add headers member to NPStream struct.  Also increase NP_VERSION_MINOR to 18.
3243         Increasing to >= 17 allows plug-ins to safely detect whether to look for
3244         NPStream::headers.  Increasing from 17 to 18 reflects presence of NPObject
3245         enumeration, which was added in a prior patch, and which has been agreed to
3246         constitute version 18 by the plugin-futures list.  Also add other missing
3247         bits of npapi.h to catch up from 14 to 18.  This includes features that are
3248         not implemented in WebKit, but those are safely stubbed.
3249
3250 2007-04-10  Geoffrey Garen  <ggaren@apple.com>
3251
3252         Reviewed by Mark Rowe.
3253         
3254         Fixed last check-in to print in release builds, too.
3255
3256         * kjs/collector.cpp:
3257         (KJS::getPlatformThreadRegisters):
3258
3259 2007-04-10  Geoffrey Garen  <ggaren@apple.com>
3260
3261         Reviewed by John Sullivan, Darin Adler.
3262         
3263         Fixed <rdar://problem/5121899> JavaScript garbage collection leads to 
3264         later crash under Rosetta (should abort or leak instead?)
3265         
3266         Log an error message and crash if the kernel reports failure during GC.
3267         We decided to do this instead of just leaking because we don't want people
3268         to get the mistaken impression that running in Rosetta is a supported
3269         configurtion.
3270         
3271         The CRASH macro will also hook into CrashReporter, which will tell us if 
3272         many (any?) users run into this issue.
3273
3274         * kjs/collector.cpp:
3275         (KJS::getPlatformThreadRegisters):
3276
3277 2007-04-06  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
3278
3279         Reviewed by darin.
3280
3281         Coverity fix. Coverity says:
3282         "Event var_deref_model: Variable "sourceRanges" tracked as NULL was passed to a
3283         function that dereferences it"
3284
3285         * kjs/string_object.cpp:
3286         (KJS::replace):
3287
3288 2007-04-06  Geoffrey Garen  <ggaren@apple.com>
3289
3290         Rubber stamped by Adele Peterson.
3291
3292         * kjs/ExecState.h: Removed obsolete forward/friend declaration of 
3293         RuntimeMethodImp.
3294
3295 2007-04-05  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
3296
3297         Reviewed by darin.
3298
3299         Coverity fix. Coverity says:
3300         "Event check_after_deref: Pointer "dateString" dereferenced before NULL check"
3301
3302         * kjs/date_object.cpp:
3303         (KJS::parseDate):
3304
3305 2007-04-05  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
3306
3307         Reviewed by darin.
3308
3309         Coverity fix. Coverity says:
3310         "Event check_after_deref: Pointer "re" dereferenced before NULL check"
3311
3312         * pcre/pcre_study.c:
3313         (pcre_study):
3314
3315 2007-04-05  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
3316
3317         Reviewed by darin.
3318
3319         Coverity fixes. Coverity says:
3320         "Event leaked_storage: Returned without freeing storage "buffer""
3321         and:
3322         "Event leaked_storage: Returned without freeing storage "script""
3323
3324         * kjs/testkjs.cpp:
3325         (doIt):
3326         (createStringWithContentsOfFile):
3327
3328 2007-04-05  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
3329
3330         Reviewed by darin.
3331
3332         Coverity fix: in single-threaded case currentThreadIsMainThread is always true
3333         so the code in if (!currentThreadIsMainThread) cannot possibly be reached
3334         and Coverity complains about dead code.
3335
3336         * kjs/collector.cpp:
3337         (KJS::Collector::collect):
3338
3339 === Safari-5522.6 ===
3340
3341 2007-04-03  Kevin McCullough  <kmccullough@apple.com>
3342
3343         Reviewed by Adam.
3344
3345         - Testing a post-commit hook.
3346
3347         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
3348
3349 2007-04-03  Anders Carlsson  <andersca@apple.com>
3350
3351         Reviewed by Adam.
3352
3353         <rdar://problem/5107534>
3354         http://bugs.webkit.org/show_bug.cgi?id=13265
3355         REGRESSION: Crash in KJS::Bindings::convertValueToNPVariant
3356         
3357         * bindings/NP_jsobject.cpp:
3358         (_NPN_InvokeDefault):
3359         Return false if the object isn't a function. Set the return value to undefined by default
3360         (to match Firefox).
3361         
3362 2007-03-30  Anders Carlsson <andersca@apple.com>
3363
3364         Build fix.
3365         
3366         * bindings/NP_jsobject.cpp:
3367         (_NPN_Enumerate):
3368
3369 2007-03-30  Anders Carlsson  <andersca@apple.com>
3370
3371         Reviewed by Geoff.
3372
3373         Implement _NPN_Enumerate support.
3374         
3375         * JavaScriptCore.exp:
3376         * bindings/NP_jsobject.cpp:
3377         (_NPN_Enumerate):
3378         * bindings/c/c_instance.cpp:
3379         (KJS::Bindings::CInstance::getPropertyNames):
3380         * bindings/c/c_instance.h:
3381         * bindings/npapi.h:
3382         * bindings/npruntime.h:
3383         * bindings/npruntime_impl.h:
3384         * bindings/runtime.h:
3385         (KJS::Bindings::Instance::getPropertyNames):
3386         * bindings/runtime_object.cpp:
3387         (RuntimeObjectImp::getPropertyNames):
3388         * bindings/runtime_object.h:
3389         (KJS::RuntimeObjectImp::getInternalInstance):
3390
3391 2007-03-28  Jeff Walden  <jwalden+code@mit.edu>
3392
3393         Reviewed by Darin.
3394
3395         http://bugs.webkit.org/show_bug.cgi?id=12963
3396         Fix some inconsistencies in the Mozilla JS Array extras implementations
3397         with respect to the Mozilla implementation:
3398
3399           - holes in arrays should be skipped, not treated as undefined,
3400             by all such methods
3401           - an element with value undefined is not a hole
3402           - Array.prototype.forEach should return undefined
3403
3404         * kjs/array_object.cpp:
3405         (ArrayInstance::getOwnPropertySlot):
3406         (ArrayProtoFunc::callAsFunction):
3407
3408 2007-03-27  Anders Carlsson  <acarlsson@apple.com>
3409
3410         Reviewed by Geoff.
3411
3412         * bindings/NP_jsobject.cpp:
3413         (_NPN_InvokeDefault):
3414         Call JSObject:call for native JavaScript objects.
3415
3416 2007-03-26  David Carson  <dacarson@gmail.com>
3417
3418         Reviewed by Darin, landed by Anders.
3419
3420         Fix for: REGRESSION (r19559): Java applet crash
3421         http://bugs.webkit.org/show_bug.cgi?id=13142
3422         <rdar://problem/5080340>
3423
3424         The previous fix http://bugs.webkit.org/show_bug.cgi?id=12636 
3425         introduced new JNIType to enum in jni_utility.h This is a 
3426         problem on the Mac as it seems that the JNIType enum is also
3427         used in the JVM, it is used to specify the return type in
3428         jni_objc.mm
3429         Corrected the fix by moving type to the end, and changing
3430         jni_objc.mm to convert the new type to an old compatible
3431         type.
3432
3433         * bindings/jni/jni_objc.mm:
3434         (KJS::Bindings::dispatchJNICall):
3435         * bindings/jni/jni_utility.h:
3436
3437 2007-03-26  Christopher Brichford  <chrisb@adobe.com>
3438
3439         Reviewed/landed by Adam.
3440
3441         Bug 13198: Move build settings from project file to xcconfig file for apollo
3442         port JSCore
3443         http://bugs.webkit.org/show_bug.cgi?id=13198
3444
3445         - Moving build settings from xcode project file to xcconfig files.
3446
3447         * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Debug.xcconfig:
3448         * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Release.xcconfig:
3449         * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcconfig:
3450         * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
3451
3452 2007-03-26  Brady Eidson  <beidson@apple.com>
3453
3454         Rubberstamped by Anders and Maciej aand Geoff (oh my!)
3455         
3456         Since CFTypeRef is really void*, a RetainPtr couldn't be used. 
3457         RefType was "void", which doesn't actually exist as a type.
3458         Since RefType only existed for operator*(), and since that operator
3459         doesn't make any sense for RetainPtr, I removed them!
3460
3461         * kjs/nodes.cpp: Touch this to force a rebuild and (hopefully) help the
3462           compiler with dependencies
3463         * wtf/RetainPtr.h: Nuke RefType and operator*()
3464
3465 2007-03-26  Geoffrey Garen  <ggaren@apple.com>
3466
3467         Touched a file to (hopefully) help the compiler with RetainPtr dependencies.
3468
3469         * kjs/nodes.cpp:
3470         (Node::deref):
3471
3472 2007-03-24  Brady Eidson  <beidson@apple.com>
3473
3474         Reviewed by Adam
3475
3476         Whoops, RetainPtr should be in the WTF namespace
3477
3478         * wtf/RetainPtr.h:
3479
3480 2007-03-24  Brady Eidson  <beidson@apple.com>
3481
3482         Reviewed by Adam
3483         
3484         <rdar://problem/5086210> - Move RetainPtr to WTF
3485
3486         * wtf/RetainPtr.h: Added
3487         * JavaScriptCore.xcodeproj/project.pbxproj: Add it to the project file
3488         * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto
3489
3490
3491 2007-03-23  Christopher Brichford  <chrisb@adobe.com>
3492
3493         Reviewed/landed by Adam.
3494
3495         Bug 13175: Make apollo mac project files for JavaScriptCore actually
3496         build something
3497         http://bugs.webkit.org/show_bug.cgi?id=13175
3498
3499         - Changing apollo mac project files for JavaScriptCore such that they actually build
3500         JavaScriptCore source code.
3501
3502         * JavaScriptCore.apolloproj/ForwardingSources/grammar.cpp: Added.
3503         * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcconfig:
3504         * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
3505
3506 2007-03-24  Mark Rowe  <mrowe@apple.com>
3507
3508         Rubber-stamped by Darin.
3509
3510         * Configurations/JavaScriptCore.xcconfig: Remove unnecessary INFOPLIST_PREPROCESS.
3511
3512 2007-03-22  Christopher Brichford  <chrisb@adobe.com>
3513
3514         Reviewed/landed by Adam.
3515
3516         Bug 13164: Initial version of mac JavaScriptCore project files for
3517         apollo port 
3518         http://bugs.webkit.org/show_bug.cgi?id=13164
3519
3520         - Adding mac project files for apollo port of JavaScriptCore. Currently project
3521         just builds dftables.
3522
3523         * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Debug.xcconfig: Added.
3524         * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Release.xcconfig: Added.
3525         * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcconfig: Added.
3526         * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: Added.
3527
3528 2007-03-21  Timothy Hatcher  <timothy@apple.com>
3529
3530         Reviewed by Darin.
3531
3532         <rdar://problem/5076599> JavaScriptCore has a weak export (vtable for KJS::JSCell)
3533
3534         * JavaScriptCore.exp: Remove __ZTVN3KJS6JSCellE.
3535
3536 2007-03-21  Adele Peterson  <adele@apple.com>
3537
3538         Reviewed by Geoff.
3539
3540         * API/JSStringRef.cpp: (JSStringIsEqual): Added JSLock.
3541
3542 2007-03-21  Zack Rusin  <zrusin@trolltech.com>
3543
3544         Fix the compile when USE(MULTIPLE_THREADS) isn't
3545         defined
3546
3547         * kjs/JSLock.cpp:
3548         (KJS::JSLock::currentThreadIsHoldingLock):
3549
3550 2007-03-20  Maciej Stachowiak  <mjs@apple.com>
3551
3552         Reviewed by Geoff and Adam.
3553         
3554         - make USE(MULTIPLE_THREADS) support more portable
3555         http://bugs.webkit.org/show_bug.cgi?id=13069
3556         
3557         - fixed a threadsafety bug discovered by testing this
3558         
3559         - enhanced threadsafety assertions in collector
3560
3561         * API/JSCallbackObject.cpp:
3562         (KJS::JSCallbackObject::~JSCallbackObject): This destructor can't
3563         DropAllLocks around the finalize callback, because it gets called
3564         from garbage collection and we can't let other threads collect!
3565
3566         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3567         * kjs/JSLock.cpp:
3568         (KJS::JSLock::currentThreadIsHoldingLock): Added new function
3569         to allow stronger assertions than just that the lock is held
3570         by some thread (you can now assert that the current thread is
3571         holding it, given the new JSLock design).
3572         * kjs/JSLock.h:
3573         * kjs/collector.cpp: Refactored for portability plus added some
3574         stronger assertions.
3575         (KJS::Collector::allocate):
3576         (KJS::currentThreadStackBase):
3577         (KJS::Collector::registerAsMainThread):
3578         (KJS::onMainThread):
3579         (KJS::PlatformThread::PlatformThread):
3580         (KJS::getCurrentPlatformThread):
3581         (KJS::Collector::Thread::Thread):
3582         (KJS::destroyRegisteredThread):
3583         (KJS::Collector::registerThread):
3584         (KJS::Collector::markCurrentThreadConservatively):
3585         (KJS::suspendThread):
3586         (KJS::resumeThread):
3587         (KJS::getPlatformThreadRegisters):
3588         (KJS::otherThreadStackPointer):
3589         (KJS::otherThreadStackBase):
3590         (KJS::Collector::markOtherThreadConservatively):
3591         (KJS::Collector::markStackObjectsConservatively):
3592         (KJS::Collector::protect):
3593         (KJS::Collector::unprotect):
3594         (KJS::Collector::collectOnMainThreadOnly):
3595         (KJS::Collector::markMainThreadOnlyObjects):
3596         (KJS::Collector::collect):
3597         * kjs/collector.h:
3598         * wtf/FastMalloc.cpp:
3599         (WTF::fastMallocSetIsMultiThreaded):
3600         * wtf/FastMallocInternal.h:
3601         * wtf/Platform.h:
3602
3603 2007-03-19  Darin Adler  <darin@apple.com>
3604
3605         * kjs/value.h: Roll ~JSValue change out. It was causing problems. I'll do it right later.
3606
3607 2007-03-19  Geoffrey Garen  <ggaren@apple.com>
3608
3609         Reviewed by John Sullivan.
3610
3611         Fixed <rdar://problem/5073380> REGRESSION: Crash occurs at WTF::fastFree() 
3612         when reloading liveconnect page (applet)
3613         
3614         Best to use free when you use malloc, especially when malloc and delete
3615         use completely different libraries.
3616
3617         * bindings/jni/jni_runtime.cpp:
3618         (JavaMethod::~JavaMethod):
3619
3620 2007-03-19  Andrew Wellington  <proton@wiretapped.net>
3621
3622         Reviewed by Maciej.
3623
3624         Really set Xcode editor to use 4 space indentation (http://webkit.org/coding/coding-style.html)
3625
3626         * JavaScriptCore.xcodeproj/project.pbxproj:
3627
3628 2007-03-19  Darin Adler  <darin@apple.com>
3629
3630         Reviewed by Geoff.
3631
3632         - Changed list size threshold to 5 based on testing.
3633
3634         I was testing the i-Bench JavaScript with the list statistics
3635         dumping on, and discovered that there were many 5-element lists.
3636         The fast case for lists was for 4 elements and fewer. By changing
3637         the threshold to 5 elements we get a measurable speedup. I believe
3638         this will help real web pages too, not just the benchmark.
3639
3640         * kjs/list.cpp: Change constant from 4 to 5.
3641
3642 2007-03-19  Darin Adler  <darin@apple.com>
3643
3644         * kjs/value.h: Oops, fix build.
3645
3646 2007-03-19  Darin Adler  <darin@apple.com>
3647
3648         Reviewed by Geoff.
3649
3650         - remove ~JSValue; tiny low-risk performance boost
3651
3652         * kjs/value.h: Remove unneeded empty virtual destructor from JSValue.
3653         The only class derived from JSValue is JSCell and it already has a
3654         virtual destructor. Declaring an empty constructor in JSValue had one
3655         good effect: it marked the destructor private, making it a compile
3656         time error to try to destroy a JSValue; but that's not a likely
3657         mistake for someone to make. It had two bad effects: (1) it caused gcc,
3658         at least, to generate code to fix up the virtual table pointer to
3659         point to the JSValue version of the virtual table inside the destructor
3660         of all classes derived from JSValue directly or indirectly; (2) it
3661         caused JSValue to be a polymorphic class so required a virtual table for
3662         it. It's cleaner to not have either of those.
3663
3664 2007-03-18  Maciej Stachowiak  <mjs@apple.com>
3665
3666         Reviewed by Mark.
3667         
3668         - avoid static construction (and global variable access) in a smarter, more portable way,
3669         to later enable MUTLI_THREAD mode to work on other platforms and compilers.
3670         
3671         * kjs/CommonIdentifiers.cpp: Added. New class to hold all the shared identifiers.
3672         (KJS::CommonIdentifiers::CommonIdentifiers):
3673         (KJS::CommonIdentifiers::shared):
3674         * kjs/CommonIdentifiers.h: Added.
3675
3676         * kjs/ExecState.h:
3677         (KJS::ExecState::propertyNames): Hand the CommonIdentifiers instance here for easy access.
3678         (KJS::ExecState::ExecState):
3679
3680         * API/JSObjectRef.cpp:
3681         (JSObjectMakeConstructor):
3682         * CMakeLists.txt:
3683         * JavaScriptCore.exp:
3684         * JavaScriptCore.pri:
3685         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3686         * JavaScriptCore.xcodeproj/project.pbxproj:
3687         * JavaScriptCoreSources.bkl:
3688         * bindings/runtime_array.cpp:
3689         (RuntimeArray::getOwnPropertySlot):
3690         (RuntimeArray::put):
3691         * bindings/runtime_method.cpp:
3692         (RuntimeMethod::getOwnPropertySlot):
3693         * kjs/array_object.cpp:
3694         (ArrayInstance::getOwnPropertySlot):
3695         (ArrayInstance::put):
3696         (ArrayInstance::deleteProperty):
3697         (ArrayProtoFunc::ArrayProtoFunc):
3698         (ArrayProtoFunc::callAsFunction):
3699         (ArrayObjectImp::ArrayObjectImp):
3700         * kjs/bool_object.cpp:
3701         (BooleanPrototype::BooleanPrototype):
3702         (BooleanProtoFunc::BooleanProtoFunc):
3703         (BooleanProtoFunc::callAsFunction):
3704         (BooleanObjectImp::BooleanObjectImp):
3705         * kjs/completion.h:
3706         (KJS::Completion::Completion):
3707         * kjs/date_object.cpp:
3708         (KJS::DateProtoFunc::DateProtoFunc):
3709         (KJS::DateObjectImp::DateObjectImp):
3710         (KJS::DateObjectFuncImp::DateObjectFuncImp):
3711         * kjs/error_object.cpp:
3712         (ErrorPrototype::ErrorPrototype):
3713         (ErrorProtoFunc::ErrorProtoFunc):
3714         (ErrorProtoFunc::callAsFunction):
3715         (ErrorObjectImp::ErrorObjectImp):
3716         (ErrorObjectImp::construct):
3717         (NativeErrorPrototype::NativeErrorPrototype):
3718         (NativeErrorImp::NativeErrorImp):
3719         (NativeErrorImp::construct):
3720         (NativeErrorImp::callAsFunction):
3721         * kjs/function.cpp:
3722         (KJS::FunctionImp::getOwnPropertySlot):
3723         (KJS::FunctionImp::put):
3724         (KJS::FunctionImp::deleteProperty):
3725         (KJS::FunctionImp::getParameterName):
3726         (KJS::DeclaredFunctionImp::construct):
3727         (KJS::IndexToNameMap::unMap):
3728         (KJS::Arguments::Arguments):
3729         (KJS::ActivationImp::getOwnPropertySlot):
3730         (KJS::ActivationImp::deleteProperty):
3731         (KJS::GlobalFuncImp::GlobalFuncImp):
3732         * kjs/function_object.cpp:
3733         (FunctionPrototype::FunctionPrototype):
3734         (FunctionProtoFunc::FunctionProtoFunc):
3735         (FunctionProtoFunc::callAsFunction):
3736         (FunctionObjectImp::FunctionObjectImp):
3737         (FunctionObjectImp::construct):
3738         * kjs/grammar.y:
3739         * kjs/identifier.cpp:
3740         * kjs/identifier.h:
3741         * kjs/interpreter.cpp:
3742         (KJS::Interpreter::init):
3743         (KJS::Interpreter::initGlobalObject):
3744         * kjs/interpreter.h:
3745         * kjs/lookup.h:
3746         * kjs/math_object.cpp:
3747         (MathFuncImp::MathFuncImp):
3748         * kjs/nodes.cpp:
3749         (ArrayNode::evaluate):
3750         (FuncDeclNode::processFuncDecl):
3751         (FuncExprNode::evaluate):
3752         * kjs/number_object.cpp:
3753         (NumberPrototype::NumberPrototype):
3754         (NumberProtoFunc::NumberProtoFunc):
3755         (NumberObjectImp::NumberObjectImp):
3756         * kjs/object.cpp:
3757         (KJS::JSObject::put):
3758         (KJS::JSObject::defaultValue):
3759         (KJS::JSObject::hasInstance):
3760         * kjs/object.h:
3761         (KJS::JSObject::getOwnPropertySlot):
3762         * kjs/object_object.cpp:
3763         (ObjectPrototype::ObjectPrototype):
3764         (ObjectProtoFunc::ObjectProtoFunc):
3765         (ObjectObjectImp::ObjectObjectImp):
3766         * kjs/regexp_object.cpp:
3767         (RegExpPrototype::RegExpPrototype):
3768         (RegExpProtoFunc::RegExpProtoFunc):
3769         (RegExpObjectImp::RegExpObjectImp):
3770         * kjs/string_object.cpp:
3771         (KJS::StringInstance::getOwnPropertySlot):
3772         (KJS::StringInstance::put):
3773         (KJS::StringInstance::deleteProperty):
3774         (KJS::StringPrototype::StringPrototype):
3775         (KJS::StringProtoFunc::StringProtoFunc):
3776         (KJS::StringProtoFunc::callAsFunction):
3777         (KJS::StringObjectImp::StringObjectImp):
3778         (KJS::StringObjectFuncImp::StringObjectFuncImp):
3779         * kjs/testkjs.cpp:
3780         (TestFunctionImp::TestFunctionImp):
3781
3782 2007-03-18  Andrew Wellington  <proton@wiretapped.net>
3783
3784         Reviewed by Mark Rowe
3785         
3786         Set Xcode editor to use 4 space indentation (http://webkit.org/coding/coding-style.html) 
3787
3788         * JavaScriptCore.xcodeproj/project.pbxproj:
3789
3790 2007-03-19  Mark Rowe  <mrowe@apple.com>
3791
3792         Rubber-stamped by Brady.
3793
3794         Update references to bugzilla.opendarwin.org with bugs.webkit.org.
3795
3796         * bindings/c/c_utility.cpp:
3797         (KJS::Bindings::convertUTF8ToUTF16):
3798         * kjs/function.cpp:
3799         (KJS::FunctionImp::callAsFunction):
3800         * kjs/grammar.y:
3801         * kjs/keywords.table:
3802         * kjs/lexer.cpp:
3803         (KJS::Lexer::shift):
3804
3805 2007-03-18  Geoffrey Garen  <ggaren@apple.com>
3806
3807         Reviewed by Oliver Hunt.
3808         
3809         Exposed some extra toUInt32 functionality, as part of the fix for
3810         REGRESSION: Incomplete document.all implementation breaks abtelectronics.com 
3811         (Style Change Through JavaScript Blanks Content)
3812
3813         * JavaScriptCore.exp:
3814         * kjs/identifier.h:
3815         (KJS::Identifier::toUInt32):
3816
3817 2007-03-18  Geoffrey Garen  <ggaren@apple.com>
3818
3819         Removed duplicate export name.
3820         
3821         * JavaScriptCore.exp:
3822
3823 2007-03-15  Geoffrey Garen  <ggaren@apple.com>
3824
3825         Reviewed by Maciej Stachowiak.
3826         
3827         Fixed <rdar://problem/5064964> Repro ASSERT failure in JS Bindings when 
3828         closing window @ lowtrades.bptrade.com
3829         
3830         Unfortunately, the bindings depend on UString and Identifier as string 
3831         representations. So, they need to acquire the JSLock when doing something
3832         that will ref/deref their strings.
3833
3834         Layout tests, the original site, and Java, Flash, and Quicktime on the 
3835         web work. No leaks reported. No automated test for this because testing 
3836         the Java bindings, like math, is hard.
3837         
3838         * bindings/runtime.h: Made Noncopyable, just to be sure.
3839         
3840         * bindings/c/c_class.cpp: 
3841         (KJS::Bindings::CClass::~CClass): Acquire the JSLock and explicitly clear the keys
3842         in our hashtable, since they're UString::Reps, and ref/deref aren't thread-safe.
3843         (KJS::Bindings::CClass::methodsNamed): Also acquire the JSLock when adding
3844         keys to the table, since the table ref's them.
3845         (KJS::Bindings::CClass::fieldNamed): ditto.
3846
3847         * bindings/c/c_utility.cpp: Removed dead function.
3848         (KJS::Bindings::convertValueToNPVariant): Acquire the JSLock because doing
3849         it recursively is pretty cheap, and it's just too confusing to tell whether
3850         all our callers do it for us.
3851         (KJS::Bindings::convertNPVariantToValue): ditto
3852         * bindings/c/c_utility.h:
3853
3854         * bindings/jni/jni_class.cpp: Same deal as c_class.cpp.
3855         (JavaClass::JavaClass):
3856         (JavaClass::~JavaClass):
3857
3858         * bindings/jni/jni_instance.cpp: Same deal as c_utility.cpp.
3859         (JavaInstance::stringValue):
3860         * bindings/jni/jni_jsobject.cpp:
3861         (JavaJSObject::convertValueToJObject):
3862
3863         * bindings/jni/jni_runtime.cpp:
3864         (JavaMethod::~JavaMethod): Moved from header, for clarity.
3865         (appendClassName): Made this static, so the set of callers is known, and
3866         we can assert that we hold the JSLock. Also changed it to take a UString
3867         reference, which makes the calling code simpler.
3868         (JavaMethod::signature): Store the ASCII value we care about instead of
3869         a UString, since UString is so much more hassle. Hold the JSLock while
3870         building up the temporary UString.
3871
3872         * bindings/jni/jni_runtime.h: Nixed dead code in JavaMethod.
3873         (KJS::Bindings::JavaString::JavaString): Hold a UString::Rep instead of
3874         a UString, so we can acquire the JSLock and explicitly release it.
3875         (KJS::Bindings::JavaString::_commonInit):
3876         (KJS::Bindings::JavaString::~JavaString):
3877         (KJS::Bindings::JavaString::UTF8String):
3878         (KJS::Bindings::JavaString::uchars):
3879         (KJS::Bindings::JavaString::length):
3880         (KJS::Bindings::JavaString::ustring):
3881
3882         * bindings/jni/jni_utility.cpp:
3883         (KJS::Bindings::convertArrayInstanceToJavaArray): Made this static, so 
3884         the set of callers is known, and we can assert that we hold the JSLock. 
3885         (KJS::Bindings::convertValueToJValue): Acquire the JSLock because doing
3886         it recursively is pretty cheap, and it's just too confusing to tell whether
3887         all our callers do it for us.
3888
3889         * bindings/objc/objc_runtime.h: Nixed some dead code.
3890         * bindings/objc/objc_utility.mm:
3891         (KJS::Bindings::convertNSStringToString): Same drill as above.
3892
3893 2007-03-18  Alexey Proskuryakov  <ap@webkit.org>
3894
3895         Reviewed by Geoff.
3896
3897         http://bugs.webkit.org/show_bug.cgi?id=13105
3898         REGRESSION: an exception raised when calculating base value of a dot expression is not returned
3899
3900         Test: fast/js/dot-node-base-exception.html
3901
3902         * kjs/nodes.cpp:
3903         (FunctionCallDotNode::evaluate): Added the necessary KJS_CHECKEXCEPTIONVALUE.
3904
3905 2007-03-18  Steve Falkenburg  <sfalken@apple.com>
3906
3907         Build fix.
3908
3909         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
3910
3911 2007-03-17  Timothy Hatcher  <timothy@apple.com>
3912
3913         Reviewed by Mark Rowe.
3914
3915         Made Version.xcconfig smarter when building for different configurations.
3916         Now uses the 522+ OpenSource version for Debug and Release, while using the
3917         full 522.4 version for Production builds. The system prefix is also computed
3918         based on the current system, so 4522.4 on Tiger and 5522.4 on Leopard.
3919
3920         * Configurations/JavaScriptCore.xcconfig:
3921         * Configurations/Version.xcconfig:
3922
3923 2007-03-15  Maciej Stachowiak  <mjs@apple.com>
3924
3925         Not reviewed.
3926         
3927         - build fix
3928
3929         * wtf/TCSystemAlloc.cpp:
3930
3931 2007-03-15  Maciej Stachowiak  <mjs@apple.com>
3932
3933         Reviewed by Geoff and Steve.
3934         
3935         - fix some portability issues with TCMalloc.
3936
3937         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
3938         * kjs/config.h:
3939         * wtf/FastMalloc.cpp:
3940         (WTF::SizeClass):
3941         (WTF::InitSizeClasses):
3942         (WTF::TCMalloc_PageHeap::Split):
3943         (WTF::TCMalloc_PageHeap::RegisterSizeClass):
3944         (WTF::TCMalloc_Central_FreeList::length):
3945         (WTF::TCMalloc_ThreadCache::InitTSD):
3946         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
3947         * wtf/TCSpinLock.h:
3948         * wtf/TCSystemAlloc.cpp:
3949         (TryVirtualAlloc):
3950         (TCMalloc_SystemAlloc):
3951
3952 2007-03-15  Timothy Hatcher  <timothy@apple.com>
3953
3954         Reviewed by John.
3955
3956         * Factored out most of our common build settings into .xcconfig files. Anything that was common in
3957           each build configuration was factored out into the shared .xcconfig file.
3958         * Adds a Version.xcconfig file to define the current framework version, to be used in other places.
3959         * Use the new $(BUNDLE_VERSION) (defined in Version.xcconfig) in the preprocessed Info.plist.
3960         * Use the versions defined in Version.xcconfig to set $(DYLIB_CURRENT_VERSION).
3961
3962         * Configurations/Base.xcconfig: Added.
3963         * Configurations/DebugRelease.xcconfig: Added.
3964         * Configurations/JavaScriptCore.xcconfig: Added.
3965         * Configurations/Version.xcconfig: Added.
3966         * Info.plist:
3967         * JavaScriptCore.xcodeproj/project.pbxproj:
3968
3969 2007-03-16  Shrikant Gangoda  <shrikant.gangoda@celunite.com>
3970
3971         Gdk build fix.
3972
3973         * kjs/DateMath.cpp:  gettimeofday comes from <sys/time.h> on Linux.
3974
3975 2007-03-14  Kevin McCullough  <kmccullough@apple.com>
3976
3977         Reviewed by .
3978
3979         - Fixed one more build breakage
3980
3981         * kjs/date_object.cpp:
3982         (KJS::formatLocaleDate):
3983
3984 2007-03-14  Kevin McCullough  <kmccullough@apple.com>
3985
3986         Reviewed by .
3987
3988         - Fixed a build breakage.
3989
3990         * kjs/DateMath.cpp:
3991         * kjs/date_object.cpp:
3992         (KJS::formatLocaleDate):
3993         (KJS::DateObjectImp::construct):
3994
3995 2007-03-14  Kevin McCullough  <kmccullough@apple.com>
3996
3997         Reviewed by Geoff.
3998
3999         - rdar://problem/5045720
4000         - DST changes in US affect JavaScript date calculations (12975)
4001         This fix was to ensure we properly test for the new changes to DST in the US.
4002         Also this fixes when we apply DST, now we correctly map most past years to current
4003         DST rules.  We still have a small issue with years before 1900 or after 2100.
4004         rdar://problem/5055038
4005
4006         * kjs/DateMath.cpp: Fix DST to match spec better.
4007         (KJS::getCurrentUTCTime):
4008         (KJS::mimimumYearForDST):
4009         (KJS::maximumYearForDST):
4010         (KJS::equivalentYearForDST):
4011         (KJS::getDSTOffset):
4012         * kjs/DateMath.h: Consolodated common funtionality.
4013         * kjs/date_object.cpp: Consolodated common functionality.
4014         (KJS::formatLocaleDate):
4015         (KJS::DateObjectImp::construct):
4016         * tests/mozilla/ecma/jsref.js: Added functions for finding the correct days when DST starts and ends.
4017         * tests/mozilla/ecma/shell.js: Added back in the old DST functions for ease of merging with mozilla if needed.
4018         * tests/mozilla/ecma_2/jsref.js: Added functions for finding the correct days when DST starts and ends.
4019         * tests/mozilla/ecma_3/Date/shell.js: Added functions for finding the correct days when DST starts and ends.
4020         * tests/mozilla/expected.html: Updated to show all date tests passing.
4021
4022 === Safari-5522.4 ===
4023
4024 2007-03-13  Kevin McCullough  <kmccullough@apple.com>
4025
4026         Reviewed by .
4027
4028         - Adding expected failures until the are truly fixed. 
4029         - rdar://problem/5060302
4030
4031         * tests/mozilla/expected.html:
4032
4033 2007-03-12  Kevin McCullough  <kmccullough@apple.com>
4034
4035         Reviewed by .
4036
4037         - Actually update tests for new DST rules.
4038
4039         * tests/mozilla/ecma/Date/15.9.3.1-1.js:
4040         * tests/mozilla/ecma/Date/15.9.3.1-2.js:
4041         * tests/mozilla/ecma/Date/15.9.3.1-3.js:
4042         * tests/mozilla/ecma/Date/15.9.3.1-4.js:
4043         * tests/mozilla/ecma/Date/15.9.3.1-5.js:
4044         * tests/mozilla/ecma/Date/15.9.3.2-1.js:
4045         * tests/mozilla/ecma/Date/15.9.3.2-2.js:
4046         * tests/mozilla/ecma/Date/15.9.3.2-3.js:
4047         * tests/mozilla/ecma/Date/15.9.3.2-4.js:
4048         * tests/mozilla/ecma/Date/15.9.3.2-5.js:
4049         * tests/mozilla/ecma/Date/15.9.3.8-1.js:
4050         * tests/mozilla/ecma/Date/15.9.3.8-2.js:
4051         * tests/mozilla/ecma/Date/15.9.3.8-3.js:
4052         * tests/mozilla/ecma/Date/15.9.3.8-4.js:
4053         * tests/mozilla/ecma/Date/15.9.3.8-5.js:
4054         * tests/mozilla/ecma/Date/15.9.5.10-1.js:
4055         * tests/mozilla/ecma/Date/15.9.5.10-10.js:
4056         * tests/mozilla/ecma/Date/15.9.5.10-11.js:
4057         * tests/mozilla/ecma/Date/15.9.5.10-12.js:
4058         * tests/mozilla/ecma/Date/15.9.5.10-13.js:
4059         * tests/mozilla/ecma/Date/15.9.5.10-2.js:
4060         * tests/mozilla/ecma/Date/15.9.5.10-3.js:
4061         * tests/mozilla/ecma/Date/15.9.5.10-4.js:
4062         * tests/mozilla/ecma/Date/15.9.5.10-5.js:
4063         * tests/mozilla/ecma/Date/15.9.5.10-6.js:
4064         * tests/mozilla/ecma/Date/15.9.5.10-7.js:
4065         * tests/mozilla/ecma/Date/15.9.5.10-8.js:
4066         * tests/mozilla/ecma/Date/15.9.5.10-9.js:
4067         * tests/mozilla/ecma/jsref.js:
4068         * tests/mozilla/ecma_2/jsref.js:
4069         * tests/mozilla/ecma_3/Date/shell.js:
4070
4071 2007-03-12  Kevin McCullough  <kmccullough@apple.com>
4072
4073         Reviewed by .
4074
4075         - Update tests for new DST rules.
4076
4077         * tests/mozilla/ecma/shell.js:
4078
4079 2007-03-11  Geoffrey Garen  <ggaren@apple.com>
4080
4081         Reviewed by Oliver Hunt.
4082         
4083         Fixed <rdar://problem/4681051> Installer crashes in KJS::Collector::
4084         markOtherThreadConservatively(KJS::Collector::Thread*) trying to install 
4085         iLife 06 using Rosetta on an Intel Machine
4086         
4087         The problem was that our thread-specific data destructor would modify the
4088         list of active JavaScript threads without holding the JSLock, corrupting
4089         the list. Corruption was especially likely if one JavaScript thread exited 
4090         while another was starting up.
4091
4092         * JavaScriptCore.exp:
4093         * kjs/JSLock.cpp: Don't conflate locking the JSLock with registering a
4094         thread, since the thread-specific data destructor needs to lock
4095         without registering a thread. Instead, treat thread registration as a
4096         part of the convenience of the JSLock object, and whittle down JSLock::lock()
4097         to just the bits that actually do the locking.
4098         (KJS::JSLock::lock):
4099         (KJS::JSLock::registerThread):
4100         * kjs/JSLock.h: Updated comments to mention the new behavior above, and
4101         other recent changes.
4102         (KJS::JSLock::JSLock):
4103         * kjs/collector.cpp:
4104         (KJS::destroyRegisteredThread): Lock here.
4105         (KJS::Collector::registerThread): To match, assert that we're locked here.
4106
4107 2007-03-10  Geoffrey Garen  <ggaren@apple.com>
4108
4109         Reviewed by Darin Adler.
4110
4111         Fixed <rdar://problem/4587763> PAC file: lock inversion between QT and 
4112         JSCore causes a hang @ www.panoramas.dk
4113         
4114         With a PAC file, run-webkit-tests --threaded passes, the reported site
4115         works, and all the Quicktime/JavaScript and Flash/JavaScript examples
4116         I found through Google work, too.
4117         
4118         Any time JavaScript causes arbitrary non-JavaScript code to execute, it 
4119         risks deadlock, because that code may block, trying to acquire a lock 
4120         owned by a thread that is waiting to execute JavaScript. In this case,
4121         the thread was a networking thread that was waiting to interpret a PAC file.
4122         
4123         Because non-JavaScript code may execute in response to, well, anything,
4124         a perfect solution to this problem is impossible. I've implemented an
4125         optimistic solution, instead: JavaScript will drop its lock whenever it
4126         makes a direct call to non-JavaScript code through a bridging/plug-in API,
4127         but will blissfully ignore the indirect ways it may cause non-JavaScript 
4128         code to run (resizing a window, for example). 
4129         
4130         Unfortunately, this solution introduces significant locking overhead in 
4131         the bridging APIs. I don't see a way around that.
4132
4133         This patch includes some distinct bug fixes I saw along the way:
4134         
4135         * bindings/objc/objc_instance.mm: Fixed a bug where a nested begin() call
4136         would leak its autorelease pool, because it would NULL out _pool without
4137         draining it.
4138
4139         * bindings/runtime_object.cpp:
4140         (RuntimeObjectImp::methodGetter): Don't copy an Identifier to ASCII only
4141         to turn around and make an Identifier from the ASCII. In an earlier 
4142         version of this patch, the copy caused an assertion failure. Now it's 
4143         just unnecessary work.
4144         (RuntimeObjectImp::getOwnPropertySlot): ditto
4145
4146         * bindings/objc/objc_instance.h: Removed overrides of setVAlueOfField and
4147         getValueOfField, because they did exactly what the base class versions did.
4148         Removed overrides of Noncopyable declarations for the same reason.
4149
4150         * bindings/runtime.h: Inherit from Noncopyable instead of rolling our own.
4151         * bindings/c/c_instance.h: ditto
4152
4153         And the actual patch:
4154         
4155         * API/JSCallbackConstructor.cpp: Drop all locks when calling out to C.
4156         (KJS::JSCallbackConstructor::construct):
4157         * API/JSCallbackFunction.cpp: ditto
4158         (KJS::JSCallbackFunction::callAsFunction):
4159         * API/JSCallbackObject.cpp: ditto
4160         (KJS::JSCallbackObject::init):
4161         (KJS::JSCallbackObject::~JSCallbackObject):
4162         (KJS::JSCallbackObject::getOwnPropertySlot):
4163         (KJS::JSCallbackObject::put):
4164         (KJS::JSCallbackObject::deleteProperty):
4165         (KJS::JSCallbackObject::construct):
4166         (KJS::JSCallbackObject::hasInstance):
4167         (KJS::JSCallbackObject::callAsFunction):
4168         (KJS::JSCallbackObject::getPropertyNames):
4169         (KJS::JSCallbackObject::toNumber):
4170         (KJS::JSCallbackObject::toString):
4171         (KJS::JSCallbackObject::staticValueGetter):
4172         (KJS::JSCallbackObject::callbackGetter):
4173         
4174         * bindings/c/c_instance.cpp: Drop all locks when calling out to C.
4175         (KJS::Bindings::CInstance::invokeMethod):
4176         (KJS::Bindings::CInstance::invokeDefaultMethod):
4177         * bindings/c/c_runtime.cpp: Drop all locks when calling out to C.
4178         (KJS::Bindings::CField::valueFromInstance):
4179         (KJS::Bindings::CField::setValueToInstance):
4180         * bindings/jni/jni_objc.mm:
4181         (KJS::Bindings::dispatchJNICall): Drop all locks when calling out to Java.
4182
4183         * bindings/objc/objc_instance.mm: The changes here are to accomodate the
4184         fact that C++ unwinding of DropAllLocks goes crazy when you put it inside
4185         a @try block. I moved all JavaScript stuff outside of the @try blocks, and 
4186         then prefixed the whole blocks with DropAllLocks objects. This required some
4187         supporting changes in other functions, which now acquire the JSLock for
4188         themselves, intead of relying on their callers to do so.
4189         (ObjcInstance::end):
4190         (ObjcInstance::invokeMethod):
4191         (ObjcInstance::invokeDefaultMethod):
4192         (ObjcInstance::setValueOfUndefinedField):
4193         (ObjcInstance::getValueOfUndefinedField):
4194         * bindings/objc/objc_runtime.mm: Same as above, except I didn't want to
4195         change throwError to acquire the JSLock for itself.
4196         (ObjcField::valueFromInstance):
4197         (ObjcField::setValueToInstance):
4198         * bindings/objc/objc_utility.mm: Supporting changes mentioned above.
4199         (KJS::Bindings::convertValueToObjcValue):
4200         (KJS::Bindings::convertObjcValueToValue):
4201
4202         * kjs/JSLock.cpp: 
4203         (1) Fixed DropAllLocks to behave as advertised, and drop the JSLock only 
4204         if the current thread actually acquired it in the first place. This is 
4205         important because WebKit needs to ensure that the JSLock has been 
4206         dropped before it makes a plug-in call, even though it doesn't know if 
4207         the current thread actually acquired the JSLock. (We don't want WebKit
4208         to accidentally drop a lock belonging to *another thread*.)
4209         (2) Used the new per-thread code written for (1) to make recursive calls
4210         to JSLock very cheap. JSLock now knows to call pthread_mutext_lock/ 
4211         pthread_mutext_unlock only at nesting level 0.
4212         (KJS::createDidLockJSMutex):
4213         (KJS::JSLock::lock):
4214         (KJS::JSLock::unlock):
4215         (KJS::DropAllLocks::DropAllLocks):
4216         (KJS::DropAllLocks::~DropAllLocks):
4217         (KJS::JSLock::lockCount):
4218         * kjs/JSLock.h: Don't duplicate Noncopyable.
4219         (KJS::JSLock::~JSLock):
4220
4221         * wtf/Assertions.h: Blind attempt at helping the Windows build.
4222
4223 2007-03-08  Darin Fisher  <darin@chromium.org>
4224
4225         Reviewed by Darin.
4226
4227         http://bugs.webkit.org/show_bug.cgi?id=13018
4228         Bug 13018: allow embedders to override the definition of CRASH.
4229
4230         * wtf/Assertions.h: make it possible to override CRASH.
4231
4232 2007-03-07  Huan Ren  <huanr@chromium.org>
4233
4234         Reviewed by Maciej.
4235
4236         Fix http://bugs.webkit.org/show_bug.cgi?id=12535
4237         Bug 12535: Stack-optimizing compilers can trick GC into freeing in-use objects
4238
4239         * kjs/internal.cpp:
4240         (KJS::StringImp::toObject): Copy val onto the stack so it is not subject to garbage collection.
4241
4242 2007-03-07  Geoffrey Garen  <ggaren@apple.com>
4243
4244         Build fix for non-multiple-thread folks.
4245         
4246         Use a shared global in the non-multiple-thread case.
4247
4248         * wtf/FastMalloc.cpp:
4249         (WTF::isForbidden):
4250         (WTF::fastMallocForbid):
4251         (WTF::fastMallocAllow):
4252
4253 2007-03-07  Geoffrey Garen  <ggaren@apple.com>
4254
4255         Reviewed by Darin Adler.
4256         
4257         Fixed ASSERT failure I just introduced.
4258         
4259         Made the fastMalloc isForbidden flag per thread. (Oops!) We expect that
4260         other threads will malloc while we're marking -- we just want to prevent
4261         our own marking from malloc'ing.
4262
4263         * wtf/FastMalloc.cpp:
4264         (WTF::initializeIsForbiddenKey):
4265         (WTF::isForbidden):
4266         (WTF::fastMallocForbid):
4267         (WTF::fastMallocAllow):
4268         (WTF::fastMalloc):
4269         (WTF::fastCalloc):
4270         (WTF::fastFree):
4271         (WTF::fastRealloc):
4272         (WTF::do_malloc):
4273
4274 2007-03-07  Shrikant Gangoda  <shrikant.gangoda@celunite.com>
4275
4276         Reviewed by Maciej.
4277
4278         http://bugs.webkit.org/show_bug.cgi?id=12997
4279
4280         Wrap pthread-specific assertion in #if USE(MULTIPLE_THREADS).
4281
4282         * kjs/collector.cpp:
4283         (KJS::Collector::markMainThreadOnlyObjects):
4284
4285 2007-03-06  Geoffrey Garen  <ggaren@apple.com>
4286
4287         Reviewed by Maciej Stachowiak.
4288         
4289         Fixed <rdar://problem/4576242> | http://bugs.webkit.org/show_bug.cgi?id=12586
4290         PAC file: malloc deadlock sometimes causes a hang @ www.apple.com/pro/profiles/ (12586)
4291         
4292         This is a modified version of r14752 on the branch.
4293         
4294         These changes just add debugging functionality. They ASSERT that we don't 
4295         malloc during the mark phase of a garbage collection, which can cause a
4296         deadlock.
4297
4298         * kjs/collector.cpp:
4299         (KJS::Collector::collect):
4300         * wtf/FastMalloc.cpp:
4301         (WTF::fastMallocForbid):
4302         (WTF::fastMallocAllow):
4303         (WTF::fastMalloc):
4304         (WTF::fastCalloc):
4305         (WTF::fastFree):
4306         (WTF::fastRealloc):
4307         (WTF::do_malloc):
4308         * wtf/FastMalloc.h:
4309
4310 2007-03-06  Geoffrey Garen  <ggaren@apple.com>
4311
4312         Reviewed by Maciej Stachowiak.
4313         
4314         Fixed all known crashers exposed by run-webkit-tests --threaded. This covers:
4315
4316         <rdar://problem/4565394> | http://bugs.webkit.org/show_bug.cgi?id=12585 
4317             PAC file: after closing a window that contains macworld.com, new window 
4318             crashes (KJS::PropertyMap::mark()) (12585)
4319         <rdar://problem/4571215> | http://bugs.webkit.org/show_bug.cgi?id=9211
4320             PAC file: Crash occurs when clicking on the navigation tabs at http://www.businessweek.com/ (9211)
4321         <rdar://problem/4557926> 
4322             PAC file: Crash occurs when attempting to view image in slideshow mode 
4323             at http://d.smugmug.com/gallery/581716 ( KJS::IfNode::execute (KJS::
4324             ExecState*) + 312) if you use a PAC file
4325
4326         (1) Added some missing JSLocks, along with related ASSERTs.
4327         
4328         (2) Fully implemented support for objects that can only be garbage collected
4329         on the main thread. So far, only WebCore uses this. We can add it to API
4330         later if we learn that it's needed. 
4331         
4332         The implementation uses a "main thread only" flag inside each object. When 
4333         collecting on a secondary thread, the Collector does an extra pass through 
4334         the heap to mark all flagged objects before sweeping. This solution makes
4335         the common case -- flag lots of objects, but never collect on a secondary 
4336         thread -- very fast, even though the uncommon case of garbage collecting
4337         on a secondary thread isn't as fast as it could be. I left some notes 
4338         about how to speed it up, if we ever care.
4339         
4340         For posterity, here are some things I learned about GC while investigating:
4341         
4342         * Each collect must either mark or delete every heap object. "Zombie" 
4343         objects, which are neither marked nor deleted, raise these issues:
4344
4345             * On the next pass, the conservative marking algorithm might mark a 
4346             zombie, causing it to mark freed objects.
4347
4348             * The client might try to use a zombie, which would seem live because 
4349             its finalizer had not yet run.
4350
4351         * A collect on the main thread is free to delete any object. Presumably, 
4352         objects allocated on secondary threads have thread-safe finalizers.
4353
4354         * A collect on a secondary thread must not delete thread-unsafe objects.
4355
4356         * The mark function must be thread-safe.
4357         
4358         Line by line comments:
4359
4360         * API/JSObjectRef.h: Added comment specifying that the finalize callback 
4361         may run on any thread.
4362
4363         * JavaScriptCore.exp: Nothing to see here.
4364
4365         * bindings/npruntime.cpp:
4366         (_NPN_GetStringIdentifier): Added JSLock.
4367
4368         * bindings/objc/objc_instance.h:
4369         * bindings/objc/objc_instance.mm:
4370         (ObjcInstance::~ObjcInstance): Use an autorelease pool. The other callers 
4371         to CFRelease needed one, too, but they were dead code, so I removed them 
4372         instead. (This fixes a leak seen while running run-webkit-tests --threaded,
4373         although I don't think it's specifically a threading issue.) 
4374         
4375         * kjs/collector.cpp:
4376         (KJS::Collector::collectOnMainThreadOnly): New function. Tells the collector
4377         to collect a value only if it's collecting on the main thread.
4378         (KJS::Collector::markMainThreadOnlyObjects): New function. Scans the heap
4379         for "main thread only" objects and marks them.
4380
4381         * kjs/date_object.cpp: 
4382         (KJS::DateObjectImp::DateObjectImp): To make the new ASSERTs happy, allocate 
4383         our globals on the heap, avoiding a seemingly unsafe destructor call at 
4384         program exit time.
4385         * kjs/function_object.cpp:
4386         (FunctionPrototype::FunctionPrototype): ditto
4387
4388         * kjs/interpreter.cpp:
4389         (KJS::Interpreter::mark): Removed boolean parameter, which was an incomplete
4390         and arguably hackish way to implement markMainThreadOnlyObjects() inside WebCore.
4391         * kjs/interpreter.h:
4392
4393         * kjs/identifier.cpp:
4394         (KJS::identifierTable): Added some ASSERTs to check for thread safety 
4395         problems.
4396
4397         * kjs/list.cpp: Added some ASSERTs to check for thread safety problems.
4398         (KJS::allocateListImp):
4399         (KJS::List::release):
4400         (KJS::List::append):
4401         (KJS::List::empty): Make the new ASSERTs happy.
4402
4403         * kjs/object.h:
4404         (KJS::JSObject::JSObject): "m_destructorIsThreadSafe" => "m_collectOnMainThreadOnly".
4405         I removed the constructor parameter because m_collectOnMainThreadOnly,
4406         like m_marked, is a Collector bit, so only the Collector should set or get it.
4407
4408         * kjs/object_object.cpp:
4409         (ObjectPrototype::ObjectPrototype): Make the ASSERTs happy.
4410         * kjs/regexp_object.cpp:
4411         (RegExpPrototype::RegExpPrototype): ditto
4412
4413         * kjs/ustring.cpp: Added some ASSERTs to check for thread safety problems.
4414         (KJS::UCharReference::ref): 
4415         (KJS::UString::Rep::createCopying):
4416         (KJS::UString::Rep::create):
4417         (KJS::UString::Rep::destroy):
4418         (KJS::UString::null): Make the new ASSERTs happy.
4419         * kjs/ustring.h:
4420         (KJS::UString::Rep::ref): Added some ASSERTs to check for thread safety problems.
4421         (KJS::UString::Rep::deref):
4422
4423         * kjs/value.h:
4424         (KJS::JSCell::JSCell):
4425
4426 2007-03-06  Geoffrey Garen  <ggaren@apple.com>
4427
4428         Reviewed by Maciej Stachowiak.
4429         
4430         2% speedup on super accurate JS iBench.
4431
4432         (KJS::Collector::collect): Removed anti-optimization to call
4433         pthread_is_threaded_np() before calling pthread_main_np(). Almost all 
4434         apps have more than one thread, so the extra call is actually worse.
4435         Interestingly, even the single-threaded testkjs shows a speed gain
4436         from removing the pthread_is_threaded_np() short-circuit. Not sure why.
4437
4438 2007-03-04  Peter Kasting  <pkasting@google.com>
4439
4440         Reviewed by Nikolas Zimmermann.
4441
4442         - fix http://bugs.webkit.org/show_bug.cgi?id=12950
4443           Assertions.cpp should not #define macros that are already defined
4444
4445         * wtf/Assertions.cpp: Don't #define WINVER and _WIN32_WINNT if they
4446         are already defined.
4447
4448 2007-03-02  Steve Falkenburg  <sfalken@apple.com>
4449
4450         Reviewed by Anders.
4451         
4452         Add unsigned int hash traits (matches existing unsigned long version)
4453
4454         * wtf/HashTraits.h:
4455         (WTF::):
4456
4457 2007-03-02  Adam Roben  <aroben@apple.com>
4458
4459         Reviewed by Kevin M.
4460
4461         Try to fix the Qt build.
4462
4463         * kjs/DateMath.cpp:
4464         (KJS::msToGregorianDateTime): Removed unnecessary "struct" keyword.
4465         * kjs/DateMath.h: Moved forward declarations to the top of the file
4466         before they are used.
4467         * kjs/date_object.cpp:
4468         (KJS::formatLocaleDate): Changed to take a const GregorianDateTime&
4469         since GregorianDateTime is Noncopyable.
4470
4471 2007-03-02  Darin Adler  <darin@apple.com>
4472
4473         Reviewed by Kevin McCullough.
4474
4475         - fix http://bugs.webkit.org/show_bug.cgi?id=12867
4476           REGRESSION: BenchJS test 7 (dates) is 220% slower than in Safari 2.0.4
4477
4478         * kjs/DateMath.h: Marked GregorianDateTime as noncopyable, since it has a non-trivial
4479         destructor and not the correspoding copy constructor or assignment operator.
4480         Changed the GregorianDateTime constructor to use member initialization syntax.
4481         Fixed the destructor to use the array delete operator, since timeZone is an array.
4482
4483         * kjs/DateMath.cpp:
4484         (KJS::daysInYear): Changed to call isLeapYear so the rule is not repeated twice.
4485         (KJS::getUTCOffset): Added caching on PLATFORM(DARWIN), since we can rely on the
4486         notify_check function and "com.apple.system.timezone" to let us know when the
4487         offset has changed.
4488
4489 2007-02-27  Geoffrey Garen  <ggaren@apple.com>
4490
4491         Reviewed by Darin Adler.
4492         
4493         Follow-up to fixing http://bugs.webkit.org/show_bug.cgi?id=12659 | <rdar://problem/4954306>
4494         JS objects not collected after closing window @ ebay.com/maps.google.com
4495         
4496         Changed Interpreter cache of global constructors and prototypes from
4497         ProtectedPtrs to bare, marked pointers. ProtectedPtrs are inefficient,
4498         and they increase the risk of reference cycles. Also, Darin said something
4499         about ProtectedPtrs giving him warts.
4500         
4501         Also changed data members to precise types from generic JSObject*'s.
4502         
4503         Layout tests and JS tests pass.
4504
4505         * kjs/SavedBuiltins.h:
4506         * kjs/interpreter.cpp:
4507         (KJS::Interpreter::init):
4508         (KJS::Interpreter::~Interpreter):
4509         (KJS::Interpreter::initGlobalObject): Moved Identifier::init() call to
4510         constructor, for clarity.
4511         (KJS::Interpreter::mark):
4512         * kjs/interpreter.h:
4513
4514 2007-02-27  Geoffrey Garen  <ggaren@apple.com>
4515
4516         Reviewed by Maciej Stachowiak.
4517         
4518         Fixed http://bugs.webkit.org/show_bug.cgi?id=12659 | <rdar://problem/4954306>
4519         JS objects not collected after closing window @ ebay.com/maps.google.com
4520
4521         Don't GC in the Interpreter destructor. For that to work, the Interpreter
4522         would have to NULL out all of its ProtectedPtrs before calling collect(). But 
4523         we've decided that we don't want things to work that way, anyway. We want the
4524         client to be in charge of manual GC so that it can optimize cases when
4525         it will be destroying many interpreters at once
4526         (e.g., http://bugs.webkit.org/show_bug.cgi?id=12900).
4527         
4528         Also removed Interpreter::collect() because it was redundant with 
4529         Collector::collect().
4530
4531         * JavaScriptCore.exp:
4532         * kjs/interpreter.cpp:
4533         (KJS::Interpreter::~Interpreter):
4534         * kjs/testkjs.cpp:
4535         (TestFunctionImp::callAsFunction):
4536
4537 2007-02-26  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
4538
4539         Reviewed by Adam Roben.
4540
4541         Rename *_SUPPORT defines to ENABLE_*.
4542
4543         * jscore.bkl:
4544
4545 2007-02-26  Maciej Stachowiak  <mjs@apple.com>
4546
4547         Reviewed by Lars.
4548         
4549         - <rdar://problem/5021698> Disable experimental SVG features (12883)
4550
4551         * wtf/Platform.h: Add ENABLE() macro similar to HAVE() and USE(), to
4552         allow nicer handling of optional WebKit features.
4553
4554 2007-02-22  George Staikos  <staikos@kde.org>
4555
4556         Reviewed by Lars.
4557
4558         Add return values
4559
4560         * wtf/unicode/qt4/UnicodeQt4.h:
4561         (WTF::Unicode::toLower):
4562         (WTF::Unicode::toUpper):
4563
4564 2007-02-22  Oscar Cwajbaum  <public@oscarc.net>
4565
4566         Reviewed by Maciej.
4567
4568         Fix ARM-specific alignment problem in FastMalloc
4569         http://bugs.webkit.org/show_bug.cgi?id=12841
4570
4571         * wtf/FastMalloc.cpp:
4572         Modify how pageheap_memory is declared to ensure proper alignment
4573         on architectures such as ARM
4574
4575 2007-02-20  Zack Rusin  <zrusin@trolltech.com>
4576
4577         Reviewed by Lars
4578
4579         Make sure that non-void methods always return something.
4580
4581         * wtf/unicode/qt4/UnicodeQt4.h:
4582         (WTF::Unicode::toLower):
4583         (WTF::Unicode::toUpper):
4584         (WTF::Unicode::foldCase):
4585
4586 2007-02-18  Kevin Ollivier  <kevino@theolliviers.com>
4587
4588         Reviewed by Adam Roben.
4589
4590         Fix cases where MSVC-specific code was identified as Win32 platform
4591         code. (as it should be compiled for e.g. wx port when using MSVC too)
4592         
4593         * wtf/Assertions.h: 
4594         * wtf/MathExtras.h:
4595         * wtf/StringExtras.h:
4596         changed PLATFORM(WIN) sections to COMPILER(MSVC) as necessary
4597
4598 2007-02-17  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
4599
4600         Reviewed by Adam Roben.
4601
4602         Fix crashes on ARM due to different struct packing. Based on a patch
4603         by Mike Emmel.
4604         * kjs/ustring.cpp: compile-time assert to make sure sizeof(UChar) == 2
4605         * kjs/ustring.h: pack UChar struct to ensure that sizeof(UChar) == 2
4606         * wtf/Assertions.h: add COMPILE_ASSERT macro for compile-time assertions
4607
4608 2007-02-16  George Staikos  <staikos@kde.org>
4609
4610         Reviewed by Maciej.
4611
4612         Fix uninitialized variable
4613
4614         * bindings/testbindings.cpp:
4615         (myAllocate):
4616
4617 2007-02-16  Anders Carlsson  <acarlsson@apple.com>
4618
4619         Reviewed by Mitz.
4620
4621         http://bugs.webkit.org/show_bug.cgi?id=12788
4622         REGRESSION: Going back one page in history has a noticeable delay
4623         
4624         Um...if all elements in two vectors are equal, then I guess we could say that
4625         the two vectors are equal too.
4626         
4627         * wtf/Vector.h:
4628         (WTF::):
4629
4630 2007-02-14  Anders Carlsson  <acarlsson@apple.com>
4631
4632         Reviewed by Darin.
4633
4634         Add new canCompareWithMemcmp vector trait and use it to determine whether
4635         operator== can use memcmp.
4636         
4637         * wtf/Vector.h:
4638         (WTF::):
4639         (WTF::VectorTypeOperations::compare):
4640         (WTF::operator==):
4641         * wtf/VectorTraits.h:
4642         (WTF::):
4643
4644 2007-02-13  Brady Eidson  <beidson@apple.com>
4645
4646         Reviewed by Darin
4647         
4648         Tweaked vector a bit
4649
4650         * wtf/Vector.h:
4651         (WTF::operator==):
4652
4653 2007-02-13  Matt Perry  <mpcomplete@chromium.org>
4654
4655         Reviewed by Darin.
4656
4657         - fix for http://bugs.webkit.org/show_bug.cgi?id=12750
4658           Vector operator== was not defined correctly. It returned void,
4659           did not accept const Vectors, and used an int instead of size_t. 
4660
4661         * wtf/Vector.h: fixed comparison operators
4662         (WTF::operator==):
4663         (WTF::operator!=):
4664
4665 2007-02-10  David Carson  <dacarson@gmail.com>
4666
4667         Reviewed by Maciej.
4668
4669         - fix for http://bugs.webkit.org/show_bug.cgi?id=12636
4670         Corrected the generation of method signatures when the parameter
4671         is an Array. 
4672         Added support for converting a Javascript array to a Java array.
4673
4674         * bindings/jni/jni_utility.h: added new type for array, array_type
4675         * bindings/jni/jni_runtime.cpp: add support for new array type
4676         (JavaField::valueFromInstance):
4677         (JavaField::setValueToInstance):
4678         (JavaMethod::JavaMethod):
4679         (JavaMethod::signature):
4680         * bindings/jni/jni_utility.cpp: add support for new array type
4681         (KJS::Bindings::callJNIMethod):
4682         (KJS::Bindings::callJNIStaticMethod):
4683         (KJS::Bindings::callJNIMethodIDA):
4684         (KJS::Bindings::JNITypeFromClassName):
4685         (KJS::Bindings::signatureFromPrimitiveType):
4686         (KJS::Bindings::JNITypeFromPrimitiveType):
4687         (KJS::Bindings::getJNIField):
4688         (KJS::Bindings::convertArrayInstanceToJavaArray): new method
4689         converts the Javascript array to the requested Java array.
4690         (KJS::Bindings::convertValueToJValue):
4691
4692 2007-02-08  Anders Carlsson  <acarlsson@apple.com>
4693
4694         Reviewed by Geoff.
4695
4696         <rdar://problem/4930614>
4697         Safari complains about "Slow Script" if GMail is left open and machine is busy
4698         
4699         <rdar://problem/4649516>
4700         Turn off slow script dialog or crank up time that makes it come up
4701         
4702         <rdar://problem/4963589>
4703         Slow script warning is displayed after closing of PROMPT or PRINT dialog
4704         
4705         Re-do the way script timeouts are handled. No longer use a unix timer that sends signals. Instead, add a 
4706         tick count and increment it in loop bodies. If the tick count reaches a threshold, do a timeout check. If the total time executing
4707         is higher than the timeout value, (possibly) interrupt the script. The timeout checker also adjusts the threshold dynamically
4708         to prevent doing the timeout check too often.
4709          
4710         * JavaScriptCore.exp:
4711         Remove pause and resume calls.
4712         
4713         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
4714         Add winmm.lib.
4715
4716         * kjs/interpreter.cpp:
4717         (KJS::Interpreter::init):
4718         (KJS::Interpreter::~Interpreter):
4719         (KJS::Interpreter::startTimeoutCheck):
4720         (KJS::Interpreter::stopTimeoutCheck):
4721         (KJS::Interpreter::resetTimeoutCheck):
4722         (KJS::getCurrentTime):
4723         (KJS::Interpreter::checkTimeout):
4724         * kjs/interpreter.h:
4725         (KJS::Interpreter::timedOut):
4726         * kjs/nodes.cpp:
4727         (DoWhileNode::execute):
4728         (WhileNode::execute):
4729         (ForNode::execute):
4730
4731 2007-02-07  Darin Adler  <darin@apple.com>
4732
4733         * JavaScriptCore.vcproj/JavaScriptCore.sln: Reenable testkjs.
4734
4735 2007-02-07  Darin Adler  <darin@apple.com>
4736
4737         Reviewed by Geoff.
4738
4739         - another build fix; this time for sure
4740
4741         * pcre/pcre_exec.c: (match):
4742         The compiler caught an incorrect use of the othercase variable across
4743         a call to RMATCH in character repeat processing. Local variables can
4744         change in the crazy NO_RECURSE mode that we use, so we instead need
4745         the value in othercase to be in one of the special stack frame variables.
4746         Added a new stack frame variable for this purpose named repeat_othercase.
4747         Also noted a similar error in the non-UTF-16 side of the #ifdef, but
4748         didn't try to fix that one. Also removed a SUPPORT_UCP #ifdef from the
4749         PCRE_UTF16 side; that code doesn't work without the Unicde properties
4750         table, and we don't try to use it that way.
4751
4752 2007-02-06  Steve Falkenburg  <sfalken@apple.com>
4753
4754         Disable testkjs in sln until we figure out mysterious compiler warning.
4755
4756         * JavaScriptCore.vcproj/JavaScriptCore.sln:
4757
4758 2007-02-06  Steve Falkenburg  <sfalken@apple.com>
4759
4760         Build fix by ggaren
4761
4762         * pcre/pcre_exec.c:
4763         (match):
4764
4765 2007-02-06  Darin Adler  <darin@apple.com>
4766
4767         Reviewed by Geoff.
4768
4769         - fix <rdar://problem/4979089> PCRE should avoid setjmp/longjmp even when compiler
4770           is not GCC
4771
4772         Added a new code path that's slower and way uglier but doesn't rely on GCC's
4773         computed gotos.
4774
4775         * pcre/pcre_exec.c: Added a numeric parameter to the RMATCH function. It must be
4776         different at every RMATCH call site. Changed the non-GCC NO_RECURSE version of
4777         the macro to use a label incorporating the number. Changed the RRETURN macro to
4778         use a goto instead of longjmp.
4779         (match): Added a different number at each callsite, using a perl script for the
4780         first-time task. Going forward it should be easy to maintain by hand. Added a
4781         switch statement at the bottom of the function. We'll get compile time errors
4782         if we have anything in the switch statement that's never used in an RMATCH,
4783         but errors in the other direction are silent except at runtime.
4784
4785 2007-02-06  Darin Adler  <darin@apple.com>
4786
4787         Reviewed by John.
4788
4789         - fix <rdar://problem/4687840> 9A241: JavaScript RegExp 25-30x slower than on 10.4.7
4790
4791         I used Shark to figure out what to do. The test case is now 15% faster than with
4792         stock Safari. Some other regular expression cases might still be a few % slower
4793         than before, but the >10x slowdown is now completely gone.
4794
4795         1) Fix slowness caused by setjmp/longjmp by using computed goto instead.
4796
4797         Use GCC extensions - locally declared labels, labels as values, and computed goto -
4798         instead of using setjmp/longjmp to implemement non-recursive version of the regular
4799         expression system. We could probably make this even faster if we reduced the use
4800         of malloc a bit too.
4801
4802         2) Fix slowness caused by allocating heapframe objects by allocating the first
4803            16 of them from the stack.
4804
4805         3) Speed up use of malloc and free in PCRE by making it use fastMalloc and fastFree.
4806
4807         4) Speed up the test case by adding a special case to a UString function.
4808
4809         5) Made a small improvement to the innermost hottest loop of match by hoisting
4810            the conversion from int to pcre_uchar out of the loop.
4811
4812         * JavaScriptCore.xcodeproj/project.pbxproj: Compile FastMallocPCRE.cpp, and don't
4813         compile pcre_globals.c.
4814
4815         * wtf/FastMallocPCRE.cpp: Added. A copy of pcre_globals.c that uses FastMalloc.h.
4816         This is better than code that sets the PCRE allocation globals because by doing it
4817         this way there's guaranteed to be no problem with order of initialization.
4818
4819         * kjs/ustring.cpp: (KJS::UString::spliceSubstringsWithSeparators): Add a fast
4820         special case when this is called for only one subrange and no seaprators. This
4821         was happening a lot in the test case and it seems quite reasonable to optimize this.
4822
4823         * pcre/pcre_exec.c: Create a copy of the RMATCH and RRETURN macros that use goto
4824         instead of setjmp/longjmp. Change code that calls pcre_stack_malloc to first use
4825         storage on the stack inside the match function.
4826         (match): Move initialization of utf8 up a couple lines to avoid "possibly used
4827         uninitialized" warning. Use a local variable so we compare with pcre_uchar instead
4828         of with int inside the inner "find a character" loop.
4829
4830 2007-02-03  George Staikos  <staikos@kde.org>
4831
4832         Reviewed by Alexey.
4833
4834         -1 is not a valid point.  We can't handle anything > 0xffff anyway.
4835         Fixes crash on cases like eval("x");
4836
4837         * wtf/unicode/qt4/UnicodeQt4.h:
4838         (WTF::Unicode::category):
4839
4840 2007-02-02  Darin Adler  <darin@apple.com>
4841
4842         Reviewed by Anders.
4843
4844         - fix copying and assigning a ListHashSet
4845
4846         No test because the code path with bugs I am fixing is not used yet.
4847
4848         * wtf/ListHashSet.h: Tweaked ListHashSetNodeAllocator a little bit for clarity.
4849         Changed m_allocator to be an OwnPtr instead of doing an explicit delete.
4850         Fixed bug in copy constructor where we'd have an uninitialized m_allocator.
4851         Fixed bug in assignment operator where it would swap only the hash table, and
4852         not the head, tail, and allocator pointers.
4853
4854 2007-02-02  Geoffrey Garen  <ggaren@apple.com>
4855
4856         Reviewed by Maciej Stachowiak.
4857         
4858         Use WTFLog instead of fprintf for logging KJS::Node leaks.
4859
4860         * kjs/nodes.cpp:
4861         (NodeCounter::~NodeCounter): Changed count to unsigned, updated
4862         to match style guidelines.
4863
4864 2007-02-02  Maciej Stachowiak  <mjs@apple.com>
4865
4866         - not reviewed, build fix
4867
4868         * wtf/ListHashSet.h:
4869         (WTF::ListHashSetNodeAllocator::ListHashSetNodeAllocator): ummm, use union correctly
4870
4871 2007-02-01  Maciej Stachowiak  <mjs@apple.com>
4872
4873         Reviewed by Darin.
4874         
4875         - use a custom allocator for ListHashSet, to fix ~1% perf regression using it for form control
4876
4877         * wtf/ListHashSet.h:
4878         (WTF::ListHashSetNodeAllocator::ListHashSetNodeAllocator):
4879         (WTF::ListHashSetNodeAllocator::allocate):
4880         (WTF::ListHashSetNodeAllocator::deallocate):
4881         (WTF::ListHashSetNode::operator new):
4882         (WTF::ListHashSetNode::operator delete):
4883         (WTF::ListHashSetNode::destroy):
4884         (WTF::ListHashSetTranslator::translate):
4885         (WTF::::ListHashSet):
4886         (WTF::::~ListHashSet):
4887         (WTF::::add):
4888         (WTF::::unlinkAndDelete):
4889         (WTF::::deleteAllNodes):
4890
4891 2007-01-31  Maciej Stachowiak  <mjs@apple.com>
4892
4893         Reviewed by Adam.
4894         
4895         - fix sporadic crash
4896
4897         * wtf/ListHashSet.h:
4898         (WTF::::remove): remove before deleting
4899
4900 2007-01-31  Maciej Stachowiak  <mjs@apple.com>
4901
4902         Reviewed by Mark with help from Lars.
4903         
4904         - added new ListHashSet class, which combines a hashtable and a linked list to provide a set
4905         that keeps elements in inserted order
4906         
4907         This is to assist in fixing the following:
4908         <rdar://problem/4751164> REGRESSION: Safari places text on incorrect button when returning to a page via back [10541]
4909         http://bugs.webkit.org/show_bug.cgi?id=10541
4910
4911         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
4912         * JavaScriptCore.xcodeproj/project.pbxproj:
4913         * wtf/HashTable.h:
4914         (WTF::HashTable::find):
4915         (WTF::HashTable::contains):
4916         (WTF::::find):
4917         (WTF::::contains):
4918         * wtf/ListHashSet.h: Added.
4919         (WTF::ListHashSetNode::ListHashSetNode):
4920         (WTF::ListHashSetNodeHashFunctions::hash):
4921         (WTF::ListHashSetNodeHashFunctions::equal):
4922         (WTF::ListHashSetIterator::ListHashSetIterator):
4923         (WTF::ListHashSetIterator::get):
4924         (WTF::ListHashSetIterator::operator*):
4925         (WTF::ListHashSetIterator::operator->):
4926         (WTF::ListHashSetIterator::operator++):
4927         (WTF::ListHashSetIterator::operator--):
4928         (WTF::ListHashSetIterator::operator==):
4929         (WTF::ListHashSetIterator::operator!=):
4930         (WTF::ListHashSetIterator::operator const_iterator):
4931         (WTF::ListHashSetIterator::node):
4932         (WTF::ListHashSetConstIterator::ListHashSetConstIterator):
4933         (WTF::ListHashSetConstIterator::get):
4934         (WTF::ListHashSetConstIterator::operator*):
4935         (WTF::ListHashSetConstIterator::operator->):
4936         (WTF::ListHashSetConstIterator::operator++):
4937         (WTF::ListHashSetConstIterator::operator--):
4938         (WTF::ListHashSetConstIterator::operator==):
4939         (WTF::ListHashSetConstIterator::operator!=):
4940         (WTF::ListHashSetConstIterator::node):
4941         (WTF::ListHashSetTranslator::hash):
4942         (WTF::ListHashSetTranslator::equal):
4943         (WTF::ListHashSetTranslator::translate):
4944         (WTF::::ListHashSet):
4945         (WTF::::operator):
4946         (WTF::::~ListHashSet):
4947         (WTF::::size):
4948         (WTF::::capacity):
4949         (WTF::::isEmpty):
4950         (WTF::::begin):
4951         (WTF::::end):
4952         (WTF::::find):
4953         (WTF::::contains):
4954         (WTF::::add):
4955         (WTF::::remove):
4956         (WTF::::clear):
4957         (WTF::::unlinkAndDelete):
4958         (WTF::::appendNode):
4959         (WTF::::deleteAllNodes):
4960         (WTF::::makeIterator):
4961         (WTF::::makeConstIterator):
4962         (WTF::deleteAllValues):
4963
4964 2007-01-30  Darin Adler  <darin@apple.com>
4965
4966         * kjs/DateMath.cpp: Fix license header to reflect LGPL as the first license
4967         mentioned. We still mention the option of using under MPL or GPL since some
4968         of this code came from the Mozilla project with those license terms.
4969
4970 2007-01-30  Simon Hausmann  <hausmann@kde.org>
4971
4972         Reviewed by Zack.
4973
4974         Turned JavaScriptCore from a separate library into an includable
4975         project, to combine it all into libWebKitQt.
4976
4977         * JavaScriptCore.pri: Added.
4978         * JavaScriptCore.pro: Removed.
4979         * kjs/testkjs.pro:
4980
4981 2007-01-29  Geoffrey Garen  <ggaren@apple.com>
4982
4983         Reviewed by Maciej Stachowiak.
4984
4985         Fixed <rdar://problem/4485644> REGRESSION: JavaScriptCore has init routines
4986         
4987         The TCMalloc module now initializes, if needed, inside GetCache() and 
4988         fastMallocSetIsMultiThreaded(). We leverage the same synchronization 
4989         technique used for enabling / disabling the single-threaded optimization 
4990         to synchronize initialization of the library without requiring a lock 
4991         for every malloc.
4992         
4993         1,251 runs of tcmalloc_unittest, 2 runs of a custom, massively multi-threaded 
4994         tcmalloc_unittest, and my custom version of the PLT show no regressions.
4995         Super-accurate JS iBench reports a .24% regression, which is right at the
4996         limit of its error range, so I'm declaring victory.
4997
4998         * wtf/FastMalloc.cpp:
4999         (WTF::fastMallocSetIsMultiThreaded): Initialize, if needed. (InitModule()
5000         checks the "if needed" part.)
5001         (WTF::TCMalloc_ThreadCache::GetCache): Restored original TCMalloc code
5002         inside #ifdef, for posterity. Added new initialization logic.
5003         (WTF::TCMalloc_ThreadCache::InitModule): Call InitTSD(), since we don't
5004         have a static initializer to call it for us, now. This means that fastMalloc
5005         is not usable as a general libc allocator, but it never was, and if it were
5006         the general libc allocator, we wouldn't be here in the first place, so whatever.
5007         (WTF::TCMalloc_ThreadCache::InitTSD): Don't try to take the pageheap_lock, 
5008         since InitModule already has it.
5009
5010 2007-01-29  Kevin McCullough  <KMcCullough@apple.com>
5011
5012         Reviewed by Geoff and Oliver.
5013
5014         - rdar://problem/4955561
5015         - missusing JavaScript shouldn't crash webkit.  Now it doesn't, in this case.
5016
5017         * bindings/objc/objc_runtime.mm:
5018         (ObjcFallbackObjectImp::callAsFunction):
5019         * bindings/runtime_method.cpp:
5020         (RuntimeMethod::callAsFunction):
5021         * bindings/runtime_object.cpp:
5022         (RuntimeObjectImp::callAsFunction):
5023
5024 2007-01-28  Geoffrey Garen  <ggaren@apple.com>
5025
5026         Reviewed by Maciej Stachowiak.
5027         
5028         First step in fixing <rdar://problem/4485644> REGRESSION: JavaScriptCore 
5029         has init routines
5030         
5031         Don't rely on a static initializer to store the main thread's ID (which
5032         we would use to detect allocations on secondary threads). Instead, require 
5033         the caller to notify fastMalloc if it might allocate on a secondary thread.
5034         
5035         Also fixed what seemed like a race condition in do_malloc.
5036         
5037         tcmalloc_unittest and my custom versions of JS iBench and PLT show no
5038         regressions.
5039
5040         * wtf/FastMalloc.cpp:
5041         (WTF::fastMallocSetIsMultiThreaded): 
5042         (1) Renamed from "fastMallocRegisterThread", which was a misleading name because 
5043         not all threads need to register with fastMalloc -- only secondary threads 
5044         need to, and only for the purpose of disabling its single-threaded optimization. 
5045
5046         (2) Use the pageheap_lock instead of a custom one, since we need to synchronize
5047         with the read of isMultiThreaded inside CreateCacheIfNecessary. This is a new
5048         requirement, now that we can't guarantee that the first call to CreateCacheIfNecessary
5049         will occur on the main thread at init time, before any other threads have been created.
5050
5051         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
5052         (WTF::do_malloc): Reverted WTF change only to call GetCache() if size <= kMaxSize.
5053         The WTF code would read phinited without holding the pageheap_lock, which
5054         seemed like a race condition. Regardless, calling GetCache reduces the number 
5055         of code paths to module initialization, which will help in writing the 
5056         final fix for this bug.
5057
5058 2007-01-28  David Kilzer  <ddkilzer@webkit.org>
5059
5060         Reviewed by Darin.
5061
5062         - fix http://bugs.webkit.org/show_bug.cgi?id=9815
5063           JavaScript TypeError loading Dean Edwards' JS compressor/obfuscator
5064
5065         Creating a function using 'new Function()' was not setting its prototype with the
5066         same flags as 'function() { }'.
5067
5068         Test: fast/js/function-prototype.html
5069
5070         * kjs/function_object.cpp:
5071         (FunctionObjectImp::construct): Change flags from DontEnum|DontDelete|ReadOnly to
5072         Internal|DontDelete to match FuncDeclNode::processFuncDecl() and
5073         FuncExprNode::evaluate() in kjs/nodes.cpp.
5074
5075 2007-01-27  Geoffrey Garen  <ggaren@apple.com>
5076
5077         Reviewed by Beth Dakin.
5078         
5079         Added some missing JSLocks, which might fix <rdar://problem/4889707>.
5080
5081         We need to lock whenever we might allocate memory because our FastMalloc
5082         implementation requires clients to register their threads, which we do
5083         through JSLock. 
5084         
5085         We also need to lock whenever modifying ref-counts because they're not 
5086         thread-safe.
5087
5088         * API/JSObjectRef.cpp:
5089         (JSClassCreate): Allocates memory
5090         (JSClassRetain): Modifies a ref-count
5091         (JSClassRelease): Modifies a ref-count
5092         (JSPropertyNameArrayRetain): Modifies a ref-count
5093         (JSPropertyNameArrayRelease): Modifies a ref-count
5094         * API/JSStringRef.cpp:
5095         (JSStringRetain): Modifies a ref-count
5096         * API/JSValueRef.cpp:
5097         (JSValueIsInstanceOfConstructor): Might allocate memory if an exception
5098         is thrown.
5099
5100 2007-01-27  Lars Knoll <lars@trolltech.com>
5101
5102         Fix the Qt build.
5103
5104         * bindings/qt/qt_instance.h:
5105
5106 2007-01-25  Geoffrey Garen  <ggaren@apple.com>
5107
5108         Reviewed by Maciej Stachowiak.
5109         
5110         Fixed <rdar://problem/4608404> WebScriptObject's _rootObject lack 
5111         of ownership policy causes crashes (e.g., in Dashcode)
5112         
5113         The old model for RootObject ownership was either to (1) leak them or (2) assign
5114         them to a single owner -- the WebCore::Frame -- which would destroy them 
5115         when it believed that all of its plug-ins had unloaded.
5116         
5117         This model was broken because of (1) and also because plug-ins are not the only 
5118         RootObject clients. All Bindings clients are RootObjects clients, including 
5119         applications, which outlive any particular WebCore::Frame.
5120         
5121         The new model for RootObject ownership is to reference-count them, with a
5122         throw-back to the old model: The WebCore::Frame tracks the RootObjects
5123         it creates, and invalidates them when it believes that all of its plug-ins 
5124         have unloaded.
5125         
5126         We maintain this throw-back to avoid plug-in leaks, particularly from Java.
5127         Java is completely broken when it comes to releasing JavaScript objects. 
5128         Comments in our code allege that Java does not always call finalize when 
5129         collecting objects. Moreoever, my own testing reveals that, when Java does 
5130         notify JavaScript of a finalize, the data it provides is totally bogus.
5131         
5132         This setup is far from ideal, but I don't think we can do better without
5133         completely rewriting the bindings code, and possibly part of the Java
5134         plug-in / VM.
5135         
5136         Layout tests pass. No additional leaks reported. WebCore/manual-tests/*liveconnect*
5137         and a few LiveConnect demos on the web also run without a hitch.
5138         
5139         const RootObject* => RootObject*, since we need to ref/deref
5140         
5141         * bindings/NP_jsobject.cpp:
5142         (jsDeallocate): deref our RootObjects. Also unprotect or JSObject, instead
5143         of just relying on the RootObject to do it for us when it's invalidated.
5144         (_isSafeScript): Check RootObject validity.
5145         (_NPN_CreateScriptObject): ditto
5146         (_NPN_Invoke): ditto
5147         (_NPN_Evaluate): ditto
5148         (_NPN_GetProperty): ditto
5149         (_NPN_SetProperty): ditto
5150         (_NPN_RemoveProperty): ditto
5151         (_NPN_HasProperty): ditto
5152         (_NPN_HasMethod): ditto
5153         (_NPN_SetException): ditto
5154
5155         * bindings/runtime_root.cpp: 
5156         Revived bit-rotted LIAR LIAR LIAR comment.
5157         
5158         LOOK: Added support for invalidating RootObjects without deleting them, 
5159         which is the main goal of this patch. 
5160
5161         Moved protect counting into the RootObject class, to emphasize that 
5162         the RootObject protects the JSObject, and unprotects it upon being invalidated.
5163             addNativeReference => RootObject::gcProtect
5164             removeNativeReference => RootObject::gcUnprotect
5165             ProtectCountSet::contains => RootObject::gcIsProtected
5166             
5167         I know we'll all be sad to see the word "native" go.
5168         
5169         * bindings/runtime_root.h: Added ref-counting support to RootObject, with
5170         all the standard accoutrements.
5171
5172         * bindings/c/c_utility.cpp:
5173         (KJS::Bindings::convertValueToNPVariant): If we can't find a valid RootObject,
5174         return void instead of just leaking.
5175
5176         * bindings/jni/jni_instance.cpp:
5177         (JavaInstance::JavaInstance): Don't take a RootObject in our constructor;
5178         be like other Instances and require the caller to call setRootObject. This
5179         reduces the number of ownership code paths.
5180         (JavaInstance::invokeMethod): Check RootObject for validity.
5181         * bindings/jni/jni_instance.h: Removed private no-arg constructor. Having
5182         an arg constructor accomplishes the same thing.
5183
5184         * bindings/jni/jni_jsobject.cpp:
5185         (JavaJSObject::invoke): No need to call findProtectCountSet, because finalize()
5186         checks for RootObject validity.
5187         (JavaJSObject::JavaJSObject): check RootObject for validity
5188         (JavaJSObject::call): ditto
5189         (JavaJSObject::eval): ditto
5190         (JavaJSObject::getMember): ditto
5191         (JavaJSObject::setMember): ditto
5192         (JavaJSObject::removeMember): ditto
5193         (JavaJSObject::getSlot): ditto
5194         (JavaJSObject::setSlot): ditto
5195         (JavaJSObject::toString): ditto
5196         (JavaJSObject::finalize): ditto
5197         (JavaJSObject::createNative): No need to tell the RootObject to protect 
5198         the global object, since the RootObject already owns the interpreter.
5199
5200         * bindings/jni/jni_runtime.cpp:
5201         (JavaArray::JavaArray): Removed copy construcutor becaue it was unused.
5202         Dead code is dangerous code.
5203
5204         * bindings/objc/objc_runtime.mm: Added WebUndefined protocol. Previous use
5205         of WebScriptObject was bogus, because WebUndefined is not a subclass of
5206         WebScriptObject.
5207         (convertValueToObjcObject): If we can't find a valid RootObject,
5208         return nil instead of just leaking.
5209
5210         * bindings/objc/objc_utility.mm:
5211         (KJS::Bindings::convertValueToObjcValue): If we can't find a valid RootObject,
5212         return nil instead of just leaking.
5213
5214 2007-01-27  Andrew Wellington  <proton@wiretapped.net>
5215
5216         Reviewed by Maciej.
5217         
5218         Fix for Repeated string concatenation results in OOM crash
5219         http://bugs.webkit.org/show_bug.cgi?id=11131
5220
5221         * kjs/operations.cpp:
5222         (KJS::add): Throw exception if string addition result is null
5223         * kjs/ustring.cpp:
5224         (KJS::UString::UString): Don't call memcpy when malloc failed
5225
5226 2007-01-25  Jan Kraemer  <camel@gmx.de>
5227
5228         Reviewed by Maciej
5229
5230         Fix for http://bugs.webkit.org/show_bug.cgi?id=12382
5231
5232         Fix crash on architectures with 32 bit ints and
5233         64 bit longs (For example Linux on AMD64)
5234
5235         * kjs/dtoa.cpp: #define Long int as suggested in comment
5236
5237 2007-01-24  Geoffrey Garen  <ggaren@apple.com>
5238
5239         Fixed up #include order for style. No review necessary.
5240
5241         * API/JSStringRef.cpp:
5242
5243 2007-01-24  Geoffrey Garen  <ggaren@apple.com>
5244
5245         Reviewed by Maciej Stachowiak.
5246
5247         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
5248         Copy JSStringRefCF, in case anybody wants to use it. (I just added
5249         it recently.)
5250
5251 2007-01-24  Maciej Stachowiak  <mjs@apple.com>
5252
5253         Not reviewed, trivial property change.
5254         
5255         * JavaScriptCore.vcproj/JavaScriptCore.sln: remove svn:mime-type
5256         property which made this binary.
5257
5258 2007-01-25  Mark Rowe  <mrowe@apple.com>
5259
5260         Reviewed by Darin.
5261
5262         * Info.plist: Update copyright string.
5263
5264 2007-01-24  Darin Adler  <darin@apple.com>
5265
5266         Reviewed by Mark Rowe.
5267
5268         * JavaScriptCore.xcodeproj/project.pbxproj: Changed to /usr/sbin/sysctl
5269         so we don't rely on people's paths.
5270
5271 2007-01-23  Alice Liu  <alice.liu@apple.com>
5272
5273         release build fix
5274
5275         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
5276         Copy APICasts.h
5277
5278 2007-01-23  Geoffrey Garen  <ggaren@apple.com>
5279
5280         build fix
5281
5282         * API/JSStringRef.h:
5283         * JavaScriptCore.xcodeproj/project.pbxproj:
5284
5285 2007-01-24  Mark Rowe  <mrowe@apple.com>
5286
5287         Build fix for DumpRenderTree.
5288
5289         * JavaScriptCore.xcodeproj/project.pbxproj: Make JSStringRefCF.h public so it's copied into built framework.
5290
5291 2007-01-23  Anders Carlsson  <acarlsson@apple.com>
5292
5293         Reviewed by Darin.
5294
5295         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
5296         Copy APICasts.h
5297
5298 2007-01-23  Geoffrey Garen  <ggaren@apple.com>
5299
5300         Reviewed by Maciej Stachowiak.
5301         
5302         Fixed <rdar://problem/4885131> Move CFString function declarations from 
5303         JSStringRef.h to JSStringRefCF.h
5304         
5305         Also removed remaining API FIXMEs and changed them into Radars.
5306
5307         * API/JSClassRef.cpp:
5308         (OpaqueJSClass::OpaqueJSClass): Added Radar numbers for UTF8 conversion.
5309
5310         * API/JSContextRef.cpp:
5311         (JSGlobalContextCreate): Replaced FIXME for NULL JSContextRef with Radar number.
5312
5313         * API/JSObjectRef.h: Removed FIXME, which is unprofessional in a public header.
5314
5315         * API/JSStringRef.cpp: Moved CF related implementations to JSStringRefCF.cpp.
5316         (JSStringCreateWithUTF8CString): Replaced FIXME with Radar number.
5317         * API/JSStringRef.h: Moved CF related declarations to JSStringRefCF.h. Added
5318         #include of JSStringRefCF.h as a stopgap until clients start #including
5319         it as needed by themselves.
5320
5321         * API/JSStringRefCF.cpp: Added.
5322         (JSStringCreateWithCFString):
5323         (JSStringCopyCFString): Replaced JSChar cast with UniChar cast, which is 
5324         more appropriate for a CF call.
5325         * API/JSStringRefCF.h: Added.
5326         * JavaScriptCore.xcodeproj/project.pbxproj:
5327
5328 2007-01-18  Sanjay Madhav  <sanjay12@gmail.com>
5329
5330         Reviewed by Darin.
5331
5332         Add JavaScriptCore define to help with tracing of when objects are marked.
5333
5334         * kjs/object.cpp:
5335         (KJS::JSObject::mark):
5336
5337 2007-01-18  Simon Hausmann  <hausmann@kde.org>
5338
5339         Reviewed by Zack.
5340
5341         * JavaScriptCore.pro: Remove generated files on make clean.
5342         * pcre/pcre.pri:
5343
5344 2007-01-16  Alexey Proskuryakov  <ap@webkit.org>
5345
5346         Reviewed by Maciej.
5347
5348         http://bugs.webkit.org/show_bug.cgi?id=12268
5349         Give object prototypes their own names
5350
5351         * kjs/lookup.h: Append "Prototype" to ClassName in KJS_IMPLEMENT_PROTOTYPE.
5352
5353 2007-01-16  Geoffrey Garen  <ggaren@apple.com>
5354
5355         Reviewed by Darin Adler.
5356         
5357         Added re-entrency checking to GC allocation and collection. It is an error
5358         to allocate or collect from within a collection. We've had at least one 
5359         case of each bug in the past.
5360         
5361         Added a comment to the API header, explaining that API clients must not
5362         make this mistake, either.
5363         
5364         Layout tests and JS tests pass.
5365
5366         * API/JSObjectRef.h:
5367         * kjs/collector.cpp:
5368         (KJS::GCLock::GCLock):
5369         (KJS::GCLock::~GCLock):
5370         (KJS::Collector::allocate):
5371         (KJS::Collector::collect):
5372
5373 2007-01-14  Mark Rowe  <mrowe@apple.com>
5374
5375         Reviewed by Mitz.
5376
5377         Minor fixes to JavaScript pretty-printing.
5378
5379         * JavaScriptCore.exp:
5380         * kjs/Parser.cpp:
5381         (KJS::Parser::prettyPrint): Return line number and error message if parsing fails.
5382         * kjs/Parser.h:
5383         * kjs/nodes2string.cpp:
5384         (ElementNode::streamTo): Include comma delimiters in array literals.
5385         (PropertyNameNode::streamTo): Quote property names in object literals to handle the case when the property name is not a valid identifier.
5386         * kjs/testkjs.cpp:
5387         (doIt): Print any errors encountered while pretty-printing.
5388
5389 2007-01-12  Anders Carlsson  <acarlsson@apple.com>
5390
5391         Reviewed by Darin.
5392
5393         * wtf/HashTraits.h:
5394         Add hash traits for unsigned long and unsigned long long.
5395
5396 2007-01-12  Geoffrey Garen  <ggaren@apple.com>
5397
5398         RS by Brady Eidson.
5399         
5400         Rolling back in r18786 with leaks fixed, and these renames slightly reworked:
5401
5402         Because they can return 0:
5403         rootObjectForImp => findRootObject (overloaded for JSObject* and Interpreter*)
5404         rootObjectForInterpreter => findRootObject (ditto)
5405         findReferenceSet => findProtectCountSet
5406
5407 2007-01-11  Geoffrey Garen  <ggaren@apple.com>
5408
5409         RS by Brady Eidson.
5410         
5411         Rolling out r18786 because it caused leaks.
5412
5413 2007-01-11  Geoffrey Garen  <ggaren@apple.com>
5414
5415         Reviewed by Anders Carlsson.
5416
5417         Even more cleanup in preparation for fixing <rdar://problem/4608404> 
5418         WebScriptObject's _executionContext lack of ownership policy causes 
5419         crashes (e.g., in Dashcode)
5420         
5421         Layout tests pass.
5422         
5423         Renames:
5424             ReferencesSet | ProtectCounts => ProtectCountSet (because it's a typename for a set of GC protect counts)
5425             ReferencesByRootMap => RootObjectMap (because RootObjectToProtectCountSetMap would have been confusing)
5426             pv => protectedValues
5427             rootObjectForImp => getRootObject (overloaded for JSObject* and Interpreter*)
5428             rootObjectForInterpreter => getRootObject (ditto)
5429             findReferenceSet => getProtectCountSet
5430             imp => jsObject
5431         
5432         (KJS::Bindings::getRootObjectMap): Changed to take advantage of built-in
5433         facility for initializing static variables.
5434
5435         (KJS::Bindings::getProtectCountSet):
5436         (KJS::Bindings::destroyProtectCountSet): Added. Helps encapsulate the fact
5437         that getting a ProtectCountSet entails adding a RootObject to a hash table,
5438         and destroying one entails the reverse.
5439
5440         (KJS::Bindings::getRootObject): Removed spurious NULL check.
5441         
5442         (KJS::Bindings::findReferenceSet): Renamed. Changed to use getRootObject()
5443         instead of iterating on its own.
5444
5445         (KJS::Bindings::addNativeReference): Changed to use an early return instead
5446         of indenting the whole function.
5447         (KJS::Bindings::removeNativeReference): Ditto.
5448
5449 2007-01-11  Geoffrey Garen  <ggaren@apple.com>
5450
5451         Reviewed by Anders Carlsson.
5452
5453         Even more cleanup in preparation for fixing <rdar://problem/4608404> 
5454         WebScriptObject's _executionContext lack of ownership policy causes 
5455         crashes (e.g., in Dashcode)
5456         
5457         Layout tests pass.
5458         
5459         Renames:
5460             findRootObjectForNativeHandleFunction => createRootObject
5461             FindRootObjectForNativeHandleFunctionPtr => CreateRootObjectFunction
5462             
5463         Also removed unnecessary use of "Bindings::" prefix.
5464
5465         * JavaScriptCore.exp:
5466         * bindings/jni/jni_jsobject.cpp:
5467         (JavaJSObject::createNative):
5468         (JavaJSObject::convertValueToJObject):
5469         (JavaJSObject::convertJObjectToValue):
5470         * bindings/runtime_root.cpp:
5471         (KJS::Bindings::RootObject::setCreateRootObject):
5472         * bindings/runtime_root.h:
5473         (KJS::Bindings::RootObject::createRootObject):
5474
5475 2007-01-11  George Staikos  <staikos@kde.org>
5476
5477         Reviewed by Maciej
5478
5479         Appears to be Mac specific right now.
5480
5481         * kjs/config.h:
5482
5483 2007-01-10  Lars Knoll <lars@trolltech.com>
5484
5485         Reviewed by Zack
5486
5487         Use the new functionality in Qt 4.3, to make
5488         the methods closer compliant with the Unicode
5489         spec.
5490
5491         Keep the old code so that it still compiles against
5492         Qt 4.2.
5493
5494         * wtf/unicode/qt4/UnicodeQt4.h:
5495         (WTF::Unicode::toLower):
5496         (WTF::Unicode::toUpper):
5497         (WTF::Unicode::toTitleCase):
5498         (WTF::Unicode::foldCase):
5499         (WTF::Unicode::isFormatChar):
5500         (WTF::Unicode::isPrintableChar):
5501         (WTF::Unicode::isSeparatorSpace):
5502         (WTF::Unicode::isPunct):
5503         (WTF::Unicode::isDigit):
5504         (WTF::Unicode::isLower):
5505         (WTF::Unicode::isUpper):
5506         (WTF::Unicode::digitValue):
5507         (WTF::Unicode::mirroredChar):
5508         (WTF::Unicode::combiningClass):
5509         (WTF::Unicode::decompositionType):
5510         (WTF::Unicode::umemcasecmp):
5511         (WTF::Unicode::direction):
5512         (WTF::Unicode::category):
5513
5514 2007-01-09  Darin Adler  <darin@apple.com>
5515
5516         - update 2007 Apple copyright for the new company name
5517
5518         * kjs/DateMath.cpp:
5519
5520 2007-01-09  Darin Adler  <darin@apple.com>
5521
5522         - fix build
5523
5524         * kjs/string_object.cpp: (KJS::StringProtoFunc::callAsFunction):
5525         Actually compile it this time.
5526
5527 2007-01-09  Darin Adler  <darin@apple.com>
5528
5529         - fix build
5530
5531         * kjs/string_object.cpp: (KJS::StringProtoFunc::callAsFunction):
5532         Change types.
5533
5534 2007-01-09  Darin Adler  <darin@apple.com>
5535
5536         - fix build on platforms where Unicode::UChar is != uint16_t
5537
5538         * kjs/string_object.cpp: (KJS::StringProtoFunc::callAsFunction):
5539         Change types.
5540
5541 2007-01-09  Mitz Pettel  <mitz@webkit.org>
5542
5543         Reviewed by Darin.
5544
5545         - changes for http://bugs.webkit.org/show_bug.cgi?id=11078
5546           Forms Don't Submit (ASP Pages)
5547
5548         * JavaScriptCore.exp:
5549         * kjs/value.cpp:
5550         (KJS::JSValue::toInt32): Folded toInt32Inline into this method, which was its
5551         only caller.
5552         (KJS::JSValue::toUInt32): Added a variant that reports if the conversion has
5553         succeeded.
5554         * kjs/value.h:
5555
5556 2007-01-09  Darin Adler  <darin@apple.com>
5557
5558         Reviewed by Maciej.
5559
5560         - fix http://bugs.webkit.org/show_bug.cgi?id=12174
5561           improve Unicode use (less WTF::Unicode:: prefix, centralized character names)
5562
5563         * wtf/unicode/icu/UnicodeIcu.h: Change parameter and return types
5564         to UChar32 and UChar. Removed unneeded type casts and added some
5565         const to functions that lacked it. Removed WTF::Unicode::memcmp.
5566         (WTF::Unicode::umemcasecmp): Renamed from strcasecmp since this
5567         doesn't work on 0-terminated strings as the str functions do.
5568         * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
5569
5570         - got rid of namespace prefixes from most uses of WTF::Unicode
5571
5572         * kjs/function.cpp:
5573         (KJS::isStrWhiteSpace):
5574         (KJS::escapeStringForPrettyPrinting):
5575         * kjs/lexer.cpp:
5576         (KJS::Lexer::isWhiteSpace):
5577         (KJS::Lexer::isIdentStart):
5578         (KJS::Lexer::isIdentPart):
5579         * kjs/string_object.cpp:
5580         (KJS::StringProtoFunc::callAsFunction):
5581
5582 2007-01-07  David Kilzer  <ddkilzer@webkit.org>
5583
5584         Reviewed by Darin.
5585
5586         - fix http://bugs.webkit.org/show_bug.cgi?id=11917
5587           setlocale() can return null
5588
5589         * kjs/date_object.cpp:
5590         (KJS::DateProtoFunc::callAsFunction): Removed dead code.
5591
5592 2007-01-07  David Carson  <dacarson@gmail.com>
5593
5594         Reviewed by Darin.
5595
5596         - fix http://bugs.webkit.org/show_bug.cgi?id=12100
5597           JNI bindings should be available to non-Mac platforms that have JNI
5598
5599         Change JNI so that it is not wrapped in the PLATFORM(MAC) ifdef, enabling
5600         other platforms who have JNI to use it.
5601
5602         * bindings/jni/jni_instance.h:  
5603           Removed unnecessary include of <CoreFoundation/CoreFoundation.h>
5604         * bindings/jni/jni_utility.cpp:
5605         (KJS::Bindings::setJavaVM):
5606         * bindings/jni/jni_utility.h:
5607           Added new method for clients to set the JavaVM
5608         * bindings/runtime.cpp:
5609         (KJS::Bindings::Instance::createBindingForLanguageInstance):
5610           Changed code to utilize new #if HAVE(JNI)
5611         * kjs/config.h:
5612           Added new #define for JNI, ie HAVE_JNI
5613
5614 2007-01-07  David Carson  <dacarson@gmail.com>
5615
5616         Reviewed by Darin.
5617
5618         Fix http://bugs.webkit.org/show_bug.cgi?id=11431
5619         ARM platform has some byte alignment issues
5620
5621         Fix for NaN being 4 bytes and it must start on a byte boundary
5622         for ARM architectures.
5623
5624         * kjs/fpconst.cpp:
5625         (KJS::):
5626
5627 2007-01-04  David Kilzer  <ddkilzer@webkit.org>
5628
5629         Reviewed by Kevin McCullough.
5630
5631         - fix http://bugs.webkit.org/show_bug.cgi?id=12070
5632           REGRESSION: KJS::getUTCOffset() caches UTC offset but ignores time zone changes
5633
5634         * kjs/DateMath.cpp:
5635         (KJS::getUTCOffset): Don't cache UTC offset.
5636
5637 2007-01-02  Darin Adler  <darin@apple.com>
5638
5639         - minor tweak (hope this doesn't re-break Windows)
5640
5641         * pcre/pcre_compile.c: Removed use of const pcre_uchar const * -- Mitz probably
5642         meant const pcre_uchar *const, but I think we can do without the explicit const here.
5643
5644         * pcre/pcre_internal.h: Re-enabled warning C4114.
5645
5646 2007-01-02  David Kilzer  <ddkilzer@webkit.org>
5647
5648         Reviewed by NOBODY (Windows build fix).
5649
5650         The MSVC compiler requires variables to be declared at the top of the enclosing block in C source.
5651
5652         Disable this warning to prevent MSVC from complaining about the 'const pcre_uchar const *' type:
5653         warning C4114: same type qualifier used more than once
5654
5655         * pcre/pcre_compile.c:
5656         (pcre_compile2): Moved variable declarations to top of their respective enclosing blocks.
5657         * pcre/pcre_internal.h: Added pragma to disable compiler warning.
5658
5659 2007-01-01  Mitz Pettel  <mitz@webkit.org>
5660
5661         Reviewed by Darin.
5662
5663         - fix http://bugs.webkit.org/show_bug.cgi?id=11849
5664           REGRESSION (r18182): Google Calendar is broken (a regular expression containing a null character is not parsed correctly)
5665
5666         Modified pcre_compile() (and the functions that it calls) to work with patterns
5667         containing null characters.
5668
5669         Covered by JavaScriptCore tests ecma_3/RegExp/octal-002.js and ecma_3/RegExp/regress-85721.js
5670
5671         * kjs/regexp.cpp:
5672         (KJS::RegExp::RegExp): Changed to not null-terminate the pattern string and instead
5673         pass its length to pcre_compile.
5674         * pcre/pcre.h:
5675         * pcre/pcre_compile.c:
5676         (check_escape):
5677         (get_ucp):
5678         (is_counted_repeat):
5679         (check_posix_syntax):
5680         (compile_branch):
5681         (compile_regex):
5682         (pcre_compile): Added a parameter specifying the length of the pattern, which
5683         is no longer required to be null-terminated and may contain null characters. 
5684         (pcre_compile2):
5685         * pcre/pcre_internal.h:
5686         * tests/mozilla/expected.html: Updated for the two tests that this patch
5687         fixes. Also updated failing results for ecma_3/RegExp/regress-100199.js
5688         which were not updated after bug 6257 was fixed.
5689
5690 2007-01-01  David Kilzer  <ddkilzer@webkit.org>
5691
5692         Reviewed by Darin.
5693
5694         - fix http://bugs.webkit.org/show_bug.cgi?id=12057
5695           REGRESSION: JavaScript Date Is One Day In The Future in GMT time zone
5696
5697         Because Mac OS X returns geographically and historically accurate time zone information,
5698         converting Jan 02, 1970 12:00:00 AM to local time then subtracting 24 hours did not work
5699         in GMT (London - England) since it was in BST (+0100) all year in 1970[1].  Instead, the
5700         UTC offset is calculated by converting Jan 01, 2000 12:00:00 AM to local time then
5701         subtracting that from the same date in UTC.
5702
5703         [1] http://en.wikipedia.org/wiki/British_Summer_Time
5704
5705         * kjs/DateMath.cpp:
5706         (KJS::getUTCOffset): Updated UTC offset calculation.
5707         (KJS::getDSTOffset): Improved comment.
5708
5709 2006-12-31  David Kilzer  <ddkilzer@webkit.org>
5710
5711         Reviewed by Geoff.
5712
5713         Update embedded pcre library from version 6.2 to 6.4.  Changes from pcre 6.2 to 6.3
5714         did not include any files in JavaScriptCore/pcre.
5715
5716         All changes include renaming EXPORT to PCRE_EXPORT, renaming of ucp_findchar() to
5717         _pcre_ucp_findchar(), or comment changes.  Additional changes noted below.
5718
5719         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Updated source file list.
5720         * JavaScriptCore.xcodeproj/project.pbxproj: Renamed pcre_printint.c to pcre_printint.src
5721         and changed it from a source file to a header file.
5722         * JavaScriptCoreSources.bkl: Updated source file list.
5723         * pcre/CMakeLists.txt: Updated source file list.
5724         * pcre/pcre-config.h:
5725         * pcre/pcre.h: Updated version.
5726         * pcre/pcre.pri: Updated source file list.
5727         * pcre/pcre_compile.c: Include pcre_printint.src #if DEBUG.
5728         (pcre_compile2):
5729         * pcre/pcre_config.c:
5730         * pcre/pcre_exec.c:
5731         (match):
5732         * pcre/pcre_fullinfo.c:
5733         * pcre/pcre_info.c:
5734         * pcre/pcre_internal.h: Added header guard.  Removed export of _pcre_printint().
5735         * pcre/pcre_ord2utf8.c:
5736         * pcre/pcre_printint.c: Renamed to pcre_printint.src.
5737         * pcre/pcre_printint.src: Added.  Renamed _pcre_printint() to pcre_printint().
5738         * pcre/pcre_refcount.c:
5739         * pcre/pcre_study.c:
5740         * pcre/pcre_tables.c:
5741         * pcre/pcre_try_flipped.c:
5742         * pcre/pcre_ucp_findchar.c: Added contents of ucp_findchar.c.
5743         * pcre/pcre_version.c:
5744         * pcre/pcre_xclass.c:
5745         (_pcre_xclass):
5746         * pcre/ucp.h: Removed export of ucp_findchar().
5747         * pcre/ucp_findchar.c: Removed.  Contents moved to pcre_ucp_findchar.c.
5748
5749 2006-12-29  David Kilzer  <ddkilzer@webkit.org>
5750
5751         Reviewed by Geoff.
5752
5753         Update embedded pcre library from version 6.1 to 6.2.  From the pcre ChangeLog:
5754
5755         3. Added "b" to the 2nd argument of fopen() in dftables.c, for non-Unix-like
5756            operating environments where this matters.
5757
5758         5. Named capturing subpatterns were not being correctly counted when a pattern
5759            was compiled. This caused two problems: (a) If there were more than 100
5760            such subpatterns, the calculation of the memory needed for the whole
5761            compiled pattern went wrong, leading to an overflow error. (b) Numerical
5762            back references of the form \12, where the number was greater than 9, were
5763            not recognized as back references, even though there were sufficient
5764            previous subpatterns.
5765
5766         * pcre/dftables.c: Item 3.
5767         (main):
5768         * pcre/pcre.h: Updated version.
5769         * pcre/pcre_compile.c: Item 5.
5770         (read_repeat_counts):
5771         (pcre_compile2):
5772
5773 2006-12-29  Geoffrey Garen  <ggaren@apple.com>
5774
5775         Reviewed by Brian Dash... err... Mark Rowe.
5776
5777         More cleanup in preparation for fixing <rdar://problem/4608404> 
5778         WebScriptObject's _executionContext lack of ownership policy causes 
5779         crashes (e.g., in Dashcode)
5780         
5781         The key change here is to RootObject::RootObject().
5782         
5783         * JavaScriptCore.exp:
5784
5785         * bindings/c/c_utility.cpp:
5786         (KJS::Bindings::convertValueToNPVariant): Changed to use new constructor.
5787
5788         * bindings/jni/jni_jsobject.cpp:
5789         (JavaJSObject::createNative): Changed to use new constructor. Replaced
5790         large 'if' followed by default condition with "if !" and explicit default
5791         condition.
5792
5793         * bindings/objc/objc_runtime.mm:
5794         (convertValueToObjcObject): Changed to use new constructor.
5795
5796         * bindings/runtime_root.cpp:
5797         (KJS::Bindings::RootObject::destroy): "removeAllNativeReferences" => "destroy"
5798         because this function actually destroys the RootObject.
5799
5800         * bindings/runtime_root.h: Changed Interpreter* to RefPtr<Interpreter>
5801         to prevent a RootObject from holding a stale Interperter*.
5802         
5803         (KJS::Bindings::RootObject::RootObject): Changed constructor to take an 
5804         Interpreter*, since it's pointless to create a RootObject without one.
5805         Removed setRootObjectImp() and rootObjectImp() because they were just
5806         a confusing way of setting and getting the Interpreter's global object.
5807
5808         (KJS::Bindings::RootObject::nativeHandle): "_nativeHandle" => "m_nativeHandle"
5809         (KJS::Bindings::RootObject::interpreter): "_interpreter" => "m_interpreter"
5810
5811 2006-12-28  George Staikos  <staikos@kde.org>
5812
5813         Reviewed by Olliej.
5814
5815         * bindings/qt/qt_instance.cpp: build
5816         (KJS::Bindings::QtInstance::QtInstance):
5817
5818 2006-12-28  Geoffrey Garen  <ggaren@apple.com>
5819
5820         Reviewed by Oliver Hunt.
5821         
5822         More cleanup. Layout tests pass.
5823         
5824         Use a helper function to initialize and access WebUndefined and WebScriptObject.
5825
5826         * bindings/objc/objc_runtime.h:
5827         * bindings/objc/objc_runtime.mm:
5828         (KJS::Bindings::webScriptObjectClass):
5829         (KJS::Bindings::webUndefinedClass):
5830         (convertValueToObjcObject):
5831         * bindings/objc/objc_utility.mm:
5832         (KJS::Bindings::convertValueToObjcValue):
5833         (KJS::Bindings::convertObjcValueToValue):
5834
5835 2006-12-28  Geoffrey Garen  <ggaren@apple.com>
5836
5837         Reviewed by Brady Eidson.
5838         
5839         Some cleanup in preparation for fixing <rdar://problem/4608404> 
5840         WebScriptObject's _executionContext lack of ownership policy causes 
5841         crashes (e.g., in Dashcode)
5842         
5843         I'm just trying to make heads or tails of this baffling code.
5844         
5845         Renamed "root" | "execContext" | "executionContext" => "rootObject", because
5846         that's the object's (admittedly vague) type name.
5847         
5848         * bindings/runtime.cpp: Removed createLanguageInstanceForValue
5849         because I'll give you a dollar if you can explain to me what it actually did.
5850         
5851         * bindings/runtime_root.cpp: Put everything in the KJS::Bindings namespace,
5852         removing the KJS::Bindings prefix from individual functions and datatypes.
5853         This matches the header and eliminates a lot of syntax cruft.
5854         
5855         * bindings/c/c_utility.cpp:
5856         (KJS::Bindings::convertValueToNPVariant): Replaced use of createLanguageInstanceForValue
5857         with call to _NPN_CreateScriptObject because that's what createLanguageInstanceForValue
5858         actually did (but don't ask me for that dollar now; that's cheating.)
5859
5860         * bindings/objc/objc_utility.h:
5861         * bindings/objc/objc_utility.mm:
5862         (KJS::Bindings::convertValueToObjcValue): Removed. Its only purpose was 
5863         to call a single function for WebKit, which WebKit can do on its own.
5864
5865         * kjs/interpreter.h: Removed rtti() because it was unused, and this class
5866         is scheduled for demolition anyway.
5867         
5868         * kjs/interpreter.cpp: Removed createLanguageInstanceForValue because it had
5869         nothing to do with the Interpreter, and nothing makes Chuck Norris more mad
5870         than a function whose sole purpose is to call another function of the same
5871         name. (Really, I asked him.)
5872
5873 2006-12-26  Geoffrey Garen  <ggaren@apple.com>
5874
5875         Reviewed by Eric Seidel.
5876
5877         Some cleanup in preparation for fixing <rdar://problem/4740328> Safari 
5878         crash on quit in _NPN_ReleaseObject from KJS::Bindings::CInstance::~CInstance
5879
5880         * bindings/c/c_instance.cpp:
5881         * bindings/c/c_instance.h: Removed unused copy constructor and assignment
5882         operator. They made tracking data flow more difficult. Unused code is also 
5883         dangerous because it can succumb to bit rot with the stealth of a Ninja.
5884         
5885         Replaced #include with forward declaration to reduce header dependency.
5886         
5887         * bindings/npruntime.cpp: Sorted #includes.
5888         (_NPN_GetStringIdentifier): Replaced assert with ASSERT.
5889         (_NPN_GetStringIdentifiers): ditto
5890         (_NPN_ReleaseVariantValue): ditto
5891         (_NPN_CreateObject): ditto
5892         (_NPN_RetainObject): ditto
5893         (_NPN_ReleaseObject): ditto
5894         (_NPN_DeallocateObject): ditto
5895
5896 2006-12-20  Anders Carlsson  <acarlsson@apple.com>
5897
5898         * kjs/string_object.cpp:
5899         (localeCompare):
5900         Another speculative Win32 fix.
5901
5902 2006-12-20  Anders Carlsson  <acarlsson@apple.com>
5903
5904         * kjs/string_object.cpp:
5905         (localeCompare):
5906         Speculative Win32 fix.
5907
5908 2006-12-20  Anders Carlsson  <acarlsson@apple.com>
5909
5910         Reviewed by Darin.
5911
5912         <rdar://problem/4235733>
5913         <http://bugs.webkit.org/?show_bug.cgi?id=10193>
5914         support String.localeCompare.
5915         
5916         Implement localeCompare.
5917         
5918         * JavaScriptCore.xcodeproj/project.pbxproj:
5919         * kjs/string_object.cpp:
5920         (localeCompare):
5921         (StringProtoFunc::callAsFunction):
5922         * kjs/string_object.h:
5923         (KJS::StringProtoFunc::):
5924
5925 2006-12-20  Timothy Hatcher  <timothy@apple.com>
5926
5927         Reviewed by Mark Rowe.
5928
5929         * JavaScriptCore.xcodeproj/project.pbxproj: use GCC 4.0 for all the other test targets
5930
5931 2006-12-20  Timothy Hatcher  <timothy@apple.com>
5932
5933         Reviewed by Mark Rowe.
5934
5935         <rdar://problem/4871613> JavaScriptCore-421.31's dftables target needs to override default compiler and use gcc-4.0
5936
5937         * JavaScriptCore.xcodeproj/project.pbxproj:
5938
5939 2006-12-20  Lars Knoll <lars@trolltech.com>
5940
5941         Reviewed by David Hyatt
5942
5943         Added support to bind QObject's to 
5944         JavaScript.
5945
5946         * JavaScriptCore.pro:
5947         * bindings/qt/qt_class.cpp: Added.
5948         (KJS::Bindings::QtClass::QtClass):
5949         (KJS::Bindings::QtClass::~QtClass):
5950         (KJS::Bindings::QtClass::classForObject):
5951         (KJS::Bindings::QtClass::name):
5952         (KJS::Bindings::QtClass::methodsNamed):
5953         (KJS::Bindings::QtClass::fieldNamed):
5954         * bindings/qt/qt_class.h: Added.
5955         (KJS::Bindings::QtClass::constructorAt):
5956         (KJS::Bindings::QtClass::numConstructors):
5957         * bindings/qt/qt_instance.cpp: Added.
5958         (KJS::Bindings::QtInstance::QtInstance):
5959         (KJS::Bindings::QtInstance::~QtInstance):
5960         (KJS::Bindings::QtInstance::operator=):
5961         (KJS::Bindings::QtInstance::getClass):
5962         (KJS::Bindings::QtInstance::begin):
5963         (KJS::Bindings::QtInstance::end):
5964         (KJS::Bindings::QtInstance::implementsCall):
5965         (KJS::Bindings::QtInstance::invokeMethod):
5966         (KJS::Bindings::QtInstance::invokeDefaultMethod):
5967         (KJS::Bindings::QtInstance::defaultValue):
5968         (KJS::Bindings::QtInstance::stringValue):
5969         (KJS::Bindings::QtInstance::numberValue):
5970         (KJS::Bindings::QtInstance::booleanValue):
5971         (KJS::Bindings::QtInstance::valueOf):
5972         * bindings/qt/qt_instance.h: Added.
5973         (KJS::Bindings::QtInstance::getObject):
5974         * bindings/qt/qt_runtime.cpp: Added.
5975         (KJS::Bindings::convertValueToQVariant):
5976         (KJS::Bindings::convertQVariantToValue):
5977         (KJS::Bindings::QtField::name):
5978         (KJS::Bindings::QtField::valueFromInstance):
5979         (KJS::Bindings::QtField::setValueToInstance):
5980         * bindings/qt/qt_runtime.h: Added.
5981         (KJS::Bindings::QtField::QtField):
5982         (KJS::Bindings::QtField::type):
5983         (KJS::Bindings::QtMethod::QtMethod):
5984         (KJS::Bindings::QtMethod::name):
5985         (KJS::Bindings::QtMethod::numParameters):
5986         * bindings/runtime.cpp:
5987         (KJS::Bindings::Instance::createBindingForLanguageInstance):
5988         * bindings/runtime.h:
5989         (KJS::Bindings::Instance::):
5990         * bindings/testbindings.pro: Added.
5991         * bindings/testqtbindings.cpp: Added.
5992         (MyObject::MyObject):
5993         (MyObject::setTestString):
5994         (MyObject::setTestInt):
5995         (MyObject::testString):
5996         (MyObject::testInt):
5997         (MyObject::foo):
5998         (Global::className):
5999         (main):
6000
6001 2006-12-19  Anders Carlsson  <acarlsson@apple.com>
6002
6003         Reviewed by Geoff.
6004
6005         Add -p option to testkjs which pretty prints the files instead of executing them.
6006
6007         * JavaScriptCore.exp:
6008         * JavaScriptCore.xcodeproj/project.pbxproj:
6009         * kjs/Parser.cpp:
6010         (KJS::Parser::prettyPrint):
6011         * kjs/Parser.h:
6012         * kjs/testkjs.cpp:
6013         (doIt):
6014
6015 2006-12-19  Brady Eidson  <beidson@apple.com>
6016
6017         Rubberstamped by Lou
6018         
6019         Removed unneccessary "else"
6020
6021         * wtf/Assertions.cpp:
6022
6023 2006-12-19  Timothy Hatcher  <timothy@apple.com>
6024
6025         Reviewed by Darin.
6026
6027         <rdar://problem/4891774> Local WebCore/WebBrowser builds fail in 9A328 due to warning about ObjC-2.0 language features
6028
6029         * JavaScriptCore.xcodeproj/project.pbxproj:
6030
6031 2006-12-17  Simon Hausmann  <hausmann@kde.org>
6032
6033         Reviewed by Zack.
6034
6035         * kjs/testkjs.pro: Oops, make it also build on machines other than
6036         mine :)
6037
6038 2006-12-17  Simon Hausmann  <hausmann@kde.org>
6039
6040         Reviewed by Rob Buis.
6041
6042         * kjs/testkjs.pro: Added .pro file to build testkjs.
6043
6044 2006-12-16  Alexey Proskuryakov  <ap@webkit.org>
6045
6046         Reviewed by Rob.
6047
6048         A deleted object was accessed to prepare RegExp construction error messages.
6049
6050         * kjs/regexp_object.cpp:
6051         (RegExpObjectImp::construct): Wrap the RegExp into an OwnPtr.
6052
6053 2006-12-16  Mitz Pettel  <mitz@webkit.org>
6054
6055         Reviewed by Alexey.
6056
6057         - fix http://bugs.webkit.org/show_bug.cgi?id=11814
6058           REGRESSION(r18098): Find does not work with capital letters
6059
6060         Test: editing/execCommand/findString-3.html
6061
6062         * wtf/unicode/icu/UnicodeIcu.h:
6063         (WTF::Unicode::foldCase): Changed to not return an error if the result fits
6064         in the buffer without a null terminator.
6065
6066 2006-12-13  Maciej Stachowiak  <mjs@apple.com>
6067
6068         Reviewed by Anders.
6069         
6070         - added equality and inequality operations for HashMap and Vector, useful for comparing more complex types
6071
6072         * wtf/HashMap.h:
6073         (WTF::operator==):
6074         (WTF::operator!=):
6075         * wtf/Vector.h:
6076         (WTF::operator==):
6077         (WTF::operator!=):
6078
6079 2006-12-12  Alexey Proskuryakov  <ap@webkit.org>
6080
6081         Reviewed by Geoff. Based on a patch by Maks Orlovich.
6082
6083         http://bugs.webkit.org/show_bug.cgi?id=6257
6084         Throw errors on invalid expressions (KJS merge)
6085
6086         * kjs/regexp.cpp:
6087         (KJS::RegExp::RegExp):
6088         (KJS::RegExp::~RegExp):
6089         (KJS::RegExp::match):
6090         * kjs/regexp.h:
6091         (KJS::RegExp::flags):
6092         (KJS::RegExp::isValid):
6093         (KJS::RegExp::errorMessage):
6094         (KJS::RegExp::subPatterns):
6095         Remember and report RegExp construction failures. Renamed data members not to start with underscores.
6096
6097         * kjs/regexp_object.cpp:
6098         (RegExpObjectImp::construct): Raise an exception if RegExp construction fails.
6099         (RegExpObjectImp::callAsFunction): Removed an obsolete comment.
6100
6101         * tests/mozilla/ecma_3/RegExp/regress-119909.js: Reduced the number of nested parentheses to 
6102         a value supported by PCRE.
6103
6104 2006-12-11  Alexey Proskuryakov  <ap@webkit.org>
6105
6106         Reviewed by Darin.
6107
6108         http://bugs.webkit.org/show_bug.cgi?id=9673
6109         Add support for window.atob() and window.btoa()
6110
6111         * JavaScriptCore.exp: Export UString::is8Bit().
6112         * JavaScriptCore.xcodeproj/project.pbxproj: Added StringExtras.h as 
6113         a private header.
6114
6115 2006-12-11  Darin Adler  <darin@apple.com>
6116
6117         Reviewed by Brady.
6118
6119         * JavaScriptCore.xcodeproj/project.pbxproj: Let Xcode update this
6120         (I think Hyatt is using an old Xcode).
6121
6122 2006-12-11  David Hyatt  <hyatt@apple.com>
6123
6124         Fix the failing layout test.  Just remove Unicode::isSpace and
6125         revert StringImpl to do the same thing it was doing before.
6126
6127         Reviewed by darin
6128
6129         * wtf/unicode/icu/UnicodeIcu.h:
6130         * wtf/unicode/qt4/UnicodeQt4.h:
6131
6132 2006-12-09  George Staikos  <staikos@kde.org>
6133
6134         Reviewed by Zack.
6135
6136         Fix bison again on qmake build.
6137
6138         * JavaScriptCore.pro:
6139
6140 2006-12-09  Lars Knoll <lars@trolltech.com>
6141
6142         Reviewed by Zack
6143
6144         Make it possible to build WebKit with qmake.
6145
6146         * JavaScriptCore.pro: Added.
6147         * kjs/kjs.pro: Removed.
6148         * pcre/pcre.pri: Added.
6149
6150 2006-12-09  Zack Rusin  <zack@kde.org>
6151
6152         Fixing the compilation with platform kde after the icu changes.
6153
6154         * CMakeLists.txt:
6155
6156 2006-12-09  Adam Roben  <aroben@apple.com>
6157
6158         Reviewed by Darin.
6159
6160         Some updates in reaction to r18098.
6161
6162         * wtf/unicode/icu/UnicodeIcu.h: Use !! to convert UBool to bool in all
6163         cases.
6164         (WTF::Unicode::toLower):
6165         (WTF::Unicode::toUpper):
6166         (WTF::Unicode::isDigit):
6167         (WTF::Unicode::isSpace):
6168         (WTF::Unicode::isPunct):
6169         (WTF::Unicode::isLower):
6170         (WTF::Unicode::isUpper):
6171         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
6172         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
6173
6174 2006-12-09  George Staikos  <staikos@kde.org>
6175
6176         Patch by Lars Knoll, comment out ICU dependency on Qt platform (unused code).
6177
6178         Reviewed by Darin.
6179
6180         * bindings/c/c_utility.cpp:
6181         (KJS::Bindings::convertUTF8ToUTF16):
6182
6183 2006-12-08  David Hyatt  <hyatt@apple.com>
6184
6185         Land the new ICU abstraction layer.  Patch by Lars.
6186
6187         Reviewed by me
6188
6189         * JavaScriptCore.xcodeproj/project.pbxproj:
6190         * wtf/Platform.h:
6191         * wtf/unicode/UnicodeCategory.h: Removed.
6192         * wtf/unicode/UnicodeDecomposition.h: Removed.
6193         * wtf/unicode/UnicodeDirection.h: Removed.
6194         * wtf/unicode/icu/UnicodeIcu.h:
6195         (WTF::Unicode::):
6196         (WTF::Unicode::foldCase):
6197         (WTF::Unicode::toLower):
6198         (WTF::Unicode::toUpper):
6199         (WTF::Unicode::toTitleCase):
6200         (WTF::Unicode::isDigit):
6201         (WTF::Unicode::isSpace):
6202         (WTF::Unicode::isPunct):
6203         (WTF::Unicode::mirroredChar):
6204         (WTF::Unicode::category):
6205         (WTF::Unicode::direction):
6206         (WTF::Unicode::isLower):
6207         (WTF::Unicode::isUpper):
6208         (WTF::Unicode::digitValue):
6209         (WTF::Unicode::combiningClass):
6210         (WTF::Unicode::decompositionType):
6211         (WTF::Unicode::strcasecmp):
6212         (WTF::Unicode::memset):
6213         * wtf/unicode/qt4/UnicodeQt4.cpp: Removed.
6214         * wtf/unicode/qt4/UnicodeQt4.h:
6215         (WTF::Unicode::):
6216         (WTF::Unicode::toLower):
6217         (WTF::Unicode::toUpper):
6218         (WTF::Unicode::toTitleCase):
6219         (WTF::Unicode::foldCase):
6220         (WTF::Unicode::isPrintableChar):
6221         (WTF::Unicode::isLower):
6222         (WTF::Unicode::isUpper):
6223         (WTF::Unicode::digitValue):
6224         (WTF::Unicode::combiningClass):
6225         (WTF::Unicode::decompositionType):
6226         (WTF::Unicode::strcasecmp):
6227         (WTF::Unicode::memset):
6228         (WTF::Unicode::direction):
6229         (WTF::Unicode::category):
6230
6231 === Safari-521.32 ===
6232
6233 2006-12-08  Adam Roben  <aroben@apple.com>
6234
6235         Reviewed by Anders.
6236
6237         This is a mo' better fix for ensuring we don't use macro definitions
6238         of min/max.
6239
6240         * kjs/config.h:
6241         * wtf/Vector.h:
6242
6243 2006-12-07  Kevin Fyure  <digdog@macports.org>
6244
6245         Reviewed by Darin.
6246
6247         http://bugs.webkit.org/show_bug.cgi?id=11545
6248         Disable the testcases do not follow the ECMA-262v3 specification.
6249         
6250         * tests/mozilla/expected.html: Update Results.
6251         * tests/mozilla/js1_2/String/concat.js:
6252         4 tests disabled. The result of concat Array object is not followinig
6253         ECMA 15.5.4.6
6254         * tests/mozilla/js1_2/function/Number.js:
6255         1 test disabled. The result of Array object to Number object conversion 
6256         is not following ECMA 9.3. And the test was duplicated in 
6257         ecma/TypeConversion/9.3-1.js
6258         * tests/mozilla/js1_2/function/String.js:
6259         2 tests disabled. The result of Object/Array object to String object 
6260         conversion is not following ECMA 15.5.1.1 and ECMA 9.8
6261
6262 2006-11-30  Steve Falkenburg  <sfalken@apple.com>
6263
6264         Reviewed by Oliver.
6265         
6266         Move WTF from JavaScriptCore project into a new WTF project.
6267
6268         * JavaScriptCore.vcproj/JavaScriptCore.sln: Add WTF.vcproj to sln
6269         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Remove WTF source files
6270         * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added.
6271         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Add dependency on WTF.lib
6272
6273 2006-11-30  Geoffrey Garen  <ggaren@apple.com>
6274
6275         Reviewed by Beth Dakin.
6276         
6277         Fixed up garbage collection at window close time.
6278
6279         * kjs/interpreter.cpp:
6280         (KJS::Interpreter::~Interpreter): Garbage collect here, since
6281         destroying the interpreter frees the global object and 
6282         therefore creates a lot of garbage.
6283
6284 2006-11-20  W. Andy Carrel  <wac@google.com>
6285
6286         Reviewed by Maciej.
6287
6288         http://bugs.webkit.org/show_bug.cgi?id=11501
6289         REGRESSION: \u no longer escapes metacharacters in RegExps
6290         http://bugs.webkit.org/show_bug.cgi?id=11502
6291         Serializing RegExps doesn't preserve Unicode escapes
6292
6293         * kjs/lexer.cpp:
6294         (Lexer::Lexer):
6295         (Lexer::setCode):
6296         (Lexer::shift):
6297         (Lexer::scanRegExp):
6298         Push \u parsing back down into the RegExp object rather than in the
6299         parser. This backs out r17354 in favor of a new fix that better 
6300         matches the behavior of other browsers.
6301
6302         * kjs/lexer.h:
6303         * kjs/regexp.cpp:
6304         (KJS::RegExp::RegExp):
6305         (KJS::sanitizePattern):
6306         (KJS::isHexDigit):
6307         (KJS::convertHex):
6308         (KJS::convertUnicode):
6309         * kjs/regexp.h:
6310         Translate \u escaped unicode characters for the benefit of pcre.
6311
6312         * kjs/ustring.cpp:
6313         (KJS::UString::append):
6314         Fix failure to increment length on the first UChar appended to a 
6315         UString that was copy-on-write.
6316
6317         * tests/mozilla/ecma_2/RegExp/properties-001.js:
6318         Adjust tests back to the uniform standards.
6319
6320 2006-11-20  Samuel Weinig  <sam@webkit.org>
6321
6322         Reviewed by Maciej.
6323
6324         Fix for http://bugs.webkit.org/show_bug.cgi?id=11647
6325         Fix Win32 build
6326
6327         * kjs/config.h: define NOMINMAX instead of min/max
6328         as themselves.
6329         * wtf/Vector.h: put back hack to ensure that min/max
6330         are not defined as macros.
6331
6332 2006-11-19  Simon Hausmann  <hausmann@kde.org>
6333
6334         Reviewed by Zack.
6335
6336         http://bugs.webkit.org/show_bug.cgi?id=11649
6337         Fix CMake Qt-only build without KDE CMake files
6338
6339         * CMakeLists.txt:
6340         * pcre/CMakeLists.txt:
6341
6342 2006-11-17  Anders Carlsson  <acarlsson@apple.com>
6343
6344         Reviewed by Adam.
6345
6346         Make sure that we always use std::min and std::max instead of macros.
6347         
6348         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
6349         * kjs/config.h:
6350         * wtf/Vector.h:
6351
6352 === Safari-521.31 ===
6353
6354 2006-11-12  Geoffrey Garen  <ggaren@apple.com>
6355
6356         Reviewed by Beth Dakin.
6357         
6358         Added project-wide setting to disable Microsoft's made-up deprecation 
6359         warnings related to std:: functions. (Doesn't have any affect yet,
6360         since we currently disable all deprecation warnings.)
6361
6362         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
6363
6364 2006-11-12  Mark Rowe  <bdash@webkit.org>
6365
6366         Reviewed by Mitz.
6367
6368         Clean up of JavaScriptCore bakefiles.
6369
6370         * JavaScriptCoreSources.bkl:
6371         * jscore.bkl:
6372
6373 2006-11-11  Alexey Proskuryakov  <ap@webkit.org>
6374
6375         Reviewed by Maciej.
6376
6377         http://bugs.webkit.org/show_bug.cgi?id=11508
6378         Undisable some warnings for JSImmediate.h
6379
6380         Fix suggested by Don Gibson.
6381
6382         * kjs/JSImmediate.h:
6383         Re-enable all MSVC warnings, move the remaining runtime checks
6384         to compile-time.
6385
6386 2006-11-10  Zalan Bujtas  <zalan.bujtas@nokia.com>
6387
6388         Reviewed by Maciej.
6389
6390         Added s60/symbian platform defines.
6391         http://bugs.webkit.org/show_bug.cgi?id=11540
6392
6393         * wtf/Platform.h:
6394
6395 === Safari-521.30 ===
6396
6397 2006-11-08  Ada Chan  <adachan@apple.com>
6398
6399         Reviewed by darin.
6400         
6401         Added a method to delete all the keys in a HashMap.
6402
6403         * wtf/HashMap.h:
6404         (WTF::deleteAllPairFirsts):
6405         (WTF::deleteAllKeys):
6406
6407 2006-11-07  Anders Carlsson  <acarlsson@apple.com>
6408
6409         Reviewed by Geoff.
6410
6411         * API/JSClassRef.cpp:
6412         (OpaqueJSClass::OpaqueJSClass):
6413         Initialize cachedPrototype to 0.
6414
6415 2006-11-06  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
6416
6417         Reviewed by Maciej.
6418
6419         Remove warning about garbage after #else. #else clause applies for all
6420         non-mac platforms, not only win.
6421
6422         * kjs/date_object.cpp:
6423
6424 2006-11-06  Mark Rowe  <bdash@webkit.org>
6425
6426         Reviewed by the wonderful Mitz Pettel.
6427
6428         http://bugs.webkit.org/show_bug.cgi?id=11524
6429         Bug 11524: REGRESSION(r9842): Array.prototype.join should use ToString operator rather than calling toString on each element
6430
6431         * kjs/array_object.cpp:
6432         (ArrayProtoFunc::callAsFunction): Use ToString operator on each element rather than calling their toString method.
6433
6434 2006-11-03  Steve Falkenburg  <sfalken@apple.com>
6435
6436         Fix build
6437
6438         * kjs/JSImmediate.h:
6439
6440 2006-11-03  Alexey Proskuryakov  <ap@nypop.com>
6441
6442         Reviewed by Darin.
6443
6444         http://bugs.webkit.org/show_bug.cgi?id=11504
6445         Fix warnings on non 32 bit platforms
6446
6447         * kjs/JSImmediate.h:
6448         (KJS::JSImmediate::NanAsBits):
6449         (KJS::JSImmediate::oneAsBits):
6450         Rewrite in a way that moves runtime checks to compile-time.
6451
6452         (KJS::):
6453         (KJS::JSImmediate::fromDouble):
6454         (KJS::JSImmediate::toDouble):
6455
6456 2006-11-02  George Staikos <staikos@kde.org>
6457
6458         Reviewed by Maciej.
6459
6460         * collector.cpp:
6461         Remove a deprecated pthreads call.
6462
6463 2006-11-02  Anders Carlsson  <acarlsson@apple.com>
6464
6465         Reviewed by Maciej, landed by Anders.
6466
6467         * CMakeLists.txt:
6468         Make KDE support optional.
6469
6470 2006-11-01  Kevin McCullough  <KMcCullough@apple.com>
6471
6472         Reviewed by Brady.
6473
6474         - Fixes many JavaScriptCore tests in other timezones.  The root problem is that on mac localtime() returns historically accurate information for DST, but the JavaScript spec explicitly states to not take into account historical information but rather to interpolate from valid years.
6475
6476         * kjs/DateMath.cpp:
6477         (KJS::equivalentYearForDST):
6478         (KJS::getDSTOffsetSimple):
6479         (KJS::getDSTOffset):
6480
6481 2006-10-31  Geoffrey Garen  <ggaren@apple.com>
6482
6483         Reviewed by Beth.
6484         
6485         Fixed http://bugs.webkit.org/show_bug.cgi?id=11477
6486         REGRESSION: GMail crashes in KJS::FunctionImp::callerGetter
6487
6488         * kjs/function.cpp:
6489         (KJS::FunctionImp::argumentsGetter): Removed unnecessary braces.
6490         (KJS::FunctionImp::callerGetter): More logical NULL checking.
6491
6492 2006-10-31  Oliver Hunt  <oliver@apple.com>
6493
6494         Reviewed by Geoff.
6495
6496         Adding definition for PLATFORM(CI)
6497
6498         * wtf/Platform.h:
6499
6500 2006-10-31  Vladimir Olexa  <vladimir.olexa@gmail.com>
6501
6502         Reviewed by Geoff.
6503
6504         http://bugs.webkit.org/show_bug.cgi?id=4166
6505         Function object does not support caller property
6506
6507         Test: fast/js/caller-property.html
6508
6509         * kjs/function.cpp: 
6510         (KJS::FunctionImp::callerGetter): added
6511         (KJS::FunctionImp::getOwnPropertySlot): added if statement to handle callerGetter()
6512         * kjs/function.h: added callerGetter() declaration
6513         * kjs/identifier.h: added caller property macro
6514         * tests/mozilla/expected.html: 
6515
6516 2006-10-30  Kevin McCullough  <KMcCullough@apple.com>
6517
6518         Reviewed by Adam.
6519
6520         - Fix some timezone issues and JavaScriptCore date tests.  Addresses bugzilla 4930.
6521
6522         * kjs/DateMath.h:
6523         (KJS::GregorianDateTime::GregorianDateTime): Here's the fix, to add parenthesis for order of precedence.
6524         * kjs/date_object.cpp:
6525         (KJS::DateProtoFunc::callAsFunction): 
6526         (KJS::DateObjectImp::construct): memset not needed as GregorianDateTime initializes itself.
6527
6528 2006-10-30  Darin Adler  <darin@apple.com>
6529
6530         Reviewed by John Sullivan.
6531
6532         * kjs/SavedBuiltins.h: Added needed include.
6533         * wtf/OwnPtr.h: (WTF::OwnPtr::set): Fixed mistake in assertion.
6534
6535 2006-10-28  Darin Adler  <darin@apple.com>
6536
6537         Reviewed by Maciej.
6538
6539         - renamed PassRefPtr::release to releaseRef to make it clearer that
6540           it's the counterpart of adoptRef, and to make it harder to confuse
6541           it with the safer-to-use RefPtr::release
6542
6543         * kjs/identifier.cpp:
6544         (KJS::CStringTranslator::translate):
6545         (KJS::UCharBufferTranslator::translate):
6546         * kjs/ustring.cpp:
6547         (KJS::UString::Rep::create):
6548         * wtf/PassRefPtr.h:
6549         (WTF::PassRefPtr::PassRefPtr):
6550         (WTF::PassRefPtr::~PassRefPtr):
6551         (WTF::PassRefPtr::get):
6552         (WTF::PassRefPtr::releaseRef):
6553         (WTF::PassRefPtr::operator->):
6554         (WTF::PassRefPtr::operator=):
6555         (WTF::adoptRef):
6556         (WTF::static_pointer_cast):
6557         (WTF::const_pointer_cast):
6558         * wtf/RefPtr.h:
6559         (WTF::RefPtr::RefPtr):
6560         (WTF::RefPtr::operator=):
6561
6562 2006-10-28  Darin Adler  <darin@apple.com>
6563
6564         Reviewed by Steve.
6565
6566         * kjs/grammar.y: Add definitions of YYMALLOC and YYFREE to fix
6567         a warning some people see (not sure why others don't see it).
6568
6569         * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Touch
6570         this file to force it to re-build grammar.cpp.
6571
6572 2006-10-28  Darin Adler  <darin@apple.com>
6573
6574         Reviewed by Geoff.
6575
6576         - made changes so the code compiles with the highest warning level
6577           under MSVC (disabling some warnings, making some code fixes)
6578
6579         * API/JSCallbackConstructor.cpp:
6580         (KJS::JSCallbackConstructor::construct):
6581         * API/JSCallbackFunction.cpp:
6582         (KJS::JSCallbackFunction::callAsFunction):
6583         * API/JSCallbackObject.cpp:
6584         (KJS::JSCallbackObject::init):
6585         (KJS::JSCallbackObject::construct):
6586         (KJS::JSCallbackObject::callAsFunction):
6587         * API/JSObjectRef.cpp:
6588         (JSPropertyNameArrayGetNameAtIndex):
6589         * API/JSStringRef.cpp:
6590         (JSStringCreateWithCharacters):
6591         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
6592         * bindings/c/c_utility.cpp:
6593         (KJS::Bindings::convertUTF8ToUTF16):
6594         (KJS::Bindings::coerceValueToNPVariantStringType):
6595         (KJS::Bindings::convertValueToNPVariant):
6596         * kjs/DateMath.h:
6597         (KJS::GregorianDateTime::GregorianDateTime):
6598         * kjs/ExecState.h:
6599         (KJS::ExecState::hadException):
6600         * kjs/JSImmediate.h:
6601         (KJS::JSImmediate::fromDouble):
6602         (KJS::JSImmediate::toDouble):
6603         (KJS::JSImmediate::NanAsBits):
6604         (KJS::JSImmediate::oneAsBits):
6605         * kjs/Parser.h:
6606         * kjs/PropertyNameArray.h:
6607         (KJS::PropertyNameArray::size):
6608         * kjs/array_object.cpp:
6609         (ArrayObjectImp::callAsFunction):
6610         * kjs/bool_object.cpp:
6611         (BooleanObjectImp::callAsFunction):
6612         * kjs/collector.cpp:
6613         (KJS::Collector::allocate):
6614         (KJS::Collector::markCurrentThreadConservatively):
6615         (KJS::Collector::collect):
6616         * kjs/completion.h:
6617         (KJS::Completion::isValueCompletion):
6618         * kjs/date_object.cpp:
6619         (KJS::findMonth):
6620         * kjs/debugger.cpp:
6621         (Debugger::sourceParsed):
6622         (Debugger::sourceUnused):
6623         (Debugger::exception):
6624         (Debugger::atStatement):
6625         (Debugger::callEvent):
6626         (Debugger::returnEvent):
6627         * kjs/dtoa.cpp:
6628         * kjs/error_object.cpp:
6629         (ErrorObjectImp::callAsFunction):
6630         (NativeErrorImp::callAsFunction):
6631         * kjs/function.cpp:
6632         (KJS::FunctionImp::processVarDecls):
6633         (KJS::GlobalFuncImp::callAsFunction):
6634         * kjs/function_object.cpp:
6635         (FunctionPrototype::callAsFunction):
6636         * kjs/grammar.y:
6637         * kjs/identifier.cpp:
6638         (KJS::CStringTranslator::translate):
6639         (KJS::Identifier::add):
6640         * kjs/internal.h:
6641         * kjs/lexer.cpp:
6642         (Lexer::lex):
6643         (Lexer::isIdentStart):
6644         (Lexer::isIdentPart):
6645         (isDecimalDigit):
6646         (Lexer::isHexDigit):
6647         (Lexer::isOctalDigit):
6648         (Lexer::matchPunctuator):
6649         (Lexer::singleEscape):
6650         (Lexer::convertOctal):
6651         (Lexer::convertHex):
6652         (Lexer::convertUnicode):
6653         (Lexer::record8):
6654         * kjs/lexer.h:
6655         * kjs/math_object.cpp:
6656         (MathFuncImp::callAsFunction):
6657         * kjs/number_object.cpp:
6658         (integer_part_noexp):
6659         (intPow10):
6660         (NumberProtoFunc::callAsFunction):
6661         (NumberObjectImp::callAsFunction):
6662         * kjs/object.cpp:
6663         (KJS::JSObject::deleteProperty):
6664         (KJS::JSObject::callAsFunction):
6665         (KJS::JSObject::toBoolean):
6666         (KJS::JSObject::toObject):
6667         * kjs/object.h:
6668         (KJS::JSObject::getPropertySlot):
6669         * kjs/property_map.cpp:
6670         (KJS::isValid):
6671         (KJS::PropertyMap::put):
6672         (KJS::PropertyMap::insert):
6673         (KJS::PropertyMap::containsGettersOrSetters):
6674         * kjs/property_map.h:
6675         (KJS::PropertyMap::hasGetterSetterProperties):
6676         * kjs/property_slot.h:
6677         * kjs/string_object.cpp:
6678         (StringInstance::getPropertyNames):
6679         (StringObjectImp::callAsFunction):
6680         (StringObjectFuncImp::callAsFunction):
6681         * kjs/ustring.cpp:
6682         (KJS::UString::Rep::computeHash):
6683         (KJS::UString::UString):
6684         (KJS::UString::from):
6685         (KJS::UString::append):
6686         (KJS::UString::ascii):
6687         (KJS::UString::operator=):
6688         (KJS::UString::find):
6689         (KJS::UString::rfind):
6690         * kjs/ustring.h:
6691         (KJS::UChar::high):
6692         (KJS::UChar::low):
6693         (KJS::UCharReference::low):
6694         (KJS::UCharReference::high):
6695         * kjs/value.cpp:
6696         (KJS::JSValue::toUInt16):
6697         * kjs/value.h:
6698         * pcre/pcre_compile.c:
6699         (get_othercase_range):
6700         * pcre/pcre_exec.c:
6701         (match):
6702         * pcre/pcre_internal.h:
6703         * wtf/HashFunctions.h:
6704         (WTF::intHash):
6705         (WTF::PtrHash::hash):
6706         * wtf/MathExtras.h:
6707         (isnan):
6708         (lround):
6709         (lroundf):
6710         * wtf/StringExtras.h:
6711         (strncasecmp):
6712         * wtf/unicode/icu/UnicodeIcu.h:
6713         (WTF::Unicode::isPrintableChar):
6714
6715 2006-10-26  W. Andy Carrel  <wac@google.com>
6716
6717         Reviewed by Maciej.
6718
6719         - Fix http://bugs.webkit.org/show_bug.cgi?id=7445 /
6720           <rdar://problem/4614195> (and 7253 / <rdar://4694011>) by changing
6721           inline regexps so that they can have \u escaped Unicode sequences and
6722           still work properly.
6723
6724         * kjs/lexer.cpp:
6725         (Lexer::Lexer): 
6726         (Lexer::setCode):
6727         (Lexer::shift): Looking ahead one additional character for the benefit
6728         of scanRegExp
6729         (Lexer::scanRegExp): Change code to support unicode escapes in inline 
6730         regexps.
6731         * kjs/lexer.h: Extra lookahead added.
6732
6733 === Safari-521.29 ===
6734
6735 2006-10-26  Nikolas Zimmermann  <zimmermann@kde.org>
6736
6737         Reviewed by Darin.
6738
6739         Fix build with older gcc 3.3.4.
6740
6741         * kjs/DateMath.cpp: Remove inline prefix.
6742         (KJS::equivalentYearForDST):
6743
6744 2006-10-26  Darin Adler  <darin@apple.com>
6745
6746         Reviewed by John.
6747
6748         - fix iteration of properties of string objects (found because of a warning
6749           emitted by the MSVC compiler)
6750
6751         * kjs/string_object.cpp: (StringInstance::getPropertyNames): Change code that
6752         wants to format a number as a string to use UString::from. Before it was using
6753         the UString constructor that makes a string from a character!
6754
6755         * kjs/ustring.h:
6756         * kjs/ustring.cpp: Remove the dangerous and not all that helpful UString(char)
6757         constructor.
6758
6759         * kjs/grammar.y: Change code to not depend on the UString(char) constructor.
6760         This is potentially more efficient anyway because we could overload the + operator
6761         some day to handle char* directly instead of creating a UString.
6762
6763         * kjs/nodes2string.cpp: (SourceStream::operator<<): Change code to not depend on
6764         the UString(char) constructor.
6765
6766 2006-10-25  Kevin McCullough  <KMcCullough@apple.com>
6767
6768         Reviewed by Steve (rubber stamp).
6769
6770         - Link against your local build of JavaScriptCore.lib first, this fixes some errors on release builds of testkjs.
6771
6772         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
6773
6774 2006-10-25  Geoffrey Garen  <ggaren@apple.com>
6775
6776         Reviewed by Lou.
6777         
6778         Removed duplicate symbol declaration.
6779
6780         * JavaScriptCore.xcodeproj/project.pbxproj:
6781         * kjs/grammar.y:
6782
6783 2006-10-24  Steve Falkenburg  <sfalken@apple.com>
6784
6785         Build config change
6786
6787         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
6788
6789 2006-10-24  Kevin McCullough  <KMcCullough@apple.com>
6790
6791         Reviewed by Brady.
6792
6793         - Fixes a date formatting issue on win.  Specifically strftime cannot handle some ranges of time so we shift time call strftime and then manipulate the returned string, if needed.
6794
6795         * kjs/date_object.cpp:
6796         (KJS::):
6797         (KJS::formatLocaleDate):
6798         (KJS::DateProtoFunc::callAsFunction):
6799
6800 2006-10-23  Kevin McCullough  <KMcCullough@apple.com>
6801
6802         Reviewed by 
6803
6804        - Build fix
6805
6806         * JavaScriptCore.xcodeproj/project.pbxproj:
6807         * kjs/grammar.y:
6808
6809 2006-10-23  Kevin McCullough  <KMcCullough@apple.com>
6810
6811         Reviewed by Maciej.
6812
6813         - Makes the toTM function an operator.  Was going to piggy back on a patch but the patch needs more work.
6814
6815         * kjs/DateMath.cpp:
6816         (KJS::equivalentYearForDST):
6817         * kjs/DateMath.h:
6818         (KJS::GregorianDateTime::operator tm):
6819         * kjs/date_object.cpp:
6820         (KJS::formatTime):
6821         (KJS::DateProtoFunc::callAsFunction):
6822
6823 2006-10-23  Kevin McCullough  <KMcCullough@apple.com>
6824
6825         Reviewed by Maciej.
6826
6827        - Fixes two regressions on win.  Both are stack overflows. For one the number of recursions is capped at 100, and for the other, nested parenthesis pairs are not evaluated (since they would evaluate to whatever is in them anyway).
6828
6829         * kjs/grammar.y:
6830         * kjs/object.cpp:
6831
6832 2006-10-21  Steve Falkenburg  <sfalken@apple.com>
6833
6834         Reviewed by Adam.
6835         
6836         Add minimal compatibility with MSVCRT leak checker
6837
6838         * wtf/FastMalloc.h:
6839
6840 2006-10-23  Kevin McCullough  <KMcCullough@apple.com>
6841
6842         Reviewed by Geof.
6843
6844         - Sets the lowercase range correctly in the test and consolidates a variable to make the test more readable.
6845
6846        * tests/mozilla/ecma/String/15.5.4.11-2.js:
6847
6848 2006-10-21  Darin Adler  <darin@apple.com>
6849
6850         Reviewed by Anders.
6851
6852         - http://bugs.webkit.org/show_bug.cgi?id=11377
6853           swap(Vector, Vector) should be O(1) instead of O(n)
6854
6855         * wtf/Vector.h:
6856         (WTF::VectorBuffer::swap): Added.
6857         (WTF::Vector::swap): Added.
6858         (WTF::swap): Added overload that takes two Vector objects.
6859
6860 2006-10-21  Darin Adler  <darin@apple.com>
6861
6862         Reviewed by Adam.
6863
6864         - http://bugs.webkit.org/show_bug.cgi?id=11376
6865           build scripts should invoke make with "-j" option for multiple processors
6866
6867         * JavaScriptCore.xcodeproj/project.pbxproj: Pass -j `sysctl -n hw.ncpu` to make.
6868
6869 2006-10-19  Kevin McCullough  <KMcCullough@apple.com>
6870
6871         Reviewed by Geof.
6872
6873         Changed test to make us pass Georgian case changing for Unicode 4.0 and 5.0.  This incorporates changes from the 1.4 revision of the same mozilla test.
6874         On Tiger we are still using Unicode 4.0 but on win and Leopard we are using Unicode 5.0, so this test currently allows for either answer.
6875
6876         * tests/mozilla/ecma/String/15.5.4.11-2.js:
6877
6878 2006-10-18  Maciej Stachowiak  <mjs@apple.com>
6879
6880         Reviewed by Geoff.
6881         
6882         - remove vestiges of KXMLCore name (former name of WTF).
6883
6884         * wtf/Assertions.h:
6885         * wtf/FastMalloc.h:
6886         (operator new):
6887         (operator delete):
6888         (operator new[]):
6889         (operator delete[]):
6890         * wtf/FastMallocInternal.h:
6891         * wtf/Forward.h:
6892         * wtf/GetPtr.h:
6893         * wtf/HashCountedSet.h:
6894         * wtf/HashFunctions.h:
6895         * wtf/HashMap.h:
6896         * wtf/HashSet.h:
6897         * wtf/HashTable.h:
6898         * wtf/HashTraits.h:
6899         * wtf/ListRefPtr.h:
6900         * wtf/MathExtras.h:
6901         * wtf/Noncopyable.h:
6902         * wtf/OwnArrayPtr.h:
6903         * wtf/OwnPtr.h:
6904         * wtf/PassRefPtr.h:
6905         * wtf/Platform.h:
6906         * wtf/RefPtr.h:
6907         * wtf/StringExtras.h:
6908         (snprintf):
6909         * wtf/UnusedParam.h:
6910         * wtf/Vector.h:
6911         * wtf/VectorTraits.h:
6912
6913 2006-10-17  Steve Falkenburg  <sfalken@apple.com>
6914
6915         Reviewed by Maciej.
6916         
6917         Adjust include paths
6918
6919         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
6920
6921 2006-10-17  Kevin McCullough  <KMcCullough@apple.com>
6922
6923         Reviewed by Darin.
6924
6925         Fixed a date issue where the UTC offset was not set in win.
6926
6927         * kjs/DateMath.cpp:
6928         (KJS::getDSTOffsetSimple):
6929         (KJS::getDSTOffset):
6930         (KJS::msToGregorianDateTime):
6931         * kjs/DateMath.h:
6932         (KJS::):
6933         (KJS::GregorianDateTime::GregorianDateTime):
6934
6935 2006-10-17  Kevin McCullough  <KMcCullough@apple.com>
6936
6937         Reviewed by Brady.
6938
6939         Fixes a JavaScriptCore math issue on win.
6940
6941         * kjs/math_object.cpp:
6942         (MathFuncImp::callAsFunction):
6943         * wtf/MathExtras.h:
6944         (wtf_atan2):
6945
6946 2006-10-16  Kevin McCullough  <kmccullough@apple.com>
6947
6948         Reviewed by Geof.
6949
6950         Removed unecessary global specifiers.
6951
6952         * kjs/math_object.cpp:
6953         (MathFuncImp::callAsFunction):
6954
6955 2006-10-16  Kevin McCullough  <KMcCullough@apple.com>
6956
6957         Reviewed by John.
6958
6959         Fixes a compile order issue for testkjs on win.
6960
6961         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
6962
6963 2006-10-15  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
6964
6965         Reviewed by Anders.
6966
6967         Remove junk (as gcc calls it) after #else clause.
6968
6969         * wtf/FastMalloc.cpp:
6970         (WTF::do_free):
6971
6972 2006-10-14  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
6973
6974         Reviewed by Maciej.
6975
6976         Define KXMLCORE_USE_CURL for platforms that wish to use CURL as
6977         networking, and set it for GDK build
6978
6979         * wtf/Platform.h:
6980
6981 2006-10-13  Brett Wilson  <brettw@google.com>
6982
6983         Reviewed by Kevin McCullough.
6984
6985         Fixes http://bugs.webkit.org/show_bug.cgi?id=11283
6986         Fixes Qt/Linux and Windows build
6987
6988         * kjs/DateMath.cpp:
6989         * kjs/DateMath.h:
6990         * kjs/date_object.cpp:
6991         (KJS::DateProtoFunc::callAsFunction):
6992
6993 2006-10-13  Kevin McCullough  <KMcCullough@apple.com>
6994
6995         Reviewed by Adam, Geoff, Darin.
6996
6997        Fixed displaying the UTC offset and time zone string, as well as renamed the GregorianDateTime structure and clean up. 
6998
6999         * ChangeLog:
7000         * kjs/DateMath.cpp:
7001         (KJS::getUTCOffset):
7002         (KJS::getDSTOffsetSimple):
7003         (KJS::gregorianDateTimeToMS):
7004         (KJS::msToGregorianDateTime):
7005         * kjs/DateMath.h:
7006         (KJS::GregorianDateTime::GregorianDateTime):
7007         (KJS::GregorianDateTime::~GregorianDateTime):
7008         (KJS::GregorianDateTime::toTM):
7009         * kjs/date_object.cpp:
7010         (KJS::gmtoffset):
7011         (KJS::formatDate):
7012         (KJS::formatDateUTCVariant):
7013         (KJS::formatTime):
7014         (KJS::fillStructuresUsingTimeArgs):
7015         (KJS::fillStructuresUsingDateArgs):
7016         (KJS::DateInstance::getTime):
7017         (KJS::DateInstance::getUTCTime):
7018         (KJS::DateProtoFunc::callAsFunction):
7019         (KJS::DateObjectImp::construct):
7020         (KJS::DateObjectImp::callAsFunction):
7021         (KJS::DateObjectFuncImp::callAsFunction):
7022         (KJS::parseDate):
7023         * kjs/date_object.h:
7024
7025 2006-10-13  Kevin McCullough  <KMcCullough@apple.com>
7026
7027         Reviewed by Adam.
7028
7029         Gets JavaScripCore tests running on windows.
7030
7031         * Scripts/run-javascriptcore-tests:
7032         * Scripts/webkitdirs.pm:
7033
7034 2006-10-12  Geoffrey Garen  <ggaren@apple.com>
7035
7036         Reviewed by Maciej.
7037         
7038         Removed JSObjectMakeWithPrototype, clarified some comments. We really
7039         don't want people to manage their own prototypes, so we don't want an
7040         extra function in the API devoted to just that. People can still manage
7041         their own prototypes if they really want by using JSObjectSetPrototype.
7042
7043         * API/JSClassRef.cpp:
7044         (OpaqueJSClass::createNoAutomaticPrototype):
7045         (OpaqueJSClass::create):
7046         * API/JSClassRef.h:
7047         * API/JSObjectRef.cpp:
7048         (JSClassCreate):
7049         (JSObjectMake):
7050         * API/JSObjectRef.h:
7051         * API/testapi.c:
7052         (main):
7053         * JavaScriptCore.exp:
7054
7055 2006-10-12  Kevin McCullough  <KMcCullough@apple.com>
7056
7057         Reviewed by Adam.
7058
7059         Build breakage fix
7060
7061         * kjs/DateMath.cpp:
7062         (KJS::msToTM):
7063         * kjs/date_object.cpp:
7064         (KJS::gmtoffset):
7065
7066 2006-10-11  Kevin McCullough  <KMcCullough@apple.com>
7067
7068         Reviewed by Geoff.
7069
7070         Added our own tm struct to have a consistent set of fields, which lets us display the DST offset and timezone strings correctly.  Also there is some code cleanup.
7071
7072         * kjs/DateMath.cpp:
7073         (KJS::timeToMS):
7074         (KJS::getUTCOffset):
7075         (KJS::getDSTOffsetSimple):
7076         (KJS::dateToMS):
7077         (KJS::msToTM):
7078         (KJS::tmToKJStm):
7079         (KJS::KJStmToTm):
7080         * kjs/DateMath.h:
7081         * kjs/date_object.cpp: 
7082         (KJS::gmtoffset): 
7083         (KJS::formatTime): 
7084         (KJS::DateProtoFunc::callAsFunction): 
7085         (KJS::DateObjectImp::construct):
7086         (KJS::DateObjectImp::callAsFunction):
7087         (KJS::DateObjectFuncImp::callAsFunction):
7088         (KJS::parseDate):
7089         * kjs/date_object.h:
7090
7091 2006-10-09  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
7092
7093         Reviewed by Geoff.
7094
7095         Improve gdk build compiler flags (show warning, no rtti and exceptions).
7096
7097         * jscore.bkl:
7098
7099 2006-10-06  Kevin McCullough  <KMcCullough@apple.com>
7100
7101         Reviewed by Brady.
7102
7103         DST and TimeZones were wrong in some cases, specifically on some of the dates where DST changes.
7104
7105         * kjs/DateMath.cpp:
7106         (KJS::equivalentYearForDST):
7107         (KJS::getUTCOffset):
7108         (KJS::getDSTOffsetSimple):
7109         (KJS::getDSTOffset):
7110         (KJS::dateToMseconds):
7111         (KJS::msToTM):
7112         * kjs/DateMath.h:
7113         * kjs/date_object.cpp:
7114         (KJS::gmtoffset):
7115
7116 2006-10-05  Darin Adler  <darin@apple.com>
7117
7118         Reviewed by Kevin McCullough.
7119
7120         * wtf/Assertions.cpp: Fix build when _DEBUG is not defined.
7121
7122 2006-10-04  Kevin McCullough  <KMcCullough@apple.com>
7123
7124         Reviewed by Adam.
7125
7126         - Removed an unnecessary assert that was stopping many pages.  tm_gmtoff was not set for UTC time in mozilla but is always set for us.
7127
7128         * kjs/DateMath.cpp:
7129         (KJS::getUTCOffset):
7130         (KJS::msToTM):
7131         * kjs/date_object.cpp:
7132         (KJS::gmtoffset):
7133         (KJS::formatTime):
7134
7135 2006-10-04  Geoffrey Garen  <ggaren@apple.com>
7136
7137         Patch by Darin and me, reviewed by Maciej.
7138
7139         Fixed <rdar://problem/4518397> REGRESSION(?): Oft-seen but unrepro crash 
7140               in JavaScript garbage collection (KJS::Collector::collect())
7141                <rdar://problem/4752492> Crash in KJS::collect
7142               
7143         The issue here was allocating one garbage-collected object in the midst 
7144         of allocating a second garbage-collected object. In such a case, the
7145         zeroIfFree word lies.
7146
7147         * kjs/collector.cpp:
7148         (KJS::Collector::allocate):
7149         (KJS::Collector::collect):
7150
7151 2006-10-04  Kevin McCullough  <KMcCullough@apple.com>
7152
7153         Reviewed by Adam.
7154
7155         - Layout test fix
7156
7157         * kjs/DateMath.cpp:
7158         (KJS::dateToDayInYear): accept and correctly handle negative months
7159
7160 2006-10-05  Kevin McCullough  <KMcCullough@apple.com>
7161
7162        build fix
7163
7164         * kjs/DateMath.cpp:
7165         (KJS::dateToDayInYear):
7166
7167 2006-10-05  Mark Rowe  <bdash@webkit.org>
7168
7169         Reviewed by maculloch.
7170
7171         Gdk build fix.
7172
7173         * JavaScriptCoreSources.bkl: Add DateMath.cpp to file list.
7174
7175 2006-10-05  Kevin McCullough  <KMcCullough@apple.com>
7176
7177         Reviewed by aroben
7178
7179         - build fix
7180
7181         * JavaScriptCore.xcodeproj/project.pbxproj:
7182
7183 2006-10-04  Nikolas Zimmermann  <zimmermann@kde.org>
7184
7185         Reviewed by Mitz.
7186
7187         Fix Qt/Linux build by adding DateMath.cpp to compilation.
7188
7189         * CMakeLists.txt: Also replace tabs with spaces.
7190
7191 2006-10-04  Kevin McCullough  <KMcCullough@apple.com>
7192
7193         Reviewed by DethBakin.
7194
7195         - Apparently the build bot uses an older version of XCode which warns about conversions and the newest version does not.  I hope this fixes the build but I cann't be sure on my system.
7196
7197         * kjs/DateMath.cpp:
7198         (KJS::msToYear):
7199         (KJS::dayInYear):
7200         (KJS::dateToDayInYear):
7201
7202 2006-10-05  Darin Adler  <darin@apple.com>
7203
7204         Reviewed by Adam.
7205
7206         * wtf/Assertions.cpp: Changed assertion formatting to omit the "======"
7207         lines so you can see more assertions in less space. Also improved format
7208         of file/line information so it works with more development environments.
7209
7210 2006-10-04  Kevin McCullough  <KMcCullough@apple.com>
7211
7212         Reviewed by Tim H.
7213
7214         - The build machine is more sensitive about automatic conversions.  These fixes exp
7215 licitly cast or change the input and return types of functions to avoid conversions.
7216
7217         * JavaScriptCore.xcodeproj/project.pbxproj:
7218         * kjs/DateMath.cpp:
7219         (KJS::):
7220         (KJS::msToDays):
7221         (KJS::msToYear):
7222         (KJS::dayInYear):
7223         (KJS::monthToDayInYear):
7224         (KJS::dateToDayInYear):
7225         (KJS::getDSTOffsetSimple):
7226         (KJS::getDSTOffset):
7227         (KJS::dateToMseconds):
7228         (KJS::msToTM):
7229
7230 2006-10-04  Kevin McCullough  <KMcCullough@apple.com>
7231
7232         Reviewed by GGaren
7233
7234         - This is a big makeover for our Date implemenetation.  This solves many platform specific issues, specifically dates before 1970, and simplifies some ugly code.  The purpose of this was to get us to pass many of the JavaScriptCore tests on windows.
7235
7236         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7237         * JavaScriptCore.xcodeproj/project.pbxproj:
7238         * kjs/DateMath.cpp: Added.
7239         (KJS::):
7240         (KJS::daysInYear):
7241         (KJS::daysFrom1970ToYear):
7242         (KJS::msFrom1970ToYear):
7243         (KJS::msToDays):
7244         (KJS::msToYear):
7245         (KJS::isLeapYear):
7246         (KJS::isInLeapYear):
7247         (KJS::dayInYear):
7248         (KJS::msToMilliseconds):
7249         (KJS::msToWeekDay):
7250         (KJS::msToSeconds):
7251         (KJS::msToMinutes):
7252         (KJS::msToHours):
7253         (KJS::msToMonth):
7254         (KJS::msToDayInMonth):
7255         (KJS::monthToDayInYear):
7256         (KJS::timeToMseconds):
7257         (KJS::dateToDayInYear):
7258         (KJS::equivalentYearForDST):
7259         (KJS::getUTCOffset):
7260         (KJS::getDSTOffsetSimple):
7261         (KJS::getDSTOffset):
7262         (KJS::localTimeToUTC):
7263         (KJS::UTCToLocalTime):
7264         (KJS::dateToMseconds):
7265         (KJS::msToTM):
7266         (KJS::isDST):
7267         * kjs/DateMath.h: Added.
7268         (KJS::):
7269         * kjs/date_object.cpp:
7270         (KJS::gmtoffset):
7271         (KJS::formatTime):
7272         (KJS::DateInstance::getTime):
7273         (KJS::DateInstance::getUTCTime):
7274         (KJS::DateProtoFunc::callAsFunction):
7275         (KJS::DateObjectImp::construct):
7276         (KJS::DateObjectFuncImp::callAsFunction):
7277         (KJS::parseDate):
7278         * kjs/testkjs.cpp:
7279         * os-win32/stdint.h:
7280
7281 2006-10-02  Nikolas Zimmermann  <zimmermann@kde.org>
7282
7283         Reviewed/landed by Adam.
7284
7285         Build testkjs on Qt/Linux.
7286
7287         * CMakeLists.txt:
7288
7289 2006-10-02  Nikolas Zimmermann  <zimmermann@kde.org>
7290
7291         Reviewed by eseidel.  Landed by eseidel.
7292
7293         Fix win32 build, which has no inttypes.h
7294
7295         * wtf/Assertions.h:
7296
7297 2006-10-02  Nikolas Zimmermann <zimmermann@kde.org>
7298
7299         Reviewed by eseidel & mjs.  Landed by eseidel.
7300
7301         Fix Qt/Linux build with older gcc 3.3.4.
7302         http://bugs.webkit.org/show_bug.cgi?id=11116
7303  
7304         * kjs/lookup.h: Move cacheGlobalObject into KJS namespace.
7305         (KJS::cacheGlobalObject): Also remove GCC_ROOT_NS_HACK.
7306         * wtf/Assertions.h: Include inttypes.h for uintptr_t.
7307
7308 2006-09-28  Steve Falkenburg  <sfalken@apple.com>
7309
7310         Reviewed by Maciej.
7311         
7312         Use $(ConfigSuffix) set via vsprops files to add _debug
7313         to end of debug filenames.
7314
7315         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7316         * JavaScriptCore.vcproj/debug.vsprops: Added.
7317         * JavaScriptCore.vcproj/dftables/dftables.vcproj:
7318         * JavaScriptCore.vcproj/release.vsprops: Added.
7319         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
7320
7321 2006-09-28  Darin Adler  <darin@apple.com>
7322
7323         Reviewed by Alice.
7324
7325         - support for change that should fix <rdar://problem/4733044>
7326           REGRESSION: XML iBench shows 10% perf. regression (copying
7327           strings while decoding)
7328
7329         * wtf/Vector.h: Changed VectorBuffer so that the general case
7330         contains an instance of the 0 case, since deriving from it
7331         was violating the Liskov Substitution Principle.
7332         (WTF::VectorBuffer::releaseBuffer): Added. Releases the buffer so it can
7333         be adopted by another data structure that uses the FastMalloc.h allocator.
7334         Returns 0 if the internal buffer was being used.
7335         (WTF::Vector::releaseBuffer): Added. Releases the buffer as above or creates
7336         a new one in the case where the internal buffer was being used.
7337
7338 2006-09-28  Maciej Stachowiak  <mjs@apple.com>
7339
7340         Reviewed by Geoff.
7341         
7342         - change garbage collection to happen at increments proportional to number of live objects, not always
7343         every 1000 allocations
7344
7345         * kjs/collector.cpp:
7346         (KJS::Collector::allocate):
7347
7348 2006-09-28  Maciej Stachowiak  <mjs@apple.com>
7349
7350         Reviewed by Mitz.
7351
7352         - fixed REGRESSION (r16606): javascriptCore Crash on website load
7353         
7354         Plus style fixes.
7355         
7356             - fixed some possible off-by-one bugs
7357             - use indexing, not iterators, for Vectors
7358             - store Vector by pointer instead of by value to avoid blowing out FunctionImp size
7359         
7360         * kjs/function.cpp:
7361         (KJS::FunctionImp::addParameter):
7362         (KJS::FunctionImp::parameterString):
7363         (KJS::FunctionImp::processParameters):
7364         (KJS::FunctionImp::lengthGetter):
7365         (KJS::FunctionImp::getParameterName):
7366         * kjs/function.h:
7367
7368 2006-09-27  Steve Falkenburg  <sfalken@apple.com>
7369
7370         Reviewed by Maciej.
7371         
7372         More build tweaks
7373
7374         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7375         * JavaScriptCore.vcproj/JavaScriptCore/dstroot-to-sdk.cmd: Removed.
7376
7377 2006-09-27  John Sullivan  <sullivan@apple.com>
7378
7379         * kjs/function.cpp:
7380         (KJS::FunctionImp::getParameterName):
7381         removed assertion that displeased gcc 4.0.1 (build 5420):
7382         ASSERT(static_cast<size_t>(index) == index);
7383
7384 2006-09-27  Kevin McCullough  <KMcCullough@apple.com>
7385
7386         Reviewed by GGaren.
7387
7388         Cleanup of previous fix which was to address Radar: 4752492
7389
7390         * kjs/function.cpp:
7391         (KJS::FunctionImp::addParameter):
7392         (KJS::FunctionImp::parameterString):
7393         (KJS::FunctionImp::processParameters):
7394         (KJS::FunctionImp::lengthGetter):
7395         (KJS::FunctionImp::getParameterName):
7396         * kjs/function.h:
7397
7398 2006-09-27  Kevin McCullough  <KMcCullough@apple.com>
7399
7400         Reviewed by Adele.
7401
7402         Fixes a GC stack overflow crash.
7403         The change is to move from a linked list implementation of Parameters to a Vector.
7404         The problem with the linked list is that each one creates it's own stack frame when being destroyed and in extreme cases this caused the stack to overflow. 
7405
7406         * kjs/function.cpp:
7407         (KJS::Parameter::Parameter):
7408         (KJS::FunctionImp::addParameter):
7409         (KJS::FunctionImp::parameterString):
7410         (KJS::FunctionImp::processParameters):
7411         (KJS::FunctionImp::lengthGetter):
7412         (KJS::FunctionImp::getParameterName):
7413         * kjs/function.h:
7414
7415 2006-09-27  Steve Falkenburg  <sfalken@apple.com>
7416
7417         Fix last path fix.
7418
7419         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7420
7421 2006-09-27  Steve Falkenburg  <sfalken@apple.com>
7422
7423         Set path before build.
7424
7425         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7426
7427 2006-09-27  Sean Gies  <seangies@apple.com>
7428
7429         Reviewed by Adam Roben.
7430
7431         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Debug config should link to debug runtime.
7432         * JavaScriptCore.vcproj/dftables/dftables.vcproj: Debug config should link to debug runtime.
7433
7434 2006-09-27  Don Melton  <gramps@apple.com>
7435
7436         Reviewed by Adam Roben.
7437
7438         Changed line ending from DOS to UNIX format so it doesn't die running
7439         on my machine. ;)
7440
7441         * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
7442
7443 2006-09-23  Alexey Proskuryakov  <ap@nypop.com>
7444
7445         Reviewed by Maciej.
7446
7447         http://bugs.webkit.org/show_bug.cgi?id=10183
7448         REGRESSION: obfuscated JS decoding breaks because of soft hyphen removal
7449         (Fanfiction.net author pages not listing stories)
7450
7451         Rolled out the fix for bug 4139.
7452
7453         * kjs/lexer.cpp:
7454         (Lexer::setCode):
7455         (Lexer::shift):
7456         * tests/mozilla/ecma/Array/15.4.5.1-1.js:
7457         * tests/mozilla/expected.html:
7458
7459 2006-09-22  Steve Falkenburg  <sfalken@apple.com>
7460
7461         Build fix.
7462
7463         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7464
7465 2006-09-22  Darin Adler  <darin@apple.com>
7466
7467         Reviewed by Alice.
7468
7469         * wtf/Vector.h: Add an append that takes a pointer and length.
7470         Generalize the existing Vector append to work on vectors with
7471         any value for inlineCapacity. Change the append algorithm so
7472         it doesn't check capacity each time through the loop.
7473
7474 2006-09-22  Steve Falkenburg  <sfalken@apple.com>
7475
7476         Fix release build.
7477
7478         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7479
7480 2006-09-21  Geoffrey Garen  <ggaren@apple.com>
7481
7482         Reviewed by Maciej.
7483
7484         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7485         Updated to include the right path.
7486         * wtf/FastMalloc.h: #include Platform.h, since we use Platform macros.
7487
7488 === Safari-521.27 ===
7489
7490 2006-09-20  Anders Carlsson  <acarlsson@apple.com>
7491
7492         Reviewed by Dave Hyatt.
7493
7494         * wtf/MathExtras.h:
7495         Get rid of lrint.
7496
7497 2006-09-20  Sean Gies  <seangies@apple.com>
7498
7499         Reviewed by Steve Falkenburg.
7500
7501         * wtf/Assertions.cpp: Debug messages should go into debugger console.
7502
7503 2006-09-20  David Hyatt  <hyatt@apple.com>
7504
7505         Add an implementation of lrint for Win32.
7506
7507         Reviewed by anders
7508
7509         * wtf/MathExtras.h:
7510         (lrint):
7511
7512 2006-09-15  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
7513
7514         Reviewed by Adam.
7515
7516         http://bugs.webkit.org/show_bug.cgi?id=10864
7517         Bug 10864: Linux\GDK build fixes
7518
7519         * JavaScriptCoreSources.bkl:
7520         * jscore.bkl:
7521
7522 2006-09-15  Adam Roben  <aroben@apple.com>
7523
7524         Windows build fix.
7525
7526         * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
7527
7528 2006-09-15  Anders Carlsson  <acarlsson@apple.com>
7529
7530         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7531         Fix the release build.
7532
7533 2006-09-15  Anders Carlsson  <acarlsson@apple.com>
7534
7535         Reviewed by Steve.
7536
7537         Add JavaScriptCore API to the build.
7538         * API/JSBase.cpp:
7539         * API/JSCallbackConstructor.cpp:
7540         * API/JSCallbackFunction.cpp:
7541         * API/JSCallbackObject.cpp:
7542         * API/JSClassRef.cpp:
7543         * API/JSContextRef.cpp:
7544         * API/JSObjectRef.cpp:
7545         * API/JSStringRef.cpp:
7546         * API/JSValueRef.cpp:
7547         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7548         * os-win32/stdbool.h: Added.
7549
7550 2006-09-12  Steve Falkenburg  <sfalken@apple.com>
7551
7552         Reviewed by Ada.
7553         
7554         Build tweaks (doing JavaScriptCore now since it doesn't have
7555         dependencies).
7556
7557         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7558         * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
7559         * JavaScriptCore.vcproj/JavaScriptCore/dstroot-to-sdk.cmd: Added.
7560         * JavaScriptCore.vcproj/dftables/dftables.vcproj:
7561         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
7562
7563 2006-09-11  Brady Eidson  <beidson@apple.com>
7564
7565         Build fix - I think Tim's last checkin wasn't tested on Tiger, possibly.  I simply
7566         commented out the undefined constants until he can have a chance to make the right call
7567
7568         * bindings/objc/objc_utility.mm:
7569         (KJS::Bindings::objcValueTypeForType): Commented out undefined symbols
7570
7571 2006-09-11  Timothy Hatcher  <timothy@apple.com>
7572
7573         Reviewed by Tim O. and Darin.
7574
7575         Add support for more method signatures affecting ObjC methods called from JavaScript:
7576         - Added unsigned types and long long.
7577         - Allow methods that use const, oneway, bycopy and byref type modifiers.
7578
7579         * bindings/objc/objc_instance.mm:
7580         (ObjcInstance::invokeMethod):
7581         * bindings/objc/objc_utility.h:
7582         (KJS::Bindings::):
7583         * bindings/objc/objc_utility.mm:
7584         (KJS::Bindings::convertValueToObjcValue):
7585         (KJS::Bindings::convertObjcValueToValue):
7586         (KJS::Bindings::objcValueTypeForType):
7587
7588 2006-09-05  Timothy Hatcher  <timothy@apple.com>
7589
7590         Reviewed by Tim O.
7591
7592         <rdar://problem/4715840> SEL is not char*
7593
7594         * bindings/objc/objc_class.mm:
7595         (KJS::Bindings::ObjcClass::methodsNamed): use sel_getName instead of a char* cast.
7596         * bindings/objc/objc_runtime.mm:
7597         (ObjcFallbackObjectImp::callAsFunction): ditto
7598
7599 2006-09-03  Alexey Proskuryakov  <ap@nypop.com>
7600
7601         Reviewed by Tim H.
7602
7603         http://bugs.webkit.org/show_bug.cgi?id=10693
7604         Convert JavaScript arrays to AppleScript lists
7605
7606         * JavaScriptCore.exp: Export ArrayInstance::info and ArrayInstance::getItem().
7607         * kjs/array_instance.h:
7608         * kjs/array_object.cpp:
7609         (ArrayInstance::getItem): Added a method to access array items from C++.
7610
7611 2006-09-02  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
7612
7613         Reviewed by Tim H.
7614
7615         Bug 10454: Unix bakefile fixes
7616         http://bugs.webkit.org/show_bug.cgi?id=10454
7617
7618         * JavaScriptCoreSources.bkl:
7619
7620 2006-09-01  Nikolas Zimmermann  <zimmermann@kde.org>
7621
7622         Reviewed by hyatt.  Landed by eseidel.
7623
7624         Fix build on Linux.
7625
7626         * pcre/CMakeLists.txt: Add wtf/ include.
7627
7628 2006-09-01  Nikolas Zimmermann  <zimmermann@kde.org>
7629
7630         Reviewed and landed by ap.
7631
7632         Fix build on Linux (C89 without gcc extensions enabled).
7633
7634         * pcre/pcre_internal.h: Use C style comments.
7635         * wtf/Assertions.h: Use C style comments.
7636         * wtf/Platform.h: Use C style comments.
7637
7638 2006-09-01  Steve Falkenburg  <sfalken@apple.com>
7639
7640         Fix build.
7641
7642         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7643         * JavaScriptCore.vcproj/dftables/dftables.vcproj:
7644
7645 2006-08-31  Anders Carlsson  <acarlsson@apple.com>
7646
7647         Reviewed by Darin.
7648         
7649         Add new portability functions to MathExtras.h and add StringExtras.h which is for
7650         string portability functions.
7651         
7652         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7653         * bindings/c/c_instance.cpp:
7654         * kjs/date_object.cpp:
7655         * wtf/MathExtras.h:
7656         (copysign):
7657         (isfinite):
7658         * wtf/StringExtras.h: Added.
7659         (snprintf):
7660         (strncasecmp):
7661
7662 2006-08-31  Anders Carlsson  <acarlsson@apple.com>
7663
7664         Reviewed by Tim H.
7665         
7666         Fix Windows build.
7667         
7668         * JavaScriptCore.vcproj/dftables/dftables.vcproj:
7669         * pcre/pcre_internal.h:
7670
7671 2006-08-31  Timothy Hatcher  <timothy@apple.com>
7672
7673         Reviewed by Geoff.
7674
7675         Band-aid fix for PCRE to compile for ppc64 and x86_64 now that
7676         we use -Wshorten-64-to-32. Adds an INT_CAST macro that ASSERTs
7677         the value <= INT_MAX.
7678
7679         I filed <rdar://problem/4712064> to track the need to verify
7680         PCRE's 64-bit compliance.
7681
7682         * pcre/pcre_compile.c:
7683         (complete_callout):
7684         (compile_branch):
7685         (compile_regex):
7686         (pcre_compile2):
7687         * pcre/pcre_exec.c:
7688         (match):
7689         (pcre_exec):
7690         * pcre/pcre_get.c:
7691         (pcre_get_substring_list):
7692         * pcre/pcre_internal.h:
7693         * pcre/pcre_tables.c:
7694         * pcre/pcre_try_flipped.c:
7695         (_pcre_try_flipped):
7696
7697 2006-08-30  Darin Adler  <darin@apple.com>
7698
7699         Reviewed by Tim Hatcher.
7700
7701         - add WTF::getPtr, a function template that makes it possible to write
7702           generic code that gets a raw pointer out of any of our pointer types
7703
7704         * JavaScriptCore.xcodeproj/project.pbxproj:
7705         * wtf/GetPtr.h: Added.
7706         * wtf/ListRefPtr.h: (WTF::getPtr): Added.
7707         * wtf/OwnArrayPtr.h: (WTF::getPtr): Added.
7708         * wtf/OwnPtr.h: (WTF::getPtr): Added.
7709         * wtf/PassRefPtr.h: (WTF::getPtr): Added.
7710         * wtf/RefPtr.h: (WTF::getPtr): Added.
7711
7712 2006-08-29  waylonis  <waylonis@google.com>
7713
7714         Reviewed, tweaked by ggaren.
7715
7716         - Added storage and accessor functions for ExecState as a fix for
7717           http://bugs.webkit.org/show_bug.cgi?id=10114
7718         
7719         * kjs/ExecState.cpp:
7720         (KJS::ExecState::ExecState):
7721         * kjs/ExecState.h:
7722         * kjs/context.h:
7723         (KJS::Context::setExecState):
7724         (KJS::Context::execState):
7725
7726 2006-08-30  Nikolas Zimmermann  <zimmermann@kde.org>
7727
7728         Reviewed by Tim H.
7729
7730         Commit KDE related tweaks, to be able to
7731         differentiate between a Qt-only or a KDE build.
7732
7733         * CMakeLists.txt: Install wtf-unity library.
7734         * wtf/Platform.h: Add define for the KDE platform.
7735
7736 2006-08-28  Darin Adler  <darin@apple.com>
7737
7738         Reviewed by Geoff.
7739
7740         * kjs/list.h: Use explicit in constructor (as appropriate).
7741
7742 2006-08-24  Nikolas Zimmermann  <zimmermann@kde.org>
7743
7744         Reviewed, tweaked and landed by ap
7745
7746         http://bugs.webkit.org/show_bug.cgi?id=10467
7747         WebKit should have Qt platform support (Part II)
7748
7749         * CMakeLists.txt: Adjust to Anders' build fixes.
7750         * wtf/Platform.h: Fix define for the Qt platform (we don't use/need Cairo.)
7751
7752 2006-08-23  David Hyatt  <hyatt@apple.com>
7753
7754         Fix Platform.h to include #defines for graphics features.
7755
7756         Reviewed by darin
7757
7758         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7759         * wtf/Platform.h:
7760
7761 2006-08-23  Anders Carlsson  <acarlsson@apple.com>
7762
7763         Reviewed by Darin.
7764
7765         Make the bindings compile without CoreFoundation.
7766         
7767         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7768         * bindings/c/c_instance.cpp:
7769         * bindings/c/c_utility.cpp:
7770         (KJS::Bindings::convertUTF8ToUTF16):
7771         * bindings/npapi.h:
7772         * bindings/runtime.cpp:
7773         (KJS::Bindings::Instance::createBindingForLanguageInstance):
7774         (KJS::Bindings::Instance::createLanguageInstanceForValue):
7775         * bindings/runtime_root.cpp:
7776         * bindings/runtime_root.h:
7777         * kjs/interpreter.cpp:
7778         (KJS::Interpreter::createLanguageInstanceForValue):
7779         * kjs/interpreter.h:
7780
7781 2006-08-22  Anders Carlsson  <acarlsson@apple.com>
7782
7783         Reviewed by Darin.
7784
7785         Move the npruntime code over to using HashMap and the runtime_root code over to using 
7786         HashMap and HashCountedSet.
7787         
7788         * bindings/NP_jsobject.cpp:
7789         * bindings/c/c_utility.cpp:
7790         (KJS::Bindings::identifierFromNPIdentifier):
7791         * bindings/c/c_utility.h:
7792         * bindings/jni/jni_jsobject.cpp:
7793         (JavaJSObject::invoke):
7794         * bindings/npruntime.cpp:
7795         (getStringIdentifierMap):
7796         (getIntIdentifierMap):
7797         (_NPN_GetStringIdentifier):
7798         (_NPN_GetIntIdentifier):
7799         * bindings/runtime_root.cpp:
7800         (getReferencesByRootMap):
7801         (getReferencesSet):
7802         (KJS::Bindings::findReferenceSet):
7803         (KJS::Bindings::rootForImp):
7804         (KJS::Bindings::rootForInterpreter):
7805         (KJS::Bindings::addNativeReference):
7806         (KJS::Bindings::removeNativeReference):
7807         (RootObject::removeAllNativeReferences):
7808         * bindings/runtime_root.h:
7809
7810 2006-08-22  Anders Carlsson  <acarlsson@apple.com>
7811
7812         Reviewed by Geoff.
7813         
7814         Switch over the NPAPI and Java bindings to using HashMaps instead of dictionaries.
7815         
7816         * JavaScriptCore.xcodeproj/project.pbxproj:
7817         * bindings/c/c_class.cpp:
7818         (KJS::Bindings::CClass::CClass):
7819         (KJS::Bindings::CClass::~CClass):
7820         (KJS::Bindings::CClass::classForIsA):
7821         (KJS::Bindings::CClass::methodsNamed):
7822         (KJS::Bindings::CClass::fieldNamed):
7823         * bindings/c/c_class.h:
7824         * bindings/jni/jni_class.cpp:
7825         (JavaClass::JavaClass):
7826         (JavaClass::~JavaClass):
7827         (JavaClass::methodsNamed):
7828         (JavaClass::fieldNamed):
7829         * bindings/jni/jni_class.h:
7830         * bindings/objc/objc_class.h:
7831         * bindings/objc/objc_class.mm:
7832         (KJS::Bindings::deleteMethod):
7833         (KJS::Bindings::deleteField):
7834         (KJS::Bindings::):
7835         (KJS::Bindings::ObjcClass::methodsNamed):
7836         (KJS::Bindings::ObjcClass::fieldNamed):
7837         * bindings/runtime.cpp:
7838         * bindings/runtime.h:
7839         * bindings/runtime_object.cpp:
7840         (RuntimeObjectImp::fieldGetter):
7841         (RuntimeObjectImp::getOwnPropertySlot):
7842         (RuntimeObjectImp::put):
7843         (RuntimeObjectImp::canPut):
7844
7845 2006-08-21  Vladimir Olexa  <vladimir.olexa@gmail.com>
7846
7847         Reviewed by Darin.
7848
7849         http://bugs.webkit.org/show_bug.cgi?id=6252
7850         JavaScript 1.6 Array.lastIndexOf
7851
7852         Test: fast/js/array-lastIndexOf.html
7853
7854         * kjs/array_object.cpp:
7855         (ArrayProtoFunc::callAsFunction): Added a LastIndexOf case.
7856         * kjs/array_object.h:
7857         (KJS::ArrayProtoFunc::): Added LastIndexOf to enum.
7858         * tests/mozilla/expected.html: Two more tests now pass.
7859
7860 2006-08-20  Nikolas Zimmermann  <zimmermann@kde.org>
7861
7862         Reviewed by Maciej. Landed by rwlbuis.
7863
7864         Fixes parts of: http://bugs.webkit.org/show_bug.cgi?id=10463
7865         WebKit should have Qt platform support
7866
7867         Removing obsolete QConstString/QString constructors in kjs code.
7868
7869         * kjs/identifier.h:
7870         * kjs/ustring.h:
7871
7872 2006-08-17  Nikolas Zimmermann  <zimmermann@kde.org>
7873
7874         Reviewed by Maciej. Landed by rwlbuis.
7875
7876         Fixes: http://bugs.webkit.org/show_bug.cgi?id=10463
7877         WTF Changes needed for Qt platform code.
7878
7879         * wtf/Platform.h:
7880         * wtf/unicode/UnicodeDecomposition.h: Added.
7881         (WTF::Unicode::):
7882         * wtf/unicode/UnicodeDirection.h: Added.
7883         (WTF::Unicode::):
7884         * wtf/unicode/qt4/UnicodeQt4.cpp: Added.
7885         (WTF::Unicode::direction):
7886         (WTF::Unicode::category):
7887         (WTF::Unicode::decomposition):
7888         * wtf/unicode/qt4/UnicodeQt4.h:
7889         (WTF::Unicode::toLower):
7890         (WTF::Unicode::toUpper):
7891         (WTF::Unicode::isPrintableChar):
7892         (WTF::Unicode::isSpace):
7893         (WTF::Unicode::isPunct):
7894         (WTF::Unicode::isDigit):
7895         (WTF::Unicode::mirroredChar):
7896         (WTF::Unicode::compare):
7897
7898 2006-08-17  Nikolas Zimmermann  <zimmermann@kde.org>
7899
7900         Reviewed by Eric. Landed by rwlbuis.
7901
7902         Fixes: http://bugs.webkit.org/show_bug.cgi?id=10464
7903         Offer a cmake build system for Qt platform.
7904
7905         * CMakeLists.txt: Added.
7906         * pcre/CMakeLists.txt: Added.
7907
7908 2006-08-17  Anders Carlsson  <acarlsson@apple.com>
7909
7910         Reviewed by Maciej.
7911
7912         * bindings/npapi.h:
7913         Fix ifdef.
7914
7915 2006-08-15  Steve Falkenburg  <sfalken@apple.com>
7916
7917         Reviewed by mjs.
7918         
7919         Build fix.
7920
7921         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7922         * wtf/Assertions.h:
7923
7924 2006-08-15  Mark Rowe  <opendarwin.org@bdash.net.nz>
7925
7926         Reviewed by Tim H.
7927
7928         Build fix:  DWARF and -gfull are incompatible with symbol separation.
7929
7930         * JavaScriptCore.xcodeproj/project.pbxproj:
7931
7932 2006-08-15  Mark Rowe  <opendarwin.org@bdash.net.nz>
7933
7934         Reviewed by Tim H.
7935
7936         http://bugs.webkit.org/show_bug.cgi?id=10394
7937         Bug 10394: WebKit Release and Production configurations should enable dead code stripping
7938
7939         * JavaScriptCore.xcodeproj/project.pbxproj:
7940
7941 2006-08-15  Mark Rowe  <opendarwin.org@bdash.net.nz>
7942
7943         Reviewed by Tim H.
7944
7945         http://bugs.webkit.org/show_bug.cgi?id=10384
7946         Bug 10384: Switch to DWARF for Release configuration
7947
7948         * JavaScriptCore.xcodeproj/project.pbxproj:
7949
7950 2006-08-13  Maks Orlovich  <maksim@kde.org>
7951
7952         Reviewed (and tweaked a little) by Maciej.
7953         
7954         - shrank the size of JSObject by 8 bytes and made the corresponding reduction to the cell size, resulting
7955         in a 1.2% speed improvement on JS iBench (and probably overall memory savings).
7956
7957         This was done by removing _scope and _internalValue data members
7958         from JSObject and moving them only to the subclasses that actually
7959         make use of them.
7960         
7961         * kjs/object.cpp: 
7962         (KJS::JSObject::mark): No need to mark scope or internal value here.
7963         * kjs/object.h:
7964         (KJS::JSObject::JSObject): Don't initialize them.
7965         * kjs/JSWrapperObject.cpp: Added. New base class for object types that
7966         wrap primitive values (Number, String, Boolean, Date).
7967         (KJS::JSWrapperObject::mark): 
7968         * kjs/JSWrapperObject.h: Added.
7969         (KJS::JSWrapperObject::JSWrapperObject):
7970         (KJS::JSWrapperObject::internalValue):
7971         (KJS::JSWrapperObject::setInternalValue):
7972         * kjs/array_object.cpp:
7973         (ArrayPrototype::ArrayPrototype): Don't set useless internal value.
7974         * kjs/bool_object.cpp:
7975         (BooleanInstance::BooleanInstance): Inherit from JSWrapperObject.
7976         (BooleanProtoFunc::callAsFunction): Fixed to account for fact that not all
7977         JSObjects have an internal value.
7978         (BooleanObjectImp::construct): ditto.
7979         * kjs/bool_object.h:
7980         * kjs/collector.cpp: Lowered cell size to 48.
7981         (KJS::Collector::allocate): meaningless whitespace change
7982         * kjs/date_object.cpp:
7983         (KJS::DateInstance::DateInstance): Inherit from JSWrapperObject.
7984         (KJS::DateProtoFunc::callAsFunction): adjusted for move of internalValue
7985         (KJS::DateObjectImp::construct): ditto
7986         * kjs/date_object.h:
7987         * kjs/error_object.cpp:
7988         (ErrorPrototype::ErrorPrototype): don't set internal value
7989         * kjs/function.cpp: move _scope and related handling here
7990         (KJS::FunctionImp::mark): mark scope
7991         * kjs/function.h:
7992         (KJS::FunctionImp::scope): moved here from JSObject
7993         (KJS::FunctionImp::setScope): ditto
7994         * kjs/number_object.cpp:
7995         (NumberInstance::NumberInstance): inherit from JSWrapperObject
7996         (NumberProtoFunc::callAsFunction): adjusted
7997         (NumberObjectImp::construct): adjusted
7998         * kjs/number_object.h: shring RegExp-related objects a little
7999         * kjs/regexp_object.cpp:
8000         (RegExpPrototype::RegExpPrototype): Adjust for size tweaks
8001         (RegExpObjectImp::RegExpObjectImp): ditto
8002         * kjs/regexp_object.h:
8003         * kjs/string_object.cpp:
8004         (StringInstance::StringInstance): inherit from JSWrapperObject
8005         (StringProtoFunc::callAsFunction): adjusted
8006         * kjs/string_object.h:
8007         * JavaScriptCore.exp: Exported new methods as needed.
8008         * JavaScriptCore.xcodeproj/project.pbxproj: Added new files to build.
8009
8010 2006-08-04  Brady Eidson  <beidson@apple.com>
8011
8012         Reviewed by Geoff's rubber stamp
8013
8014         Fix a build break on Intel hardware causes by adapting stricter
8015         compiler warnings (-Wshorten-64-to-32)
8016
8017         * API/testapi.c:
8018         (assertEqualsAsNumber): manually cast some doubles to floats
8019         (main): ditto
8020
8021 2006-08-04  Sam Weinig  <sam.weinig@gmail.com>
8022
8023         Reviewed by Darin.
8024
8025         - patch for http://bugs.webkit.org/show_bug.cgi?id=10192
8026           Make WebCore (and friends) compile with -Wshorten-64-to-32
8027
8028           * Adds -Wshorten-64-to-32 flag to Xcode project.
8029           * Adds explicit casts where OK.
8030
8031         * API/JSNodeList.c:
8032         (JSNodeList_item):
8033         (JSNodeList_getProperty):
8034         * JavaScriptCore.xcodeproj/project.pbxproj:
8035
8036 2006-08-04  Adam Roben  <aroben@apple.com>
8037
8038         Reviewed by Anders.
8039
8040         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Convert
8041         spaces to tabs
8042
8043 2006-08-03  Sam Weinig  <sam.weinig@gmail.com>
8044
8045         Reviewed by Darin.
8046
8047         - patch for http://bugs.webkit.org/show_bug.cgi?id=10176
8048           Make WebCore compile with -Wundef
8049
8050           * Adds -Wundef flag to Xcode project
8051           * Converts #ifs to #ifdef and #ifndefs where needed.
8052           * Added #define YYMAXDEPTH 10000 in kjs/grammar.y
8053             to fix a warning from within Bison.
8054
8055         * JavaScriptCore.xcodeproj/project.pbxproj:
8056         * bindings/jni/jni_jsobject.cpp:
8057         (JavaJSObject::getSlot):
8058         (JavaJSObject::setSlot):
8059         * bindings/npapi.h:
8060         * bindings/objc/objc_class.mm:
8061         (KJS::Bindings::ObjcClass::methodsNamed):
8062         (KJS::Bindings::ObjcClass::fieldNamed):
8063         * bindings/objc/objc_instance.mm:
8064         (ObjcInstance::invokeMethod):
8065         * bindings/objc/objc_runtime.mm:
8066         (ObjcMethod::getMethodSignature):
8067         (ObjcField::name):
8068         (ObjcField::type):
8069         * kjs/grammar.y:
8070         * kjs/identifier.h:
8071
8072 2006-08-03  Anders Carlsson  <acarlsson@apple.com>
8073
8074         Reviewed by John Sullivan.
8075
8076        * wtf/HashSet.h:
8077         (WTF::::operator):
8078         Return *this in operator=
8079
8080 2006-08-03  Adam Roben  <aroben@apple.com>
8081
8082         Reviewed by Anders.
8083
8084         - Fixed Windows build
8085
8086         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
8087         * wtf/MathExtras.h: Implement inline versions of these functions
8088         (nextafter):
8089         (nextafterf):
8090
8091 2006-08-02  Adam Roben  <aroben@apple.com>
8092
8093         Reviewed by Darin.
8094
8095         - Fixed build
8096
8097         * kjs/date_object.cpp:
8098         (KJS::formatTime):
8099
8100 2006-07-29  Darin Adler  <darin@apple.com>
8101
8102         - Removed tabs from these source files that still had them.
8103           We don't use them; that way source files look fine in editors
8104           that have tabs set to 8 spaces or to 4 spaces.
8105         - Removed allow-tabs Subversion property from the files too.
8106
8107         * bindings/NP_jsobject.cpp:
8108         * bindings/c/c_utility.cpp:
8109         * bindings/jni/jni_runtime.cpp:
8110         * bindings/jni/jni_utility.cpp:
8111         * bindings/objc/objc_utility.mm:
8112         * bindings/runtime.cpp:
8113         * bindings/runtime_method.cpp:
8114         * bindings/testbindings.cpp:
8115         * bindings/testbindings.mm:
8116         * kjs/date_object.cpp:
8117         * kjs/function.cpp:
8118         * kjs/list.cpp:
8119         * kjs/nodes.cpp:
8120         * kjs/nodes.h:
8121         * kjs/string_object.cpp:
8122         * kjs/ustring.cpp:
8123
8124 2006-07-29  Darin Adler  <darin@apple.com>
8125
8126         * tests/mozilla/expected.html: Update test results now that regress-185165.js
8127         is succeeding. I suspect Anders fix for bug 4620655 is the reason.
8128
8129 2006-07-29  Sam Weinig  <sam.weinig@gmail.com>
8130
8131         Reviewed by Darin.
8132
8133         - patch for http://bugs.webkit.org/show_bug.cgi?id=10080
8134           Adopt pedantic changes from the Unity project to improve 
8135           cross-compiler compatibility
8136
8137           Changes include:
8138           * Removing trailing semicolon from namespace braces.
8139           * Removing trailing comma from last enum declaration.
8140           * Updating to match style guidelines.
8141           * Adding missing newline to the end of the file.
8142           * Turning on gcc warning for missing newline at the end of a source file
8143             (GCC_WARN_ABOUT_MISSING_NEWLINE in Xcode, -Wnewline in gcc).
8144           * Alphabetical sorting of Xcode source list files. 
8145           * Replace use of non-portable variable-size array with Vector.
8146           * Use C-style comments instead of C++ comments in files that might
8147             be included by either C or C++ files.
8148
8149         * API/JSCallbackConstructor.cpp:
8150         (KJS::JSCallbackConstructor::construct):
8151         * API/JSCallbackFunction.cpp:
8152         (KJS::JSCallbackFunction::callAsFunction):
8153         * API/JSCallbackObject.cpp:
8154         (KJS::JSCallbackObject::construct):
8155         (KJS::JSCallbackObject::callAsFunction):
8156         * JavaScriptCore.xcodeproj/project.pbxproj:
8157         * JavaScriptCorePrefix.h:
8158         * bindings/jni/jni_class.cpp:
8159         (JavaClass::fieldNamed):
8160         * bindings/jni/jni_class.h:
8161         * bindings/jni/jni_instance.cpp:
8162         (JavaInstance::JavaInstance):
8163         (JavaInstance::valueOf):
8164         * bindings/jni/jni_objc.mm:
8165         (KJS::Bindings::dispatchJNICall):
8166         * bindings/jni/jni_runtime.cpp:
8167         (JavaParameter::JavaParameter):
8168         (JavaArray::JavaArray):
8169         * bindings/jni/jni_runtime.h:
8170         * bindings/jni/jni_utility.h:
8171         * bindings/objc/objc_instance.h:
8172         * bindings/runtime_array.h:
8173         * kjs/collector.h:
8174         * kjs/config.h:
8175         * kjs/ustring.cpp:
8176         * wtf/Platform.h:
8177
8178 2006-07-29  Mike Emmel  <mike.emmel@gmail.com>
8179
8180         Reviewed by Darin.
8181
8182         - fixes for Linux build
8183
8184         * JavaScriptCoreSources.bkl: Added new files to build, kjs/PropertyNameArray.cpp
8185         and kjs/testkjs.cpp, and removed old files.
8186
8187 2006-07-24  Dan Waylonis  <waylonis@google.com>
8188
8189         Reviewed and tweaked a bit by Darin.
8190
8191         - fix http://bugs.webkit.org/show_bug.cgi?id=9902
8192           jsNull and NSNull not properly converted between JS and ObjC
8193
8194         * bindings/objc/objc_utility.mm: (KJS::Bindings::convertObjcValueToValue):
8195         Added case for converting NSNull to jsNull.
8196
8197 2006-07-24  Rob Buis  <buis@kde.org>
8198
8199         Reviewed by Darin.
8200
8201         http://bugs.webkit.org/show_bug.cgi?id=4258
8202         Date().toString() only includes GMT offset, not timezone string
8203
8204         Use the info in tm_zone to append timezone abbreviation
8205         to Date().toString().
8206
8207         * kjs/date_object.cpp:
8208         (KJS::formatTime):
8209
8210 2006-07-24  Rob Buis  <buis@kde.org>
8211
8212         Reviewed by Darin.
8213
8214         http://bugs.webkit.org/show_bug.cgi?id=5257
8215         setYear() does not match FireFox/IE behavior
8216
8217         Make sure the right values end up in tm_year.
8218
8219         * kjs/date_object.cpp:
8220         (KJS::formatTime):
8221
8222 2006-07-23  Mark Rowe  <opendarwin.org@bdash.net.nz>
8223
8224         Reviewed by Maciej.
8225
8226         Bug 9686: [Drosera] Need the ability to break into Drosera on Javascript exceptions
8227         http://bugs.webkit.org/show_bug.cgi?id=9686
8228
8229         JavaScriptCore portion of the fix.
8230
8231         * JavaScriptCore.exp: Update symbol for change in argument type.
8232         * kjs/debugger.cpp:
8233         (Debugger::detach): Clear map of recent exceptions.
8234         (Debugger::hasHandledException): Track the most recent exception
8235         thrown by an interpreter.
8236         (Debugger::exception): Change exception argument to a JSValue.
8237         * kjs/debugger.h:
8238         * kjs/nodes.cpp:
8239         (Node::debugExceptionIfNeeded): Notify the debugger of an exception
8240         if it hasn't seen it before.
8241         (ThrowNode::execute): Notify the debugger that an exception is being thrown.
8242         * kjs/nodes.h:
8243
8244     2006-07-23  Geoffrey Garen  <ggaren@apple.com>
8245
8246         Patch by Eric Albert, reviewed by Darin and me.
8247         
8248         - Fixed <rdar://problem/4645931> JavaScriptCore stack-scanning code 
8249         crashes (Collector::markStackObjectsConservatively)
8250         
8251         * bindings/jni/jni_jsobject.cpp: On 64bit systems, jint is a long, not an
8252         int.
8253         (JavaJSObject::getSlot):
8254         (JavaJSObject::setSlot):
8255         * kjs/collector.cpp:
8256         (KJS::Collector::markCurrentThreadConservatively): Use a pointer instead of
8257         an int as 'dummy,' because on LP64 systems, an int is not pointer-aligned,
8258         and we want to scan the stack for pointers.
8259         * JavaScriptCore.xcodeproj/project.pbxproj: After a tense cease-fire, the 
8260         XCode war has started up again!
8261
8262 === Safari-521.20 ===
8263
8264 2006-07-21  Geoffrey Garen  <ggaren@apple.com>
8265
8266         Reviewed by Darin.
8267
8268         <rdar://problem/4507265> REGRESSION: overlays don't work on HousingMaps.com (Google Maps-based site)
8269
8270         - Added support for strings that masquerade as undefined. Currently used
8271         by WebCore to implement undetectable style.filter.
8272         
8273         The name is a little long, but it's only used in one line of code, so I
8274         thought clarity should win over brevity.
8275
8276         * JavaScriptCore.exp:
8277         * JavaScriptCore.xcodeproj/project.pbxproj:
8278         * kjs/object.h:
8279         * kjs/string_object.h:
8280         (KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
8281         (KJS::StringInstanceThatMasqueradesAsUndefined::masqueradeAsUndefined):
8282         (KJS::StringInstanceThatMasqueradesAsUndefined::toBoolean):
8283
8284 === Safari-521.19 ===
8285
8286 2006-07-20  Steve Falkenburg  <sfalken@apple.com>
8287
8288         Fix the build
8289
8290         * kjs/function.cpp:
8291         (KJS::escapeStringForPrettyPrinting):
8292
8293 2006-07-19  Anders Carlsson  <acarlsson@apple.com>
8294
8295         Reviewed by Darin.
8296
8297         <rdar://problem/4620655> REGRESSION(10.4.7-10.5): preview button for a blogger.com post doesn't work
8298         
8299         * kjs/nodes2string.cpp:
8300         (StringNode::streamTo):
8301         Return the escaped string.
8302         
8303         (RegExpNode::streamTo):
8304         Use the correct syntax.
8305         
8306         * kjs/function.cpp:
8307         (KJS::escapeStringForPrettyPrinting):
8308         * kjs/function.h:
8309         Add escape function which escapes a string for pretty-printing so it can be parsed again.
8310         
8311         * wtf/unicode/icu/UnicodeIcu.h:
8312         (WTF::Unicode::isPrintableChar):
8313         New function.
8314
8315 2006-07-18  Maciej Stachowiak  <mjs@apple.com>
8316
8317         Reviewed by Adele Peterson.
8318         
8319         <rdar://problem/4589530> REGRESSION: null character in JS string causes parse error (works in Tiger and in other browsers)
8320
8321         * kjs/lexer.cpp:
8322         (Lexer::shift):
8323         (Lexer::lex):
8324         (Lexer::record16):
8325         (Lexer::scanRegExp):
8326         * kjs/lexer.h:
8327
8328 2006-07-18  Tim Omernick  <timo@apple.com>
8329
8330         Reviewed by Tim Hatcher.
8331
8332         Removed a misleading comment; we recently added support for the NPNVPluginElementNPObject
8333         variable.
8334
8335         * bindings/npapi.h:
8336
8337 === Safari-521.18 ===
8338
8339 2006-07-18  Timothy Hatcher  <timothy@apple.com>
8340
8341         Made the following headers public:
8342
8343         * JavaScriptCore.h
8344         * JSBase.h
8345         * JSContextRef.h
8346         * JSObjectRef.h
8347         * JSStringRef.h
8348         * JSValueRef.h
8349
8350         * JavaScriptCore.xcodeproj/project.pbxproj:
8351
8352 2006-07-17  Geoffrey Garen  <ggaren@apple.com>
8353
8354         Reviewed by Maciej.
8355         
8356         - Added automatic prototype creation for classes.
8357         
8358         A class stores a weak reference to a prototype, which is cleared when
8359         the prototype is garbage collected, to avoid a reference cycle.
8360         
8361         We now have an attributes field in JSClassDefinition, that currently is
8362         used only to override automatic prototype creation when you want to manage your
8363         own prototypes, but can be extended in the future for other nefarious purposes.
8364         
8365         Similarly, we have JSObjectMake and JSObjectMakeWithPrototype, the latter
8366         allowing you to manage your own prototypes.
8367         
8368         JSObjectMakeConstructor is more interesting now, able to make a constructor
8369         on your behalf if you just give it a class.
8370         
8371         - Removed bogus old code from minidom.js.
8372         
8373         - Tweaked the headerdocs.
8374         
8375         - Added more GC testing, which caught some leaks, and tested more funny 
8376         edge cases in lookup, which caught a lookup bug. Removed some testing 
8377         we used to do with MyObject because it was redundant with the new, cool 
8378         stuff.
8379         
8380         While fixing the lookup bug I retracted this change:
8381         
8382             "If a static setProperty callback returns 'false', to indicate that the
8383             property was not set, we no longer forward the set request up the class
8384             chain, because that's almost certainly not what the programmer expected."
8385
8386         Returning false when setting a static property is a little silly, but you can see
8387         it being useful when shadowing a base class's static properties, and, regardless
8388         of usefullness, this is the defined behavior of the setProperty callback.
8389         
8390         - Plus a little ASCII art, for the kids.
8391
8392 2006-07-17  Timothy Hatcher  <timothy@apple.com>
8393
8394         Reviewed by Maciej.
8395
8396         <rdar://problem/4634874> WebScriptObject and WebUndefined are no longer defined by WebKit
8397
8398         Moves WebScriptObject and WebUndefined up to WebCore.
8399         This change does create an upwards-dependancy on WebScriptObject existing
8400         in the loaded process, but this code path in JavaScriptCore does not get used
8401         unless it is through WebKit/WebCore. Moving all of the binding code out of
8402         JavaScriptCore might make sense in the future.
8403
8404         * JavaScriptCore.exp:
8405         * JavaScriptCore.xcodeproj/project.pbxproj:
8406         * bindings/objc/WebScriptObject.h: Replaced.
8407         * bindings/objc/WebScriptObject.mm: Removed.
8408         * bindings/objc/WebScriptObjectPrivate.h: Removed.
8409         * bindings/objc/objc_class.h:
8410         * bindings/objc/objc_instance.h:
8411         * bindings/objc/objc_instance.mm:
8412         (ObjcInstance::~ObjcInstance):
8413         * bindings/objc/objc_runtime.h:
8414         * bindings/objc/objc_runtime.mm:
8415         (convertValueToObjcObject):
8416         * bindings/objc/objc_utility.mm:
8417         (KJS::Bindings::convertValueToObjcValue):
8418         (KJS::Bindings::convertObjcValueToValue):
8419         (KJS::Bindings::createObjcInstanceForValue):
8420
8421 2006-07-17  Darin Adler  <darin@apple.com>
8422
8423         * API/JSBase.h: Fix comment formatting where things used to be lined up but
8424         are now ragged. Got rid of spaces that attempted to line things up.
8425         * API/JSObjectRef.h: Ditto. Also add missing periods for a couple of comments.
8426
8427 2006-07-17  Geoffrey Garen  <ggaren@apple.com>
8428
8429         Reviewed by Maciej.
8430         
8431         - Removed the exception parameter from the initialize callback and, by extension,
8432         JSObjectMake. We have never had a need for exceptions when iniitializing,
8433         so the parameter seemed likely to "get in the way." 
8434         
8435         Also, an exception in JavaScript is thrown in response to input -- 
8436         "invalid URL", "index not a number", etc., so it's the job of the 
8437         constructor function, not the initialize method, to throw.
8438         
8439         If initialize *really* wants to throw, it can communicate the throw to
8440         the constructor through the constructed object's private data (e.g., set
8441         it to NULL, signaling to the consntructor that initialization failed.)
8442         
8443         - Added JSObjectMakeWithData, which enables a constructor to set private
8444         data on an object *before* it has been initialized. That way, the initialize
8445         methods can properly operate on the data. 
8446
8447         * API/JSNode.c: Moved ref into the initialize method, for better encapsulation,
8448         now that it's possible.
8449         * API/JSNodeList.c: ditto
8450         * API/minidom.c:
8451         (main): Do more aggressive garbage collection to test ref/deref and 
8452         initialize/finalize.
8453         * API/minidom.js: store childNodes in a temporary so it doesn't get re-created
8454         like a thousand times. This makes debugging ref/deref easier
8455
8456 2006-07-17  Geoffrey Garen  <ggaren@apple.com>
8457
8458         Reviewed by Maciej.
8459         
8460         - Changed the initialize callback to run from least derived class (parent
8461         class) to most derived class. This enables C++ style initialization,
8462         and derived class overriding of member data.
8463         
8464         - Added excpetion propopgation to JSObjectMake, to support initialize
8465         exceptions, and generally round out our policy of making function
8466         signatures as long as possible.
8467
8468         * API/JSCallbackObject.h: Use ExecState instead of ContextRef, cuz we're
8469         in C++ land now.
8470
8471 2006-07-17  Geoffrey Garen  <ggaren@apple.com>
8472
8473         Reviewed by Maciej.
8474         
8475         - Changed JSObjectMakeConstructor to JSObjectMakeConstructorWithCallback,
8476         to match JSObjectMakeFunctionWithCallback.
8477         
8478         - Added prototype parameter, so the generated constructor
8479         automatically works with hasInstance / instanceof
8480         
8481         - Moved hasInstance implementation from InternalFunctionImp to JSObject
8482         so that subclasses can inherit it without inheriting function-related baggage.
8483         More refactoring here would be good, but this seems like a good short-term
8484         solution.
8485
8486         (KJS::JSCallbackFunction::implementsHasInstance): override and return false,
8487         because callback functions aren't constructors.
8488
8489 2006-07-17  Maciej Stachowiak  <mjs@apple.com>
8490
8491         Reviewed by Geoff.
8492         
8493         - add a JSContextRef parameter to all JSValueRef, JSObjectRef, and JSContextRef operations;
8494         except JSObject{Get,Set}PrivateData which can be assumed to be simple pure accessors.
8495         
8496         Also renamed the parameter "context" to "ctx" because it makes the code read better with this pervasive
8497         but usually uninteresting parameter.
8498
8499         * API/JSBase.cpp:
8500         (JSEvaluateScript):
8501         (JSCheckScriptSyntax):
8502         (JSGarbageCollect):
8503         * API/JSBase.h:
8504         * API/JSCallbackObject.cpp:
8505         (KJS::JSCallbackObject::JSCallbackObject):
8506         (KJS::JSCallbackObject::init):
8507         (KJS::JSCallbackObject::getOwnPropertySlot):
8508         (KJS::JSCallbackObject::put):
8509         (KJS::JSCallbackObject::deleteProperty):
8510         (KJS::JSCallbackObject::toNumber):
8511         (KJS::JSCallbackObject::toString):
8512         * API/JSContextRef.cpp:
8513         (JSGlobalContextCreate):
8514         (JSGlobalContextRetain):
8515         (JSGlobalContextRelease):
8516         (JSContextGetGlobalObject):
8517         * API/JSContextRef.h:
8518         * API/JSNode.c:
8519         (JSNodePrototype_appendChild):
8520         (JSNodePrototype_removeChild):
8521         (JSNodePrototype_replaceChild):
8522         (JSNode_getNodeType):
8523         (JSNode_getFirstChild):
8524         (JSNode_prototype):
8525         * API/JSNodeList.c:
8526         (JSNodeListPrototype_item):
8527         (JSNodeList_length):
8528         (JSNodeList_getProperty):
8529         (JSNodeList_prototype):
8530         * API/JSObjectRef.cpp:
8531         (JSObjectMake):
8532         (JSObjectMakeFunctionWithCallback):
8533         (JSObjectMakeConstructor):
8534         (JSObjectMakeFunction):
8535         (JSObjectGetPrototype):
8536         (JSObjectSetPrototype):
8537         (JSObjectHasProperty):
8538         (JSObjectGetProperty):
8539         (JSObjectSetProperty):
8540         (JSObjectGetPropertyAtIndex):
8541         (JSObjectSetPropertyAtIndex):
8542         (JSObjectDeleteProperty):
8543         (JSObjectIsFunction):
8544         (JSObjectCallAsFunction):
8545         (JSObjectIsConstructor):
8546         (JSObjectCallAsConstructor):
8547         (JSObjectCopyPropertyNames):
8548         * API/JSObjectRef.h:
8549         * API/JSStringRef.cpp:
8550         * API/JSValueRef.cpp:
8551         (JSValueGetType):
8552         (JSValueIsUndefined):
8553         (JSValueIsNull):
8554         (JSValueIsBoolean):
8555         (JSValueIsNumber):
8556         (JSValueIsString):
8557         (JSValueIsObject):
8558         (JSValueIsObjectOfClass):
8559         (JSValueIsEqual):
8560         (JSValueIsStrictEqual):
8561         (JSValueIsInstanceOfConstructor):
8562         (JSValueMakeUndefined):
8563         (JSValueMakeNull):
8564         (JSValueMakeBoolean):
8565         (JSValueMakeNumber):
8566         (JSValueMakeString):
8567         (JSValueToBoolean):
8568         (JSValueToNumber):
8569         (JSValueToStringCopy):
8570         (JSValueToObject):
8571         (JSValueProtect):
8572         (JSValueUnprotect):
8573         * API/JSValueRef.h:
8574         * API/minidom.c:
8575         (print):
8576         * API/testapi.c:
8577         (MyObject_getProperty):
8578         (MyObject_deleteProperty):
8579         (MyObject_callAsFunction):
8580         (MyObject_callAsConstructor):
8581         (MyObject_convertToType):
8582         (print_callAsFunction):
8583         (main):
8584
8585 2006-07-16  Geoffrey Garen  <ggaren@apple.com>
8586
8587         Approved by Maciej, RS by Beth.
8588         
8589         JSObjectMakeFunction -> JSObjectMakeFunctionWithCallback
8590         JSObjectMakeFunctionWithBody -> JSObjectMakeFunction
8591         
8592         because the latter is more common, and more fundamental, than the former.
8593
8594         * API/APICast.h:
8595         (toJS):
8596         * API/JSBase.h:
8597         * API/JSCallbackObject.cpp:
8598         (KJS::JSCallbackObject::getOwnPropertySlot):
8599         (KJS::JSCallbackObject::put):
8600         (KJS::JSCallbackObject::deleteProperty):
8601         (KJS::JSCallbackObject::getPropertyNames):
8602         (KJS::JSCallbackObject::staticValueGetter):
8603         (KJS::JSCallbackObject::staticFunctionGetter):
8604         * API/JSClassRef.cpp:
8605         (OpaqueJSClass::OpaqueJSClass):
8606         (OpaqueJSClass::~OpaqueJSClass):
8607         * API/JSClassRef.h:
8608         * API/JSObjectRef.cpp:
8609         (JSClassCreate):
8610         (JSObjectMakeFunctionWithCallback):
8611         (JSObjectMakeFunction):
8612         (OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray):
8613         (JSObjectCopyPropertyNames):
8614         * API/JSObjectRef.h:
8615         * API/minidom.c:
8616         (main):
8617         * API/testapi.c:
8618         (main):
8619         * ChangeLog:
8620         * JavaScriptCore.exp:
8621
8622 2006-07-16  Geoffrey Garen  <ggaren@apple.com>
8623
8624         Laughed at by Beth.
8625         
8626         Replace __JS with OpaqueJS because the former, while used by CF, is
8627         a prefix that's triply-reserved by the compiler. (_* is reserved in global 
8628         names, _[A-Z] is reserved in all names, and __ is reserved in all names 
8629         in C++.)
8630         
8631         Opaque is an alternative used by other Mac OS X framewokrs.
8632
8633         * API/APICast.h:
8634         (toJS):
8635         * API/JSBase.h:
8636         * API/JSCallbackObject.cpp:
8637         (KJS::JSCallbackObject::getOwnPropertySlot):
8638         (KJS::JSCallbackObject::put):
8639         (KJS::JSCallbackObject::deleteProperty):
8640         (KJS::JSCallbackObject::getPropertyNames):
8641         (KJS::JSCallbackObject::staticValueGetter):
8642         (KJS::JSCallbackObject::staticFunctionGetter):
8643         * API/JSClassRef.cpp:
8644         (OpaqueJSClass::OpaqueJSClass):
8645         (OpaqueJSClass::~OpaqueJSClass):
8646         * API/JSClassRef.h:
8647         * API/JSObjectRef.cpp:
8648         (JSClassCreate):
8649         (OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray):
8650         (JSObjectCopyPropertyNames):
8651
8652 2006-07-16  Darin Adler  <darin@apple.com>
8653
8654         - try to fix Windows build
8655
8656         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
8657         Added some recently added files, removed some recently removed.
8658
8659 2006-07-16  Geoffrey Garen  <ggaren@apple.com>
8660
8661         Reviewed by Maciej.
8662         
8663         - Change getProperty* to return undefined, rather than NULL, for missing
8664         properties, since that's what the spec says. Also added exception out
8665         parameters to the *Index functions, because they can call through to the
8666         regular functions, which can throw for custom objects.
8667
8668         * API/JSObjectRef.cpp:
8669         (JSObjectGetProperty):
8670         (JSObjectGetPropertyAtIndex):
8671         (JSObjectSetPropertyAtIndex):
8672         * API/JSObjectRef.h:
8673         * API/testapi.c:
8674         (main):
8675
8676 2006-07-16  Geoffrey Garen  <ggaren@apple.com>
8677
8678         Reviewed by Maciej.
8679         
8680         - Properly document and handle NULL callbacks for static properties. We
8681         throw an exception in any case other than a ReadOnly property with a NULL
8682         setProperty callback, because a NULL callback almost certainly indicates 
8683         a programming error. Also throw an exception if hasProperty returns true
8684         for a property that getProperty can't get.
8685         
8686         - If a static setProperty callback returns 'false', to indicate that the
8687         property was not set, we no longer forward the set request up the class
8688         chain, because that's almost certainly not what the programmer expected.
8689
8690         * API/JSCallbackObject.cpp:
8691         (KJS::JSCallbackObject::getOwnPropertySlot):
8692         (KJS::JSCallbackObject::put):
8693         (KJS::JSCallbackObject::staticValueGetter):
8694         (KJS::JSCallbackObject::staticFunctionGetter):
8695         (KJS::JSCallbackObject::callbackGetter):
8696         * API/JSObjectRef.h:
8697         * API/minidom.js:
8698         * API/testapi.c:
8699         (MyObject_hasProperty):
8700         * API/testapi.js:
8701
8702 2006-07-16  Geoffrey Garen  <ggaren@apple.com>
8703
8704         Reviewed by Maciej.
8705         
8706         - Added names to functions.
8707         
8708         - Removed GetPrivate/SetPrivate from callbackFunctions and callbackConstructors.
8709         The private data idiom is that a JS object stores its native implementation
8710         as private data. For functions and constructors, the native implementation is nothing
8711         more than the callback they already store, so supporting private data, too,
8712         confuses the idiom. If you *really* want, you can still create a custom 
8713         function with private data.
8714
8715         * API/JSCallbackConstructor.cpp:
8716         * API/JSCallbackConstructor.h:
8717         * API/JSCallbackFunction.cpp:
8718         (KJS::JSCallbackFunction::JSCallbackFunction):
8719         * API/JSCallbackFunction.h:
8720         * API/JSCallbackObject.cpp:
8721         (KJS::JSCallbackObject::staticFunctionGetter):
8722         * API/JSObjectRef.cpp:
8723         (JSObjectMakeFunction):
8724         (JSObjectMakeFunctionWithBody):
8725         (JSObjectGetPrivate):
8726         (JSObjectSetPrivate):
8727         * API/JSObjectRef.h:
8728         * API/minidom.c:
8729         (main):
8730         * API/testapi.c:
8731         (main):
8732
8733 2006-07-15  Maciej Stachowiak  <mjs@apple.com>
8734
8735         Reviewed by Darin.
8736         
8737         - switch property lists to be vector+set of Identifiers instead of list of References
8738         
8739         This has the following benefits:
8740         
8741         - no duplicates in property lists
8742         - simplifies API calls
8743         - probably more efficient, since linked list is gone
8744         - entirely removed Reference, ReferenceList and ProtectedReference types from the API
8745
8746         * kjs/PropertyNameArray.cpp: Added.
8747         (KJS::PropertyNameArray::add): Check set, if not already there, add to
8748         vector.
8749         * kjs/PropertyNameArray.h: Added.
8750         (KJS::PropertyNameArray::PropertyNameArray): Newly added type, combines
8751         a set and a vector to make a unique but ordered list of identifiers.
8752         (KJS::PropertyNameArray::begin): ditto
8753         (KJS::PropertyNameArray::end): ditto
8754         (KJS::PropertyNameArray::size): ditto
8755         (KJS::PropertyNameArray::operator[]): ditto
8756         * kjs/array_instance.h:
8757         * kjs/array_object.cpp:
8758         (ArrayInstance::getPropertyNames): renamed from getPropertyList, updated
8759         for PropertyNameArray
8760         (ArrayInstance::setLength): updated for PropertyNameArray
8761         (ArrayInstance::pushUndefinedObjectsToEnd): ditto
8762         * kjs/nodes.cpp:
8763         (ForInNode::execute): updated for PropertyNameArray
8764         * kjs/nodes.h:
8765         * kjs/object.cpp:
8766         (KJS::JSObject::getPropertyNames): renamed from getPropertyList, updated
8767         for PropertyNameArray
8768         * kjs/object.h:
8769         * kjs/property_map.cpp:
8770         (KJS::PropertyMap::getEnumerablePropertyNames): updated for PropertyNameArray
8771         (KJS::PropertyMap::getSparseArrayPropertyNames): ditto
8772         * kjs/property_map.h:
8773         * kjs/protected_reference.h: Removed.
8774         * kjs/reference.cpp: Removed.
8775         * kjs/reference.h: Removed.
8776         * kjs/reference_list.cpp: Removed.
8777         * kjs/reference_list.h: Removed.
8778         * kjs/scope_chain.cpp:
8779         (KJS::ScopeChain::print): Use PropertyNamesArray instead of ReferenceList.
8780         * kjs/string_object.cpp:
8781         (StringInstance::getPropertyNames): Updated for new approach.
8782         * kjs/string_object.h:
8783         * kjs/ustring.h:
8784         * API/APICast.h:
8785         (toJS): Added overload for PropertyNameAccumulatorRef / PropertyNameArray*
8786         (toRef): ditto
8787         * API/JSBase.h:
8788         * API/JSCallbackObject.cpp:
8789         (KJS::JSCallbackObject::getPropertyNames): Fixed for new API.
8790         * API/JSCallbackObject.h:
8791         * API/JSObjectRef.cpp:
8792         (__JSPropertyNameArray::__JSPropertyNameArray): Type used for a publicly vended
8793         JSPropertyNameArrayRef.
8794         (JSObjectCopyPropertyNames): New API call - renamed / refactored from 
8795         JSObjectCreatePropertyList
8796         (JSPropertyNameArrayRetain): new retain call for JSPropertyNameArray.
8797         (JSPropertyNameArrayRelease): new release call for - " -.
8798         (JSPropertyNameArrayGetCount): Instead of having to use a stateful enumerator you
8799         can now get the count and items in any order.
8800         (JSPropertyNameArrayGetNameAtIndex): See above.
8801         (JSPropertyNameAccumulatorAddName): What you add properties to is now an opaque 
8802         accumulator object.
8803         * API/JSObjectRef.h: Prototyped new functions, removed old ones
8804         * JavaScriptCore.exp: Updated exported symbols.
8805         * JavaScriptCore.xcodeproj/project.pbxproj: Added new files, removed old.
8806         * API/testapi.c:
8807         (MyObject_getPropertyNames): Renamed / fixed callback to fit new paradigm.
8808         (main): Updated for new API.
8809
8810 2006-07-15  Darin Adler  <darin@apple.com>
8811
8812         - oops, missed a few more arrays that had to be const
8813
8814         * API/JSNode.c:
8815         (JSNodePrototype_appendChild): Added const.
8816         (JSNodePrototype_removeChild): Ditto.
8817         (JSNodePrototype_replaceChild): Ditto.
8818         (JSNode_construct): Ditto.
8819         * API/JSNodeList.c:
8820         (JSNodeListPrototype_item): Ditto.
8821         * API/JSObjectRef.cpp:
8822         (JSObjectMakeFunctionWithBody): Ditto.
8823         (JSObjectCallAsFunction): Ditto.
8824         (JSObjectCallAsConstructor): Ditto.
8825         * API/minidom.c:
8826         (print): Ditto.
8827         * API/testapi.c:
8828         (MyObject_callAsFunction): Ditto.
8829         (MyObject_callAsConstructor): Ditto.
8830         (print_callAsFunction): Ditto.
8831         (myConstructor_callAsConstructor): Ditto.
8832
8833 2006-07-15  Darin Adler  <darin@apple.com>
8834
8835         Reviewed by Maciej.
8836
8837         * API/JSNode.h: Made an array parameter const.
8838         * API/JSObjectRef.h: Made array parameters const. Fixed a comment.
8839
8840 2006-07-15  Geoffrey Garen  <ggaren@apple.com>
8841
8842         Reviewed by Maciej.
8843         
8844         - JSObjectMakeFunctionWithBody includes a function name and named parameters now.
8845
8846         * API/JSObjectRef.cpp:
8847         (JSObjectMakeFunctionWithBody):
8848         * API/JSObjectRef.h:
8849         * API/testapi.c:
8850         (assertEqualsAsUTF8String): More informative failure reporting.
8851         (main): Test more function cases.
8852
8853 2006-07-15  Geoffrey Garen  <ggaren@apple.com>
8854
8855         Reviewed by Maciej.
8856
8857         - Moved the arguments passed to JSClassCreate into a single structure,
8858         called JSClassDefinition. This will enable easier structure 
8859         migration/versioning in the future, if necessary.
8860         
8861         - Added support for class names.
8862         
8863         - kJSClassDefinitionNull replaces kJSObjectCallbacksNone.
8864         
8865         - JSClass is becoming a fairly complex struct, so I migrated all of its
8866         implementation other than reference counting to the sruct.
8867         
8868         - Also moved JSClass* functions in the API to JSObjectRef.cpp, since they're
8869         declared in JSObjectRef.h
8870         
8871         - Also added some more informative explanation to the class structure doc.
8872         
8873 2006-07-15  Darin Adler  <darin@apple.com>
8874
8875         Reviewed by Geoff.
8876
8877         - fix http://bugs.webkit.org/show_bug.cgi?id=8395
8878           <rdar://problem/4613467>
8879           REGRESSION: RegEx seems broken for hex escaped non breaking space
8880
8881         Test: fast/js/regexp-extended-characters-more.html
8882
8883         * pcre/pcre_exec.c:
8884         (match): Got rid of utf16Length local variable to guarantee there's no
8885         extra stack usage in recursive calls. Fixed two places in the PCRE_UTF16
8886         code that were using the length variable, which is the UTF-8 length of
8887         a character in the pattern, to move in the UTF-16 subject string. Instead
8888         they hardcode lengths of 1 and 2 since the code already handles BMP
8889         characters and surrogate pairs separately. Also fixed some DPRINTF so
8890         I could compile with DEBUG on.
8891         (pcre_exec): Changed a place that was checking for multibyte characters
8892         in the subject string to use ISMIDCHAR. Instead it was using hardcoded
8893         logic that was right for UTF-8 but wrong for UTF-16.
8894
8895         * pcre/pcre_compile.c: (pcre_compile2): Fixed a DPRINTF so I could compile
8896         with DEBUG on.
8897
8898 2006-07-14  Geoffrey Garen  <ggaren@apple.com>
8899
8900         RS by Maciej.
8901         
8902         Global replace in the API of argc/argv with argumentCount/arguments.
8903
8904 2006-07-14  Geoffrey Garen  <ggaren@apple.com>
8905
8906         Reviewed by Maciej.
8907         
8908         - Finalized exception handling in the API.
8909         
8910         setProperty can throw because it throws for built-in arrays. getProperty
8911         and deleteProperty can throw because setProperty can throw and we want
8912         to be consistent, and also because they seem like "actions." callAsFunction,
8913         callAsConstructor, and hasInstance can throw, because they caan throw for
8914         all built-ins.
8915         
8916         toBoolean can't throw because it's defined that way in the spec.
8917         
8918         - Documented that toBoolean and toObject can't be overridden by custom 
8919         objects because they're defined that way in the spec.
8920
8921 === Safari-521.17 ===
8922
8923 2006-07-14  Geoffrey Garen  <ggaren@apple.com>
8924
8925         Reviewed by Maciej.
8926         
8927         - Implemented ref-counting of JSContexts by splitting into two datatypes:
8928         JSGlobalContext, which you can create/retain/release, and JSContext, which
8929         you can't.
8930         
8931         Internally, you retain a JSGlobalContext/ExecState by retaining its
8932         interpreter, which, in the case of a global ExecState, owns it.
8933         
8934         - Also made ~Interpreter() protected to catch places where Interpreter
8935         is manually deleted. (Can't make it private because some crazy fool
8936         decided it would be a good idea to subclass Interpreter in other frameworks.
8937         I pity da fool.)
8938
8939         * API/APICast.h: 
8940         (toJS): Added cast for new JSGlobalContext
8941         * API/JSStringRef.h: Changed vague "you must" language to more specific
8942         (but, ultimately, equally vague) "behavior is undefined if you don't" 
8943         language.
8944         (KJS::Interpreter::Interpreter): Factored more common initialization into
8945         init()
8946         * kjs/interpreter.h:
8947         (KJS::Interpreter::ref): new
8948         (KJS::Interpreter::deref): new
8949         (KJS::Interpreter::refCount): new
8950         * kjs/testkjs.cpp: 
8951         (doIt): Ref-count the interpreter.
8952
8953 2006-07-14  Maciej Stachowiak  <mjs@apple.com>
8954
8955         Reviewed by Geoff.
8956         
8957         - removed bool return value from JSObjectSetProperty, since it is inefficient and
8958         also doesn't work quite right
8959         - added JSObjectGetPropertyAtIndex and JSObjectSetPropertyAtIndex
8960
8961         * API/JSObjectRef.cpp:
8962         (JSObjectSetProperty): Removed return value and canPut stuff.
8963         (JSObjectGetPropertyAtIndex): Added.
8964         (JSObjectSetPropertyAtIndex): Added.
8965         * API/JSObjectRef.h: Prototyped and documented new functions.
8966
8967 2006-07-14  Geoffrey Garen  <ggaren@apple.com>
8968
8969         Reviewed by Beth.
8970         
8971         Moved JSCheckScriptSyntax, JSEvaluateScript, and JSGarbageCollect into
8972         JSBase.h/.cpp. They don't belong in the value-specific or context-specific 
8973         files because they're not part of the value or context implementations.
8974
8975         * API/JSBase.h:
8976         * API/JSContextRef.cpp:
8977         (JSContextGetGlobalObject):
8978         * API/JSContextRef.h:
8979         * API/JSValueRef.cpp:
8980         (JSValueUnprotect):
8981         * API/JSValueRef.h:
8982         * JavaScriptCore.xcodeproj/project.pbxproj:
8983
8984 2006-07-13  Timothy Hatcher  <timothy@apple.com>
8985
8986         Reviewed by Maciej.
8987
8988         Moved JavaScriptCore to be a public framework.
8989
8990         * JavaScriptCore.xcodeproj/project.pbxproj:
8991
8992 2006-07-13  Mark Rowe  <opendarwin.org@bdash.net.nz>
8993
8994         Reviewed by Geoffrey.
8995
8996         http://bugs.webkit.org/show_bug.cgi?id=9742
8997         Bug 9742: REGRESSION: WebKit hangs when loading <http://www.vtbook.com>
8998
8999         * kjs/value.h:
9000         (KJS::JSValue::getUInt32): Only types tagged as numeric can be converted to UInt32.
9001
9002 2006-07-13  Geoffrey Garen  <ggaren@apple.com>
9003
9004         Pleasing to Maciej.
9005         
9006         - Renamed JSEvaluate -> JSEvaluateScript, JSCheckSyntax -> JSCheckScriptSyntax
9007         - Added exception out parameters to JSValueTo* and JSValueIsEqual because
9008         they can throw
9009         - Removed JSObjectGetDescription because it's useless and vague, and 
9010         JSValueToString/JSValueIsObjectOfClass do a better job, anyway
9011         - Clarified comments about "IsFunction/Constructor" to indicate that they
9012         are true of all functions/constructors, not just those created by JSObjectMake*
9013
9014 2006-07-12  Geoffrey Garen  <ggaren@apple.com>
9015
9016         RS by Beth.
9017         
9018         Finished previously approved JSInternalString -> JSString conversion 
9019         by renaming the files.
9020
9021         * API/JSCallbackObject.cpp:
9022         * API/JSInternalStringRef.cpp: Removed.
9023         * API/JSInternalStringRef.h: Removed.
9024         * API/JSStringRef.cpp: Added.
9025         * API/JSStringRef.h: Added.
9026         * API/JavaScriptCore.h:
9027         * JavaScriptCore.xcodeproj/project.pbxproj:
9028
9029 2006-07-12  Geoffrey Garen  <ggaren@apple.com>
9030
9031         Reviewed by Maciej.
9032         
9033         - Removed context and exception parameters from JSObjectGetPropertyEnumerator,
9034         removing the spurious use of ExecState inside JavaScriptCore that made
9035         us think this was necessary in the first place.
9036
9037         (StringInstance::getPropertyList): Use getString instead of toString because
9038         we know we're dealing with a string -- we put it there in the first place.
9039         While we're at it, store the string's size instead of retrieving it each time 
9040         through the loop, to avoid the unnecessary killing of puppies.
9041         * kjs/string_object.h:
9042
9043 2006-07-12  Maciej Stachowiak  <mjs@apple.com>
9044
9045         Reviewed by Geoff.
9046         
9047         - add handling of hasInstance callback for API objects
9048
9049         * API/JSCallbackObject.cpp:
9050         (KJS::JSCallbackObject::implementsHasInstance): Check if callback is present.
9051         (KJS::JSCallbackObject::hasInstance): Invoke appropriate callback.
9052         * API/JSCallbackObject.h:
9053         * API/JSClassRef.cpp:
9054         * API/JSObjectRef.h:
9055         * API/testapi.c:
9056         (MyObject_hasInstance): Test case; should match what construct would do.
9057         * API/testapi.js:
9058
9059 2006-07-11  Geoffrey Garen  <ggaren@apple.com>
9060
9061         Reviewed by Maciej.
9062         
9063         - Implemented a vast number of renames and comment clarifications 
9064         suggested during API review.
9065         
9066         JSInternalString -> JSString
9067         JS*Make -> JSValueMake*, JSObjectMake*
9068         JSTypeCode -> JSType
9069         JSValueIsInstanceOf -> JSValueIsInstanceOfConstructor (reads strangely well in client code)
9070         JSGC*Protect -> JSValue*Protect
9071         JS*Callback -> JSObject*Callback
9072         JSGetPropertyListCallback -> JSObjectAddPropertiesToListCallback
9073         JSPropertyEnumeratorGetNext -> JSPropertyEnumeratorGetNextName
9074         JSString* -> 
9075             JSStringCreateWithUTF8CString, JSStringGetUTF8CString,
9076             JSStringGetMaximumUTF8CStringSize JSStringIsEqualToUTF8CString, 
9077             JSStringCreateWithCFString, JSStringCopyCFString, JSStringCreateWithCharacters.
9078         
9079         - Changed functions taking a JSValue out arg and returning a bool indicating
9080         whether it was set to simply return a JSValue or NULL.
9081         
9082         - Removed JSStringGetCharacters because it's more documentation than code,
9083         and it's just a glorified memcpy built on existing API functionality.
9084         
9085         - Moved standard library includes into the headers that actually require them.
9086         
9087         - Standardized use of the phrase "Create Rule."
9088         
9089         - Removed JSLock from make functions that don't allocate.
9090         
9091         - Added exception handling to JSValueToBoolean, since we now allow
9092         callback objects to throw exceptions upon converting to boolean.
9093         
9094         - Renamed JSGCCollect to JSGarbageCollect.
9095
9096 2006-07-10  Geoffrey Garen  <ggaren@apple.com>
9097
9098         Reviewed by Darin.
9099         
9100         - Changed public header includes to the <JavaScriptCore/ style.
9101         - Changed instances of 'buffer' to 'string' since we decided on
9102         JSInternalString instead of JSStringBuffer.
9103
9104         * API/JSContextRef.h:
9105         * API/JSInternalStringRef.cpp:
9106         (JSStringMake):
9107         (JSInternalStringRetain):
9108         (JSInternalStringRelease):
9109         (JSValueCopyStringValue):
9110         (JSInternalStringGetLength):
9111         (JSInternalStringGetCharactersPtr):
9112         (JSInternalStringGetCharacters):
9113         (JSInternalStringGetMaxLengthUTF8):
9114         (JSInternalStringGetCharactersUTF8):
9115         (CFStringCreateWithJSInternalString):
9116         * API/JSInternalStringRef.h:
9117         * API/JSNode.c:
9118         (JSNodePrototype_appendChild):
9119         (JSNode_getNodeType):
9120         * API/JSObjectRef.cpp:
9121         (JSObjectCallAsConstructor):
9122         * API/JSValueRef.h:
9123         * API/JavaScriptCore.h:
9124         * API/minidom.c:
9125         (main):
9126         (print):
9127         * API/testapi.c:
9128         (MyObject_getPropertyList):
9129         (myConstructor_callAsConstructor):
9130         (main): I noticed that we were prematurely releasing some string buffers,
9131         so I moved their release calls to the end of main(). I got rid of 'Buf' in *Buf
9132         (sometimes changing to 'IString', when necessary to differentiate a variable) 
9133         to match the buffer->string change.
9134
9135 === Safari-521.16 ===
9136
9137 2006-07-10  Darin Adler  <darin@apple.com>
9138
9139         * kjs/value.cpp: (KJS::JSValue::toInt32Inline): Added inline keyword one more place.
9140         Just in case.
9141
9142 2006-07-10  Darin Adler  <darin@apple.com>
9143
9144         - fix the release build
9145
9146         * kjs/value.h:
9147         * kjs/value.cpp:
9148         (KJS::JSValue::toInt32Inline): Move the code here to an inline.
9149         (KJS::JSValue::toInt32): Call the inline from both overloaded toInt32 functions.
9150
9151 2006-07-10  David Kilzer  <ddkilzer@kilzer.net>
9152
9153         Reviewed by Darin.
9154
9155         - fix http://bugs.webkit.org/show_bug.cgi?id=9179
9156           Implement select.options.add() method
9157
9158         * JavaScriptCore.exp: Added overloaded KJS::JSValue::toInt32() method.
9159         * JavaScriptCore.xcodeproj/project.pbxproj: Altered attributes metadata for
9160         kjs/value.h to make it available as a forwarded header.
9161         * kjs/lookup.h:
9162         (KJS::lookupPut): Extracted a lookupPut() method from the existing lookupPut() method.
9163         The new method returns a boolean value if no entry is found in the lookup table.
9164         * kjs/value.cpp:
9165         (KJS::JSValue::toInt32): Overloaded toInt32() method with boolean "Ok" argument.
9166         * kjs/value.h: Ditto.
9167
9168 2006-07-10  Geoffrey Garen  <ggaren@apple.com>
9169
9170         No review necessary. Removed bogus file I accidentally checked in before.
9171
9172         * API/JSInternalSringRef.h: Removed.
9173
9174 2006-07-10  Geoffrey Garen  <ggaren@apple.com>
9175
9176         Reviewed by Darin.
9177         
9178         Added exception out parameter to API object callbacks, removed semi-bogus
9179         JSContext(.*)Exception functions.
9180         
9181         To make these calls syntactically simple, I added an exceptionSlot()
9182         method to the ExecState class, which provides a JSValue** slot in which to 
9183         store a JSValue* exception.
9184
9185         * API/APICast.h:
9186         (toRef):
9187         * API/JSCallbackConstructor.cpp:
9188         (KJS::JSCallbackConstructor::construct):
9189         * API/JSCallbackFunction.cpp:
9190         (KJS::JSCallbackFunction::callAsFunction):
9191         * API/JSCallbackObject.cpp:
9192         (KJS::JSCallbackObject::init):
9193         (KJS::JSCallbackObject::getOwnPropertySlot):
9194         (KJS::JSCallbackObject::put):
9195         (KJS::JSCallbackObject::deleteProperty):
9196         (KJS::JSCallbackObject::construct):
9197         (KJS::JSCallbackObject::callAsFunction):
9198         (KJS::JSCallbackObject::getPropertyList):
9199         (KJS::JSCallbackObject::toBoolean):
9200         (KJS::JSCallbackObject::toNumber):
9201         (KJS::JSCallbackObject::toString):
9202         (KJS::JSCallbackObject::staticValueGetter):
9203         (KJS::JSCallbackObject::callbackGetter):
9204         * API/JSContextRef.cpp:
9205         (JSCheckSyntax):
9206         * API/JSContextRef.h:
9207         * API/JSNode.c:
9208         (JSNodePrototype_appendChild):
9209         (JSNodePrototype_removeChild):
9210         (JSNodePrototype_replaceChild):
9211         (JSNode_getNodeType):
9212         (JSNode_getChildNodes):
9213         (JSNode_getFirstChild):
9214         (JSNode_construct):
9215         * API/JSNode.h:
9216         * API/JSNodeList.c:
9217         (JSNodeListPrototype_item):
9218         (JSNodeList_length):
9219         (JSNodeList_getProperty):
9220         * API/JSObjectRef.h:
9221         * API/minidom.c:
9222         (print):
9223         * API/testapi.c:
9224         (MyObject_initialize):
9225         (MyObject_hasProperty):
9226         (MyObject_getProperty):
9227         (MyObject_setProperty):
9228         (MyObject_deleteProperty):
9229         (MyObject_getPropertyList):
9230         (MyObject_callAsFunction):
9231         (MyObject_callAsConstructor):
9232         (MyObject_convertToType):
9233         (print_callAsFunction):
9234         (myConstructor_callAsConstructor):
9235         (main):
9236         * JavaScriptCore.exp:
9237         * kjs/ExecState.h:
9238         (KJS::ExecState::exceptionHandle):
9239
9240 2006-07-10  Geoffrey Garen  <ggaren@apple.com>
9241
9242         Reviewed by Darin.
9243
9244         Improved type safety by implementing opaque JSValue/JSObject typing through 
9245         abuse of 'const', not void*. Also fixed an alarming number of bugs
9246         exposed by this new type safety.
9247         
9248         I made one design change in JavaScriptCore, which is that the JSObject
9249         constructor should take a JSValue* as its prototype argument, not a JSObject*,
9250         since we allow the prototype to be any JSValue*, including jsNull(), for
9251         example.
9252         
9253         * API/APICast.h:
9254         (toJS):
9255         * API/JSBase.h:
9256         * API/JSCallbackConstructor.cpp:
9257         (KJS::JSCallbackConstructor::construct):
9258         * API/JSCallbackFunction.cpp:
9259         (KJS::JSCallbackFunction::callAsFunction):
9260         * API/JSCallbackObject.cpp:
9261         (KJS::JSCallbackObject::JSCallbackObject):
9262         (KJS::JSCallbackObject::getOwnPropertySlot):
9263         (KJS::JSCallbackObject::put):
9264         (KJS::JSCallbackObject::construct):
9265         (KJS::JSCallbackObject::callAsFunction):
9266         (KJS::JSCallbackObject::staticFunctionGetter):
9267         * API/JSCallbackObject.h:
9268         * API/JSContextRef.cpp:
9269         (JSEvaluate):
9270         * API/JSNode.c:
9271         (JSNodePrototype_appendChild):
9272         (JSNodePrototype_removeChild):
9273         (JSNodePrototype_replaceChild):
9274         * API/JSObjectRef.cpp:
9275         (JSObjectMake):
9276         (JSFunctionMakeWithBody):
9277         (JSObjectGetProperty):
9278         (JSObjectCallAsFunction):
9279         (JSObjectCallAsConstructor):
9280         * API/JSObjectRef.h:
9281         * API/testapi.c:
9282         (main):
9283         * ChangeLog:
9284         * kjs/object.h:
9285         (KJS::JSObject::JSObject):
9286
9287 2006-07-10  Geoffrey Garen  <ggaren@apple.com>
9288
9289         Approved by Maciej, Darin.
9290         
9291         Renamed JSStringBufferRef to JSInternalStringRef. "Internal string" means the 
9292         JavaScript engine's internal string representation, which is the most 
9293         low-level and efficient representation to use when interfacing with JavaScript.
9294
9295         * API/APICast.h:
9296         (toJS):
9297         (toRef):
9298         * API/JSBase.h:
9299         * API/JSCallbackObject.cpp:
9300         (KJS::JSCallbackObject::getOwnPropertySlot):
9301         (KJS::JSCallbackObject::put):
9302         (KJS::JSCallbackObject::deleteProperty):
9303         (KJS::JSCallbackObject::staticValueGetter):
9304         (KJS::JSCallbackObject::callbackGetter):
9305         * API/JSContextRef.cpp:
9306         (JSEvaluate):
9307         (JSCheckSyntax):
9308         * API/JSContextRef.h:
9309         * API/JSInternalStringRef.cpp: Added.
9310         (JSStringMake):
9311         (JSInternalStringCreate):
9312         (JSInternalStringCreateUTF8):
9313         (JSInternalStringRetain):
9314         (JSInternalStringRelease):
9315         (JSValueCopyStringValue):
9316         (JSInternalStringGetLength):
9317         (JSInternalStringGetCharactersPtr):
9318         (JSInternalStringGetCharacters):
9319         (JSInternalStringGetMaxLengthUTF8):
9320         (JSInternalStringGetCharactersUTF8):
9321         (JSInternalStringIsEqual):
9322         (JSInternalStringIsEqualUTF8):
9323         (JSInternalStringCreateCF):
9324         (CFStringCreateWithJSInternalString):
9325         * API/JSInternalStringRef.h: Added.
9326         * API/JSNode.c:
9327         (JSNodePrototype_appendChild):
9328         (JSNode_getNodeType):
9329         (JSNode_getChildNodes):
9330         (JSNode_getFirstChild):
9331         * API/JSNodeList.c:
9332         (JSNodeList_length):
9333         (JSNodeList_getProperty):
9334         * API/JSObjectRef.cpp:
9335         (JSFunctionMakeWithBody):
9336         (JSObjectGetDescription):
9337         (JSObjectHasProperty):
9338         (JSObjectGetProperty):
9339         (JSObjectSetProperty):
9340         (JSObjectDeleteProperty):
9341         (JSPropertyEnumeratorGetNext):
9342         (JSPropertyListAdd):
9343         * API/JSObjectRef.h:
9344         * API/JSStringBufferRef.cpp: Removed.
9345         * API/JSStringBufferRef.h: Removed.
9346         * API/JSValueRef.h:
9347         * API/JavaScriptCore.h:
9348         * API/minidom.c:
9349         (main):
9350         (print):
9351         * API/testapi.c:
9352         (assertEqualsAsUTF8String):
9353         (assertEqualsAsCharactersPtr):
9354         (assertEqualsAsCharacters):
9355         (MyObject_hasProperty):
9356         (MyObject_getProperty):
9357         (MyObject_setProperty):
9358         (MyObject_deleteProperty):
9359         (MyObject_getPropertyList):
9360         (print_callAsFunction):
9361         (myConstructor_callAsConstructor):
9362         (main):
9363         * JavaScriptCore.exp:
9364         * JavaScriptCore.xcodeproj/project.pbxproj:
9365
9366 2006-07-08  Tim Omernick  <timo@apple.com>
9367
9368         Reviewed by Maciej.
9369
9370         Added an OpenGL drawing model to the Netscape Plug-in API.
9371
9372         * bindings/npapi.h:
9373
9374 2006-07-08  Timothy Hatcher  <timothy@apple.com>
9375
9376         Reviewed by Maciej.
9377
9378         Moved KJS_GetCreatedJavaVMs to jni_utility.cpp.
9379         Switched KJS_GetCreatedJavaVMs over to use dlopen and dlsym
9380         now that NSAddImage, NSLookupSymbolInImage and NSAddressOfSymbol
9381         are deprecated in Leopard.
9382
9383         * JavaScriptCore.exp:
9384         * JavaScriptCore.xcodeproj/project.pbxproj:
9385         * bindings/jni/jni_utility.cpp:
9386         (KJS::Bindings::KJS_GetCreatedJavaVMs):
9387         * bindings/softlinking.c: Removed.
9388         * bindings/softlinking.h: Removed.
9389
9390 2006-07-08  Geoffrey Garen  <ggaren@apple.com>
9391
9392         Reviewed by Anders.
9393         
9394         - Make JSObjectGetProperty return a JSValue or NULL, like JSEvaluate does.
9395
9396         * API/JSObjectRef.cpp:
9397         (JSObjectGetProperty):
9398         * API/JSObjectRef.h:
9399         * API/testapi.c:
9400         (main):
9401
9402 2006-07-08  Geoffrey Garen  <ggaren@apple.com>
9403
9404         Style change -- no review necessary.
9405         
9406         Use 0 instead of NULL in API .cpp files, to match our style guidelines.
9407
9408         * API/JSContextRef.cpp:
9409         (JSEvaluate):
9410         * API/JSObjectRef.cpp:
9411         (JSFunctionMakeWithBody):
9412         (JSObjectCallAsFunction):
9413         (JSObjectCallAsConstructor):
9414         * API/JSValueRef.cpp:
9415         (JSValueToObject):
9416
9417 2006-07-08  Geoffrey Garen  <ggaren@apple.com>
9418
9419         Reviewed by TimO.
9420
9421         - Added ability to pass NULL for thisObject when calling JSObjectCallAsFunction,
9422         to match JSEvaluate.
9423         
9424         * API/JSObjectRef.cpp:
9425         (JSObjectCallAsFunction):
9426         * API/JSObjectRef.h:
9427         * API/testapi.c:
9428         (main):
9429
9430 === Safari-521.15 ===
9431
9432 2006-07-07  Geoffrey Garen  <ggaren@apple.com>
9433
9434         Reviewed by Maciej.
9435         
9436         - Standardized which functions take a JSContext as an argument. The rule is:
9437         if you might execute JavaScript, you take a JSContext, otherwise you don't.
9438         
9439         The FIXME in JSObjectRef.h requires refactoring some parts of Interpreter,
9440         but not API changes, so I'm putting it off until later.
9441
9442         * API/JSCallbackObject.cpp:
9443         (KJS::JSCallbackObject::JSCallbackObject):
9444         (KJS::JSCallbackObject::init):
9445         * API/JSCallbackObject.h:
9446         * API/JSContextRef.cpp:
9447         (JSContextCreate):
9448         * API/JSContextRef.h:
9449         * API/JSObjectRef.cpp:
9450         (JSObjectMake):
9451         (JSPropertyEnumeratorGetNext):
9452         * API/JSObjectRef.h:
9453         * API/testapi.c:
9454         (MyObject_initialize):
9455         (main):
9456         * JavaScriptCore.exp:
9457         * kjs/array_object.cpp:
9458         (ArrayInstance::setLength):
9459         (ArrayInstance::pushUndefinedObjectsToEnd):
9460         * kjs/nodes.cpp:
9461         (ForInNode::execute):
9462         * kjs/reference.cpp:
9463         (KJS::Reference::getPropertyName):
9464         (KJS::Reference::getValue):
9465         * kjs/reference.h:
9466         * kjs/scope_chain.cpp:
9467         (KJS::ScopeChain::print):
9468
9469 2006-07-06  Geoffrey Garen  <ggaren@apple.com>
9470
9471         Reviewed by Maciej.
9472         
9473         More API action.
9474         
9475         - Headerdoc finished
9476
9477         Semantic Changes:
9478         - Added a JSContextRef argument to many functions, because you need a 
9479         JSContextRef for doing virtually anything. I expect to add this argument
9480         to even more functions in a future patch.
9481         
9482         - Removed the globalObjectPrototype argument to JSContextCreate because
9483         you can't create an object until you have a context, so it's impossible
9484         to pass a prototype object to JSContextCreate. That's OK because (1) there's
9485         no reason to give the global object a prototype and (2) if you really want
9486         to, you can just use a separate call to JSObjectSetPrototype.
9487         
9488         - Removed the JSClassRef argument to JSClassCreate because it was unnecessary,
9489         and you need to be able to make the global object's class before you've
9490         created a JSContext.
9491         
9492         - Added an optional exception parameter to JSFunctionMakeWithBody because anything
9493         less would be uncivilized.
9494         
9495         - Made the return value parameter to JSObjectGetProperty optional to match
9496         all other return value parameters in the API.
9497         
9498         - Made JSObjectSetPrivate/JSObjectGetPrivate work on JSCallbackFunctions
9499         and JSCallbackConstructors. You could use an abstract base class or strategic
9500         placement of m_privateData in the class structure to implement this, but 
9501         the former seemed like overkill, and the latter seemed too dangerous.
9502         
9503         - Fixed a bug where JSPropertyEnumeratorGetNext would skip the first property.
9504
9505         Cosmetic Changes:
9506         - Reversed the logic of the JSChar #ifdef to avoid confusing headerdoc
9507         
9508         - Removed function names from @function declarations because headeroc
9509         can parse them automatically, and I wanted to rule out manual mismatch.
9510
9511         - Changed Error::create to take a const UString& instead of a UString*
9512         because it was looking at me funny.
9513         
9514         - Renamed JSStringBufferCreateWithCFString to JSStringBufferCreateCF
9515         because the latter is more concise and it matches JSStringBufferCreateUTF8.
9516         
9517         * API/JSCallbackObject.cpp:
9518         (KJS::JSCallbackObject::getOwnPropertySlot):
9519         (KJS::JSCallbackObject::put):
9520         (KJS::JSCallbackObject::deleteProperty):
9521         (KJS::JSCallbackObject::getPropertyList):
9522         (KJS::JSCallbackObject::toBoolean):
9523         (KJS::JSCallbackObject::toNumber):
9524         (KJS::JSCallbackObject::toString):
9525         * API/JSClassRef.cpp:
9526         (JSClassCreate):
9527         * API/JSContextRef.cpp:
9528         (JSContextCreate):
9529         (JSContextSetException):
9530         * API/JSContextRef.h:
9531         * API/JSNode.c:
9532         (JSNodePrototype_class):
9533         (JSNode_class):
9534         * API/JSNodeList.c:
9535         (JSNodeListPrototype_class):
9536         (JSNodeList_class):
9537         * API/JSObjectRef.cpp:
9538         (JSObjectGetProperty):
9539         (JSObjectGetPrivate):
9540         (JSObjectSetPrivate):
9541         (JSObjectCallAsFunction):
9542         (JSObjectCallAsConstructor):
9543         (JSPropertyEnumeratorGetNext):
9544         * API/JSObjectRef.h:
9545         * API/JSStringBufferRef.cpp:
9546         (JSStringBufferCreateCF):
9547         * API/JSStringBufferRef.h:
9548         * API/JSValueRef.cpp:
9549         (JSValueIsInstanceOf):
9550         * API/JSValueRef.h:
9551         * API/minidom.c:
9552         (main):
9553         * API/minidom.js:
9554         * API/testapi.c:
9555         (MyObject_hasProperty):
9556         (MyObject_setProperty):
9557         (MyObject_deleteProperty):
9558         (MyObject_getPropertyList):
9559         (MyObject_convertToType):
9560         (MyObject_class):
9561         (main):
9562         * JavaScriptCore.exp:
9563
9564 2006-07-07  Geoffrey Garen  <ggaren@apple.com>
9565
9566         Reviewed by John.
9567         
9568         - Fixed a few crashes resulting from NULL parameters to JSClassCreate.
9569
9570         * API/JSClassRef.cpp:
9571         (JSClassCreate):
9572         (JSClassRelease):
9573         * API/testapi.c: Added test for NULL parameters.
9574         (main):
9575
9576 2006-07-07  Geoffrey Garen  <ggaren@apple.com>
9577
9578         Reviewed by John, mocked by Darin.
9579         
9580         - Changed JSEvaluate to take a JSObjectRef instead of a JSValueRef as
9581         "this," since "this" must be an object.
9582
9583         * API/JSContextRef.cpp:
9584         (JSEvaluate):
9585         * API/JSContextRef.h:
9586
9587 2006-07-07  Geoffrey Garen  <ggaren@apple.com>
9588
9589         Reviewed by John.
9590         
9591         - More headerdoc
9592
9593         * API/JSBase.h:
9594         * JavaScriptCore.xcodeproj/project.pbxproj:
9595
9596 2006-07-05  Geoffrey Garen  <ggaren@apple.com>
9597
9598         RS by Beth.
9599         
9600         Renamed JSCharBufferRef, which was universally unpopular, to JSStringBufferRef,
9601         which, hopefully, will be less unpopular.
9602
9603         * API/APICast.h:
9604         (toJS):
9605         (toRef):
9606         * API/JSBase.h:
9607         * API/JSCallbackObject.cpp:
9608         (KJS::JSCallbackObject::getOwnPropertySlot):
9609         (KJS::JSCallbackObject::put):
9610         (KJS::JSCallbackObject::deleteProperty):
9611         (KJS::JSCallbackObject::staticValueGetter):
9612         (KJS::JSCallbackObject::callbackGetter):
9613         * API/JSCharBufferRef.cpp: Removed.
9614         * API/JSCharBufferRef.h: Removed.
9615         * API/JSContextRef.cpp:
9616         (JSEvaluate):
9617         (JSCheckSyntax):
9618         * API/JSContextRef.h:
9619         * API/JSNode.c:
9620         (JSNodePrototype_appendChild):
9621         (JSNode_getNodeType):
9622         (JSNode_getChildNodes):
9623         (JSNode_getFirstChild):
9624         * API/JSNodeList.c:
9625         (JSNodeList_length):
9626         (JSNodeList_getProperty):
9627         * API/JSObjectRef.cpp:
9628         (JSFunctionMakeWithBody):
9629         (JSObjectGetDescription):
9630         (JSObjectHasProperty):
9631         (JSObjectGetProperty):
9632         (JSObjectSetProperty):
9633         (JSObjectDeleteProperty):
9634         (JSPropertyEnumeratorGetNext):
9635         (JSPropertyListAdd):
9636         * API/JSObjectRef.h:
9637         * API/JSStringBufferRef.cpp: Added.
9638         (JSStringMake):
9639         (JSStringBufferCreate):
9640         (JSStringBufferCreateUTF8):
9641         (JSStringBufferRetain):
9642         (JSStringBufferRelease):
9643         (JSValueCopyStringValue):
9644         (JSStringBufferGetLength):
9645         (JSStringBufferGetCharactersPtr):
9646         (JSStringBufferGetCharacters):
9647         (JSStringBufferGetMaxLengthUTF8):
9648         (JSStringBufferGetCharactersUTF8):
9649         (JSStringBufferIsEqual):
9650         (JSStringBufferIsEqualUTF8):
9651         (JSStringBufferCreateWithCFString):
9652         (CFStringCreateWithJSStringBuffer):
9653         * API/JSStringBufferRef.h: Added.
9654         * API/JSValueRef.h:
9655         * API/JavaScriptCore.h:
9656         * API/minidom.c:
9657         (main):
9658         (print):
9659         * API/testapi.c:
9660         (assertEqualsAsUTF8String):
9661         (assertEqualsAsCharactersPtr):
9662         (assertEqualsAsCharacters):
9663         (MyObject_hasProperty):
9664         (MyObject_getProperty):
9665         (MyObject_setProperty):
9666         (MyObject_deleteProperty):
9667         (MyObject_getPropertyList):
9668         (print_callAsFunction):
9669         (myConstructor_callAsConstructor):
9670         (main):
9671         * JavaScriptCore.exp:
9672         * JavaScriptCore.xcodeproj/project.pbxproj:
9673
9674 2006-07-05  Geoffrey Garen  <ggaren@apple.com>
9675
9676         RS by Beth.
9677         
9678         Moved some code around for more logical file separation.
9679
9680         * API/JSBase.h:
9681         * API/JSContextRef.h:
9682         * API/JSObjectRef.cpp:
9683         * API/JSValueRef.cpp:
9684         (JSValueToObject):
9685         * API/JSValueRef.h:
9686
9687 2006-07-03  Geoffrey Garen  <ggaren@apple.com>
9688
9689         Reviewed by Maciej.
9690         
9691         Implemented JSFunctionMakeWithBody, which parses a script as a function body
9692         in the global scope, and returns the resulting anonymous function.
9693         
9694         I also removed private data from JSCallbackFunction. It never worked,
9695         since JSCallbackFunction doesn't inherit from JSCallbackObject.
9696
9697         * API/JSCallbackConstructor.cpp: Removed.
9698         * API/JSCallbackConstructor.h: Removed.
9699         * API/JSCallbackFunction.cpp:
9700         (KJS::JSCallbackFunction::JSCallbackFunction):
9701         (KJS::JSCallbackFunction::implementsConstruct):
9702         (KJS::JSCallbackFunction::construct):
9703         (KJS::JSCallbackFunction::implementsCall):
9704         (KJS::JSCallbackFunction::callAsFunction):
9705         * API/JSCallbackFunction.h:
9706         * API/JSCallbackObject.cpp:
9707         (KJS::JSCallbackObject::staticFunctionGetter):
9708         * API/JSObjectRef.cpp:
9709         (JSFunctionMake):
9710         (JSFunctionMakeWithCallbacks):
9711         * API/JSObjectRef.h:
9712         * API/JSValueRef.h:
9713         * API/minidom.c:
9714         (main):
9715         * API/testapi.c:
9716         (main):
9717         * JavaScriptCore.exp: Programmatically added all symbols exported by
9718         API object files, and sorted results
9719         * JavaScriptCore.xcodeproj/project.pbxproj:
9720
9721 2006-07-03  Geoffrey Garen  <ggaren@apple.com>
9722
9723         Reviewed by Maciej.
9724
9725         - Return syntax error in JSCheckSyntax through a JSValueRef* exception
9726         argument
9727         
9728         * API/JSBase.h:
9729         * API/JSContextRef.cpp:
9730         (JSCheckSyntax):
9731         * API/testapi.c:
9732         (main):
9733         * JavaScriptCore.exp:
9734         * kjs/interpreter.cpp:
9735         (KJS::Interpreter::checkSyntax):
9736         * kjs/interpreter.h:
9737
9738 2006-07-04  Darin Adler  <darin@apple.com>
9739
9740         - fixed build
9741
9742         * wtf/MathExtras.h: Oops. Added missing #endif.
9743
9744 2006-07-04  Bjoern Graf  <bjoern.graf@gmail.com>
9745
9746         Reviewed by Maciej.
9747         Tweaked a bit by Darin.
9748
9749         - http://bugs.webkit.org/show_bug.cgi?id=9678
9750           work around MSVCRT's fmod function returning NaN for fmod(x, infinity) instead of x
9751
9752         * wtf/MathExtras.h: Added include of <float.h>.
9753         (isinf): Fix to return false for NAN.
9754         (wtf_fmod): Added. An inline that works around the bug.
9755
9756         * kjs/nodes.cpp:
9757         * kjs/number_object.cpp:
9758         * kjs/operations.cpp:
9759         * kjs/value.cpp:
9760         Added includes of MathExtras.h to all files using fmod.
9761
9762         * JavaScriptCore.xcodeproj/project.pbxproj: Let Xcode 2.3 have its way with
9763         the project.
9764
9765 2006-07-01  Geoffrey Garen  <ggaren@apple.com>
9766
9767         Reviewed by Darin.
9768         
9769         - Refined value conversions in the API:
9770             - failed toNumber returns NaN
9771             - failed toObject returns NULL
9772             - failed toString returns empty string
9773         
9774         - Refined excpetion handling in the API:
9775             - failed value conversions do not throw exceptions
9776             - uncaught exceptions in JSEvaluate, JSObjectCallAsFunction, and 
9777               JSObjectCallAsConstructor are returned through a JSValueRef* exception
9778               argument
9779             - removed JSContextHasException, because JSContextGetException does
9780               the same job
9781             
9782         * API/JSBase.h:
9783         * API/JSCharBufferRef.cpp:
9784         (JSValueCopyStringValue):
9785         * API/JSContextRef.cpp:
9786         (JSEvaluate):
9787         * API/JSContextRef.h:
9788         * API/JSNodeList.c: Added test code demonstrating how you would use
9789         toNumber, and why you probably don't need toUInt32, etc.
9790         (JSNodeListPrototype_item):
9791         (JSNodeList_getProperty):
9792         * API/JSObjectRef.cpp:
9793         (JSValueToObject):
9794         (JSObjectCallAsFunction):
9795         (JSObjectCallAsConstructor):
9796         * API/JSObjectRef.h:
9797         * API/JSValueRef.cpp:
9798         (JSValueToNumber):
9799         * API/JSValueRef.h:
9800         * API/minidom.c:
9801         (main):
9802         * API/testapi.c:
9803         (main): Added tests for new rules, and call to JSGCProtect to fix Intel 
9804         crash
9805         * JavaScriptCore.exp:
9806
9807 2006-07-03  Darin Adler  <darin@apple.com>
9808
9809         - Rolled out HashMap implementation of NPRuntime, at least temporarily.
9810
9811         Fixes hang in the bindings section of layout tests seen on the
9812         buildbot.
9813
9814         This code was using HashMap<const char*, PrivateIdentifier*>.
9815         But that hashes based on pointer identity, not string value.
9816         The default hash for any pointer type is to hash based on the pointer.
9817         And WTF doesn't currently have a string hash for char*.
9818         We'll need to fix that before re-landing this patch.
9819
9820         (Formatting was also incorrect -- extra spaces in parentheses.)
9821
9822         * bindings/npruntime.cpp: Rolled out last change.
9823
9824 2006-07-02  Justin Haygood  <jhaygood@spsu.edu>
9825
9826         Reviewed, tweaked, landed by ggaren.
9827
9828         - Port NPRuntime from CFDictionary to HashMap.
9829
9830         * bindings/npruntime.cpp:
9831         (getStringIdentifierDictionary):
9832         (getIntIdentifierDictionary):
9833         (_NPN_GetStringIdentifier):
9834         (_NPN_GetIntIdentifier):
9835         * bindings/npruntime.h:
9836
9837 2006-07-01  Geoffrey Garen  <ggaren@apple.com>
9838
9839         Reviewed by Adele.
9840         
9841         - Fixed <rdar://problem/4611197> REGRESSION: Liveconnect with Java test 
9842         fails at http://www-sor.inria.fr/~dedieu/notes/liveconnect/simple_example.html
9843
9844         * JavaScriptCore.exp: Export symbols used by liveconnect
9845
9846 2006-06-29  Geoffrey Garen  <ggaren@apple.com>
9847
9848         Reviewed by Maciej.
9849         
9850         - Phase 2 in the JS API.
9851         
9852         - Added support for specifying static tables of values -- this should
9853         obviate the need for using complicated callbacks for most lookups.
9854         
9855         -  API objects are now created with classes (JSClassRef) -- in order to support
9856         static values, and in order to prevent API objects from storing their
9857         data inline, and thus falling into the oversized (read: slow and prone to
9858         giving Maciej the frowny face) heap.
9859         
9860         - Added two specialized JSObject subclasses -- JSCallbackFunction and JSCallbackConstructor -- 
9861         to allow JSFunctionMake and JSConstructorMake to continue to work with
9862         the new class model. Another solution to this problem would be to create
9863         a custom class object for each function and constructor you make. This
9864         solution is more code but also more efficient.
9865         
9866         - Substantially beefed up the minidom example to demonstrate and test a
9867         lot of these techniques. Its output is still pretty haphazard, though.
9868         
9869         - Gave the <kjs/ preface to some includes -- I'm told this matters to
9870         building on some versions of Linux.
9871         
9872         - Implemented JSValueIsInstanceOf and JSValueIsObjectOfClass
9873         
9874         - Removed GetDescription callback. Something in the class datastructure
9875         should take care of this.
9876
9877         * API/JSBase.h:
9878         * API/JSCallbackConstructor.cpp: Added.
9879         (KJS::):
9880         (KJS::JSCallbackConstructor::JSCallbackConstructor):
9881         (KJS::JSCallbackConstructor::implementsConstruct):
9882         (KJS::JSCallbackConstructor::construct):
9883         (KJS::JSCallbackConstructor::setPrivate):
9884         (KJS::JSCallbackConstructor::getPrivate):
9885         * API/JSCallbackConstructor.h: Added.
9886         (KJS::JSCallbackConstructor::classInfo):
9887         * API/JSCallbackFunction.cpp: Added.
9888         (KJS::):
9889         (KJS::JSCallbackFunction::JSCallbackFunction):
9890         (KJS::JSCallbackFunction::implementsCall):
9891         (KJS::JSCallbackFunction::callAsFunction):
9892         (KJS::JSCallbackFunction::setPrivate):
9893         (KJS::JSCallbackFunction::getPrivate):
9894         * API/JSCallbackFunction.h: Added.
9895         (KJS::JSCallbackFunction::classInfo):
9896         * API/JSCallbackObject.cpp:
9897         (KJS::):
9898         (KJS::JSCallbackObject::JSCallbackObject):
9899         (KJS::JSCallbackObject::init):
9900         (KJS::JSCallbackObject::~JSCallbackObject):
9901         (KJS::JSCallbackObject::className):
9902         (KJS::JSCallbackObject::getOwnPropertySlot):
9903         (KJS::JSCallbackObject::put):
9904         (KJS::JSCallbackObject::deleteProperty):
9905         (KJS::JSCallbackObject::implementsConstruct):
9906         (KJS::JSCallbackObject::construct):
9907         (KJS::JSCallbackObject::implementsCall):
9908         (KJS::JSCallbackObject::callAsFunction):
9909         (KJS::JSCallbackObject::getPropertyList):
9910         (KJS::JSCallbackObject::toBoolean):
9911         (KJS::JSCallbackObject::toNumber):
9912         (KJS::JSCallbackObject::toString):
9913         (KJS::JSCallbackObject::inherits):
9914         (KJS::JSCallbackObject::staticValueGetter):
9915         (KJS::JSCallbackObject::staticFunctionGetter):
9916         (KJS::JSCallbackObject::callbackGetter):
9917         * API/JSCallbackObject.h:
9918         * API/JSCharBufferRef.cpp:
9919         * API/JSClassRef.cpp: Added.
9920         (JSClassCreate):
9921         (JSClassRetain):
9922         (JSClassRelease):
9923         * API/JSClassRef.h: Added.
9924         (StaticValueEntry::StaticValueEntry):
9925         (StaticFunctionEntry::StaticFunctionEntry):
9926         (__JSClass::__JSClass):
9927         * API/JSContextRef.cpp:
9928         (JSContextCreate):
9929         (JSEvaluate):
9930         * API/JSContextRef.h:
9931         * API/JSNode.c: Added.
9932         (JSNodePrototype_appendChild):
9933         (JSNodePrototype_removeChild):
9934         (JSNodePrototype_replaceChild):
9935         (JSNodePrototype_class):
9936         (JSNode_getNodeType):
9937         (JSNode_getChildNodes):
9938         (JSNode_getFirstChild):
9939         (JSNode_finalize):
9940         (JSNode_class):
9941         (JSNode_prototype):
9942         (JSNode_new):
9943         (JSNode_construct):
9944         * API/JSNode.h: Added.
9945         * API/JSNodeList.c: Added.
9946         (JSNodeListPrototype_item):
9947         (JSNodeListPrototype_class):
9948         (JSNodeList_length):
9949         (JSNodeList_getProperty):
9950         (JSNodeList_finalize):
9951         (JSNodeList_class):
9952         (JSNodeList_prototype):
9953         (JSNodeList_new):
9954         * API/JSNodeList.h: Added.
9955         * API/JSObjectRef.cpp:
9956         (JSObjectMake):
9957         (JSFunctionMake):
9958         (JSConstructorMake):
9959         (__JSPropertyEnumerator::__JSPropertyEnumerator):
9960         (JSObjectCreatePropertyEnumerator):
9961         (JSPropertyEnumeratorGetNext):
9962         (JSPropertyEnumeratorRetain):
9963         (JSPropertyEnumeratorRelease):
9964         * API/JSObjectRef.h:
9965         (__JSObjectCallbacks::):
9966         * API/JSValueRef.cpp:
9967         (JSValueIsObjectOfClass):
9968         (JSValueIsInstanceOf):
9969         * API/JSValueRef.h:
9970         * API/Node.c: Added.
9971         (Node_new):
9972         (Node_appendChild):
9973         (Node_removeChild):
9974         (Node_replaceChild):
9975         (Node_ref):
9976         (Node_deref):
9977         * API/Node.h: Added.
9978         * API/NodeList.c: Added.
9979         (NodeList_new):
9980         (NodeList_length):
9981         (NodeList_item):
9982         (NodeList_ref):
9983         (NodeList_deref):
9984         * API/NodeList.h: Added.
9985         * API/minidom.c:
9986         (main):
9987         (print):
9988         (createStringWithContentsOfFile):
9989         * API/minidom.js:
9990         * API/testapi.c:
9991         (assertEqualsAsCharacters):
9992         (MyObject_getProperty):
9993         (MyObject_class):
9994         (myConstructor_callAsConstructor):
9995         (main):
9996         * API/testapi.js:
9997         * JavaScriptCore.xcodeproj/project.pbxproj:
9998
9999 2006-06-26  Kevin Ollivier  <kevino@theolliviers.com>
10000         
10001         Reviewed and tweaked by Darin.
10002
10003         - Compile fixes for wx port / gcc 4.0.2
10004
10005         * kjs/array_object.cpp:
10006         Added missing headers. 
10007
10008         * kjs/ExecState.h:
10009         gcc needs class prototypes before defining those classes as friend classes
10010
10011 2006-06-30  Mike Emmel  <mike.emmel@gmail.com>
10012
10013         Reviewed by Darin.
10014
10015         Compilation fixes for Linux/Gdk.
10016
10017         * JavaScriptCore/kjs/interpreter.cpp: added include of signal.h
10018         * JavaScriptCore/kjs/ExecState.h: added missing class declaration 
10019         * JavaScriptCore/kjs/ExecState.cpp: case wrong on include of context.h 
10020         * JavaScriptCore/JavaScriptCoreSources.bkl: added Context.cpp and ExecState.cpp
10021
10022 === Safari-521.14 ===
10023
10024 2006-06-29  Maciej Stachowiak  <mjs@apple.com>
10025
10026         Reviewed by Geoff.
10027         
10028         - add headerdoc comments to some of the new JS API headers
10029
10030         * API/JSBase.h:
10031         * API/JSValueRef.h:
10032
10033 2006-06-28  Timothy Hatcher  <timothy@apple.com>
10034
10035         Prefer the Stabs debugging symbols format until DWARF bugs are fixed.
10036
10037         * JavaScriptCore.xcodeproj/project.pbxproj:
10038
10039 2006-06-27  Timothy Hatcher  <timothy@apple.com>
10040
10041         Reviewed by Tim O.
10042
10043         <rdar://problem/4448350> Deprecated ObjC language API used in JavaScriptCore, WebCore, WebKit and WebBrowser
10044
10045         Switch to the new ObjC 2 API, ifdefed the old code around OBJC_API_VERSION so it still works on Tiger.
10046         Removed the use of the old stringWithCString, switched to the new Tiger version that accepts an encoding.
10047         Lots of code style cleanup.
10048
10049         * JavaScriptCore.xcodeproj/project.pbxproj:
10050         * bindings/objc/objc_class.h:
10051         * bindings/objc/objc_class.mm:
10052         (KJS::Bindings::ObjcClass::~ObjcClass):
10053         (KJS::Bindings::_createClassesByIsAIfNecessary):
10054         (KJS::Bindings::ObjcClass::classForIsA):
10055         (KJS::Bindings::ObjcClass::name):
10056         (KJS::Bindings::ObjcClass::methodsNamed):
10057         (KJS::Bindings::ObjcClass::fieldNamed):
10058         (KJS::Bindings::ObjcClass::fallbackObject):
10059         * bindings/objc/objc_header.h:
10060         * bindings/objc/objc_instance.h:
10061         * bindings/objc/objc_instance.mm:
10062         (ObjcInstance::ObjcInstance):
10063         (ObjcInstance::~ObjcInstance):
10064         (ObjcInstance::operator=):
10065         (ObjcInstance::begin):
10066         (ObjcInstance::end):
10067         (ObjcInstance::getClass):
10068         (ObjcInstance::invokeMethod):
10069         (ObjcInstance::invokeDefaultMethod):
10070         (ObjcInstance::setValueOfField):
10071         (ObjcInstance::supportsSetValueOfUndefinedField):
10072         (ObjcInstance::setValueOfUndefinedField):
10073         (ObjcInstance::getValueOfField):
10074         (ObjcInstance::getValueOfUndefinedField):
10075         (ObjcInstance::defaultValue):
10076         (ObjcInstance::stringValue):
10077         (ObjcInstance::numberValue):
10078         (ObjcInstance::booleanValue):
10079         (ObjcInstance::valueOf):
10080         * bindings/objc/objc_runtime.h:
10081         * bindings/objc/objc_runtime.mm:
10082         (ObjcMethod::ObjcMethod):
10083         (ObjcMethod::name):
10084         (ObjcMethod::getMethodSignature):
10085         (ObjcMethod::setJavaScriptName):
10086         (ObjcField::name):
10087         (ObjcField::type):
10088         (ObjcField::valueFromInstance):
10089         (convertValueToObjcObject):
10090         (ObjcField::setValueToInstance):
10091         (ObjcArray::operator=):
10092         (ObjcArray::setValueAt):
10093         (ObjcArray::valueAt):
10094         (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
10095         (ObjcFallbackObjectImp::callAsFunction):
10096         (ObjcFallbackObjectImp::defaultValue):
10097
10098 2006-06-28  Anders Carlsson  <acarlsson@apple.com>
10099
10100         Reviewed by Geoff.
10101
10102         http://bugs.webkit.org/show_bug.cgi?id=8636
10103         REGRESSION: JavaScript access to Java applet causes hang (_webViewURL not implemented)
10104
10105         * bindings/jni/jni_objc.mm:
10106         (KJS::Bindings::dispatchJNICall):
10107         Just pass nil as the calling URL. This will cause the Java plugin to use the URL of the page
10108         containing the applet (which is what we used to do).
10109
10110 2006-06-27  Timothy Hatcher  <timothy@apple.com>
10111
10112         Reviewed by Darin.
10113
10114         <rdar://problem/4406785> Add an export file to TOT JavaScriptCore like the Safari-2-0-branch
10115
10116         * JavaScriptCore.exp: Added.
10117         * JavaScriptCore.xcodeproj/project.pbxproj:
10118
10119 2006-06-25  Geoffrey Garen  <ggaren@apple.com>
10120
10121         Reviewed by Adele.
10122         
10123         - Added JSConstructorMake to match JSFunctionMake, along with test code.
10124         
10125         [ I checked in the ChangeLog before without the actual files. ]
10126
10127         * API/JSObjectRef.cpp:
10128         (JSConstructorMake):
10129         * API/JSObjectRef.h:
10130         * API/testapi.c:
10131         (myConstructor_callAsConstructor):
10132         (main):
10133         * API/testapi.js:
10134         * ChangeLog:
10135         * JavaScriptCore.xcodeproj/project.pbxproj: Moved testapi.c to the testapi
10136         target -- this was an oversight in my earlier check-in.
10137
10138 2006-06-25  Timothy Hatcher  <timothy@apple.com>
10139
10140         Reviewed by Darin.
10141
10142         Bug 9574: Drosera should show inline scripts within the original HTML
10143         http://bugs.webkit.org/show_bug.cgi?id=9574
10144
10145         Pass the starting line number and error message to the debugger.
10146
10147         * kjs/debugger.cpp:
10148         (Debugger::sourceParsed):
10149         * kjs/debugger.h:
10150         * kjs/function.cpp:
10151         (KJS::GlobalFuncImp::callAsFunction):
10152         * kjs/function_object.cpp:
10153         (FunctionObjectImp::construct):
10154         * kjs/interpreter.cpp:
10155         (KJS::Interpreter::evaluate):
10156
10157 2006-06-24  Alexey Proskuryakov  <ap@nypop.com>
10158
10159         Rubber-stamped by Eric.
10160
10161         Add a -h (do not follow symlinks) option to ln in derived sources build script (without it,
10162         a symlink was created inside the source directory on second build).
10163
10164         * JavaScriptCore.xcodeproj/project.pbxproj:
10165
10166 2006-06-24  David Kilzer  <ddkilzer@kilzer.net>
10167
10168         Reviewed by Timothy.
10169
10170         * Info.plist: Fixed copyright to include 2003-2006.
10171
10172 2006-06-24  Alexey Proskuryakov  <ap@nypop.com>
10173
10174         Reviewed by Darin.
10175
10176         - http://bugs.webkit.org/show_bug.cgi?id=9418
10177         WebKit will not build when Space exists in path
10178
10179         * JavaScriptCore.xcodeproj/project.pbxproj: Enclose search paths in quotes; create symlinks to 
10180         avoid passing paths with spaces to make.
10181
10182 2006-06-23  Timothy Hatcher  <timothy@apple.com>
10183
10184         Reviewed by Darin.
10185
10186         Adding more operator[] overloads for long and short types.
10187
10188         * wtf/Vector.h:
10189         (WTF::Vector::operator[]):
10190
10191 === JavaScriptCore-521.13 ===
10192
10193 2006-06-22  Alexey Proskuryakov  <ap@nypop.com>
10194
10195         Build fix.
10196
10197         - http://bugs.webkit.org/show_bug.cgi?id=9539
10198         Another case error preventing build
10199
10200         * API/JSObjectRef.cpp: Changed "identifier.h" to "Identifier.h"
10201         
10202 2006-06-22  David Kilzer  <ddkilzer@kilzer.net>
10203
10204         Build fix.
10205
10206         http://bugs.webkit.org/show_bug.cgi?id=9539
10207         Another case error preventing build
10208
10209         * API/APICast.h: Changed "UString.h" to "ustring.h".
10210
10211 2006-06-21  Geoffrey Garen  <ggaren@apple.com>
10212
10213         Fixed release build, fixed accidental infinite recursion due to
10214         last minute global replace gone awry.
10215         
10216         * API/APICast.h:
10217         (toRef):
10218         * API/testapi.c:
10219         (assertEqualsAsBoolean):
10220         (assertEqualsAsNumber):
10221         (assertEqualsAsUTF8String):
10222         (assertEqualsAsCharactersPtr):
10223         * JavaScriptCore.xcodeproj/project.pbxproj:
10224
10225 2006-06-21  Geoffrey Garen  <ggaren@apple.com>
10226
10227         Reviewed by Anders.
10228         
10229         - First cut at C API to JavaScript. Includes a unit test, 'testapi.c', 
10230         and the outline of a test app, 'minidom.c'.
10231         
10232         Includes one change to JSC internals: Rename propList to getPropertyList and have it
10233         take its target property list by reference so that subclasses can
10234         add properties to the list before calling through to their superclasses.
10235         
10236         Also, I just ran prepare-ChangeLog in about 10 seconds, and I would like
10237         to give a shout-out to that.
10238         
10239         * API/APICast.h: Added.
10240         (toJS):
10241         (toRef):
10242         * API/JSBase.h: Added.
10243         * API/JSCallbackObject.cpp: Added.
10244         (KJS::):
10245         (KJS::JSCallbackObject::JSCallbackObject):
10246         (KJS::JSCallbackObject::~JSCallbackObject):
10247         (KJS::JSCallbackObject::className):
10248         (KJS::JSCallbackObject::getOwnPropertySlot):
10249         (KJS::JSCallbackObject::put):
10250         (KJS::JSCallbackObject::deleteProperty):
10251         (KJS::JSCallbackObject::implementsConstruct):
10252         (KJS::JSCallbackObject::construct):
10253         (KJS::JSCallbackObject::implementsCall):
10254         (KJS::JSCallbackObject::callAsFunction):
10255         (KJS::JSCallbackObject::getPropertyList):
10256         (KJS::JSCallbackObject::toBoolean):
10257         (KJS::JSCallbackObject::toNumber):
10258         (KJS::JSCallbackObject::toString):
10259         (KJS::JSCallbackObject::setPrivate):
10260         (KJS::JSCallbackObject::getPrivate):
10261         (KJS::JSCallbackObject::cachedValueGetter):
10262         (KJS::JSCallbackObject::callbackGetter):
10263         * API/JSCallbackObject.h: Added.
10264         (KJS::JSCallbackObject::classInfo):
10265         * API/JSCharBufferRef.cpp: Added.
10266         (JSStringMake):
10267         (JSCharBufferCreate):
10268         (JSCharBufferCreateUTF8):
10269         (JSCharBufferRetain):
10270         (JSCharBufferRelease):
10271         (JSValueCopyStringValue):
10272         (JSCharBufferGetLength):
10273         (JSCharBufferGetCharactersPtr):
10274         (JSCharBufferGetCharacters):
10275         (JSCharBufferGetMaxLengthUTF8):
10276         (JSCharBufferGetCharactersUTF8):
10277         (JSCharBufferIsEqual):
10278         (JSCharBufferIsEqualUTF8):
10279         (JSCharBufferCreateWithCFString):
10280         (CFStringCreateWithJSCharBuffer):
10281         * API/JSCharBufferRef.h: Added.
10282         * API/JSContextRef.cpp: Added.
10283         (JSContextCreate):
10284         (JSContextDestroy):
10285         (JSContextGetGlobalObject):
10286         (JSEvaluate):
10287         (JSCheckSyntax):
10288         (JSContextHasException):
10289         (JSContextGetException):
10290         (JSContextClearException):
10291         (JSContextSetException):
10292         * API/JSContextRef.h: Added.
10293         * API/JSObjectRef.cpp: Added.
10294         (JSValueToObject):
10295         (JSObjectMake):
10296         (JSFunctionMake):
10297         (JSObjectGetDescription):
10298         (JSObjectGetPrototype):
10299         (JSObjectSetPrototype):
10300         (JSObjectHasProperty):
10301         (JSObjectGetProperty):
10302         (JSObjectSetProperty):
10303         (JSObjectDeleteProperty):
10304         (JSObjectGetPrivate):
10305         (JSObjectSetPrivate):
10306         (JSObjectIsFunction):
10307         (JSObjectCallAsFunction):
10308         (JSObjectIsConstructor):
10309         (JSObjectCallAsConstructor):
10310         (__JSPropertyListEnumerator::__JSPropertyListEnumerator):
10311         (JSObjectCreatePropertyEnumerator):
10312         (JSPropertyEnumeratorGetNext):
10313         (JSPropertyEnumeratorRetain):
10314         (JSPropertyEnumeratorRelease):
10315         (JSPropertyListAdd):
10316         * API/JSObjectRef.h: Added.
10317         * API/JSValueRef.cpp: Added.
10318         (JSValueGetType):
10319         (JSValueIsUndefined):
10320         (JSValueIsNull):
10321         (JSValueIsBoolean):
10322         (JSValueIsNumber):
10323         (JSValueIsString):
10324         (JSValueIsObject):
10325         (JSValueIsEqual):
10326         (JSValueIsStrictEqual):
10327         (JSUndefinedMake):
10328         (JSNullMake):
10329         (JSBooleanMake):
10330         (JSNumberMake):
10331         (JSValueToBoolean):
10332         (JSValueToNumber):
10333         (JSGCProtect):
10334         (JSGCUnprotect):
10335         (JSGCCollect):
10336         * API/JSValueRef.h: Added.
10337         * API/JavaScriptCore.h: Added.
10338         * API/minidom.c: Added.
10339         (main):
10340         * API/minidom.html: Added.
10341         * API/minidom.js: Added.
10342         * API/testapi.c: Added.
10343         (assertEqualsAsBoolean):
10344         (assertEqualsAsNumber):
10345         (assertEqualsAsUTF8String):
10346         (assertEqualsAsCharactersPtr):
10347         (assertEqualsAsCharacters):
10348         (MyObject_initialize):
10349         (MyObject_copyDescription):
10350         (MyObject_hasProperty):
10351         (MyObject_getProperty):
10352         (MyObject_setProperty):
10353         (MyObject_deleteProperty):
10354         (MyObject_getPropertyList):
10355         (MyObject_callAsFunction):
10356         (MyObject_callAsConstructor):
10357         (MyObject_convertToType):
10358         (MyObject_finalize):
10359         (print_callAsFunction):
10360         (main):
10361         (createStringWithContentsOfFile):
10362         * API/testapi.js: Added.
10363         * ChangeLog:
10364         * JavaScriptCore.xcodeproj/project.pbxproj:
10365         * bindings/npruntime_impl.h:
10366         * kjs/array_instance.h:
10367         * kjs/array_object.cpp:
10368         (ArrayInstance::getPropertyList):
10369         * kjs/interpreter.cpp:
10370         (KJS::Interpreter::evaluate):
10371         * kjs/nodes.cpp:
10372         (ForInNode::execute):
10373         * kjs/object.cpp:
10374         (KJS::JSObject::put):
10375         (KJS::JSObject::canPut):
10376         (KJS::JSObject::deleteProperty):
10377         (KJS::JSObject::propertyIsEnumerable):
10378         (KJS::JSObject::getPropertyAttributes):
10379         (KJS::JSObject::getPropertyList):
10380         * kjs/object.h:
10381         * kjs/property_map.cpp:
10382         (KJS::PropertyMap::get):
10383         * kjs/property_map.h:
10384         * kjs/scope_chain.cpp:
10385         (KJS::ScopeChain::print):
10386         * kjs/string_object.cpp:
10387         (StringInstance::getPropertyList):
10388         * kjs/string_object.h:
10389         * kjs/ustring.h:
10390         (KJS::UString::Rep::ref):
10391
10392 2006-06-20  Timothy Hatcher  <timothy@apple.com>
10393
10394         Reviewed by Geoff.
10395
10396         Make sure we clear the exception before returning so
10397         that future calls will not fail because of an earlier
10398         exception state. Assert on entry that the WebScriptObject
10399         is working with an ExecState that dose not have an exception. 
10400         Document that evaluateWebScript and callWebScriptMethod return
10401         WebUndefined when an exception is thrown.
10402
10403         * bindings/objc/WebScriptObject.h:
10404         * bindings/objc/WebScriptObject.mm:
10405         (-[WebScriptObject callWebScriptMethod:withArguments:]):
10406         (-[WebScriptObject evaluateWebScript:]):
10407         (-[WebScriptObject setValue:forKey:]):
10408         (-[WebScriptObject valueForKey:]):
10409         (-[WebScriptObject removeWebScriptKey:]):
10410         (-[WebScriptObject webScriptValueAtIndex:]):
10411         (-[WebScriptObject setWebScriptValueAtIndex:value:]):
10412
10413 2006-06-19  Anders Carlsson  <acarlsson@apple.com>
10414
10415         Reviewed by John.
10416
10417         * kjs/interpreter.cpp:
10418         (KJS::TimeoutChecker::pauseTimeoutCheck):
10419         (KJS::TimeoutChecker::resumeTimeoutCheck):
10420         Fix argument order in setitimer calls.
10421
10422 2006-06-18  Anders Carlsson  <acarlsson@apple.com>
10423
10424         Reviewed by Geoff.
10425
10426         * kjs/interpreter.cpp:
10427         (KJS::TimeoutChecker::pauseTimeoutCheck):
10428         Do nothing if the timeout check hasn't been started.
10429         
10430         (KJS::TimeoutChecker::resumeTimeoutCheck):
10431         Do nothing if the timeout check hasn't been started.
10432         Use the right signal handler when unblocking.
10433         
10434         (KJS::Interpreter::handleTimeout):
10435         pause/resume the timeout check around the call to
10436         shouldInterruptScript().
10437         
10438 2006-06-16  Ben Goodger <beng@google.com>
10439         
10440         Reviewed by Maciej
10441
10442         http://bugs.webkit.org/show_bug.cgi?id=9491
10443         Windows build breaks in interpreter.cpp 
10444
10445         * kjs/interpreter.cpp
10446         (KJS::TimeoutChecker::pauseTimeoutCheck):
10447         (KJS::TimeoutChecker::resumeTimeoutCheck):
10448         Make sure to only assert equality with s_executingInterpreter when it 
10449         is being used (i.e. when HAVE(SYS_TIME_H) == true)
10450
10451 2006-06-17  David Kilzer  <ddkilzer@kilzer.net>
10452
10453         Reviewed by darin.
10454
10455         http://bugs.webkit.org/show_bug.cgi?id=9477
10456         REGRESSION: fast/dom/replaceChild.html crashes on WebKit ToT in debug build
10457
10458         * kjs/function.cpp:
10459         (KJS::FunctionImp::callAsFunction): Refetch the debugger after executing the function
10460         in case the WebFrame it was running in has since been destroyed.
10461
10462 2006-06-17  David Kilzer  <ddkilzer@kilzer.net>
10463
10464         Reviewed by ggaren.
10465
10466         http://bugs.webkit.org/show_bug.cgi?id=9476
10467         REGRESSION: Reproducible crash after closing window after viewing
10468         css2.1/t0803-c5501-imrgn-t-00-b-ag.html
10469
10470         * kjs/debugger.cpp:
10471         (Debugger::detach): Call setDebugger(0) for all interpreters removed from
10472         the 'attached to a debugger' list.
10473
10474 2006-06-17  Anders Carlsson  <acarlsson@apple.com>
10475
10476         Reviewed by Maciej and Geoff.
10477
10478         http://bugs.webkit.org/show_bug.cgi?id=7080
10479         Provide some way to stop a JavaScript infinite loop
10480         
10481         * kjs/completion.h:
10482         (KJS::):
10483         Add Interrupted completion type.
10484         
10485         * kjs/function.cpp:
10486         (KJS::FunctionImp::callAsFunction):
10487         (KJS::GlobalFuncImp::callAsFunction):
10488         Only set the exception on the new ExecState if the current one has had one.
10489         
10490         * kjs/interpreter.cpp:
10491         (KJS::TimeoutChecker::startTimeoutCheck):
10492         (KJS::TimeoutChecker::stopTimeoutCheck):
10493         (KJS::TimeoutChecker::alarmHandler):
10494         (KJS::TimeoutChecker::pauseTimeoutCheck):
10495         (KJS::TimeoutChecker::resumeTimeoutCheck):
10496         New TimeoutChecker class which handles setting Interpreter::m_timedOut flag after a given
10497         period of time. This currently only works on Unix platforms where setitimer and signals are used.
10498         
10499         (KJS::Interpreter::Interpreter):
10500         Initialize new member variables.
10501         
10502         (KJS::Interpreter::~Interpreter):
10503         Destroy the timeout checker.
10504         
10505         (KJS::Interpreter::startTimeoutCheck):
10506         (KJS::Interpreter::stopTimeoutCheck):
10507         (KJS::Interpreter::pauseTimeoutCheck):
10508         (KJS::Interpreter::resumeTimeoutCheck):
10509         Call the timeout checker.
10510         
10511         (KJS::Interpreter::handleTimeout):
10512         Called on timeout. Resets the m_timedOut flag and calls shouldInterruptScript.
10513         
10514         * kjs/interpreter.h:
10515         (KJS::Interpreter::setTimeoutTime):
10516         New function for setting the timeout time.
10517         
10518         (KJS::Interpreter::shouldInterruptScript):
10519         New function. The idea is that this should be overridden by subclasses in order to for example
10520         pop up a dialog asking the user if the script should be interrupted.
10521         
10522         (KJS::Interpreter::checkTimeout):
10523         New function which checks the m_timedOut flag and calls handleTimeout if it's set.
10524         
10525         * kjs/nodes.cpp:
10526         (DoWhileNode::execute):
10527         (WhileNode::execute):
10528         (ForNode::execute):
10529         Call Interpreter::checkTimeout after each iteration of the loop.
10530
10531 2006-06-15  Timothy Hatcher  <timothy@apple.com>
10532
10533         Reviewed by Geoff and Darin.
10534         
10535         Prefer the DWARF debugging symbols format for use in Xcode 2.3.
10536
10537         * JavaScriptCore.xcodeproj/project.pbxproj:
10538
10539 2006-06-14  Geoffrey Garen  <ggaren@apple.com>
10540
10541         Reviewed by Beth.
10542         
10543         - fixed http://bugs.webkit.org/show_bug.cgi?id=9438
10544         Someone broke ToT: cannot build
10545
10546         * JavaScriptCore.xcodeproj/project.pbxproj:
10547         * bindings/runtime_root.h: Changed "Interpreter.h" to "interpreter.h"
10548
10549 2006-06-12  Geoffrey Garen  <ggaren@apple.com>
10550
10551         build fix
10552         
10553         * bindings/objc/WebScriptObject.mm:
10554         (+[WebScriptObject throwException:]): Restore assignment I accidentally
10555         deleted in previous commit
10556
10557 2006-06-12  Geoffrey Garen  <ggaren@apple.com>
10558
10559         Reviewed by TimO, Maciej.
10560         
10561         - Merged InterpreterImp code into Interpreter, which implements
10562         all interpreter functionality now. This is part of my continuing quest
10563         to create an external notion of JS "execution context" that is unified and simple --
10564         something to replace the mix of Context, ContextImp, ExecState, Interpreter,
10565         InterpreterImp, and JSRun.
10566         
10567         All tests pass. Leaks test has not regressed from its baseline ~207 leaks
10568         with ~3460 leaked nodes.
10569
10570         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
10571         * JavaScriptCore.xcodeproj/project.pbxproj:
10572         * bindings/NP_jsobject.cpp:
10573         * bindings/objc/WebScriptObject.mm:
10574         (+[WebScriptObject throwException:]):
10575         * bindings/runtime_root.cpp:
10576         * bindings/runtime_root.h:
10577         * kjs/Context.cpp:
10578         (KJS::Context::Context):
10579         * kjs/ExecState.cpp: Added.
10580         (KJS::ExecState::lexicalInterpreter):
10581         * kjs/ExecState.h: Added.
10582         (KJS::ExecState::dynamicInterpreter):
10583         * kjs/SavedBuiltins.h: Added.
10584         * kjs/bool_object.cpp:
10585         (BooleanPrototype::BooleanPrototype):
10586         * kjs/collector.cpp:
10587         (KJS::Collector::collect):
10588         (KJS::Collector::numInterpreters):
10589         * kjs/context.h:
10590         * kjs/debugger.cpp:
10591         (Debugger::attach):
10592         (Debugger::detach):
10593         * kjs/function.cpp:
10594         (KJS::FunctionImp::callAsFunction):
10595         (KJS::GlobalFuncImp::callAsFunction):
10596         * kjs/function_object.cpp:
10597         (FunctionObjectImp::construct):
10598         * kjs/internal.cpp:
10599         * kjs/internal.h:
10600         * kjs/interpreter.cpp:
10601         (KJS::interpreterMap):
10602         (KJS::Interpreter::Interpreter):
10603         (KJS::Interpreter::init):
10604         (KJS::Interpreter::~Interpreter):
10605         (KJS::Interpreter::globalObject):
10606         (KJS::Interpreter::initGlobalObject):
10607         (KJS::Interpreter::globalExec):
10608         (KJS::Interpreter::checkSyntax):
10609         (KJS::Interpreter::evaluate):
10610         (KJS::Interpreter::builtinObject):
10611         (KJS::Interpreter::builtinFunction):
10612         (KJS::Interpreter::builtinArray):
10613         (KJS::Interpreter::builtinBoolean):
10614         (KJS::Interpreter::builtinString):
10615         (KJS::Interpreter::builtinNumber):
10616         (KJS::Interpreter::builtinDate):
10617         (KJS::Interpreter::builtinRegExp):
10618         (KJS::Interpreter::builtinError):
10619         (KJS::Interpreter::builtinObjectPrototype):
10620         (KJS::Interpreter::builtinFunctionPrototype):
10621         (KJS::Interpreter::builtinArrayPrototype):
10622         (KJS::Interpreter::builtinBooleanPrototype):
10623         (KJS::Interpreter::builtinStringPrototype):
10624         (KJS::Interpreter::builtinNumberPrototype):
10625         (KJS::Interpreter::builtinDatePrototype):
10626         (KJS::Interpreter::builtinRegExpPrototype):
10627         (KJS::Interpreter::builtinErrorPrototype):
10628         (KJS::Interpreter::builtinEvalError):
10629         (KJS::Interpreter::builtinRangeError):
10630         (KJS::Interpreter::builtinReferenceError):
10631         (KJS::Interpreter::builtinSyntaxError):
10632         (KJS::Interpreter::builtinTypeError):
10633         (KJS::Interpreter::builtinURIError):
10634         (KJS::Interpreter::builtinEvalErrorPrototype):
10635         (KJS::Interpreter::builtinRangeErrorPrototype):
10636         (KJS::Interpreter::builtinReferenceErrorPrototype):
10637         (KJS::Interpreter::builtinSyntaxErrorPrototype):
10638         (KJS::Interpreter::builtinTypeErrorPrototype):
10639         (KJS::Interpreter::builtinURIErrorPrototype):
10640         (KJS::Interpreter::mark):
10641         (KJS::Interpreter::interpreterWithGlobalObject):
10642         (KJS::Interpreter::saveBuiltins):
10643         (KJS::Interpreter::restoreBuiltins):
10644         * kjs/interpreter.h:
10645         (KJS::Interpreter::setCompatMode):
10646         (KJS::Interpreter::compatMode):
10647         (KJS::Interpreter::firstInterpreter):
10648         (KJS::Interpreter::nextInterpreter):
10649         (KJS::Interpreter::prevInterpreter):
10650         (KJS::Interpreter::debugger):
10651         (KJS::Interpreter::setDebugger):
10652         (KJS::Interpreter::setContext):
10653         (KJS::Interpreter::context):
10654         * kjs/nodes.cpp:
10655         (StatementNode::hitStatement):
10656         (RegExpNode::evaluate):
10657         * kjs/protect.h:
10658
10659 2006-06-12  Geoffrey Garen  <ggaren@apple.com>
10660
10661         Reviewed by Maciej.
10662         
10663         - Have *.lut.h files #include lookup.h to eliminate surprising header
10664         include order dependency.
10665
10666         * DerivedSources.make:
10667         * kjs/array_object.cpp:
10668         * kjs/date_object.cpp:
10669         * kjs/date_object.h:
10670         (KJS::DateProtoFunc::):
10671         * kjs/lexer.cpp:
10672         * kjs/math_object.cpp:
10673         * kjs/number_object.cpp:
10674         * kjs/regexp_object.cpp:
10675         * kjs/string_object.cpp:
10676
10677 2006-06-10  Geoffrey Garen  <ggaren@apple.com>
10678
10679         - http://bugs.webkit.org/show_bug.cgi?id=8515
10680         Linux porting compile bug
10681         
10682         Fix by Mike Emmel, Reviewed by Darin.
10683
10684         * JavaScriptCoreSources.bkl:
10685         * jscore.bkl:
10686         * wtf/Platform.h:
10687
10688 2006-06-09  Geoffrey Garen  <ggaren@apple.com>
10689
10690         Build fix -- I think :).
10691
10692         * JavaScriptCore.xcodeproj/project.pbxproj:
10693         * kjs/context.h:
10694
10695 2006-06-09  Geoffrey Garen  <ggaren@apple.com>
10696
10697         Reviewed by Eric (yay!).
10698         
10699         - Removed Context wrapper for ContextImp, renamed ContextImp to Context,
10700         split Context into its own file -- Context.cpp -- renamed _var to m_var,
10701         change ' *' to '* '.
10702
10703         * JavaScriptCore.xcodeproj/project.pbxproj:
10704         * kjs/Context.cpp: Added.
10705         (KJS::Context::Context):
10706         (KJS::Context::~Context):
10707         (KJS::Context::mark):
10708         * kjs/context.h:
10709         (KJS::Context::scopeChain):
10710         (KJS::Context::variableObject):
10711         (KJS::Context::setVariableObject):
10712         (KJS::Context::thisValue):
10713         (KJS::Context::callingContext):
10714         (KJS::Context::activationObject):
10715         (KJS::Context::currentBody):
10716         (KJS::Context::function):
10717         (KJS::Context::arguments):
10718         (KJS::Context::pushScope):
10719         (KJS::Context::seenLabels):
10720         * kjs/function.cpp:
10721         (KJS::FunctionImp::callAsFunction):
10722         (KJS::FunctionImp::processParameters):
10723         (KJS::FunctionImp::argumentsGetter):
10724         (KJS::GlobalFuncImp::callAsFunction):
10725         * kjs/internal.cpp:
10726         (KJS::InterpreterImp::evaluate):
10727         * kjs/internal.h:
10728         (KJS::InterpreterImp::setContext):
10729         (KJS::InterpreterImp::context):
10730         * kjs/interpreter.cpp:
10731         * kjs/interpreter.h:
10732         (KJS::ExecState::context):
10733         (KJS::ExecState::ExecState):
10734         * kjs/nodes.cpp:
10735         (currentSourceId):
10736         (currentSourceURL):
10737         (ThisNode::evaluate):
10738         (ResolveNode::evaluate):
10739         (FunctionCallResolveNode::evaluate):
10740         (PostfixResolveNode::evaluate):
10741         (DeleteResolveNode::evaluate):
10742         (TypeOfResolveNode::evaluate):
10743         (PrefixResolveNode::evaluate):
10744         (AssignResolveNode::evaluate):
10745         (VarDeclNode::evaluate):
10746         (VarDeclNode::processVarDecls):
10747         (DoWhileNode::execute):
10748         (WhileNode::execute):
10749         (ForNode::execute):
10750         (ForInNode::execute):
10751         (ContinueNode::execute):
10752         (BreakNode::execute):
10753         (ReturnNode::execute):
10754         (WithNode::execute):
10755         (SwitchNode::execute):
10756         (LabelNode::execute):
10757         (TryNode::execute):
10758         (FuncDeclNode::processFuncDecl):
10759         (FuncExprNode::evaluate):
10760
10761 2006-06-07  Geoffrey Garen  <ggaren@apple.com>
10762
10763         Removed API directory I prematurely/accidentally added.
10764
10765         * API: Removed.
10766
10767 2006-06-05  Mitz Pettel  <opendarwin.org@mitzpettel.com>
10768
10769         Reviewed and landed by Geoff.
10770
10771         - fix a regression in ecma_3/String/regress-104375.js
10772
10773         * kjs/string_object.cpp:
10774         (substituteBackreferences): If a 2-digit back reference is out of range,
10775         parse it as a 1-digit reference (followed by the other digit). This matches
10776         Firefox's behavior.
10777
10778 2006-06-05  Geoffrey Garen  <ggaren@apple.com>
10779
10780         Reviewed By Maciej.
10781         Darin already reviewed this change on the branch. See <rdar://problem/4317701>.
10782         
10783         - Fixed <rdar://problem/4291345> PCRE overflow in Safari JavaScriptCore
10784
10785         No test case because there's no behavior change.
10786         
10787         * pcre/pcre_compile.c:
10788         (read_repeat_counts): Check for integer overflow / out of bounds
10789
10790 2006-06-05  Geoffrey Garen  <ggaren@apple.com>
10791
10792         Reviewed by aliu.
10793
10794         - Changed CString length from int to size_t. We sould probably do this
10795         for UString, too. (Darin, if you're reading this: Maciej said so.)
10796         
10797         * kjs/function.cpp:
10798         (KJS::encode):
10799         * kjs/ustring.cpp:
10800         (KJS::CString::CString):
10801         (KJS::operator==):
10802         * kjs/ustring.h:
10803         (KJS::CString::size):
10804
10805 2006-06-04  Geoffrey Garen  <ggaren@apple.com>
10806
10807         Reviewed by Maciej.
10808         
10809         - http://bugs.webkit.org/show_bug.cgi?id=9304
10810         Minor cleanup in JavaScriptCore
10811
10812         * kjs/value.h: Removed redundant declarations
10813
10814 2006-06-04  Darin Adler  <darin@apple.com>
10815
10816         Reviewed by Anders.
10817
10818         - changed deleteAllValues so it can work on "const" collections
10819           Deleting the values affects the values, not the pointers in the
10820           collection, so it's legitimate to do it to a const collection,
10821           and a case of that actually came up in the XPath code.
10822
10823         * wtf/HashMap.h:
10824         (WTF::deleteAllPairSeconds): Use const iterators.
10825         (WTF::deleteAllValues): Take const HashMap reference as a parameter.
10826         * wtf/HashSet.h:
10827         (WTF::deleteAllValues): Take const HashSet reference as a parameter,
10828         and use const iterators.
10829         * wtf/Vector.h:
10830         (WTF::deleteAllValues): Take const Vector reference as a parameter.
10831
10832         - added more functions that are present in <math.h> on some platforms,
10833           but not on others; moved here from various files in WebCore
10834
10835         * wtf/MathExtras.h:
10836         (isinf): Added.
10837         (isnan): Added.
10838         (lround): Added.
10839         (lroundf): Tweaked.
10840         (round): Added.
10841         (roundf): Tweaked.
10842         (signbit): Added.
10843
10844 2006-06-02  Mitz Pettel  <opendarwin.org@mitzpettel.com>
10845
10846         Reviewed by ggaren.
10847
10848         - http://bugs.webkit.org/show_bug.cgi?id=9234
10849           Implement $&, $' and $` replacement codes in String.prototype.replace
10850
10851         Test: fast/js/string-replace-3.html
10852
10853         * kjs/string_object.cpp:
10854         (substituteBackreferences): Added support for $& (matched substring),
10855         $` (everything preceding matched substring), $' (everything following
10856         matched substring) and 2-digit back references, and cleaned up a little.
10857
10858 2006-06-02 Adele Peterson  <adele@apple.com>
10859
10860         Reviewed by Darin.
10861
10862         Set incremental linking to no. This seems to fix a build problem I was seeing
10863         where dftables couldn't find a dll. 
10864
10865         * JavaScriptCore.vcproj/dftables/dftables.vcproj:
10866
10867 2006-05-26  Steve Falkenburg  <sfalken@apple.com>
10868
10869         Build fixes/tweaks
10870
10871         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
10872
10873 === JavaScriptCore-521.11 ===
10874
10875 2006-05-24  Geoffrey Garen  <ggaren@apple.com>
10876
10877         Reviewed by mjs.
10878         
10879         - JSC half of fix for <rdar://problem/4557926> TOT REGRESSSION: Crash
10880         occurs when attempting to view image in slideshow mode at
10881         http://d.smugmug.com/gallery/581716 ( KJS::IfNode::execute
10882         (KJS::ExecState*) + 312)
10883
10884         On alternate threads, DOMObjects remain in the
10885         ScriptInterpreter's cache because they're not collected. So, they
10886         need an opportunity to mark their children.
10887         
10888         I'm not particularly happy with this solution because it fails to
10889         resolve many outstanding issues with the DOM object cache. Since none
10890         of those issues is a crasher or a serious compatibility concern,
10891         and since the behavior of other browsers is not much to go on in this
10892         case, I've filed <rdar://problem/4561439> about that, and I'm moving on 
10893         with my life.
10894
10895         * JavaScriptCore.xcodeproj/project.pbxproj:
10896         * kjs/collector.cpp:
10897         (KJS::Collector::collect):
10898         * kjs/internal.cpp:
10899         (KJS::InterpreterImp::mark):
10900         * kjs/internal.h:
10901         * kjs/interpreter.cpp:
10902         (KJS::Interpreter::mark):
10903         * kjs/interpreter.h:
10904
10905 === JavaScriptCore-521.10 ===
10906
10907 2006-05-22  Timothy Hatcher  <timothy@apple.com>
10908
10909         Reviewed by Eric, Kevin and Geoff.
10910
10911         Merge open source build fixes. <rdar://problem/4555500>
10912
10913         * kjs/collector.cpp: look at the rsp register in x86_64 
10914         (KJS::Collector::markOtherThreadConservatively):
10915         * wtf/Platform.h: add x86_64 to the platform list
10916
10917 2006-05-19  Anders Carlsson  <acarlsson@apple.com>
10918
10919         Reviewed by Geoff.
10920
10921         http://bugs.webkit.org/show_bug.cgi?id=8993
10922         Support function declaration in case statements
10923         
10924         * kjs/grammar.y: Get rid of StatementList and use SourceElements instead.
10925         
10926         * kjs/nodes.cpp:
10927         (CaseClauseNode::evalStatements):
10928         (CaseClauseNode::processVarDecls):
10929         (CaseClauseNode::processFuncDecl):
10930         (ClauseListNode::processFuncDecl):
10931         (CaseBlockNode::processFuncDecl):
10932         (SwitchNode::processFuncDecl):
10933         * kjs/nodes.h:
10934         (KJS::CaseClauseNode::CaseClauseNode):
10935         (KJS::ClauseListNode::ClauseListNode):
10936         (KJS::ClauseListNode::getClause):
10937         (KJS::ClauseListNode::getNext):
10938         (KJS::ClauseListNode::releaseNext):
10939         (KJS::SwitchNode::SwitchNode):
10940         Add processFuncDecl for the relevant nodes.        
10941
10942         * kjs/nodes2string.cpp:
10943         (CaseClauseNode::streamTo):
10944         next got renamed to source.
10945
10946 2006-05-17  George Staikos <staikos@kde.org>
10947
10948         Reviewed by Maciej, Alexey, and Eric.
10949
10950         * pcre/pcre_compile.c:
10951         * pcre/pcre_get.c:
10952         * pcre/pcre_exec.c:
10953         * wtf/UnusedParam.h:
10954         Use /**/ in .c files to compile with non-C99 and non-GCC compilers.
10955
10956         * kjs/testkjs.cpp:
10957         Change include to <wtf/HashTraits.h> from "HashTraits.h" to avoid -I
10958
10959         * wtf/unicode/qt4/UnicodeQt4.h:
10960         Use correct parentheses and correct mask for utf-32 support.
10961
10962 2006-05-17  Alexey Proskuryakov  <ap@nypop.com>
10963
10964         Reviewed by Darin.
10965
10966         - fix http://bugs.webkit.org/show_bug.cgi?id=8870
10967         Crash typing in Yahoo auto-complete widget.
10968
10969         Test: fast/js/regexp-stack-overflow.html
10970
10971         * pcre/pcre-config.h: Define NO_RECURSE.
10972
10973 2006-05-16  George Staikos <staikos@kde.org>
10974
10975         Reviewed by Maciej.
10976
10977         Fix some warnings and strict compilation errors.
10978
10979         * kjs/nodes.cpp: 
10980         * kjs/value.cpp: 
10981
10982 2006-05-15  Alexey Proskuryakov  <ap@nypop.com>
10983
10984         * make-generated-sources.sh: Changed to be executable and removed
10985         text in the file generated by "svn diff".
10986
10987 2006-05-15  Geoffrey Garen  <ggaren@apple.com>
10988
10989         Reviewed by Maciej.
10990
10991         - Fixed <rdar://problem/4534904> please do not treat "debugger" as
10992         a reserved word while parsing JavaScript (and other ECMA reserved
10993         words) 
10994
10995         AKA 
10996
10997         http://bugs.webkit.org/show_bug.cgi?id=6179 
10998         We treat "char" as a reserved word in JavaScript and firefox/IE do
10999         not
11000
11001         (1) I unreserved most of the spec's "future reserved words" because 
11002         they're not reserved in IE or FF. (Most, but not all, because IE
11003         somewhat randomly *does* reserve a few of them.)
11004         (2) I made 'debugger' a legitimate statement that acts like an empty
11005         statement because FF and IE support it.
11006         
11007         * kjs/grammar.y:
11008         * kjs/keywords.table:
11009
11010 2006-05-15  Tim Omernick  <timo@apple.com>
11011
11012         Reviewed by John Sullivan.
11013
11014         Part of <rdar://problem/4466508> Add 64-bit support to the Netscape Plugin API
11015
11016         Added to the Netscape Plugin API the concept of "plugin drawing models".  The drawing model
11017         determines the kind of graphics context created by the browser for the plugin, as well as 
11018         the Mac types of various Netscape Plugin API data structures.
11019
11020         There is a drawing model to represent the old QuickDraw-based API.  It is used by default
11021         if QuickDraw is available on the system, unless the plugin specifies another drawing model.
11022
11023         The big change is the addition of the CoreGraphics drawing model.  A plugin may request this
11024         drawing model to obtain access to a CGContextRef for drawing, instead of a QuickDraw CGrafPtr.
11025
11026         * bindings/npapi.h:
11027         Define NP_NO_QUICKDRAW when compiling 64-bit; there is no 64-bit QuickDraw.
11028         Added NPNVpluginDrawingModel, NPNVsupportsQuickDrawBool, and NPNVsupportsCoreGraphicsBool
11029         variables.
11030         Added NPDrawingModel enumeration.  Currently the only drawing models are QuickDraw and
11031         CoreGraphics.
11032         NPRegion's type now depends on the drawing model specified by the plugin.
11033         NP_Port is now only defined when QuickDraw is available.
11034         Added NP_CGContext, which is the type of the NPWindow's "window" member in CoreGraphics mode.
11035
11036 2006-05-13  Kevin M. Ollivier  <kevino@theolliviers.com>
11037
11038         Reviewed by Darin, landed by ap.
11039
11040         - http://bugs.webkit.org/show_bug.cgi?id=8528
11041           Bakefiles (and generated Makefiles) for wx and gdk ports
11042
11043         * make-generated-sources.sh: 
11044         Added script to configure environment to run DerivedSources.make
11045         
11046         * JavaScriptCoreSources.bkl:
11047         Added JavaScriptCore sources list for Bakefile.
11048         
11049         * jscore.bkl:
11050         Bakefile used to generate JavaScriptCore project files 
11051         (currently only used by wx and gdk ports)
11052
11053 2006-05-09  Steve Falkenburg  <sfalken@apple.com>
11054
11055         Fix Windows build.
11056         Minor fixes to WTF headers.
11057         
11058         Reviewed by kevin.
11059
11060         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Fix include dirs, paths to files. 
11061         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Fix include dirs.
11062         * wtf/Assertions.h: include Platform.h to get definition for COMPILER()
11063         * wtf/Vector.h: include FastMalloc.h for definition of fastMalloc, fastFree
11064
11065 2006-05-09  Maciej Stachowiak  <mjs@apple.com>
11066
11067         Rubber stamped by Anders.
11068         
11069         - renamed kxmlcore to wtf
11070         
11071         kxmlcore --> wtf
11072         KXMLCore --> WTF
11073         KXC --> WTF
11074
11075         * JavaScriptCore.xcodeproj/project.pbxproj:
11076         * bindings/c/c_instance.cpp:
11077         * bindings/objc/WebScriptObject.mm:
11078         * kjs/JSImmediate.h:
11079         * kjs/Parser.cpp:
11080         * kjs/Parser.h:
11081         * kjs/array_object.cpp:
11082         * kjs/collector.cpp:
11083         (KJS::Collector::registerThread):
11084         * kjs/collector.h:
11085         * kjs/config.h:
11086         * kjs/function.cpp:
11087         (KJS::isStrWhiteSpace):
11088         * kjs/function.h:
11089         * kjs/identifier.cpp:
11090         * kjs/internal.cpp:
11091         * kjs/internal.h:
11092         * kjs/lexer.cpp:
11093         (Lexer::shift):
11094         (Lexer::isWhiteSpace):
11095         (Lexer::isIdentStart):
11096         (Lexer::isIdentPart):
11097         * kjs/lookup.cpp:
11098         * kjs/nodes.cpp:
11099         * kjs/nodes.h:
11100         * kjs/number_object.cpp:
11101         * kjs/object.h:
11102         * kjs/property_map.cpp:
11103         * kjs/property_map.h:
11104         * kjs/string_object.cpp:
11105         (StringProtoFunc::callAsFunction):
11106         * kjs/testkjs.cpp:
11107         (testIsInteger):
11108         * kjs/ustring.cpp:
11109         * kjs/ustring.h:
11110         * kxmlcore: Removed.
11111         * kxmlcore/AlwaysInline.h: Removed.
11112         * kxmlcore/Assertions.cpp: Removed.
11113         * kxmlcore/Assertions.h: Removed.
11114         * kxmlcore/FastMalloc.cpp: Removed.
11115         * kxmlcore/FastMalloc.h: Removed.
11116         * kxmlcore/FastMallocInternal.h: Removed.
11117         * kxmlcore/Forward.h: Removed.
11118         * kxmlcore/HashCountedSet.h: Removed.
11119         * kxmlcore/HashFunctions.h: Removed.
11120         * kxmlcore/HashMap.h: Removed.
11121         * kxmlcore/HashSet.h: Removed.
11122         * kxmlcore/HashTable.cpp: Removed.
11123         * kxmlcore/HashTable.h: Removed.
11124         * kxmlcore/HashTraits.h: Removed.
11125         * kxmlcore/ListRefPtr.h: Removed.
11126         * kxmlcore/Noncopyable.h: Removed.
11127         * kxmlcore/OwnArrayPtr.h: Removed.
11128         * kxmlcore/OwnPtr.h: Removed.
11129         * kxmlcore/PassRefPtr.h: Removed.
11130         * kxmlcore/Platform.h: Removed.
11131         * kxmlcore/RefPtr.h: Removed.
11132         * kxmlcore/TCPageMap.h: Removed.
11133         * kxmlcore/TCSpinLock.h: Removed.
11134         * kxmlcore/TCSystemAlloc.cpp: Removed.
11135         * kxmlcore/TCSystemAlloc.h: Removed.
11136         * kxmlcore/UnusedParam.h: Removed.
11137         * kxmlcore/Vector.h: Removed.
11138         * kxmlcore/VectorTraits.h: Removed.
11139         * kxmlcore/unicode: Removed.
11140         * kxmlcore/unicode/Unicode.h: Removed.
11141         * kxmlcore/unicode/UnicodeCategory.h: Removed.
11142         * kxmlcore/unicode/icu: Removed.
11143         * kxmlcore/unicode/icu/UnicodeIcu.h: Removed.
11144         * kxmlcore/unicode/posix: Removed.
11145         * kxmlcore/unicode/qt3: Removed.
11146         * kxmlcore/unicode/qt4: Removed.
11147         * kxmlcore/unicode/qt4/UnicodeQt4.h: Removed.
11148         * pcre/pcre_get.c:
11149         * wtf: Added.
11150         * wtf/Assertions.cpp:
11151         * wtf/Assertions.h:
11152         * wtf/FastMalloc.cpp:
11153         (WTF::TCMalloc_ThreadCache::Scavenge):
11154         (WTF::do_malloc):
11155         (WTF::do_free):
11156         (WTF::TCMallocGuard::TCMallocGuard):
11157         (WTF::malloc):
11158         (WTF::free):
11159         (WTF::calloc):
11160         (WTF::cfree):
11161         (WTF::realloc):
11162         * wtf/FastMalloc.h:
11163         * wtf/FastMallocInternal.h:
11164         * wtf/Forward.h:
11165         * wtf/HashCountedSet.h:
11166         * wtf/HashFunctions.h:
11167         * wtf/HashMap.h:
11168         * wtf/HashSet.h:
11169         * wtf/HashTable.cpp:
11170         * wtf/HashTable.h:
11171         * wtf/HashTraits.h:
11172         * wtf/ListRefPtr.h:
11173         * wtf/Noncopyable.h:
11174         * wtf/OwnArrayPtr.h:
11175         * wtf/OwnPtr.h:
11176         * wtf/PassRefPtr.h:
11177         * wtf/RefPtr.h:
11178         * wtf/TCSystemAlloc.cpp:
11179         (TCMalloc_SystemAlloc):
11180         * wtf/Vector.h:
11181         * wtf/VectorTraits.h:
11182         * wtf/unicode/UnicodeCategory.h:
11183         * wtf/unicode/icu/UnicodeIcu.h:
11184
11185 2006-05-08  Timothy Hatcher  <timothy@apple.com>
11186
11187         Reviewed by Tim O.
11188
11189         * bindings/npapi.h: do not define #pragma options align=mac68k if we are 64-bit
11190
11191 2006-05-07  Darin Adler  <darin@apple.com>
11192
11193         Reviewed and landed by Maciej.
11194
11195         - fix http://bugs.webkit.org/show_bug.cgi?id=8765
11196         Random crashes on TOT since the form state change
11197         
11198         I haven't figured out how to construct a test for this, but this does seem to fix the
11199         problem; Mitz mentioned that a double-destroy was occurring in these functions.
11200         
11201         * kxmlcore/HashMap.h: (KXMLCore::HashMap::remove): Use RefCounter::deref instead of calling
11202         ~ValueType, because ~ValueType often results in a double-destroy, since the HashTable also
11203         destroys the element based on the storage type. The RefCounter template correctly does work
11204         only in cases where ValueType and ValueStorageType differ and this class is what's used
11205         elsewhere for the same purpose; I somehow missed this case when optimizing HashMap.
11206         * kxmlcore/HashSet.h: (KXMLCore::HashSet::remove): Ditto.
11207         
11208 2006-05-05  Darin Adler  <darin@apple.com>
11209
11210         - http://bugs.webkit.org/show_bug.cgi?id=8722
11211           IE compatibility fix in date parsing
11212
11213         * kjs/date_object.cpp: (KJS::parseDate): Merged change that George Staikos provided
11214         from KDE 3.4.3 branch that allows day values of 0 and values that are > 1000.
11215
11216 2006-05-04  Anders Carlsson  <andersca@mac.com>
11217
11218         Reviewed by Maciej.
11219
11220         http://bugs.webkit.org/show_bug.cgi?id=8734
11221         Would like a Vector::append that takes another Vector
11222         
11223         * kxmlcore/Vector.h:
11224         (KXMLCore::::append):
11225         New function that takes another array.
11226
11227 2006-05-02  Steve Falkenburg  <sfalken@apple.com>
11228
11229         Reviewed by eric.
11230
11231         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: set NDEBUG for release build
11232         * kxmlcore/FastMalloc.cpp: Prevent USE_SYSTEM_MALLOC from being defined twice
11233
11234 2006-05-02  Anders Carlsson  <andersca@mac.com>
11235
11236         Reviewed by Maciej.
11237
11238         * kxmlcore/HashMap.h:
11239         (KXMLCore::::operator):
11240         Return *this
11241
11242 2006-05-01  Tim Omernick  <timo@apple.com>
11243
11244         Reviewed by Tim Hatcher.
11245
11246         <rdar://problem/4476875> Support printing for embedded Netscape plugins
11247
11248         * bindings/npapi.h:
11249         Fixed struct alignment problem in our npapi.h.  Structs must be 68k-aligned on both pre-Mac OS X
11250         and Mac OS X systems, as this is what plugins expect.
11251
11252 2006-05-01  Timothy Hatcher  <timothy@apple.com>
11253
11254         Reviewed by Maciej.
11255         
11256         <rdar://problem/4308243> 8F36 Regression: crash in malloc_consolidate if you use a .PAC file
11257
11258         The original fix missed the oversized cell case. Added a test for "currentThreadIsMainThread || 
11259         imp->m_destructorIsThreadSafe" where we collect oversized cells.
11260
11261         We don't have a way to test PAC files yet, so there's no test attached.
11262
11263         * kjs/collector.cpp:
11264         (KJS::Collector::collect): test the thread when we collect oversized cells
11265
11266 2006-05-01  Tim Omernick  <timo@apple.com>
11267
11268         Reviewed by Adele.
11269
11270         <rdar://problem/4526114> REGRESSION (two days ago): LOG() just prints @ for NSObject substitutions
11271
11272         * kxmlcore/Assertions.cpp:
11273         Changed sense of strstr("%@") check.  I already made the same fix to the WebBrowser assertions.
11274
11275 2006-04-28  Steve Falkenburg  <sfalken@apple.com>
11276
11277         Reviewed by kdecker
11278         
11279         Actually apply the change that was reviewed insted of checking it in with an #if 0 (oops).
11280
11281         * kjs/testkjs.cpp:
11282         (main): Suppress C runtime alerts
11283
11284 2006-04-28  Steve Falkenburg  <sfalken@apple.com>
11285
11286         Reviewed by kdecker
11287
11288         Suppress error reporting dialog that blocks Javascript tests from completing.
11289         
11290         Real error is due to an overflow in the date/time handling functions that needs
11291         to be addressed, but this will prevent the hang running the Javascript tests
11292         on the build bot (along with the related changes).
11293         
11294         * kjs/testkjs.cpp:
11295         (main): Suppress C runtime alerts
11296
11297 2006-04-27  Geoffrey Garen  <ggaren@apple.com>
11298
11299         Reviewed by Maciej
11300
11301         - Minor fixups I discovered while working on the autogenerator.
11302         
11303         * kjs/lookup.cpp:
11304         (findEntry): ASSERT that size is not 0, because otherwise we'll % by 0,
11305         compute a garbage address, and possibly crash.
11306         * kjs/lookup.h:
11307         (cacheGlobalObject): Don't enumerate cached objects -- ideally, they
11308         would be hidden entirely.
11309
11310 2006-04-21  Kevin M. Ollivier  <kevino@theolliviers.com>
11311
11312         Reviewed by Darin.
11313
11314         - http://bugs.webkit.org/show_bug.cgi?id=8507
11315           Compilation fixes for building on gcc 4.0.2, and without precomp headers
11316
11317         * kjs/operations.h:
11318         * kxmlcore/Assertions.cpp:
11319         * kxmlcore/FastMalloc.cpp:
11320         Added necessary headers to resolve compilation issues when not using
11321         precompiled headers.
11322         
11323         * kjs/value.h: Declare the JSCell class before friend declaration  
11324         to resolve compilation issues with gcc 4.0.2.
11325         
11326         * kxmlcore/Platform.h: Set Unicode support to use ICU on platforms
11327         other than KDE (previously only defined for Win and Mac OS)
11328                 
11329 2006-04-18  Eric Seidel  <eseidel@apple.com>
11330
11331         Reviewed by ggaren.
11332
11333         Fix "new Function()" to correctly use lexical scoping.
11334         Add ScopeChain::print() function for debugging.
11335         <rdar://problem/4067864> REGRESSION (125-407): JavaScript failure on PeopleSoft REN Server
11336
11337         * kjs/function_object.cpp:
11338         (FunctionObjectImp::construct):
11339         * kjs/scope_chain.cpp:
11340         (KJS::ScopeChain::print):
11341         * kjs/scope_chain.h:
11342
11343 2006-04-14  James G. Speth  <speth@end.com>
11344
11345         Reviewed by Timothy.
11346
11347         Bug 8389: support for Cocoa bindings - binding an NSTreeController to the WebView's DOM
11348         http://bugs.webkit.org/show_bug.cgi?id=8389
11349
11350         Adds a category to WebScriptObject with array accessors for KVC/KVO.
11351
11352         If super valueForKey: fails it will call valueForUndefinedKey:, which is
11353         important because it causes the right behavior to happen with bindings using
11354         the "Raises for Not Applicable Keys" flag and the "Not Applicable Placeholder"
11355
11356         * bindings/objc/WebScriptObject.mm:
11357         (-[WebScriptObject valueForKey:]):
11358         (-[WebScriptObject count]):
11359         (-[WebScriptObject objectAtIndex:]):
11360         (-[WebUndefined description]): return "undefined"
11361
11362 2006-04-13  Geoffrey Garen  <ggaren@apple.com>
11363
11364         Reviewed by Darin.
11365
11366         * kjs/internal.cpp:
11367         (KJS::InterpreterImp::initGlobalObject): Add the built-in object
11368         prototype to the end of the global object's prototype chain instead of
11369         just blowing away its existing prototype. We need to do this because
11370         the window object has a meaningful prototype now.
11371
11372 2006-04-13  Maciej Stachowiak  <mjs@apple.com>
11373
11374         Reviewed by Geoff.
11375         
11376         - fix testkjs to not show false-positive KJS::Node leaks in debug builds
11377
11378         * kjs/testkjs.cpp:
11379         (doIt):
11380         (kjsmain):
11381
11382 2006-04-11  Geoffrey Garen  <ggaren@apple.com>
11383
11384         Reviewed by Maciej.
11385
11386         Minor code cleanup -- passes all the JS tests.
11387
11388         * kjs/object_object.cpp:
11389         (ObjectObjectImp::construct):
11390         (ObjectObjectImp::callAsFunction):
11391
11392 2006-04-11  Darin Adler  <darin@apple.com>
11393
11394         - another attempt to fix Windows build -- Vector in Forward.h was not working
11395
11396         * kxmlcore/Forward.h: Remove Vector.
11397         * kxmlcore/Vector.h: Add back default arguments, remove include of
11398         Forward.h.
11399
11400 2006-04-11  Darin Adler  <darin@apple.com>
11401
11402         - try to fix Windows build -- HashForward.h was not working
11403
11404         * kxmlcore/HashForward.h: Removed.
11405
11406         * JavaScriptCore.xcodeproj/project.pbxproj: Remove HashForward.h.
11407         * kjs/collector.h: Remove use of HashForward.h.
11408         * kxmlcore/HashCountedSet.h: Remove include of HashForward.h, restore
11409         default arguments.
11410         * kxmlcore/HashMap.h: Ditto.
11411         * kxmlcore/HashSet.h: Ditto.
11412
11413 2006-04-11  David Harrison  <harrison@apple.com>
11414
11415         Reviewed by Darin.
11416
11417         - fixed clean build, broken by Darin's check-in
11418
11419         * kjs/date_object.cpp: Add needed include of lookup.h.
11420         * kjs/regexp_object.cpp: Move include of .lut.h file below other includes.
11421
11422 2006-04-10  Darin Adler  <darin@apple.com>
11423
11424         Rubber-stamped by John Sullivan.
11425
11426         - switched from a shell script to a makefile for generated files
11427         - removed lots of unneeded includes
11428         - added new Forward.h and HashForward.h headers that allow compiling with
11429           fewer unneeded templates
11430
11431         * DerivedSources.make: Added.
11432         * generate-derived-sources: Removed.
11433         * JavaScriptCore.xcodeproj/project.pbxproj: Added new files, changed to use
11434         DerivedSources.make.
11435
11436         * kxmlcore/Forward.h: Added.
11437         * kxmlcore/HashForward.h: Added.
11438
11439         * kxmlcore/HashCountedSet.h: Include HashForward for default args.
11440         * kxmlcore/HashMap.h: Ditto.
11441         * kxmlcore/HashSet.h: Ditto.
11442
11443         * kjs/object.h:
11444         * kjs/object.cpp:
11445         Moved KJS_MAX_STACK into the .cpp file.
11446
11447         * bindings/NP_jsobject.cpp:
11448         * bindings/c/c_instance.h:
11449         * bindings/jni/jni_class.h:
11450         * bindings/jni/jni_runtime.h:
11451         * bindings/jni/jni_utility.h:
11452         * bindings/objc/WebScriptObject.mm:
11453         * bindings/objc/WebScriptObjectPrivate.h:
11454         * bindings/objc/objc_class.h:
11455         * bindings/objc/objc_class.mm:
11456         * bindings/objc/objc_instance.h:
11457         * bindings/objc/objc_instance.mm:
11458         * bindings/objc/objc_runtime.mm:
11459         * bindings/objc/objc_utility.mm:
11460         * bindings/runtime.h:
11461         * bindings/runtime_array.cpp:
11462         * bindings/runtime_array.h:
11463         * bindings/runtime_method.cpp:
11464         * bindings/runtime_method.h:
11465         * bindings/runtime_object.cpp:
11466         * bindings/runtime_root.h:
11467         * kjs/JSImmediate.cpp:
11468         * kjs/Parser.h:
11469         * kjs/array_object.cpp:
11470         * kjs/array_object.h:
11471         * kjs/bool_object.cpp:
11472         * kjs/bool_object.h:
11473         * kjs/collector.h:
11474         * kjs/context.h:
11475         * kjs/debugger.cpp:
11476         * kjs/error_object.h:
11477         * kjs/function_object.h:
11478         * kjs/internal.h:
11479         * kjs/lexer.cpp:
11480         * kjs/math_object.cpp:
11481         * kjs/math_object.h:
11482         * kjs/nodes.cpp:
11483         * kjs/nodes.h:
11484         * kjs/number_object.cpp:
11485         * kjs/number_object.h:
11486         * kjs/object_object.cpp:
11487         * kjs/operations.cpp:
11488         * kjs/protected_reference.h:
11489         * kjs/reference.h:
11490         * kjs/reference_list.h:
11491         * kjs/regexp_object.h:
11492         * kjs/string_object.cpp:
11493         * kjs/string_object.h:
11494         * kjs/testkjs.cpp:
11495         * kjs/value.cpp:
11496         * kjs/value.h:
11497         * kxmlcore/HashTable.h:
11498         * kxmlcore/ListRefPtr.h:
11499         * kxmlcore/TCPageMap.h:
11500         * kxmlcore/Vector.h:
11501         Removed unneeded header includes.
11502
11503 2006-04-09  Geoffrey Garen  <ggaren@apple.com>
11504
11505         Reviewed by eric.
11506
11507         - Fixed http://bugs.webkit.org/show_bug.cgi?id=8284
11508         prevent unnecessary entries in the "nodes with extra refs" hash table
11509
11510         This patch switches manually RefPtr exchange with use of
11511         RefPtr::release to ensure that a node's ref count never tops 1
11512         (in the normal case).
11513
11514         * kjs/nodes.cpp:
11515         (BlockNode::BlockNode):
11516         (CaseBlockNode::CaseBlockNode):
11517         * kjs/nodes.h:
11518         (KJS::ArrayNode::ArrayNode):
11519         (KJS::ObjectLiteralNode::ObjectLiteralNode):
11520         (KJS::ArgumentsNode::ArgumentsNode):
11521         (KJS::VarStatementNode::VarStatementNode):
11522         (KJS::ForNode::ForNode):
11523         (KJS::CaseClauseNode::CaseClauseNode):
11524         (KJS::FuncExprNode::FuncExprNode):
11525         (KJS::FuncDeclNode::FuncDeclNode):
11526
11527 2006-04-08  Alexey Proskuryakov  <ap@nypop.com>
11528
11529         Reviewed by Darin.
11530
11531         One more attempt - use reinterpret_cast, rather than static_cast.
11532
11533 2006-04-08  Alexey Proskuryakov  <ap@nypop.com>
11534
11535         Reviewed by Darin.
11536
11537         An attempt to fix Win32 build - ICU uses wchar_t on Windows, so we need a type cast.
11538
11539         * kxmlcore/unicode/icu/UnicodeIcu.h:
11540         (KXMLCore::Unicode::toLower):
11541         (KXMLCore::Unicode::toUpper):
11542
11543 2006-04-08  Alexey Proskuryakov  <ap@nypop.com>
11544
11545         Reviewed by Darin.
11546
11547         - fix http://bugs.webkit.org/show_bug.cgi?id=8264
11548         toLowerCase and toUpperCase don't honor special mappings
11549
11550         Test: fast/js/string-capitalization.html
11551
11552         * JavaScriptCore.xcodeproj/project.pbxproj: Added KXMLCore::Unicode headers to the project.
11553         * icu/unicode/putil.h: Added (copied from WebCore).
11554         * icu/unicode/uiter.h: Ditto.
11555         * icu/unicode/ustring.h: Ditto.
11556         * kjs/string_object.cpp:
11557         (StringProtoFunc::callAsFunction): Use the new KXMLCore::Unicode::toUpper() and toLower().
11558         * kjs/ustring.cpp: Removed unused (and evil) UChar::toLower() and toUpper().
11559         * kjs/ustring.h: Ditto.
11560
11561         * kxmlcore/unicode/Unicode.h: Corrected capitalization of the word Unicode.
11562         * kxmlcore/unicode/UnicodeCategory.h: Renamed include guard macro to match file name.
11563
11564         * kxmlcore/unicode/icu/UnicodeIcu.h:
11565         (KXMLCore::Unicode::toLower): Work on strings, not individual characters. Use ICU root locale.
11566         (KXMLCore::Unicode::toUpper): Ditto.
11567         (KXMLCore::Unicode::isFormatChar): Use int32_t, which can hold a complete code point.
11568         (KXMLCore::Unicode::isSeparatorSpace): Ditto.
11569         (KXMLCore::Unicode::category): Ditto.
11570         * kxmlcore/unicode/qt4/UnicodeQt4.h:
11571         (KXMLCore::Unicode::toLower): Work on strings, not individual characters.
11572         (KXMLCore::Unicode::toUpper): Ditto.
11573         (KXMLCore::Unicode::isFormatChar): Use int32_t, which can hold a complete code point.
11574         (KXMLCore::Unicode::isSeparatorSpace): Ditto.
11575         (KXMLCore::Unicode::category): Ditto.
11576
11577         * tests/mozilla/ecma/String/15.5.4.12-1.js: Corrected expected results.
11578         * tests/mozilla/ecma/String/15.5.4.12-5.js: Corrected expected results.
11579
11580 2006-04-05  Darin Adler  <darin@apple.com>
11581
11582         - attempt to fix Windows build
11583
11584         * kxmlcore/HashMap.h: (KXMLCore::HashMap::remove): Use (*it). instead of it->.
11585         * kxmlcore/HashSet.h: (KXMLCore::HashSet::remove): Ditto.
11586
11587 2006-04-05  Darin Adler  <darin@apple.com>
11588
11589         - attempt to fix Windows build
11590
11591         * os-win32/stdint.h: Add int8_t, uint8_t, int64_t.
11592
11593 2006-04-05  Darin Adler  <darin@apple.com>
11594
11595         Reviewed by Maciej.
11596
11597         - fix memory leak introduced by the previous change
11598
11599         * kxmlcore/HashTable.h: Specialize NeedsRef so that it correctly returns true when
11600         the value in question is a pair where one of the pair needs a ref and the other
11601         of the pair does not.
11602
11603 2006-04-05  Darin Adler  <darin@apple.com>
11604
11605         Reviewed by Maciej.
11606
11607         - JavaScriptCore part of fix for http://bugs.webkit.org/show_bug.cgi?id=8049
11608           StringImpl hash traits deleted value creates an init routine for WebCore
11609           <rdar://problem/4442248> REGRESSION: WebCore has init routines (8049)
11610
11611         Change HashMap and HashSet implementation so they fold various types together.
11612         This allows us to implement maps and sets that use RefPtr<WebCore::StringImpl>
11613         and WebCore::String in terms of the underlying raw pointer type, and hence use
11614         -1 for the deleted value.
11615
11616         * kxmlcore/HashTraits.h: Added a new type to HashTraits, StorageTraits, which is a
11617         type to be used when storing a value that has the same layout as the type itself.
11618         This is used only for non-key cases. In the case of keys, the hash function must also
11619         be considered. Moved emptyValue out of GenericHashTraitsBase into GenericHashTraits.
11620         Added a new bool to HashTraits, needsRef, which indicates whether the type needs
11621         explicit reference counting. If the type itself has needsRef true, but the storage
11622         type has needsRef false, then the HashSet or HashMap has to handle the reference
11623         counting explicitly. Added hash trait specializations for all signed integer values
11624         that give -1 as the deleted value. Gave all integers StorageTraits of the canonical
11625         integer type of the same size so int and long will share code. Gave all pointers and
11626         RefPtrs StorageTraits of the appropriately sized integer type. Removed redundant
11627         TraitType and emptyValue definitions in the pointer specialization for HashTraits.
11628         Added PairBaseHashTraits, which doesn't try to set up needsDestruction and deletedValue.
11629         Useful for types where we don't want to force the existence of deletedValue, such as
11630         the type of a pair in a HashMap which is not the actual storage type. Removed an
11631         unneeded parameter from the DeletedValueAssigner template. Added HashKeyStorageTraits
11632         template, which determines what type can be used to store a given hash key type with
11633         a given hash function, and specialized it for pointers and RefPtr so that pointer
11634         hash tables share an underlying HashTable that uses IntHash.
11635
11636         * kxmlcore/HashTable.h: Added HashTableConstIteratorAdapter, HashTableIteratorAdapter,
11637         NeedsRef, RefCountManagerBase, RefCountManager, HashTableRefCountManagerBase, and
11638         HashTableRefCountManager. All are used by both HashSet and HashMap to handle hash
11639         tables where the type stored is not the same as the real value type.
11640         
11641         * kxmlcore/HashFunctions.h: Added a new struct named IntTypes that finds an
11642         integer type given a sizeof value. Renamed pointerHash to intHash and made it
11643         use overloading and take integer parameters. Added an IntHash struct which is
11644         a hash function that works for integers. Changed PtrHash to call IntHash with
11645         an appropriately sized integer. Made IntHash the default hash function for
11646         many integer types. Made PtrHash the default hash function for RefPtr as well
11647         as for raw pointers.
11648
11649         * kxmlcore/HashSet.h: Changed implementation to use a separate "storage type"
11650         derived from the new traits. The HashTable will use the storage type and all
11651         necessary translation and ref/deref is done at the HashSet level. Also reorganized
11652         the file so that the HashSet is at the top and has no inline implementation inside
11653         it so it's easy to read the interface to HashSet.
11654
11655         * kxmlcore/HashMap.h: Changed implementation to use a separate "storage type"
11656         derived from the new traits. The HashTable will use the storage type and all
11657         necessary translation and ref/deref is done at the HashMap level. Also reorganized
11658         the file so that the HashMap is at the top and has no inline implementation inside
11659         it so it's easy to read the interface to HashMap.
11660
11661         * kxmlcore/HashMapPtrSpec.h: Removed. Superceded by optimizations in HashMap itself.
11662
11663         * JavaScriptCore.xcodeproj/project.pbxproj: Remove HashMapPtrSpec.h, resort files,
11664         and also remove some unnecessary build settings from the aggregate target that
11665         generates derived sources.
11666         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
11667
11668 2006-04-04  Timothy Hatcher  <timothy@apple.com>
11669
11670         Reviewed by Darin.
11671
11672         The Debug and Release frameworks are now built with install paths relative to the build products directory.
11673         This removes the need for other projects to build with -framework WebCore and -framework JavaScriptCore. 
11674
11675         * JavaScriptCore.xcodeproj/project.pbxproj:
11676
11677 2006-04-04  Eric Seidel  <eseidel@apple.com>
11678
11679         Reviewed by ggaren.
11680
11681         Fix win32 build.
11682         Disable ASSERT redefinition warnings for now.
11683
11684         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
11685         * kxmlcore/Assertions.h:
11686
11687 2006-04-04  Bjrn Graf  <bjoern.graf@gmail.com>
11688
11689         Reviewed by ggaren & darin.  Landed by eseidel.
11690
11691         Integrate CURL version of gettimeofday
11692         http://bugs.webkit.org/show_bug.cgi?id=7399
11693         Disable crash report dialogs for testkjs.exe in Release mode
11694         http://bugs.webkit.org/show_bug.cgi?id=8113
11695
11696         * kjs/testkjs.cpp:
11697         (StopWatch::start):
11698         (StopWatch::stop):
11699         (StopWatch::getElapsedMS):
11700         (main):
11701         (kjsmain):
11702
11703 2006-04-04  Eric Seidel  <eseidel@apple.com>
11704
11705         Reviewed by mjs.
11706
11707         * kjs/number_object.cpp:
11708         (NumberProtoFunc::callAsFunction): remove trunc() to fix win32.
11709
11710 2006-03-12  Maciej Stachowiak  <mjs@apple.com>
11711
11712         Reviewed by Darin.
11713         
11714         - fixed "toPrecision sometimes messes up the last digit on intel Macs"
11715         http://bugs.webkit.org/show_bug.cgi?id=7748
11716
11717         * kjs/number_object.cpp:
11718         (intPow10): Compute integer powers of 10 using exponentiation by squaring.
11719         (NumberProtoFunc::callAsFunction): Use intPow10(n) in place of all pow(10.0, n),
11720         plus a bit of refactoring.
11721
11722 2006-04-03  Darin Adler  <darin@apple.com>
11723
11724         - tweak config.h and Platform.h to try to get buildbot working
11725           (making some small changes at the same time)
11726
11727         * kjs/config.h: Removed now-unneeded HAVE_ICU.
11728         * kxmlcore/Platform.h: Tweak how platform gets set up. Move all the
11729         USE stuff to the end.
11730
11731 2006-04-03  George Staikos   <staikos@opensource.apple.com>
11732
11733         Reviewed by Maciej.
11734
11735         Fix Win32 build breakage from previous commit, remove unused forward.
11736
11737 2006-04-03  George Staikos   <staikos@opensource.apple.com>
11738
11739         Reviewed by Maciej.
11740
11741         Implement a unicode abstraction layer to make JavaScriptCore much more
11742         easily ported to other platforms without having to take in libicu.  Also
11743         makes the unicode related code easier to understand.
11744
11745 2006-04-03  Timothy Hatcher  <timothy@apple.com>
11746
11747         Reviewed by Adele.
11748
11749         Fixes <rdar://problem/4498338> JavaScriptCore fails to compile for ppc64
11750         Other 64 bit build fixes.
11751
11752         * kjs/collector.cpp:
11753         (KJS::Collector::markOtherThreadConservatively): test for __DARWIN_UNIX03 and use __r1
11754         * kjs/dtoa.cpp:
11755         (Bigint::): cast PRIVATE_mem to unsigned to prevent warning
11756         * bindings/jni/jni_utility.cpp:
11757         (KJS::Bindings::getJavaVM): cast jniError to long to prevent format warning
11758         (KJS::Bindings::getJNIEnv): cast jniError to long to prevent format warning
11759         * bindings/runtime_root.cpp:
11760         (KJS::Bindings::addNativeReference): cast CFDictionaryGetValue to unsigned long to prevent warning
11761         (KJS::Bindings::removeNativeReference): cast CFDictionaryGetValue to unsigned long to prevent warning
11762
11763 2006-03-31  Darin Adler  <darin@apple.com>
11764
11765         Reviewed by Geoff.
11766
11767         - <rdar://problem/4395622> API: WebScriptObject.h incorrectly reports that -isSelectorExcludedFromWebScript returns NO by default
11768
11769         * bindings/objc/WebScriptObject.h: Fixed comment.
11770
11771 2006-03-31  Eric Seidel  <eseidel@apple.com>
11772
11773         Reviewed by mjs.
11774
11775         A bit more code cleanup.
11776
11777         * bindings/c/c_utility.cpp:
11778         (KJS::Bindings::convertValueToNPVariant):
11779         * bindings/objc/objc_runtime.mm:
11780         (convertValueToObjcObject):
11781         * bindings/objc/objc_utility.mm:
11782         (KJS::Bindings::convertValueToObjcValue):
11783         * kjs/function.cpp:
11784         (KJS::GlobalFuncImp::callAsFunction):
11785         * kjs/interpreter.cpp:
11786         (KJS::ExecState::lexicalInterpreter):
11787         * kjs/interpreter.h:
11788         * kjs/operations.cpp:
11789         (KJS::equal):
11790
11791 2006-03-30  Eric Seidel  <eseidel@apple.com>
11792
11793         Reviewed by anders.
11794
11795         Small code-style update.
11796
11797         * kjs/operations.cpp:
11798         (KJS::isNaN):
11799         (KJS::isInf):
11800         (KJS::isPosInf):
11801         (KJS::isNegInf):
11802         (KJS::equal):
11803         (KJS::strictEqual):
11804         (KJS::relation):
11805         (KJS::maxInt):
11806         (KJS::minInt):
11807         (KJS::add):
11808         (KJS::mult):
11809
11810 2006-03-31  Anders Carlsson  <andersca@mac.com>
11811
11812         Reviewed by Maciej.
11813
11814         Make sure the GetterSetterImp objects are marked as well.
11815         
11816         * kjs/internal.cpp:
11817         (KJS::GetterSetterImp::mark):
11818         Call JSCell::mark().
11819
11820 2006-03-30  Eric Seidel  <eseidel@apple.com>
11821
11822         Reviewed by ggaren.
11823
11824         * kjs/nodes.h: Some various small style fixes.
11825
11826 2006-03-30  Eric Seidel  <eseidel@apple.com>
11827
11828         Reviewed by ggaren.
11829
11830         Clean-up style issues in node.h, remove redundant initializations.
11831
11832         * kjs/nodes.h:
11833         (KJS::StatementNode::evaluate):
11834         (KJS::ArrayNode::ArrayNode):
11835         (KJS::ObjectLiteralNode::ObjectLiteralNode):
11836         (KJS::ArgumentsNode::ArgumentsNode):
11837         (KJS::NewExprNode::NewExprNode):
11838         (KJS::CaseClauseNode::CaseClauseNode):
11839         (KJS::FuncDeclNode::FuncDeclNode):
11840
11841 2006-03-30  Tim Omernick  <timo@apple.com>
11842
11843         Reviewed by Geoff.
11844
11845         <rdar://problem/4212626> REGRESSION: LIVECONNECT: JavaScript type for Java Strings is function,
11846         not object
11847
11848         * bindings/runtime.h:
11849         (KJS::Bindings::Instance::implementsCall):
11850         New method.  Returns false by default.  Concrete subclasses can override this return true when
11851         the bound object may be called as a function.
11852         (KJS::Bindings::Instance::invokeDefaultMethod):
11853         Since bound objects are no longer treated as functions by default, we can return jsUndefined()
11854         here instead of in concrete subclasses that decide not to implement the default method
11855         functionality.
11856
11857         * bindings/runtime_object.cpp:
11858         (RuntimeObjectImp::implementsCall):
11859         Don't assume that the bound object is a function; instead, let the object instance decide whether
11860         it is callable.
11861
11862         * bindings/c/c_instance.h:
11863         * bindings/c/c_instance.cpp:
11864         (KJS::Bindings::CInstance::implementsCall):
11865         The object is callable if its class has an invokeDefault function.
11866
11867         * bindings/objc/objc_instance.h:
11868         * bindings/objc/objc_instance.mm:
11869         (ObjcInstance::implementsCall):
11870         The object is callable if the ObjC instance responds to -invokeDefaultMethodWithArguments:.
11871
11872         * bindings/jni/jni_instance.h:
11873         * bindings/jni/jni_instance.cpp:
11874         Moved bogus invokeDefaultMethod() to superclass.
11875
11876 2006-03-29  Geoffrey Garen  <ggaren@apple.com>
11877
11878         Reviewed by Darin.
11879
11880         - JavaScriptCore side of fix for <rdar://problem/4308243> 8F36 
11881         Regression: crash in malloc_consolidate if you use a .PAC file
11882
11883         The crash was a result of threaded deallocation of thread-unsafe
11884         objects. Pure JS objects are thread-safe because all JS execution
11885         is synchronized through JSLock. However, JS objects that wrap WebCore 
11886         objects are thread-unsafe because JS and WebCore execution are not 
11887         synchronized.  That unsafety comes into play when the collector 
11888         deallocates a JS object that wraps a WebCore object, thus causing the 
11889         WebCore object to be deallocated.
11890
11891         The solution here is to have each JSCell know whether it is safe to
11892         collect on a non-main thread, and to avoid collecting unsafe cells
11893         when on a non-main thread.
11894
11895         We don't have a way to test PAC files yet, so there's no test
11896         attached to this patch.
11897
11898         * kjs/collector.cpp:
11899         (KJS::Collector::collect):
11900         (1) Added the test "currentThreadIsMainThread || 
11901         imp->m_destructorIsThreadSafe". 
11902
11903         * kjs/protect.h:
11904         (KJS::gcProtectNullTolerant):
11905         (KJS::gcUnprotectNullTolerant):
11906         * kjs/value.h:
11907         (KJS::JSCell::JSCell): The bools here must be bitfields, otherwise
11908         m_destructorIsThreadSafe becomes another whole word, ruining the
11909         collector optimizations we've made based on the size of a JSObject.
11910         * kxmlcore/FastMalloc.cpp:
11911         (KXMLCore::currentThreadIsMainThread):
11912         (KXMLCore::fastMallocRegisterThread):
11913         * kxmlcore/FastMalloc.h:
11914
11915 2006-03-28  Darin Adler  <darin@apple.com>
11916
11917         Reviewed by Geoff.
11918
11919         - change some code that resulted in init routines on Mac OS X -- if the framework has
11920           init routines it will use memory and slow down applications that link with WebKit
11921           even in cases where those applications don't use WebKit
11922
11923         * kjs/date_object.cpp: Changed constants that were derived by multiplying other constants
11924         to use immediate numbers instead. Apparently, double constant expressions of the type we
11925         had here are evaluated at load time.
11926
11927         * kjs/list.cpp: Can't use OwnArrayPtr in ListImp because of the global instances of
11928         ListImp, so go back to using a plain old pointer.
11929         (KJS::List::List): Set overflow to 0 when initializing ListImp.
11930         (KJS::List::release): Replace a clear call with a delete and explicit set to 0.
11931         (KJS::List::append): Use raw pointers, and do a delete [] instead of finessing it with
11932         a swap of OwnArrayPtr.
11933         (KJS::List::copyFrom): Remove now-unneeded get().
11934         (KJS::List::copyTail): Ditto.
11935
11936         * kjs/ustring.cpp: Changed UString::Rep::empty initializer a bit so that it doesn't get
11937         a static initializer routine. Had to get rid of one level of constant to get the compiler
11938         to understand it could initialize without any code.
11939
11940         - added a build step that checks for init routines
11941
11942         * JavaScriptCore.xcodeproj/project.pbxproj: Deleted now-unused custom build rule that
11943         was replaced by the generate-derived-sources script a while back. Added a custom build
11944         phase that invokes the check-for-global-initializers script.
11945
11946 2006-03-28  Timothy Hatcher  <timothy@apple.com>
11947
11948         Reviewed by Eric.
11949
11950         fixes <rdar://problem/4458539> Unable to include Security(public) and WebKit(private) headers
11951
11952         * bindings/npapi.h: added #defines after the #ifndefs
11953
11954 2006-03-27  Maciej Stachowiak  <mjs@apple.com>
11955
11956         Reviewed by Anders.
11957         
11958         - fixed <rdar://problem/4489745> REGRESSION: Safari crashes at to display http://www.lgphilips-lcd.com/
11959
11960         * kjs/nodes.cpp:
11961         (Node::deref): take into account the case where the extra refcount table was never created
11962
11963 2006-03-23  David Carson <dacarson@gmail.com>
11964
11965         Reviewed by Darin.
11966         
11967         - JSObject in LiveConnect not working.
11968         http://bugs.webkit.org/show_bug.cgi?id=7917
11969
11970         * bindings/jni_jsobject.cpp:
11971         (JavaJSObject::convertJObjectToValue): Was trying to retrieve the native pointer from the wrong base
11972         class, and the GetFieldID was using the wrong signature.
11973
11974 2006-03-23  Darin Adler  <darin@apple.com>
11975
11976         Reviewed by Maciej.
11977
11978         - fix buildbot
11979
11980         * JavaScriptCore.xcodeproj/project.pbxproj: Change target name to JavaScriptCore (it was "include"!?).
11981         Also add -Y 3 option for linker.
11982
11983 2006-03-23  Darin Adler  <darin@apple.com>
11984
11985         Reviewed by Maciej.
11986
11987         - fix http://bugs.webkit.org/show_bug.cgi?id=7726
11988           REGRESSION: orbitz calendar fails (JavaScript function serialization/parsing)
11989
11990         * kjs/object.h: Take function name, as well as source URL and line number, when
11991         using the special overloaded construct for making functions.
11992         * kjs/object.cpp: (KJS::JSObject::construct): Ditto.
11993         * kjs/function_object.h: Ditto.
11994         * kjs/function_object.cpp: (FunctionObjectImp::construct): Pass a name when
11995         constructing the function rather than null. Use "anonymous" when making a
11996         function using the default function constructor.
11997
11998         * kjs/nodes2string.cpp: (FuncDeclNode::streamTo): Put a line break just before
11999         a function declaration.
12000
12001         - unrelated fix
12002
12003         * kxmlcore/HashMapPtrSpec.h: Add missing needed friend declaration.
12004
12005 2006-03-23  Darin Adler  <darin@apple.com>
12006
12007         Reviewed by Maciej.
12008
12009         - fix http://bugs.webkit.org/show_bug.cgi?id=7805
12010           LEAK: method name leaks in KJS::Bindings::CInstance::invokeMethod
12011
12012         * bindings/c/c_utility.h: Remove NPN_UTF16FromString declaration (not implemented).
12013         * bindings/c/c_utility.cpp:
12014         (KJS::Bindings::convertValueToNPVariant): Use DOUBLE_TO_NPVARIANT,
12015         BOOLEAN_TO_NPVARIANT, VOID_TO_NPVARIANT, NULL_TO_NPVARIANT, and
12016         OBJECT_TO_NPVARIANT. In the case of OBJECT, call _NPN_RetainObject in
12017         one case and remove a _NPN_ReleaseObject in another because this
12018         should return a retained value.
12019         (KJS::Bindings::convertNPVariantToValue): Use NPVARIANT_TO_BOOLEAN,
12020         NPVARIANT_TO_INT32, and NPVARIANT_TO_DOUBLE.
12021
12022         * bindings/c/c_runtime.h: Removed implementations of CMethod::name and
12023         CField::name that called _NPN_UTF8FromIdentifier and hence leaked.
12024         * bindings/c/c_runtime.cpp:
12025         (KJS::Bindings::CMethod::name): Added. Returns the string from inside the
12026         method object.
12027         (KJS::Bindings::CField::name): Added. Returns the string from inside the
12028         field object.
12029         (KJS::Bindings::CField::valueFromInstance): Added call to _NPN_ReleaseVariantValue
12030         on the result of getProperty after using it to fix a storage leak.
12031         (KJS::Bindings::CField::setValueToInstance): Added call to _NPN_ReleaseVariantValue
12032         after pasing a value to setProperty now that the conversion function does a retain.
12033
12034         * bindings/c/c_instance.cpp:
12035         (KJS::Bindings::CInstance::invokeMethod): Changed to use Vector for a local
12036         stack buffer. Removed special case for NPVARIANT_IS_VOID because the
12037         convertNPVariantToValue function handles that properly.
12038         (KJS::Bindings::CInstance::invokeDefaultMethod): Ditto.
12039
12040         * bindings/NP_jsobject.h: Formatting changes only.
12041         * bindings/NP_jsobject.cpp:
12042         (jsDeallocate): Changed parameter type so we don't need a function cast.
12043         (_NPN_InvokeDefault): Use VOID_TO_NPVARIANT.
12044         (_NPN_Invoke): Use NULL_TO_NPVARIANT and VOID_TO_NPVARIANT.
12045         (_NPN_Evaluate): Use VOID_TO_NPVARIANT.
12046         (_NPN_GetProperty): Use NULL_TO_NPVARIANT and VOID_TO_NPVARIANT.
12047
12048         * bindings/c/c_class.cpp: Formatting changes only.
12049         * bindings/c/c_class.h: Formatting changes only.
12050
12051         * bindings/npruntime_priv.h: Removed obsolete and now-unused functions:
12052         NPN_VariantIsVoid, NPN_VariantIsNull, NPN_VariantIsUndefined,
12053         NPN_VariantIsBool, NPN_VariantIsInt32, NPN_VariantIsDouble,
12054         NPN_VariantIsString, NPN_VariantIsObject, NPN_VariantToBool,
12055         NPN_VariantToInt32, NPN_VariantToDouble, NPN_VariantToString,
12056         NPN_VariantToStringCopy, NPN_VariantToObject, NPN_InitializeVariantAsVoid,
12057         NPN_InitializeVariantAsNull, NPN_InitializeVariantAsUndefined,
12058         NPN_InitializeVariantWithBool, NPN_InitializeVariantWithInt32,
12059         NPN_InitializeVariantWithDouble, NPN_InitializeVariantWithString,
12060         NPN_InitializeVariantWithObject, and NPN_InitializeVariantWithVariant.
12061         * bindings/npruntime.cpp:
12062         (getIntIdentifierDictionary): Don't bother creating custom callbacks for the
12063         integer dictionary since the default behavior is fine for integers.
12064
12065 2006-03-23  Mark Rowe  <opendarwin.org@bdash.net.nz>
12066
12067         Reviewed and landed by Maciej.
12068
12069         - WebKit no longer builds with bison 2.1
12070         http://bugs.webkit.org/show_bug.cgi?id=7923
12071
12072         * generate-derived-sources:  Handle generated header named either grammar.cpp.h
12073         or grammar.hpp.
12074
12075 2006-03-22  Maciej Stachowiak  <mjs@apple.com>
12076
12077         - fix the build
12078
12079         * JavaScriptCore.xcodeproj/project.pbxproj:
12080
12081 2006-03-21  Maciej Stachowiak  <mjs@apple.com>
12082
12083         * kjs/generate-derived-sources: Set executable property.
12084
12085 2006-03-21  Maciej Stachowiak  <mjs@apple.com>
12086
12087         Reviewed by Darin.
12088         
12089         Ensure that generated source dependencies are handled properly, as follows:
12090         
12091         - Made an external script that generates the sources into a
12092           DerivedSources dir in the build products directory.
12093         - Added a new build target that builds all the generated sources
12094           if needed. Sadly it has to be a target, not a phase for Xcode to notice changes.
12095         - Added the DerivedSources dir in question to the include path.
12096         - Added the new DerivedSources dir and its contents to the project as build-relative.
12097         
12098         * JavaScriptCore.xcodeproj/project.pbxproj:
12099         * kjs/generate-derived-sources: Added. Based on the windows version - maybe someday they
12100         can share more.
12101
12102 2006-03-11  Maciej Stachowiak  <mjs@apple.com>
12103
12104         Reviewed by Darin.
12105         
12106         - fixed "charAt layout test fails on intel macs; some NaNs are printed as -NaN"
12107         http://bugs.webkit.org/show_bug.cgi?id=7745
12108
12109         * kjs/ustring.cpp:
12110         (KJS::UString::from): Use "NaN" for all NaN values, regardless of sign.
12111
12112 2006-03-16  Maciej Stachowiak  <mjs@apple.com>
12113
12114         Reviewed by Darin.
12115         
12116         - tweaks to my change to redo KJS::Node refcounting
12117
12118         * kjs/nodes.cpp:
12119         (Node::ref):
12120         (Node::deref):
12121         (Node::refcount):
12122         (Node::clearNewNodes):
12123         * kjs/nodes.h:
12124
12125 2006-03-16  Darin Adler  <darin@apple.com>
12126
12127         Reviewed by Maciej.
12128
12129         - fixed Vector so that you can pass a reference to something in the vector
12130           to the append or insert functions
12131
12132         * kxmlcore/Vector.h:
12133         (KXMLCore::Vector::expandCapacity): Added new overloads that take a pointer to adjust
12134         and return the adjusted value of the pointer.
12135         (KXMLCore::Vector::append): Pass a pointer when expanding the vector, and use it when
12136         adding the new element. Makes the case where the element moves when the vector
12137         is expanded work.
12138         (KXMLCore::Vector::insert): Ditto.
12139
12140 2006-03-15  Eric Seidel  <eseidel@apple.com>
12141
12142         Reviewed by adele.
12143
12144         Build fix.
12145
12146         * kjs/date_object.cpp:
12147         (KJS::DateProtoFunc::callAsFunction): use size() not "len()"
12148
12149 2006-03-15  Eric Seidel  <eseidel@apple.com>
12150
12151         Reviewed by mjs.
12152
12153         Fix CString copy constructor, fixes Date.parse("") on Win32.
12154
12155         * kjs/date_object.cpp:
12156         (KJS::DateProtoFunc::callAsFunction):
12157         * kjs/ustring.cpp:
12158         (KJS::CString::CString):
12159         (KJS::CString::operator=):
12160
12161 2006-03-13  Maciej Stachowiak  <mjs@apple.com>
12162
12163         Reviewed by Anders.
12164         
12165         - KJS::Node and KJS::StatementNode are bigger than they need to be
12166         http://bugs.webkit.org/show_bug.cgi?id=7775
12167
12168         The memory usage of Node was reduced by 2 machine words per node:
12169
12170         - sourceURL was removed and only kept on FunctionBodyNode. The
12171         source URL can only be distinct per function or top-level program node, 
12172         and you always have one.
12173         
12174         - refcount was removed and kept in a separate hashtable when
12175         greater than 1. newNodes set represents floating nodes with
12176         refcount of 0. This helps because almost all nodes have a refcount of 1
12177         for almost all of their lifetime.
12178         
12179         * bindings/runtime_method.cpp:
12180         (RuntimeMethod::RuntimeMethod): Pass null body, added FIXME.
12181         * kjs/Parser.cpp:
12182         (KJS::clearNewNodes): New nodes are tracked in nodes.cpp now, but still clear
12183         them at the appropriate time.
12184         * kjs/context.h:
12185         (KJS::ContextImp::currentBody): added; used to retrieve source URL and sid
12186         for current code.
12187         (KJS::ContextImp::pushIteration): moved here from LabelStack
12188         (KJS::ContextImp::popIteration): ditto
12189         (KJS::ContextImp::inIteration): ditto
12190         (KJS::ContextImp::pushSwitch): ditto
12191         (KJS::ContextImp::popSwitch): ditto
12192         (KJS::ContextImp::inSwitch): ditto
12193         * kjs/function.cpp:
12194         (KJS::FunctionImp::FunctionImp): Add FunctionBodyNode* parameter.
12195         (KJS::FunctionImp::callAsFunction): Pass body to ContextImp.
12196         (KJS::FunctionImp::argumentsGetter): _context renamed to m_context.
12197         (KJS::DeclaredFunctionImp::DeclaredFunctionImp): Pass body to superclass
12198         constructor.
12199         (KJS::GlobalFuncImp::callAsFunction): Pass progNode as body for ContextImp in
12200         eval.
12201         * kjs/function.h: Move body field from DeclaredFunctionImp to
12202         FunctionImp.
12203         * kjs/grammar.y: Change DBG; statements no longer have a sourceid.
12204         * kjs/internal.cpp:
12205         (KJS::ContextImp::ContextImp): Initialize new m_currentBody, m_iterationDepth
12206         and m_switchDepth data members. New FunctionBodyNode* parameter - the
12207         function body provides source URL and SourceId.
12208         (KJS::InterpreterImp::mark): Use exception() function, not _exception directly.
12209         (KJS::InterpreterImp::evaluate): Pass progNode to ContextImp constructor
12210         to use as the body.
12211         * kjs/internal.h:
12212         (KJS::LabelStack::LabelStack): Remove iteration depth and switch depth;
12213         statement label stacks don't need these and it bloats their size. Put them
12214         in the ContextImp instead.
12215         * kjs/interpreter.cpp:
12216         (KJS::ExecState::lexicalInterpreter): Renamed _context to m_context.
12217         * kjs/interpreter.h:
12218         (KJS::ExecState::dynamicInterpreter): Renamed _context to m_context.
12219         (KJS::ExecState::context): ditto
12220         (KJS::ExecState::setException): Renamed _exception to m_exception
12221         (KJS::ExecState::clearException): ditto
12222         (KJS::ExecState::exception): ditto
12223         (KJS::ExecState::hadException): ditto
12224         (KJS::ExecState::ExecState): ditto both above renames
12225         * kjs/nodes.cpp:
12226         (Node::Node): Removed initialization of line, source URL and refcount. Add to
12227         local newNodes set instead of involving parser.
12228         (Node::ref): Instead of managing refcount directly, story refcount over 1 in a
12229         HashCountedSet, and keep a separate HashSet of "floating" nodes with refcount
12230         0.
12231         (Node::deref): ditto
12232         (Node::refcount): ditto
12233         (Node::clearNewNodes): Destroy anything left in the new nodes set.
12234         (currentSourceId): Inline helper to get sourceId from function body via context.
12235         (currentSourceURL): ditto for sourceURL.
12236         (Node::createErrorCompletion): use new helper
12237         (Node::throwError): ditto
12238         (Node::setExceptionDetailsIfNeeded): ditto
12239         (StatementNode::StatementNode): remove initialization of l0 and sid, rename
12240         l1 to m_lastLine.
12241         (StatementNode::setLoc): Set own m_lastLine and Node's m_line.
12242         (StatementNode::hitStatement): Get sid, first line, last line in the proper new ways.
12243         (StatListNode::StatListNode): updated for setLoc changes
12244         (BlockNode::BlockNode): ditto
12245         (DoWhileNode::execute): excpect iteraton counts on ContextImp, not LabelStack
12246         (WhileNode::execute): ditto
12247         (ForNode::execute): ditto
12248         (ForInNode::execute): ditto
12249         (ContinueNode::execute): excpect inIteration on ContextImp, not LabelStack
12250         (BreakNode::execute): excpect inIteration and inSwitch on ContextImp, not LabelStack
12251         (SwitchNode::execute): expect switch counts on ContextImp, not LabelStack
12252         (FunctionBodyNode::FunctionBodyNode): update for new setLoc
12253         (FunctionBodyNode::processFuncDecl): reindent
12254         (SourceElementsNode::SourceElementsNode): update for new setLoc
12255         * kjs/nodes.h:
12256         (KJS::Node::lineNo): Renamed _line to m_line
12257         (KJS::StatementNode::firstLine): Use lineNo()
12258         (KJS::StatementNode::lastLine): Renamed l1 to m_lastLine
12259         (KJS::FunctionBodyNode::sourceId): added
12260         (KJS::FunctionBodyNode::sourceURL): added
12261         * kjs/testkjs.cpp:
12262
12263 2006-03-14  Geoffrey Garen  <ggaren@apple.com>
12264
12265         - Fixed <rdar://problem/4478239> string sort puts "closed" before 
12266         "close"
12267
12268         Reviewed by Eric.
12269
12270         * kjs/ustring.cpp:
12271         (KJS::compare): Inverted a < in order to treat the longer string as > 
12272         the shorter string.
12273
12274 2006-03-12  Alexey Proskuryakov  <ap@nypop.com>
12275
12276         Reviewed by Maciej.
12277
12278         - fix http://bugs.webkit.org/show_bug.cgi?id=7708
12279         REGRESSION: Flash callback to JavaScript function not working.
12280
12281         Test: plugins/invoke.html
12282
12283         * bindings/c/c_utility.cpp:
12284         (KJS::Bindings::convertUTF8ToUTF16): Return a correct string length.
12285
12286 2006-03-08  Eric Seidel  <eseidel@apple.com>
12287
12288         Reviewed by darin.
12289
12290         Partially fix JS on win32 by fixing hash table generation.
12291
12292         * kjs/create_hash_table: limit << results to 32 bits.
12293         * kjs/testkjs.cpp:
12294         (TestFunctionImp::callAsFunction):
12295
12296 2006-03-07  Darin Adler  <darin@apple.com>
12297
12298         * kxmlcore/Vector.h: Quick fix to try to get Windows compiling again.
12299
12300 2006-03-07  Darin Adler  <darin@apple.com>
12301
12302         Reviewed by Anders.
12303
12304         - fix http://bugs.webkit.org/show_bug.cgi?id=7655
12305           unwanted output while running layout tests
12306
12307         * kjs/lexer.cpp: (Lexer::lex): Turn off the "yylex: ERROR" message.
12308         * kjs/regexp.cpp: (KJS::RegExp::RegExp): Remove the code to log errors from PCRE
12309         to standard output. I think we should arrange for the error text to be in JavaScript
12310         exceptions instead at some point.
12311         * kxmlcore/Vector.h: Add a check for overflow so that we'll abort if we pass a
12312         too-large size rather than allocating a buffer smaller than requested.
12313
12314 2006-03-06  David Carson <dacarson@gmail.com>
12315
12316         Reviewed by Darin, landed by ap.
12317
12318         - Fixed http://bugs.webkit.org/show_bug.cgi?id=7582
12319         c_utility.cpp contains CFString OS X platform-dependent code; should use ICU
12320
12321         Tested with test case from:
12322         http://bugs.webkit.org/show_bug.cgi?id=5163
12323
12324         * bindings/c_utility.cpp
12325         (convertUTF8ToUTF16): Changed to using Unicode converter from ICU, and manual Latin-1 conversion.
12326         * icu/unicode/ucnv.h: Copied from WebCore.
12327         * icu/unicode/ucnv_err.h: Ditto.
12328         * icu/unicode/uenum.h: Ditto.
12329
12330 2006-03-05  Darin Adler  <darin@apple.com>
12331
12332         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Updated.
12333
12334 2006-03-06  Mitz Pettel  <opendarwin.org@mitzpettel.com>
12335
12336         Fix suggested by Alexey Proskuryakov <ap@nypop.com>, reviewed by Maciej and Hyatt.
12337         
12338         - fix http://bugs.webkit.org/show_bug.cgi?id=7601
12339           REGRESSION (r13089): Reproducible crash dereferencing a deallocated element on google image search
12340
12341         * kxmlcore/Platform.h: Corrected the define to enable USE(MULTIPLE_THREADS) on Mac OS X.
12342
12343 2006-03-05  Darin Adler  <darin@apple.com>
12344
12345         Reviewed by Maciej.
12346
12347         - http://bugs.webkit.org/show_bug.cgi?id=7616
12348           get all references to KJS::Node out of internal.h
12349
12350         * JavaScriptCore.xcodeproj/project.pbxproj: Updated for file changes.
12351
12352         * kjs/Parser.cpp: Added.
12353         * kjs/Parser.h: Added.
12354
12355         * kjs/internal.cpp: Removed the Parser class.
12356         * kjs/internal.h: Ditto. Also removed unnecessary declarations of classes
12357         not used in this header.
12358
12359         * kjs/nodes.h: Added an include of "Parser.h".
12360         * kjs/function.h: Added a declaration of FunctionBodyNode.
12361
12362 2006-03-05  Geoffrey Garen  <ggaren@apple.com>
12363
12364         Reviewed by Maciej.
12365
12366         - JSC support for the fix for <rdar://problem/4467143> JavaScript 
12367         enumeration of HTML element properties skips DOM node properties
12368
12369         * kjs/lookup.h: 
12370         (1) Added the KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE macro. The 
12371         class definiton macro needs to know about the prototype's prototype so 
12372         that the class constructor properly sets it. 
12373         (2) Removed the KJS_IMPLEMENT_PROTOTYPE_WITH_PARENT macro. The class
12374         implementation macro does not need to know about the prototype's
12375         prototype, since getOwnPropertySlot should only look in the current 
12376         object's property map, and not its prototype's.
12377
12378 2006-03-05  Andrew Wellington  <proton@wiretapped.net>
12379
12380         Reviewed by Eric, landed by ap.
12381         
12382         - Remove unused breakpoint bool from StatementNodes. No test provided as
12383         there is no functionality change.
12384
12385         * kjs/nodes.cpp:
12386         (StatementNode::StatementNode):
12387         * kjs/nodes.h:
12388
12389 2006-03-03  Geoffrey Garen  <ggaren@apple.com>
12390
12391         Reviewed by Darin.
12392
12393         - Fixed <rdar://problem/4465598> REGRESSION (TOT): Crash occurs at 
12394         http://maps.google.com/?output=html ( KJS::Identifier::add(KJS::UString::Rep*)
12395
12396         This regression was caused by my fix for 4448098. I failed to account for the
12397         deleted entry sentinel in the mehtod that saves the contents of a property map to 
12398         the back/forward cache.
12399
12400         Manual test in WebCore/manual-tests/property-map-save-crash.html
12401
12402         * kjs/property_map.cpp:
12403         (KJS::deletedSentinel): Use 1 instead of -1 to facilitate an easy bit mask
12404         (KJS::isValid): New function: checks if a key is null or the deleted sentinel
12405         (KJS::PropertyMap::~PropertyMap): Fixed up the branch logic here for readability
12406         and a slight performance win
12407         (KJS::PropertyMap::clear):
12408         (KJS::PropertyMap::rehash):
12409         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList):
12410         (KJS::PropertyMap::save): Check keys with isValid()
12411
12412 2006-03-02  Maciej Stachowiak  <mjs@apple.com>
12413
12414         - now fix mac build again
12415
12416         * kjs/identifier.cpp:
12417
12418 2006-03-02  Maciej Stachowiak  <mjs@apple.com>
12419
12420         Rubber stamped by Anders and Eric.
12421
12422         - add fpconst.cpp to win32 build, it is now needed
12423
12424         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
12425         * kjs/fpconst.cpp:
12426
12427 2006-03-02  Maciej Stachowiak  <mjs@apple.com>
12428
12429         Reviewed by Eric.
12430
12431         - fix windows build, broken by my last patch
12432
12433         * kjs/JSImmediate.cpp:
12434         * kjs/identifier.cpp:
12435         * kxmlcore/FastMalloc.cpp:
12436         * kxmlcore/Platform.h:
12437
12438 2006-03-01  Maciej Stachowiak  <mjs@apple.com>
12439
12440         Reviewed by Darin.
12441         
12442         - Set up new prototype macros and avoid using #if without defined() in JSC
12443         
12444         Added new PLATFORM macros and related, to make sure #if's all check if relevant macros
12445         are defined, and to separate core OS-level dependencies from operating environment
12446         dependencies so you can, e.g., build KDE on Mac or Windows.
12447
12448         * kxmlcore/Platform.h: Added.
12449
12450         - deploy them everywhere in JavaScriptCore
12451         
12452         * JavaScriptCore.xcodeproj/project.pbxproj:
12453         * bindings/jni/jni_utility.cpp:
12454         (KJS::Bindings::convertValueToJValue):
12455         * bindings/objc/WebScriptObject.mm:
12456         * bindings/objc/objc_instance.mm:
12457         (ObjcInstance::end):
12458         * bindings/softlinking.h:
12459         * bindings/testbindings.mm:
12460         (main):
12461         * kjs/JSLock.cpp:
12462         * kjs/collector.cpp:
12463         (KJS::Collector::markCurrentThreadConservatively):
12464         (KJS::Collector::markOtherThreadConservatively):
12465         (KJS::Collector::markStackObjectsConservatively):
12466         * kjs/config.h:
12467         * kjs/date_object.cpp:
12468         (gmtoffset):
12469         (KJS::formatTime):
12470         (KJS::DateProtoFunc::callAsFunction):
12471         (KJS::DateObjectImp::construct):
12472         (KJS::makeTime):
12473         * kjs/dtoa.cpp:
12474         * kjs/fpconst.cpp:
12475         (KJS::sizeof):
12476         (KJS::):
12477         * kjs/grammar.y:
12478         * kjs/identifier.cpp:
12479         * kjs/internal.cpp:
12480         * kjs/interpreter.cpp:
12481         (KJS::Interpreter::evaluate):
12482         (KJS::Interpreter::createLanguageInstanceForValue):
12483         * kjs/interpreter.h:
12484         * kjs/lookup.cpp:
12485         * kjs/lookup.h:
12486         * kjs/math_object.cpp:
12487         * kjs/object.cpp:
12488         * kjs/object.h:
12489         * kjs/operations.cpp:
12490         (KJS::isNaN):
12491         (KJS::isInf):
12492         (KJS::isPosInf):
12493         (KJS::isNegInf):
12494         * kjs/operations.h:
12495         * kjs/regexp.cpp:
12496         (KJS::RegExp::RegExp):
12497         (KJS::RegExp::~RegExp):
12498         (KJS::RegExp::match):
12499         * kjs/regexp.h:
12500         * kjs/testkjs.cpp:
12501         (StopWatch::start):
12502         (StopWatch::stop):
12503         (StopWatch::getElapsedMS):
12504         * kjs/ustring.cpp:
12505         * kjs/ustring.h:
12506         * kxmlcore/AlwaysInline.h:
12507         * kxmlcore/Assertions.cpp:
12508         * kxmlcore/Assertions.h:
12509         * kxmlcore/FastMalloc.cpp:
12510         (KXMLCore::):
12511         * kxmlcore/FastMalloc.h:
12512         * kxmlcore/FastMallocInternal.h:
12513         * kxmlcore/HashTable.h:
12514         * kxmlcore/TCPageMap.h:
12515         * kxmlcore/TCSpinLock.h:
12516         (TCMalloc_SpinLock::Lock):
12517         (TCMalloc_SpinLock::Unlock):
12518         (TCMalloc_SlowLock):
12519         * kxmlcore/TCSystemAlloc.cpp:
12520         (TCMalloc_SystemAlloc):
12521         * os-win32/stdint.h:
12522
12523 2006-02-28  Geoffrey Garen  <ggaren@apple.com>
12524
12525         Reviewed by Darin.
12526
12527         - Fixed <rdar://problem/4448098> Switch PropertyMap deleted entry 
12528         placeholder to -1 from UString::Rep::null
12529
12530         This turned out to be only a small speedup (.12%). That's within the 
12531         margin of error for super accurate JS iBench, but Shark confirms the 
12532         same, so I think it's worth landing.
12533
12534         FYI, I also confirmed that the single entry optimization in 
12535         PropertyMap is a 3.2% speedup.
12536
12537         * kjs/property_map.cpp:
12538         (KJS::PropertyMap::~PropertyMap):
12539         (KJS::PropertyMap::clear):
12540         (KJS::PropertyMap::put):
12541         (KJS::PropertyMap::insert):
12542         (KJS::PropertyMap::rehash):
12543         (KJS::PropertyMap::remove):
12544         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList):
12545         (KJS::PropertyMap::checkConsistency):
12546         * kjs/property_map.h:
12547         (KJS::PropertyMap::deletedSentinel):
12548
12549 2006-02-27  Eric Seidel  <eseidel@apple.com>
12550
12551         Rubber-stamped by darin.
12552
12553         Remove fpconst.cpp, unused on win32 and the cause of linker warnings.
12554
12555         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
12556
12557 2006-02-27  Eric Seidel  <eseidel@apple.com>
12558
12559         Reviewed by mjs.
12560
12561         Fix Assertions.cpp to compile on win32.
12562
12563         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
12564         * kxmlcore/Assertions.cpp:
12565
12566 2006-02-27  Eric Seidel  <eseidel@apple.com>
12567
12568         Reviewed by mjs.
12569
12570         Made Assertions.cpp platform independent.
12571         Moved mac-specific logging logic up into WebCore.
12572         http://bugs.webkit.org/show_bug.cgi?id=7503
12573
12574         * JavaScriptCore.xcodeproj/project.pbxproj:
12575         * kxmlcore/Assertions.cpp: Added.
12576         * kxmlcore/Assertions.h:
12577         * kxmlcore/Assertions.mm: Removed.
12578
12579 2006-02-27  Darin Adler  <darin@apple.com>
12580
12581         - fixed Mac Debug build, there was an unused parameter
12582
12583         * kxmlcore/FastMalloc.cpp: (KXMLCore::fastMallocRegisterThread):
12584         Remove parameter name.
12585
12586         * kjs/debugger.h: Fixed comment.
12587
12588 2006-02-27  Eric Seidel  <eseidel@apple.com>
12589
12590         Reviewed by darin.
12591
12592         * kxmlcore/Vector.h:
12593         (KXMLCore::deleteAllValues): fix unused variable warning
12594
12595 2006-02-21  Maciej Stachowiak  <mjs@apple.com>
12596
12597         Reviewed by Darin.
12598         
12599         - Turn off -Wno-unused-param for JavaScriptCore and get rid of unused params
12600         http://bugs.webkit.org/show_bug.cgi?id=7384
12601
12602         * JavaScriptCore.xcodeproj/project.pbxproj:
12603         * bindings/NP_jsobject.cpp:
12604         (jsAllocate):
12605         (_NPN_InvokeDefault):
12606         (_NPN_Evaluate):
12607         (_NPN_GetProperty):
12608         (_NPN_SetProperty):
12609         (_NPN_RemoveProperty):
12610         (_NPN_HasProperty):
12611         (_NPN_HasMethod):
12612         * bindings/c/c_class.h:
12613         (KJS::Bindings::CClass::constructorAt):
12614         * bindings/c/c_utility.cpp:
12615         (KJS::Bindings::convertNPVariantToValue):
12616         * bindings/jni/jni_class.cpp:
12617         (JavaClass::methodsNamed):
12618         (JavaClass::fieldNamed):
12619         * bindings/jni/jni_instance.cpp:
12620         (JavaInstance::invokeDefaultMethod):
12621         * bindings/jni/jni_jsobject.cpp:
12622         * bindings/jni/jni_objc.mm:
12623         (-[NSObject KJS::Bindings::]):
12624         * bindings/objc/WebScriptObject.mm:
12625         (+[WebUndefined allocWithZone:]):
12626         (-[WebUndefined initWithCoder:]):
12627         (-[WebUndefined encodeWithCoder:]):
12628         (-[WebUndefined copyWithZone:]):
12629         * bindings/objc/objc_class.h:
12630         (KJS::Bindings::ObjcClass::constructorAt):
12631         * bindings/objc/objc_class.mm:
12632         (KJS::Bindings::ObjcClass::methodsNamed):
12633         (KJS::Bindings::ObjcClass::fallbackObject):
12634         * bindings/objc/objc_instance.mm:
12635         (ObjcInstance::getValueOfUndefinedField):
12636         * bindings/objc/objc_runtime.mm:
12637         (ObjcFallbackObjectImp::getOwnPropertySlot):
12638         (ObjcFallbackObjectImp::put):
12639         (ObjcFallbackObjectImp::canPut):
12640         (ObjcFallbackObjectImp::deleteProperty):
12641         (ObjcFallbackObjectImp::toBoolean):
12642         * bindings/runtime.cpp:
12643         (KJS::Bindings::Instance::createLanguageInstanceForValue):
12644         * bindings/runtime.h:
12645         (KJS::Bindings::Instance::getValueOfUndefinedField):
12646         (KJS::Bindings::Instance::setValueOfUndefinedField):
12647         * bindings/runtime_array.cpp:
12648         (RuntimeArray::lengthGetter):
12649         (RuntimeArray::indexGetter):
12650         (RuntimeArray::put):
12651         (RuntimeArray::deleteProperty):
12652         * bindings/runtime_method.cpp:
12653         (RuntimeMethod::lengthGetter):
12654         (RuntimeMethod::execute):
12655         * bindings/runtime_object.cpp:
12656         (RuntimeObjectImp::fallbackObjectGetter):
12657         (RuntimeObjectImp::fieldGetter):
12658         (RuntimeObjectImp::methodGetter):
12659         (RuntimeObjectImp::put):
12660         (RuntimeObjectImp::canPut):
12661         (RuntimeObjectImp::deleteProperty):
12662         (RuntimeObjectImp::defaultValue):
12663         (RuntimeObjectImp::callAsFunction):
12664         * bindings/runtime_root.cpp:
12665         (performJavaScriptAccess):
12666         * kjs/array_object.cpp:
12667         (ArrayInstance::lengthGetter):
12668         (ArrayInstance::getOwnPropertySlot):
12669         (ArrayPrototype::ArrayPrototype):
12670         (ArrayPrototype::getOwnPropertySlot):
12671         * kjs/bool_object.cpp:
12672         (BooleanObjectImp::BooleanObjectImp):
12673         * kjs/date_object.cpp:
12674         (KJS::DateObjectFuncImp::DateObjectFuncImp):
12675         (KJS::DateObjectFuncImp::callAsFunction):
12676         * kjs/error_object.cpp:
12677         (ErrorObjectImp::ErrorObjectImp):
12678         (NativeErrorPrototype::NativeErrorPrototype):
12679         (NativeErrorImp::NativeErrorImp):
12680         * kjs/function.cpp:
12681         (KJS::FunctionImp::argumentsGetter):
12682         (KJS::FunctionImp::lengthGetter):
12683         (KJS::Arguments::mappedIndexGetter):
12684         (KJS::ActivationImp::argumentsGetter):
12685         (KJS::ActivationImp::put):
12686         * kjs/function_object.cpp:
12687         (FunctionObjectImp::FunctionObjectImp):
12688         * kjs/internal.cpp:
12689         (KJS::GetterSetterImp::toPrimitive):
12690         (KJS::GetterSetterImp::toBoolean):
12691         * kjs/interpreter.cpp:
12692         (KJS::Interpreter::evaluate):
12693         * kjs/interpreter.h:
12694         (KJS::Interpreter::isGlobalObject):
12695         (KJS::Interpreter::interpreterForGlobalObject):
12696         (KJS::Interpreter::isSafeScript):
12697         * kjs/lexer.cpp:
12698         (Lexer::makeIdentifier):
12699         (Lexer::makeUString):
12700         * kjs/lookup.h:
12701         (KJS::staticFunctionGetter):
12702         (KJS::staticValueGetter):
12703         * kjs/nodes.cpp:
12704         (StatementNode::processFuncDecl):
12705         (PropertyNode::evaluate):
12706         (PropertyNameNode::evaluate):
12707         * kjs/number_object.cpp:
12708         (NumberObjectImp::NumberObjectImp):
12709         (NumberObjectImp::getOwnPropertySlot):
12710         * kjs/object.cpp:
12711         (KJS::JSObject::defineGetter):
12712         (KJS::JSObject::defineSetter):
12713         (KJS::JSObject::hasInstance):
12714         (KJS::JSObject::propertyIsEnumerable):
12715         * kjs/object_object.cpp:
12716         (ObjectObjectImp::ObjectObjectImp):
12717         * kjs/property_slot.cpp:
12718         (KJS::PropertySlot::undefinedGetter):
12719         (KJS::PropertySlot::functionGetter):
12720         * kjs/reference.cpp:
12721         (KJS::Reference::getPropertyName):
12722         * kjs/reference_list.cpp:
12723         (ReferenceListIterator::operator++):
12724         * kjs/regexp_object.cpp:
12725         (RegExpObjectImp::RegExpObjectImp):
12726         (RegExpObjectImp::getValueProperty):
12727         (RegExpObjectImp::putValueProperty):
12728         * kjs/string_object.cpp:
12729         (StringInstance::lengthGetter):
12730         (StringInstance::indexGetter):
12731         (StringPrototype::StringPrototype):
12732         * kxmlcore/Assertions.mm:
12733         * kxmlcore/FastMalloc.cpp:
12734         (KXMLCore::TCMalloc_PageHeap::CheckList):
12735         * kxmlcore/HashTable.h:
12736         (KXMLCore::HashTableConstIterator::checkValidity):
12737         (KXMLCore::IdentityHashTranslator::translate):
12738         * pcre/pcre_get.c:
12739         (pcre_get_stringnumber):
12740
12741 2006-02-23  Darin Adler  <darin@apple.com>
12742
12743         - try to fix buildbot failure
12744
12745         * bindings/c/c_utility.cpp: Touch this file, which seems to not have been
12746         recompiled after additional inlining was introduced (Xcode bug?).
12747
12748 2006-02-23  Geoffrey Garen  <ggaren@apple.com>
12749
12750         Reviewed by Darin, Maciej.
12751
12752         - Inline some functions suggested by Shark. 2.9% speedup on super
12753         accurate JS iBench.
12754
12755         http://bugs.webkit.org/show_bug.cgi?id=7411
12756         <rdar://problem/4448116>
12757
12758         * kjs/nodes.h:
12759         (KJS::ArgumentsNode::evaluateList):
12760         * kjs/object.cpp:
12761         * kjs/object.h:
12762         (KJS::ScopeChain::release):
12763         (KJS::JSObject::toPrimitive):
12764         * kjs/scope_chain.cpp:
12765         * kjs/ustring.cpp:
12766         * kjs/ustring.h:
12767         (KJS::UString::toArrayIndex):
12768         * kjs/value.cpp:
12769         * kjs/value.h:
12770         (KJS::JSValue::toObject):
12771         * kxmlcore/FastMalloc.cpp:
12772         (KXMLCore::TCMalloc_ThreadCache_FreeList::Push):
12773         (KXMLCore::TCMalloc_ThreadCache_FreeList::Pop):
12774
12775 2006-02-21  Eric Seidel  <eseidel@apple.com>
12776
12777         Added *.user to ignore list.
12778
12779 2006-02-21  Eric Seidel  <eseidel@apple.com>
12780
12781         Reviewed by ggaren.
12782
12783         Add grammarWrapper.cpp to work around visual studio bug plaguing buildbot.
12784
12785         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
12786         * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Added.
12787
12788 2006-02-21  Eric Seidel  <eseidel@apple.com>
12789
12790         Reviewed by ggaren.
12791
12792         * kjs/testkjs.cpp: #if out timeval code on win32
12793
12794 2006-02-21  Michael Emmel  <mike.emmel@gmail.com>
12795
12796         Reviewed by Darin.
12797
12798         - fix http://bugs.webkit.org/show_bug.cgi?id=7397
12799           TCPageMap.h would not compile for me because string.h was missing
12800
12801         * kxmlcore/TCPageMap.h: Added <string.h> include.
12802
12803 2006-02-21  Darin Adler  <darin@apple.com>
12804
12805         Reviewed by John Sullivan.
12806
12807         - http://bugs.webkit.org/show_bug.cgi?id=7404
12808           remove a bunch of extra implementsCall overrides
12809
12810         * JavaScriptCore.xcodeproj/project.pbxproj: Sorted files.
12811
12812         * kjs/internal.h: Made InternalFunctionImp::callAsFunction pure virtual so that
12813         we'll get a compile error if some derived class neglects to implement it.
12814
12815         * kjs/function.cpp: (KJS::FunctionImp::FunctionImp): Remove unneeded initialization
12816         of param, which is an OwnPtr so it gets initialized by default.
12817
12818         * bindings/runtime_method.cpp:
12819         * bindings/runtime_method.h:
12820         * kjs/array_object.cpp:
12821         * kjs/array_object.h:
12822         * kjs/bool_object.cpp:
12823         * kjs/bool_object.h:
12824         * kjs/date_object.cpp:
12825         * kjs/date_object.h:
12826         * kjs/error_object.cpp:
12827         * kjs/error_object.h:
12828         * kjs/function.cpp:
12829         * kjs/function.h:
12830         * kjs/function_object.cpp:
12831         * kjs/function_object.h:
12832         * kjs/math_object.cpp:
12833         * kjs/math_object.h:
12834         * kjs/number_object.cpp:
12835         * kjs/number_object.h:
12836         * kjs/object_object.cpp:
12837         * kjs/object_object.h:
12838         * kjs/regexp_object.cpp:
12839         * kjs/regexp_object.h:
12840         * kjs/string_object.cpp:
12841         * kjs/string_object.h:
12842         Removed many rendundant implementations of implementsCall from subclasses of
12843         InternalFunctionImp.
12844
12845 2006-02-21  Darin Adler  <darin@apple.com>
12846
12847         - fixed build
12848
12849         * kjs/internal.cpp: (KJS::InternalFunctionImp::implementsCall):
12850         Oops, fixed name.
12851
12852 2006-02-21  Darin Adler  <darin@apple.com>
12853
12854         Change suggested by Mitz.
12855
12856         - http://bugs.webkit.org/show_bug.cgi?id=7402
12857           REGRESSION: Methods do not execute
12858
12859         * kjs/internal.h: Add implementsHasCall to InternalFunctionImp.
12860         * kjs/internal.cpp: (KJS::InternalFunctionImp::implementsHasCall):
12861         Return true. All the classes derived from InternalFunctionImp need
12862         to return true from this -- later we can remove all the extra
12863         implementations too.
12864
12865 2006-02-21  Maciej Stachowiak  <mjs@apple.com>
12866
12867         - fix build breakage caused by last-minute change to my patch
12868
12869         * kjs/lookup.h:
12870
12871 2006-02-20  Maciej Stachowiak  <mjs@apple.com>
12872
12873         Reviewed by Geoff and Darin.
12874         
12875         Patch from Maks Orlovich, based on work by David Faure, hand-applied and 
12876         significantly reworked by me.
12877         
12878         - Patch: give internal function names (KJS merge)
12879         http://bugs.webkit.org/show_bug.cgi?id=6279
12880
12881         * tests/mozilla/expected.html: Updated for newly fixed test.
12882
12883         * kjs/array_object.cpp:
12884         (ArrayProtoFunc::ArrayProtoFunc):
12885         * kjs/array_object.h:
12886         * kjs/bool_object.cpp:
12887         (BooleanPrototype::BooleanPrototype):
12888         (BooleanProtoFunc::BooleanProtoFunc):
12889         * kjs/bool_object.h:
12890         * kjs/date_object.cpp:
12891         (KJS::DateProtoFunc::DateProtoFunc):
12892         (KJS::DateObjectImp::DateObjectImp):
12893         (KJS::DateObjectFuncImp::DateObjectFuncImp):
12894         * kjs/error_object.cpp:
12895         (ErrorPrototype::ErrorPrototype):
12896         (ErrorProtoFunc::ErrorProtoFunc):
12897         * kjs/error_object.h:
12898         * kjs/function.cpp:
12899         (KJS::FunctionImp::FunctionImp):
12900         (KJS::GlobalFuncImp::GlobalFuncImp):
12901         * kjs/function.h:
12902         * kjs/function_object.cpp:
12903         (FunctionPrototype::FunctionPrototype):
12904         (FunctionProtoFunc::FunctionProtoFunc):
12905         (FunctionProtoFunc::callAsFunction):
12906         * kjs/function_object.h:
12907         * kjs/internal.cpp:
12908         (KJS::InterpreterImp::initGlobalObject):
12909         (KJS::InternalFunctionImp::InternalFunctionImp):
12910         * kjs/internal.h:
12911         (KJS::InternalFunctionImp::functionName):
12912         * kjs/lookup.h:
12913         (KJS::staticFunctionGetter):
12914         (KJS::HashEntryFunction::HashEntryFunction):
12915         (KJS::HashEntryFunction::implementsCall):
12916         (KJS::HashEntryFunction::toBoolean):
12917         (KJS::HashEntryFunction::implementsHasInstance):
12918         (KJS::HashEntryFunction::hasInstance):
12919         * kjs/math_object.cpp:
12920         (MathFuncImp::MathFuncImp):
12921         * kjs/math_object.h:
12922         * kjs/number_object.cpp:
12923         (NumberPrototype::NumberPrototype):
12924         (NumberProtoFunc::NumberProtoFunc):
12925         * kjs/number_object.h:
12926         * kjs/object.cpp:
12927         (KJS::JSObject::putDirectFunction):
12928         (KJS::Error::create):
12929         * kjs/object.h:
12930         * kjs/object_object.cpp:
12931         (ObjectPrototype::ObjectPrototype):
12932         (ObjectProtoFunc::ObjectProtoFunc):
12933         * kjs/object_object.h:
12934         * kjs/regexp_object.cpp:
12935         (RegExpPrototype::RegExpPrototype):
12936         (RegExpProtoFunc::RegExpProtoFunc):
12937         * kjs/regexp_object.h:
12938         * kjs/string_object.cpp:
12939         (StringProtoFunc::StringProtoFunc):
12940         (StringObjectImp::StringObjectImp):
12941         (StringObjectFuncImp::StringObjectFuncImp):
12942         * kjs/string_object.h:
12943         
12944 2006-02-20  Geoffrey Garen  <ggaren@apple.com>
12945
12946         Reviewed by Darin, with help from Eric, Maciej.
12947
12948         - More changes to support super-accurate JS iBench. Doesn't work on 
12949         Windows. (Doesn't break Windows, either.) I've filed 
12950         [http://bugs.webkit.org/show_bug.cgi?id=7399] about that. 
12951
12952         * kjs/interpreter.cpp:
12953         (KJS::Interpreter::evaluate): Print line numbers with exception output
12954         * kjs/testkjs.cpp: Changed " *" to "* " because Eric says that's the 
12955         way we roll with .cpp files.
12956         (StopWatch::StopWatch): New class. Provides microsecond-accurate 
12957         timings.
12958         (StopWatch::~StopWatch):
12959         (StopWatch::start):
12960         (StopWatch::stop):
12961         (StopWatch::getElapsedMS):
12962         (TestFunctionImp::callAsFunction): Added missing return statement. 
12963         Fixed up "run" to use refactored helper functions. Removed bogus 
12964         return statement from "quit" case. Made "print" output to stdout 
12965         instead of stderr because that makes more sense, and PERL handles 
12966         stdout better.
12967         (main): Factored out KXMLCore unit tests. Removed custom exception 
12968         printing code because the interpreter prints exceptions for you. Added 
12969         a "delete" call for the GlobalImp we allocate.
12970         (testIsInteger): New function, result of refacotring.
12971         (createStringWithContentsOfFile): New function, result of refactoring. 
12972         Renamed "code" to "buffer" to match factored-out-ness.
12973
12974 2006-02-20  Eric Seidel  <eseidel@apple.com>
12975
12976         Reviewed by hyatt.
12977
12978         Fix "Copy ICU DLLs..." phase.
12979
12980         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
12981         * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
12982
12983 2006-02-19  Darin Adler  <darin@apple.com>
12984
12985         - renamed ERROR to LOG_ERROR to fix build
12986           presumably Maciej had this change and forgot to land it
12987
12988         * kjs/collector.cpp: Removed now-unneeded #undef ERROR.
12989         * kxmlcore/Assertions.h: Renamed ERROR to LOG_ERROR.
12990         * kxmlcore/FastMalloc.cpp: Changed MESSAGE macro to use LOG_ERROR.
12991
12992 2006-02-18  Mitz Pettel  <opendarwin.org@mitzpettel.com>
12993
12994         Test: fast/js/toString-exception.html
12995
12996         Reviewed by Maciej.
12997
12998         - fix http://bugs.webkit.org/show_bug.cgi?id=7343
12999           REGRESSION: fast/js/toString-overrides.html fails when run multiple times
13000
13001         * kjs/array_object.cpp:
13002         (ArrayProtoFunc::callAsFunction): Remove the object from the visited elements set before
13003         returning an error.
13004
13005 2006-02-18  Darin Adler  <darin@apple.com>
13006
13007         Reviewed by Maciej.
13008
13009         - http://bugs.webkit.org/show_bug.cgi?id=7345
13010           add insert and remove to KXMLCore::Vector
13011
13012         * kxmlcore/Vector.h: Added "moveOverlapping", which is used in both
13013         insert and remove to slide elements within the vector. Also added
13014         "insert" and "remove" functions.
13015
13016 2006-02-16  Geoffrey Garen  <ggaren@apple.com>
13017
13018         Reviewed by John.
13019
13020         - Fixed <rdar://problem/4448534> TOT REGRESSION: crash in KJS::
13021         Bindings::Instance::deref when leaving page @ gigaom.com
13022
13023         * bindings/c/c_instance.cpp:
13024         (KJS::Bindings::CInstance::~CInstance): Since we cache the class object
13025         globally, we shouldn't delete it, so don't.
13026
13027 2006-02-16  Timothy Hatcher  <timothy@apple.com>
13028
13029         Added -Wno-deprecated-declarations to all the ObjC binding files to prevent deprecation
13030         warnings. Using <rdar://problem/4448350> to track this.
13031
13032         * JavaScriptCore.xcodeproj/project.pbxproj:
13033         * bindings/objc/objc_jsobject.h: Removed empty file.
13034         * bindings/objc/objc_jsobject.mm: Removed empty file.
13035
13036 2006-02-16  Tim Omernick  <timo@apple.com>
13037
13038         Reviewed by Geoff.
13039
13040         <rdar://problem/4428609> Flash Player 8.0.22 can crash Safari (and WebKit apps) with
13041         javascript disabled (7015)
13042
13043         * bindings/NP_jsobject.cpp:
13044         (_NPN_CreateNoScriptObject):
13045         Returns an NPObject which is not bound to a JavaScript object.  This kind of NPObject
13046         can be given to a plugin as the "window script object" when JavaScript is disabled.
13047         The object has a custom NPClass, NPNoScriptObjectClass, which has no defined methods.
13048         Because of this, none of the NPN_* functions called by the plugin on this "no script
13049         object" will cause entry into JavaScript code.
13050         (_NPN_InvokeDefault):
13051         Make sure the NPVariant is filled before returning from this function.  This never
13052         mattered before because we never reached this case, having only created NPObjects of
13053         the class NPScriptObjectClass.
13054         (_NPN_Invoke):
13055         ditto
13056         (_NPN_Evaluate):
13057         ditto
13058         (_NPN_GetProperty):
13059         ditto
13060
13061         * bindings/NP_jsobject.h:
13062         Declared _NPN_CreateNoScriptObject().
13063
13064 2006-02-16  Darin Adler  <darin@apple.com>
13065
13066         Reviewed by me, change by Peter Kuemmel.
13067
13068         * kjs/operations.cpp: (KJS::isNegInf): Fix Windows code, which was
13069         checking for positive infinity (rolling in fix from KDE side).
13070
13071 2006-02-15  Geoffrey Garen  <ggaren@apple.com>
13072
13073         Reviewed by Maciej, Eric.
13074
13075         - JavaScriptCore half of fix for <rdar://problem/4176077> CrashTracer: 6569
13076         crashes in DashboardClient at com.apple.JavaScriptCore:
13077         KJS::Bindings::ObjcFallbackObjectImp::type()
13078
13079         WebCore and JavaScriptCore weren't sharing Instance objects very
13080         nicely. I made them use RefPtrs, and sent them to bed without dessert.
13081
13082         * bindings/jni/jni_instance.cpp: Made _instance a RefPtr
13083         (JavaInstance::~JavaInstance):
13084         (JObjectWrapper::JObjectWrapper):
13085         * bindings/jni/jni_instance.h:
13086         (KJS::Bindings::JObjectWrapper::ref):
13087         (KJS::Bindings::JObjectWrapper::deref):
13088         * bindings/jni/jni_runtime.cpp: Made _array a RefPtr
13089         (JavaArray::~JavaArray):
13090         (JavaArray::JavaArray):
13091         * bindings/jni/jni_runtime.h:
13092         (KJS::Bindings::JavaArray::operator=):
13093         * bindings/objc/objc_runtime.h:
13094         - Prohibited copying because that would muss the ref count.
13095         - Prohibited construction without instance because an instance wrapper
13096         without an instance is almost certainly a bug.
13097         * bindings/objc/objc_runtime.mm:
13098         (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
13099         * bindings/runtime.cpp:
13100         (KJS::Bindings::Instance::Instance):
13101         (KJS::Bindings::Instance::createBindingForLanguageInstance):
13102         (KJS::Bindings::Instance::createRuntimeObject):
13103         * bindings/runtime.h:
13104         (KJS::Bindings::Instance::ref):
13105         (KJS::Bindings::Instance::deref):
13106         * bindings/runtime_object.cpp:
13107         (RuntimeObjectImp::RuntimeObjectImp):
13108         (RuntimeObjectImp::fallbackObjectGetter):
13109         (RuntimeObjectImp::fieldGetter):
13110         (RuntimeObjectImp::methodGetter):
13111         (RuntimeObjectImp::getOwnPropertySlot):
13112         (RuntimeObjectImp::put):
13113         (RuntimeObjectImp::canPut):
13114         * bindings/runtime_object.h: 
13115         - Removed ownsInstance data member because RefPtr takes care of 
13116         instance lifetime now. 
13117         - Prohibited copying because that would muss the ref count.
13118         - Prohibited construction without instance because an instance wrapper
13119         without an instance is almost certainly a bug.
13120         (KJS::RuntimeObjectImp::getInternalInstance):
13121
13122 2006-02-15  Geoffrey Garen  <ggaren@apple.com>
13123
13124         Reviewed by John.
13125
13126         - Applied the 4330457 change to CClass and ObjcClass as well.
13127
13128         Once plugins work in DumpRenderTree, running run-webkit-tests --leaks
13129         will catch this. 
13130
13131         This change isn't as critical because CClass and ObjcClass objects get 
13132         cached globally and never deleted, but it's good practice, in case we 
13133         ever do decide to delete CClass and ObjcClass objects.
13134
13135         This change requires prohibiting copying, because we don't do any 
13136         intelligent ref-counting -- when a Class is destroyed, it destroys its 
13137         methods and fields unconditionally. (Java classes already prohibited
13138         copying.)
13139
13140         * bindings/c/c_class.cpp:
13141         - Merged _commonInit and _commonDelete into constructor and destructor.
13142         (CClass::CClass):
13143         (CClass::~CClass):
13144         (CClass::methodsNamed): Added delete callbacks
13145         (CClass::fieldNamed): Added delete callbacks
13146         * bindings/c/c_class.h: Prohibited copying
13147         * bindings/c/c_instance.cpp: 
13148         (KJS::Bindings::CInstance::getClass): Changed to use the preferred 
13149         class factory method, to take advantage of the global cache.
13150
13151         [ Repeated changes applied to CClass for ObjcClass: ]
13152
13153         * bindings/objc/objc_class.h: 
13154         * bindings/objc/objc_class.mm:
13155         (KJS::Bindings::ObjcClass::ObjcClass):
13156         (KJS::Bindings::ObjcClass::~ObjcClass):
13157         (KJS::Bindings::ObjcClass::methodsNamed):
13158         (KJS::Bindings::ObjcClass::fieldNamed):
13159         * bindings/objc/objc_runtime.h:
13160         (KJS::Bindings::ObjcMethod::ObjcMethod): Initialized uninitialized
13161         variable to prevent bad CFRelease.
13162         (KJS::Bindings::ObjcMethod::~ObjcMethod): Removed erroneous ';' from
13163         if statement to prevent bad CFRelease.
13164         * bindings/objc/objc_runtime.cpp: Changed to use the preferred
13165         ObjectStructPtr, for clarity.
13166
13167 2006-02-14  Geoffrey Garen  <ggaren@apple.com>
13168
13169         Reviewed by John.
13170
13171         - Fixed <rdar://problem/4330457> CrashTracer: [REGRESSION] 3763 crashes
13172         in Safari at com.apple.JavaScriptCore: KJS::Bindings::JavaInstance::
13173         getClass const + 56
13174
13175         Once plugins work in DumpRenderTree, running run-webkit-tests --leaks
13176         will catch this. 
13177
13178         This was a memory leak in the bindings code. The leak was so extreme
13179         that it would cause Safari or the JVM to abort from lack of memory.
13180         Upon construction, Class objects create field and method objects, 
13181         storing them in CFDictionaries. The bug was that upon destruction, the 
13182         class objects released the dictionaries but didn't destroy the stored 
13183         objects.
13184
13185         The fix is to supply CFDictionary callbacks for destroying the values
13186         added to the dictionary. 
13187         
13188         * bindings/jni/jni_class.cpp: 
13189         (JavaClass::JavaClass): Added delete callbacks
13190         * bindings/runtime.cpp: Added definitions for delete callbacks
13191         (KJS::Bindings::deleteMethodList):
13192         (KJS::Bindings::deleteMethod):
13193         (KJS::Bindings::deleteField):
13194         * bindings/runtime.h: Added declarations for delete callbacks
13195
13196 2006-02-14  Timothy Hatcher  <timothy@apple.com>
13197
13198         Reviewed by Justin.
13199
13200         Fixed <rdar://problem/4415050> STD: WebCore build steps use echo -n, which will change
13201         behavior due to POSIX version of sh
13202
13203         * JavaScriptCore.xcodeproj/project.pbxproj: removed the use of echo -n, replaced with printf ""
13204
13205 2006-02-13   Dave Hyatt <hyatt@apple.com>
13206
13207         Fix Win32 bustage in JavaScriptCore.
13208
13209         Reviewed by darin
13210
13211         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
13212         Add JSImmediate to the Win32 project.
13213
13214         * kjs/JSImmediate.h:
13215         (KJS::JSImmediate::fromDouble):
13216         (KJS::JSImmediate::toDouble):
13217         (KJS::JSImmediate::NanAsBits):
13218         (KJS::JSImmediate::oneAsBits):
13219         Win32 needs explicit returns after abort() for non-void functions.
13220
13221         * kjs/testkjs.cpp:
13222         (run):
13223         Win32 catches a bug in testkjs!  The "return 2" should actually
13224         have been a return false.
13225
13226         * kjs/value.h:
13227         The extern decls of NaN and Inf need to be const.
13228
13229 === JavaScriptCore-521.7 ===
13230
13231 2006-02-13  Timothy Hatcher  <timothy@apple.com>
13232
13233         Reviewed by Darin.
13234
13235         Replaced the old NS_DURING exception blocking with @try/@catch.
13236
13237         * JavaScriptCorePrefix.h: undef try and catch to workaround a C++ conflict
13238         * bindings/objc/objc_instance.mm:
13239         (ObjcInstance::invokeMethod):
13240         (ObjcInstance::invokeDefaultMethod):
13241         (ObjcInstance::setValueOfUndefinedField):
13242         (ObjcInstance::getValueOfUndefinedField):
13243         * bindings/objc/objc_runtime.mm:
13244         (ObjcField::valueFromInstance):
13245         (ObjcField::setValueToInstance):
13246         (ObjcArray::setValueAt):
13247         (ObjcArray::valueAt):
13248
13249 2006-02-13  Darin Adler  <darin@apple.com>
13250
13251         - fix a couple problems building on Windows, based on requests
13252           from Krzysztof Kowalczyk <kkowalczyk@gmail.com>
13253
13254         * kjs/JSImmediate.h: Change code using non-standard u_int32/64_t types
13255         to the standard uint32/64_t. Also removed curious "isIEEE()" function
13256         that checked the sizes of some types (and type sizes alone don't tell you if
13257         the floating point conforms to the IEEE-standard). Added missing include
13258         of <stdint.h>.
13259
13260         * kjs/property_slot.h: Added missing include of <assert.h>.
13261
13262 2006-02-12  Geoffrey Garen  <ggaren@apple.com>
13263
13264         Reviewed by darin.
13265
13266         Cleaned up testkjs, added new "run" functionality to allow scripting 
13267         tests from within JS. ("run" is a part of my new super-accurate
13268         JS iBench.)
13269
13270         No regressions in run-javascriptcore-tests.
13271
13272         * kjs/testkjs.cpp:
13273         (GlobalImp::className):
13274         (TestFunctionImp::):
13275         (TestFunctionImp::callAsFunction):
13276         (main):
13277         (run):
13278
13279 2006-02-11  Alexey Proskuryakov  <ap@nypop.com>
13280
13281         Reviewed by Darin.
13282
13283         - improve fix for http://bugs.webkit.org/show_bug.cgi?id=5163
13284         RealPlayer.GetTitle() Crashes Safari/Dashboard
13285
13286         * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16):
13287         Use kCFStringEncodingISOLatin1 rather than kCFStringEncodingWindowsLatin1, 
13288         because the latter encoding has holes, and conversion can still fail.
13289
13290 2006-02-10  Geoffrey Garen  <ggaren@apple.com>
13291
13292         Reviewed by Darin.
13293
13294         - Inlined RefPtr assignment operators. .7% performance win on 
13295         super-accurate JS iBench.
13296
13297         * kxmlcore/RefPtr.h:
13298         (KXMLCore::::operator):
13299
13300 2006-02-10  Geoffrey Garen  <ggaren@apple.com>
13301
13302         No review needed, just a build fix. This time for sure.
13303
13304         * kjs/JSType.h:
13305
13306 2006-02-10  Geoffrey Garen  <ggaren@apple.com>
13307
13308         Reviewed by eric.
13309         
13310         - Fixed build. As it goes without saying, I will not mention that I
13311         blame Kevin.
13312
13313         * JavaScriptCore.xcodeproj/project.pbxproj:
13314         * kjs/JSImmediate.cpp:
13315         (KJS::JSImmediate::toObject):
13316
13317 2006-02-09  Geoffrey Garen  <ggaren@apple.com>
13318
13319         Reviewed by mjs.
13320
13321         - Fixed <rdar://problem/4343730> Should switch ConstantValues (null, 
13322         undefined, true, false) from JS objects to immediate values similar to
13323         SimpleNumber
13324
13325         2.0% performance gain on my new super-accurate version of JS iBench.
13326         (I promise to land a version of it soon.)
13327
13328         The gist of the change:
13329         (1) The SimpleNumber class (simple_number.h) is now the JSImmediate
13330         class (JSImmediate.h/.cpp), and it handles not only numbers but also 
13331         null, undefined, true, and false. 
13332         (2) JSImmediate provides convenience methods for the bit masking
13333         necessary to encode and decode immediate values.
13334         (3) ConstantValues, BooleanImp, NullImp, and UndefinedImp are gone.
13335         (4) JSCell no longer implements functions like getBoolean, because
13336         only a JSImmediate can be a boolean.
13337         (5) JSImmediate no longer uses ALWAYS_INLINE because there's no need,
13338         and ALWAYS_INLINE is a non-portable option of last resort.
13339         (6) Type is now JSType, and it resides in its own file, JSType.h.
13340         Since I was there, I did some header include sorting as part of this
13341         change.
13342
13343         The rest pretty much explains itself.
13344
13345         * JavaScriptCore.xcodeproj/project.pbxproj: Removed simple_number.h,
13346         added JSImmediate.h/.cpp.
13347         * bindings/c/c_instance.cpp:
13348         (KJS::Bindings::CInstance::defaultValue):
13349         * bindings/c/c_instance.h:
13350         * bindings/c/c_utility.cpp:
13351         (KJS::Bindings::convertValueToNPVariant):
13352         * bindings/jni/jni_instance.cpp:
13353         (JavaInstance::defaultValue):
13354         * bindings/jni/jni_instance.h:
13355         * bindings/jni/jni_jsobject.cpp:
13356         (JavaJSObject::convertValueToJObject):
13357         * bindings/objc/WebScriptObject.mm:
13358         (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
13359         Standardized calls to use getXXX instead of hand-rolling JSValue 
13360         functionality.
13361         * bindings/objc/objc_instance.h:
13362         * bindings/objc/objc_instance.mm:
13363         (ObjcInstance::getValueOfUndefinedField):
13364         (ObjcInstance::defaultValue):
13365         * bindings/objc/objc_runtime.h:
13366         * bindings/objc/objc_runtime.mm:
13367         (ObjcFallbackObjectImp::type):
13368         (ObjcFallbackObjectImp::defaultValue):
13369         * bindings/runtime.h:
13370         (KJS::Bindings::Instance::getValueOfUndefinedField):
13371         * bindings/runtime_object.cpp:
13372         (RuntimeObjectImp::defaultValue):
13373         * bindings/runtime_object.h:
13374         * kjs/JSImmediate.h: Added.
13375         (KJS::JSImmediate::isImmediate):
13376         (KJS::JSImmediate::isNumber):
13377         (KJS::JSImmediate::isBoolean):
13378         (KJS::JSImmediate::isUndefinedOrNull):
13379         (KJS::JSImmediate::fromDouble):
13380         (KJS::JSImmediate::toDouble):
13381         (KJS::JSImmediate::toBoolean):
13382         (KJS::JSImmediate::trueImmediate):
13383         (KJS::JSImmediate::falseImmediate):
13384         (KJS::JSImmediate::NaNImmediate):
13385         (KJS::JSImmediate::undefinedImmediate):
13386         (KJS::JSImmediate::nullImmediate):
13387         (KJS::JSImmediate::tag):
13388         (KJS::JSImmediate::unTag):
13389         (KJS::JSImmediate::getTag):
13390         (KJS::JSImmediate::):
13391         (KJS::JSImmediate::isIEEE):
13392         (KJS::JSImmediate::is32bit):
13393         (KJS::JSImmediate::is64bit):
13394         (KJS::JSImmediate::NanAsBits):
13395         (KJS::JSImmediate::zeroAsBits):
13396         (KJS::JSImmediate::oneAsBits):
13397         * kjs/JSLock.cpp:
13398         (KJS::JSLock::lock): Removed hack-o-rama to initialize ConstantValues.
13399         * kjs/JSType.h: Added.
13400         * kjs/collector.cpp:
13401         (KJS::Collector::protect):
13402         (KJS::Collector::unprotect):
13403         (KJS::Collector::collect):
13404         * kjs/internal.cpp:
13405         (KJS::StringImp::toPrimitive):
13406         (KJS::NumberImp::toPrimitive):
13407         (KJS::NumberImp::toBoolean):
13408         (KJS::GetterSetterImp::toPrimitive):
13409         * kjs/internal.h:
13410         (KJS::StringImp::type):
13411         (KJS::NumberImp::type):
13412         * kjs/object.cpp:
13413         (KJS::JSObject::type):
13414         (KJS::tryGetAndCallProperty): Replaced "Are you one of the six things
13415         I'm looking for?" test with "Are you not the one thing I'm not looking
13416         for" test.
13417         (KJS::JSObject::defaultValue):
13418         (KJS::JSObject::toPrimitive):
13419         * kjs/object.h:
13420         (KJS::GetterSetterImp::type):
13421         (KJS::JSValue::isObject):
13422         * kjs/operations.cpp:
13423         (KJS::equal):
13424         (KJS::strictEqual):
13425         (KJS::add):
13426         * kjs/reference.cpp:
13427         (KJS::Reference::deleteValue):
13428         * kjs/simple_number.h: Removed.
13429         * kjs/string_object.cpp:
13430         (StringInstance::getOwnPropertySlot): fixed indentation
13431         * kjs/value.cpp:
13432         (KJS::JSValue::toObject):
13433         (KJS::jsNumberCell): New function to quarantine a PIC branch -- allows
13434         us to inline jsNumber without adding PIC branches to callers.
13435         * kjs/value.h:
13436         (KJS::jsUndefined):
13437         (KJS::jsNull):
13438         (KJS::jsNaN):
13439         (KJS::jsBoolean):
13440         (KJS::jsNumber):
13441         (KJS::JSValue::downcast):
13442         (KJS::JSValue::isUndefinedOrNull):
13443         (KJS::JSValue::isBoolean):
13444         (KJS::JSValue::isNumber):
13445         (KJS::JSValue::isString):
13446         (KJS::JSValue::isObject):
13447         (KJS::JSValue::getBoolean):
13448         (KJS::JSValue::getNumber):
13449         (KJS::JSValue::getString):
13450         (KJS::JSValue::getObject):
13451         (KJS::JSValue::getUInt32):
13452         (KJS::JSValue::mark): Replaced !JSImmediate::is() test with assertion,
13453         resulting in a slight performance gain. Callers should always check
13454         !marked() before calling mark(), so it's impossible to call mark on
13455         a JSImmediate.
13456         (KJS::JSValue::marked):
13457         (KJS::JSValue::type):
13458         (KJS::JSValue::toPrimitive):
13459         (KJS::JSValue::toBoolean):
13460         (KJS::JSValue::toNumber):
13461         (KJS::JSValue::toString):
13462
13463 2006-02-06  Eric Seidel  <eseidel@apple.com>
13464
13465         Add svn:ignore properties for visual studio internals.
13466
13467 2006-02-06  Alexey Proskuryakov  <ap@nypop.com>
13468
13469         Reviewed by Darin.
13470
13471         - Refactor DateInstance to provide direct access to data. Several WIN32 modifications.
13472         http://bugs.webkit.org/show_bug.cgi?id=7107
13473
13474         - No tests added - only changed functionality on WIN32, which should be covered by 
13475         existing tests.
13476
13477         * kjs/date_object.cpp:
13478         (gmtoffset): On WIN32, use the recommended global (_timezone rather than timezone).
13479         Updated comments. 
13480         (KJS::timeZoneOffset): Removed, was basically the same as the above.
13481         (KJS::formatTime): Pass an UTC flag - UTC/local cannot be correctly selected on
13482         Windows based on struct tm itself.
13483         (KJS::DateInstance::getTime): Added.
13484         (KJS::DateInstance::getUTCTime): Added.
13485         (KJS::millisecondsToTM): Factored out from DateProtoFunc::callAsFunction().
13486         (KJS::DateObjectImp::callAsFunction): Use the new parameter to formatTime().
13487         (KJS::DateProtoFunc::callAsFunction): Updated for the other changes. The code for
13488         GetTimezoneOffset was incorrect on WIN32 - _daylight global has nothing to do
13489         with daylight savings time being in effect.
13490
13491         * kjs/date_object.h: Added prototypes for new functions.
13492
13493 2006-02-05  Maciej Stachowiak  <mjs@apple.com>
13494
13495         Reviewed by Anders.
13496         
13497         - fixed ~1100 KJS::Node leaked on layout tests
13498         http://bugs.webkit.org/show_bug.cgi?id=7097
13499
13500         * kjs/internal.cpp:
13501         (KJS::Parser::noteNodeCycle):
13502         (KJS::Parser::removeNodeCycle):
13503         (KJS::clearNewNodes):
13504         * kjs/internal.h:
13505         * kjs/nodes.cpp:
13506         (ElementNode::breakCycle):
13507         (PropertyListNode::breakCycle):
13508         (ArgumentListNode::breakCycle):
13509         (StatListNode::StatListNode):
13510         (StatListNode::breakCycle):
13511         (VarDeclListNode::breakCycle):
13512         (BlockNode::BlockNode):
13513         (ClauseListNode::breakCycle):
13514         (CaseBlockNode::CaseBlockNode):
13515         (ParameterNode::breakCycle):
13516         (SourceElementsNode::SourceElementsNode):
13517         (SourceElementsNode::breakCycle):
13518         * kjs/nodes.h:
13519         (KJS::Node::breakCycle):
13520         (KJS::ElementNode::ElementNode):
13521         (KJS::ArrayNode::ArrayNode):
13522         (KJS::PropertyListNode::PropertyListNode):
13523         (KJS::ObjectLiteralNode::ObjectLiteralNode):
13524         (KJS::ArgumentListNode::ArgumentListNode):
13525         (KJS::ArgumentsNode::ArgumentsNode):
13526         (KJS::VarDeclListNode::VarDeclListNode):
13527         (KJS::VarStatementNode::VarStatementNode):
13528         (KJS::ForNode::ForNode):
13529         (KJS::CaseClauseNode::CaseClauseNode):
13530         (KJS::ClauseListNode::ClauseListNode):
13531         (KJS::ParameterNode::ParameterNode):
13532         (KJS::FuncExprNode::FuncExprNode):
13533         (KJS::FuncDeclNode::FuncDeclNode):
13534
13535 2006-02-05  Maciej Stachowiak  <mjs@apple.com>
13536
13537         Reviewed by Hyatt.
13538         
13539         - fix default traits for classes to make sure default constructors get called
13540
13541         * kxmlcore/VectorTraits.h:
13542         (KXMLCore::):
13543
13544 2006-02-04  Darin Adler  <darin@apple.com>
13545
13546         Reviewed by Maciej.
13547
13548         - fix http://bugs.webkit.org/show_bug.cgi?id=5210
13549           REGRESSION: for/in loop with var changes global variable instead of making local
13550
13551         Test: fast/js/for-in-var-scope.html
13552
13553         * kjs/nodes.cpp:
13554         (valueForReadModifyAssignment): Use ALWAYS_INLINE macro.
13555         (ForInNode::execute): Break out of the scope chain loop once we find and set the
13556         loop variable. We don't want to set multiple loop variables.
13557         (ForInNode::processVarDecls): Process the declaration of the loop variable.
13558
13559         - other cleanup
13560
13561         * kjs/object.cpp: (KJS::tryGetAndCallProperty): Use ALWAYS_INLINE macro.
13562         * kxmlcore/FastMalloc.cpp: Change to use ALWAYS_INLINE macro from AlwaysInline.h
13563         instead of defining it here a second time.
13564
13565 2006-02-04  Maciej Stachowiak  <mjs@apple.com>
13566
13567         Reviewed by Hyatt.
13568         
13569         - change JavaScript collector statistics calls to use HashCountedSet instead
13570         of CFSet; other misc cleanup
13571         http://bugs.webkit.org/show_bug.cgi?id=7072
13572         
13573         * kjs/collector.cpp:
13574         (KJS::Collector::numProtectedObjects): renamed from numReferencedObjects
13575         (KJS::typeName):
13576         (KJS::Collector::rootObjectTypeCounts): renamed from rootObjectClasses,
13577         use HashSet
13578         * kjs/collector.h:
13579         (KJS::Collector::isOutOfMemory): Renamed from outOfMemory.
13580         * kjs/nodes.cpp:
13581
13582 2006-02-03  Timothy Hatcher  <timothy@apple.com>
13583
13584         Reviewed by Justin.
13585
13586         Renamed configuration names to Debug, Release and Production.
13587
13588         * JavaScriptCore.xcodeproj/project.pbxproj:
13589
13590 2006-02-02  George Staikos <staikos@opensource.apple.com>
13591
13592         Reviewed by Maciej.
13593
13594         * kjs/lookup.h: Fix compile, merged from KDE.
13595
13596 2006-02-02  Darin Adler  <darin@apple.com>
13597
13598         Reviewed by Maciej.
13599
13600         - http://bugs.webkit.org/show_bug.cgi?id=7005
13601           add Noncopyable, OwnPtr, OwnArrayPtr to KXMLCore
13602
13603         * kxmlcore/Noncopyable.h: Added.
13604         * kxmlcore/OwnArrayPtr.h: Added.
13605         * kxmlcore/OwnPtr.h: Added.
13606
13607         * JavaScriptCore.xcodeproj/project.pbxproj: Added new files.
13608
13609         * kjs/function.h:
13610         * kjs/function.cpp: Use OwnPtr for Parameter pointers.
13611
13612         * kjs/internal.h: Use Noncopyable for LabelStack.
13613
13614         * kjs/list.cpp: Use OwnArrayPtr for overflow.
13615
13616         * kjs/property_map.h:
13617         * kjs/property_map.cpp: Use OwnArrayPtr for SavedProperties.
13618         Use Vector for some stack buffers.
13619
13620         * kjs/regexp_object.h:
13621         * kjs/regexp_object.cpp: Use OwnArrayPtr for lastOvector.
13622
13623 2006-01-31  Maciej Stachowiak  <mjs@apple.com>
13624
13625         Reviewed by Darin.
13626         
13627         - fixed leak of hundreds of thousands of JS parser nodes on the layout tests, and added an exit counter
13628         that would catch them
13629
13630         * kjs/nodes.cpp:
13631         (NodeCounter::~NodeCounter): Added debug-only node counter.
13632         (Node::Node):
13633         (Node::~Node):
13634         * kxmlcore/VectorTraits.h: Simple classes like RefPtr do in fact need destruction.
13635
13636 2006-01-31  Darin Adler  <darin@apple.com>
13637
13638         Reviewed by Maciej.
13639
13640         - added deleteAllValues for HashSet as well as HashMap
13641         - fixed conversion from const_iterator to iterator, which I broke a while back
13642
13643         * kxmlcore/HashMap.h: Updated copyright date.
13644         * kxmlcore/HashSet.h: (KXMLCore::deleteAllValues): Added.
13645         * kxmlcore/HashTable.h: (KXMLCore::HashTableIterator::operator const_iterator): Added.
13646
13647 2006-01-31  Tim Omernick  <timo@apple.com>
13648
13649         Reviewed by Geoff Garen.
13650
13651         * bindings/c/c_utility.cpp:
13652         (KJS::Bindings::convertUTF8ToUTF16):
13653         Fixed an invalid assertion that UTF8Chars is not NULL.  It is valid for it to be NULL as long as
13654         UTF8Length is 0.
13655         This fixes an assertion failure on TOT at <http://www.musicindiaonline.com/p/x/tJO0OOBME9.As1NMvHdW/>,
13656         where JavaScript is getting a NULL string back from some call on the Real Player plugin.
13657
13658 2006-01-30  Anders Carlsson  <andersca@mac.com>
13659
13660         Reviewed by Darin.
13661
13662         Fix http://bugs.webkit.org/show_bug.cgi?id=6907
13663         REGRESSION: United.com menus messed up due to document.all/MSIE sniff
13664         
13665         * kjs/nodes.cpp:
13666         (typeStringForValue):
13667         Return "undefined" if the given object should masquerade as undefined.
13668         
13669         * kjs/object.h:
13670         (KJS::JSObject::masqueradeAsUndefined):
13671         Rename from isEqualToNull.
13672         
13673         * kjs/operations.cpp:
13674         (KJS::equal):
13675         Update for name change.
13676
13677 2006-01-29  Maciej Stachowiak  <mjs@apple.com>
13678
13679         Reviewed by Darin.
13680         
13681         - properly define Vector assignment operator; the private version was accidentally left
13682         in, and the template version is not enough to replace the default
13683
13684         * kxmlcore/Vector.h:
13685         (KXMLCore::Vector::operator=):
13686
13687 2006-01-29  Eric Seidel  <eseidel@apple.com>
13688
13689         Reviewed by darin.
13690
13691         Fix the build by applying a GCC-specific namespace hack.
13692
13693         * kjs/lookup.h:
13694
13695 2006-01-29  Eric Seidel <eseidel@apple.com>
13696
13697         Reviewed by hyatt.
13698
13699         Fix build on Win32.
13700
13701         * kjs/lookup.h: fixed ::cacheGlobalObject
13702         * kxmlcore/Vector.h:
13703         (KXMLCore::Vector::operator[]): use unsigned long
13704
13705 2006-01-29  Maciej Stachowiak  <mjs@apple.com>
13706
13707         Reviewed by Dave Hyatt.
13708
13709         * kxmlcore/Vector.h:
13710         (KXMLCore::Vector::operator[]): Add unsigned overload
13711
13712 2006-01-28  Darin Adler  <darin@apple.com>
13713
13714         Reviewed by John Sullivan.
13715
13716         - http://bugs.webkit.org/show_bug.cgi?id=6895
13717           include exception names in JavaScript form of DOM exception
13718
13719         * khtml/ecma/kjs_binding.cpp: (KJS::setDOMException): Include the name of the
13720         exception in the error message.
13721
13722 2006-01-28  Maciej Stachowiak  <mjs@apple.com>
13723
13724         Reviewed by Darin.
13725         
13726         - miscellaneous Vector improvements
13727
13728         * kxmlcore/Vector.h:
13729         (KXMLCore::Vector::at): Add range-checking asserts.
13730         (KXMLCore::Vector::first): Added as a convenience.
13731         (KXMLCore::Vector::last): Convenience for stack-style use.
13732         (KXMLCore::Vector::removeLast): ditto
13733
13734 2006-01-28  Darin Adler  <darin@apple.com>
13735
13736         Reviewed by John Sullivan
13737
13738         - fix http://bugs.webkit.org/show_bug.cgi?id=6870
13739           REGRESSION: JavaScript Date constructor won't accept another Date object
13740
13741         Test: fast/js/date-constructor.html
13742
13743         * kjs/date_object.cpp: (KJS::DateObjectImp::construct):
13744         Added a special case for constructing one date from another (to avoid losing
13745         milliseconds, which are not in the text form, to match Firefox), and changed
13746         the base code to convert to primitive before checking for string to match
13747         the standard. Also corrected a couple silly things in the "construct from
13748         current time" code path (removed a floor that does no good, and changed
13749         the constant used to convert microseconds to milliseconds to be a 1000
13750         rather than "msPerSecond").
13751
13752 2006-01-28  Darin Adler  <darin@apple.com>
13753
13754         * kjs/create_hash_table: Added missing license.
13755
13756 2006-01-28  Maciej Stachowiak  <mjs@apple.com>
13757
13758         Reviewed by Dave Hyatt.
13759         
13760         - added a Vector class
13761         http://bugs.webkit.org/show_bug.cgi?id=6894
13762
13763         * JavaScriptCore.xcodeproj/project.pbxproj:
13764         * kjs/internal.cpp:
13765         (KJS::Parser::saveNewNode): Apply Vector.
13766         (KJS::clearNewNodes): ditto
13767         * kjs/number_object.cpp:
13768         (integer_part_noexp): ditto
13769         (char_sequence): ditto
13770         * kjs/ustring.cpp:
13771         (KJS::UString::UTF8String): ditto
13772         * kxmlcore/HashMap.h:
13773         (KXMLCore::deleteAllValues): Tweaked this to only apply to HashMap,
13774         other versions are useful for other containers.
13775         * kxmlcore/Vector.h: Added. Implemented a Vector class, which should
13776         be usable for all Array/QVector style purposes, and also as a stack buffer
13777         with oversize handling. Also some helper classes to make vector operations
13778         as efficient as possible for POD types and for simple non-PODs like RefPtr.
13779         (KXMLCore::):
13780         (KXMLCore::VectorTypeOperations::destruct):
13781         (KXMLCore::VectorTypeOperations::initialize):
13782         (KXMLCore::VectorTypeOperations::move):
13783         (KXMLCore::VectorTypeOperations::uninitializedCopy):
13784         (KXMLCore::VectorTypeOperations::uninitializedFill):
13785         (KXMLCore::VectorBuffer::VectorBuffer):
13786         (KXMLCore::VectorBuffer::~VectorBuffer):
13787         (KXMLCore::VectorBuffer::deallocateBuffer):
13788         (KXMLCore::VectorBuffer::inlineBuffer):
13789         (KXMLCore::Vector::Vector):
13790         (KXMLCore::Vector::~Vector):
13791         (KXMLCore::Vector::size):
13792         (KXMLCore::Vector::capacity):
13793         (KXMLCore::Vector::isEmpty):
13794         (KXMLCore::Vector::at):
13795         (KXMLCore::Vector::operator[]):
13796         (KXMLCore::Vector::data):
13797         (KXMLCore::Vector::operator T*):
13798         (KXMLCore::Vector::operator const T*):
13799         (KXMLCore::Vector::begin):
13800         (KXMLCore::Vector::end):
13801         (KXMLCore::Vector::clear):
13802         (KXMLCore::Vector::fill):
13803         (KXMLCore::Vector::operator=):
13804         (KXMLCore::::Vector):
13805         (KXMLCore::::operator):
13806         (KXMLCore::::fill):
13807         (KXMLCore::::expandCapacity):
13808         (KXMLCore::::resize):
13809         (KXMLCore::::reserveCapacity):
13810         (KXMLCore::::append):
13811         (KXMLCore::deleteAllValues):
13812         * kxmlcore/VectorTraits.h: Added.
13813         (KXMLCore::VectorTraits): Traits to enable making Vector efficient for
13814         simple types.
13815
13816 2006-01-28  Alexey Proskuryakov  <ap@nypop.com>
13817
13818         Reviewed by Darin.
13819
13820         - fix http://bugs.webkit.org/show_bug.cgi?id=5163
13821         RealPlayer.GetTitle() Crashes Safari/Dashboard
13822
13823         * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16):
13824         Fallback to kCFStringEncodingWindowsLatin1 if the passed buffer is not valid UTF-8, preventing crashes.
13825
13826 2006-01-25  George Staikos <staikos@opensource.apple.com>
13827
13828         Reviewed by Darin.
13829
13830         * kxmlcore/HashFunctions.h: Merge build fix from KDE.
13831
13832 2006-01-25  Darin Adler  <darin@apple.com>
13833
13834         - removed an unused source file
13835
13836         * kjs/pointer_hash.h: Removed.
13837         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Removed reference to pointer_hash.h.
13838
13839 2006-01-23  Anders Carlsson  <andersca@mac.com>
13840
13841         Reviewed by Maciej.
13842
13843         - fix http://bugs.webkit.org/show_bug.cgi?id=6737
13844         KJS_DEFINE_PROTOTYPE should work outside of the KJS namespace
13845         
13846         * kjs/lookup.h:
13847         Prefix all KJS types with KJS:: in KJS_DEFINE_PROTOTYPE.
13848         
13849         (cacheGlobalObject):
13850         Move this out of the KJS namespace.
13851
13852 2006-01-23  Maciej Stachowiak  <mjs@apple.com>
13853
13854         Reviewed by Eric.
13855
13856         - renamed PointerHash to PtrHash
13857         - made PtrHash the default hash function for int and pointer types that aren't further specialized
13858         - added an AtomicStringImpl class to make it easier and more typesafe to identity hash atomic strings
13859         - did appropriate consequent cleanup (very few places now need to declare a hash function)
13860         http://bugs.webkit.org/show_bug.cgi?id=6752
13861         
13862         * kjs/array_object.cpp:
13863         (ArrayProtoFunc::callAsFunction): no need to mention PointerHash
13864         * kjs/collector.cpp: ditto
13865         * kjs/identifier.cpp:
13866         (KXMLCore::): declare DefaultHash the new way
13867         * kjs/internal.cpp: no need to mention PointerHash
13868         * kjs/ustring.h:
13869         * kxmlcore/HashCountedSet.h: change how we get the default hash to make it
13870         easier to specialize on PtrHash
13871         * kxmlcore/HashFunctions.h:
13872         (KXMLCore::): renamed PointerHash to PtrHash; changed DefaultHash so that it has
13873         a Hash typedef rather than being a hash function class itself; declared DefaultHash
13874         for int and partializy specialized for pointer types
13875         * kxmlcore/HashMapPtrSpec.h:
13876         (KXMLCore::PtrHashIteratorAdapter::PtrHashIteratorAdapter): Slight tweaks for new
13877         way of handling pointer hash
13878         (KXMLCore::PtrHashConstIteratorAdapter::PtrHashConstIteratorAdapter): ditto
13879         (KXMLCore::): ditto
13880         * kxmlcore/HashMap.h: ditto
13881         * kxmlcore/HashSet.h: ditto
13882
13883 2006-01-23  Maciej Stachowiak  <mjs@apple.com>
13884
13885         Reviewed by Tim Omernick.
13886         
13887         - use classes instead of free functions for extractors, this better matches how other
13888         things work and should avoid the need for hacky workarounds on other compilers
13889         http://bugs.webkit.org/show_bug.cgi?id=6748
13890
13891         * kjs/array_object.cpp:
13892         * kjs/identifier.cpp:
13893         * kjs/internal.cpp:
13894         * kxmlcore/HashMap.h:
13895         (KXMLCore::PairFirstExtractor::extract):
13896         * kxmlcore/HashMapPtrSpec.h:
13897         (KXMLCore::):
13898         * kxmlcore/HashSet.h:
13899         (KXMLCore::IdentityExtractor::extract):
13900         * kxmlcore/HashTable.h:
13901         (KXMLCore::addIterator):
13902         (KXMLCore::removeIterator):
13903         (KXMLCore::HashTable::add):
13904         (KXMLCore::HashTable::isEmptyBucket):
13905         (KXMLCore::HashTable::isDeletedBucket):
13906         (KXMLCore::HashTable::HashTable):
13907         (KXMLCore::HashTable::lookup):
13908         (KXMLCore::HashTable::add):
13909         (KXMLCore::HashTable::reinsert):
13910         (KXMLCore::HashTable::find):
13911         (KXMLCore::HashTable::contains):
13912         (KXMLCore::HashTable::remove):
13913         (KXMLCore::HashTable::allocateTable):
13914         (KXMLCore::HashTable::deallocateTable):
13915         (KXMLCore::HashTable::expand):
13916         (KXMLCore::HashTable::rehash):
13917         (KXMLCore::HashTable::clear):
13918         (KXMLCore::HashTable::swap):
13919         (KXMLCore::HashTable::operator):
13920         (KXMLCore::HashTable::checkTableConsistency):
13921         (KXMLCore::HashTable::checkTableConsistencyExceptSize):
13922         (KXMLCore::HashTable::invalidateIterators):
13923
13924 2006-01-23  Maciej Stachowiak  <mjs@apple.com>
13925
13926         Rubber stamped by Tim Hatcher.
13927         
13928         - renamed inert() operation on HashSet, HashCountedSet and HashTable to add()
13929         for consistency with HashMap
13930
13931         * kjs/array_object.cpp:
13932         (ArrayProtoFunc::callAsFunction):
13933         * kjs/collector.cpp:
13934         (KJS::Collector::protect):
13935         * kjs/identifier.cpp:
13936         (KJS::Identifier::add):
13937         * kxmlcore/HashCountedSet.h:
13938         (KXMLCore::::add):
13939         * kxmlcore/HashMap.h:
13940         (KXMLCore::::inlineAdd):
13941         * kxmlcore/HashSet.h:
13942         (KXMLCore::::add):
13943         * kxmlcore/HashTable.h:
13944         (KXMLCore::HashTable::add):
13945         (KXMLCore::::add):
13946         (KXMLCore::::HashTable):
13947
13948 2006-01-23  Justin Garcia  <justin.garcia@apple.com>
13949
13950         Reviewed by thatcher
13951         
13952         Turned on -O2 for B&I build.
13953
13954         * JavaScriptCore.xcodeproj/project.pbxproj:
13955
13956 2006-01-23  Maciej Stachowiak  <mjs@apple.com>
13957
13958         Reviewed by Tim Hatcher.
13959         
13960         - it's "Franklin Street", not "Franklin Steet"
13961
13962         * kjs/array_instance.h:
13963         * kjs/array_object.cpp:
13964         * kjs/array_object.h:
13965         * kjs/bool_object.cpp:
13966         * kjs/bool_object.h:
13967         * kjs/collector.cpp:
13968         * kjs/collector.h:
13969         * kjs/completion.h:
13970         * kjs/context.h:
13971         * kjs/date_object.cpp:
13972         * kjs/date_object.h:
13973         * kjs/debugger.cpp:
13974         * kjs/debugger.h:
13975         * kjs/dtoa.h:
13976         * kjs/error_object.cpp:
13977         * kjs/error_object.h:
13978         * kjs/function.cpp:
13979         * kjs/function.h:
13980         * kjs/function_object.cpp:
13981         * kjs/function_object.h:
13982         * kjs/grammar.y:
13983         * kjs/identifier.cpp:
13984         * kjs/identifier.h:
13985         * kjs/internal.cpp:
13986         * kjs/internal.h:
13987         * kjs/interpreter.cpp:
13988         * kjs/interpreter.h:
13989         * kjs/lexer.cpp:
13990         * kjs/lexer.h:
13991         * kjs/list.cpp:
13992         * kjs/list.h:
13993         * kjs/lookup.cpp:
13994         * kjs/lookup.h:
13995         * kjs/math_object.cpp:
13996         * kjs/math_object.h:
13997         * kjs/nodes.cpp:
13998         * kjs/nodes.h:
13999         * kjs/nodes2string.cpp:
14000         * kjs/number_object.cpp:
14001         * kjs/number_object.h:
14002         * kjs/object.cpp:
14003         * kjs/object.h:
14004         * kjs/object_object.cpp:
14005         * kjs/object_object.h:
14006         * kjs/operations.cpp:
14007         * kjs/operations.h:
14008         * kjs/property_map.cpp:
14009         * kjs/property_map.h:
14010         * kjs/property_slot.cpp:
14011         * kjs/property_slot.h:
14012         * kjs/reference.cpp:
14013         * kjs/reference.h:
14014         * kjs/reference_list.cpp:
14015         * kjs/reference_list.h:
14016         * kjs/regexp.cpp:
14017         * kjs/regexp.h:
14018         * kjs/regexp_object.cpp:
14019         * kjs/regexp_object.h:
14020         * kjs/scope_chain.cpp:
14021         * kjs/scope_chain.h:
14022         * kjs/simple_number.h:
14023         * kjs/string_object.cpp:
14024         * kjs/string_object.h:
14025         * kjs/testkjs.cpp:
14026         * kjs/types.h:
14027         * kjs/ustring.cpp:
14028         * kjs/ustring.h:
14029         * kjs/value.cpp:
14030         * kjs/value.h:
14031         * kxmlcore/AlwaysInline.h:
14032         * kxmlcore/ListRefPtr.h:
14033         * kxmlcore/PassRefPtr.h:
14034         * kxmlcore/RefPtr.h:
14035
14036 2006-01-23  Darin Adler  <darin@apple.com>
14037
14038         Reviewed by John Sullivan.
14039
14040         - change needed for fix to http://bugs.webkit.org/show_bug.cgi?id=6617
14041           REGRESSION: Crash in cloneChildNodes when clicking element
14042
14043         * kxmlcore/PassRefPtr.h: Fix assignment operator from RefPtr of a different
14044         type by calling get() instead of going directly at m_ptr.
14045         * kxmlcore/RefPtr.h: Ditto.
14046
14047         - other changes
14048
14049         * JavaScriptCore.xcodeproj/project.pbxproj: Xcode decided to change this file.
14050         It's just a resorted list of keys in a dictionary.
14051
14052         * kjs/fpconst.cpp: Wrap this file in #if __APPLE__ since the alternate version
14053         in internal.cpp is in #if !__APPLE__. This file is to give us the "no init
14054         routine" property we want to have on OS X.
14055
14056 2006-01-22  Maciej Stachowiak  <mjs@apple.com>
14057
14058         Reviewed by Darin.
14059
14060         - Set up Page class and invert Frame / WebCoreFrameBridge ownership
14061         http://bugs.webkit.org/show_bug.cgi?id=6577
14062
14063         * kjs/interpreter.h: make globalExec virtual so ScriptInterpreter can 
14064         override it
14065
14066 2006-01-23  George Staikos <staikos@opensource.apple.com>
14067
14068         Reviewed by Maciej and Darin.
14069
14070         * kxmlcore/Assertions.h: This file only works with __APPLE__ right now
14071         * kjs/interpreter.cpp: ditto
14072         * kjs/simple_number.h: Add assert.h and remove from config.h
14073         * kjs/array_object.cpp: Use relative paths for kxmlcore includes
14074         * kjs/testkjs.cpp: Use relative paths for kxmlcore includes
14075
14076 2006-01-23  George Staikos <staikos@opensource.apple.com>
14077
14078         Reviewed by Maciej.
14079
14080         * kjs/config.h: unbreak preprocessor change
14081
14082 2006-01-23  George Staikos <staikos@opensource.apple.com>
14083
14084         Approved by Maciej and Darin.
14085
14086         * kjs/:
14087         * kxmlcore/:
14088              Update FSF address in license to make merging easier
14089
14090 2006-01-22  George Staikos <staikos@opensource.apple.com>
14091
14092         Reviewed by Maciej.
14093
14094         * kjs/collector.cpp: merge major speedup from KDE on Linux
14095                              patch by Maks Orlovich, bug #6145
14096                              Also unify cpu detection
14097         * kjs/config.h: define simpler CPU macros
14098
14099 2006-01-22  George Staikos <staikos@opensource.apple.com>
14100
14101         Reviewed by Maciej.
14102
14103         * kjs/collector.cpp: merge FreeBSD compile fix from KDE
14104                              -> requires build magic for use
14105
14106 2006-01-21  George Staikos <staikos@opensource.apple.com>
14107
14108         Reviewed by Maciej.
14109
14110         * kjs/nodes2string.cpp
14111         * kjs/operations.h
14112         * kjs/debugger.h
14113           Fix pedantic compile with some gcc versions (Merge from KDE)
14114
14115         * kjs/create_hash_table:
14116           Fix build with Perl 5.8.0 (Merge from KDE)
14117
14118 2006-01-18  Darin Adler  <darin@apple.com>
14119
14120         Reviewed by Hyatt.
14121
14122         - hash table fixes needed for my WebCore changes
14123
14124         * kxmlcore/HashTable.h: (KXMLCore::HashTableConstIterator::operator=):
14125         Added a missing return statement.
14126
14127         * kxmlcore/HashTraits.h: Fix traits so they work properly for classes where you
14128         can't instantiate with a 0 by using traits rather than ? : to select the default
14129         emtpy value of hash table keys.
14130
14131         - small cleanup of "runtime" code left over from recent JavaScript crash fix
14132
14133         * bindings/runtime_root.h:
14134         (KJS::Bindings::RootObject::RootObject): No explicit initialization of _imp needed
14135         since it's now a ProtectedPtr.
14136         (KJS::Bindings::RootObject::setRootObjectImp): Remove old code that relied on the
14137         fact that _imp was 0 and replaced with use of ProtectedPtr.
14138         (KJS::Bindings::RootObject::rootObjectImp): Updated since _imp is a ProtectedPtr.
14139
14140 2006-01-17  Darin Adler  <darin@apple.com>
14141
14142         Reviewed by Anders.
14143
14144         - http://bugs.webkit.org/show_bug.cgi?id=6611
14145           add assertions to check correct use of hash table iterators
14146
14147         * kxmlcore/HashTable.h:
14148         (KXMLCore::addIterator): Added. Helper function that adds an iterator to the list
14149         maintained by the specified hash table.
14150         (KXMLCore::removeIterator): Added. Helper function that removes an iterator from
14151         the list maintained by the hash table it's in.
14152         (KXMLCore::HashTableConstIterator::HashTableConstIterator): Added a HashTable
14153         parameter, ignored when not debugging. Call addIterator.
14154         (KXMLCore::HashTableConstIterator::~HashTableConstIterator):
14155         (KXMLCore::HashTableConstIterator::operator=): Call removeIterator.
14156         (KXMLCore::HashTableConstIterator::operator*): Call checkValidity.
14157         (KXMLCore::HashTableConstIterator::operator->): Ditto.
14158         (KXMLCore::HashTableConstIterator::operator++): Ditto.
14159         (KXMLCore::HashTableConstIterator::operator==): Ditto.
14160         (KXMLCore::HashTableConstIterator::operator!=): Ditto.
14161         (KXMLCore::HashTableConstIterator::checkValidity): Checks that the hash table
14162         pointer is not 0 and if there are two iterators that both point at the same table.
14163         (KXMLCore::HashTableIterator::HashTableIterator): Changed to use the const iterator
14164         as an implementation detail, to avoid having two separate iterator implementations.
14165         (KXMLCore::HashTableIterator::operator*): Ditto.
14166         (KXMLCore::HashTableIterator::operator->): Ditto.
14167         (KXMLCore::HashTableIterator::operator++): Ditto.
14168         (KXMLCore::HashTableIterator::operator==): Ditto.
14169         (KXMLCore::HashTableIterator::operator!=): Ditto.
14170         (KXMLCore::HashTable::HashTable): Initialize pointer to head of iterators list.
14171         (KXMLCore::HashTable::~HashTable): Added call to invalidateIterators.
14172         (KXMLCore::HashTable::makeIterator): Pass this pointer.
14173         (KXMLCore::HashTable::makeConstIterator): Ditto.
14174         (KXMLCore::HashTable::insert): Call invalidateIterators, since this is a public
14175         entry point that modifies the hash table.
14176         (KXMLCore::HashTable::remove): Ditto.
14177         (KXMLCore::HashTable::clear): Ditto.
14178         (KXMLCore::HashTable::swap): Ditto.
14179         (KXMLCore::HashTable::invalidateIterators): Added. Walks the iterators list and
14180         clears out the table, next, and previous pointers in all of them, and then clears
14181         the head so we have an empty list.
14182         (KXMLCore::addIterator): Added. Adds the iterator the the linked list in the
14183         passed-in table, and points the iterator at the table.
14184         (KXMLCore::removeIterator): Added. Removes the iterator from the linked list in
14185         the passed-in table.
14186
14187         * kxmlcore/HashTraits.h: A bit of tweaking and formatting.
14188
14189 2006-01-17  Justin Garcia  <justin.garcia@apple.com>
14190
14191         Reviewed by eric
14192         
14193         Deployment builds now use -O2
14194
14195         * JavaScriptCore.xcodeproj/project.pbxproj:
14196
14197 2006-01-17  Darin Adler  <darin@apple.com>
14198
14199         Reviewed by Anders.
14200
14201         - fix http://bugs.webkit.org/show_bug.cgi?id=6610
14202           change RefPtr so that it works when deref ends up deleting the RefPtr
14203
14204         * kxmlcore/PassRefPtr.h: Always set m_ptr before calling deref.
14205         * kxmlcore/RefPtr.h: Ditto.
14206
14207 2006-01-16  Geoffrey Garen  <ggaren@apple.com>
14208
14209         Reviewed by darin.
14210
14211         - Fixed http://bugs.webkit.org/show_bug.cgi?id=6322
14212         DateProtoFuncImp::callAsFunction can crash due to lack of type checking
14213
14214         * kjs/date_object.cpp:
14215         (KJS::DateProtoFunc::callAsFunction): Type check calls to all methods. 
14216         This matches section 15.9.5 in the spec.
14217
14218 2006-01-16  Tim Omernick  <timo@apple.com>
14219
14220         Reviewed by John Sullivan.
14221
14222         JavaScriptCore part of <rdar://problem/4211707> NPAPI ref count behavior differs with Mozilla
14223
14224         * bindings/npruntime.cpp:
14225         (_NPN_ReleaseObject):
14226         Refactored part of this function out into _NPN_DeallocateObject.
14227         (_NPN_DeallocateObject):
14228         Forcibly deallocates the passed object, even if its refcount is
14229         greater than zero.
14230         
14231         * bindings/npruntime_impl.h:
14232         Declared _NPN_DeallocateObject().
14233
14234 2006-01-16  Darin Adler  <darin@apple.com>
14235
14236         Reviewed by Maciej.
14237
14238         - fix problem with ++, ==, and != on const iterators in
14239           HashMaps that are using the pointer specialization
14240
14241         * kxmlcore/HashMapPtrSpec.h:
14242         (KXMLCore::PointerHashConstIteratorAdapter::operator++): Change type to const_iterator.
14243         (KXMLCore::PointerHashConstIteratorAdapter::operator==): Ditto.
14244         (KXMLCore::PointerHashConstIteratorAdapter::operator!=): Ditto.
14245
14246 2006-01-15  Alexey Proskuryakov  <ap@nypop.com>
14247
14248         Reviewed by Anders.
14249
14250         - fix http://bugs.webkit.org/show_bug.cgi?id=6561
14251         run-javascriptcore-tests doesn't work
14252
14253         * JavaScriptCore/tests/mozilla/Getopt/Mixed.pm: 
14254         Changed revision number to 1.8 (broken by svn migration).
14255
14256 2006-01-14  David Kilzer  <ddkilzer@kilzer.net>
14257
14258         Reviewed and landed by Anders.
14259
14260         * kjs/create_hash_table: Fixed comment typo.
14261
14262 2006-01-13  Maks Orlovich   <maksim@kde.org>
14263
14264         Mostly merging work by Peter Kelly. Reviewed by Maciej, landed by ap.
14265
14266         - fix http://bugs.webkit.org/show_bug.cgi?id=6261
14267         Misc. array object fixes from KJS
14268
14269         * kjs/array_object.cpp: Don't treat 2^32-1 as a real array index property.
14270         (ArrayInstance::getOwnPropertySlot): Ditto.
14271         (ArrayInstance::deleteProperty): Ditto.
14272         (ArrayInstance::put): Ditto.
14273         (ArrayInstance::propList): Added a FIXME comment.
14274         (ArrayInstance::put): Throw exception on trying to set invalid array length.
14275         (ArrayProtoFunc::callAsFunction): Do not use a separator argument when doing toString/toLocalString.
14276         * kjs/array_object.h: Added MAX_ARRAY_INDEX.
14277
14278 2006-01-13  Darin Adler  <darin@apple.com>
14279
14280         - Replaced tabs with spaces in source files that had less than 10 lines with tabs.
14281         - Set allow-tabs Subversion property in source files that have more than 10 lines with tabs.
14282
14283 2006-01-13  Anders Carlsson  <andersca@mac.com>
14284
14285         Reviewed by Eric.
14286
14287         * kjs/create_hash_table:
14288         Use correct size variables.
14289
14290 2006-01-13  Anders Carlsson  <andersca@mac.com>
14291
14292         Reviewed by Darin.
14293
14294         * kjs/create_hash_table:
14295         Don't create an empty entry array, instead add a entry with all fields
14296         set to null and set the hash table size to 1.
14297         
14298         * kjs/lookup.cpp:
14299         (findEntry):
14300         Remove the hash table size check
14301
14302 2006-01-12  Anders Carlsson  <andersca@mac.com>
14303
14304         Reviewed by Maciej.
14305
14306         - fix http://bugs.webkit.org/show_bug.cgi?id=6494
14307         Crash when assigning a new function to a DOMParser object
14308         
14309         * JavaScriptCore.xcodeproj/project.pbxproj:
14310         Move lookup.cpp before lookup.h
14311         
14312         * kjs/lookup.cpp:
14313         (findEntry):
14314         If the hash table is empty, return 0 early.
14315
14316 2006-01-12  George Staikos <staikos@kde.org>
14317
14318         Reviewed by Darin.
14319
14320         * kjs/interpreter.cpp:
14321         * kjs/testkjs.cpp:
14322         * kjs/interpreter.h:
14323         Add helper to interpreter to call the collector in order to facilitate
14324         visibility rules in KDE.
14325
14326 2006-01-12  George Staikos <staikos@kde.org>
14327
14328         Reviewed by Maciej.
14329
14330         * kjs/kjs.pro: Updates to build the whole thing on Linux at least.
14331
14332         * kxmlcore/HashTable.h: Add missing assert.h
14333
14334 2006-01-12  Darin Adler  <darin@apple.com>
14335
14336         Reviewed by Geoff.
14337
14338         - fix http://bugs.webkit.org/show_bug.cgi?id=6505
14339           retire APPLE_CHANGES from JavaScriptCore
14340
14341         * JavaScriptCore.xcodeproj/project.pbxproj: Removed both
14342         APPLE_CHANGES and HAVE_CONFIG_H from all targets.
14343
14344         * README: Removed. This had obsolete information in it
14345         and it wasn't clear what to replace it with.
14346
14347         * kjs/collector.h: Removed an APPLE_CHANGES if around something
14348         that's not really platform-specific (although it does use a
14349         platform-specific API at the moment).
14350         * kjs/collector.cpp: Removed a mistaken comment.
14351
14352         * kjs/grammar.y:
14353         * kjs/internal.cpp:
14354         * kjs/object.h:
14355         * kjs/operations.cpp:
14356         * kjs/operations.h:
14357         * kjs/ustring.h:
14358         Use __APPLE__ instead of APPLE_CHANGES for code that should be
14359         used only on Mac OS X.
14360
14361         * kjs/interpreter.cpp: Removed APPLE_CHANGES ifdef around the include
14362         of the runtime.h header. Even though that header isn't needed at the
14363         moment on platforms other than Mac OS X, the conditional stuff should
14364         be in the header itself, not in this one client.
14365
14366         * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed some
14367         code inside APPLE_CHANGES. I'm pretty sure this code isn't needed on
14368         any platform where pow is implemented corrrectly according to the IEEE
14369         standard. If it is needed on some, we can add it back with an appropriate
14370         #if for the platforms where it is needed.
14371
14372 2006-01-12  Justin Haygood  <justin@xiondigital.net>
14373
14374         Reviewed, tweaked, and landed by Darin.
14375
14376         - fix http://bugs.webkit.org/show_bug.cgi?id=6416
14377           lexer.cpp, grammar.y protect include of config.h with "HAVE_CONFIG_H"
14378
14379         * kjs/dtoa.cpp: Removed HAVE_CONFIG_H, changed config.h to use
14380         quotes instead of angle brackets. Moved dtoa.h include to the top.
14381         Changed system header includes to use angle brackets instead of quotes.
14382         * kjs/grammar.y: Removed HAVE_CONFIG_H, changed config.h to use
14383         quotes instead of angle brackets.
14384         * kjs/lexer.cpp: Removed HAVE_CONFIG_H, changed config.h to use
14385         quotes instead of angle brackets. Moved lexer.h include to the top.
14386         * kjs/ustring.cpp: Removed HAVE_CONFIG_H, changed config.h to use
14387         quotes instead of angle brackets. Moved ustring.h include to the top.
14388
14389 2006-01-12  George Staikos <staikos@kde.org>
14390
14391         Reviewed by Maciej
14392
14393         - Import initial QMake file.  Doesn't fully work yet.
14394
14395 2006-01-11  Ricci Adams  <ricciadams@apple.com>
14396
14397         Reviewed by Maciej and Darin, landed by Darin.
14398
14399         - fix http://bugs.webkit.org/show_bug.cgi?id=5939
14400           final comma in javascript object prevents parsing
14401
14402         * kjs/grammar.y: Added rule to allow trailing comma in
14403         object construction.
14404
14405 2006-01-11  Ricci Adams  <ricciadams@apple.com>
14406
14407         Reviewed by Geoff, landed by Darin.
14408
14409         - fix http://bugs.webkit.org/show_bug.cgi?id=5308
14410           Number.toFixed doesn't include leading 0
14411
14412         * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
14413         Fixed a "<" that should have been a "<=".
14414
14415 2006-01-11  Ricci Adams  <ricciadams@apple.com>
14416
14417         Reviewed by Geoff, landed by Darin.
14418
14419         - fix http://bugs.webkit.org/show_bug.cgi?id=5307
14420           Number.toFixed doesn't round 0.5 up
14421
14422         * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
14423         Fixed a ">" that should have been a ">=".
14424
14425 2006-01-11  Justin Haygood  <justin@xiondigital.net>
14426
14427         Reviewed and landed by Darin.
14428
14429         - fix http://bugs.webkit.org/show_bug.cgi?id=6486
14430           JavaScriptCore should use system malloc on Windows
14431
14432         * kjs/config.h: Add USE_SYSTEM_MALLOC to the Win32 section.
14433
14434 2006-01-10  Darin Adler  <darin@apple.com>
14435
14436         * Makefile: Took out unneeded "export" line.
14437         * <many-files>: Changed a lot of flags (cleared bogus executable bits, set
14438           MIME types, other small corrections).
14439
14440 2006-01-09  Darin Adler  <darin@apple.com>
14441
14442         * Makefile.am: Removed.
14443
14444 2006-01-07  Anders Carlsson  <andersca@mac.com>
14445
14446         Reviewed by Maciej.
14447         
14448         - fix http://bugs.webkit.org/show_bug.cgi?id=6373
14449         REGRESSION: JavaScript hang when comparing large array to null
14450         
14451         * kjs/object.h:
14452         (KJS::JSObject::isEqualToNull):
14453         Add new function which returns true if an object should be treated as null when
14454         doing comparisons.
14455         
14456         * kjs/operations.cpp:
14457         (KJS::equal):
14458         Use isEqualToNull.
14459
14460 2006-01-07  Alexey Proskuryakov  <ap@nypop.com>
14461
14462         Reviewed by Maciej.
14463
14464         - Fix WebCore development build
14465         http://bugs.webkit.org/show_bug.cgi?id=6408
14466
14467         * kxmlcore/Assertions.h: Use __VA_ARGS__ in variadic macros.
14468
14469 2006-01-06  Maciej Stachowiak  <mjs@apple.com>
14470
14471         Reviewed by Darin.
14472
14473         - miscellaneous changes for 4% speedup on the JavaScript iBench
14474         http://bugs.webkit.org/show_bug.cgi?id=6396
14475         
14476         Changes mostly thanks to Maks Orlovich, tweaked a little by me.
14477
14478         * kjs/create_hash_table: Use the same hash as the one used by Identifier.
14479         * kjs/function.cpp:
14480         (KJS::FunctionImp::processParameters): Use the new List::copyFrom
14481         (KJS::ActivationImp::ActivationImp): track variable while iterating
14482         * kjs/internal.cpp:
14483         (KJS::StringImp::toObject): create StringInstance directly
14484         * kjs/list.cpp:
14485         (KJS::List::copy): implement in terms of copyFrom
14486         (KJS::List::copyFrom): more efficient way to copy in another list
14487         * kjs/list.h:
14488         * kjs/lookup.cpp:
14489         (keysMatch): updated to work with identifier hash
14490         (findEntry): ditto
14491         (Lookup::findEntry): ditto
14492         (Lookup::find): ditto
14493         * kjs/lookup.h:
14494
14495 2006-01-06  Maciej Stachowiak  <mjs@apple.com>
14496
14497         - fix development build failure from the previous checkin
14498
14499         * kjs/function.cpp:
14500         (KJS::ActivationImp::put): Use prototype() accessor in assert.
14501
14502 2006-01-05  Maciej Stachowiak  <mjs@apple.com>
14503
14504         Reviewed by Eric.
14505
14506         - fix remaining performance regression from Getter/Setter change
14507         http://bugs.webkit.org/show_bug.cgi?id=6249
14508
14509         - Activation objects should not have __proto__ property
14510         http://bugs.webkit.org/show_bug.cgi?id=6395
14511
14512         * kjs/function.cpp:
14513         (KJS::ActivationImp::getOwnPropertySlot): Implement directly, thus
14514         skipping getter/setter handling and __proto__ handling, as well
14515         as inlining needed superclass stuff.
14516         (KJS::ActivationImp::put): Implement directly, skipping getter/setter,
14517         __proto__, and do canPut directly in PropertyMap::put since there's no
14518         static property table either.
14519         * kjs/function.h:
14520         * kjs/property_map.cpp:
14521         (KJS::PropertyMap::put): Allow optionally inlining canPut check.
14522         * kjs/property_map.h:
14523
14524 2006-01-04  Geoffrey Garen  <ggaren@apple.com>
14525
14526         Patch by kimmo.t.kinnunen@nokia.com, reviewed by darin, tweaked by me.
14527
14528         - Fixed http://bugs.webkit.org/show_bug.cgi?id=4921
14529         \u escape sequences in JavaScript identifiers
14530
14531         * kjs/function_object.cpp:
14532         (FunctionObjectImp::construct):
14533         * kjs/lexer.cpp:
14534         (Lexer::shift):
14535         (Lexer::lex):
14536         (Lexer::isWhiteSpace):
14537         (Lexer::isLineTerminator):
14538         (Lexer::isIdentStart):
14539         (Lexer::isIdentPart):
14540         (isDecimalDigit):
14541         (Lexer::scanRegExp):
14542         * kjs/lexer.h:
14543         (KJS::Lexer::):
14544
14545         * tests/mozilla/expected.html: Updated test results.
14546
14547 2005-12-30  Maciej Stachowiak  <mjs@apple.com>
14548
14549         No review, just test result update.
14550
14551         * tests/mozilla/expected.html: Updated for newly passing test from recent fixes.
14552
14553 2005-12-30  Anders Carlsson  <andersca@mac.com>
14554
14555         Reviewed by Maciej.
14556
14557         - Fix http://bugs.webkit.org/show_bug.cgi?id=6298
14558         Getter setter test is failing
14559                 
14560         * kjs/object.cpp:
14561         (KJS::JSObject::put):
14562         Rework the getter setter part. We now walk the prototype chain, checking for
14563         getter/setter properties and only take the slow path if any are found. 
14564
14565 2005-12-30  Maks Orlovich <maksim@kde.org>
14566
14567         Reviewed and committed by Maciej.
14568
14569         - Handle negative, FP numbers with non-10 radix in toString
14570         http://bugs.webkit.org/show_bug.cgi?id=6259
14571
14572         (Merged from KJS, original work by Harri Porten)
14573         
14574         * kjs/number_object.cpp:
14575         (NumberProtoFunc::callAsFunction): rewrote Number.toString(radix) to work with  
14576         negative numbers, floating point and very large numbers.
14577
14578 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
14579
14580         Patch by Maks Orlovich, reviewed and landed by me.
14581
14582         - http://bugs.webkit.org/show_bug.cgi?id=6267
14583         Fix Number.prototype.toFixed/toExponential(undefined)
14584
14585         * kjs/number_object.cpp:
14586         (NumberProtoFunc::callAsFunction):
14587
14588 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
14589
14590         Patch by Maks Orlovich, Reviewed and landed by me.
14591
14592         - http://bugs.webkit.org/show_bug.cgi?id=6266
14593         Minor object naming updates (to match Mozilla, KJS)
14594
14595         * kjs/number_object.cpp:
14596         * kjs/regexp_object.cpp:
14597
14598 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
14599
14600         Patch by Maks Orlovich, reviewed by mjs.
14601
14602         This has 2 very minor fixes, covered by KJS testsuite:    
14603         1. Enumerates string indices in property list (with the same bug as array    
14604            object has in corresponding code). This is a mozilla emulation thing. 
14605         2. Permits properties with integer names in prototypes to be found    
14606
14607         * kjs/string_object.cpp:
14608         (StringInstance::getOwnPropertySlot):
14609         (StringInstanceImp::propList):
14610         * kjs/string_object.h:
14611
14612 2005-12-26  Geoffrey Garen  <ggaren@apple.com>
14613
14614         Reviewed by mjs.
14615
14616         - Fixed <rdar://problem/4364705> run-javascriptcore-tests crashes in 
14617         KJS::BlockNode::deref 
14618         AKA 
14619         http://bugs.webkit.org/show_bug.cgi?id=6233
14620         Reproducible stack-overflow crash in ~RefPtr<T> due to RefPtr<T> use in 
14621         linked lists
14622
14623         This patch does four things: 
14624         (1) Standardizes all our linked list nodes to use "next" as their next 
14625         pointers. 
14626         (2) Creates the ListRefPtr<T> class, a subclass of RefPtr<T> specialized
14627         to iteratively deref "next" pointers.
14628         (3) Standardizes our linked list nodes to use ListRefPtr<T> and 
14629         implement the releaseNext() function used by ~ListRefPtr<T>().
14630         (4) Adds to RefPtr<T> the release() method used by releaseNext().
14631
14632         - Modified existing mozilla test to ensure it would make deployment 
14633         builds crash as well.
14634
14635         * JavaScriptCore.xcodeproj/project.pbxproj:
14636         * kjs/nodes.cpp:
14637         (ElementNode::evaluate):
14638         (PropertyListNode::evaluate):
14639         (ArgumentListNode::evaluateList):
14640         (StatListNode::StatListNode):
14641         (StatListNode::execute):
14642         (StatListNode::processVarDecls):
14643         (VarDeclListNode::evaluate):
14644         (VarDeclListNode::processVarDecls):
14645         (VarStatementNode::execute):
14646         (VarStatementNode::processVarDecls):
14647         (BlockNode::BlockNode):
14648         (CaseClauseNode::evalStatements):
14649         (CaseClauseNode::processVarDecls):
14650         (ClauseListNode::processVarDecls):
14651         (CaseBlockNode::CaseBlockNode):
14652         (CaseBlockNode::evalBlock):
14653         (SourceElementsNode::SourceElementsNode):
14654         (SourceElementsNode::execute):
14655         (SourceElementsNode::processFuncDecl):
14656         (SourceElementsNode::processVarDecls):
14657         * kjs/nodes.h:
14658         (KJS::ElementNode::ElementNode):
14659         (KJS::ElementNode::releaseNext):
14660         (KJS::ArrayNode::ArrayNode):
14661         (KJS::PropertyListNode::PropertyListNode):
14662         (KJS::PropertyListNode::releaseNext):
14663         (KJS::ObjectLiteralNode::ObjectLiteralNode):
14664         (KJS::ArgumentListNode::ArgumentListNode):
14665         (KJS::ArgumentListNode::releaseNext):
14666         (KJS::ArgumentsNode::ArgumentsNode):
14667         (KJS::StatListNode::releaseNext):
14668         (KJS::VarDeclListNode::VarDeclListNode):
14669         (KJS::VarDeclListNode::releaseNext):
14670         (KJS::VarStatementNode::VarStatementNode):
14671         (KJS::ForNode::ForNode):
14672         (KJS::CaseClauseNode::CaseClauseNode):
14673         (KJS::ClauseListNode::ClauseListNode):
14674         (KJS::ClauseListNode::getClause):
14675         (KJS::ClauseListNode::getNext):
14676         (KJS::ClauseListNode::releaseNext):
14677         (KJS::ParameterNode::ParameterNode):
14678         (KJS::ParameterNode::releaseNext):
14679         (KJS::SourceElementsNode::releaseNext):
14680         * kjs/nodes2string.cpp:
14681         (ElementNode::streamTo):
14682         (PropertyListNode::streamTo):
14683         (ArgumentListNode::streamTo):
14684         (StatListNode::streamTo):
14685         (VarDeclListNode::streamTo):
14686         (VarStatementNode::streamTo):
14687         (CaseClauseNode::streamTo):
14688         (ClauseListNode::streamTo):
14689         (CaseBlockNode::streamTo):
14690         (SourceElementsNode::streamTo):
14691         * kxmlcore/ListRefPtr.h: Added.
14692         (KXMLCore::ListRefPtr::ListRefPtr):
14693         (KXMLCore::ListRefPtr::~ListRefPtr):
14694         (KXMLCore::ListRefPtr::operator=):
14695         * kxmlcore/RefPtr.h:
14696         (KXMLCore::RefPtr::release):
14697
14698 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
14699
14700         Reviewed by mjs.
14701
14702         - Fixed http://bugs.webkit.org/show_bug.cgi?id=4026
14703         Math.random() not seeded.
14704
14705         Added call to sranddev() -- it executes the first time a process
14706         calls Math.random().
14707
14708         * kjs/math_object.cpp:
14709         (MathFuncImp::callAsFunction):
14710
14711 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
14712
14713         Reviewed by darin.
14714
14715         - Fixed http://bugs.webkit.org/show_bug.cgi?id=6265
14716         Name change regression: Java doesn't know what JavaJSObject is
14717
14718         Changed strings passed to Java back to original "JSObject".
14719
14720         * bindings/jni/jni_jsobject.cpp:
14721         (JavaJSObject::convertValueToJObject):
14722         (JavaJSObject::convertJObjectToValue):
14723
14724 2005-12-28  Anders Carlsson  <andersca@mac.com>
14725
14726         Reviewed by Maciej.
14727
14728         - The JSC part of http://bugs.webkit.org/show_bug.cgi?id=6268
14729         Add undetectable document.all
14730         
14731         * kjs/operations.cpp:
14732         (KJS::equal):
14733         When comparing an object with null or undefined, call toPrimitive with 
14734         NullType as the preferred type.
14735
14736 2005-12-27  Anders Carlsson  <andersca@mac.com>
14737
14738         Reviewed by Darin.
14739
14740         * kjs/array_object.cpp:
14741         (ArrayProtoFunc::callAsFunction):
14742         Implement filter and map. Also, make the existing
14743         array iteration functions not invoke the callback for
14744         non-existing properties, just as Mozilla does now.
14745         
14746         * kjs/array_object.h:
14747         (KJS::ArrayProtoFunc::):
14748         Add filter and map.
14749         
14750         * tests/mozilla/expected.html:
14751         Update, two 1.6 tests now pass.
14752
14753 2005-12-27  Maciej Stachowiak  <mjs@apple.com>
14754
14755         - updated test results for new JS 1.6 tests
14756
14757         * tests/mozilla/expected.html:
14758
14759 2005-12-27  Anders Carlsson  <andersca@mac.com>
14760
14761         Reviewed by Maciej.
14762
14763         Add Mozilla JS 1.6 tests.
14764         
14765         * tests/mozilla/js1_6/Array/browser.js: Added.
14766         * tests/mozilla/js1_6/Array/regress-290592.js: Added.
14767         * tests/mozilla/js1_6/Array/regress-304828.js: Added.
14768         * tests/mozilla/js1_6/Array/regress-305002.js: Added.
14769         * tests/mozilla/js1_6/Array/regress-310425-01.js: Added.
14770         * tests/mozilla/js1_6/Array/regress-310425-02.js: Added.
14771         * tests/mozilla/js1_6/Array/regress-320887.js: Added.
14772         * tests/mozilla/js1_6/Array/shell.js: Added.
14773         * tests/mozilla/js1_6/README: Added.
14774         * tests/mozilla/js1_6/Regress/browser.js: Added.
14775         * tests/mozilla/js1_6/Regress/regress-301574.js: Added.
14776         * tests/mozilla/js1_6/Regress/regress-309242.js: Added.
14777         * tests/mozilla/js1_6/Regress/regress-311157-01.js: Added.
14778         * tests/mozilla/js1_6/Regress/regress-311157-02.js: Added.
14779         * tests/mozilla/js1_6/Regress/regress-314887.js: Added.
14780         * tests/mozilla/js1_6/Regress/regress-320172.js: Added.
14781         * tests/mozilla/js1_6/Regress/shell.js: Added.
14782         * tests/mozilla/js1_6/String/browser.js: Added.
14783         * tests/mozilla/js1_6/String/regress-306591.js: Added.
14784         * tests/mozilla/js1_6/String/shell.js: Added.
14785         * tests/mozilla/js1_6/browser.js: Added.
14786         * tests/mozilla/js1_6/shell.js: Added.
14787         * tests/mozilla/js1_6/template.js: Added.
14788
14789 2005-12-27  Maks Orlovich <maksim@kde.org>
14790
14791         Reviewed and landed by Maciej.
14792
14793         - fixed 6234: Can delete array index property incorrectly.
14794         http://bugs.webkit.org/show_bug.cgi?id=6234
14795
14796         * kjs/array_object.cpp:
14797         (ArrayInstance::deleteProperty): use toArrayIndex instead of toUInt32 when
14798         looking for array properties.
14799
14800 2005-12-27  Anders Carlsson  <andersca@mac.com>
14801
14802         Reviewed by Maciej.
14803
14804         * kjs/object.cpp:
14805         (KJS::JSObject::defineSetter):
14806         Remove duplicate call to putDirect.
14807
14808 2005-12-26  Maciej Stachowiak  <mjs@apple.com>
14809
14810         Reviewed by Darin and Geoff.
14811
14812         Changes by me and Anders.
14813
14814         - mostly fixed REGRESSION: 5-10% performance regression on JS iBench from getter/setter change
14815         http://bugs.webkit.org/show_bug.cgi?id=6083
14816
14817         - also fixed some warnings reported by -Winline
14818         
14819         * JavaScriptCorePrefix.h: Move new and delete definitions higher so there
14820         aren't conflicts with use in standard C++ headers
14821         * kjs/object.cpp:
14822         (KJS::throwSetterError): Moved this piece of put into a seprate function
14823         to avoid the PIC branch.
14824         (KJS::JSObject::put): Use hasGetterSetterProperties to avoid expensive stuff
14825         when not needed. Also use GetterSetter properties attribute.
14826         (KJS::JSObject::deleteProperty): Recompute whether any properties are getter/setter
14827         properties any more, if this one was one.
14828         (KJS::JSObject::defineGetter): Let the PropertyMap know that it has getter/setter
14829         properties now (and use the new attribute).
14830         (KJS::JSObject::defineSetter): Ditto.
14831         (KJS::JSObject::fillGetterPropertySlot): Out-of-line helper for getOwnPropertySlot,
14832         to avoid global variable access in the hot code path.
14833         * kjs/object.h:
14834         (KJS::): Added GetterSetter attribute.
14835         (KJS::JSCell::isObject): Moved lower to be after inline methods it uses.
14836         (KJS::JSValue::isObject): ditto
14837         (KJS::JSObject::getOwnPropertySlot): try to avoid impact of getters and setters
14838         as much as possible in the case where they are not being used
14839         * kjs/property_map.cpp:
14840         (KJS::PropertyMap::containsGettersOrSetters): New method to help with this
14841         * kjs/property_map.h:
14842         (KJS::PropertyMap::hasGetterSetterProperties): Ditto
14843         (KJS::PropertyMap::setHasGetterSetterProperties): Ditto
14844         (KJS::PropertyMap::PropertyMap): Added a crazy hack to store the
14845         global "has getter/setter properties" flag in the property map
14846         single entry, to avoid making objects any bigger.
14847         * kjs/value.h: Moved some things to object.h to make -Winline happier
14848
14849 2005-12-24  Maciej Stachowiak  <mjs@apple.com>
14850
14851         Reviewed by Eric and Dave Hyatt.
14852
14853         - make even const PassRefPtrs give transfer of ownership semantics
14854         http://bugs.webkit.org/show_bug.cgi?id=6238
14855         
14856         This is a somewhat cheesy change. Having to use PassRefPtr_Ref creates ambiguities
14857         in assignment and copy construction. And this makes life way easier and removes
14858         the need for pass(). It is not really correct, but we pretty much never need a real
14859         const PassRefPtr, and this takes care of things for PassRefPtr temporaries.
14860         
14861         * kjs/identifier.cpp:
14862         (KJS::Identifier::add): No more need for pass()
14863         * kjs/property_map.cpp:
14864         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): No more need for pass()
14865         * kjs/ustring.cpp:
14866         (KJS::UString::Rep::create): Use adoptRef
14867         (KJS::UString::UString): No more need for pass
14868         (KJS::UString::append): No more need for pass
14869         (KJS::UString::substr): No more need for pass
14870         * kxmlcore/PassRefPtr.h: made m_ptr mutable (ugh)
14871         (KXMLCore::PassRefPtr::PassRefPtr): Take a const PassRefPtr reference
14872         (KXMLCore::PassRefPtr::release): Made this a const method (ugh)
14873         (KXMLCore::PassRefPtr::operator=): clean up appropriately
14874         (KXMLCore::adoptRef): Added this to use instead of PassRefPtr<T>::adopt, I think
14875         it makes the behavior more clear and it is less verbose.
14876         (KXMLCore::static_pointer_cast): use adoptRef
14877         (KXMLCore::const_pointer_cast): use adoptRef
14878         * kxmlcore/RefPtr.h:
14879         (KXMLCore::RefPtr::RefPtr): take const PassRefPtr&
14880         (KXMLCore::PassRefPtr::operator=): take const PassRefPtr&
14881
14882 2005-12-25  Eric Seidel  <eseidel@apple.com>
14883
14884         Reviewed by mjs.
14885
14886         Unbreak HashTableConstIterator++ by returning const_iterator
14887
14888         * kxmlcore/HashTable.h:
14889         (KXMLCore::HashTableConstIterator::operator++): use const_iterator
14890
14891 2005-12-25  Eric Seidel  <eseidel@apple.com>
14892
14893         Reviewed by mjs.
14894
14895         Un-break HashTable copy constructor.
14896
14897         * kxmlcore/HashTable.h:
14898         (KXMLCore::::HashTable): use const_iterator instead
14899
14900 2005-12-23  Maciej Stachowiak  <mjs@apple.com>
14901
14902         Reviewed by Eric.
14903
14904         - fixed "HashMap does not work with const pointer keys or values"
14905         http://bugs.webkit.org/show_bug.cgi?id=6222
14906         
14907         * kxmlcore/HashMapPtrSpec.h:
14908         (KXMLCore::HashMap): In all methods, explicitly cast all pointers
14909         to void * before passing to internal implementation. Use C-style
14910         casts instead of new-style casts, because the real solution would
14911         require a combo of reinterpret_cast anc const_cast.
14912
14913
14914 2005-12-23  Maciej Stachowiak  <mjs@apple.com>
14915
14916         - this time for sure
14917
14918         * kxmlcore/RefPtr.h:
14919         (KXMLCore::::swap):
14920
14921 2005-12-22  Maciej Stachowiak  <mjs@apple.com>
14922
14923         - fix build problem from last commit.
14924
14925         * kxmlcore/RefPtr.h:
14926         (KXMLCore::::swap):
14927
14928 2005-12-21  Maciej Stachowiak  <mjs@apple.com>
14929
14930         Reviewed by Darin.
14931
14932         - Make HashMap/HashSet support non-POD types
14933         http://bugs.webkit.org/show_bug.cgi?id=5332
14934
14935         The changes for support are relatively simple, but I also made extensive changes to
14936         avoid copying, so that there isn't refcount thrash when you put RefPtrs into a HashMap.
14937
14938         * kxmlcore/HashTable.h:
14939         (KXMLCore::swap): specialize swap for pairs, to swap elements individually,
14940         so that excess copies can be avoided.
14941         (KXMLCore::Mover::move): Template function to either copy or swap, used
14942         when transferring elements from old table to new.
14943         (KXMLCore::IdentityHashTranslator::hash): The old "converting lookup" templates
14944         that took two or three function parameters now take a class parameter, this is
14945         the class used to do a normal lookup.
14946         (KXMLCore::IdentityHashTranslator::equal): Ditto.
14947         (KXMLCore::IdentityHashTranslator::translate): Ditto. Translate now takes a reference
14948         to write into instead of returning a value to avoid redundant copies.
14949         (KXMLCore::HashTable::~HashTable): Use deallocateTable instead of freeing directly.
14950         (KXMLCore::HashTable::insert): Based on HashTranslator now instead of separate
14951         functions. Added a FIXME about a remaining rare excess copy.
14952         (KXMLCore::HashTable::isEmptyBucket): Use KeyTraits directly instead of unwrapping
14953         the key from Traits, to avoid creating and destroying pair, which copies.
14954         (KXMLCore::HashTable::isDeletedBucket): ditto
14955         (KXMLCore::HashTable::lookup): Use HashTranslator now instead of separate functions.
14956         (KXMLCore::HashTable::initializeBucket): Renamed from emptyBucket. Use placement new to
14957         work right for non-POD types.
14958         (KXMLCore::HashTable::deleteBucket): Use assignDeleted to avoid excess copies.
14959         (KXMLCore::HashTable::reinsert): use Mover template to copy or swap as appropriate
14960         (KXMLCore::HashTable::allocateTable): Initialize every bucket if calloc won't do.
14961         (KXMLCore::HashTable::deallocateTable): Destruct every bucket if needed.
14962         (KXMLCore::HashTable::rehash): Avoid copy before reinserting, so that swap can do its magic.
14963         (KXMLCore::HashTable::clear): use deallocateTable instead of freeing directly.
14964         (KXMLCore::HashTable::HashTable): be more dumb when copying to ensure that non-POD types
14965         work right
14966         * kxmlcore/HashFunctions.h:
14967         (KXMLCore::PointerHash): Specialize PointerHash for RefPtr
14968         * kxmlcore/HashMap.h:
14969         (KXMLCore::extractFirst): Return a reference not a full object to avoid
14970         copies.
14971         (KXMLCore::HashMapTranslator::hash): Use a special translator for insertion
14972         to defer making the pair as long as possible, thus avoiding needless copies.
14973         (KXMLCore::HashMapTranslator::equal): ditto
14974         (KXMLCore::HashMapTranslator::translate): ditto
14975         (KXMLCore::::inlineAdd): Shared by set and add to insert using HashMapTranslator
14976         (KXMLCore::::set): Use inlineAdd
14977         (KXMLCore::::add): Use inlineAdd
14978         * kxmlcore/HashMapPtrSpec.h:
14979         (KXMLCore::): Pass KeyTraits along
14980         * kxmlcore/HashSet.h:
14981         (KXMLCore::identityExtract): Return a reference not a full object to avoid copies.
14982         (KXMLCore::HashSetTranslatorAdapter::hash): Redo adapter stuff to work with
14983         the new HashTranslator approach.
14984         (KXMLCore::HashSetTranslatorAdapter::equal): ditto
14985         (KXMLCore::HashSetTranslatorAdapter::translate): ditto
14986         (KXMLCore::::insert): ditto
14987         * kxmlcore/HashTraits.h:
14988         (KXMLCore::GenericHashTraits): This is intended be used as a base class for
14989         customized traits: sensible defaults.
14990         (KXMLCore::): Use it a bunch
14991         (KXMLCore::assignDeleted): template function to allow pairs to be assigned the
14992         deleted value w/o excess copies.
14993         (KXMLCore::PairHashTraits::emptyValue): Updated
14994         (KXMLCore::PairHashTraits::deletedValue): Updated
14995         (KXMLCore::PairHashTraits::assignDeletedValue): part of assignDeleted hack
14996         (KXMLCore::DeletedValueAssigner::assignDeletedValue): Use template magic
14997         to either use use deletedValue or assignDeletedValue for the cases where we care.
14998         * kxmlcore/RefPtr.h:
14999         (KXMLCore::RefPtr::swap): Added swap method.
15000         (KXMLCore::swap): Added swap free function.
15001         * kjs/identifier.cpp:
15002         (KJS::CStringTranslator::hash): Use new HashTranslator class approach to
15003         alternate type based insertion.
15004         (KJS::CStringTranslator::equal): ditto
15005         (KJS::CStringTranslator::translate): ditto
15006         (KJS::Identifier::add): ditto
15007         (KJS::UCharBufferTranslator::hash): ditto
15008         (KJS::UCharBufferTranslator::equal): ditto
15009         (KJS::UCharBufferTranslator::translate): ditto
15010
15011         - irrelevant change:
15012         
15013         * kjs/array_object.cpp:
15014         (ArrayProtoFunc::callAsFunction): Removed a stray space.
15015
15016 2005-12-22  Anders Carlsson  <andersca@mac.com>
15017
15018         Reviewed by Eric and Darin.
15019
15020         - fix http://bugs.webkit.org/show_bug.cgi?id=6196
15021         Would like to be able to define prototypes in headers
15022         
15023         * kjs/lookup.h:
15024         Move ClassName from KJS_DECLARE_PROTOTYPE to KJS_IMPLEMENT_PROTOTYPE.
15025         Also, namespace all macros by prefixing them with KJS_. 
15026
15027 2005-12-22  Darin Adler  <darin@apple.com>
15028
15029         Reviewed by Maciej.
15030
15031         - fix http://bugs.webkit.org/show_bug.cgi?id=6191
15032           RefPtr/PassRefPtr have a leak issue, operator== issues
15033
15034         * kxmlcore/PassRefPtr.h:
15035         (KXMLCore::PassRefPtr::PassRefPtr): Remove non-template constructor that takes RefPtr
15036         since the constructor template that takes RefPtr should be sufficient. Add a constructor
15037         template that takes PassRefPtr&.
15038         (KXMLCore::PassRefPtr::adopt): Use PassRefPtr_Ref to avoid setting pointer first to
15039         0 and then to the pointer.
15040         (KXMLCore::PassRefPtr::operator=): Added template versions that take PassRefPtr& and
15041         RefPtr parameters.
15042         (KXMLCore::PassRefPtr::operator PassRefPtr<U>): Changed to fix leak -- old version
15043         would release and then ref.
15044         (KXMLCore::operator==): Make templates have two parameters so you can mix types.
15045         Also remove unneeded const in raw pointer versions.
15046         (KXMLCore::operator!=): Ditto.
15047
15048         * kxmlcore/RefPtr.h:
15049         (KXMLCore::RefPtr::RefPtr): Add constructor template that takes PassRefPtr.
15050         (KXMLCore::RefPtr::operator=): Add assignment operator templates that take
15051         RefPtr and PassRefPtr.
15052         (KXMLCore::operator==): Make templates have two parameters so you can mix types.
15053         Also remove unneeded const in raw pointer versions.
15054         (KXMLCore::operator!=): Ditto.
15055
15056 2005-12-21  Timothy Hatcher  <timothy@apple.com>
15057
15058         * JavaScriptCore.xcodeproj/project.pbxproj:
15059           Set tab width to 8, indent width to 4 and uses tabs to false per file.
15060
15061 2005-12-21  Geoffrey Garen  <ggaren@apple.com>
15062
15063         Reviewed by Darin.
15064
15065         Removed evil hack for determining if a type is an integer, replaced
15066         with template metaprogramming.
15067
15068         * JavaScriptCore.xcodeproj/project.pbxproj: Set tab size to 2 for
15069         testkjs.cpp
15070         * kjs/testkjs.cpp:
15071         (main): Inserted asserts to test IsInteger. FIXME: Move these to
15072         KXMLCore unit tests directory when we create one.
15073         * kxmlcore/HashTraits.h:
15074         (KXMLCore::): Added IsInteger class for querying types.
15075
15076 2005-12-20  Maciej Stachowiak  <mjs@apple.com>
15077
15078         Reviewed by Darin.
15079
15080         - made ALWAYS_INLINE declare things inline as well as __attribute__((always_inline))
15081         http://bugs.webkit.org/show_bug.cgi?id=6159
15082
15083         * kxmlcore/AlwaysInline.h:
15084
15085 2005-12-19  Maciej Stachowiak  <mjs@apple.com>
15086
15087         Reviewed by Darin.
15088
15089         - fixed a leak in the assignment operator from PassRefPtr to RefPtr
15090         http://bugs.webkit.org/show_bug.cgi?id=6158
15091
15092         * kxmlcore/RefPtr.h:
15093         (KXMLCore::RefPtr::operator=):
15094
15095         - fix problem with PassRefPtr that darin spotted - it lacked a copy constructor
15096         and therefore was using the default one, which can lead to excess derefs
15097
15098         I fixed this by adding a copy constructor from non-const
15099         reference, and by adding a template pass() function that you have
15100         to use when raw pointer or RefPtr are passed where PassRefPtr is
15101         expected.
15102
15103         * kjs/identifier.cpp:
15104         (KJS::Identifier::add): Changed to have PassRefPtr return type and
15105         pass() the results.
15106         * kjs/identifier.h:
15107         * kjs/property_map.cpp:
15108         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): Use pass()
15109         where required.
15110         * kjs/ustring.cpp:
15111         (KJS::UString::UString): Use pass() as needed.
15112         (KJS::UString::append): ditto
15113         (KJS::UString::substr): ditto
15114         * kjs/ustring.h:
15115         (KJS::UString::UString): Use initializer instead of assignment
15116         * kxmlcore/PassRefPtr.h:
15117         (KXMLCore::PassRefPtr::PassRefPtr): Added copy constructor
15118         (KXMLCore::pass): new template function to make it convenient to pass
15119         a PassRefPtr
15120
15121 2005-12-19  Geoffrey Garen  <ggaren@apple.com>
15122   
15123         Reviewed by Maciej.
15124
15125         Fixed <rdar://problem/4370397> Missing return statement in
15126         JSMethodNameToObjcMethodName.
15127
15128         JSMethodNameToObjcMethodName had a check for a name being too long, but
15129         the check was missing a return statement.
15130
15131         A lot of this code was confusing and some of it was wrong, so I fixed
15132         it up, added some asserts to catch this type of bug in the future, 
15133         changed some comments, and renamed some variables.
15134
15135         The two advantages of the new algorithm are (1) It makes writing past
15136         the end of the buffer virtually impossible because the test on the main
15137         loop is "while (not past end of buffer)" and (2) It's twice as fast
15138         because it doesn't call strlen. (There's no need to call strlen when
15139         we're walking the string ourselves.) 
15140         
15141         methodsNamed also supports arbitrary-length method names now. Just in 
15142         case the AppKit folks start getting REALLY verbose...
15143
15144         * bindings/objc/objc_class.mm:
15145         (KJS::Bindings::ObjcClass::methodsNamed):
15146         * bindings/objc/objc_utility.h:
15147         * bindings/objc/objc_utility.mm:
15148         (KJS::Bindings::JSMethodNameToObjcMethodName):
15149
15150 2005-12-19  Darin Adler  <darin@apple.com>
15151
15152         Originally done by both George Staikos and Alexey Proskuryakov.
15153
15154         - fix http://bugs.webkit.org/show_bug.cgi?id=5706
15155           Sharedptr dependency can be removed
15156
15157         Our coding guidelines say "use 0 instead of NULL" and both RefPtr and
15158         PassRefPtr were using NULL, which required including a header that
15159         defines NULL.
15160
15161         * kxmlcore/PassRefPtr.h:
15162         (KXMLCore::PassRefPtr::PassRefPtr): Use 0 instead of NULL.
15163         (KXMLCore::PassRefPtr::operator!): Use ! instead of == NULL.
15164         * kxmlcore/RefPtr.h:
15165         (KXMLCore::RefPtr::RefPtr): Use 0 instead of NULL.
15166         (KXMLCore::RefPtr::operator!): Use ! instead of == NULL.
15167         Also did some reformatting.
15168
15169 2005-12-19  Darin Adler  <darin@apple.com>
15170
15171         Reviewed by Geoff Garen and Eric Seidel.
15172
15173         - fix http://bugs.webkit.org/show_bug.cgi?id=4923
15174           stop using <ostream> in WebCore, eliminating the <cmath> troubles it causes
15175
15176         * kjs/simple_number.h: Removed many unnecessary includes, including
15177         the <cmath> one to work around GCC library header bugs. We may have to
15178         add some includes elsewhere for platforms other than OS X, since our
15179         prefix header takes care of some things.
15180
15181         * kxmlcore/AlwaysInline.h: Added. Now clients that don't include
15182         simple_number.h can still get the ALWAYS_INLINE macro.
15183         * JavaScriptCore.xcodeproj/project.pbxproj: Added AlwaysInline.h.
15184
15185         * bindings/NP_jsobject.h: Removed a lot of unnecessary includes
15186         and removed C-specific stuff from this C++-only header.
15187         * bindings/jni/jni_jsobject.h: Removed a lot of unnecessary includes
15188         and did some reformatting.
15189         * bindings/objc/objc_runtime.h:  Removed an unnecessary include.
15190         * bindings/runtime.h: Removed some unneeded includes. Reformatted.
15191         * bindings/runtime.cpp: Updated to compile with header changes,
15192         including a lot of reformatting.
15193         * bindings/runtime_object.h: Removed an unnecessary include.
15194
15195 2005-12-13  Maciej Stachowiak  <mjs@apple.com>
15196
15197         Reviewed by Geoff and Adele
15198
15199         - replaced custom Identifier hashtable with HashSet
15200
15201         * kjs/identifier.cpp:
15202         (KXMLCore::):
15203         (KJS::identifierTable):
15204         (KJS::Identifier::equal):
15205         (KJS::hash):
15206         (KJS::equal):
15207         (KJS::convert):
15208         (KJS::Identifier::add):
15209         (KJS::Identifier::remove):
15210         * kjs/identifier.h:
15211         * kjs/internal.cpp:
15212         (KJS::InterpreterImp::initGlobalObject):
15213
15214 2005-12-18  Justin Haygood  <justin@xiondigital.net>
15215
15216         Reviewed, tweaked, and landed by Darin.
15217
15218         - fix http://bugs.webkit.org/show_bug.cgi?id=5227
15219           Array indexOf() extension for JavaScript 1.5 Core
15220
15221         * kjs/array_object.h:
15222         * kjs/array_object.cpp: (ArrayProtoFunc::callAsFunction): Added implementation of indexOf.
15223
15224 2005-12-18  Anders Carlsson  <andersca@mac.com>
15225
15226         Reviewed by Darin and Geoffrey.
15227
15228         - fix for <http://bugs.webkit.org/show_bug.cgi?id=4000>
15229         Object.prototype is missing isPrototypeOf
15230         
15231         * kjs/object_object.cpp:
15232         (ObjectPrototype::ObjectPrototype):
15233         Add isPrototypeOf to object prototype.
15234         
15235         (ObjectProtoFunc::callAsFunction):
15236         Implement isPrototypeOf
15237         
15238         * kjs/object_object.h:
15239         (KJS::ObjectProtoFunc::):
15240         Add id for isPrototypeOf.
15241
15242 2005-12-17  Geoffrey Garen  <ggaren@apple.com>
15243
15244         Reviewed by Darin.
15245
15246         Fixed http://bugs.webkit.org/show_bug.cgi?id=6119
15247         split() function ignores case insensitive modifier.
15248
15249         Glossary:
15250         RegExpImp: The C++ object you get when JavaScript executes
15251                    "new RegExp()".
15252         RegExp:    A C++ wrapper object that performs regular expression
15253                    matching on behalf of a RegExpImp.
15254
15255         Instead of unnecessarily constructing a RegExp which (wrongly) lacks
15256         any modifiers, String.split() now uses the RegExp built in to the 
15257         RegExpImp passed to it, which has the right modifiers already.
15258
15259         I also cleaned up other bits of the string code to standardized how
15260         we handle RegExpImp arguments.
15261
15262         * ChangeLog:
15263         * kjs/string_object.cpp:
15264         (replace):
15265         (StringProtoFunc::callAsFunction):
15266
15267 2005-12-16  David Hyatt  <hyatt@apple.com>
15268
15269         Remove unused RefPtr constructors that can create an ambiguity in ustring on some platforms.
15270         
15271         Reviewed by mjs
15272
15273         * kxmlcore/RefPtr.h:
15274         (KXMLCore::RefPtr::RefPtr):
15275
15276 2005-12-15  Darin Adler  <darin@apple.com>
15277
15278         Reviewed by Maciej.
15279
15280         - fix http://bugs.webkit.org/show_bug.cgi?id=5688
15281           speed up JavaScript parsing by not creating a UString just to parse
15282
15283         * kjs/internal.h:
15284         * kjs/internal.cpp: (KJS::InterpreterImp::evaluate): Change to take a character pointer
15285         and length rather than a UString.
15286
15287         * kjs/interpreter.h:
15288         * kjs/interpreter.cpp: (Interpreter::evaluate): Ditto.
15289
15290         * kjs/protect.h: Remove uneeded "convert to bool" operator since we already have a
15291         "convert to raw pointer" operator in this class.
15292
15293 === Safari-521~5 ===
15294
15295 2005-12-13  Geoffrey Garen  <ggaren@apple.com>
15296
15297         Updated test results to match Anders's last fix.
15298
15299         * tests/mozilla/expected.html:
15300
15301 2005-12-13  Anders Carlsson  <andersca@mac.com>
15302
15303         * ChangeLog: Add titles for my bugzilla bugs.
15304
15305 2005-12-13  Anders Carlsson  <andersca@mac.com>
15306
15307         Reviewed by Darin.
15308
15309         - Fixes <http://bugs.webkit.org/show_bug.cgi?id=6041>
15310         Support property getters and setters.
15311         
15312         * bindings/runtime_array.cpp:
15313         (RuntimeArray::lengthGetter):
15314         (RuntimeArray::indexGetter):
15315         * bindings/runtime_array.h:
15316         * bindings/runtime_method.cpp:
15317         (RuntimeMethod::lengthGetter):
15318         * bindings/runtime_method.h:
15319         * bindings/runtime_object.cpp:
15320         (RuntimeObjectImp::fallbackObjectGetter):
15321         (RuntimeObjectImp::fieldGetter):
15322         (RuntimeObjectImp::methodGetter):
15323         * bindings/runtime_object.h:
15324         * kjs/array_instance.h:
15325         * kjs/array_object.cpp:
15326         (ArrayInstance::lengthGetter):
15327         (getProperty):
15328         Update for changes to PropertySlot::getValue and
15329         PropertySlot::GetValueFunc.
15330         
15331         * kjs/collector.cpp:
15332         (KJS::className):
15333         Handle GetterSetterType.
15334         
15335         * kjs/function.cpp:
15336         (KJS::FunctionImp::argumentsGetter):
15337         (KJS::FunctionImp::lengthGetter):
15338         (KJS::Arguments::mappedIndexGetter):
15339         (KJS::ActivationImp::argumentsGetter):
15340         * kjs/function.h:
15341         Update for changes to PropertySlot::getValue and
15342         PropertySlot::GetValueFunc.
15343         
15344         * kjs/grammar.y:
15345         Rework grammar parts for get set declarations directly
15346         in the object literal.
15347         
15348         * kjs/internal.cpp:
15349         (KJS::GetterSetterImp::mark):
15350         (KJS::GetterSetterImp::toPrimitive):
15351         (KJS::GetterSetterImp::toBoolean):
15352         (KJS::GetterSetterImp::toNumber):
15353         (KJS::GetterSetterImp::toString):
15354         (KJS::GetterSetterImp::toObject):
15355         Add type conversion functions. These aren't meant to be called.
15356         
15357         (KJS::printInfo):
15358         Handle GetterSetterType.
15359         
15360         * kjs/lookup.h:        
15361         (KJS::staticFunctionGetter):
15362         (KJS::staticValueGetter):
15363         Update for changes to PropertySlot::GetValueFunc.
15364         
15365         * kjs/nodes.cpp:
15366         Refactor they way properties nodes are implemented.
15367         We now have a PropertyListNode which is a list of PropertyNodes.
15368         Each PropertyNode has a name (which is a PropertyNameNode) and an associated
15369         value node. PropertyNodes can be of different types. The Constant type is the
15370         old constant declaration and the Getter and Setter types are for property getters
15371         and setters.
15372         (ResolveNode::evaluate):
15373         Update for changes to PropertySlot::getValue.
15374         
15375         (PropertyListNode::evaluate):
15376         Go through all property nodes and set them on the newly created object. If the
15377         property nodes are of type Getter or Setter, define getters and setters. Otherwise,
15378         just add the properties like before.
15379         
15380         (PropertyNode::evaluate):
15381         This should never be called directly.
15382         
15383         (PropertyNameNode::evaluate):
15384         Rename from PropertyNode::evaluate.
15385         
15386         (FunctionCallResolveNode::evaluate):
15387         (FunctionCallBracketNode::evaluate):
15388         (FunctionCallDotNode::evaluate):
15389         (PostfixResolveNode::evaluate):
15390         (PostfixBracketNode::evaluate):
15391         (PostfixDotNode::evaluate):
15392         (TypeOfResolveNode::evaluate):
15393         (PrefixResolveNode::evaluate):
15394         (PrefixBracketNode::evaluate):
15395         (PrefixDotNode::evaluate):
15396         (AssignResolveNode::evaluate):
15397         (AssignDotNode::evaluate):
15398         (AssignBracketNode::evaluate):
15399         Update for changes to PropertySlot::getValue.
15400         
15401         * kjs/nodes.h:
15402         (KJS::PropertyNameNode::PropertyNameNode):
15403         Rename from PropertyNode.
15404         
15405         (KJS::PropertyNode::):
15406         (KJS::PropertyNode::PropertyNode):
15407         New class, representing a single property.
15408         
15409         (KJS::PropertyListNode::PropertyListNode):
15410         Rename from PropertyValueNode.
15411         
15412         (KJS::FuncExprNode::FuncExprNode):
15413         Put ParameterNode parameter last, and make it optional.
15414         
15415         (KJS::ObjectLiteralNode::ObjectLiteralNode):
15416         Use a PropertyListNode here now.
15417         
15418         * kjs/nodes2string.cpp:
15419         (PropertyListNode::streamTo):
15420         Iterate through all property nodes.
15421         
15422         (PropertyNode::streamTo):
15423         Print out the name and value. Doesn't handle getters and setters currently.
15424         
15425         (PropertyNameNode::streamTo):
15426         Rename from PropertyNode::streamTo.
15427         
15428         * kjs/object.cpp:
15429         (KJS::JSObject::get):
15430         Update for changes to PropertySlot::getValue.
15431         
15432         (KJS::JSObject::put):
15433         If the property already exists and has a Setter, invoke
15434         the setter function instead of setting the property directly.
15435         
15436         (KJS::JSObject::defineGetter):
15437         (KJS::JSObject::defineSetter):
15438         New functions for defining property getters and setters on the object.
15439         
15440         * kjs/object.h:
15441         (KJS::GetterSetterImp::type):
15442         (KJS::GetterSetterImp::GetterSetterImp):
15443         (KJS::GetterSetterImp::getGetter):
15444         (KJS::GetterSetterImp::setGetter):
15445         (KJS::GetterSetterImp::getSetter):
15446         (KJS::GetterSetterImp::setSetter):
15447         New class for properties which have getters and setters defined.
15448         This class is only used internally and should never be seen from the outside.
15449         
15450         (KJS::JSObject::getOwnPropertySlot):
15451          If the property is a getter, call setGetterSlot on the property slot.
15452          
15453         * kjs/object_object.cpp:
15454         (ObjectPrototype::ObjectPrototype):
15455         Add __defineGetter__, __defineSetter, __lookupGetter__, __lookupSetter__
15456         to prototype.
15457         
15458         (ObjectProtoFunc::callAsFunction):
15459         Implement handlers for new functions.
15460         
15461         * kjs/object_object.h:
15462         (KJS::ObjectProtoFunc::):
15463         Add ids for new functions.
15464         
15465         * kjs/property_slot.cpp:
15466         (KJS::PropertySlot::undefinedGetter):
15467         Update for changes to PropertySlot::GetValueFunc.
15468         
15469         (KJS::PropertySlot::functionGetter):
15470         Call the function getter object and return its value.
15471         
15472         * kjs/property_slot.h:
15473         (KJS::PropertySlot::getValue):
15474         Add a new argument which is the original object that
15475         getPropertySlot was called on.
15476         
15477         (KJS::PropertySlot::setGetterSlot):
15478         (KJS::PropertySlot::):
15479         New function which sets a getter slot. When getValue is called on a 
15480         getter slot, the getter function object is invoked.
15481         
15482         * kjs/string_object.cpp:
15483         (StringInstance::lengthGetter):
15484         (StringInstance::indexGetter):
15485         * kjs/string_object.h:
15486         Update for changes to PropertySlot::GetValueFunc.
15487         
15488         * kjs/value.h:
15489         (KJS::):
15490         Add GetterSetterType and make GetterSetterImp a friend class of JSCell.
15491
15492 2005-12-12  Maciej Stachowiak  <mjs@apple.com>
15493
15494         Reviewed by Eric.
15495
15496         - added a new HashCountedSet class for the common pattern of mapping items to counts that can change
15497         
15498         * kxmlcore/HashCountedSet.h: Added.
15499         (KXMLCore::HashCountedSet::*): Implemented, on top of HashMap.
15500         * kxmlcore/HashMap.h:
15501         (KXMLCore::HashMap::add): New method - does not replace existing value if key already present
15502         but otherwise like set().
15503         (KXMLCore::HashMap::set): Improved comments.
15504         * kxmlcore/HashMapPtrSpec.h:
15505         (KXMLCore::HashMap::add): Added to specializations too.
15506         * JavaScriptCore.xcodeproj/project.pbxproj: Add new  file.
15507         * kxmlcore/HashFunctions.h: Added include of stdint.h
15508         
15509         - replaced the custom hashtable for values protected from GC with HashCountedSet
15510
15511         * kjs/collector.cpp:
15512         (KJS::Collector::protect): Moved code here from ProtectedValues::increaseProtectCount
15513         since the code is so simple now.
15514         (KJS::Collector::unprotect): Ditto for ProtectedValues::decreaseProtectCount.
15515         (KJS::Collector::markProtectedObjects): Updated for new way of doing things, now
15516         simpler and safer.
15517         (KJS::Collector::numReferencedObjects): ditto
15518         (KJS::Collector::rootObjectClasses): ditto
15519         * kjs/collector.h: Added protect and unprotect static methods
15520         * kjs/protect.h:
15521         (KJS::gcProtect): Updated for removal of ProtectedValues class
15522         (KJS::gcUnprotect): likewise
15523         * kjs/protected_values.cpp: Removed.
15524         * kjs/protected_values.h: Removed.
15525
15526 2005-12-10  Darin Adler  <darin@apple.com>
15527
15528         Rubber stamped by Maciej.
15529
15530         - did long-promised KJS renaming:
15531         
15532             ValueImp -> JSValue
15533             ObjectImp -> JSObject
15534             AllocatedValueImp -> JSCell
15535         
15536         A renaming to get a class out of the way
15537         
15538             KJS::Bindings::JSObject -> JavaJSObject
15539  
15540         and some other "imp-reduction" renaming
15541         
15542             *InstanceImp -> *Instance
15543             *ProtoFuncImp -> *ProtoFunc
15544             *PrototypeImp -> *Prototype
15545             ArgumentsImp -> Arguments
15546             RuntimeArrayImp -> RuntimeArray
15547             RuntimeMethodImp -> RuntimeMethod
15548
15549         * most files and functions
15550
15551 2005-12-10  Darin Adler  <darin@apple.com>
15552
15553         Reviewed by Maciej.
15554
15555         - eliminated the old Undefined(), Null(), Boolean(), Number(), and String()
15556
15557         Code now uses jsUndefined(), jsNull(), jsBoolean(), jsNumber(), and jsString().
15558
15559         * bindings/NP_jsobject.cpp:
15560         (_NPN_Evaluate):
15561         * bindings/c/c_instance.cpp:
15562         (KJS::Bindings::CInstance::invokeMethod):
15563         (KJS::Bindings::CInstance::invokeDefaultMethod):
15564         * bindings/c/c_runtime.cpp:
15565         (CField::valueFromInstance):
15566         * bindings/c/c_utility.cpp:
15567         (KJS::Bindings::convertNPVariantToValue):
15568         * bindings/jni/jni_instance.cpp:
15569         (JavaInstance::invokeMethod):
15570         (JavaInstance::invokeDefaultMethod):
15571         * bindings/jni/jni_jsobject.cpp:
15572         (JSObject::eval):
15573         (JSObject::convertJObjectToValue):
15574         * bindings/jni/jni_runtime.cpp:
15575         (JavaArray::convertJObjectToArray):
15576         (JavaField::valueFromInstance):
15577         (JavaArray::valueAt):
15578         * bindings/objc/WebScriptObject.mm:
15579         (-[WebScriptObject callWebScriptMethod:withArguments:]):
15580         (-[WebScriptObject evaluateWebScript:]):
15581         (-[WebScriptObject valueForKey:]):
15582         (-[WebScriptObject webScriptValueAtIndex:]):
15583         * bindings/objc/objc_instance.mm:
15584         (ObjcInstance::invokeMethod):
15585         (ObjcInstance::invokeDefaultMethod):
15586         (ObjcInstance::getValueOfUndefinedField):
15587         * bindings/objc/objc_runtime.mm:
15588         (ObjcField::valueFromInstance):
15589         (ObjcFallbackObjectImp::callAsFunction):
15590         * bindings/objc/objc_utility.mm:
15591         (KJS::Bindings::convertNSStringToString):
15592         (KJS::Bindings::convertObjcValueToValue):
15593         * bindings/runtime.h:
15594         (KJS::Bindings::Class::fallbackObject):
15595         (KJS::Bindings::Instance::getValueOfUndefinedField):
15596         (KJS::Bindings::Instance::valueOf):
15597         * bindings/runtime_array.cpp:
15598         (RuntimeArrayImp::lengthGetter):
15599         * bindings/runtime_method.cpp:
15600         (RuntimeMethodImp::lengthGetter):
15601         (RuntimeMethodImp::callAsFunction):
15602         (RuntimeMethodImp::execute):
15603         * kjs/array_object.cpp:
15604         (ArrayInstanceImp::lengthGetter):
15605         (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
15606         (ArrayPrototypeImp::ArrayPrototypeImp):
15607         (ArrayProtoFuncImp::ArrayProtoFuncImp):
15608         (ArrayProtoFuncImp::callAsFunction):
15609         (ArrayObjectImp::ArrayObjectImp):
15610         * kjs/bool_object.cpp:
15611         (BooleanPrototypeImp::BooleanPrototypeImp):
15612         (BooleanProtoFuncImp::callAsFunction):
15613         (BooleanObjectImp::BooleanObjectImp):
15614         (BooleanObjectImp::callAsFunction):
15615         * kjs/error_object.cpp:
15616         (ErrorPrototypeImp::ErrorPrototypeImp):
15617         (ErrorProtoFuncImp::ErrorProtoFuncImp):
15618         (ErrorProtoFuncImp::callAsFunction):
15619         (ErrorObjectImp::ErrorObjectImp):
15620         (NativeErrorImp::NativeErrorImp):
15621         * kjs/function.cpp:
15622         (KJS::FunctionImp::callAsFunction):
15623         (KJS::FunctionImp::processParameters):
15624         (KJS::FunctionImp::argumentsGetter):
15625         (KJS::FunctionImp::lengthGetter):
15626         (KJS::DeclaredFunctionImp::execute):
15627         (KJS::encode):
15628         (KJS::decode):
15629         (KJS::GlobalFuncImp::callAsFunction):
15630         * kjs/function_object.cpp:
15631         (FunctionPrototypeImp::FunctionPrototypeImp):
15632         (FunctionPrototypeImp::callAsFunction):
15633         (FunctionProtoFuncImp::callAsFunction):
15634         (FunctionObjectImp::FunctionObjectImp):
15635         * kjs/internal.cpp:
15636         (KJS::InterpreterImp::initGlobalObject):
15637         * kjs/interpreter.h:
15638         * kjs/lookup.h:
15639         * kjs/math_object.cpp:
15640         (MathObjectImp::getValueProperty):
15641         (MathFuncImp::callAsFunction):
15642         * kjs/nodes.cpp:
15643         (Node::setExceptionDetailsIfNeeded):
15644         (NullNode::evaluate):
15645         (PropertyNode::evaluate):
15646         (FunctionCallBracketNode::evaluate):
15647         (FunctionCallDotNode::evaluate):
15648         (PostfixBracketNode::evaluate):
15649         (PostfixDotNode::evaluate):
15650         (VoidNode::evaluate):
15651         (PrefixBracketNode::evaluate):
15652         (PrefixDotNode::evaluate):
15653         (ShiftNode::evaluate):
15654         (valueForReadModifyAssignment):
15655         (AssignDotNode::evaluate):
15656         (AssignBracketNode::evaluate):
15657         (VarDeclNode::evaluate):
15658         (VarDeclNode::processVarDecls):
15659         (VarDeclListNode::evaluate):
15660         (ReturnNode::execute):
15661         (CaseClauseNode::evalStatements):
15662         (ParameterNode::evaluate):
15663         (FuncDeclNode::processFuncDecl):
15664         * kjs/nodes.h:
15665         (KJS::StatementNode::evaluate):
15666         * kjs/number_object.cpp:
15667         (NumberPrototypeImp::NumberPrototypeImp):
15668         (NumberProtoFuncImp::callAsFunction):
15669         (NumberObjectImp::NumberObjectImp):
15670         (NumberObjectImp::getValueProperty):
15671         (NumberObjectImp::callAsFunction):
15672         * kjs/object.cpp:
15673         (KJS::ObjectImp::get):
15674         (KJS::Error::create):
15675         * kjs/object_object.cpp:
15676         (ObjectPrototypeImp::ObjectPrototypeImp):
15677         (ObjectProtoFuncImp::callAsFunction):
15678         (ObjectObjectImp::ObjectObjectImp):
15679         * kjs/property_slot.cpp:
15680         (KJS::PropertySlot::undefinedGetter):
15681         * kjs/regexp_object.cpp:
15682         (RegExpPrototypeImp::RegExpPrototypeImp):
15683         (RegExpProtoFuncImp::callAsFunction):
15684         (RegExpObjectImp::RegExpObjectImp):
15685         (RegExpObjectImp::arrayOfMatches):
15686         (RegExpObjectImp::getBackref):
15687         (RegExpObjectImp::getLastMatch):
15688         (RegExpObjectImp::getLastParen):
15689         (RegExpObjectImp::getLeftContext):
15690         (RegExpObjectImp::getRightContext):
15691         (RegExpObjectImp::getValueProperty):
15692         (RegExpObjectImp::construct):
15693         * kjs/string_object.cpp:
15694         (StringInstanceImp::StringInstanceImp):
15695         (StringPrototypeImp::StringPrototypeImp):
15696         (replace):
15697         (StringProtoFuncImp::callAsFunction):
15698         (StringObjectImp::StringObjectImp):
15699         (StringObjectImp::callAsFunction):
15700         (StringObjectFuncImp::StringObjectFuncImp):
15701         (StringObjectFuncImp::callAsFunction):
15702         * kjs/testkjs.cpp:
15703         (TestFunctionImp::callAsFunction):
15704         (VersionFunctionImp::callAsFunction):
15705         * kjs/value.h:
15706
15707 2005-12-10  Oliver Hunt  <ojh16@student.canterbury.ac.nz>
15708
15709         Reviewed by Maciej, landed by Darin.
15710
15711         - fix http://bugs.webkit.org/show_bug.cgi?id=3539
15712           Array join and toString methods do not support circular references
15713
15714         * kjs/array_object.cpp: (ArrayProtoFuncImp::callAsFunction):
15715         Added set of visited objects -- don't recurse if item is already in the set.
15716
15717 2005-12-08  Maciej Stachowiak  <mjs@apple.com>
15718
15719         Reviewed by John.
15720
15721         - fix major memory leak and resultant slowdown on JavaScript iBench from
15722         my PassRefPtr changes
15723         
15724         * kjs/ustring.cpp:
15725         (KJS::UString::Rep::create): I forgot to change one of the two overloads to create
15726         with a refcount of 0 instead of 1 (the smart pointer then bumps it. But instead of
15727         changing it, I changed both to start with a refcounter of 1 and use PassRefPtr::adopt
15728         to adopt the initial refcount, this may be a hair more efficient.
15729
15730         - made the assignment operators for smart pointers inline because Shark said so
15731         
15732         * kxmlcore/PassRefPtr.h:
15733         (KXMLCore::::operator=):
15734         * kxmlcore/RefPtr.h:
15735         (KXMLCore::::operator=):
15736
15737 2005-12-06  Anders Carlsson  <andersca@mac.com>
15738
15739         Reviewed by Darin.
15740
15741         - fix build when using gcc 4
15742                 
15743         * kjs/ustring.h:
15744         Make Rep public.
15745
15746         * kxmlcore/PassRefPtr.h:
15747         (KXMLCore::::operator):
15748         Fix a typo.
15749
15750 2005-12-05  Maciej Stachowiak  <mjs@apple.com>
15751
15752         Reviewed by Eric.
15753
15754         - add PassRefPtr, a smart pointer class that works in conjunction
15755         with RefPtr but has transfer-of-ownership semantics
15756         - apply RefPtr and PassRefPtr to UString
15757         - cleaned up UString a little so that it doesn't need to have so many friend classes
15758
15759         * JavaScriptCore.xcodeproj/project.pbxproj:
15760         * kjs/identifier.cpp:
15761         (KJS::Identifier::add):
15762         * kjs/identifier.h:
15763         (KJS::Identifier::Identifier):
15764         (KJS::Identifier::equal):
15765         * kjs/property_map.cpp:
15766         (KJS::PropertyMap::get):
15767         (KJS::PropertyMap::getLocation):
15768         (KJS::PropertyMap::put):
15769         (KJS::PropertyMap::remove):
15770         * kjs/ustring.cpp:
15771         (KJS::UCharReference::operator=):
15772         (KJS::UCharReference::ref):
15773         (KJS::UString::Rep::createCopying):
15774         (KJS::UString::Rep::create):
15775         (KJS::UString::usedCapacity):
15776         (KJS::UString::usedPreCapacity):
15777         (KJS::UString::expandCapacity):
15778         (KJS::UString::expandPreCapacity):
15779         (KJS::UString::UString):
15780         (KJS::UString::spliceSubstringsWithSeparators):
15781         (KJS::UString::append):
15782         (KJS::UString::operator=):
15783         (KJS::UString::toStrictUInt32):
15784         (KJS::UString::substr):
15785         (KJS::UString::copyForWriting):
15786         (KJS::operator==):
15787         * kjs/ustring.h:
15788         (KJS::UString::UString):
15789         (KJS::UString::~UString):
15790         (KJS::UString::data):
15791         (KJS::UString::isNull):
15792         (KJS::UString::isEmpty):
15793         (KJS::UString::size):
15794         (KJS::UString::rep):
15795         * kxmlcore/RefPtr.h:
15796         (KXMLCore::RefPtr::RefPtr):
15797         (KXMLCore::RefPtr::operator*):
15798         (KXMLCore::::operator):
15799         (KXMLCore::operator==):
15800         (KXMLCore::operator!=):
15801         (KXMLCore::static_pointer_cast):
15802         (KXMLCore::const_pointer_cast):
15803
15804 2005-12-04  Geoffrey Garen  <ggaren@apple.com>
15805
15806         Update test results to match Anders's last checkin.
15807
15808         * tests/mozilla/expected.html:
15809
15810 2005-12-04  Anders Carlsson  <andersca@mac.com>
15811
15812         Reviewed by Geoffrey.
15813
15814         - Fixes <http://bugs.webkit.org/show_bug.cgi?id=3999>
15815         Object.prototype is missing propertyIsEnumerable
15816         
15817         * kjs/object.cpp:
15818         (KJS::ObjectImp::canPut):
15819         Refactor to use getPropertyAttributes.
15820
15821         (KJS::ObjectImp::propertyIsEnumerable):
15822         New function which checks if a property is enumerable.
15823
15824         (KJS::ObjectImp::getPropertyAttributes):
15825         * kjs/object.h:
15826         Add getPropertyAttributes and propertyIsEnumerable.
15827
15828         * kjs/object_object.cpp:
15829         (ObjectPrototypeImp::ObjectPrototypeImp):
15830         (ObjectProtoFuncImp::callAsFunction):
15831         * kjs/object_object.h:
15832         (KJS::ObjectProtoFuncImp::):
15833         Add propertyIsEnumerable to the Object prototype.
15834
15835 2005-12-01  Maciej Stachowiak  <mjs@apple.com>
15836
15837         Reviewed by Tim Hatcher.
15838
15839         - removed deprecated reset, isNull and nonNull methods
15840
15841         * kxmlcore/RefPtr.h:
15842
15843 2005-12-01  Anders Carlsson  <andersca@mac.com>
15844
15845         Reviewed by Darin.
15846
15847         - Fixes <http://bugs.webkit.org/show_bug.cgi?id=3382>
15848         nodes2strings.cpp fails to print left expression of ForInNode when 'var' is not used
15849         
15850         Patch by Mark Rowe.
15851
15852         * kjs/nodes2string.cpp:
15853         (ForInNode::streamTo):
15854         Add lexpr if there's no varDecl.
15855
15856 2005-12-01  Maciej Stachowiak  <mjs@apple.com>
15857
15858         Rubber stamped by Eric.
15859
15860         - renamed SharedPtr to RefPtr via script
15861
15862         * JavaScriptCore.xcodeproj/project.pbxproj:
15863         * kjs/function.cpp:
15864         (KJS::GlobalFuncImp::callAsFunction):
15865         * kjs/function.h:
15866         * kjs/function_object.cpp:
15867         (FunctionObjectImp::construct):
15868         * kjs/internal.cpp:
15869         (KJS::Parser::parse):
15870         (KJS::InterpreterImp::checkSyntax):
15871         (KJS::InterpreterImp::evaluate):
15872         * kjs/internal.h:
15873         * kjs/nodes.h:
15874         * kjs/nodes2string.cpp:
15875         (KJS::SourceStream::operator<<):
15876         * kjs/protect.h:
15877         * kxmlcore/RefPtr.h: Added.
15878         (KXMLCore::RefPtr::RefPtr):
15879         (KXMLCore::RefPtr::~RefPtr):
15880         (KXMLCore::RefPtr::isNull):
15881         (KXMLCore::RefPtr::notNull):
15882         (KXMLCore::RefPtr::reset):
15883         (KXMLCore::RefPtr::get):
15884         (KXMLCore::RefPtr::operator*):
15885         (KXMLCore::RefPtr::operator->):
15886         (KXMLCore::RefPtr::operator!):
15887         (KXMLCore::RefPtr::operator UnspecifiedBoolType):
15888         (KXMLCore::::operator):
15889         (KXMLCore::operator==):
15890         (KXMLCore::operator!=):
15891         (KXMLCore::static_pointer_cast):
15892         (KXMLCore::const_pointer_cast):
15893         * kxmlcore/SharedPtr.h: Removed.
15894
15895 2005-11-30  Maciej Stachowiak  <mjs@apple.com>
15896
15897         Reviewed by Dave Hyatt.
15898
15899         - change idiom used for implicit bool conversion of smart pointers, because the old one gives weird error messages sometimes
15900
15901         * kjs/protect.h:
15902         (KJS::ProtectedPtr::operator UnspecifiedBoolType):
15903         * kxmlcore/SharedPtr.h:
15904         (KXMLCore::SharedPtr::operator UnspecifiedBoolType):
15905
15906 2005-11-29  Mitz Pettel  <opendarwin.org@mitzpettel.com>
15907
15908         Reviewed by ggaren.  Committed by eseidel.
15909
15910         Date conversion to local time gets the DST flag wrong sometimes
15911         http://bugs.webkit.org/show_bug.cgi?id=5514
15912
15913         * kjs/date_object.cpp:
15914         (KJS::isTime_tSigned):
15915         (KJS::DateProtoFuncImp::callAsFunction):
15916
15917 2005-11-26  Maciej Stachowiak  <mjs@apple.com>
15918
15919         Rubber stamped by Eric.
15920
15921         - renamed InterpreterLock to JSLock
15922
15923         * bindings/NP_jsobject.cpp:
15924         (_NPN_Invoke):
15925         (_NPN_Evaluate):
15926         (_NPN_GetProperty):
15927         (_NPN_SetProperty):
15928         (_NPN_RemoveProperty):
15929         (_NPN_HasProperty):
15930         (_NPN_HasMethod):
15931         (_NPN_SetException):
15932         * bindings/jni/jni_jsobject.cpp:
15933         (JSObject::call):
15934         (JSObject::eval):
15935         (JSObject::getMember):
15936         (JSObject::setMember):
15937         (JSObject::removeMember):
15938         (JSObject::getSlot):
15939         (JSObject::setSlot):
15940         (JSObject::toString):
15941         (JSObject::convertJObjectToValue):
15942         * bindings/objc/WebScriptObject.mm:
15943         (-[WebScriptObject callWebScriptMethod:withArguments:]):
15944         (-[WebScriptObject evaluateWebScript:]):
15945         (-[WebScriptObject setValue:forKey:]):
15946         (-[WebScriptObject valueForKey:]):
15947         (-[WebScriptObject removeWebScriptKey:]):
15948         (-[WebScriptObject stringRepresentation]):
15949         (-[WebScriptObject webScriptValueAtIndex:]):
15950         (-[WebScriptObject setWebScriptValueAtIndex:value:]):
15951         (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
15952         * bindings/runtime.cpp:
15953         (Instance::createRuntimeObject):
15954         * bindings/runtime_root.cpp:
15955         (KJS::Bindings::addNativeReference):
15956         (KJS::Bindings::removeNativeReference):
15957         (RootObject::removeAllNativeReferences):
15958         * bindings/runtime_root.h:
15959         (KJS::Bindings::RootObject::~RootObject):
15960         (KJS::Bindings::RootObject::setRootObjectImp):
15961         * bindings/testbindings.cpp:
15962         (main):
15963         * bindings/testbindings.mm:
15964         (main):
15965         * kjs/JSLock.cpp:
15966         (KJS::initializeJSLock):
15967         (KJS::JSLock::lock):
15968         (KJS::JSLock::unlock):
15969         (KJS::JSLock::lockCount):
15970         (KJS::JSLock::DropAllLocks::DropAllLocks):
15971         (KJS::JSLock::DropAllLocks::~DropAllLocks):
15972         * kjs/JSLock.h:
15973         (KJS::JSLock::JSLock):
15974         (KJS::JSLock::~JSLock):
15975         * kjs/collector.cpp:
15976         (KJS::Collector::allocate):
15977         (KJS::Collector::collect):
15978         * kjs/internal.cpp:
15979         (KJS::InterpreterImp::InterpreterImp):
15980         (KJS::InterpreterImp::clear):
15981         (KJS::InterpreterImp::checkSyntax):
15982         (KJS::InterpreterImp::evaluate):
15983         * kjs/interpreter.cpp:
15984         (Interpreter::evaluate):
15985         * kjs/protect.h:
15986         (KJS::::ProtectedPtr):
15987         (KJS::::~ProtectedPtr):
15988         (KJS::::operator):
15989         * kjs/protected_reference.h:
15990         (KJS::ProtectedReference::ProtectedReference):
15991         (KJS::ProtectedReference::~ProtectedReference):
15992         (KJS::ProtectedReference::operator=):
15993         * kjs/protected_values.cpp:
15994         (KJS::ProtectedValues::getProtectCount):
15995         (KJS::ProtectedValues::increaseProtectCount):
15996         (KJS::ProtectedValues::decreaseProtectCount):
15997         * kjs/testkjs.cpp:
15998         (TestFunctionImp::callAsFunction):
15999         (main):
16000
16001 2005-11-26  Darin Adler  <darin@apple.com>
16002
16003         Reviewed by eseidel.  Committed by eseidel.
16004
16005         Inline ScopeChain functions for speed.
16006         http://bugs.webkit.org/show_bug.cgi?id=5687
16007
16008         * kjs/object.h:
16009         (KJS::ScopeChain::mark):
16010         * kjs/scope_chain.cpp:
16011         * kjs/scope_chain.h:
16012         (KJS::ScopeChain::ref):
16013         (KJS::ScopeChain::operator=):
16014         (KJS::ScopeChain::bottom):
16015         (KJS::ScopeChain::push):
16016         (KJS::ScopeChain::pop):
16017
16018 2005-11-21  Maciej Stachowiak  <mjs@apple.com>
16019
16020         Reviewed by Geoff.
16021
16022         <rdar://problem/4139620> Seed: WebKit: hang when sending XMLHttpRequest if automatic proxy config is used
16023
16024         Also factored locking code completely into a separate class, and
16025         added a convenient packaged way to temporarily drop locks.
16026
16027         * JavaScriptCore.xcodeproj/project.pbxproj:
16028         * kjs/JSLock.cpp: Added.
16029         (KJS::initializeInterpreterLock):
16030         (KJS::InterpreterLock::lock):
16031         (KJS::InterpreterLock::unlock):
16032         (KJS::InterpreterLock::lockCount):
16033         (KJS::InterpreterLock::DropAllLocks::DropAllLocks):
16034         (KJS::InterpreterLock::DropAllLocks::~DropAllLocks):
16035         * kjs/JSLock.h: Added.
16036         (KJS::InterpreterLock::InterpreterLock):
16037         (KJS::InterpreterLock::~InterpreterLock):
16038         * kjs/internal.cpp:
16039         * kjs/internal.h:
16040         * kjs/interpreter.cpp:
16041         * kjs/interpreter.h:
16042         * kjs/protect.h:
16043         * kjs/testkjs.cpp:
16044         (TestFunctionImp::callAsFunction):
16045
16046 2005-11-21  Eric Seidel  <eseidel@apple.com>
16047
16048         Rubber-stamped by hyatt.
16049         
16050         Removed JavaScriptCore+SVG target.
16051
16052         * JavaScriptCore.xcodeproj/project.pbxproj:
16053
16054 2005-11-15  Geoffrey Garen  <ggaren@apple.com>
16055
16056         Reviewed by mjs.
16057         
16058         - Fixed <rdar://problem/4342216> Installer crash in 
16059           KJS::ValueImp::marked() when garbage collector runs inside call to 
16060           ConstantValues::init()
16061           
16062         I took responsibility for initializing and marking ConstantValues away 
16063         from InterpreterImp, since it's possible to reference such a value 
16064         before any interpreter has been created and after the last interpreter 
16065         has been destroyed.
16066
16067         InterpreterImp::lock now initializes ConstantValues. It's a good
16068         place for the initialization because you have to call it before
16069         creating any objects. Since ::lock can be called more than once,
16070         I added a check in ConstantValues::init to ensure that it executes 
16071         only once.
16072
16073         Collector:collect is now responsible for marking ConstantValues.
16074
16075         We no longer clear the ConstantValues since we can't guarantee that no 
16076         one has a reference to them.
16077
16078         FIXME: This is hackery. The long-term plan is to make ConstantValues
16079         use immediate values that require no initialization.
16080
16081         * ChangeLog:
16082         * kjs/collector.cpp:
16083         (KJS::Collector::collect):
16084         * kjs/internal.cpp:
16085         (KJS::InterpreterImp::InterpreterImp):
16086         (KJS::InterpreterImp::lock):
16087         (KJS::InterpreterImp::clear):
16088         (KJS::InterpreterImp::mark):
16089         * kjs/internal.h:
16090         * kjs/value.cpp:
16091         (KJS::ConstantValues::initIfNeeded):
16092         * kjs/value.h:
16093
16094 2005-11-08  Geoffrey Garen  <ggaren@apple.com>
16095
16096         Reviewed by Darin.
16097
16098         This patch fixes some naughty naughty code -- 5 crashes and 2 
16099         may-go-haywire-in-the-futures.
16100         
16101         One such crash is <rdar://problem/4247330> 8C46 Crash with with 
16102         incomplete parameter list to webScript object function.
16103         
16104         I replaced early returns from within NS_DURINGs with calls to
16105         NS_VALUERETURN because the doc says, "You cannot use goto or 
16106         return to exit an exception handling domain -- errors will result."
16107         
16108         I replaced hard-coded analyses of -[NSMethodSignature 
16109         methodReturnType] with more abstracted alternatives, since
16110         the documentation says "This encoding is implementation-specific, 
16111         so applications should use it with caution," and then emits an
16112         evil cackle.
16113         
16114         I removed the early return in the case where a JavaScript caller
16115         supplies an insufficient number of arguments, because the right
16116         thing to do in such a case is to use JavaScript's defined behavior
16117         of supplying "undefined" for any missing arguments.
16118         
16119         I also changed ObjcInstance::invokeMethod so that it no longer
16120         deletes the method passed to it. It doesn't create the method,
16121         so it shouldn't delete it. A friend of mine named
16122         KERNEL_PROTECTION_FAILURE agrees with me on this point.
16123         
16124         Finally, I changed an assert(true) to assert(false) because
16125         all the other asserts were making fun of it.
16126
16127         * bindings/objc/objc_instance.mm:
16128         (ObjcInstance::invokeMethod):
16129         (ObjcInstance::invokeDefaultMethod):
16130
16131 2005-11-06  Geoffrey Garen  <ggaren@apple.com>
16132
16133         Reviewed by Darin.
16134
16135         - Fixed http://bugs.webkit.org/show_bug.cgi?id=5571
16136           REGRESSION (412.5-TOT): duplicated words/sentences at 
16137           shakespeer.sourceforge.net
16138
16139         Our UTF16-modified PCRE didn't work with extended character classes
16140         (classes involving characters > 255) because it used the GETCHARINC
16141         macro to read through them. In UTF16 mode, GETCHARINC expects UTF16 
16142         input, but PCRE encodes character classes in UTF8 regardless of the
16143         input mode of the subject string.
16144
16145         The fix is to explicitly define GETUTF8CHARINC, and to use it,
16146         rather than GETCHARINC, when reading extended character classes. 
16147         
16148         In UTF8 mode, we simply define GETCHARINC to be GETUTF8CHARINC.
16149
16150         * pcre/pcre_internal.h:
16151         * pcre/pcre_xclass.c:
16152         (_pcre_xclass):
16153
16154 2005-11-05  Geoffrey Garen  <ggaren@apple.com>
16155
16156         Patch by Mitz Pettel, reviewed by Maciej.
16157
16158         - Fixed http://bugs.webkit.org/show_bug.cgi?id=5357
16159           REGRESSION: Scriptable plugin hides properties of OBJECT element
16160
16161         * bindings/objc/objc_class.mm:
16162         (KJS::Bindings::ObjcClass::fallbackObject):
16163
16164 2005-11-05  Geoffrey Garen  <ggaren@apple.com>
16165
16166         Reviewed by Darin.
16167
16168         - Fixed http://bugs.webkit.org/show_bug.cgi?id=5409
16169         slice() testcase doesn't pass
16170
16171         Modified String.slice to deal with funky values.
16172         Updated test results. We now pass <js1_2/String/slice.js>.
16173
16174         * kjs/string_object.cpp:
16175         (StringProtoFuncImp::callAsFunction):
16176         * tests/mozilla/expected.html:
16177
16178 2005-11-04  Darin Adler  <darin@apple.com>
16179
16180         Reviewed by Tim Hatcher.
16181
16182         * kxmlcore/HashSet.h: Fixed case of "hashfunctions.h" -- needs to be "HashFunctions.h".
16183
16184 2005-11-03  Timothy Hatcher  <timothy@apple.com>
16185
16186         Reviewed by Darin and Vicki.
16187
16188         * JavaScriptCore.xcodeproj/project.pbxproj:
16189           Change to use $(SYSTEM_LIBRARY_DIR) consistently and place
16190           $(NEXT_ROOT) in a few spots to make build-root work.
16191
16192 2005-11-03  Geoffrey Garen  <ggaren@apple.com>
16193
16194         - Updated JavaScriptCore test results to reflect recent fixes.
16195
16196         * tests/mozilla/expected.html:
16197
16198 2005-11-03  Geoffrey Garen  <ggaren@apple.com>
16199
16200         Reviewed by darin.
16201
16202         - Fixed http://bugs.webkit.org/show_bug.cgi?id=5602
16203           REGRESSION: RegExp("[^\\s$]+", "g") returns extra matches
16204
16205         We now update lastIndex relative to the start of the last match,
16206         rather than the start of the last search. We used to assume that
16207         the two were equal, but that is not the case when a pattern
16208         matches at a character after the first in the string.
16209
16210         * kjs/regexp_object.cpp:
16211         (RegExpProtoFuncImp::callAsFunction):
16212
16213 2005-10-24  John Sullivan  <sullivan@apple.com>
16214
16215         Reviewed by Darin Adler. Code changes by Alexey Proskuryakov.
16216         
16217         - fixed http://bugs.webkit.org/show_bug.cgi?id=4931
16218         Unicode format characters (Cf) should be removed from JavaScript source
16219
16220         * kjs/lexer.cpp:
16221         include <unicode/uchar.h>
16222         (Lexer::Lexer):
16223         use KJS::UChar instead of UChar to avoid ambiguity caused by new include
16224         (Lexer::setCode):
16225         ditto; also, use shift(4) to skip first 4 chars to take advantage of new
16226         logic there.
16227         (Lexer::shift):
16228         skip chars of type U_FORMAT_CHAR
16229         (Lexer::convertUnicode):
16230         use KJS::UChar instead of UChar to avoid ambiguity caused by new include
16231         (Lexer::record16):
16232         ditto
16233         (Lexer::makeIdentifier):
16234         ditto
16235         (Lexer::makeUString):
16236         ditto
16237         
16238         * tests/mozilla/ecma/Array/15.4.5.1-1.js:
16239         updated to skip soft hyphens
16240
16241 2005-10-24  John Sullivan  <sullivan@apple.com>
16242
16243         Reviewed by Darin Adler. Code changes by George Staikos/Geoff Garen.
16244         
16245         - fixed http://bugs.webkit.org/show_bug.cgi?id=4142
16246         Date object does not always adjust daylight savings correctly
16247
16248         * kjs/date_object.cpp:
16249         (KJS::makeTime):
16250         Fix the case where a time change crosses the daylight savings start/end dates.
16251
16252 2005-10-17  Maciej Stachowiak  <mjs@apple.com>
16253
16254         Reviewed by Geoff. Code changes by Darin.
16255
16256         - some micro-optimizations to FastMalloc to reduce math and branches.
16257
16258         * kxmlcore/FastMalloc.cpp:
16259         (KXMLCore::TCMalloc_Central_FreeList::Populate):
16260         (KXMLCore::fastMallocRegisterThread):
16261         (KXMLCore::TCMalloc_ThreadCache::GetCache):
16262         (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
16263
16264 2005-10-15  Maciej Stachowiak  <mjs@apple.com>
16265
16266         Reverted fix for this bug, because it was part of a time range that caused a performance
16267         regression:
16268         
16269         <rdar://problem/4260481> Remove Reference type from JavaScriptCore
16270
16271 2005-10-15  Darin Adler  <darin@apple.com>
16272
16273         * kxmlcore/HashTable.cpp: Fixed build failure (said hashtable.h instead of HashTable.h).
16274
16275 2005-10-14  Geoffrey Garen  <ggaren@apple.com>
16276
16277         Style changes recommended by Darin.
16278         
16279         Changed to camelCase, changed ValueImp* to ValueImp *.
16280
16281         * kjs/simple_number.h:
16282         (KJS::SimpleNumber::make):
16283         (KJS::SimpleNumber::value):
16284
16285 2005-10-11  Geoffrey Garen  <ggaren@apple.com>
16286
16287         Added regexp_object.lut.h build phase from JavaScriptCore
16288         to JavaScriptCore+SVG.
16289
16290         Reviewed by mitz.
16291
16292         * JavaScriptCore.xcodeproj/project.pbxproj:
16293
16294 2005-10-11  Geoffrey Garen  <ggaren@apple.com>
16295
16296         Fixed build bustage from last checkin (stray characters
16297         in the project file).
16298
16299         Reviewed by mitz.
16300
16301         * JavaScriptCore.xcodeproj/project.pbxproj:
16302
16303 2005-10-11  Geoffrey Garen  <ggaren@apple.com>
16304
16305         New JavaScriptCore test results to reflect the last change.
16306
16307         * tests/mozilla/expected.html:
16308
16309 2005-10-10  Geoffrey Garen  <ggaren@apple.com>
16310
16311         - Implemented caching of match state inside the global RegExp object
16312           (lastParen, leftContext, rightContext, lastMatch, input).
16313
16314           exec(), test(), match(), search(), and replace() now dipatch regular
16315           expression matching through the RegExp object's performMatch function, 
16316           to facilitate caching. This replaces registerRegexp and 
16317           setSubPatterns.
16318         
16319         - Implemented the special '$' aliases (e.g. RegExp.input aliases to 
16320           RegExp.$_).
16321
16322         - Moved support for backreferences into the new static hash table
16323           used for other special RegExp properties. Truncated backreferences
16324           at $9 to match IE, FF, and the "What's New in Netscape 1.2?" doc.
16325           (String.replace still supports double-digit backreferences.)
16326
16327         - Tweaked RegExp.prototype.exec to handle ginormous values in lastIndex.
16328
16329         Fixes 11 -- count em, 11 -- JavaScriptCore tests.
16330
16331         * fast/js/regexp-caching-expected.txt: Added.
16332         * fast/js/regexp-caching.html: Added.
16333
16334         Reviewed by mjs.
16335
16336         * JavaScriptCore.xcodeproj/project.pbxproj: Added regexp_object.lut.h
16337         * kjs/create_hash_table: Tweaked to allow for more exotic characters.
16338                                  We now rely on the compiler to catch illegal
16339                                  identifiers.
16340         * kjs/regexp.cpp:
16341         (KJS::RegExp::RegExp):
16342         * kjs/regexp_object.cpp:
16343         (RegExpProtoFuncImp::callAsFunction):
16344         (RegExpObjectImp::RegExpObjectImp):
16345         (RegExpObjectImp::performMatch):
16346         (RegExpObjectImp::arrayOfMatches):
16347         (RegExpObjectImp::backrefGetter):
16348         (RegExpObjectImp::getLastMatch):
16349         (RegExpObjectImp::getLastParen):
16350         (RegExpObjectImp::getLeftContext):
16351         (RegExpObjectImp::getRightContext):
16352         (RegExpObjectImp::getOwnPropertySlot):
16353         (RegExpObjectImp::getValueProperty):
16354         (RegExpObjectImp::put):
16355         (RegExpObjectImp::putValueProperty):
16356         * kjs/regexp_object.h:
16357         (KJS::RegExpObjectImp::):
16358         * kjs/string_object.cpp:
16359         (substituteBackreferences):
16360         (replace):
16361         (StringProtoFuncImp::callAsFunction):
16362
16363 2005-10-09  Darin Adler  <darin@apple.com>
16364
16365         Reviewed by Maciej; some changes done after review.
16366
16367         - fixed <rdar://problem/4092064> hanging loading page; rte.ie (works in IE and Firefox)
16368         - fixed http://bugs.webkit.org/show_bug.cgi?id=5280
16369           Date.setMonth fails with negative values
16370         - fixed http://bugs.webkit.org/show_bug.cgi?id=5154
16371           JSC should switch to _r variants of unix time/date functions
16372         - fixed a few possible overflow cases
16373
16374         Retested all tests to be sure nothing broke; added layout test for bug 5280.
16375
16376         * kjs/config.h: Removed TIME_WITH_SYS_TIME define. Also set HAVE_SYS_TIMEB_H
16377         for the __APPLE__ case (the latter is accurate but irrelevant).
16378
16379         * kjs/date_object.h: Reformatted. Removed unnecessary include of "function_object.h".
16380         Moved declarations of helper classes and functions into the cpp file.
16381
16382         * kjs/date_object.cpp: Removed code at top to define macros to use CoreFoundation instead of
16383         POSIX date functions.
16384         (KJS::styleFromArgString): Tweaked to return early instead of using a variable.
16385         (KJS::formatLocaleDate): Tweaked to check for undefined rather than checking argument count.
16386         (KJS::formatDate): Made parameter const.
16387         (KJS::formatDateUTCVariant): Ditto.
16388         (KJS::formatTime): Ditto.
16389         (KJS::DateProtoFuncImp::callAsFunction): Use gmtime_r and localtime_r instead of gmtime and
16390         localtime.
16391         (KJS::DateObjectImp::callAsFunction): Use localtime_r instead of localtime.
16392         (KJS::ymdhmsToSeconds): Renamed from ymdhms_to_seconds. Changed computation to avoid possible
16393         overflow if year is an extremely large or small number.
16394         (KJS::makeTime): Removed code to move large month numbers from tm_mon to tm_year; this was
16395         to accomodate CFGregorianDate, which is no longer used (and didn't handle negative values).
16396         (KJS::parseDate): Renamed from KRFCDate_parseDate; changed to return a value in milliseconds
16397         rather than in seconds. Reformatted the code. Changed to use UTF8String() instead of ascii(),
16398         since ascii() is not thread safe. Changed some variables back from int to long to avoid
16399         trouble if the result of strtol does not fit in an int (64-bit issue only).
16400
16401 2005-10-08  Mitz Pettel  <opendarwin.org@mitzpettel.com>
16402
16403         Reviewed by Geoff.
16404         Tweaked and landed by Darin.
16405
16406         - fixed http://bugs.webkit.org/show_bug.cgi?id=5266
16407           Support parenthesized comments in Date.parse()
16408
16409         * kjs/date_object.cpp:
16410         (KJS::skipSpacesAndComments): Take a pointer, and advance it past spaces,
16411         and also past anything enclosed in parentheses.
16412         (KJS::KRFCDate_parseDate): Use skipSpacesAndComments wherever we formerly had
16413         code to skip spaces.
16414
16415 2005-10-08  Justin Haygood  <justin@xiondigital.net>
16416
16417         Reviewed, tweaked, and landed by Darin.
16418
16419         - fixed http://bugs.webkit.org/show_bug.cgi?id=5189
16420           pcre_exec.c fails to compile using MSVC
16421         - fixed http://bugs.webkit.org/show_bug.cgi?id=5190
16422           KJS config.h adjustment for Win32
16423         
16424         * kjs/config.h: Make sure HAVE_MMAP and HAVE_SBRK are off for Win32.
16425         Turn HAVE_ERRNO_H on for Mac OS X. Sort defines so they are easy to compare
16426         with each other. Remove #undef of DEBUG_COLLECTOR.
16427         * pcre/pcre_exec.c: (match): Work around strange MSVC complaint by splitting
16428         the definition of a local variable into a separate declaration and
16429         initialization.
16430
16431 2005-10-05  Geoffrey Garen  <ggaren@apple.com>
16432  
16433         - Darin and I rewrote our implementation of the SimpleNumber class
16434           to store number bit patterns in their floating point formats.
16435  
16436         My tweaks reviewed by Darin.
16437         
16438         ~1% speedup on JS iBench.
16439         
16440         * kjs/internal.h: removed obsolete jsNumber declarations.
16441         * kjs/math_object.cpp:
16442         (MathFuncImp::callAsFunction): changed KJS::isNaN to isNaN
16443         * kjs/nodes.cpp:
16444         (PostfixResolveNode::evaluate): removed obsolete knownToBeInteger
16445         (PostfixBracketNode::evaluate): ditto
16446         (PostfixDotNode::evaluate): ditto
16447         (PrefixResolveNode::evaluate): ditto
16448         (PrefixBracketNode::evaluate): ditto
16449         (PrefixDotNode::evaluate): ditto
16450         (NegateNode::evaluate): ditto
16451         (valueForReadModifyAssignment): ditto
16452         * kjs/number_object.cpp: removed obsolete comment
16453         * kjs/operations.cpp:
16454         (KJS::equal): removed unnecessary isNaN checks
16455         (KJS::strictEqual): ditto
16456         (KJS::add): removed obsolete knownToBeInteger
16457         (KJS::mult): ditto
16458         * kjs/operations.h: removed include of "value.h" to prevent circular reference
16459         * kjs/simple_number.h: removed unnecessary #includes
16460         (KJS::SimpleNumber::make): see above
16461         (KJS::SimpleNumber::is): ditto
16462         (KJS::SimpleNumber::value): ditto
16463         * kjs/string_object.cpp:
16464         (StringProtoFuncImp::callAsFunction): changed KJS::isNaN to isNaN
16465         * kjs/ustring.cpp: removed unnecessary isNaN check
16466         (KJS::UString::toUInt32): ditto
16467         * kjs/value.cpp:
16468         (KJS::jsNumber): removed obsolete jsNumber definitions
16469         (KJS::ConstantValues::init): NaN is no longer a ConstantValue
16470         (KJS::ConstantValues::clear): ditto
16471         (KJS::ConstantValues::mark): ditto
16472         * kjs/value.h: removed obsolete knownToBeInteger
16473         (KJS::jsNaN): now returns a SimpleNumber
16474         (KJS::ValueImp::getUInt32): changed to account for NaN being a SimpleNumber
16475         (KJS::ValueImp::toBoolean): ditto
16476         (KJS::ValueImp::toString): changed to account for +/- 0.0
16477         (KJS::jsZero): changed to reflect that SimpleNumber::make takes a double
16478         (KJS::jsOne): ditto
16479         (KJS::jsTwo): ditto
16480         (KJS::Number): removed obsolete non-double constructor declarations
16481
16482 2005-10-05  Maciej Stachowiak  <mjs@apple.com>
16483
16484         Reviewed by Eric.
16485
16486         - fixed <rdar://problem/4260481> Remove Reference type from JavaScriptCore
16487
16488         Also fixed some bugs with for..in enumeration while I was at it. object
16489         properties now come before prototype properties and duplicates
16490         between object and prototype are listed only once.
16491
16492         * JavaScriptCore.xcodeproj/project.pbxproj:
16493         * kjs/IdentifierSequencedSet.cpp: Added.
16494         (KJS::IdentifierSequencedSet::IdentifierSequencedSet):
16495         (KJS::IdentifierSequencedSet::deallocateVector):
16496         (KJS::IdentifierSequencedSet::~IdentifierSequencedSet):
16497         (KJS::IdentifierSequencedSet::insert):
16498         * kjs/IdentifierSequencedSet.h: Added.
16499         (KJS::IdentifierSequencedSetIterator::IdentifierSequencedSetIterator):
16500         (KJS::IdentifierSequencedSetIterator::operator*):
16501         (KJS::IdentifierSequencedSetIterator::operator->):
16502         (KJS::IdentifierSequencedSetIterator::operator++):
16503         (KJS::IdentifierSequencedSetIterator::operator==):
16504         (KJS::IdentifierSequencedSetIterator::operator!=):
16505         (KJS::IdentifierSequencedSet::begin):
16506         (KJS::IdentifierSequencedSet::end):
16507         (KJS::IdentifierSequencedSet::size):
16508         * kjs/array_instance.h:
16509         * kjs/array_object.cpp:
16510         (ArrayInstanceImp::getPropertyNames):
16511         (ArrayInstanceImp::setLength):
16512         (ArrayInstanceImp::pushUndefinedObjectsToEnd):
16513         * kjs/nodes.cpp:
16514         (ForInNode::execute):
16515         * kjs/nodes.h:
16516         * kjs/object.cpp:
16517         (KJS::ObjectImp::getPropertyNames):
16518         * kjs/object.h:
16519         * kjs/property_map.cpp:
16520         (KJS::PropertyMap::getEnumerablePropertyNames):
16521         (KJS::PropertyMap::getSparseArrayPropertyNames):
16522         * kjs/property_map.h:
16523         * kjs/protect.h:
16524         * kjs/protected_reference.h: Removed.
16525         * kjs/reference.cpp: Removed.
16526         * kjs/reference.h: Removed.
16527         * kjs/reference_list.cpp: Removed.
16528         * kjs/reference_list.h: Removed.
16529         * kjs/ustring.h:
16530         (KJS::UString::impl):
16531         * kxmlcore/HashSet.h:
16532
16533 2005-10-04  Eric Seidel  <eseidel@apple.com>
16534
16535         Reviewed by mjs.
16536
16537         Code cleanup, which resulted in a small win on iBench.
16538
16539         * kjs/object.cpp:
16540         (KJS::tryGetAndCallProperty): new static inline
16541         (KJS::ObjectImp::defaultValue): code cleanup
16542
16543 2005-10-03  Maciej Stachowiak  <mjs@apple.com>
16544
16545         Patch from George Staikos <staikos@kde.org>, reviewed and tweaked a bit by me.
16546
16547         - more Linux build fixes
16548         
16549         * kjs/operations.cpp:
16550         * kxmlcore/FastMalloc.h:
16551         * kxmlcore/TCSystemAlloc.cpp:
16552         (TCMalloc_SystemAlloc):
16553
16554 2005-10-03  Maciej Stachowiak  <mjs@apple.com>
16555
16556         Patch from George Staikos <staikos@kde.org>, reviewed and tweaked a bit by me.
16557
16558         http://bugs.webkit.org/show_bug.cgi?id=5174
16559         Add support for compiling on Linux (likely to help for other POSIX systems too)
16560
16561         * kjs/collector.cpp:
16562         (KJS::Collector::markCurrentThreadConservatively):
16563         (KJS::Collector::markOtherThreadConservatively):
16564         * kjs/config.h:
16565         * kjs/date_object.cpp:
16566         (KJS::formatDate):
16567         (KJS::formatDateUTCVariant):
16568         (KJS::formatTime):
16569         (KJS::timeZoneOffset):
16570         (KJS::DateProtoFuncImp::callAsFunction):
16571         (KJS::DateObjectImp::construct):
16572         (KJS::DateObjectImp::callAsFunction):
16573         (KJS::makeTime):
16574         * kjs/identifier.cpp:
16575         * kjs/internal.cpp:
16576         (KJS::initializeInterpreterLock):
16577         (KJS::lockInterpreter):
16578         (KJS::unlockInterpreter):
16579         (KJS::UndefinedImp::toPrimitive):
16580         (KJS::UndefinedImp::toBoolean):
16581         (KJS::UndefinedImp::toNumber):
16582         (KJS::UndefinedImp::toString):
16583         (KJS::NullImp::toPrimitive):
16584         (KJS::NullImp::toBoolean):
16585         (KJS::NullImp::toNumber):
16586         (KJS::NullImp::toString):
16587         (KJS::BooleanImp::toPrimitive):
16588         (KJS::BooleanImp::toBoolean):
16589         (KJS::BooleanImp::toNumber):
16590         (KJS::BooleanImp::toString):
16591         (KJS::StringImp::toPrimitive):
16592         (KJS::StringImp::toBoolean):
16593         (KJS::StringImp::toNumber):
16594         (KJS::StringImp::toString):
16595         * kjs/internal.h:
16596         * kjs/protected_values.cpp:
16597
16598 2005-10-03  Maciej Stachowiak  <mjs@apple.com>
16599
16600         - fix Development build after last checkin
16601
16602         * kxmlcore/FastMalloc.cpp:
16603         (KXMLCore::fastMallocRegisterThread):
16604
16605 2005-10-02  Maciej Stachowiak  <mjs@apple.com>
16606
16607         Reviewed by Darin.
16608
16609         <rdar://problem/4283967> REGRESSION: 3% regression on PLT from new FastMalloc
16610         http://bugs.webkit.org/show_bug.cgi?id=5243
16611         
16612         A number of optimizations to the new threadsafe malloc that make it actually as fast
16613         as dlmalloc (I measured wrong before) and as memory-efficient as the system malloc.
16614
16615         - use fastMalloc for everything - it now gets applied to all new/delete allocations
16616         via a private inline operator new that is now included into every file via config.h.
16617
16618         - tweaked some of the numeric parameters for size classes and amount of wasted memory
16619         allowed per allocation - this saves on memory use and consequently improves speed.
16620
16621         - so long as the allocator is not being used on background threads, get the per-thread
16622         cache from a global variable instead of from pthread_getspecific, since the latter is slow.
16623
16624         - inline more functions, and force the ones GCC refuses to inline with 
16625         attribute(always_inline), nearly all of these have one call site so inlining them has 
16626         to be a win.
16627
16628         - use some tricks to calculate allocation size more efficiently and fewer times for small
16629         allocations, to avoid hitting the huge size table array.
16630
16631         - avoid hitting the per-thread cache on code paths that don't need it.
16632
16633         - implement inline assembly version of spinlock for PowerPC (was already done for x86)
16634
16635         * bindings/NP_jsobject.cpp:
16636         * bindings/c/c_class.cpp:
16637         * bindings/c/c_instance.cpp:
16638         * bindings/c/c_runtime.cpp:
16639         * bindings/c/c_utility.cpp:
16640         * bindings/jni/jni_class.cpp:
16641         * bindings/jni/jni_instance.cpp:
16642         * bindings/jni/jni_jsobject.cpp:
16643         * bindings/jni/jni_objc.mm:
16644         * bindings/jni/jni_runtime.cpp:
16645         * bindings/jni/jni_utility.cpp:
16646         * bindings/npruntime.cpp:
16647         * bindings/objc/WebScriptObject.mm:
16648         * bindings/objc/objc_class.mm:
16649         * bindings/objc/objc_instance.mm:
16650         * bindings/objc/objc_runtime.mm:
16651         * bindings/objc/objc_utility.mm:
16652         * bindings/runtime.cpp:
16653         * bindings/runtime_array.cpp:
16654         * bindings/runtime_method.cpp:
16655         * bindings/runtime_object.cpp:
16656         * bindings/runtime_root.cpp:
16657         * bindings/testbindings.cpp:
16658         * bindings/testbindings.mm:
16659         * kjs/array_object.cpp:
16660         (ArrayInstanceImp::ArrayInstanceImp):
16661         (ArrayInstanceImp::~ArrayInstanceImp):
16662         (ArrayInstanceImp::resizeStorage):
16663         * kjs/bool_object.cpp:
16664         * kjs/collector.cpp:
16665         (KJS::Collector::registerThread):
16666         * kjs/config.h:
16667         * kjs/debugger.cpp:
16668         * kjs/error_object.cpp:
16669         * kjs/function.cpp:
16670         * kjs/function_object.cpp:
16671         * kjs/identifier.cpp:
16672         (KJS::Identifier::rehash):
16673         * kjs/internal.cpp:
16674         (KJS::Parser::saveNewNode):
16675         (KJS::clearNewNodes):
16676         * kjs/interpreter.cpp:
16677         * kjs/lexer.cpp:
16678         (Lexer::doneParsing):
16679         (Lexer::makeIdentifier):
16680         (Lexer::makeUString):
16681         * kjs/list.cpp:
16682         * kjs/math_object.cpp:
16683         * kjs/nodes.cpp:
16684         * kjs/nodes.h:
16685         * kjs/nodes2string.cpp:
16686         * kjs/number_object.cpp:
16687         (integer_part_noexp):
16688         (char_sequence):
16689         * kjs/object.cpp:
16690         * kjs/object_object.cpp:
16691         * kjs/property_map.cpp:
16692         * kjs/property_slot.cpp:
16693         * kjs/protected_values.cpp:
16694         (KJS::ProtectedValues::rehash):
16695         * kjs/reference.cpp:
16696         * kjs/reference_list.cpp:
16697         * kjs/regexp.cpp:
16698         * kjs/regexp_object.cpp:
16699         * kjs/scope_chain.cpp:
16700         * kjs/scope_chain.h:
16701         * kjs/string_object.cpp:
16702         * kjs/testkjs.cpp:
16703         * kjs/ustring.h:
16704         * kjs/value.cpp:
16705         * kxmlcore/Assertions.mm:
16706         * kxmlcore/FastMalloc.cpp:
16707         (KXMLCore::InitSizeClasses):
16708         (KXMLCore::DLL_IsEmpty):
16709         (KXMLCore::DLL_Prepend):
16710         (KXMLCore::TCMalloc_Central_FreeList::Insert):
16711         (KXMLCore::TCMalloc_Central_FreeList::Remove):
16712         (KXMLCore::TCMalloc_Central_FreeList::Populate):
16713         (KXMLCore::TCMalloc_ThreadCache::Allocate):
16714         (KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
16715         (KXMLCore::fastMallocRegisterThread):
16716         (KXMLCore::TCMalloc_ThreadCache::GetCache):
16717         (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
16718         (KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
16719         (KXMLCore::do_malloc):
16720         (KXMLCore::do_free):
16721         (KXMLCore::realloc):
16722         * kxmlcore/FastMalloc.h:
16723         (operator new):
16724         (operator delete):
16725         (operator new[]):
16726         (operator delete[]):
16727         * kxmlcore/HashTable.cpp:
16728         * kxmlcore/TCSpinLock.h:
16729         (TCMalloc_SpinLock::Lock):
16730         (TCMalloc_SpinLock::Unlock):
16731         (TCMalloc_SlowLock):
16732         * kxmlcore/TCSystemAlloc.cpp:
16733
16734 2005-09-30  Geoffrey Garen  <ggaren@apple.com>
16735
16736         - Second cut at fixing <rdar://problem/4275206> Denver Regression: Seed: 
16737           Past Editions of Opinions display "NAN/Undefined" for www.washingtonpost.com
16738                 
16739         Reviewed by john.
16740
16741         * kjs/date_object.cpp:
16742         (KJS::KRFCDate_parseDate): Intead of creating a timezone when one isn't specified,
16743         just rely on the fallback logic, which will do it for you. Also, return invalidDate
16744         if the date includes trailing garbage. (Somewhat accidentally, the timezone logic
16745         used to catch trailing garbage.)
16746
16747         Added test case to fast/js/date-parse-test.html.
16748
16749 2005-09-29  Eric Seidel  <eseidel@apple.com>
16750         Fix from Mitz Pettel <opendarwin.org@mitzpettel.com>
16751
16752         Reviewed by darin.
16753
16754         Fix JSC memory smasher in TOT.
16755         http://bugs.webkit.org/show_bug.cgi?id=5176
16756
16757         * pcre/pcre_exec.c:
16758         (match):
16759
16760 2005-09-29  Eric Seidel  <eseidel@apple.com>
16761         Fix from Mitz Pettel <opendarwin.org@mitzpettel.com>
16762
16763         Reviewed by mjs.
16764
16765         * JavaScriptCore.xcodeproj/project.pbxproj:
16766         Build fix for JSC+SVG after 5161.
16767         http://bugs.webkit.org/show_bug.cgi?id=5179
16768
16769 2005-09-28  Geoffrey Garen  <ggaren@apple.com>
16770
16771         - Fixed <rdar://problem/4275206> Denver Regression: Seed: Past Editions of Opinions display 
16772           "NAN/Undefined" for www.washingtonpost.com
16773           
16774         Reviewed by darin.
16775
16776         * kjs/date_object.cpp:
16777         (KJS::KRFCDate_parseDate): If the timezone isn't specified, rather than returning
16778         invalidDate, substitute the local timezone. This matches the behavior of FF/IE.
16779
16780 2005-09-28  Maciej Stachowiak  <mjs@apple.com>
16781
16782         Patch from George Staikos, reviewed by me.
16783
16784         - fixed some compile issues on Linux
16785         
16786         * kjs/property_slot.h:
16787         * kjs/simple_number.h:
16788
16789 2005-09-27  Maciej Stachowiak  <mjs@apple.com>
16790
16791         Reviewed by Eric.
16792
16793         - move HashMap/HashSet code down to JavaScriptCore
16794         http://bugs.webkit.org/show_bug.cgi?id=5161
16795         
16796         * JavaScriptCore.xcodeproj/project.pbxproj:
16797         * kjs/internal.cpp:
16798         (KJS::interpreterMap): Function that fetches the interpreter map on demand. 
16799         (KJS::InterpreterImp::InterpreterImp): Replace use of InterpreterMap
16800         class with an appropriate HashMap.
16801         (KJS::InterpreterImp::clear): ditto
16802         (KJS::InterpreterImp::interpreterWithGlobalObject): ditto
16803         * kjs/interpreter_map.cpp: Removed.
16804         * kjs/interpreter_map.h: Removed.
16805
16806         The HashMap/HashSet code (copied and slightly tweaked from WebCore)
16807         
16808         * kxmlcore/HashFunctions.h: Added.
16809         (KXMLCore::4):
16810         (KXMLCore::8):
16811         (KXMLCore::):
16812         (KXMLCore::PointerHash::hash):
16813         (KXMLCore::PointerHash::equal):
16814         * kxmlcore/HashMap.h: Added.
16815         (KXMLCore::extractFirst):
16816         (KXMLCore::HashMap::HashMap):
16817         (KXMLCore::::size):
16818         (KXMLCore::::capacity):
16819         (KXMLCore::::isEmpty):
16820         (KXMLCore::::begin):
16821         (KXMLCore::::end):
16822         (KXMLCore::::find):
16823         (KXMLCore::::contains):
16824         (KXMLCore::::set):
16825         (KXMLCore::::get):
16826         (KXMLCore::::remove):
16827         (KXMLCore::::clear):
16828         (KXMLCore::deleteAllValues):
16829         * kxmlcore/HashMapPtrSpec.h: Added.
16830         (KXMLCore::PointerHashIteratorAdapter::PointerHashIteratorAdapter):
16831         (KXMLCore::PointerHashIteratorAdapter::operator*):
16832         (KXMLCore::PointerHashIteratorAdapter::operator->):
16833         (KXMLCore::PointerHashIteratorAdapter::operator++):
16834         (KXMLCore::PointerHashIteratorAdapter::operator==):
16835         (KXMLCore::PointerHashIteratorAdapter::operator!=):
16836         (KXMLCore::PointerHashConstIteratorAdapter::PointerHashConstIteratorAdapter):
16837         (KXMLCore::PointerHashConstIteratorAdapter::operator*):
16838         (KXMLCore::PointerHashConstIteratorAdapter::operator->):
16839         (KXMLCore::PointerHashConstIteratorAdapter::operator++):
16840         (KXMLCore::PointerHashConstIteratorAdapter::operator==):
16841         (KXMLCore::PointerHashConstIteratorAdapter::operator!=):
16842         (KXMLCore::):
16843         * kxmlcore/HashSet.h: Added.
16844         (KXMLCore::identityExtract):
16845         (KXMLCore::convertAdapter):
16846         (KXMLCore::HashSet::HashSet):
16847         (KXMLCore::::size):
16848         (KXMLCore::::capacity):
16849         (KXMLCore::::isEmpty):
16850         (KXMLCore::::begin):
16851         (KXMLCore::::end):
16852         (KXMLCore::::find):
16853         (KXMLCore::::contains):
16854         (KXMLCore::::insert):
16855         (KXMLCore::::remove):
16856         (KXMLCore::::clear):
16857         * kxmlcore/HashTable.cpp: Added.
16858         (KXMLCore::HashTableStats::~HashTableStats):
16859         (KXMLCore::HashTableStats::recordCollisionAtCount):
16860         * kxmlcore/HashTable.h: Added.
16861         (KXMLCore::HashTableIterator::skipEmptyBuckets):
16862         (KXMLCore::HashTableIterator::HashTableIterator):
16863         (KXMLCore::HashTableIterator::operator*):
16864         (KXMLCore::HashTableIterator::operator->):
16865         (KXMLCore::HashTableIterator::operator++):
16866         (KXMLCore::HashTableIterator::operator==):
16867         (KXMLCore::HashTableIterator::operator!=):
16868         (KXMLCore::HashTableConstIterator::HashTableConstIterator):
16869         (KXMLCore::HashTableConstIterator::operator*):
16870         (KXMLCore::HashTableConstIterator::operator->):
16871         (KXMLCore::HashTableConstIterator::skipEmptyBuckets):
16872         (KXMLCore::HashTableConstIterator::operator++):
16873         (KXMLCore::HashTableConstIterator::operator==):
16874         (KXMLCore::HashTableConstIterator::operator!=):
16875         (KXMLCore::HashTable::HashTable):
16876         (KXMLCore::HashTable::~HashTable):
16877         (KXMLCore::HashTable::begin):
16878         (KXMLCore::HashTable::end):
16879         (KXMLCore::HashTable::size):
16880         (KXMLCore::HashTable::capacity):
16881         (KXMLCore::HashTable::insert):
16882         (KXMLCore::HashTable::isEmptyBucket):
16883         (KXMLCore::HashTable::isDeletedBucket):
16884         (KXMLCore::HashTable::isEmptyOrDeletedBucket):
16885         (KXMLCore::HashTable::hash):
16886         (KXMLCore::HashTable::equal):
16887         (KXMLCore::HashTable::identityConvert):
16888         (KXMLCore::HashTable::extractKey):
16889         (KXMLCore::HashTable::lookup):
16890         (KXMLCore::HashTable::shouldExpand):
16891         (KXMLCore::HashTable::mustRehashInPlace):
16892         (KXMLCore::HashTable::shouldShrink):
16893         (KXMLCore::HashTable::shrink):
16894         (KXMLCore::HashTable::clearBucket):
16895         (KXMLCore::HashTable::deleteBucket):
16896         (KXMLCore::HashTable::makeLookupResult):
16897         (KXMLCore::HashTable::makeIterator):
16898         (KXMLCore::HashTable::makeConstIterator):
16899         (KXMLCore::::lookup):
16900         (KXMLCore::::insert):
16901         (KXMLCore::::reinsert):
16902         (KXMLCore::::find):
16903         (KXMLCore::::contains):
16904         (KXMLCore::::remove):
16905         (KXMLCore::::allocateTable):
16906         (KXMLCore::::expand):
16907         (KXMLCore::::rehash):
16908         (KXMLCore::::clear):
16909         (KXMLCore::::HashTable):
16910         (KXMLCore::::swap):
16911         (KXMLCore::::operator):
16912         (KXMLCore::::checkTableConsistency):
16913         (KXMLCore::::checkTableConsistencyExceptSize):
16914         * kxmlcore/HashTraits.h: Added.
16915         (KXMLCore::HashTraits::emptyValue):
16916         (KXMLCore::):
16917         (KXMLCore::PairHashTraits::emptyValue):
16918         (KXMLCore::PairHashTraits::deletedValue):
16919
16920 2005-09-27  Darin Adler  <darin@apple.com>
16921
16922         Reviewed by Maciej.
16923
16924         - update grammar to fix conflicts; fixes one of our test cases
16925           because it resolves the relationship between function expressions
16926           and declarations in the way required by the ECMA specification
16927
16928         * kjs/grammar.y: Added lots of new grammar rules so we have no conflicts.
16929         A new set of rules for "no bracket or function at start of expression" and
16930         another set of rules for "no in anywhere in expression". Also simplified the
16931         handling of try to use only a single node and used operator precedence to
16932         get rid of the conflict in handling of if and else. Also used a macro to
16933         streamline the handling of automatic semicolons and changed parenthesis
16934         handling to use a virtual function.
16935
16936         * kjs/nodes.h: Added nodeInsideAllParens, removed unused abortStatement.
16937         (KJS::TryNode::TryNode): Updated to hold catch and finally blocks directly instead
16938         of using a special node for each.
16939         * kjs/nodes.cpp:
16940         (Node::createErrorCompletion): Added. Used instead of throwError when creating errors
16941         that should not be in a completion rather than an ExecState.
16942         (Node::throwUndefinedVariableError): Added. Sets source location unlike the call it
16943         replaces.
16944         (Node::nodeInsideAllParens): Added.
16945         (GroupNode::nodeInsideAllParens): Added.
16946         (StatListNode::execute): Removed code to move exceptions into completion objects;
16947         that's now done solely by the KJS_CHECKEXCEPTION macro.
16948         (TryNode::execute): Include execution of catch and finally here rather than using
16949         separate nodes.
16950         (FuncDeclNode::execute): Moved here, no longer inline.
16951         * kjs/nodes2string.cpp:
16952         (TryNode::streamTo): Updated for change.
16953         (FuncDeclNode::streamTo): Ditto.
16954         (FuncExprNode::streamTo): Ditto.
16955
16956         * kjs/kjs-test: Removed. Was part of "make check".
16957         * kjs/kjs-test.chk: Ditto.
16958         * kjs/test.js: Ditto.
16959
16960         * tests/mozilla/expected.html: Updated because one more test succeeds.
16961
16962 2005-09-27  Adele Peterson  <adele@apple.com>
16963
16964         Reviewed by Maciej.
16965
16966         Changed ints to size_t where appropriate.
16967
16968         * kjs/collector.cpp:
16969         (KJS::Collector::allocate):
16970         (KJS::Collector::markStackObjectsConservatively):
16971         (KJS::Collector::collect):
16972         (KJS::Collector::size):
16973         (KJS::Collector::numInterpreters):
16974         (KJS::Collector::numGCNotAllowedObjects):
16975         (KJS::Collector::numReferencedObjects):
16976         * kjs/collector.h:
16977
16978 2005-09-27  Eric Seidel  <eseidel@apple.com>
16979
16980         Reviewed by kevin.
16981
16982         * JavaScriptCore.xcodeproj/project.pbxproj: fix after malloc changes.
16983
16984 2005-09-27  Eric Seidel  <eseidel@apple.com>
16985
16986         Reviewed by mjs.
16987
16988         * kjs/nodes.cpp:
16989         (FuncExprNode::evaluate): Now sets .constructor properly.
16990         Test cases added to WebCore/layout-tests.
16991         http://bugs.webkit.org/show_bug.cgi?id=3537
16992
16993 2005-09-26  Maciej Stachowiak  <mjs@apple.com>
16994
16995         Reviewed by John.
16996
16997         - replace dlmalloc with tcmalloc
16998         http://bugs.webkit.org/show_bug.cgi?id=5145
16999
17000         I also moved SharedPtr and the assertion code from WebCore into a
17001         new kxmlcore directory.
17002         
17003         * JavaScriptCore.xcodeproj/project.pbxproj:
17004         * kjs/collector.cpp:
17005         (KJS::Collector::allocate):
17006         (KJS::Collector::collect):
17007         * kjs/config.h:
17008         * kjs/fast_malloc.cpp: Removed.
17009         * kjs/fast_malloc.h: Removed.
17010         * kjs/function.cpp:
17011         * kjs/function.h:
17012         * kjs/function_object.cpp:
17013         * kjs/identifier.cpp:
17014         (KJS::Identifier::add):
17015         * kjs/internal.cpp:
17016         * kjs/internal.h:
17017         * kjs/nodes.h:
17018         * kjs/nodes2string.cpp:
17019         * kjs/property_map.cpp:
17020         (KJS::PropertyMap::~PropertyMap):
17021         (KJS::PropertyMap::rehash):
17022         * kjs/scope_chain.h:
17023         * kjs/shared_ptr.h: Removed.
17024         * kjs/string_object.cpp:
17025         (StringObjectFuncImp::callAsFunction):
17026         * kjs/ustring.cpp:
17027         (KJS::UString::Rep::createCopying):
17028         (KJS::UString::Rep::destroy):
17029         (KJS::UString::expandCapacity):
17030         (KJS::UString::expandPreCapacity):
17031         (KJS::UString::UString):
17032         (KJS::UString::spliceSubstringsWithSeparators):
17033         (KJS::UString::append):
17034         (KJS::UString::operator=):
17035         (KJS::UString::detach):
17036         * kjs/ustring.h:
17037         * kxmlcore/Assertions.h: Added.
17038         * kxmlcore/Assertions.mm: Added.
17039         * kxmlcore/FastMalloc.cpp: Added.
17040         (KXMLCore::LgFloor):
17041         (KXMLCore::SizeClass):
17042         (KXMLCore::ByteSizeForClass):
17043         (KXMLCore::InitSizeClasses):
17044         (KXMLCore::MetaDataAlloc):
17045         (KXMLCore::PageHeapAllocator::Init):
17046         (KXMLCore::PageHeapAllocator::New):
17047         (KXMLCore::PageHeapAllocator::Delete):
17048         (KXMLCore::PageHeapAllocator::inuse):
17049         (KXMLCore::pages):
17050         (KXMLCore::AllocationSize):
17051         (KXMLCore::Event):
17052         (KXMLCore::NewSpan):
17053         (KXMLCore::DeleteSpan):
17054         (KXMLCore::DLL_Init):
17055         (KXMLCore::DLL_Remove):
17056         (KXMLCore::DLL_IsEmpty):
17057         (KXMLCore::DLL_Length):
17058         (KXMLCore::DLL_Print):
17059         (KXMLCore::DLL_Prepend):
17060         (KXMLCore::DLL_InsertOrdered):
17061         (KXMLCore::):
17062         (KXMLCore::TCMalloc_PageHeap::GetDescriptor):
17063         (KXMLCore::TCMalloc_PageHeap::SystemBytes):
17064         (KXMLCore::TCMalloc_PageHeap::FreeBytes):
17065         (KXMLCore::TCMalloc_PageHeap::RecordSpan):
17066         (KXMLCore::TCMalloc_PageHeap::TCMalloc_PageHeap):
17067         (KXMLCore::TCMalloc_PageHeap::New):
17068         (KXMLCore::TCMalloc_PageHeap::Split):
17069         (KXMLCore::TCMalloc_PageHeap::Carve):
17070         (KXMLCore::TCMalloc_PageHeap::Delete):
17071         (KXMLCore::TCMalloc_PageHeap::RegisterSizeClass):
17072         (KXMLCore::TCMalloc_PageHeap::Dump):
17073         (KXMLCore::TCMalloc_PageHeap::GrowHeap):
17074         (KXMLCore::TCMalloc_PageHeap::Check):
17075         (KXMLCore::TCMalloc_PageHeap::CheckList):
17076         (KXMLCore::TCMalloc_ThreadCache_FreeList::Init):
17077         (KXMLCore::TCMalloc_ThreadCache_FreeList::length):
17078         (KXMLCore::TCMalloc_ThreadCache_FreeList::empty):
17079         (KXMLCore::TCMalloc_ThreadCache_FreeList::lowwatermark):
17080         (KXMLCore::TCMalloc_ThreadCache_FreeList::clear_lowwatermark):
17081         (KXMLCore::TCMalloc_ThreadCache_FreeList::Push):
17082         (KXMLCore::TCMalloc_ThreadCache_FreeList::Pop):
17083         (KXMLCore::TCMalloc_ThreadCache::freelist_length):
17084         (KXMLCore::TCMalloc_ThreadCache::Size):
17085         (KXMLCore::TCMalloc_Central_FreeList::length):
17086         (KXMLCore::TCMalloc_Central_FreeList::Init):
17087         (KXMLCore::TCMalloc_Central_FreeList::Insert):
17088         (KXMLCore::TCMalloc_Central_FreeList::Remove):
17089         (KXMLCore::TCMalloc_Central_FreeList::Populate):
17090         (KXMLCore::TCMalloc_ThreadCache::SampleAllocation):
17091         (KXMLCore::TCMalloc_ThreadCache::Init):
17092         (KXMLCore::TCMalloc_ThreadCache::Cleanup):
17093         (KXMLCore::TCMalloc_ThreadCache::Allocate):
17094         (KXMLCore::TCMalloc_ThreadCache::Deallocate):
17095         (KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
17096         (KXMLCore::TCMalloc_ThreadCache::ReleaseToCentralCache):
17097         (KXMLCore::TCMalloc_ThreadCache::Scavenge):
17098         (KXMLCore::TCMalloc_ThreadCache::GetCache):
17099         (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
17100         (KXMLCore::TCMalloc_ThreadCache::PickNextSample):
17101         (KXMLCore::TCMalloc_ThreadCache::InitModule):
17102         (KXMLCore::TCMalloc_ThreadCache::InitTSD):
17103         (KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
17104         (KXMLCore::TCMalloc_ThreadCache::DeleteCache):
17105         (KXMLCore::TCMalloc_ThreadCache::RecomputeThreadCacheSize):
17106         (KXMLCore::TCMalloc_ThreadCache::Print):
17107         (KXMLCore::ExtractStats):
17108         (KXMLCore::DumpStats):
17109         (KXMLCore::PrintStats):
17110         (KXMLCore::DumpStackTraces):
17111         (KXMLCore::TCMallocImplementation::GetStats):
17112         (KXMLCore::TCMallocImplementation::ReadStackTraces):
17113         (KXMLCore::TCMallocImplementation::GetNumericProperty):
17114         (KXMLCore::TCMallocImplementation::SetNumericProperty):
17115         (KXMLCore::DoSampledAllocation):
17116         (KXMLCore::do_malloc):
17117         (KXMLCore::do_free):
17118         (KXMLCore::do_memalign):
17119         (KXMLCore::TCMallocGuard::TCMallocGuard):
17120         (KXMLCore::TCMallocGuard::~TCMallocGuard):
17121         (KXMLCore::malloc):
17122         (KXMLCore::free):
17123         (KXMLCore::calloc):
17124         (KXMLCore::cfree):
17125         (KXMLCore::realloc):
17126         (KXMLCore::memalign):
17127         (KXMLCore::posix_memalign):
17128         (KXMLCore::valloc):
17129         (KXMLCore::pvalloc):
17130         (KXMLCore::malloc_stats):
17131         (KXMLCore::mallopt):
17132         (KXMLCore::mallinfo):
17133         * kxmlcore/FastMalloc.h: Added.
17134         (KXMLCore::FastAllocated::operator new):
17135         (KXMLCore::FastAllocated::operator delete):
17136         (KXMLCore::FastAllocated::operator new[]):
17137         (KXMLCore::FastAllocated::operator delete[]):
17138         * kxmlcore/SharedPtr.h: Added.
17139         (KXMLCore::SharedPtr::SharedPtr):
17140         (KXMLCore::SharedPtr::~SharedPtr):
17141         (KXMLCore::SharedPtr::isNull):
17142         (KXMLCore::SharedPtr::notNull):
17143         (KXMLCore::SharedPtr::reset):
17144         (KXMLCore::SharedPtr::get):
17145         (KXMLCore::SharedPtr::operator*):
17146         (KXMLCore::SharedPtr::operator->):
17147         (KXMLCore::SharedPtr::operator!):
17148         (KXMLCore::SharedPtr::operator bool):
17149         (KXMLCore::::operator):
17150         (KXMLCore::operator==):
17151         (KXMLCore::operator!=):
17152         (KXMLCore::static_pointer_cast):
17153         (KXMLCore::const_pointer_cast):
17154         * kxmlcore/TCPageMap.h: Added.
17155         (TCMalloc_PageMap1::TCMalloc_PageMap1):
17156         (TCMalloc_PageMap1::Ensure):
17157         (TCMalloc_PageMap1::get):
17158         (TCMalloc_PageMap1::set):
17159         (TCMalloc_PageMap2::TCMalloc_PageMap2):
17160         (TCMalloc_PageMap2::get):
17161         (TCMalloc_PageMap2::set):
17162         (TCMalloc_PageMap2::Ensure):
17163         (TCMalloc_PageMap3::NewNode):
17164         (TCMalloc_PageMap3::TCMalloc_PageMap3):
17165         (TCMalloc_PageMap3::get):
17166         (TCMalloc_PageMap3::set):
17167         (TCMalloc_PageMap3::Ensure):
17168         * kxmlcore/TCSpinLock.h: Added.
17169         (TCMalloc_SpinLock::Init):
17170         (TCMalloc_SpinLock::Finalize):
17171         (TCMalloc_SpinLock::Lock):
17172         (TCMalloc_SpinLock::Unlock):
17173         (TCMalloc_SlowLock):
17174         (TCMalloc_SpinLockHolder::TCMalloc_SpinLockHolder):
17175         (TCMalloc_SpinLockHolder::~TCMalloc_SpinLockHolder):
17176         * kxmlcore/TCSystemAlloc.cpp: Added.
17177         (TrySbrk):
17178         (TryMmap):
17179         (TryDevMem):
17180         (TCMalloc_SystemAlloc):
17181         * kxmlcore/TCSystemAlloc.h: Added.
17182
17183 2005-09-23  Maciej Stachowiak  <mjs@apple.com>
17184
17185         Reviewed by Darin.
17186
17187         <rdar://problem/4260479> Finish deploying PropertySlot in the interpreter
17188         http://bugs.webkit.org/show_bug.cgi?id=5112
17189         
17190         Convert postfix, prefix, delete, prefix, and for..in expressions to use
17191         PropertySlot-based lookup instead of evaluateReference.
17192
17193         3% speedup on JS iBench.
17194
17195         Fixed two of the JS tests:
17196         * tests/mozilla/expected.html:
17197
17198         * kjs/grammar.y:
17199         * kjs/nodes.cpp:
17200         (PostfixResolveNode::evaluate):
17201         (PostfixBracketNode::evaluate):
17202         (PostfixDotNode::evaluate):
17203         (DeleteResolveNode::evaluate):
17204         (DeleteBracketNode::evaluate):
17205         (DeleteDotNode::evaluate):
17206         (DeleteValueNode::evaluate):
17207         (typeStringForValue):
17208         (TypeOfResolveNode::evaluate):
17209         (TypeOfValueNode::evaluate):
17210         (PrefixResolveNode::evaluate):
17211         (PrefixBracketNode::evaluate):
17212         (PrefixDotNode::evaluate):
17213         (ForInNode::execute):
17214         * kjs/nodes.h:
17215         (KJS::PostfixResolveNode::PostfixResolveNode):
17216         (KJS::PostfixBracketNode::PostfixBracketNode):
17217         (KJS::PostfixDotNode::PostfixDotNode):
17218         (KJS::DeleteResolveNode::DeleteResolveNode):
17219         (KJS::DeleteBracketNode::DeleteBracketNode):
17220         (KJS::DeleteDotNode::DeleteDotNode):
17221         (KJS::DeleteValueNode::DeleteValueNode):
17222         (KJS::TypeOfResolveNode::TypeOfResolveNode):
17223         (KJS::TypeOfValueNode::TypeOfValueNode):
17224         (KJS::PrefixResolveNode::PrefixResolveNode):
17225         (KJS::PrefixBracketNode::PrefixBracketNode):
17226         (KJS::PrefixDotNode::PrefixDotNode):
17227         * kjs/nodes2string.cpp:
17228         (PostfixResolveNode::streamTo):
17229         (PostfixBracketNode::streamTo):
17230         (PostfixDotNode::streamTo):
17231         (DeleteResolveNode::streamTo):
17232         (DeleteBracketNode::streamTo):
17233         (DeleteDotNode::streamTo):
17234         (DeleteValueNode::streamTo):
17235         (TypeOfValueNode::streamTo):
17236         (TypeOfResolveNode::streamTo):
17237         (PrefixResolveNode::streamTo):
17238         (PrefixBracketNode::streamTo):
17239         (PrefixDotNode::streamTo):
17240         * kjs/reference.cpp:
17241         (KJS::Reference::Reference):
17242         (KJS::Reference::getPropertyName):
17243         (KJS::Reference::getValue):
17244         (KJS::Reference::deleteValue):
17245         * kjs/reference.h:
17246
17247 2005-09-23  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
17248
17249         Reviewed and landed by Darin.
17250
17251         - a Windows-specific file
17252
17253         * os-win32/stdint.h: Added. We plan to remove dependency on the <stdint.h> types,
17254         and if we do so, we will remove this file.
17255
17256 2005-09-22  Geoffrey Garen  <ggaren@apple.com>
17257
17258         - Fixed http://bugs.webkit.org/show_bug.cgi?id=5053
17259         Need to restore int/long changes to simple_number.h
17260         
17261         Reviewed by darin and mjs.
17262
17263         * kjs/simple_number.h: changed enums to indenpendent constants to clarify types
17264         (KJS::isNegativeZero): changed to static function - no reason to export
17265         (KJS::SimpleNumber::rightShiftSignExtended): new function for clarity
17266         (KJS::SimpleNumber::make): specified cast as reinterpret_cast
17267         (KJS::SimpleNumber::is): changed to use uintptr_t for portability
17268         (KJS::SimpleNumber::value): changed to use uintptr_t and rightShiftSignExtended
17269         (KJS::SimpleNumber::fits): inverted tests - probably only a performance win for double
17270         (KJS::SimpleNumber::integerFits): ditto
17271
17272 2005-09-20  Maciej Stachowiak  <mjs@apple.com>
17273
17274         Reviewed by Geoff and partly by Darin.
17275
17276         - fixed http://bugs.webkit.org/post_bug.cgi
17277         (Reduce conflicts in JavaScriptCore grammar)
17278
17279         This change gets us down from over 200 shift/reduce and 45 reduce/reduce to
17280         9 shift/reduce and 45 reduce/reduce.
17281
17282         * kjs/grammar.y:
17283         * kjs/grammar_types.h: Removed.
17284         * kjs/lexer.cpp:
17285         * kjs/nodes.h:
17286         (KJS::Node::isGroupNode):
17287         (KJS::Node::isLocation):
17288         (KJS::Node::isResolveNode):
17289         (KJS::Node::isBracketAccessorNode):
17290         (KJS::Node::isDotAccessorNode):
17291         (KJS::ResolveNode::isLocation):
17292         (KJS::ResolveNode::isResolveNode):
17293         (KJS::ResolveNode::identifier):
17294         (KJS::GroupNode::isGroupNode):
17295         (KJS::GroupNode::leafNode):
17296         (KJS::BracketAccessorNode::isLocation):
17297         (KJS::BracketAccessorNode::isBracketAccessorNode):
17298         (KJS::BracketAccessorNode::base):
17299         (KJS::BracketAccessorNode::subscript):
17300         (KJS::DotAccessorNode::isLocation):
17301         (KJS::DotAccessorNode::isDotAccessorNode):
17302         (KJS::DotAccessorNode::base):
17303         (KJS::DotAccessorNode::identifier):
17304         (KJS::FuncExprNode::FuncExprNode):
17305         (KJS::FuncExprNode::identifier):
17306         (KJS::FuncDeclNode::FuncDeclNode):
17307         (KJS::FuncDeclNode::execute):
17308
17309 2005-09-20  Geoffrey Garen  <ggaren@apple.com>
17310
17311         - Oops. The 4263434 change was only appropriate on the branch. Rolling out.
17312         
17313         Reviewed by eric.
17314         
17315         * kjs/internal.cpp:
17316         (KJS::InterpreterImp::mark):
17317
17318 2005-09-20  Geoffrey Garen  <ggaren@apple.com>
17319
17320         - More changes needed to fix <rdar://problem/4214783> 8F29 REGRESSION(Denver/Chardonnay):
17321           kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in
17322           the installer)
17323           
17324         Added InterpreterLocks in some places in the bindings we missed before.
17325         
17326         Reviewed by john.
17327
17328         * bindings/runtime_root.cpp:
17329         (KJS::Bindings::addNativeReference):
17330         (KJS::Bindings::removeNativeReference):
17331         (RootObject::removeAllNativeReferences):
17332         * bindings/runtime_root.h:
17333         (KJS::Bindings::RootObject::~RootObject):
17334         (KJS::Bindings::RootObject::setRootObjectImp):
17335
17336 2005-09-20  Geoffrey Garen  <ggaren@apple.com>
17337
17338         - Fixed <rdar://problem/4263434> <rdar://problem/4263434> Denver 8F29 Regression:
17339           KJS::InterpreterImp::mark() crash
17340           
17341         Fix by mjs, review by me.
17342
17343         * kjs/internal.cpp:
17344         (KJS::InterpreterImp::mark): Added a null check on globExec in case a
17345         garbage collection occurs inside InterpreterImp::globalInit (called
17346         from InterpreterImp::InterpreterImp), at which point globExec has not yet been initialized.
17347
17348 2005-09-20  Geoffrey Garen  <ggaren@apple.com>
17349
17350         - Rolled in fix for http://bugs.webkit.org/show_bug.cgi?id=4892
17351           Date constructor has problems with months larger than 11
17352
17353         Test cases added:
17354
17355         * layout-tests/fast/js/date-big-constructor-expected.txt: Added.
17356         * layout-tests/fast/js/date-big-constructor.html: Added.
17357
17358         Reviewed by darin.
17359
17360         * kjs/date_object.cpp:
17361         (KJS::fillStructuresUsingDateArgs):
17362         (KJS::makeTime):
17363
17364 2005-09-19  Geoffrey Garen  <ggaren@apple.com>
17365
17366         - Fixed http://bugs.webkit.org/show_bug.cgi?id=5028
17367           9 layout tests fail following the change from long to int
17368           
17369         - Rolled out changes to simple_number.h, and added fits(long long) 
17370           and SimpleNumber::fits(unsigned long long) to the old system.
17371         
17372         Reviewed by mjs.
17373
17374         * kjs/simple_number.h:
17375         (KJS::SimpleNumber::):
17376         (KJS::SimpleNumber::value):
17377         (KJS::SimpleNumber::fits):
17378         (KJS::SimpleNumber::integerFits):
17379         (KJS::SimpleNumber::make):
17380
17381 2005-09-14  Maciej Stachowiak  <mjs@apple.com>
17382
17383         Reviewed by Geoff.
17384
17385         - fixed <rdar://problem/4214783> REGRESSION: kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in the installer)
17386
17387         Make sure to lock using the InterpreterLock class in all places that need it
17388         (including anything that uses the collector, the parser, the protect count hash table,
17389         and anything that allocates via fast_malloc).
17390
17391         Also added assertions to ensure that the locking rules are followed for the relevant
17392         resources.
17393
17394         * Makefile.am:
17395         * bindings/NP_jsobject.cpp:
17396         (identifierFromNPIdentifier):
17397         (_NPN_Invoke):
17398         (_NPN_Evaluate):
17399         (_NPN_GetProperty):
17400         (_NPN_SetProperty):
17401         (_NPN_RemoveProperty):
17402         (_NPN_HasProperty):
17403         (_NPN_HasMethod):
17404         (_NPN_SetException):
17405         * bindings/jni/jni_jsobject.cpp:
17406         (JSObject::call):
17407         (JSObject::eval):
17408         (JSObject::getMember):
17409         (JSObject::setMember):
17410         (JSObject::removeMember):
17411         (JSObject::getSlot):
17412         (JSObject::setSlot):
17413         (JSObject::toString):
17414         (JSObject::convertJObjectToValue):
17415         * bindings/objc/WebScriptObject.mm:
17416         (-[WebScriptObject callWebScriptMethod:withArguments:]):
17417         (-[WebScriptObject evaluateWebScript:]):
17418         (-[WebScriptObject setValue:forKey:]):
17419         (-[WebScriptObject valueForKey:]):
17420         (-[WebScriptObject removeWebScriptKey:]):
17421         (-[WebScriptObject stringRepresentation]):
17422         (-[WebScriptObject webScriptValueAtIndex:]):
17423         (-[WebScriptObject setWebScriptValueAtIndex:value:]):
17424         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
17425         * bindings/runtime.cpp:
17426         (Instance::createRuntimeObject):
17427         * bindings/runtime_root.h:
17428         * bindings/testbindings.cpp:
17429         (main):
17430         * bindings/testbindings.mm:
17431         (main):
17432         * kjs/fast_malloc.cpp:
17433         (KJS::kjs_fast_malloc):
17434         (KJS::kjs_fast_calloc):
17435         (KJS::kjs_fast_free):
17436         (KJS::kjs_fast_realloc):
17437         * kjs/fast_malloc.h:
17438         * kjs/identifier.h:
17439         * kjs/internal.cpp:
17440         (InterpreterImp::InterpreterImp):
17441         (InterpreterImp::clear):
17442         (InterpreterImp::mark):
17443         (InterpreterImp::checkSyntax):
17444         (InterpreterImp::evaluate):
17445         * kjs/internal.h:
17446         (KJS::InterpreterImp::globalObject):
17447         * kjs/interpreter.cpp:
17448         (Interpreter::evaluate):
17449         * kjs/interpreter.h:
17450         (KJS::InterpreterLock::InterpreterLock):
17451         (KJS::InterpreterLock::~InterpreterLock):
17452         * kjs/nodes.h:
17453         * kjs/protect.h:
17454         (KJS::ProtectedValue::ProtectedValue):
17455         (KJS::ProtectedValue::~ProtectedValue):
17456         (KJS::ProtectedValue::operator=):
17457         (KJS::ProtectedObject::ProtectedObject):
17458         (KJS::ProtectedObject::~ProtectedObject):
17459         (KJS::ProtectedObject::operator=):
17460         (KJS::ProtectedReference::ProtectedReference):
17461         (KJS::ProtectedReference::~ProtectedReference):
17462         (KJS::ProtectedReference::operator=):
17463         * kjs/protected_object.h:
17464         * kjs/protected_values.cpp:
17465         (KJS::ProtectedValues::getProtectCount):
17466         (KJS::ProtectedValues::increaseProtectCount):
17467         (KJS::ProtectedValues::decreaseProtectCount):
17468         * kjs/string_object.cpp:
17469         (StringObjectImp::StringObjectImp):
17470         * kjs/testkjs.cpp:
17471         (main):
17472
17473 2005-09-16  Adele Peterson  <adele@apple.com>
17474
17475         Change by Darin, reviewed by me and Maciej.
17476
17477         Fixes http://bugs.webkit.org/show_bug.cgi?id=4547
17478         use int instead of long for 32-bit (to prepare for LP64 compiling)
17479
17480         * bindings/c/c_class.h:
17481         (KJS::Bindings::CClass::constructorAt):
17482         (KJS::Bindings::CClass::numConstructors):
17483         * bindings/c/c_runtime.h:
17484         (KJS::Bindings::CMethod::numParameters):
17485         * bindings/jni/jni_class.cpp:
17486         (JavaClass::JavaClass):
17487         * bindings/jni/jni_class.h:
17488         (KJS::Bindings::JavaClass::constructorAt):
17489         (KJS::Bindings::JavaClass::numConstructors):
17490         * bindings/jni/jni_instance.cpp:
17491         (JavaInstance::invokeMethod):
17492         * bindings/jni/jni_jsobject.cpp:
17493         (JSObject::convertJObjectToValue):
17494         (JSObject::listFromJArray):
17495         * bindings/jni/jni_runtime.cpp:
17496         (JavaMethod::JavaMethod):
17497         * bindings/jni/jni_runtime.h:
17498         (KJS::Bindings::JavaConstructor::_commonCopy):
17499         (KJS::Bindings::JavaConstructor::parameterAt):
17500         (KJS::Bindings::JavaConstructor::numParameters):
17501         (KJS::Bindings::JavaMethod::_commonCopy):
17502         (KJS::Bindings::JavaMethod::parameterAt):
17503         (KJS::Bindings::JavaMethod::numParameters):
17504         * bindings/npapi.h:
17505         * bindings/objc/WebScriptObject.mm:
17506         (listFromNSArray):
17507         * bindings/objc/objc_class.h:
17508         (KJS::Bindings::ObjcClass::constructorAt):
17509         (KJS::Bindings::ObjcClass::numConstructors):
17510         * bindings/objc/objc_instance.h:
17511         * bindings/objc/objc_runtime.h:
17512         * bindings/objc/objc_runtime.mm:
17513         (ObjcMethod::numParameters):
17514         * bindings/runtime.h:
17515         * kjs/identifier.h:
17516         * kjs/internal.h:
17517         * kjs/property_slot.h:
17518         (KJS::PropertySlot::setCustomIndex):
17519         (KJS::PropertySlot::index):
17520         (KJS::PropertySlot::):
17521         * kjs/regexp_object.cpp:
17522         (RegExpObjectImp::backrefGetter):
17523         (RegExpObjectImp::getOwnPropertySlot):
17524         * kjs/simple_number.h:
17525         (KJS::SimpleNumber::):
17526         (KJS::SimpleNumber::value):
17527         (KJS::SimpleNumber::fits):
17528         (KJS::SimpleNumber::integerFits):
17529         (KJS::SimpleNumber::make):
17530         * kjs/string_object.cpp:
17531         (substituteBackreferences):
17532         * kjs/ustring.cpp:
17533         (KJS::UString::from):
17534         (KJS::UString::toUInt32):
17535         (KJS::UString::find):
17536         (KJS::UString::rfind):
17537         * kjs/ustring.h:
17538         * kjs/value.cpp:
17539         (KJS::jsNumber):
17540         * kjs/value.h:
17541
17542 2005-09-11  Eric Seidel  <eseidel@apple.com>
17543
17544         No review requested, build fix affects only SVG.
17545
17546         * JavaScriptCore.xcodeproj/project.pbxproj: Fixed JSC+SVG
17547         Fixed JavaScriptCore+SVG after PCRE 6.1 merger.
17548         http://bugs.webkit.org/show_bug.cgi?id=4932
17549
17550 2005-09-10  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
17551
17552         Reviewed and landed by Darin.
17553
17554         * Makefile.vc: Added.
17555         * README-Win32.txt: Added.
17556
17557 2005-09-10  Darin Adler  <darin@apple.com>
17558
17559         - fixed compilation for WebCore (another try)
17560
17561         * kjs/simple_number.h: Added more "using" lines.
17562
17563 2005-09-10  Darin Adler  <darin@apple.com>
17564
17565         - fixed compilation for WebCore
17566
17567         * kjs/simple_number.h: Have to include <cmath> here to work around a bug in the GCC
17568         standard C++ library headers.
17569
17570 2005-09-10  Darin Adler  <darin@apple.com>
17571
17572         Windows changes by Krzysztof Kowalczyk <kkowalczyk@gmail.com>.
17573
17574         - fixed http://bugs.webkit.org/show_bug.cgi?id=4870
17575           win portability: fix IS_NEGATIVE_ZERO macro in simple_number.h
17576
17577         * kjs/simple_number.h:
17578         (KJS::isNegativeZero): Added. Inline function. Has a case for Windows that
17579         uses _fpclass and a case for other platforms that uses signbit.
17580         (KJS::SimpleNumber::fits): Use inline isNegativeZero instead of macro IS_NEGATIVE_ZERO.
17581
17582         * kjs/internal.cpp: Remove definition of now-unneeded negZero global.
17583
17584         * kjs/value.cpp: Touched the file because Xcode didn't know it needed to
17585         recompile it.
17586
17587         - improved test engine
17588
17589         * tests/mozilla/jsDriver.pl: Sort tests in numeric order instead of using
17590         a plain-ASCII sort; now test 33 will be after test 5 in any given set of
17591         numbered tests.
17592
17593 2005-09-08  Darin Adler  <darin@apple.com>
17594
17595         - fixed overloaded versions of throwError so that they substitute *all* 
17596           expected parameters into the message string -- some versions used to
17597           skip parameters, resulting in "%s" being printed in the error message.
17598         
17599         Reviewed by Geoff.
17600
17601         * kjs/nodes.h: Updated declarations to use "const &" and not to name parameters
17602         * kjs/nodes.cpp: (Node::throwError): Updated to match above and add one missing
17603         call to substitute.
17604
17605 2005-09-08  Darin Adler  <darin@apple.com>
17606
17607         Reviewed by Geoff.
17608
17609         - updated to PCRE 6.1
17610
17611         The original PCRE 6.1 sources are checked into the tree with the tag
17612         "pcre-6-1" for reference. What we're checking in right now is the original
17613         plus our changes to make it support UTF-16 and at least one other tweak
17614         (vertical tab considered whitespace). Our work to get our changes was
17615         done on "pcre-6-1-branch", with an anchor at "pcre-6-1-anchor" so you can
17616         see the evolution of the UTF-16 changes.
17617         
17618         Note also that there was one small change made here that's not on the branch
17619         in pcre_compile.c.
17620
17621         * Info.plist: Updated the part of the copyright message that's about PCRE.
17622
17623         * JavaScriptCore.xcodeproj/project.pbxproj: Added new PCRE source files,
17624         removed obsolete ones.
17625
17626         * pcre/AUTHORS: Updated to PCRE 6.1. Includes credits for Apple's UTF-16
17627         changes, but not the credits for Google's C++ wrapper, since we don't include that.
17628         * pcre/COPYING: Updated to PCRE 6.1.
17629         * pcre/LICENCE: Ditto.
17630         * pcre/dftables.c: Ditto.
17631         * pcre/pcre-config.h: Ditto.
17632         * pcre/pcre.h: Ditto.
17633
17634         * pcre/pcre_compile.c: Added for PCRE 6.1.
17635         * pcre/pcre_config.c: Ditto.
17636         * pcre/pcre_exec.c: Ditto.
17637         * pcre/pcre_fullinfo.c: Ditto.
17638         * pcre/pcre_get.c: Ditto.
17639         * pcre/pcre_globals.c: Ditto.
17640         * pcre/pcre_info.c: Ditto.
17641         * pcre/pcre_internal.h: Ditto.
17642         * pcre/pcre_maketables.c: Ditto.
17643         * pcre/pcre_ord2utf8.c: Ditto.
17644         * pcre/pcre_printint.c: Ditto.
17645         * pcre/pcre_refcount.c: Ditto.
17646         * pcre/pcre_study.c: Ditto.
17647         * pcre/pcre_tables.c: Ditto.
17648         * pcre/pcre_try_flipped.c: Ditto.
17649         * pcre/pcre_ucp_findchar.c: Ditto.
17650         * pcre/pcre_version.c: Ditto.
17651         * pcre/pcre_xclass.c: Ditto.
17652         * pcre/ucp.h: Ditto.
17653         * pcre/ucp_findchar.c: Ditto.
17654         * pcre/ucpinternal.h: Ditto.
17655         * pcre/ucptable.c: Ditto.
17656
17657         * pcre/get.c: Removed.
17658         * pcre/internal.h: Removed.
17659         * pcre/maketables.c: Removed.
17660         * pcre/pcre.c: Removed.
17661         * pcre/study.c: Removed.
17662
17663 2005-09-07  Geoffrey Garen  <ggaren@apple.com>
17664
17665         -fixed http://bugs.webkit.org/show_bug.cgi?id=4781
17666         Date.setMonth fails with big values due to overflow
17667
17668         Reviewed by darin.
17669
17670         * kjs/date_object.cpp:
17671         (timetUsingCF): for consistency, changed return statement to invalidDate instead of LONG_MAX
17672         (KJS::fillStructuresUsingTimeArgs): modified for readability
17673         (KJS::fillStructuresUsingDateArgs): new function analogous to fillStructuresUsingTimeArgs
17674         (KJS::DateProtoFuncImp::callAsFunction): modified to use fillStructuresUsingDateArgs
17675         (KJS::DateObjectImp::construct): moved variable declaration to proper scope
17676         (KJS::DateObjectFuncImp::callAsFunction): moved variable declaration to proper scope
17677
17678 2005-09-07  Geoffrey Garen  <ggaren@apple.com>
17679         -updated expected test results to reflect fix for 
17680         http://bugs.webkit.org/show_bug.cgi?id=4698
17681         kjs does not allow named functions in function expressions
17682  
17683         * tests/mozilla/expected.html:
17684
17685 2005-09-04  Darin Adler  <darin@apple.com>
17686
17687         * kjs/identifier.cpp: Fix comment, add missing include.
17688         (Follow-on to changes from yesterday.)
17689
17690 2005-09-03  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
17691
17692         Reviewed, tweaked and landed by Darin.
17693
17694         - another try at some of the Windows compilation fixes
17695           should fix these bugs: 4546, 4831, 4834, 4643, 4830, 4832, 4833, 4835
17696
17697         * kjs/collector.cpp: Add missing <setjmp.h> include.
17698         * kjs/date_object.cpp: Fix broken copysign macro.
17699         * kjs/dtoa.cpp: Move macro definitions down after all header includes.
17700         * kjs/fast_malloc.cpp: Add missing <assert.h> and <stddef.h> includes.
17701         * kjs/function.cpp: Remove broken isxdigit definition.
17702         * kjs/grammar.y: Add a missing semicolon (and remove an excess one).
17703         * kjs/identifier.cpp: Turn off AVOID_STATIC_CONSTRUCTORS because the placement new syntax
17704         doesn't seem to work in Visual C++ (I'm surprised to hear that, by the way).
17705         * kjs/value.h: Made ValueImp's destructor virtual because otherwise pointers to ValueImp
17706         on the stack aren't right for garbage collection on Windows (don't think it works that
17707         way with gcc's virtual table scheme, but it's a harmless change).
17708
17709 2005-09-03  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
17710
17711         Reviewed, tweaked and landed by Darin.
17712
17713         - some Windows compilation fixes, hoping to fix the problems reported in these bugs:
17714           4627, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4639, 4640, 4641, 4644, 4645
17715
17716         * kjs/collector.cpp: Include <windows.h> on WIN32. Put thread-related code inside
17717         KJS_MULTIPLE_THREADS #if directives.
17718         (KJS::Collector::markCurrentThreadConservatively): Use NT_TIB to find the stack base on Win32.
17719
17720         * kjs/config.h: Define HAVE_SYS_TIMEB_H for Win32.
17721
17722         * kjs/date_object.cpp: Add include of <limits.h>. Add definitions of strncasecmp, isfinite, and
17723         copysign for Win32.
17724         (KJS::KRFCDate_parseDate): Move "errno = 0" line down closer to the first call to strol -- I believe
17725         that on Win32 there's some other call before that setting errno.
17726
17727         * kjs/date_object.h: Remove unneeded include of <sys/time.h>.
17728
17729         * kjs/dtoa.cpp: Add an undef of strtod, needed on Win32.
17730
17731         * kjs/fast_malloc.cpp: Put #if !WIN32 around some customization that's not appropriate on Win32.
17732         (KJS::region_list_append): Add a missing cast so this Win32-specific function compiles in C++.
17733         (KJS::sbrk): Change parameter type to match the declaration.
17734
17735         * kjs/function.cpp: (isxdigit): Define a locale-independent isxdigit on Win32.
17736
17737         * kjs/function.h: Remove unneeded friend class Function for FunctionImp.
17738
17739         * kjs/identifier.cpp: Took out the APPLE_CHANGES from around the AVOID_STATIC_CONSTRUCTORS
17740         define. We ultimately intend to phase out APPLE_CHANGES entirely. Also fix the
17741         non-AVOID_STATIC_CONSTRUCTORS code path.
17742
17743         * kjs/internal.cpp: Remove uneeded include of <strings.h>, which was confused with <string.h>!
17744         Add a Win32 implementation of copysign. Put the threads code inside KJS_MULTIPLE_THREADS.
17745
17746         * kjs/internal.h: Define a KJS_MULTIPLE_THREADS macro on non-Win32 only. Later we can make this
17747         specific to Mac OS X if we like.
17748
17749         * kjs/interpreter_map.cpp: Add missing include of <stdlib.h>.
17750
17751         * kjs/list.cpp:
17752         (KJS::ListImp::markValues): Use std::min instead of MIN.
17753         (KJS::List::copy): Ditto.
17754         (KJS::List::copyTail): Ditto.
17755
17756         * kjs/math_object.cpp: (signbit): Add a Win32 implementation of signbit.
17757
17758         * kjs/nodes.cpp: (Node::finalCheck): Use unsigned instead of uint.
17759         Put the use of always_inline inside __GNUC__.
17760
17761         * kjs/number_object.cpp: (NumberProtoFuncImp::callAsFunction): Use "10.0" instead of "10"
17762         inside all the calls to pow to avoid ambiguity caused by overloading of pow on Win32, seen
17763         when passing an int rather than a double or float.
17764
17765         * kjs/operations.cpp:
17766         (KJS::isInf): Add Win32 implementation.
17767         (KJS::isPosInf): Add Win32 implementation.
17768         (KJS::isNegInf): Add Win32 implementation.
17769
17770         * kjs/regexp.cpp: Use unsigned instead of uint.
17771         * kjs/regexp.h: Ditto.
17772         * kjs/regexp_object.cpp: Ditto.
17773         * kjs/regexp_object.h: Ditto.
17774
17775 2005-09-02  Beth Dakin  <bdakin@apple.com>
17776
17777         Fix for <rdar://problem/4235531> Denver Regression: Safari crash in KWQStringData::makeUnicode
17778         The other half of the fix is in WebCore.
17779
17780         Fix written by Maciej and Darin.
17781         Reviewed by me/Maciej
17782
17783         As Maciej said in Radar: These problems was caused by a conflict between some of our custom 
17784         allocators, causing them to return null. Symptom is typically a null pointer dereference in 
17785         a place where it might be expected an allocation has just occurred.
17786
17787         * kjs/fast_malloc.cpp: Added #define for MORECORE_CONTIGUOUS, MORECORE_CANNOT_TRIM, 
17788                                and MALLOC_FAILURE_ACTION.
17789
17790 2005-08-31  Geoffrey Garen  <ggaren@apple.com>
17791
17792         -rolled in fix for http://bugs.webkit.org/show_bug.cgi?id=4698
17793         kjs does not allow named functions in function expressions
17794         
17795         Fix by Arthur Langereis.
17796         
17797         Reviewed by darin.
17798         
17799         * kjs/grammar.y:
17800         * kjs/nodes.cpp:
17801         (FuncExprNode::evaluate):
17802         * kjs/nodes.h:
17803         (KJS::FuncExprNode::FuncExprNode):
17804
17805         Test cases added:
17806
17807         * layout-tests/fast/js/named-function-expression-expected.txt: Added.
17808         * layout-tests/fast/js/named-function-expression.html: Added.
17809         
17810 2005-08-31  Justin Haygood  <justin@xiondigital.net>
17811
17812         Reviewed, tweaked, and landed by Darin.
17813
17814         - fixed http://bugs.webkit.org/show_bug.cgi?id=4085
17815         - fixed http://bugs.webkit.org/show_bug.cgi?id=4087
17816         - fixed http://bugs.webkit.org/show_bug.cgi?id=4096
17817           Some fixes for compiling on windows.
17818
17819         * kjs/config.h: Added a WIN32 case in here, with suitable defines.
17820         (To be tweaked as necessary.)
17821         * kjs/function.cpp: Took out APPLE_CHANGES around use of ICU.
17822         * kjs/operations.cpp: Removed some bogus code that always set HAVE_FLOAT_H.
17823
17824 2005-08-30  Darin Adler  <darin@apple.com>
17825
17826         Reviewed by John Sullivan.
17827
17828         - fixed http://bugs.webkit.org/show_bug.cgi?id=4758
17829           unify SharedPtr in WebCore and JavaScriptCore
17830
17831         * kjs/shared_ptr.h: Updated namespace to KXMLCore instead of kxhmlcore.
17832         Made a few small improvements to use local variables a bit more and added
17833         an "operator int" to reduce the chance that we'll convert a SharedPtr to
17834         an int by accident. Also made the == operators normal functions rather than
17835         friend functions, added a couple of comemnts.
17836
17837         * kjs/function.h: Updated for namespace change.
17838         * kjs/function.cpp: Ditto.
17839         * kjs/function_object.cpp: Ditto.
17840         * kjs/internal.h: Ditto.
17841         * kjs/internal.cpp: Ditto.
17842         * kjs/nodes.h: Ditto.
17843         * kjs/nodes2string.cpp: Ditto.
17844
17845 2005-08-26  Maciej Stachowiak  <mjs@apple.com>
17846
17847         Reviewed by John.
17848
17849         <rdar://problem/4224911> many many leaks in kjsyyparse with malformed Javascript        
17850
17851         Record all nodes that are created during parsing, and delete any
17852         that are left floating with a refcount of 0.
17853         
17854         * kjs/internal.cpp:
17855         (KJS::Parser::saveNewNode):
17856         (KJS::clearNewNodes):
17857         (KJS::Parser::parse):
17858         * kjs/internal.h:
17859         * kjs/nodes.cpp:
17860         (Node::Node):
17861         * kjs/nodes.h:
17862         (KJS::Node::refcount):
17863
17864 2005-08-26  Maciej Stachowiak  <mjs@apple.com>
17865
17866         Reviewed by John.
17867
17868         - fixed <rdar://problem/4232452> many many leaks in kjsyyparse on some well-formed JavaScript (can repro on sony.com, webkit tests)
17869         
17870         Fixed by changing the refcounting scheme for nodes. Instead of each node implementing a custom ref and
17871         deref for all its children (and being responsible for deleting them), nodes use a smart pointer to
17872         hold their children, and smart pointers are used outside the node tree as well. This change mostly
17873         removes code.
17874         
17875         * JavaScriptCore.xcodeproj/project.pbxproj:
17876         * kjs/function.cpp:
17877         (KJS::DeclaredFunctionImp::DeclaredFunctionImp):
17878         (KJS::GlobalFuncImp::callAsFunction):
17879         * kjs/function.h:
17880         * kjs/function_object.cpp:
17881         (FunctionObjectImp::construct):
17882         * kjs/grammar.y:
17883         * kjs/internal.cpp:
17884         (KJS::Parser::parse):
17885         (KJS::Parser::accept):
17886         (KJS::InterpreterImp::checkSyntax):
17887         (KJS::InterpreterImp::evaluate):
17888         * kjs/internal.h:
17889         * kjs/nodes.cpp:
17890         (Node::Node):
17891         (Node::~Node):
17892         (ElementNode::evaluate):
17893         (PropertyValueNode::evaluate):
17894         (ArgumentListNode::evaluateList):
17895         (NewExprNode::evaluate):
17896         (FunctionCallValueNode::evaluate):
17897         (FunctionCallBracketNode::evaluate):
17898         (FunctionCallDotNode::evaluate):
17899         (RelationalNode::evaluate):
17900         (StatListNode::execute):
17901         (StatListNode::processVarDecls):
17902         (VarDeclListNode::evaluate):
17903         (VarDeclListNode::processVarDecls):
17904         (ForInNode::ForInNode):
17905         (ClauseListNode::processVarDecls):
17906         (CaseBlockNode::evalBlock):
17907         (FuncDeclNode::processFuncDecl):
17908         (FuncExprNode::evaluate):
17909         (SourceElementsNode::execute):
17910         (SourceElementsNode::processFuncDecl):
17911         (SourceElementsNode::processVarDecls):
17912         * kjs/nodes.h:
17913         (KJS::Node::ref):
17914         (KJS::Node::deref):
17915         (KJS::NumberNode::NumberNode):
17916         (KJS::GroupNode::GroupNode):
17917         (KJS::ElementNode::ElementNode):
17918         (KJS::ArrayNode::ArrayNode):
17919         (KJS::PropertyValueNode::PropertyValueNode):
17920         (KJS::ObjectLiteralNode::ObjectLiteralNode):
17921         (KJS::BracketAccessorNode::BracketAccessorNode):
17922         (KJS::DotAccessorNode::DotAccessorNode):
17923         (KJS::ArgumentListNode::ArgumentListNode):
17924         (KJS::ArgumentsNode::ArgumentsNode):
17925         (KJS::NewExprNode::NewExprNode):
17926         (KJS::FunctionCallValueNode::FunctionCallValueNode):
17927         (KJS::FunctionCallResolveNode::FunctionCallResolveNode):
17928         (KJS::FunctionCallBracketNode::FunctionCallBracketNode):
17929         (KJS::FunctionCallDotNode::FunctionCallDotNode):
17930         (KJS::PostfixNode::PostfixNode):
17931         (KJS::DeleteNode::DeleteNode):
17932         (KJS::VoidNode::VoidNode):
17933         (KJS::TypeOfNode::TypeOfNode):
17934         (KJS::PrefixNode::PrefixNode):
17935         (KJS::UnaryPlusNode::UnaryPlusNode):
17936         (KJS::NegateNode::NegateNode):
17937         (KJS::BitwiseNotNode::BitwiseNotNode):
17938         (KJS::LogicalNotNode::LogicalNotNode):
17939         (KJS::MultNode::MultNode):
17940         (KJS::AddNode::AddNode):
17941         (KJS::ShiftNode::ShiftNode):
17942         (KJS::RelationalNode::RelationalNode):
17943         (KJS::EqualNode::EqualNode):
17944         (KJS::BitOperNode::BitOperNode):
17945         (KJS::BinaryLogicalNode::BinaryLogicalNode):
17946         (KJS::ConditionalNode::ConditionalNode):
17947         (KJS::AssignResolveNode::AssignResolveNode):
17948         (KJS::AssignBracketNode::AssignBracketNode):
17949         (KJS::AssignDotNode::AssignDotNode):
17950         (KJS::CommaNode::CommaNode):
17951         (KJS::AssignExprNode::AssignExprNode):
17952         (KJS::VarDeclListNode::VarDeclListNode):
17953         (KJS::VarStatementNode::VarStatementNode):
17954         (KJS::ExprStatementNode::ExprStatementNode):
17955         (KJS::IfNode::IfNode):
17956         (KJS::DoWhileNode::DoWhileNode):
17957         (KJS::WhileNode::WhileNode):
17958         (KJS::ForNode::ForNode):
17959         (KJS::ReturnNode::ReturnNode):
17960         (KJS::WithNode::WithNode):
17961         (KJS::CaseClauseNode::CaseClauseNode):
17962         (KJS::ClauseListNode::ClauseListNode):
17963         (KJS::ClauseListNode::clause):
17964         (KJS::ClauseListNode::next):
17965         (KJS::SwitchNode::SwitchNode):
17966         (KJS::LabelNode::LabelNode):
17967         (KJS::ThrowNode::ThrowNode):
17968         (KJS::CatchNode::CatchNode):
17969         (KJS::FinallyNode::FinallyNode):
17970         (KJS::TryNode::TryNode):
17971         (KJS::ParameterNode::ParameterNode):
17972         (KJS::ParameterNode::nextParam):
17973         (KJS::FuncDeclNode::FuncDeclNode):
17974         (KJS::FuncExprNode::FuncExprNode):
17975         * kjs/nodes2string.cpp:
17976         (KJS::SourceStream::operator<<):
17977         (ElementNode::streamTo):
17978         (PropertyValueNode::streamTo):
17979         (ArgumentListNode::streamTo):
17980         (StatListNode::streamTo):
17981         (VarDeclListNode::streamTo):
17982         (CaseBlockNode::streamTo):
17983         (ParameterNode::streamTo):
17984         (SourceElementsNode::streamTo):
17985         * kjs/shared_ptr.h: Added.
17986         (kxmlcore::SharedPtr::SharedPtr):
17987         (kxmlcore::SharedPtr::~SharedPtr):
17988         (kxmlcore::SharedPtr::isNull):
17989         (kxmlcore::SharedPtr::notNull):
17990         (kxmlcore::SharedPtr::reset):
17991         (kxmlcore::SharedPtr::get):
17992         (kxmlcore::SharedPtr::operator*):
17993         (kxmlcore::SharedPtr::operator->):
17994         (kxmlcore::SharedPtr::operator!):
17995         (kxmlcore::SharedPtr::operator bool):
17996         (kxmlcore::SharedPtr::operator==):
17997         (kxmlcore::::operator):
17998         (kxmlcore::operator!=):
17999         (kxmlcore::static_pointer_cast):
18000         (kxmlcore::const_pointer_cast):
18001
18002 2005-08-26  Geoff Garen  <ggaren@apple.com>
18003
18004         Reviewed by John.
18005         Landed by Darin.
18006
18007         - fixed http://bugs.webkit.org/show_bug.cgi?id=4664
18008           TOT Crash from backwards null check in WebScriptObject.mm
18009
18010         * bindings/objc/WebScriptObject.mm:
18011         (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
18012         Remove bogus !.
18013
18014 2005-08-25  Darin Adler  <darin@apple.com>
18015
18016         Reviewed by John Sullivan.
18017
18018         - rename KJS::UString::string() to KJS::UString::domString()
18019         - rename KJS::Identifier::string() to KJS::Identifier::domString()
18020
18021         * kjs/identifier.h: Renamed.
18022         * kjs/ustring.h: Ditto.
18023
18024 2005-08-19  Darin Adler  <darin@apple.com>
18025
18026         Reviewed by Maciej.
18027
18028         - fixed http://bugs.webkit.org/show_bug.cgi?id=4435
18029           speed up JavaScript by tweaking the Identifier class
18030
18031         * kjs/identifier.h: Add a new global nullIdentifier and make Identifier::null a function
18032         that returns it.
18033         * kjs/identifier.cpp: (KJS::Identifier::init): Initialize a global for the null identifier
18034         as well as all the other globals for special identifiers.
18035
18036         * kjs/ustring.h: (KJS::UString::UString): Make this empty constructor inline.
18037         * kjs/ustring.cpp: Remove the old non-inline version.
18038
18039 2005-08-19  Mitz Pettel  <opendarwin.org@mitzpettel.com>
18040
18041         Reviewed by Maciej.
18042         Revised and landed by Darin.
18043
18044         - fixed http://bugs.webkit.org/show_bug.cgi?id=4474
18045           REGRESSION: Crash when using in-place operator on uninitialized array element
18046
18047         * kjs/nodes.cpp:
18048         (AssignResolveNode::evaluate): Remove unneeded "isSet" assertion.
18049         (AssignBracketNode::evaluate): Replace code that tested "isSet" with code that
18050         tests the return value of getPropertySlot.
18051
18052         * kjs/property_slot.h: Removed unneeded "isSet" function. Property slots are
18053         either uninitialized or set. There's no "initialized and not set" state.
18054
18055 2005-08-18  Adele Peterson  <adele@apple.com>
18056
18057         Checked "Inline Functions Hidden" box
18058
18059         * JavaScriptCore.xcodeproj/project.pbxproj:
18060
18061 2005-08-16  Darin Adler  <darin@apple.com>
18062
18063         Reviewed by Geoff.
18064
18065         - fixed crash in one of the JavaScript tests (introduced by my throwError change)
18066
18067         * kjs/nodes.cpp: (Node::setExceptionDetailsIfNeeded): Check if the exception is an
18068         object before setting the file and line number properties on it. Something to think
18069         about in the future -- do we really want to do this on any object that's thrown?
18070         How about limiting it to error objects that were created by the JavaScript engine?
18071
18072         - changed kjs_fast_malloc so we don't have two conflicting versions of the same function
18073
18074         * kjs/fast_malloc.h: Took out all the ifdefs from this header.
18075         * kjs/fast_malloc.cpp: Added non-NDEBUG versions of the functions that just call
18076         the system malloc, and put the NDEBUG versions in an #else.
18077
18078 2005-08-16  Darin Adler  <darin@apple.com>
18079
18080         Reviewed by Geoff.
18081
18082         - clean up exported symbols that are not in a "KJS" namespace
18083
18084         * bindings/NP_jsobject.cpp: (identiferFromNPIdentifier): Marked this function static
18085         so it no longer has external linkage.
18086         * bindings/c/c_utility.h: Put all this stuff inside the KJS namespace.
18087         * bindings/c/c_utility.cpp: Also marked some globals static so they don't have external
18088         linkage; not as important given the namespace.
18089         * bindings/npruntime.cpp: Marked functions static so they no longer have internal linkage.
18090         Also removed unused _NPN_SetExceptionWithUTF8 function (not in header, had C++ linkage!).
18091
18092         * bindings/jni/jni_utility.cpp: (KJS::Bindings::getJavaVM): Call KJS_GetCreatedJavaVMs
18093         using the soft linking header, instead of calling the JNI call. This allows processes
18094         to link both JavaScriptCore and JavaVM without a symbol conflict.
18095         * bindings/softlinking.c:
18096         (loadFramework): Marked this function static so it no longer has external linkage.
18097         (getFunctionPointer): Ditto.
18098         (KJS_GetCreatedJavaVMs): Renamed this so it has a KJS prefix.
18099
18100         * JavaScriptCore.xcodeproj/project.pbxproj: Added softlinking.h.
18101         * bindings/softlinking.h: Added.
18102
18103         * kjs/nodes2string.cpp: (streamAssignmentOperatorTo): Marked this function static so it
18104         no longer has external linkage.
18105
18106 2005-08-15  Darin Adler  <darin@apple.com>
18107
18108         Reviewed by Geoff.
18109
18110         - fixed http://bugs.webkit.org/show_bug.cgi?id=4437
18111           clean up error creation with new throwError function
18112
18113         * bindings/NP_jsobject.cpp:
18114         (_NPN_SetException):
18115         * bindings/jni/jni_instance.cpp:
18116         (JavaInstance::invokeMethod):
18117         * bindings/jni/jni_runtime.cpp:
18118         (JavaField::dispatchValueFromInstance):
18119         (JavaField::dispatchSetValueToInstance):
18120         * bindings/objc/WebScriptObject.mm:
18121         (-[WebScriptObject _initializeWithObjectImp:originExecutionContext:executionContext:]):
18122         (-[WebScriptObject _initWithObjectImp:originExecutionContext:executionContext:]):
18123         (+[WebScriptObject throwException:]):
18124         (-[WebScriptObject setException:]):
18125         (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
18126         * bindings/objc/objc_class.h:
18127         (KJS::Bindings::ObjcClass::~ObjcClass):
18128         (KJS::Bindings::ObjcClass::ObjcClass):
18129         (KJS::Bindings::ObjcClass::operator=):
18130         (KJS::Bindings::ObjcClass::constructorAt):
18131         (KJS::Bindings::ObjcClass::numConstructors):
18132         * bindings/objc/objc_header.h:
18133         * bindings/objc/objc_runtime.h:
18134         (KJS::Bindings::ObjcField::~ObjcField):
18135         (KJS::Bindings::ObjcField::ObjcField):
18136         (KJS::Bindings::ObjcField::operator=):
18137         (KJS::Bindings::ObjcMethod::ObjcMethod):
18138         (KJS::Bindings::ObjcMethod::~ObjcMethod):
18139         (KJS::Bindings::ObjcMethod::operator=):
18140         * bindings/objc/objc_runtime.mm:
18141         (ObjcField::valueFromInstance):
18142         (ObjcField::setValueToInstance):
18143         (ObjcArray::setValueAt):
18144         (ObjcArray::valueAt):
18145         * bindings/objc/objc_utility.h:
18146         * bindings/objc/objc_utility.mm:
18147         (KJS::Bindings::JSMethodNameToObjCMethodName):
18148         (KJS::Bindings::convertValueToObjcValue):
18149         (KJS::Bindings::convertNSStringToString):
18150         (KJS::Bindings::convertObjcValueToValue):
18151         (KJS::Bindings::objcValueTypeForType):
18152         (KJS::Bindings::createObjcInstanceForValue):
18153         (KJS::Bindings::throwError):
18154         * bindings/runtime.h:
18155         (KJS::Bindings::Parameter::~Parameter):
18156         (KJS::Bindings::Method::~Method):
18157         (KJS::Bindings::Instance::Instance):
18158         (KJS::Bindings::Instance::begin):
18159         (KJS::Bindings::Instance::end):
18160         (KJS::Bindings::Instance::getValueOfUndefinedField):
18161         (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
18162         (KJS::Bindings::Instance::setValueOfUndefinedField):
18163         (KJS::Bindings::Instance::valueOf):
18164         * bindings/runtime_array.cpp:
18165         (RuntimeArrayImp::put):
18166         * bindings/runtime_object.h:
18167         (KJS::RuntimeObjectImp::setInternalInstance):
18168         (KJS::RuntimeObjectImp::getInternalInstance):
18169         * kjs/array_object.cpp:
18170         (getProperty):
18171         (ArrayProtoFuncImp::callAsFunction):
18172         (ArrayObjectImp::construct):
18173         * kjs/bool_object.cpp:
18174         (BooleanProtoFuncImp::callAsFunction):
18175         * kjs/date_object.cpp:
18176         (KJS::DateProtoFuncImp::callAsFunction):
18177         * kjs/function.cpp:
18178         (KJS::decode):
18179         (KJS::GlobalFuncImp::callAsFunction):
18180         * kjs/function_object.cpp:
18181         (FunctionProtoFuncImp::callAsFunction):
18182         (FunctionObjectImp::construct):
18183         * kjs/internal.cpp:
18184         (KJS::UndefinedImp::toObject):
18185         (KJS::NullImp::toObject):
18186         (KJS::InterpreterImp::evaluate):
18187         (KJS::InternalFunctionImp::hasInstance):
18188         * kjs/nodes.cpp:
18189         (Node::throwError):
18190         (substitute):
18191         (Node::setExceptionDetailsIfNeeded):
18192         (undefinedVariableError):
18193         (ProgramNode::ProgramNode):
18194         * kjs/number_object.cpp:
18195         (NumberProtoFuncImp::callAsFunction):
18196         * kjs/object.cpp:
18197         (KJS::ObjectImp::call):
18198         (KJS::ObjectImp::defaultValue):
18199         (KJS::Error::create):
18200         (KJS::throwError):
18201         * kjs/object.h:
18202         (KJS::ObjectImp::clearProperties):
18203         (KJS::ObjectImp::getPropertySlot):
18204         (KJS::ObjectImp::getOwnPropertySlot):
18205         * kjs/object_object.cpp:
18206         (ObjectProtoFuncImp::callAsFunction):
18207         * kjs/reference.cpp:
18208         (KJS::Reference::getBase):
18209         (KJS::Reference::getValue):
18210         (KJS::Reference::putValue):
18211         (KJS::Reference::deleteValue):
18212         * kjs/regexp_object.cpp:
18213         (RegExpProtoFuncImp::callAsFunction):
18214         (RegExpObjectImp::construct):
18215         * kjs/string_object.cpp:
18216         (StringProtoFuncImp::callAsFunction):
18217
18218 2005-08-15  Anders Carlsson  <andersca@mac.com>
18219
18220         Reviewed by Darin.
18221
18222         * tests/mozilla/ecma_3/Date/15.9.5.5.js:
18223         Remove the code which tests that Date.toLocaleString should be parsable
18224         by Date.parse. That is not true according to the spec.
18225
18226 2005-08-15  Darin Adler  <darin@apple.com>
18227
18228         Reviewed by Geoff.
18229
18230         * kjs/collector.cpp: (KJS::Collector::allocate): Use a local instead of a global in one
18231         more place; slight speedup.
18232
18233 2005-08-14  Darin Adler  <darin@apple.com>
18234
18235         Reviewed by Maciej.
18236
18237         - fixed crash observed on one of the Apple-only layout tests
18238
18239         * kjs/property_map.cpp: (KJS::PropertyMap::mark): Change code to understand that deleted
18240         entries have a value of NULL, so the deleted sentinel count doesn't need to be included
18241         in the count of things to mark since we're ignoring the keys.
18242
18243 2005-08-14  Darin Adler  <darin@apple.com>
18244
18245         Reviewed by Maciej.
18246
18247         - fixed http://bugs.webkit.org/show_bug.cgi?id=4421
18248           speed up JavaScript by inlining some label stack functions
18249
18250         * kjs/internal.h: Removed the copy constructor and assignment operator for LabelStack.
18251         They were unused, and the implementations had bugs; I removed them rather than fixing them.
18252         Also removed the clear function, since that was only needed to help the assignment operator
18253         share code with the destructor, and was not efficient enough for the destructor.
18254         (KJS::LabelStack::~LabelStack): Made this inline. Also used an efficient implementation
18255         that's nice and fast when the stack is empty, better than the old clear() function which
18256         used to keep updating and refetching "tos" each time through the loop.
18257         (KJS::LabelStack::pop): Made this inline.
18258
18259         * kjs/internal.cpp: Deleted the now-inline functions and the obsolete functions. Also
18260         deleted a commented-out line of code.
18261
18262 2005-08-14  Darin Adler  <darin@apple.com>
18263
18264         Reviewed by Maciej.
18265
18266         - fixed http://bugs.webkit.org/show_bug.cgi?id=4419
18267           speed up JavaScript by improving KJS::List
18268
18269         my measurements show an improvement of 1% on iBench JavaScript
18270
18271         * kjs/list.cpp: Rearrange list to make the values and free list share the same storage,
18272         which saves 4 bytes per list. Also remove the pointers used only on the heap from the
18273         lists that are in the pool, which saves 8 bytes per list. Moving the free list pointer
18274         closer to the start of the list object also speeds up access to the free list. New
18275         "HeapListImp" struct is used only for the lists on the heap.
18276         (KJS::List::markProtectedLists): Shadowed global variable in local and updated for the
18277         new terminology ("heap" instead of "outside pool").
18278         (KJS::allocateListImp): Updated for new terminology.
18279         (KJS::List::release): Moved the code from deallocateListImp in here -- it wasn't being
18280         inlined and didn't need to be in a separate function.
18281
18282 2005-08-14  Darin Adler  <darin@apple.com>
18283
18284         Reviewed by Maciej.
18285
18286         - fixed http://bugs.webkit.org/show_bug.cgi?id=4417
18287           speed up JavaScript with some small changes to the property map code
18288
18289         my measurements show an improvement of 2% on iBench JavaScript
18290
18291         * kjs/property_map.h: (KJS::PropertyMap::PropertyMap): Made the default constructor inline.
18292         * kjs/property_map.cpp:
18293         (KJS::PropertyMap::~PropertyMap): Changed loop to exit early once we know we've processed
18294         all the hash table entries, based on the count.
18295         (KJS::PropertyMap::mark): Ditto.
18296
18297         * kjs/object.h: Made an arbitrary change here to force recompiling so we pick up changes to
18298         property_map.h. Works around what seems to be an Xcode header dependency bug.
18299
18300 2005-08-14  Darin Adler  <darin@apple.com>
18301
18302         Reviewed by Maciej.
18303
18304         - fixed http://bugs.webkit.org/show_bug.cgi?id=4416
18305           speed up JavaScript with some improvements to the garbage collector
18306
18307         my measurements show an improvement of 2% on iBench JavaScript
18308
18309         * kjs/collector.cpp:
18310         (KJS::Collector::allocate): Use local variables to shadow globals instead of repeatedly
18311         going at global variables. Tighten up loop implementations to make the common case fast.
18312         (KJS::Collector::markStackObjectsConservatively): Use local variables to shadow globals.
18313         Used a goto to eliminate a boolean since it was showing up in the profile.
18314         (KJS::Collector::markProtectedObjects): Iterate through the table using pointer rather
18315         than an index since the profile showed that generating better code.
18316         (KJS::Collector::collect): Added a special case for blocks where all cells are used,
18317         Use local variables to shadow globals. Eliminated a boolean by computing it another
18318         way (checking to see if the number of live objects changed). Also used local variables
18319         to shadow fields in the current cell when sweeping.
18320         (KJS::Collector::numReferencedObjects): Use AllocatedValueImp instead of ValueImp
18321         in one place -- means we get faster versions of various functions that don't worry
18322         about SimpleNumber.
18323         (KJS::className): Ditto.
18324         (KJS::Collector::rootObjectClasses): Ditto.
18325
18326 2005-08-14  Darin Adler  <darin@apple.com>
18327
18328         - fixed http://bugs.webkit.org/show_bug.cgi?id=4344
18329           REGRESSION: JavaScript crash when going back from viewing a thread (NULL protoype)
18330
18331         * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set proto in a more
18332         straightforward way. The old code set the proto to 0 and then to the correct value.
18333         This showed up as a "false positive" when searching for places that set prototype
18334         to NULL/0 so I fixed it.
18335
18336         * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Change to
18337         not pass an explicit "0" to the base class (InternalFunctionImp) constructor.
18338
18339         * kjs/internal.h: Added a default constructor for InternalFunctionImp.
18340         * kjs/internal.cpp: (KJS::InternalFunctionImp::InternalFunctionImp): Added the
18341         default constructor (empty body, just calls base class's default constructor).
18342
18343         * kjs/object.h:
18344         (KJS::ObjectImp::ObjectImp): Add an assertion to catch NULL prototypes earlier
18345         in Development builds.
18346         (KJS::ObjectImp::setPrototype): Ditto.
18347
18348 2005-08-12  Maciej Stachowiak  <mjs@apple.com>
18349
18350         Reviewed by John.
18351
18352         - two simple speed improvements for a 3% speed gain
18353         
18354         * JavaScriptCore.xcodeproj/project.pbxproj: turn on -fstrict-aliasing
18355
18356         * kjs/scope_chain.h:
18357         (KJS::ScopeChainIterator::ScopeChainIterator): Add a scope chain iterator
18358         so you can walk a scope chain without having to make a copy that you then mutate.
18359         (KJS::ScopeChainIterator::operator*): standard iterator operation
18360         (KJS::ScopeChainIterator::operator->): ditto
18361         (KJS::ScopeChainIterator::operator++): ditto
18362         (KJS::ScopeChainIterator::operator==): ditto
18363         (KJS::ScopeChainIterator::operator!=): ditto
18364         (KJS::ScopeChain::begin): Iterator for the top of the scope chain
18365         (KJS::ScopeChain::end): Iterator for one past the bottom (i.e. null)
18366         * kjs/nodes.cpp:
18367         (ResolveNode::evaluate): Use scope chain iterator instead of copying
18368         a scope chain and then modifying the copy
18369         (ResolveNode::evaluateReference): ditto
18370         (FunctionCallResolveNode::evaluate): ditto
18371         (AssignResolveNode::evaluate): ditto
18372
18373 2005-08-12  Maciej Stachowiak  <mjs@apple.com>
18374
18375         Patch from Anders Carlsson, reviewed by me.
18376
18377         * kjs/nodes.h: Fix build breakage.
18378
18379 2005-08-12  Maciej Stachowiak  <mjs@apple.com>
18380
18381         Reviewed by hyatt.
18382
18383         - refactor function calls, 3% speedup on JS iBench.
18384
18385         * kjs/grammar.y:
18386         * kjs/nodes.cpp:
18387         (Node::throwError): Added new useful variants.
18388         (FunctionCallValueNode::evaluate): New node to handle calls on expressions
18389         that are strictly values, not references.
18390         (FunctionCallValueNode::ref):  ditto
18391         (FunctionCallValueNode::deref): ditto
18392         (FunctionCallResolveNode::evaluate): New node to handle calls on identifier
18393         expressions, so that they are looked up in the scope chain.
18394         (FunctionCallResolveNode::ref): ditto
18395         (FunctionCallResolveNode::deref): ditto
18396         (FunctionCallBracketNode::evaluate): New node to handle calls on bracket
18397         dereferences, so that the expression before brackets is used as the this
18398         object.
18399         (FunctionCallBracketNode::ref): ditto
18400         (FunctionCallBracketNode::deref): ditto
18401         (FunctionCallDotNode::evaluate): New node to handle calls on dot
18402         dereferences, so that the expression before the dot is used as the this
18403         object.
18404         (FunctionCallDotNode::ref): ditto
18405         (FunctionCallDotNode::deref): ditto
18406         (dotExprNotAnObjectString): helper function to avoid global variable access.
18407         (dotExprDoesNotAllowCallsString): ditto
18408         * kjs/nodes.h: Declared new classes.
18409         * kjs/nodes2string.cpp:
18410         (FunctionCallValueNode::streamTo): Added - serializes the appropriate function call
18411         (FunctionCallResolveNode::streamTo): ditto
18412         (FunctionCallBracketNode::streamTo): ditto
18413         (FunctionCallParenBracketNode::streamTo): ditto
18414         (FunctionCallDotNode::streamTo): ditto
18415         (FunctionCallParenDotNode::streamTo): ditto
18416         * kjs/object.h:
18417         (KJS::ObjectImp::isActivation): Change how activation objects are
18418         detected in the scope chain, a virtual function is cheaper than the
18419         old inheritance test.
18420         * kjs/function.h:
18421         (KJS::ActivationImp::isActivation): Ditto.
18422
18423 2005-08-11  Maciej Stachowiak  <mjs@apple.com>
18424
18425         - added missing file from earlier checkin
18426
18427         * kjs/grammar_types.h: Added.
18428         (KJS::makeNodePair):
18429         (KJS::makeNodeWithIdent):
18430
18431 2005-08-11  Maciej Stachowiak  <mjs@apple.com>
18432
18433         Reviewed by Geoff.
18434
18435         * kjs/date_object.cpp:
18436         (timetUsingCF): Fix one of the date tests my making the CF version of mktime
18437         have the same quirk about the DST field as the real mktime.
18438         * tests/mozilla/expected.html: Updated for newly fixed test.
18439
18440 2005-08-11  Maciej Stachowiak  <mjs@apple.com>
18441
18442         - updated for one of the tests that Darin incidentally fixed.
18443
18444         * tests/mozilla/expected.html:
18445
18446 2005-08-10  Maciej Stachowiak  <mjs@apple.com>
18447
18448         Reviewed by Geoff.
18449
18450         Refactor assignment grammar to avoid Reference type, and to later
18451         be able to take advantage of writeable PropertySlots, when those
18452         are added. I also fixed a minor bug, turning a function to a
18453         string lost parentheses, I made sure they are printed at least
18454         where semantically significant.
18455         
18456         Test cases: see WebCore
18457         
18458         * kjs/grammar.y: Change grammar so that assignment expressions are parsed
18459         directly to nodes that know how to set the kind of location being assigned, instead
18460         of having a generic assign node that counts on evaluateReference.
18461         * kjs/lexer.cpp: Include grammar_types.h.
18462         * kjs/nodes.cpp:
18463         (BracketAccessorNode): Renamed from AccessorNode1 for clarity.
18464         (DotAccessorNode): Renamed from AccessorNode2 for clarity.
18465         (combineForAssignment): Inline function for doing the proper kind of
18466         operation for various update assignments like += or *=.
18467         (AssignResolveNode): Node that handles assignment to a bare identifier.
18468         (AssignDotNode): Node that handles assignments of the form EXPR . IDENT = EXPR
18469         (AssignBracketNode): EXPR [ IDENT ] = EXPR
18470         * kjs/nodes.h: Updated for declarations/renames of new classes.
18471         * kjs/nodes2string.cpp:
18472         (GroupNode::streamTo): Fixed to print parens around the expression.
18473         (BracketAccessorNode::streamTo): Renamed.
18474         (DotAccessorNode::streamTo): Renamed.
18475         (AssignResolveNode::streamTo): Added.
18476         (AssignBracketNode::streamTo): Added.
18477         (AssignDotNode::streamTo): Added.
18478         (streamAssignmentOperatorTo): helper function for the above
18479         * kjs/property_slot.h:
18480         (KJS::PropertySlot::isSet): Made this const.
18481
18482 2005-08-10  Adele Peterson  <adele@apple.com>
18483
18484         Bumping version to 420+
18485
18486         * Info.plist:
18487
18488 2005-08-10  Geoffrey Garen  <ggaren@apple.com>
18489
18490         -fixed <rdar://problem/4151132> REGRESSION: Some applet liveconnect calls 
18491         throws privilege exception.
18492         
18493         Reviewed by richard and mjs.
18494
18495         -I removed the global static JavaClass cache, since it violated Java
18496         security to cache classes between websites and applets.
18497         
18498         * bindings/jni/jni_class.cpp: 
18499             -removed global static cache dictionary
18500             -instance constructor and destructor now do the work that used to 
18501             be done by static factory methods
18502             -removed obsolete functions
18503         (JavaClass::JavaClass):
18504         (JavaClass::~JavaClass):
18505         * bindings/jni/jni_class.h:
18506             -removed obsolete function declarations
18507             -made copying private since it's unused and it's also not clear
18508             excatly how copying would work with Java security
18509             -made default construction private since it's meaningless
18510         * bindings/jni/jni_instance.cpp:
18511             -removed obsolete functions
18512         (JavaInstance::~JavaInstance):
18513         (JavaInstance::getClass):
18514         * bindings/jni/jni_instance.h:
18515            -made copying private since it's unused and it's also not clear
18516             excatly how copying would work with Java security
18517             -made default construction private since it's meaningless
18518
18519 2005-08-08  Geoffrey Garen  <ggaren@apple.com>
18520
18521         -fixed crash caused by fix for http://bugs.webkit.org/show_bug.cgi?id=4313
18522         
18523         - exceptionDescription now gets explicitly initialized to NULL in all
18524         the places listed below -- our wrapper classes used to take care of this 
18525         automagically
18526         
18527         * bindings/jni/jni_instance.cpp:
18528         (JavaInstance::invokeMethod):
18529         * bindings/jni/jni_runtime.cpp:
18530         (JavaField::dispatchValueFromInstance):
18531         (JavaField::dispatchSetValueToInstance):
18532
18533 2005-08-08  Darin Adler  <darin@apple.com>
18534
18535         Reviewed by John Sullivan.
18536
18537         - fixed http://bugs.webkit.org/show_bug.cgi?id=4325
18538           Mozilla Date tests have an unnecessary loop that runs 1970 times before each test
18539
18540         * tests/mozilla/ecma/shell.js: Added TIME_YEAR_0 constant.
18541
18542         * tests/mozilla/ecma/Date/15.9.5.10-1.js: Removed the loop and changed code to use the constant.
18543         * tests/mozilla/ecma/Date/15.9.5.10-10.js: Ditto.
18544         * tests/mozilla/ecma/Date/15.9.5.10-11.js: Ditto.
18545         * tests/mozilla/ecma/Date/15.9.5.10-12.js: Ditto.
18546         * tests/mozilla/ecma/Date/15.9.5.10-13.js: Ditto.
18547         * tests/mozilla/ecma/Date/15.9.5.10-2.js: Ditto.
18548         * tests/mozilla/ecma/Date/15.9.5.10-3.js: Ditto.
18549         * tests/mozilla/ecma/Date/15.9.5.10-4.js: Ditto.
18550         * tests/mozilla/ecma/Date/15.9.5.10-5.js: Ditto.
18551         * tests/mozilla/ecma/Date/15.9.5.10-6.js: Ditto.
18552         * tests/mozilla/ecma/Date/15.9.5.10-7.js: Ditto.
18553         * tests/mozilla/ecma/Date/15.9.5.10-8.js: Ditto.
18554         * tests/mozilla/ecma/Date/15.9.5.10-9.js: Ditto.
18555         * tests/mozilla/ecma/Date/15.9.5.11-2.js: Ditto.
18556         * tests/mozilla/ecma/Date/15.9.5.12-1.js: Ditto.
18557         * tests/mozilla/ecma/Date/15.9.5.12-2.js: Ditto.
18558         * tests/mozilla/ecma/Date/15.9.5.12-3.js: Ditto.
18559         * tests/mozilla/ecma/Date/15.9.5.12-4.js: Ditto.
18560         * tests/mozilla/ecma/Date/15.9.5.12-5.js: Ditto.
18561         * tests/mozilla/ecma/Date/15.9.5.12-6.js: Ditto.
18562         * tests/mozilla/ecma/Date/15.9.5.12-7.js: Ditto.
18563         * tests/mozilla/ecma/Date/15.9.5.12-8.js: Ditto.
18564         * tests/mozilla/ecma/Date/15.9.5.13-2.js: Ditto.
18565         * tests/mozilla/ecma/Date/15.9.5.13-8.js: Ditto.
18566         * tests/mozilla/ecma/Date/15.9.5.14.js: Ditto.
18567         * tests/mozilla/ecma/Date/15.9.5.15.js: Ditto.
18568         * tests/mozilla/ecma/Date/15.9.5.16.js: Ditto.
18569         * tests/mozilla/ecma/Date/15.9.5.17.js: Ditto.
18570         * tests/mozilla/ecma/Date/15.9.5.18.js: Ditto.
18571         * tests/mozilla/ecma/Date/15.9.5.19.js: Ditto.
18572         * tests/mozilla/ecma/Date/15.9.5.20.js: Ditto.
18573         * tests/mozilla/ecma/Date/15.9.5.21-1.js: Ditto.
18574         * tests/mozilla/ecma/Date/15.9.5.21-2.js: Ditto.
18575         * tests/mozilla/ecma/Date/15.9.5.21-3.js: Ditto.
18576         * tests/mozilla/ecma/Date/15.9.5.21-4.js: Ditto.
18577         * tests/mozilla/ecma/Date/15.9.5.21-5.js: Ditto.
18578         * tests/mozilla/ecma/Date/15.9.5.21-6.js: Ditto.
18579         * tests/mozilla/ecma/Date/15.9.5.21-7.js: Ditto.
18580         * tests/mozilla/ecma/Date/15.9.5.21-8.js: Ditto.
18581         * tests/mozilla/ecma/Date/15.9.5.22-1.js: Ditto.
18582         * tests/mozilla/ecma/Date/15.9.5.22-2.js: Ditto.
18583         * tests/mozilla/ecma/Date/15.9.5.22-3.js: Ditto.
18584         * tests/mozilla/ecma/Date/15.9.5.22-4.js: Ditto.
18585         * tests/mozilla/ecma/Date/15.9.5.22-5.js: Ditto.
18586         * tests/mozilla/ecma/Date/15.9.5.22-6.js: Ditto.
18587         * tests/mozilla/ecma/Date/15.9.5.22-7.js: Ditto.
18588         * tests/mozilla/ecma/Date/15.9.5.22-8.js: Ditto.
18589         * tests/mozilla/ecma/Date/15.9.5.23-4.js: Ditto.
18590         * tests/mozilla/ecma/Date/15.9.5.23-5.js: Ditto.
18591         * tests/mozilla/ecma/Date/15.9.5.23-6.js: Ditto.
18592         * tests/mozilla/ecma/Date/15.9.5.23-7.js: Ditto.
18593         * tests/mozilla/ecma/Date/15.9.5.23-8.js: Ditto.
18594         * tests/mozilla/ecma/Date/15.9.5.23-9.js: Ditto.
18595         * tests/mozilla/ecma/Date/15.9.5.5.js: Ditto.
18596         * tests/mozilla/ecma/Date/15.9.5.6.js: Ditto.
18597         * tests/mozilla/ecma/Date/15.9.5.7.js: Ditto.
18598         * tests/mozilla/ecma/Date/15.9.5.8.js: Ditto.
18599         * tests/mozilla/ecma/Date/15.9.5.9.js: Ditto.
18600
18601 2005-08-08  Darin Adler  <darin@apple.com>
18602
18603         - forgot to delete an obsolete file
18604
18605         * kjs/object_wrapper.h: Deleted.
18606
18607 2005-08-07  Darin Adler  <darin@apple.com>
18608
18609         - fixed two problems compiling with gcc 4.0
18610
18611         * kjs/array_object.cpp: (ArrayProtoFuncImp::callAsFunction): Initialized a
18612         variable to quiet an erroneous warning.
18613         * kjs/date_object.cpp: (KJS::makeTime): Removed extraneous KJS:: prefix.
18614
18615 2005-08-07  Darin Adler  <darin@apple.com>
18616
18617         Rubber stamped by Maciej.
18618
18619         - fixed http://bugs.webkit.org/show_bug.cgi?id=4313
18620           eliminate KJS::Value and KJS::Object smart pointer wrappers (for simplicity and speed)
18621
18622         * JavaScriptCore.xcodeproj/project.pbxproj: Removed object_wrapper.h.
18623
18624         Global replaces and other wonderful stuff.
18625
18626         * bindings/NP_jsobject.cpp:
18627         (_NPN_Invoke):
18628         (_NPN_Evaluate):
18629         (_NPN_GetProperty):
18630         (_NPN_SetProperty):
18631         (_NPN_HasMethod):
18632         (_NPN_SetException):
18633         * bindings/c/c_instance.cpp:
18634         (KJS::Bindings::CInstance::CInstance):
18635         (KJS::Bindings::CInstance::invokeMethod):
18636         (KJS::Bindings::CInstance::invokeDefaultMethod):
18637         (KJS::Bindings::CInstance::defaultValue):
18638         (KJS::Bindings::CInstance::stringValue):
18639         (KJS::Bindings::CInstance::numberValue):
18640         (KJS::Bindings::CInstance::booleanValue):
18641         (KJS::Bindings::CInstance::valueOf):
18642         * bindings/c/c_instance.h:
18643         * bindings/c/c_runtime.cpp:
18644         (CField::valueFromInstance):
18645         (CField::setValueToInstance):
18646         * bindings/c/c_runtime.h:
18647         * bindings/c/c_utility.cpp:
18648         (convertNPStringToUTF16):
18649         (convertUTF8ToUTF16):
18650         (coerceValueToNPVariantStringType):
18651         (convertValueToNPVariant):
18652         (convertNPVariantToValue):
18653         * bindings/c/c_utility.h:
18654         * bindings/jni/jni_instance.cpp:
18655         (JavaInstance::stringValue):
18656         (JavaInstance::numberValue):
18657         (JavaInstance::booleanValue):
18658         (JavaInstance::invokeMethod):
18659         (JavaInstance::invokeDefaultMethod):
18660         (JavaInstance::defaultValue):
18661         (JavaInstance::valueOf):
18662         * bindings/jni/jni_instance.h:
18663         * bindings/jni/jni_jsobject.cpp:
18664         (JSObject::invoke):
18665         (JSObject::call):
18666         (JSObject::eval):
18667         (JSObject::getMember):
18668         (JSObject::getSlot):
18669         (JSObject::toString):
18670         (JSObject::convertValueToJObject):
18671         (JSObject::convertJObjectToValue):
18672         (JSObject::listFromJArray):
18673         * bindings/jni/jni_jsobject.h:
18674         * bindings/jni/jni_objc.mm:
18675         (KJS::Bindings::dispatchJNICall):
18676         * bindings/jni/jni_runtime.cpp:
18677         (JavaArray::convertJObjectToArray):
18678         (JavaField::dispatchValueFromInstance):
18679         (JavaField::valueFromInstance):
18680         (JavaField::dispatchSetValueToInstance):
18681         (JavaField::setValueToInstance):
18682         (JavaArray::setValueAt):
18683         (JavaArray::valueAt):
18684         * bindings/jni/jni_runtime.h:
18685         (KJS::Bindings::JavaString::ustring):
18686         * bindings/jni/jni_utility.cpp:
18687         (KJS::Bindings::getJavaVM):
18688         (KJS::Bindings::getJNIEnv):
18689         (KJS::Bindings::getMethodID):
18690         (KJS::Bindings::callJNIVoidMethod):
18691         (KJS::Bindings::callJNIObjectMethod):
18692         (KJS::Bindings::callJNIBooleanMethod):
18693         (KJS::Bindings::callJNIStaticBooleanMethod):
18694         (KJS::Bindings::callJNIByteMethod):
18695         (KJS::Bindings::callJNICharMethod):
18696         (KJS::Bindings::callJNIShortMethod):
18697         (KJS::Bindings::callJNIIntMethod):
18698         (KJS::Bindings::callJNILongMethod):
18699         (KJS::Bindings::callJNIFloatMethod):
18700         (KJS::Bindings::callJNIDoubleMethod):
18701         (KJS::Bindings::callJNIVoidMethodA):
18702         (KJS::Bindings::callJNIObjectMethodA):
18703         (KJS::Bindings::callJNIByteMethodA):
18704         (KJS::Bindings::callJNICharMethodA):
18705         (KJS::Bindings::callJNIShortMethodA):
18706         (KJS::Bindings::callJNIIntMethodA):
18707         (KJS::Bindings::callJNILongMethodA):
18708         (KJS::Bindings::callJNIFloatMethodA):
18709         (KJS::Bindings::callJNIDoubleMethodA):
18710         (KJS::Bindings::callJNIBooleanMethodA):
18711         (KJS::Bindings::callJNIVoidMethodIDA):
18712         (KJS::Bindings::callJNIObjectMethodIDA):
18713         (KJS::Bindings::callJNIByteMethodIDA):
18714         (KJS::Bindings::callJNICharMethodIDA):
18715         (KJS::Bindings::callJNIShortMethodIDA):
18716         (KJS::Bindings::callJNIIntMethodIDA):
18717         (KJS::Bindings::callJNILongMethodIDA):
18718         (KJS::Bindings::callJNIFloatMethodIDA):
18719         (KJS::Bindings::callJNIDoubleMethodIDA):
18720         (KJS::Bindings::callJNIBooleanMethodIDA):
18721         (KJS::Bindings::getCharactersFromJString):
18722         (KJS::Bindings::releaseCharactersForJString):
18723         (KJS::Bindings::getCharactersFromJStringInEnv):
18724         (KJS::Bindings::releaseCharactersForJStringInEnv):
18725         (KJS::Bindings::getUCharactersFromJStringInEnv):
18726         (KJS::Bindings::releaseUCharactersForJStringInEnv):
18727         (KJS::Bindings::JNITypeFromClassName):
18728         (KJS::Bindings::signatureFromPrimitiveType):
18729         (KJS::Bindings::JNITypeFromPrimitiveType):
18730         (KJS::Bindings::getJNIField):
18731         (KJS::Bindings::convertValueToJValue):
18732         * bindings/jni/jni_utility.h:
18733         * bindings/objc/WebScriptObject.mm:
18734         (_didExecute):
18735         (-[WebScriptObject _initializeWithObjectImp:originExecutionContext:Bindings::executionContext:Bindings::]):
18736         (-[WebScriptObject _initWithObjectImp:originExecutionContext:Bindings::executionContext:Bindings::]):
18737         (-[WebScriptObject _imp]):
18738         (-[WebScriptObject _executionContext]):
18739         (-[WebScriptObject _setExecutionContext:]):
18740         (-[WebScriptObject _originExecutionContext]):
18741         (-[WebScriptObject _setOriginExecutionContext:]):
18742         (+[WebScriptObject throwException:]):
18743         (listFromNSArray):
18744         (-[WebScriptObject callWebScriptMethod:withArguments:]):
18745         (-[WebScriptObject evaluateWebScript:]):
18746         (-[WebScriptObject setValue:forKey:]):
18747         (-[WebScriptObject valueForKey:]):
18748         (-[WebScriptObject removeWebScriptKey:]):
18749         (-[WebScriptObject stringRepresentation]):
18750         (-[WebScriptObject webScriptValueAtIndex:]):
18751         (-[WebScriptObject setException:]):
18752         (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:Bindings::]):
18753         * bindings/objc/WebScriptObjectPrivate.h:
18754         * bindings/objc/objc_class.h:
18755         * bindings/objc/objc_class.mm:
18756         (KJS::Bindings::ObjcClass::fallbackObject):
18757         * bindings/objc/objc_instance.h:
18758         * bindings/objc/objc_instance.mm:
18759         (ObjcInstance::invokeMethod):
18760         (ObjcInstance::invokeDefaultMethod):
18761         (ObjcInstance::setValueOfField):
18762         (ObjcInstance::setValueOfUndefinedField):
18763         (ObjcInstance::getValueOfField):
18764         (ObjcInstance::getValueOfUndefinedField):
18765         (ObjcInstance::defaultValue):
18766         (ObjcInstance::stringValue):
18767         (ObjcInstance::numberValue):
18768         (ObjcInstance::booleanValue):
18769         (ObjcInstance::valueOf):
18770         * bindings/objc/objc_runtime.h:
18771         * bindings/objc/objc_runtime.mm:
18772         (ObjcField::valueFromInstance):
18773         (convertValueToObjcObject):
18774         (ObjcField::setValueToInstance):
18775         (ObjcArray::setValueAt):
18776         (ObjcArray::valueAt):
18777         (ObjcFallbackObjectImp::put):
18778         (ObjcFallbackObjectImp::callAsFunction):
18779         (ObjcFallbackObjectImp::defaultValue):
18780         * bindings/objc/objc_utility.h:
18781         * bindings/objc/objc_utility.mm:
18782         (Bindings::JSMethodNameToObjCMethodName):
18783         (Bindings::convertValueToObjcValue):
18784         (Bindings::convertNSStringToString):
18785         (Bindings::convertObjcValueToValue):
18786         (Bindings::objcValueTypeForType):
18787         (Bindings::createObjcInstanceForValue):
18788         * bindings/runtime.cpp:
18789         (Instance::getValueOfField):
18790         (Instance::setValueOfField):
18791         (Instance::createRuntimeObject):
18792         (Instance::createLanguageInstanceForValue):
18793         * bindings/runtime.h:
18794         (KJS::Bindings::Constructor::~Constructor):
18795         (KJS::Bindings::Field::~Field):
18796         (KJS::Bindings::MethodList::MethodList):
18797         (KJS::Bindings::Class::fallbackObject):
18798         (KJS::Bindings::Class::~Class):
18799         (KJS::Bindings::Instance::Instance):
18800         (KJS::Bindings::Instance::getValueOfUndefinedField):
18801         (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
18802         (KJS::Bindings::Instance::setValueOfUndefinedField):
18803         (KJS::Bindings::Instance::valueOf):
18804         (KJS::Bindings::Instance::setExecutionContext):
18805         (KJS::Bindings::Instance::~Instance):
18806         (KJS::Bindings::Array::~Array):
18807         * bindings/runtime_array.cpp:
18808         (RuntimeArrayImp::RuntimeArrayImp):
18809         (RuntimeArrayImp::lengthGetter):
18810         (RuntimeArrayImp::indexGetter):
18811         (RuntimeArrayImp::put):
18812         * bindings/runtime_array.h:
18813         * bindings/runtime_method.cpp:
18814         (RuntimeMethodImp::lengthGetter):
18815         (RuntimeMethodImp::callAsFunction):
18816         * bindings/runtime_method.h:
18817         * bindings/runtime_object.cpp:
18818         (RuntimeObjectImp::fallbackObjectGetter):
18819         (RuntimeObjectImp::fieldGetter):
18820         (RuntimeObjectImp::methodGetter):
18821         (RuntimeObjectImp::getOwnPropertySlot):
18822         (RuntimeObjectImp::put):
18823         (RuntimeObjectImp::defaultValue):
18824         (RuntimeObjectImp::callAsFunction):
18825         * bindings/runtime_object.h:
18826         * kjs/array_instance.h:
18827         * kjs/array_object.cpp:
18828         (ArrayInstanceImp::ArrayInstanceImp):
18829         (ArrayInstanceImp::lengthGetter):
18830         (ArrayInstanceImp::getOwnPropertySlot):
18831         (ArrayInstanceImp::put):
18832         (ArrayInstanceImp::propList):
18833         (ArrayInstanceImp::setLength):
18834         (compareByStringForQSort):
18835         (compareWithCompareFunctionForQSort):
18836         (ArrayInstanceImp::sort):
18837         (ArrayInstanceImp::pushUndefinedObjectsToEnd):
18838         (ArrayPrototypeImp::ArrayPrototypeImp):
18839         (ArrayProtoFuncImp::ArrayProtoFuncImp):
18840         (ArrayProtoFuncImp::callAsFunction):
18841         (ArrayObjectImp::ArrayObjectImp):
18842         (ArrayObjectImp::construct):
18843         (ArrayObjectImp::callAsFunction):
18844         * kjs/array_object.h:
18845         * kjs/bool_object.cpp:
18846         (BooleanPrototypeImp::BooleanPrototypeImp):
18847         (BooleanProtoFuncImp::BooleanProtoFuncImp):
18848         (BooleanProtoFuncImp::callAsFunction):
18849         (BooleanObjectImp::BooleanObjectImp):
18850         (BooleanObjectImp::construct):
18851         (BooleanObjectImp::callAsFunction):
18852         * kjs/bool_object.h:
18853         * kjs/collector.cpp:
18854         (KJS::Collector::markStackObjectsConservatively):
18855         (KJS::Collector::collect):
18856         (KJS::className):
18857         * kjs/completion.h:
18858         (KJS::Completion::Completion):
18859         (KJS::Completion::value):
18860         (KJS::Completion::isValueCompletion):
18861         * kjs/context.h:
18862         (KJS::ContextImp::variableObject):
18863         (KJS::ContextImp::setVariableObject):
18864         (KJS::ContextImp::thisValue):
18865         (KJS::ContextImp::activationObject):
18866         (KJS::ContextImp::pushScope):
18867         * kjs/date_object.cpp:
18868         (formatLocaleDate):
18869         (KJS::timeFromArgs):
18870         (KJS::DatePrototypeImp::DatePrototypeImp):
18871         (KJS::DateProtoFuncImp::DateProtoFuncImp):
18872         (KJS::DateProtoFuncImp::callAsFunction):
18873         (KJS::DateObjectImp::DateObjectImp):
18874         (KJS::DateObjectImp::construct):
18875         (KJS::DateObjectImp::callAsFunction):
18876         (KJS::DateObjectFuncImp::DateObjectFuncImp):
18877         (KJS::DateObjectFuncImp::callAsFunction):
18878         (KJS::parseDate):
18879         (KJS::KRFCDate_parseDate):
18880         (KJS::timeClip):
18881         * kjs/date_object.h:
18882         * kjs/debugger.cpp:
18883         (Debugger::exception):
18884         (Debugger::callEvent):
18885         (Debugger::returnEvent):
18886         * kjs/debugger.h:
18887         * kjs/error_object.cpp:
18888         (ErrorPrototypeImp::ErrorPrototypeImp):
18889         (ErrorProtoFuncImp::ErrorProtoFuncImp):
18890         (ErrorProtoFuncImp::callAsFunction):
18891         (ErrorObjectImp::ErrorObjectImp):
18892         (ErrorObjectImp::construct):
18893         (ErrorObjectImp::callAsFunction):
18894         (NativeErrorPrototypeImp::NativeErrorPrototypeImp):
18895         (NativeErrorImp::NativeErrorImp):
18896         (NativeErrorImp::construct):
18897         (NativeErrorImp::callAsFunction):
18898         * kjs/error_object.h:
18899         * kjs/function.cpp:
18900         (KJS::FunctionImp::FunctionImp):
18901         (KJS::FunctionImp::callAsFunction):
18902         (KJS::FunctionImp::processParameters):
18903         (KJS::FunctionImp::argumentsGetter):
18904         (KJS::FunctionImp::lengthGetter):
18905         (KJS::FunctionImp::put):
18906         (KJS::DeclaredFunctionImp::DeclaredFunctionImp):
18907         (KJS::DeclaredFunctionImp::construct):
18908         (KJS::ArgumentsImp::ArgumentsImp):
18909         (KJS::ArgumentsImp::mappedIndexGetter):
18910         (KJS::ArgumentsImp::put):
18911         (KJS::ActivationImp::argumentsGetter):
18912         (KJS::GlobalFuncImp::GlobalFuncImp):
18913         (KJS::encode):
18914         (KJS::decode):
18915         (KJS::GlobalFuncImp::callAsFunction):
18916         * kjs/function.h:
18917         * kjs/function_object.cpp:
18918         (FunctionPrototypeImp::FunctionPrototypeImp):
18919         (FunctionPrototypeImp::callAsFunction):
18920         (FunctionProtoFuncImp::FunctionProtoFuncImp):
18921         (FunctionProtoFuncImp::callAsFunction):
18922         (FunctionObjectImp::FunctionObjectImp):
18923         (FunctionObjectImp::construct):
18924         (FunctionObjectImp::callAsFunction):
18925         * kjs/function_object.h:
18926         * kjs/internal.cpp:
18927         (KJS::UndefinedImp::toPrimitive):
18928         (KJS::UndefinedImp::toObject):
18929         (KJS::NullImp::toPrimitive):
18930         (KJS::NullImp::toObject):
18931         (KJS::BooleanImp::toPrimitive):
18932         (KJS::BooleanImp::toObject):
18933         (KJS::StringImp::toPrimitive):
18934         (KJS::StringImp::toObject):
18935         (KJS::NumberImp::toPrimitive):
18936         (KJS::NumberImp::toObject):
18937         (KJS::NumberImp::getUInt32):
18938         (KJS::LabelStack::push):
18939         (KJS::ContextImp::ContextImp):
18940         (KJS::InterpreterImp::globalInit):
18941         (KJS::InterpreterImp::globalClear):
18942         (KJS::InterpreterImp::InterpreterImp):
18943         (KJS::InterpreterImp::initGlobalObject):
18944         (KJS::InterpreterImp::clear):
18945         (KJS::InterpreterImp::mark):
18946         (KJS::InterpreterImp::evaluate):
18947         (KJS::InternalFunctionImp::hasInstance):
18948         (KJS::roundValue):
18949         (KJS::printInfo):
18950         * kjs/internal.h:
18951         (KJS::InterpreterImp::builtinObject):
18952         (KJS::InterpreterImp::builtinFunction):
18953         (KJS::InterpreterImp::builtinArray):
18954         (KJS::InterpreterImp::builtinBoolean):
18955         (KJS::InterpreterImp::builtinString):
18956         (KJS::InterpreterImp::builtinNumber):
18957         (KJS::InterpreterImp::builtinDate):
18958         (KJS::InterpreterImp::builtinRegExp):
18959         (KJS::InterpreterImp::builtinError):
18960         (KJS::InterpreterImp::builtinObjectPrototype):
18961         (KJS::InterpreterImp::builtinFunctionPrototype):
18962         (KJS::InterpreterImp::builtinArrayPrototype):
18963         (KJS::InterpreterImp::builtinBooleanPrototype):
18964         (KJS::InterpreterImp::builtinStringPrototype):
18965         (KJS::InterpreterImp::builtinNumberPrototype):
18966         (KJS::InterpreterImp::builtinDatePrototype):
18967         (KJS::InterpreterImp::builtinRegExpPrototype):
18968         (KJS::InterpreterImp::builtinErrorPrototype):
18969         (KJS::InterpreterImp::builtinEvalError):
18970         (KJS::InterpreterImp::builtinRangeError):
18971         (KJS::InterpreterImp::builtinReferenceError):
18972         (KJS::InterpreterImp::builtinSyntaxError):
18973         (KJS::InterpreterImp::builtinTypeError):
18974         (KJS::InterpreterImp::builtinURIError):
18975         (KJS::InterpreterImp::builtinEvalErrorPrototype):
18976         (KJS::InterpreterImp::builtinRangeErrorPrototype):
18977         (KJS::InterpreterImp::builtinReferenceErrorPrototype):
18978         (KJS::InterpreterImp::builtinSyntaxErrorPrototype):
18979         (KJS::InterpreterImp::builtinTypeErrorPrototype):
18980         (KJS::InterpreterImp::builtinURIErrorPrototype):
18981         * kjs/interpreter.cpp:
18982         (Context::variableObject):
18983         (Context::thisValue):
18984         (Interpreter::Interpreter):
18985         (Interpreter::globalObject):
18986         (Interpreter::evaluate):
18987         (Interpreter::builtinObject):
18988         (Interpreter::builtinFunction):
18989         (Interpreter::builtinArray):
18990         (Interpreter::builtinBoolean):
18991         (Interpreter::builtinString):
18992         (Interpreter::builtinNumber):
18993         (Interpreter::builtinDate):
18994         (Interpreter::builtinRegExp):
18995         (Interpreter::builtinError):
18996         (Interpreter::builtinObjectPrototype):
18997         (Interpreter::builtinFunctionPrototype):
18998         (Interpreter::builtinArrayPrototype):
18999         (Interpreter::builtinBooleanPrototype):
19000         (Interpreter::builtinStringPrototype):
19001         (Interpreter::builtinNumberPrototype):
19002         (Interpreter::builtinDatePrototype):
19003         (Interpreter::builtinRegExpPrototype):
19004         (Interpreter::builtinErrorPrototype):
19005         (Interpreter::builtinEvalError):
19006         (Interpreter::builtinRangeError):
19007         (Interpreter::builtinReferenceError):
19008         (Interpreter::builtinSyntaxError):
19009         (Interpreter::builtinTypeError):
19010         (Interpreter::builtinURIError):
19011         (Interpreter::builtinEvalErrorPrototype):
19012         (Interpreter::builtinRangeErrorPrototype):
19013         (Interpreter::builtinReferenceErrorPrototype):
19014         (Interpreter::builtinSyntaxErrorPrototype):
19015         (Interpreter::builtinTypeErrorPrototype):
19016         (Interpreter::builtinURIErrorPrototype):
19017         (Interpreter::createLanguageInstanceForValue):
19018         * kjs/interpreter.h:
19019         (KJS::Interpreter::isGlobalObject):
19020         (KJS::ExecState::setException):
19021         (KJS::ExecState::clearException):
19022         (KJS::ExecState::exception):
19023         (KJS::ExecState::hadException):
19024         (KJS::ExecState::ExecState):
19025         * kjs/list.cpp:
19026         (KJS::List::at):
19027         * kjs/list.h:
19028         (KJS::List::operator[]):
19029         (KJS::ListIterator::operator->):
19030         (KJS::ListIterator::operator*):
19031         (KJS::ListIterator::operator++):
19032         (KJS::ListIterator::operator--):
19033         * kjs/lookup.h:
19034         (KJS::staticFunctionGetter):
19035         (KJS::staticValueGetter):
19036         (KJS::lookupPut):
19037         (KJS::cacheGlobalObject):
19038         * kjs/math_object.cpp:
19039         (MathObjectImp::getValueProperty):
19040         (MathFuncImp::MathFuncImp):
19041         (MathFuncImp::callAsFunction):
19042         * kjs/math_object.h:
19043         * kjs/nodes.cpp:
19044         (Node::evaluateReference):
19045         (Node::throwError):
19046         (Node::setExceptionDetailsIfNeeded):
19047         (NullNode::evaluate):
19048         (BooleanNode::evaluate):
19049         (NumberNode::evaluate):
19050         (StringNode::evaluate):
19051         (RegExpNode::evaluate):
19052         (ThisNode::evaluate):
19053         (ResolveNode::evaluate):
19054         (ResolveNode::evaluateReference):
19055         (GroupNode::evaluate):
19056         (ElementNode::evaluate):
19057         (ArrayNode::evaluate):
19058         (ObjectLiteralNode::evaluate):
19059         (PropertyValueNode::evaluate):
19060         (PropertyNode::evaluate):
19061         (AccessorNode1::evaluate):
19062         (AccessorNode1::evaluateReference):
19063         (AccessorNode2::evaluate):
19064         (AccessorNode2::evaluateReference):
19065         (ArgumentListNode::evaluate):
19066         (ArgumentListNode::evaluateList):
19067         (ArgumentsNode::evaluate):
19068         (NewExprNode::evaluate):
19069         (FunctionCallNode::evaluate):
19070         (PostfixNode::evaluate):
19071         (DeleteNode::evaluate):
19072         (VoidNode::evaluate):
19073         (TypeOfNode::evaluate):
19074         (PrefixNode::evaluate):
19075         (UnaryPlusNode::evaluate):
19076         (NegateNode::evaluate):
19077         (BitwiseNotNode::evaluate):
19078         (LogicalNotNode::evaluate):
19079         (MultNode::evaluate):
19080         (AddNode::evaluate):
19081         (ShiftNode::evaluate):
19082         (RelationalNode::evaluate):
19083         (EqualNode::evaluate):
19084         (BitOperNode::evaluate):
19085         (BinaryLogicalNode::evaluate):
19086         (ConditionalNode::evaluate):
19087         (AssignNode::evaluate):
19088         (CommaNode::evaluate):
19089         (StatListNode::execute):
19090         (AssignExprNode::evaluate):
19091         (VarDeclNode::evaluate):
19092         (VarDeclNode::processVarDecls):
19093         (VarDeclListNode::evaluate):
19094         (ExprStatementNode::execute):
19095         (IfNode::execute):
19096         (DoWhileNode::execute):
19097         (WhileNode::execute):
19098         (ForNode::execute):
19099         (ForInNode::execute):
19100         (ContinueNode::execute):
19101         (BreakNode::execute):
19102         (ReturnNode::execute):
19103         (WithNode::execute):
19104         (CaseClauseNode::evaluate):
19105         (ClauseListNode::evaluate):
19106         (CaseBlockNode::evaluate):
19107         (CaseBlockNode::evalBlock):
19108         (SwitchNode::execute):
19109         (ThrowNode::execute):
19110         (CatchNode::execute):
19111         (TryNode::execute):
19112         (ParameterNode::evaluate):
19113         (FuncDeclNode::processFuncDecl):
19114         (FuncExprNode::evaluate):
19115         (SourceElementsNode::execute):
19116         * kjs/nodes.h:
19117         (KJS::StatementNode::evaluate):
19118         * kjs/number_object.cpp:
19119         (NumberPrototypeImp::NumberPrototypeImp):
19120         (NumberProtoFuncImp::NumberProtoFuncImp):
19121         (NumberProtoFuncImp::callAsFunction):
19122         (NumberObjectImp::NumberObjectImp):
19123         (NumberObjectImp::getValueProperty):
19124         (NumberObjectImp::construct):
19125         (NumberObjectImp::callAsFunction):
19126         * kjs/number_object.h:
19127         * kjs/object.cpp:
19128         (KJS::ObjectImp::call):
19129         (KJS::ObjectImp::mark):
19130         (KJS::ObjectImp::classInfo):
19131         (KJS::ObjectImp::get):
19132         (KJS::ObjectImp::getProperty):
19133         (KJS::ObjectImp::getPropertySlot):
19134         (KJS::ObjectImp::put):
19135         (KJS::ObjectImp::hasOwnProperty):
19136         (KJS::ObjectImp::defaultValue):
19137         (KJS::ObjectImp::findPropertyHashEntry):
19138         (KJS::ObjectImp::construct):
19139         (KJS::ObjectImp::callAsFunction):
19140         (KJS::ObjectImp::hasInstance):
19141         (KJS::ObjectImp::propList):
19142         (KJS::ObjectImp::toPrimitive):
19143         (KJS::ObjectImp::toNumber):
19144         (KJS::ObjectImp::toString):
19145         (KJS::ObjectImp::toObject):
19146         (KJS::ObjectImp::putDirect):
19147         (KJS::Error::create):
19148         (KJS::error):
19149         * kjs/object.h:
19150         (KJS::):
19151         (KJS::ObjectImp::getPropertySlot):
19152         (KJS::AllocatedValueImp::isObject):
19153         (KJS::ObjectImp::ObjectImp):
19154         (KJS::ObjectImp::internalValue):
19155         (KJS::ObjectImp::setInternalValue):
19156         (KJS::ObjectImp::prototype):
19157         (KJS::ObjectImp::setPrototype):
19158         (KJS::ObjectImp::inherits):
19159         * kjs/object_object.cpp:
19160         (ObjectPrototypeImp::ObjectPrototypeImp):
19161         (ObjectProtoFuncImp::ObjectProtoFuncImp):
19162         (ObjectProtoFuncImp::callAsFunction):
19163         (ObjectObjectImp::ObjectObjectImp):
19164         (ObjectObjectImp::construct):
19165         (ObjectObjectImp::callAsFunction):
19166         * kjs/object_object.h:
19167         * kjs/operations.cpp:
19168         (KJS::equal):
19169         (KJS::strictEqual):
19170         (KJS::relation):
19171         (KJS::add):
19172         (KJS::mult):
19173         * kjs/operations.h:
19174         * kjs/property_map.cpp:
19175         (KJS::PropertyMap::mark):
19176         (KJS::PropertyMap::addEnumerablesToReferenceList):
19177         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList):
19178         (KJS::PropertyMap::save):
19179         (KJS::PropertyMap::restore):
19180         * kjs/property_map.h:
19181         * kjs/property_slot.cpp:
19182         (KJS::PropertySlot::undefinedGetter):
19183         * kjs/property_slot.h:
19184         (KJS::PropertySlot::getValue):
19185         * kjs/protect.h:
19186         (KJS::gcUnprotectNullTolerant):
19187         (KJS::ProtectedValue::ProtectedValue):
19188         (KJS::ProtectedValue::~ProtectedValue):
19189         (KJS::ProtectedValue::operator=):
19190         (KJS::ProtectedValue::operator ValueImp *):
19191         (KJS::ProtectedValue::operator->):
19192         * kjs/protected_object.h:
19193         (KJS::ProtectedObject::ProtectedObject):
19194         (KJS::ProtectedObject::operator=):
19195         (KJS::ProtectedObject::operator ValueImp *):
19196         (KJS::ProtectedObject::operator ObjectImp *):
19197         (KJS::ProtectedObject::operator->):
19198         (KJS::ProtectedReference::ProtectedReference):
19199         (KJS::ProtectedReference::~ProtectedReference):
19200         (KJS::ProtectedReference::operator=):
19201         * kjs/protected_values.cpp:
19202         (KJS::ProtectedValues::getProtectCount):
19203         (KJS::ProtectedValues::increaseProtectCount):
19204         (KJS::ProtectedValues::insert):
19205         (KJS::ProtectedValues::decreaseProtectCount):
19206         * kjs/protected_values.h:
19207         * kjs/reference.cpp:
19208         (KJS::Reference::Reference):
19209         (KJS::Reference::makeValueReference):
19210         (KJS::Reference::getBase):
19211         (KJS::Reference::getValue):
19212         (KJS::Reference::putValue):
19213         (KJS::Reference::deleteValue):
19214         * kjs/reference.h:
19215         (KJS::Reference::baseIfMutable):
19216         * kjs/regexp_object.cpp:
19217         (RegExpPrototypeImp::RegExpPrototypeImp):
19218         (RegExpProtoFuncImp::RegExpProtoFuncImp):
19219         (RegExpProtoFuncImp::callAsFunction):
19220         (RegExpObjectImp::RegExpObjectImp):
19221         (RegExpObjectImp::arrayOfMatches):
19222         (RegExpObjectImp::backrefGetter):
19223         (RegExpObjectImp::construct):
19224         (RegExpObjectImp::callAsFunction):
19225         * kjs/regexp_object.h:
19226         * kjs/string_object.cpp:
19227         (StringInstanceImp::lengthGetter):
19228         (StringInstanceImp::indexGetter):
19229         (StringInstanceImp::getOwnPropertySlot):
19230         (StringInstanceImp::put):
19231         (StringPrototypeImp::StringPrototypeImp):
19232         (StringProtoFuncImp::StringProtoFuncImp):
19233         (regExpIsGlobal):
19234         (replace):
19235         (StringProtoFuncImp::callAsFunction):
19236         (StringObjectImp::StringObjectImp):
19237         (StringObjectImp::construct):
19238         (StringObjectImp::callAsFunction):
19239         (StringObjectFuncImp::StringObjectFuncImp):
19240         (StringObjectFuncImp::callAsFunction):
19241         * kjs/string_object.h:
19242         * kjs/testkjs.cpp:
19243         (TestFunctionImp::callAsFunction):
19244         (VersionFunctionImp::callAsFunction):
19245         (main):
19246         * kjs/value.cpp:
19247         (KJS::AllocatedValueImp::operator new):
19248         (KJS::AllocatedValueImp::getUInt32):
19249         (KJS::ValueImp::toInteger):
19250         (KJS::ValueImp::toInt32):
19251         (KJS::ValueImp::toUInt32):
19252         (KJS::ValueImp::toUInt16):
19253         (KJS::ValueImp::toObject):
19254         (KJS::AllocatedValueImp::getBoolean):
19255         (KJS::AllocatedValueImp::getNumber):
19256         (KJS::AllocatedValueImp::getString):
19257         (KJS::AllocatedValueImp::getObject):
19258         (KJS::jsString):
19259         (KJS::jsNumber):
19260         (KJS::ConstantValues::init):
19261         (KJS::ConstantValues::clear):
19262         (KJS::ConstantValues::mark):
19263         * kjs/value.h:
19264         (KJS::):
19265         (KJS::jsUndefined):
19266         (KJS::jsNull):
19267         (KJS::jsBoolean):
19268         (KJS::jsNaN):
19269         (KJS::ValueImp::ValueImp):
19270         (KJS::ValueImp::~ValueImp):
19271         (KJS::AllocatedValueImp::AllocatedValueImp):
19272         (KJS::AllocatedValueImp::~AllocatedValueImp):
19273         (KJS::AllocatedValueImp::isBoolean):
19274         (KJS::AllocatedValueImp::isNumber):
19275         (KJS::AllocatedValueImp::isString):
19276         (KJS::AllocatedValueImp::isObject):
19277         (KJS::AllocatedValueImp::marked):
19278         (KJS::AllocatedValueImp::mark):
19279         (KJS::ValueImp::downcast):
19280         (KJS::ValueImp::isUndefined):
19281         (KJS::ValueImp::isNull):
19282         (KJS::ValueImp::isUndefinedOrNull):
19283         (KJS::ValueImp::isBoolean):
19284         (KJS::ValueImp::isNumber):
19285         (KJS::ValueImp::isString):
19286         (KJS::ValueImp::isObject):
19287         (KJS::ValueImp::getBoolean):
19288         (KJS::ValueImp::getNumber):
19289         (KJS::ValueImp::getString):
19290         (KJS::ValueImp::getObject):
19291         (KJS::ValueImp::getUInt32):
19292         (KJS::ValueImp::mark):
19293         (KJS::ValueImp::marked):
19294         (KJS::ValueImp::type):
19295         (KJS::ValueImp::toPrimitive):
19296         (KJS::ValueImp::toBoolean):
19297         (KJS::ValueImp::toNumber):
19298         (KJS::ValueImp::toString):
19299         (KJS::jsZero):
19300         (KJS::jsOne):
19301         (KJS::jsTwo):
19302         (KJS::Undefined):
19303         (KJS::Null):
19304         (KJS::Boolean):
19305         (KJS::Number):
19306         (KJS::String):
19307
19308 2005-08-06  Maciej Stachowiak  <mjs@apple.com>
19309
19310         Reviewed by Darin.
19311
19312         Change over to the new PropertySlot mechanism for property
19313         lookup. This allows the elimination of hasOwnProperty
19314         methods. Also did some of the performance tuning enabled by this
19315         (but not yet all the possible improvements for function calls,
19316         assignment, ++, and so forth). And also much code cleanup.
19317
19318         Net result is about a 2% speedup on the JS iBench.
19319         
19320         Also redid Geoff's fix for the chrashing applet by avoiding a NULL
19321         prototype in the bindings code and using the default of Null()
19322         instead.
19323         
19324         * JavaScriptCore.xcodeproj/project.pbxproj:
19325         * bindings/objc/objc_runtime.h:
19326         * bindings/objc/objc_runtime.mm:
19327         (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
19328         (ObjcFallbackObjectImp::getOwnPropertySlot):
19329         * bindings/runtime_array.cpp:
19330         (RuntimeArrayImp::lengthGetter):
19331         (RuntimeArrayImp::indexGetter):
19332         (RuntimeArrayImp::getOwnPropertySlot):
19333         * bindings/runtime_array.h:
19334         * bindings/runtime_method.cpp:
19335         (RuntimeMethodImp::lengthGetter):
19336         (RuntimeMethodImp::getOwnPropertySlot):
19337         * bindings/runtime_method.h:
19338         * bindings/runtime_object.cpp:
19339         (RuntimeObjectImp::RuntimeObjectImp):
19340         (RuntimeObjectImp::fallbackObjectGetter):
19341         (RuntimeObjectImp::fieldGetter):
19342         (RuntimeObjectImp::methodGetter):
19343         (RuntimeObjectImp::getOwnPropertySlot):
19344         * bindings/runtime_object.h:
19345         * bindings/runtime_root.h:
19346         * kjs/array_instance.h:
19347         * kjs/array_object.cpp:
19348         (ArrayInstanceImp::lengthGetter):
19349         (ArrayInstanceImp::getOwnPropertySlot):
19350         (ArrayPrototypeImp::getOwnPropertySlot):
19351         * kjs/array_object.h:
19352         * kjs/date_object.cpp:
19353         (DatePrototypeImp::getOwnPropertySlot):
19354         * kjs/date_object.h:
19355         * kjs/function.cpp:
19356         (KJS::FunctionImp::argumentsGetter):
19357         (KJS::FunctionImp::lengthGetter):
19358         (KJS::FunctionImp::getOwnPropertySlot):
19359         (KJS::FunctionImp::put):
19360         (KJS::FunctionImp::deleteProperty):
19361         (KJS::ArgumentsImp::mappedIndexGetter):
19362         (KJS::ArgumentsImp::getOwnPropertySlot):
19363         (KJS::ActivationImp::argumentsGetter):
19364         (KJS::ActivationImp::getArgumentsGetter):
19365         (KJS::ActivationImp::getOwnPropertySlot):
19366         (KJS::ActivationImp::deleteProperty):
19367         * kjs/function.h:
19368         * kjs/internal.cpp:
19369         (InterpreterImp::InterpreterImp):
19370         (InterpreterImp::initGlobalObject):
19371         (InterpreterImp::~InterpreterImp):
19372         (InterpreterImp::evaluate):
19373         * kjs/internal.h:
19374         (KJS::InterpreterImp::globalExec):
19375         * kjs/interpreter.cpp:
19376         (Interpreter::Interpreter):
19377         (Interpreter::createLanguageInstanceForValue):
19378         * kjs/interpreter.h:
19379         (KJS::Interpreter::argumentsIdentifier):
19380         (KJS::Interpreter::specialPrototypeIdentifier):
19381         * kjs/lookup.h:
19382         (KJS::staticFunctionGetter):
19383         (KJS::staticValueGetter):
19384         (KJS::getStaticPropertySlot):
19385         (KJS::getStaticFunctionSlot):
19386         (KJS::getStaticValueSlot):
19387         * kjs/math_object.cpp:
19388         (MathObjectImp::getOwnPropertySlot):
19389         * kjs/math_object.h:
19390         * kjs/nodes.cpp:
19391         (ResolveNode::evaluate):
19392         (ResolveNode::evaluateReference):
19393         (AccessorNode1::evaluate):
19394         (AccessorNode2::evaluate):
19395         * kjs/number_object.cpp:
19396         (NumberObjectImp::getOwnPropertySlot):
19397         * kjs/number_object.h:
19398         * kjs/object.cpp:
19399         (KJS::ObjectImp::get):
19400         (KJS::ObjectImp::getProperty):
19401         (KJS::ObjectImp::getPropertySlot):
19402         (KJS::ObjectImp::getOwnPropertySlot):
19403         (KJS::ObjectImp::put):
19404         (KJS::ObjectImp::hasProperty):
19405         (KJS::ObjectImp::hasOwnProperty):
19406         * kjs/object.h:
19407         (KJS::ObjectImp::getDirectLocation):
19408         (KJS::ObjectImp::getPropertySlot):
19409         (KJS::ObjectImp::getOwnPropertySlot):
19410         * kjs/object_wrapper.h: Added.
19411         (KJS::):
19412         (KJS::Object::Object):
19413         (KJS::Object::operator ObjectImp *):
19414         * kjs/property_map.cpp:
19415         (KJS::PropertyMap::getLocation):
19416         * kjs/property_map.h:
19417         * kjs/property_slot.cpp: Added.
19418         (KJS::PropertySlot::undefinedGetter):
19419         * kjs/property_slot.h: Added.
19420         (KJS::PropertySlot::isSet):
19421         (KJS::PropertySlot::getValue):
19422         (KJS::PropertySlot::setValueSlot):
19423         (KJS::PropertySlot::setStaticEntry):
19424         (KJS::PropertySlot::setCustom):
19425         (KJS::PropertySlot::setCustomIndex):
19426         (KJS::PropertySlot::setUndefined):
19427         (KJS::PropertySlot::slotBase):
19428         (KJS::PropertySlot::staticEntry):
19429         (KJS::PropertySlot::index):
19430         (KJS::PropertySlot::):
19431         * kjs/protect.h:
19432         * kjs/protected_object.h: Added.
19433         (KJS::ProtectedObject::ProtectedObject):
19434         (KJS::ProtectedObject::~ProtectedObject):
19435         (KJS::ProtectedObject::operator=):
19436         (KJS::ProtectedReference::ProtectedReference):
19437         (KJS::ProtectedReference::~ProtectedReference):
19438         (KJS::ProtectedReference::operator=):
19439         * kjs/reference.h:
19440         * kjs/reference_list.cpp:
19441         * kjs/regexp_object.cpp:
19442         (RegExpObjectImp::backrefGetter):
19443         (RegExpObjectImp::getOwnPropertySlot):
19444         * kjs/regexp_object.h:
19445         * kjs/string_object.cpp:
19446         (StringInstanceImp::lengthGetter):
19447         (StringInstanceImp::indexGetter):
19448         (StringInstanceImp::getOwnPropertySlot):
19449         (StringPrototypeImp::getOwnPropertySlot):
19450         * kjs/string_object.h:
19451
19452 2005-08-05  Adele Peterson  <adele@apple.com>
19453
19454         Reviewed by Darin.
19455
19456         * JavaScriptCore.xcodeproj/project.pbxproj: Unchecked 'statics are thread safe' option.
19457
19458 2005-08-05  Geoffrey Garen  <ggaren@apple.com>
19459
19460         -fixed <rdar://problem/4207220> REGRESSION (DENVER): Crash occurs 
19461         after clicking on Hangman applet
19462
19463         Reviewed by darin.
19464
19465         * kjs/object.cpp:
19466         (KJS::ObjectImp::hasProperty): added check for null prototype.
19467
19468         FIXME: The long-term plan is to make runtime objects use JS Null()
19469         instead of null pointers, which will allow us to eliminate null
19470         checks, improving performance.
19471
19472 2005-08-05  Geoffrey Garen  <ggaren@apple.com>
19473
19474         Fix by darin, reviewed by me.
19475         
19476         - rolled in fix for: <rdar://problem/4161606> JavaScript regular 
19477         expressions with certain ranges of Unicode characters cause a crash
19478
19479         Test cases added:
19480
19481         * layout-tests/fast/js/regexp-big-unicode-ranges-expected.txt: Added.
19482         * layout-tests/fast/js/regexp-big-unicode-ranges.html: Added.
19483
19484         * pcre/pcre.c:
19485         (compile_branch): added checks for characters > 255
19486
19487 2005-08-04  Maciej Stachowiak  <mjs@apple.com>
19488
19489         - updated expected test results now that we no longer exlude the
19490         date tests (apparently this was overlooked)
19491
19492         * tests/mozilla/expected.html:
19493
19494 2005-07-31  Darin Adler  <darin@apple.com>
19495
19496         Reviewed by Maciej.
19497
19498         - remove uses of Mac-OS-X-specific MAX macro
19499         - remove one of the many excess "APPLE_CHANGES" ifdefs
19500
19501         * kjs/collector.cpp: (KJS::Collector::allocate): Use std::max instead of MAX.
19502         * kjs/property_map.cpp: (KJS::PropertyMap::rehash): Ditto.
19503         * kjs/ustring.cpp:
19504         (KJS::UChar::toLower): Take out non-ICU code path.
19505         (KJS::UChar::toUpper): Ditto.
19506         (KJS::UString::spliceSubstringsWithSeparators): Use std::max instead of MAX.
19507
19508 2005-07-27  Geoffrey Garen  <ggaren@apple.com>
19509
19510         - fixed http://bugs.webkit.org/show_bug.cgi?id=4147
19511         Array.toString() and toLocaleString() improvements from KDE KJS
19512         (rolled in KDE changes)
19513
19514         Test cases added:
19515
19516         * layout-tests/fast/js/toString-overrides-expected.txt: Added.
19517         * layout-tests/fast/js/toString-overrides.html: Added.
19518         
19519         * kjs/array_object.cpp:
19520         (ArrayProtoFuncImp::call):
19521
19522 2005-07-27  Maciej Stachowiak  <mjs@apple.com>
19523
19524         Changes by Michael Kahl, reviewed by me.
19525
19526         - fixed <rdar://problem/4194278> Need better debugging support in JavaScriptCore
19527         
19528         * JavaScriptCore.xcodeproj/project.pbxproj:
19529         * kjs/debugger.cpp:
19530         (KJS::AttachedInterpreter::AttachedInterpreter):
19531         (KJS::AttachedInterpreter::~AttachedInterpreter):
19532         (Debugger::~Debugger):
19533         (Debugger::attach):
19534         (Debugger::detach):
19535         (Debugger::sourceParsed):
19536         * kjs/debugger.h:
19537         * kjs/function.cpp:
19538         (KJS::FunctionImp::call):
19539         (KJS::GlobalFuncImp::call):
19540         * kjs/function_object.cpp:
19541         (FunctionObjectImp::construct):
19542         * kjs/grammar.y:
19543         * kjs/internal.cpp:
19544         (Parser::parse):
19545         (InterpreterImp::evaluate):
19546         * kjs/internal.h:
19547         (KJS::InterpreterImp::setDebugger):
19548         * kjs/interpreter.cpp:
19549         * kjs/interpreter.h:
19550         (KJS::Interpreter::imp):
19551         * kjs/nodes.cpp:
19552
19553 2005-07-27  Geoffrey Garen  <ggaren@apple.com>
19554
19555         - fixed http://bugs.webkit.org/show_bug.cgi?id=3381
19556         Date.prototype.setDate() incorrect for values >=128
19557         
19558         - Test cases added:
19559
19560         * layout-tests/fast/js/date-big-setdate-expected.txt: Added.
19561         * layout-tests/fast/js/date-big-setdate.html: Added.
19562
19563         Reviewed by darin.
19564
19565         * kjs/date_object.cpp:
19566         (DateProtoFuncImp::call):
19567
19568 2005-07-27  Geoffrey Garen  <ggaren@apple.com>
19569
19570         -rolled in patch by Carsten Guenther <cguenther@gmail.com>
19571         for http://bugs.webkit.org/show_bug.cgi?id=3759
19572         Date object enhancements
19573         
19574         Test cases added:
19575
19576         * layout-tests/fast/js/date-preserve-milliseconds-expected.txt: Added.
19577         * layout-tests/fast/js/date-preserve-milliseconds.html: Added.
19578
19579         Reviewed by darin.
19580
19581         * kjs/date_object.cpp:
19582         (timeFromArgs):
19583         (DateProtoFuncImp::call):
19584         (DateObjectImp::construct):
19585         (DateObjectFuncImp::call):
19586         (KJS::makeTime):
19587         * kjs/date_object.h:
19588         * tests/mozilla/expected.html:
19589
19590 2005-07-26  Justin Garcia  <justin.garcia@apple.com>
19591
19592         Added a forward declaration to fix gcc4 build error
19593
19594         * kjs/function.h:
19595
19596 2005-07-25  Geoffrey Garen  <ggaren@apple.com>
19597         - fixed mistake in my last checkin -- the expected results included
19598         results from a patch that hasn't landed yet.
19599         
19600         * tests/mozilla/expected.html:
19601
19602 2005-07-25  Maciej Stachowiak  <mjs@apple.com>
19603
19604         - fix mistake in last change that leads to assertion failure in the Development build
19605
19606         * kjs/lookup.h:
19607         (KJS::lookupGetOwnValue):
19608
19609 2005-07-24  Maciej Stachowiak  <mjs@apple.com>
19610
19611         Reviewed by Darin.
19612
19613         - http://bugs.webkit.org/show_bug.cgi?id=4124
19614         (change JavaScript property access to avoid double lookup)
19615
19616         - 10% speedup on JavaScript iBench
19617         - 5% speedup on 24fun BenchJS benchmark
19618
19619         Changed all get methods to getOwnProperty - they are no longer
19620         responsible for prototype lookup, and determine if the property
19621         was found as a side efect. 
19622
19623         get() is now a nonvirtual ObjectImp method which calls the virtual
19624         getOwnProperty and walks the prototype chain. A few selected
19625         methods were inlined.
19626
19627         Changed ResolveNode::evaluate plus some other places to use
19628         getProperty which does get() and hasProperty() in one lookup.
19629
19630         Also miscellaneous code cleanup.
19631         
19632         * bindings/objc/objc_runtime.h:
19633         * bindings/objc/objc_runtime.mm:
19634         (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
19635         (ObjcFallbackObjectImp::getOwnProperty):
19636         * bindings/runtime_array.cpp:
19637         (RuntimeArrayImp::RuntimeArrayImp):
19638         (RuntimeArrayImp::getOwnProperty):
19639         * bindings/runtime_array.h:
19640         * bindings/runtime_method.cpp:
19641         (RuntimeMethodImp::getOwnProperty):
19642         * bindings/runtime_method.h:
19643         * bindings/runtime_object.cpp:
19644         (RuntimeObjectImp::getOwnProperty):
19645         * bindings/runtime_object.h:
19646         * kjs/array_instance.h:
19647         * kjs/array_object.cpp:
19648         (ArrayInstanceImp::getOwnProperty):
19649         (ArrayPrototypeImp::getOwnProperty):
19650         (ArrayProtoFuncImp::call):
19651         * kjs/array_object.h:
19652         * kjs/date_object.cpp:
19653         (DatePrototypeImp::getOwnProperty):
19654         * kjs/date_object.h:
19655         * kjs/function.cpp:
19656         (KJS::FunctionImp::getOwnProperty):
19657         (KJS::ArgumentsImp::getOwnProperty):
19658         (KJS::ActivationImp::getOwnProperty):
19659         * kjs/function.h:
19660         * kjs/lookup.h:
19661         (KJS::lookupGetOwnProperty):
19662         (KJS::lookupGetOwnFunction):
19663         (KJS::lookupGetOwnValue):
19664         * kjs/math_object.cpp:
19665         (MathObjectImp::getOwnProperty):
19666         (MathObjectImp::getValueProperty):
19667         * kjs/math_object.h:
19668         * kjs/nodes.cpp:
19669         (ResolveNode::evaluate):
19670         * kjs/number_object.cpp:
19671         (NumberObjectImp::getOwnProperty):
19672         * kjs/number_object.h:
19673         * kjs/object.cpp:
19674         (KJS::ObjectImp::get):
19675         (KJS::ObjectImp::getOwnProperty):
19676         (KJS::ObjectImp::getProperty):
19677         * kjs/object.h:
19678         (KJS::ObjectImp::getProperty):
19679         (KJS::ObjectImp::getOwnProperty):
19680         * kjs/object_object.cpp:
19681         (ObjectProtoFuncImp::call):
19682         * kjs/regexp_object.cpp:
19683         (RegExpObjectImp::getOwnProperty):
19684         * kjs/regexp_object.h:
19685         * kjs/string_object.cpp:
19686         (StringInstanceImp::getOwnProperty):
19687         (StringPrototypeImp::getOwnProperty):
19688         * kjs/string_object.h:
19689
19690 2005-07-25  Geoffrey Garen  <ggaren@apple.com>
19691
19692         - fixed http://bugs.webkit.org/show_bug.cgi?id=3971
19693         JS test suite depends on JS 1.2 behavior
19694         
19695         Reviewed by darin.
19696
19697         * tests/mozilla/js1_2/Array/tostring_1.js: now tests only for JS 1.5 behavior
19698         * tests/mozilla/js1_2/Array/tostring_2.js: ditto
19699         * tests/mozilla/expected.html:
19700
19701 2005-07-24  Justin Garcia  <justin.garcia@apple.com>
19702
19703         Reviewed by kevin.
19704
19705         Fixes make clean problem introduced in xcode2.1 transition
19706
19707         * Makefile.am:
19708
19709 2005-07-22  Geoffrey Garen  <ggaren@apple.com>
19710
19711         Reviewed by darin.
19712
19713         * kjs/date_object.cpp: DatePrototypeImp now identifies itself as a
19714         child class of DateInstanceImp -- this enables calls to Date.ValueOf().
19715         
19716         fixes: ecma/Date/15.9.5.js (once we enable the date tests).
19717
19718 2005-07-22  Geoffrey Garen  <ggaren@apple.com>
19719
19720         
19721         Reviewed by darin.
19722
19723         * tests/mozilla/jsDriver.pl: now takes the path to testkjs as a command-line argument
19724         * tests/mozilla/run-mozilla-tests: Removed.
19725
19726 2005-07-21  Geoffrey Garen  <ggaren@apple.com>
19727
19728         * JavaScriptCore.xcodeproj/.cvsignore: Added.
19729
19730 2005-07-21  Geoffrey Garen  <ggaren@apple.com>
19731
19732         * JavaScriptCore.pbproj/project.pbxproj: Removed.
19733         * JavaScriptCore.xcodeproj/ggaren.pbxuser: Added.
19734         * JavaScriptCore.xcodeproj/ggaren.perspective: Added.
19735         * JavaScriptCore.xcodeproj/project.pbxproj: Added.
19736         * Makefile.am:
19737
19738 2005-07-20  Maciej Stachowiak  <mjs@apple.com>
19739
19740         Patch from Trey Matteson <trey@usa.net>, reviewed by me.
19741
19742         - fixed http://bugs.webkit.org/show_bug.cgi?id=3956
19743         some of WebKit builds with symbols, some doesn't
19744         
19745         * JavaScriptCore.pbproj/project.pbxproj: Generate symbols even for
19746         Deployment.
19747
19748 2005-07-19  Geoffrey Garen  <ggaren@apple.com>
19749
19750         -fixed http://bugs.webkit.org/show_bug.cgi?id=3991
19751         JSC doesn't implement Array.prototype.toLocaleString()
19752
19753         -test failure: ecma_3/Array/15.4.4.3-1.js
19754
19755         Reviewed by mjs.
19756
19757         * kjs/array_object.cpp:
19758         (ArrayProtoFuncImp::call): now searches for toString and
19759         toLocaleString overrides in the array's elements
19760
19761         * tests/mozilla/expected.html: failures are under 100! woohoo!
19762
19763 2005-07-19  Darin Adler  <darin@apple.com>
19764
19765         - fixed the build
19766
19767         * kjs/lookup.h: (KJS::lookupPut): Remove bogus const; was preventing WebCore from
19768         compiling (not sure why this didn't affect my other build machine).
19769
19770         - one other tiny tweak (so sue me)
19771
19772         * bindings/runtime_root.cpp: Remove unneeded declaration.
19773
19774 2005-07-19  Darin Adler  <darin@apple.com>
19775
19776         Reviewed by Geoff Garen.
19777
19778         - eliminated try wrappers for get/put/call since we don't use C++ exceptions any more
19779
19780         * kjs/lookup.h: Changed tryCall in IMPLEMENT_PROTOFUNC here to call. It doesn't make
19781         sense for this macro to use the name tryCall anyway, since that's specific to how
19782         WebCore used this, so this is good anyway. On the other hand, it might be a problem
19783         for KDOM or KSVG, in which case we'll need another macro for them, since JavaScriptCore
19784         should presumably not have the C++ exception support.
19785
19786 2005-07-18  Geoffrey Garen  <ggaren@apple.com>
19787
19788         -fixed http://bugs.webkit.org/show_bug.cgi?id=4008
19789         Error objects report incorrect length
19790         
19791         Reviewed by darin.
19792
19793         * kjs/error_object.cpp: Error objects now include a length property
19794         (ErrorObjectImp::ErrorObjectImp):
19795
19796         * tests/mozilla/expected.html: updated expected results to reflect fix
19797         * tests/mozilla/js1_5/Exceptions/regress-123002.js: test now expects 
19798         ecma compliant results
19799
19800 2005-07-15  Geoffrey Garen  <ggaren@apple.com>
19801
19802         -rolled in KDE fixes for http://bugs.webkit.org/show_bug.cgi?id=3601
19803         Error instance type info
19804         
19805         Reviewed by mjs.
19806
19807         * kjs/error_object.cpp:
19808         - Created ErrorInstanceImp class for Error() objects. 
19809         - Changed parent object for Native Errors to "Function" (matches
19810         ECMA spec).
19811         (ErrorInstanceImp::ErrorInstanceImp):
19812         (ErrorProtoFuncImp::call):
19813         (ErrorObjectImp::construct):
19814         (NativeErrorImp::construct):
19815
19816         * kjs/error_object.h:
19817         (KJS::ErrorInstanceImp::classInfo):
19818         * kjs/object.h: made comment more informative about ClassInfo
19819
19820         * tests/mozilla/expected.html:
19821
19822 2005-07-14  Geoffrey Garen  <ggaren@apple.com>
19823
19824         - fixed: JS test suite expects an out of memory error
19825         that our memory efficiency avoids
19826         
19827         Reviewed by mjs.
19828
19829         * tests/mozilla/js1_5/Array/regress-157652.js:
19830         test now expects normal execution
19831         
19832         * tests/mozilla/expected.html:
19833
19834 2005-07-14  Geoffrey Garen  <ggaren@apple.com>
19835         - fixed http://bugs.webkit.org/show_bug.cgi?id=4006
19836         testkjs doesn't implement gc()
19837         
19838         - test failure:
19839         ecma_3/Function/regress-104584.js
19840         
19841         Reviewed by mjs.
19842
19843         * kjs/interpreter.cpp:
19844         (Interpreter::finalCheck): removed misleading while && comment
19845
19846         * kjs/testkjs.cpp: added "gc" function to global object
19847         (TestFunctionImp::):
19848         (TestFunctionImp::call):
19849         (main):
19850
19851         * tests/mozilla/expected.html:
19852
19853 2005-07-14  Geoffrey Garen  <ggaren@apple.com>
19854
19855         -rolled in patches for http://bugs.webkit.org/show_bug.cgi?id=3945
19856         [PATCH] Safe merges of comments and other trivialities from KDE's kjs
19857         
19858         -patch by Martijn Klingens <klingens@kde.org>
19859         
19860         * kjs/array_instance.h:
19861         * kjs/array_object.cpp:
19862         * kjs/array_object.h:
19863         * kjs/bool_object.cpp:
19864         * kjs/bool_object.h:
19865         * kjs/collector.cpp:
19866         * kjs/collector.h:
19867         * kjs/completion.h:
19868         * kjs/context.h:
19869         * kjs/date_object.cpp:
19870         * kjs/date_object.h:
19871         * kjs/debugger.cpp:
19872         * kjs/debugger.h:
19873         * kjs/dtoa.h:
19874         * kjs/error_object.cpp:
19875         * kjs/error_object.h:
19876         * kjs/function.cpp:
19877         * kjs/function.h:
19878         * kjs/function_object.cpp:
19879         * kjs/function_object.h:
19880         * kjs/grammar.y:
19881         * kjs/identifier.cpp:
19882         * kjs/identifier.h:
19883         * kjs/internal.cpp:
19884         * kjs/internal.h:
19885         * kjs/interpreter.cpp:
19886         * kjs/interpreter.h:
19887         * kjs/interpreter_map.cpp:
19888         * kjs/interpreter_map.h:
19889         * kjs/lexer.cpp:
19890         * kjs/lexer.h:
19891         * kjs/list.cpp:
19892         * kjs/list.h:
19893         * kjs/lookup.cpp:
19894         * kjs/lookup.h:
19895         * kjs/math_object.cpp:
19896         * kjs/math_object.h:
19897         * kjs/nodes.cpp:
19898         * kjs/nodes.h:
19899         * kjs/nodes2string.cpp:
19900         * kjs/number_object.cpp:
19901         * kjs/number_object.h:
19902         * kjs/object.cpp:
19903         * kjs/object.h:
19904         * kjs/object_object.cpp:
19905         * kjs/object_object.h:
19906         * kjs/operations.cpp:
19907         * kjs/operations.h:
19908         * kjs/property_map.cpp:
19909         * kjs/property_map.h:
19910         * kjs/reference.cpp:
19911         * kjs/reference.h:
19912         * kjs/reference_list.cpp:
19913         * kjs/reference_list.h:
19914         * kjs/regexp.cpp:
19915         * kjs/regexp.h:
19916         * kjs/regexp_object.cpp:
19917         * kjs/regexp_object.h:
19918         * kjs/scope_chain.cpp:
19919         * kjs/scope_chain.h:
19920         * kjs/simple_number.h:
19921         * kjs/string_object.cpp:
19922         * kjs/string_object.h:
19923         * kjs/testkjs.cpp:
19924         * kjs/types.h:
19925         * kjs/ustring.cpp:
19926         * kjs/ustring.h:
19927         * kjs/value.cpp:
19928         * kjs/value.h:
19929
19930 2005-07-14  Geoffrey Garen  <ggaren@apple.com>
19931
19932         -fixed http://bugs.webkit.org/show_bug.cgi?id=3970
19933         throw statements fail inside eval statements
19934         
19935         Reviewed by mjs.
19936
19937         * kjs/function.cpp:
19938         (KJS::GlobalFuncImp::call):
19939         Big change since I fixed the tabbing. The important part is:
19940         if (c.complType() == Throw)
19941           exec->setException(c.value());
19942
19943         * kjs/nodes.cpp:
19944         (ThrowNode::execute): removed duplicate KJS_CHECKEXCEPTION
19945         (TryNode::execute): 
19946         try now clears the exception state before the finally block executes,
19947         and checks the state after the block executes, so that exceptions in
19948         finally code get caught.
19949
19950         * tests/mozilla/expected.html:
19951
19952 2005-07-14  Geoffrey Garen  <ggaren@apple.com>
19953         
19954         -landed fix for http://bugs.webkit.org/show_bug.cgi?id=3412
19955         Object.prototype is missing toLocaleString
19956
19957         - patch by Mark Rowe (bdash) <opendarwin.org@bdash.net.nz>
19958         
19959         -layout test info in webcore changelog
19960
19961         Reviewed by mjs.
19962
19963         * kjs/object_object.cpp:
19964         (ObjectPrototypeImp::ObjectPrototypeImp):
19965         (ObjectProtoFuncImp::call):
19966         * kjs/object_object.h:
19967         (KJS::ObjectProtoFuncImp::):
19968
19969 2005-07-12  Geoffrey Garen  <ggaren@apple.com>
19970
19971         Reviewed by mjs.
19972
19973         * kjs/function.cpp:
19974         (KJS::IndexToNameMap::operator[]): fixed infinite recursion
19975         bug in last checkin
19976
19977 2005-07-12  Geoffrey Garen  <ggaren@apple.com>
19978
19979         -fixed http://bugs.webkit.org/show_bug.cgi?id=3881
19980         arguments object should share values with function parameters
19981
19982         Reviewed by mjs.
19983
19984         ArgumentsImp now uses a simple hash lookup to share values
19985         with the activation object.
19986
19987         * kjs/function.cpp:
19988         (KJS::FunctionImp::getParameterName):
19989         (KJS::IndexToNameMap::IndexToNameMap):
19990         (KJS::IndexToNameMap::~IndexToNameMap):
19991         (KJS::IndexToNameMap::isMapped):
19992         (KJS::IndexToNameMap::unMap):
19993         (KJS::IndexToNameMap::operator[]):
19994         (KJS::ArgumentsImp::ArgumentsImp):
19995         (KJS::ArgumentsImp::mark):
19996         (KJS::ArgumentsImp::get):
19997         (KJS::ArgumentsImp::put):
19998         (KJS::ArgumentsImp::deleteProperty):
19999         (KJS::ArgumentsImp::hasOwnProperty):
20000         (KJS::ActivationImp::createArgumentsObject):
20001         * kjs/function.h:
20002         * tests/mozilla/expected.html: updated results
20003
20004 2005-07-09  Maciej Stachowiak  <mjs@apple.com>
20005
20006         - backing out my earlier collector change, it causes a performance regression in TOT
20007
20008         * kjs/collector.cpp:
20009         (KJS::Collector::allocate):
20010
20011 2005-07-08  Eric Seidel  <eseidel@apple.com>
20012
20013         Reviewed by mjs/hyatt (only in concept).
20014
20015         * JavaScriptCore.pbproj/project.pbxproj: Added JavaScriptCore+SVG
20016         Turns on RTTI support for JavaScriptCore.framework when
20017         building the JavaScriptCore+SVG target.  This is needed as
20018         kdom (part of WebCore+SVG) requires RTTI for the time being.
20019
20020 2005-07-08  Maciej Stachowiak  <mjs@apple.com>
20021
20022         Reviewed by hyatt.
20023
20024         - When there are many live objects, GC less often, to try to make
20025         GC cost proportional to garbage, not proportional to total memory used.
20026
20027         * kjs/collector.cpp:
20028         (KJS::Collector::allocate):
20029
20030 2005-07-08  Vicki Murley  <vicki@apple.com>
20031
20032         Fix from Carsten Guenther, reviewed by Maciej
20033
20034         - fixed http://bugs.webkit.org/show_bug.cgi?id=3644 (Error string representation)
20035
20036         Switch from "-" to ":" in error strings.
20037
20038         * kjs/error_object.cpp:
20039         (ErrorProtoFuncImp::call):
20040         * tests/mozilla/expected.html:
20041
20042 2005-07-08  Geoffrey Garen  <ggaren@apple.com>
20043
20044         -rolled in patch for http://bugs.webkit.org/show_bug.cgi?id=3878
20045         arguments object should be an object not an array
20046
20047         Reviewed by mjs.
20048
20049         * kjs/function.cpp:
20050         (KJS::ArgumentsImp::ArgumentsImp): now manually handles initialization
20051         we used to get for free by inheriting from ArrayInstanceImp
20052         * kjs/function.h: ArgumentsImp now inherits from ObjectImp
20053         * tests/mozilla/expected.html: updated expected test results
20054
20055 2005-07-07  Eric Seidel  <eseidel@apple.com>
20056
20057         Reviewed by mjs.
20058
20059         * kjs/grammar.y: removed #define YYMAXDEPTH 0 for bison 2.0
20060         http://bugs.webkit.org/show_bug.cgi?id=3882
20061
20062 2005-07-03  Maciej Stachowiak  <mjs@apple.com>
20063
20064         Original patch from Mark Rowe <opendarwin.org@bdash.net.nz>, reviewed by me.
20065         Fixes to patch by me, reviewed by John Sullivan.
20066
20067         - fixed http://bugs.webkit.org/show_bug.cgi?id=3293
20068
20069         Test cases added:
20070         * tests/mozilla/expected.html: Two tests newly pass.
20071
20072         * bindings/objc/objc_runtime.h:
20073         * bindings/objc/objc_runtime.mm:
20074         (ObjcFallbackObjectImp::hasOwnProperty):
20075         * bindings/runtime_array.cpp:
20076         (RuntimeArrayImp::hasOwnProperty):
20077         * bindings/runtime_array.h:
20078         * bindings/runtime_object.cpp:
20079         (RuntimeObjectImp::hasOwnProperty):
20080         * bindings/runtime_object.h:
20081         * kjs/array_instance.h:
20082         * kjs/array_object.cpp:
20083         (ArrayInstanceImp::hasOwnProperty):
20084         * kjs/function.cpp:
20085         (KJS::FunctionImp::hasOwnProperty):
20086         (KJS::ActivationImp::hasOwnProperty):
20087         * kjs/function.h:
20088         * kjs/lookup.h:
20089         * kjs/object.cpp:
20090         (KJS::ObjectImp::hasProperty):
20091         (KJS::ObjectImp::hasOwnProperty):
20092         * kjs/object.h:
20093         (KJS::Object::hasOwnProperty):
20094         * kjs/object_object.cpp:
20095         (ObjectPrototypeImp::ObjectPrototypeImp):
20096         (ObjectProtoFuncImp::call):
20097         * kjs/object_object.h:
20098         (KJS::ObjectProtoFuncImp::):
20099         * kjs/string_object.cpp:
20100         (StringInstanceImp::hasOwnProperty):
20101         * kjs/string_object.h:
20102
20103 2005-07-01  Geoffrey Garen  <ggaren@apple.com>
20104
20105         -landed patch by Eric Seidel <macdome@opendarwin.org>
20106         
20107         -for http://bugs.webkit.org/show_bug.cgi?id=3657
20108         GroundWork:  Moving some functions from khtml->jsc following kjs TOT
20109         
20110         - no layout test necessary yet - only groundwork
20111
20112         Reviewed by darin.
20113
20114         * kjs/lookup.h:
20115         (KJS::cacheGlobalObject):
20116
20117 2005-07-01  Geoffrey Garen  <ggaren@apple.com>
20118
20119         -landed patch by Carsten Guenther <cguenther@gmail.com>
20120
20121         -fixes http://bugs.webkit.org/show_bug.cgi?id=3477
20122         some US-centric date formats not parsed by JavaScript (clock at news8austin.com)
20123
20124         -relevant tests:
20125                mozilla/ecma_3/Date/15.9.5.5.js 
20126                layout-tests/fast/js/date-parse-test.html
20127
20128         Reviewed by darin.
20129
20130         * kjs/date_object.cpp:
20131         (formatLocaleDate):
20132         (day):
20133         (dayFromYear):
20134         (daysInYear):
20135         (timeFromYear):
20136         (yearFromTime):
20137         (weekDay):
20138         (timeZoneOffset):
20139         (DateProtoFuncImp::call):
20140         (DateObjectImp::construct):
20141         (KJS::parseDate):
20142         (ymdhms_to_seconds):
20143         (KJS::makeTime):
20144         (findMonth):
20145         (KJS::KRFCDate_parseDate):
20146         * kjs/date_object.h:
20147         * tests/mozilla/expected.html: updated expected results to reflect fix
20148
20149 2005-07-01  Geoffrey Garen  <ggaren@apple.com>
20150
20151         -fixed <rdar://problem/4168186> JavaScript fails to throw exceptions 
20152         for invalid return statements
20153         
20154         relevant tests:
20155             ecma/Statements/12.9-1-n.js
20156             ecma_2/Exceptions/lexical-052.js
20157             ecma_2/Exceptions/statement-009.js
20158
20159         Reviewed by sullivan.
20160
20161         * kjs/nodes.cpp:
20162         (ReturnNode::execute): now throws exception if return is not inside
20163         a function.
20164
20165         * tests/mozilla/expected.html: updated to reflect fix
20166
20167 2005-07-01  Geoffrey Garen  <ggaren@apple.com>
20168
20169         Reviewed by sullivan.
20170
20171         * tests/mozilla/expected.html: Updated test results for last fix.
20172
20173 2005-07-01  Geoffrey Garen  <ggaren@apple.com>
20174
20175         -fixed <rdar://problem/4168161> JavaScript fails to throw an exception 
20176         for invalid function calls
20177         
20178         Reviewed by sullivan.
20179
20180         Relevant mozilla test: ecma_3/Exceptions/regress-95101.js 
20181
20182         * kjs/nodes.cpp:
20183         (FunctionCallNode::evaluate): evaluate now checks for an exception
20184         after resolving a function name (in case the function is undefined)
20185
20186 2005-07-01  Eric Seidel  <eseidel@apple.com>
20187
20188         Reviewed by darin.
20189
20190         * kjs/interpreter.h:
20191         (KJS::Context::curStmtFirstLine): stub for compatibility with KDE
20192         * kjs/value.h:
20193         (KJS::Value::isValid): compatibility with KDE
20194         http://bugs.webkit.org/show_bug.cgi?id=3687
20195
20196 2005-07-01  Eric Seidel  <eseidel@apple.com>
20197
20198         Reviewed by darin.
20199
20200         * kjs/create_hash_table: rolled in changes from KDE, including
20201         -n <namespace> support from KDOM and support for newer comments
20202         http://bugs.webkit.org/show_bug.cgi?id=3771
20203
20204 2005-06-30  Geoffrey Garen  <ggaren@apple.com>
20205
20206         -rolled in KDE fix to <rdar://problem/4167660> JavaScript fails to 
20207         throw exceptions for invalid break/continue statements
20208
20209         No layout tests because it's already covered by the Mozilla suite
20210
20211         Reviewed by mjs.
20212
20213         * kjs/internal.h: LabelStack now tracks where you are relative to
20214         switch and iteration (loop) statements
20215         
20216         (KJS::LabelStack::LabelStack):
20217         (KJS::LabelStack::pushIteration):
20218         (KJS::LabelStack::popIteration):
20219         (KJS::LabelStack::inIteration):
20220         (KJS::LabelStack::pushSwitch):
20221         (KJS::LabelStack::popSwitch):
20222         (KJS::LabelStack::inSwitch):
20223
20224         * kjs/nodes.cpp: 
20225         These files were updated to use the new LabelStack:
20226         (DoWhileNode::execute): 
20227         (WhileNode::execute):
20228         (ForNode::execute):
20229         (ForInNode::execute):
20230         (SwitchNode::execute):
20231         
20232         These files were updated to throw exceptions for invalid
20233         break/continue statements:
20234         (BreakNode::execute): 
20235         (ContinueNode::execute):
20236
20237         * tests/mozilla/expected.html: Updated expected results to reflect fix
20238
20239 2005-06-30  Kevin Decker  <kdecker@apple.com>
20240
20241         Reviewed by rjw.
20242
20243         fixed: <rdar://problem/4166838> failed assertion in`Interpreter::lockCount() > 0
20244
20245         no layout test added; this is in the bindings code.
20246
20247         * bindings/objc/WebScriptObject.mm:
20248         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]): make sure to lock and unlock the interpreter around allocations. 
20249
20250 2005-06-29  Geoffrey Garen  <ggaren@apple.com>
20251
20252         Patch by Francisco Tolmasky <tolmasky@gmail.com>
20253
20254         - fixes http://bugs.webkit.org/show_bug.cgi?id=3667
20255         Core JavaScript 1.5 Reference:Objects:Array:forEach
20256
20257         See WebCore Changelog for layout tests added.
20258
20259         Reviewed by darin.
20260
20261         * kjs/array_object.cpp:
20262         (ArrayProtoFuncImp::call):
20263         * kjs/array_object.h:
20264         (KJS::ArrayProtoFuncImp::):
20265
20266 2005-06-29  Geoffrey Garen  <ggaren@apple.com>
20267
20268         Patch contributed by Oliver Hunt <ojh16@student.canterbury.ac.nz>
20269
20270         -fixed http://bugs.webkit.org/show_bug.cgi?id=3743
20271         Incorrect error message given for certain calls
20272
20273         See WebCore Changelog for layout test added.
20274
20275         Reviewed by mjs.
20276
20277         * kjs/object.cpp:
20278         (KJS::ObjectImp::defaultValue):
20279
20280 2005-06-29  Geoffrey Garen  <ggaren@apple.com>
20281
20282         Rolling out date patch from 6-28-05 because it breaks 
20283         fast/js/date-parse-test
20284
20285         * kjs/date_object.cpp:
20286         (formatLocaleDate):
20287         (DateProtoFuncImp::call):
20288         (DateObjectImp::construct):
20289         (KJS::parseDate):
20290         (ymdhms_to_seconds):
20291         (isSpaceOrTab):
20292         (KJS::KRFCDate_parseDate):
20293         * kjs/date_object.h:
20294         * tests/mozilla/expected.html:
20295
20296 2005-06-29  Geoffrey Garen  <ggaren@apple.com>
20297
20298         Reviewed by Darin.
20299
20300         -fixes http://bugs.webkit.org/show_bug.cgi?id=3750
20301         build fails with KJS_VERBOSE set
20302
20303         * kjs/nodes.cpp: changed debug print statement to use UString
20304         (VarDeclNode::evaluate):
20305         * kjs/reference.cpp: ditto
20306         (KJS::Reference::putValue):
20307
20308 2005-06-28  Geoffrey Garen  <ggaren@apple.com>
20309
20310         Patch contributed by Carsten Guenther <cguenther@gmail.com>.
20311
20312         -fixes http://bugs.webkit.org/show_bug.cgi?id=3477
20313         some US-centric date formats not parsed by JavaScript (clock at news8austin.com)
20314
20315         Reviewed by darin.
20316
20317         * kjs/date_object.cpp:
20318         (formatLocaleDate):
20319         (day):
20320         (dayFromYear):
20321         (daysInYear):
20322         (timeFromYear):
20323         (yearFromTime):
20324         (weekDay):
20325         (timeZoneOffset):
20326         (DateProtoFuncImp::call):
20327         (DateObjectImp::construct):
20328         (KJS::parseDate):
20329         (ymdhms_to_seconds):
20330         (KJS::makeTime):
20331         (findMonth):
20332         (KJS::KRFCDate_parseDate):
20333         * kjs/date_object.h:
20334         * tests/mozilla/expected.html: updated expected test results to reflect fix
20335
20336 2005-06-26  Maciej Stachowiak  <mjs@apple.com>
20337
20338         Reviewed by Darin.
20339
20340         - replace hash functions  with better ones
20341
20342         * JavaScriptCore.pbproj/project.pbxproj: Add new file to build.
20343         * kjs/interpreter_map.cpp:
20344         (KJS::InterpreterMap::computeHash): Use shared pointer hash.
20345         * kjs/pointer_hash.h: Added.
20346         (KJS::pointerHash): Pointer hash based on 32-bit mix and 64-bit mix hashes.
20347         * kjs/protected_values.cpp:
20348         (KJS::ProtectedValues::computeHash): Use shared pointer hash.
20349         * kjs/ustring.cpp:
20350         (KJS::UString::Rep::computeHash): Use SuperFastHash algorithm.
20351
20352 2005-06-22  Darin Adler  <darin@apple.com>
20353
20354         Change by Anders Carlsson.
20355         Reviewed by me.
20356
20357         - fixed <http://bugs.webkit.org/show_bug.cgi?id=3294>
20358           String.prototype.replace() fails with function as second param
20359
20360         * kjs/string_object.cpp: (replace): Added code to handle functions.
20361
20362         * tests/mozilla/expected.html: Updated since ecma_3/RegExp/regress-209067.js is fixed now.
20363
20364         * tests/mozilla/run-mozilla-tests: Fix a minor coding style issue that leads to a warning each
20365         time we run the tests.
20366
20367 2005-06-21  Adele Peterson  <adele@apple.com>
20368
20369         rolling out fix for http://bugs.webkit.org/show_bug.cgi?id=3293, since it caused layout test failures.
20370         fast/forms/element-by-name
20371         fast/loader/loadInProgress
20372
20373         * ChangeLog:
20374         * bindings/objc/objc_runtime.h:
20375         * bindings/objc/objc_runtime.mm:
20376         (ObjcFallbackObjectImp::hasProperty):
20377         * bindings/runtime_array.cpp:
20378         (RuntimeArrayImp::hasProperty):
20379         * bindings/runtime_array.h:
20380         * bindings/runtime_object.cpp:
20381         (RuntimeObjectImp::hasProperty):
20382         * bindings/runtime_object.h:
20383         * kjs/array_instance.h:
20384         * kjs/array_object.cpp:
20385         (ArrayInstanceImp::hasProperty):
20386         * kjs/function.cpp:
20387         (KJS::FunctionImp::hasProperty):
20388         (KJS::ActivationImp::hasProperty):
20389         * kjs/function.h:
20390         * kjs/object.cpp:
20391         (KJS::ObjectImp::hasProperty):
20392         * kjs/object.h:
20393         * kjs/object_object.cpp:
20394         (ObjectPrototypeImp::ObjectPrototypeImp):
20395         (ObjectProtoFuncImp::call):
20396         * kjs/object_object.h:
20397         (KJS::ObjectProtoFuncImp::):
20398         * kjs/string_object.cpp:
20399         (StringInstanceImp::hasProperty):
20400         * kjs/string_object.h:
20401         * tests/mozilla/expected.html:
20402
20403 2005-06-21  Darin Adler  <darin@apple.com>
20404
20405         * JavaScriptCore.pbproj/project.pbxproj: Switched to a build rule rather than a build phase for
20406         .y files -- this gets rid of the problem where modifying the .y file would not cause sufficient
20407         compilation.
20408
20409         * kjs/grammar_wrapper.cpp: Removed.
20410
20411 2005-06-21  Adele Peterson  <adele@apple.com>
20412
20413         Patch from Anders Carlsson <andersca@mac.com>, reviewed by Darin.
20414
20415         Fixed: <http://bugs.webkit.org/show_bug.cgi?id=3450>
20416         <rdar://problem/3881901> String.replace() method not working when regex pattern contains {n, m}
20417
20418         * pcre/pcre.c: (pcre_compile): Remember the last char length so it can be subtracted correctly if needed.
20419
20420 2005-06-21  Geoffrey Garen  <ggaren@apple.com>
20421
20422         - fixed <rdar://problem/4155532> 'delete' succeeds on functions
20423         - fixed <rdar://problem/4155049> javascript function named as "opener" doesn't get called because of window.opener property
20424         
20425         Reviewed by cblu.
20426
20427         * kjs/nodes.cpp:
20428         (FuncDeclNode::processFuncDecl): Functions now have DontDelete and Internal attributes set when appropriate.
20429
20430         Test cases:
20431         * tests/mozilla/expected.html: Updated for one new success.
20432         - see also test case added in WebCore.
20433
20434 2005-06-20  Maciej Stachowiak  <mjs@apple.com>
20435
20436         Reviewed by Darin(first pass) and Hyatt.
20437
20438         - fixed http://bugs.webkit.org/show_bug.cgi?id=3576
20439         (roll in support for "const" keyword from KDE tree)
20440         - make processVarDecls handle deletability of variables declared
20441         in an eval block the same as evaluate would
20442         - make eval() call processVarDecls - needed to match mozilla and
20443         to make the second change testable
20444
20445         I started with the KDE implementation of const but I ended up changing it a bit
20446         to avoid the use of a global variable. Now instead of the global variable it distinguishes
20447         const and var at the grammar level so the appropriate node can know the right kind of
20448         declaration.
20449
20450         Test cases:
20451         * tests/mozilla/expected.html: Updated for one new test that is
20452         failing - we used to bail on it entirely because it checks for
20453         const support before starting.
20454         - see also test cases added in WebCore
20455
20456         * kjs/grammar.y: Add rules for const declarations.
20457         * kjs/keywords.table: Add const keyword.
20458         * kjs/nodes.cpp:
20459         (VarDeclNode::VarDeclNode): Add parameter.
20460         (VarDeclNode::evaluate): Add const support.
20461         (VarDeclNode::processVarDecls): Add const support.
20462         (VarStatementNode::execute): Irrelevant change.
20463         (ForInNode::ForInNode): Tell our variable node that it's a variable.
20464         * kjs/nodes.h:
20465         (KJS::VarDeclNode::): Add declaration of type enum, extra constructor parameter.
20466         (KJS::VarStatementNode::VarStatementNode): Irrelevant change.
20467         * kjs/function.cpp:
20468         (KJS::GlobalFuncImp::call): Process var decls before evaluating.
20469
20470 2005-06-20  Maciej Stachowiak  <mjs@apple.com>
20471
20472         Patch from Mark Rowe <opendarwin.org@bdash.net.nz>, reviewed by me.
20473
20474         - fixed http://bugs.webkit.org/show_bug.cgi?id=3293
20475         
20476         Test cases added: 
20477         * tests/mozilla/expected.html: Updated for two fixed tests.
20478         - also added a layout test
20479
20480         * bindings/objc/objc_runtime.h:
20481         * bindings/objc/objc_runtime.mm:
20482         (ObjcFallbackObjectImp::hasOwnProperty):
20483         * bindings/runtime_array.cpp:
20484         (RuntimeArrayImp::hasOwnProperty):
20485         * bindings/runtime_array.h:
20486         * bindings/runtime_object.cpp:
20487         (RuntimeObjectImp::hasOwnProperty):
20488         * bindings/runtime_object.h:
20489         * kjs/array_instance.h:
20490         * kjs/array_object.cpp:
20491         (ArrayInstanceImp::hasOwnProperty):
20492         * kjs/function.cpp:
20493         (KJS::FunctionImp::hasOwnProperty):
20494         (KJS::ActivationImp::hasOwnProperty):
20495         * kjs/function.h:
20496         * kjs/object.cpp:
20497         (KJS::ObjectImp::hasProperty):
20498         (KJS::ObjectImp::hasOwnProperty):
20499         * kjs/object.h:
20500         (KJS::Object::hasOwnProperty):
20501         * kjs/object_object.cpp:
20502         (ObjectPrototypeImp::ObjectPrototypeImp):
20503         (ObjectProtoFuncImp::call):
20504         * kjs/object_object.h:
20505         (KJS::ObjectProtoFuncImp::):
20506         * kjs/string_object.cpp:
20507         (StringInstanceImp::hasOwnProperty):
20508         * kjs/string_object.h:
20509
20510 2005-06-18  Darin Adler  <darin@apple.com>
20511
20512         Reviewed by Eric Seidel.
20513
20514         * pcre/get.c: (pcre_get_substring): Fix some computations so this works for UTF-16.
20515         This is unused in the current JavaScriptCore, but still good to fix.
20516
20517 2005-06-18  Darin Adler  <darin@apple.com>
20518
20519         Change by Finlay Dobbie.
20520         Reviewed by me.
20521
20522         - fixed <http://bugs.webkit.org/show_bug.cgi?id=3331>
20523           10.3.9 Build Failure: NSString may not respond to `+stringWithCString:encoding:'
20524
20525         * bindings/objc/WebScriptObject.mm: (-[WebScriptObject stringRepresentation]):
20526         Undo change we did a while back to work around the gcc 3.3 compiler error.
20527         It no longer seems to happen, and the workaround code was 10.4-specific.
20528
20529 2005-06-16  Geoffrey Garen  <ggaren@apple.com>
20530
20531         Fixed: <rdar://problem/4151759> 'delete' fails on variables declared inside 'eval' statements.
20532
20533         Reviewed by cblu.
20534
20535         * kjs/context.h:
20536         (KJS::ContextImp::codeType): Added code type accessor for execution context objects.
20537         * kjs/internal.cpp:
20538         (ContextImp::ContextImp): Reflects change to ContextImp::codeType.
20539         * kjs/nodes.cpp:
20540         (VarDeclNode::evaluate): Added separate code path for variable declarations inside 'eval' statements.
20541         * tests/mozilla/expected.html: Updated expected test results to reflect fix.
20542
20543 2005-06-14  Geoffrey Garen  <ggaren@apple.com>
20544
20545         Updated expected.html to reflect fix to <rdar://problem/4147745>.
20546
20547         Reviewed by cblu.
20548
20549         * tests/mozilla/expected.html:
20550
20551 2005-06-14  Geoffrey Garen  <ggaren@apple.com>
20552
20553         Fixed: <rdar://problem/4147745> JavaScript discards locally defined "arguments" property
20554
20555         No layout tests added because this change fixes existing tests:
20556         ecma/ExecutionContexts/10.1.6.js
20557         ecma_3/Function/regress-94506.js
20558         js1_4/Functions/function-001.js
20559
20560         Reviewed by cblu.
20561
20562         * kjs/function.cpp:
20563         (KJS::ActivationImp::get): get now checks for an "arguments" property defined in the local variable object
20564         before trying to return the built-in arguments array.
20565         
20566         * kjs/function.h: ActivationImp::put no longer overrides ObjectImp::put
20567
20568 2005-06-10  Darin Adler  <darin@apple.com>
20569
20570         Change by Mark Rowe <opendarwin.org@bdash.net.nz>.
20571         Reviewed by me.
20572
20573         - further improvements to exception file/line number fix
20574
20575         * kjs/nodes.h: Added setExceptionDetailsIfNeeded function.
20576         * kjs/nodes.cpp: Updated macros to call the new setExceptionDetailsIfNeeded function.
20577         (Node::setExceptionDetailsIfNeeded): Added.
20578
20579 2005-06-09  Darin Adler  <darin@apple.com>
20580
20581         Change by Mark Rowe <opendarwin.org@bdash.net.nz>
20582         Reviewed by me.
20583
20584         * kjs/nodes.cpp: Get rid of unneeded this->.
20585
20586 2005-06-08  Maciej Stachowiak  <mjs@apple.com>
20587
20588         Change by Mark Rowe <opendarwin.org@bdash.net.nz>
20589         Reviewed by me.
20590
20591         - fixed http://bugs.webkit.org/show_bug.cgi?id=3327
20592         (Exception When Setting Style to Invalid Value Lacks Line/File Information)
20593
20594         * kjs/nodes.cpp: Include source file and line number when making exception in
20595         KJS_CHECKEXCEPTIONVALUE.
20596
20597 2005-06-07  Darin Adler  <darin@apple.com>
20598
20599         Change by Toby Peterson <toby@opendarwin.org>.
20600         Reviewed by me.
20601
20602         * JavaScriptCore.pbproj/project.pbxproj: Allow bison 2.0, which generates the file
20603         with a different name.
20604
20605 2005-06-07  Darin Adler  <darin@apple.com>
20606
20607         Change by Toby Peterson <toby@opendarwin.org>.
20608         Reviewed by me.
20609
20610         * kjs/grammar.y: Remove bogus extra line from grammar.y. Toby got this change from KDE KJS.
20611
20612 2005-06-06  Darin Adler  <darin@apple.com>
20613
20614         * tests/mozilla/run-mozilla-tests: Wrote a perl version of this so we don't require
20615         the "jst" tool to run the tests.
20616
20617 2005-06-04  Darin Adler  <darin@apple.com>
20618
20619         Reviewed by Maciej.
20620
20621         - add libicu headers
20622
20623         * JavaScriptCore.pbproj/project.pbxproj: Added icu directory to header search path.
20624
20625         * icu/README: Added.
20626         * icu/unicode/platform.h: Added.
20627         * icu/unicode/uchar.h: Added.
20628         * icu/unicode/uconfig.h: Added.
20629         * icu/unicode/umachine.h: Added.
20630         * icu/unicode/urename.h: Added.
20631         * icu/unicode/utf.h: Added.
20632         * icu/unicode/utf16.h: Added.
20633         * icu/unicode/utf8.h: Added.
20634         * icu/unicode/utf_old.h: Added.
20635         * icu/unicode/utypes.h: Added.
20636         * icu/unicode/uversion.h: Added.
20637
20638 2005-05-19  Darin Adler  <darin@apple.com>
20639
20640         Reviewed by Maciej.
20641         
20642         - turned off exceptions and RTTI; seems to cut JavaScriptCore code size by about 22%
20643
20644         * JavaScriptCore.pbproj/project.pbxproj: Turn off exceptions and RTTI for both
20645         the framework and testkjs tool.
20646
20647 2005-05-18  Darin Adler  <darin@apple.com>
20648
20649         Reviewed by Maciej.
20650
20651         - got rid of code that depended on RTTI
20652
20653         * kjs/collector.cpp:
20654         (KJS::className): Added. Gets class name in a KJS way, rather than a C++ RTTI way.
20655         (KJS::Collector::rootObjectClasses): Use className instead of typeid names.
20656
20657 2005-05-18  Darin Adler  <darin@apple.com>
20658
20659         Reviewed by Maciej.
20660
20661         - fix a failure seen in the Mozilla JavaScript tests where a live object was garbage-collected
20662           when the only reference to it was in an argList on the stack
20663
20664         * kjs/list.h: Moved the operator= function into the .cpp file since it's too big to be
20665         a good choice to inline.
20666         * kjs/list.cpp: (KJS::List::operator=): Moved this formerly-inline function into a separate
20667         file and added missing code to update valueRefCount. It's the latter that fixes the bug.
20668
20669 2005-05-16  Darin Adler  <darin@apple.com>
20670
20671         Reviewed by Adele.
20672
20673         - fixed issues preventing us from compiling with newer versions of gcc 4.0
20674
20675         * kjs/ustring.cpp:
20676         (KJS::operator==): Remove redundant and illegal KJS:: prefix on this function's definition.
20677         (KJS::operator<): Ditto.
20678         (KJS::compare): Ditto.
20679
20680 2005-05-09  Darin Adler  <darin@apple.com>
20681
20682         Reviewed by John.
20683
20684         - turn on conservative GC unconditionally and start on SPI changes to
20685           eliminate the now-unneeded smart pointers since we don't ref count any more
20686
20687         * kjs/value.h: Removed macros to turn conservative GC on and off.
20688         Removed ref and deref functions.
20689         (KJS::ValueImp::ValueImp): Removed non-conservative-GC code path.
20690         (KJS::ValueImp::isUndefined): Added. New SPI to make it easier to deal with ValueImp directly.
20691         (KJS::ValueImp::isNull): Ditto.
20692         (KJS::ValueImp::isBoolean): Ditto.
20693         (KJS::ValueImp::isNumber): Ditto.
20694         (KJS::ValueImp::isString): Ditto.
20695         (KJS::ValueImp::isObject): Ditto.
20696         (KJS::Value::Value): Removed non-conservative-GC code path and made constructor no
20697         longer explicit so we can quietly create Value wrappers from ValueImp *; inexpensive with
20698         conservative GC and eases the transition.
20699         (KJS::Value::operator ValueImp *): Added. Quietly creates ValueImp * from Value.
20700         (KJS::ValueImp::marked): Removed non-conservative-GC code path.
20701
20702         * kjs/value.cpp:
20703         (KJS::ValueImp::mark): Removed non-conservative-GC code path.
20704         (KJS::ValueImp::isUndefinedOrNull): Added. New SPI to make it easier to deal with ValueImp directly.
20705         (KJS::ValueImp::isBoolean): Ditto.
20706         (KJS::ValueImp::isNumber): Ditto.
20707         (KJS::ValueImp::isString): Ditto.
20708         (KJS::ValueImp::asString): Ditto.
20709         (KJS::ValueImp::isObject): Ditto.
20710         (KJS::undefined): Ditto.
20711         (KJS::null): Ditto.
20712         (KJS::boolean): Ditto.
20713         (KJS::string): Ditto.
20714         (KJS::zero): Ditto.
20715         (KJS::one): Ditto.
20716         (KJS::two): Ditto.
20717         (KJS::number): Ditto.
20718
20719         * kjs/object.h: Made constructor no longer explicit so we can quietly create Object
20720         wrappers from ObjectImp *; inexpensive with conservative GC and eases the transition.
20721         (KJS::Object::operator ObjectImp *): Added. Quietly creates ObjectImp * from Object.
20722         (KJS::ValueImp::isObject): Added. Implementation of new object-related ValueImp function.
20723         (KJS::ValueImp::asObject): Ditto.
20724
20725         * kjs/object.cpp:
20726         (KJS::ObjectImp::setInternalValue): Remove non-conservative-GC code path.
20727         (KJS::ObjectImp::putDirect): Ditto.
20728         (KJS::error): Added. Function in the new SPI style to create an error object.
20729
20730         * kjs/internal.h: Added the new number-constructing functions as friends of NumberImp.
20731         There may be a more elegant way to do this later; what's important now is the new SPI.
20732
20733         * kjs/collector.h:  Remove non-conservative-GC code path and also take out some
20734         unneeded APPLE_CHANGES.
20735
20736         * bindings/runtime_root.cpp:
20737         (KJS::Bindings::addNativeReference): Remove non-conservative-GC code path.
20738         (KJS::Bindings::removeNativeReference): Ditto.
20739         (RootObject::removeAllNativeReferences): Ditto.
20740         * bindings/runtime_root.h:
20741         (KJS::Bindings::RootObject::~RootObject): Ditto.
20742         (KJS::Bindings::RootObject::setRootObjectImp): Ditto.
20743         * kjs/collector.cpp:
20744         (KJS::Collector::allocate): Ditto.
20745         (KJS::Collector::collect): Ditto.
20746         (KJS::Collector::numGCNotAllowedObjects): Ditto.
20747         (KJS::Collector::numReferencedObjects): Ditto.
20748         (KJS::Collector::rootObjectClasses): Ditto.
20749         * kjs/internal.cpp:
20750         (NumberImp::create): Ditto.
20751         (InterpreterImp::globalInit): Ditto.
20752         (InterpreterImp::globalClear): Ditto.
20753         * kjs/list.cpp:
20754         (KJS::List::markProtectedLists): Ditto.
20755         (KJS::List::clear): Ditto.
20756         (KJS::List::append): Ditto.
20757         * kjs/list.h:
20758         (KJS::List::List): Ditto.
20759         (KJS::List::deref): Ditto.
20760         (KJS::List::operator=): Ditto.
20761         * kjs/protect.h:
20762         (KJS::gcProtect): Ditto.
20763         (KJS::gcUnprotect): Ditto.
20764
20765 2005-05-09  Chris Blumenberg  <cblu@apple.com>
20766
20767         Workaround gcc 3.3 internal compiler errors.
20768
20769         Reviewed by darin.
20770
20771         * bindings/objc/WebScriptObject.mm:
20772         (-[WebScriptObject stringRepresentation]): call [NSString stringWithCString:encoding] rather than using @""
20773
20774 2005-05-09  Darin Adler  <darin@apple.com>
20775
20776         * Makefile.am: Don't set up PBXIntermediatesDirectory explicitly;
20777         Not needed to make builds work, spews undesirable error messages too.
20778
20779 2005-05-06  Darin Adler  <darin@apple.com>
20780
20781         Reviewed by Maciej.
20782
20783         - make building multiple trees with make work better
20784
20785         * Makefile.am: Set up Xcode build directory before invoking xcodebuild.
20786
20787 2005-05-04  Maciej Stachowiak  <mjs@apple.com>
20788
20789         Reviewed by Darin.
20790
20791         <rdar://problem/4086570> Crash in JavaScriptCore with RSS Visualizer
20792         
20793         * kjs/internal.cpp:
20794         (InterpreterImp::mark): mark staticNaN, it is usually protected by the Number
20795         prototype but there is a small window where it can get collected.
20796
20797 2005-05-04  Darin Adler  <darin@apple.com>
20798
20799         Reviewed by Dave Hyatt.
20800
20801         - another gcc-4.0-related fix
20802
20803         * bindings/runtime_root.h: Take off extra namespace prefixes that apparently cause problems
20804         compiling with gcc 4.0, although I have not observed the problems.
20805
20806 2005-05-04  Darin Adler  <darin@apple.com>
20807
20808         Reviewed by Dave Hyatt.
20809
20810         - fixed build rules to match other projects
20811
20812         * JavaScriptCore.pbproj/project.pbxproj: Set deployment target to 10.3 in the build styles.
20813         When built without a build style (by Apple B&I) we want to get the target from the
20814         environment. But when built with a build style (by Safari engineers and others), we want
20815         to use 10.3.
20816
20817         * Makefile.am: Took out extra parameters that make command-line building different from
20818         Xcode building. Now that this is fixed, you should not get a full rebuild if you switch
20819         from command line to Xcode or back.
20820
20821 2005-05-04  Maciej Stachowiak  <mjs@apple.com>
20822
20823         - revert presumably accidental change to mozilla JS test expected results, this
20824         was making the tests fail.
20825
20826         * tests/mozilla/expected.html:
20827
20828 2005-05-03  Richard Williamson   <rjw@apple.com>
20829
20830         Fixed <rdar://problem/4102644> Crash in LiveConnect below KJS::Bindings::JavaInstance::stringValue() const
20831
20832         Correctly handle accessing nil objects from a Java object array.
20833
20834         Reviewed by John.
20835
20836         * bindings/jni/jni_runtime.cpp:
20837         (JavaArray::valueAt):
20838
20839 2005-05-01  Darin Adler  <darin@apple.com>
20840
20841         - move to Xcode native targets and stop checking in generated files
20842
20843         * JavaScriptCore.pbproj/project.pbxproj: Updated to use native targets and generate all the generated
20844         files, so we don't have to check them in any more.
20845         * Info.plist: Added. Native targets use a separate file for this.
20846
20847         * Makefile.am: Removed pcre and kjs SUBDIRS. Also removed code that deleted the embedded copy of this
20848         framework, since we haven't been embedding it for some time.
20849
20850         * kjs/grammar_wrapper.cpp: Added. Shell used to compile grammar.cpp since we can't add a generated file
20851         easily to the list of files to be compiled.
20852
20853         * kjs/.cvsignore: Removed.
20854         * kjs/Makefile.am: Removed.
20855         * kjs/array_object.lut.h: Removed.
20856         * kjs/date_object.lut.h: Removed.
20857         * kjs/grammar.cpp: Removed.
20858         * kjs/grammar.cpp.h: Removed.
20859         * kjs/grammar.h: Removed.
20860         * kjs/lexer.lut.h: Removed.
20861         * kjs/math_object.lut.h: Removed.
20862         * kjs/number_object.lut.h: Removed.
20863         * kjs/string_object.lut.h: Removed.
20864         * pcre/.cvsignore: Removed.
20865         * pcre/Makefile.am: Removed.
20866         * pcre/chartables.c: Removed.
20867
20868 2005-04-28  Darin Adler  <darin@apple.com>
20869
20870         Reviewed by Dave Harrison.
20871
20872         - fixed problems preventing us from compiling with gcc 4.0
20873
20874         * JavaScriptCore.pbproj/project.pbxproj: Removed -Wmissing-prototypes from
20875         WARNING_CPLUSPLUSFLAGS since it's now a C-only warning.
20876
20877         * bindings/jni/jni_jsobject.cpp:
20878         (JSObject::getSlot): Changed some %d to %ld where the parameters where long ints.
20879         (JSObject::setSlot): Ditto.
20880         * bindings/jni/jni_utility.cpp:
20881         (KJS::Bindings::getJavaVM): Ditto.
20882         (KJS::Bindings::getJNIEnv): Ditto.
20883         * bindings/objc/objc_utility.mm: Fixed include of <JavascriptCore/internal.h> that needed the
20884         letter "S" capitalized.
20885         * kjs/bool_object.cpp: (BooleanProtoFuncImp::call): Rearranged how this function returns to
20886         avoid incorrect gcc 4.0 warning.
20887         * kjs/collector.cpp: (KJS::Collector::markStackObjectsConservatively): Changed code to check
20888         the alignment of the passed-in pointers to only require pointer-level alignment, not 8-byte alignment.
20889         Prevents a crash on garbage collect when compiled with gcc 4.0.
20890         * kjs/nodes.cpp:
20891         (WhileNode::execute): Added a redundant return after an infinite loop to work around incorrect gcc 4.0 warning.
20892         (ForNode::execute): Ditto.
20893         (SwitchNode::execute):Rearranged how this function returns to avoid incorrect gcc 4.0 warning.
20894         (LabelNode::execute): Ditto.
20895         * kjs/string_object.cpp: (replace): Ditto.
20896
20897 2005-04-26  Richard Williamson   <rjw@apple.com>
20898
20899         Fixed <rdar://problem/4098713> Scripting API is incompatible with Mozilla
20900         
20901         We were incompatible with Mozilla's implementation of the scripting APIs in
20902         two ways:
20903
20904         Their NPN_SetException has the following signature:
20905
20906             void NPN_SetException(NPObject *npobj, const NPUTF8 *message);
20907
20908         ours has:
20909
20910             void NPN_SetException (NPObject * npobj, const NPString *message);
20911
20912         Also, they expect the string returned from NPN_UTF8FromIdentifier() to be freed by caller.
20913         We do not.
20914
20915         I changed both behaviors to match Mozilla.
20916
20917         Reviewed by Chris.
20918
20919         * bindings/NP_jsobject.cpp:
20920         (_NPN_SetException):
20921         * bindings/npruntime.cpp:
20922         (_NPN_UTF8FromIdentifier):
20923         (_NPN_IntFromIdentifier):
20924         (_NPN_SetExceptionWithUTF8):
20925         * bindings/npruntime.h:
20926         * bindings/npruntime_impl.h:
20927
20928 2005-04-26  Maciej Stachowiak  <mjs@apple.com>
20929
20930         Reviewed by Chris.
20931
20932         <rdar://problem/4092136> reproducible crash in KJS::kjs_fast_realloc loading maps.google.com
20933         
20934         * kjs/string_object.cpp:
20935         (StringObjectFuncImp::call): Allocate adopted ustring buffer properly.
20936
20937 2005-04-22  Darin Adler  <darin@apple.com>
20938
20939         Reviewed by Maciej.
20940
20941         * kjs/ustring.cpp: (KJS::UString::UTF8String): Fix off-by-one error in surrogate pair logic.
20942
20943 2005-04-22  Darin Adler  <darin@apple.com>
20944
20945         Reviewed by John.
20946
20947         - fixed <rdar://problem/4090046> JavaScript throw statement causes parse error when no semicolon is present
20948
20949         * kjs/grammar.y: Added an additional rule for throw like the ones we have for all the other semicolon rules.
20950         Not sure why we missed this one earlier.
20951
20952         * kjs/grammar.cpp: Regenerated.
20953
20954 === JavaScriptCore-412.1 ===
20955
20956 2005-04-20  Darin Adler  <darin@apple.com>
20957
20958         Reviewed by Maciej.
20959
20960         - speedups, total 12% on JavaScript iBench
20961
20962         I ran the benchmark under Shark and followed its advice a lot, mainly.
20963
20964         * kjs/collector.cpp:
20965         (KJS::Collector::allocate): Take out special case for 0; costing speed but unexercised.
20966         Use numLiveObjectsAtLastCollect instead of numAllocationsSinceLastCollect so we don't
20967         have to bump it each time we call allocate. Put numLiveObjects into a local variable to
20968         cut down on global variable accesses. Make "next" cell pointer be a byte offset rather
20969         than a pointer so we don't need a special case for NULL. Allow freeList to point to some
20970         bogus item when the entire block is full rather than going out of our way to make it
20971         point to NULL.
20972         (KJS::Collector::markProtectedObjects): Get table size and pointer into locals outside
20973         the loop to avoid re-loading them over and over again.
20974         (KJS::Collector::collect): Put numLiveObjects into a local variable to cut down on global
20975         variable accesses. Make "next" cell pointer be a byte offset as above. Put numLiveObjects
20976         into a local variable to cut down on global variable accesses. Set numLiveObjectsAtLastCollect
20977         rather than numAllocationsSinceLastCollect.
20978         (KJS::Collector::numReferencedObjects): Get table size and pointer into locals outside
20979         the loop to avoid re-loading them over and over again.
20980         (KJS::Collector::rootObjectClasses): Ditto.
20981
20982         * kjs/internal.h: Make Value be a friend of NumberImp so it can construct number objects
20983         directly, avoiding the conversion from Number to Value.
20984
20985         * kjs/internal.cpp: (StringImp::toObject): Don't use Object::dynamicCast, because we know
20986         the thing is an object and we don't want to do all the extra work; just cast directly.
20987
20988         * kjs/list.cpp: (KJS::List::List): Construct valueRefCount in a way that avoids the need for
20989         a branch -- in the hot case this just meant avoiding checking a variable we just set to false.
20990
20991         * kjs/lookup.cpp: (keysMatch): Marked this inline.
20992
20993         * kjs/nodes.cpp: Disabled KJS_BREAKPOINT, to avoid calling hitStatement all the time.
20994         (BooleanNode::evaluate): Make a Value directly, rather than making a Boolean which is converted
20995         into a Value.
20996         (NumberNode::evaluate): Ditto.
20997         (StringNode::evaluate): Ditto.
20998         (ArrayNode::evaluate): Ditto.
20999         (FunctionCallNode::evaluate): Use new inline baseIfMutable to avoid unnecessary getBase function.
21000         Also just use a pointer for func, rather than an Object.
21001         (PostfixNode::evaluate): Change code so that it doesn't make an excess Number, and so that it
21002         passes a "known to be integer" boolean in, often avoiding a conversion from floating point to
21003         integer and back.
21004         (DeleteNode::evaluate): Make a Value directly.
21005         (TypeOfNode::evaluate): Use new inline baseIfMutable and make Value directly.
21006         (PrefixNode::evaluate): Change code so that it doesn't make an excess Number, and so that it
21007         passes a "known to be integer" boolean in, often avoiding a conversion from floating point to
21008         integer and back.
21009         (UnaryPlusNode::evaluate): Make a Value directly.
21010         (NegateNode::evaluate): Change code so that it doesn't make an excess Number, and so that it
21011         passes a "known to be integer" boolean in, often avoiding a conversion from floating point to
21012         integer and back.
21013         (BitwiseNotNode::evaluate): Make a Value directly.
21014         (LogicalNotNode::evaluate): Ditto.
21015         (ShiftNode::evaluate): Don't convert to a double before making a Value.
21016         (RelationalNode::evaluate): Make a Value directly.
21017         (EqualNode::evaluate): Ditto.
21018         (BitOperNode::evaluate): Ditto.
21019         (AssignNode::evaluate): Make a Value directly. Change code so that it passes a "known to be integer"
21020         boolean in, often avoiding a conversion from floating point to integer and back.
21021         (VarDeclNode::evaluate): Make a Value directly.
21022         (ForNode::execute): Remove unused local variable.
21023
21024         * kjs/operations.h:
21025         (KJS::isNaN): Inlined.
21026         (KJS::isInf): Ditto.
21027         (KJS::isPosInf): Ditto.
21028         (KJS::isNegInf): Ditto.
21029
21030         * kjs/operations.cpp: Change isNaN, isInf, isPosInf, and isNegInf to be inlines.
21031         (KJS::equal): Rewrite to avoid creating values and recursing back into the function.
21032         (KJS::relation): Rearranged code so that we don't need explicit isNaN checks.
21033         (KJS::add): Changed code to make Value directly, and so that it passes a "known to be integer"
21034         boolean in, often avoiding a conversion from floating point to integer and back.
21035         (KJS::mult): Ditto.
21036
21037         * kjs/property_map.cpp:
21038         (KJS::PropertyMap::~PropertyMap): Get size and entries pointer outside loop to avoid
21039         re-getting them inside the loop.
21040         (KJS::PropertyMap::clear): Ditto. Clear value pointer in addition to key, so we can just
21041         look at the value pointer in the mark function.
21042         (KJS::PropertyMap::get): Get sizeMask and entries pointer outside loop to avoid
21043         re-getting them inside the loop.
21044         (KJS::PropertyMap::put): Ditto.
21045         (KJS::PropertyMap::insert): Ditto.
21046         (KJS::PropertyMap::remove): Ditto.
21047         (KJS::PropertyMap::mark): Get size and entries pointer outside loop to avoid
21048         re-getting them inside the loop. Don't bother checking key for 0, since we already have
21049         to check value for 0. (Also had to change clear() to set value to 0.)
21050         (KJS::PropertyMap::addEnumerablesToReferenceList): Get size and entries pointer outside
21051         loop to avoid re-getting them inside the loop.
21052         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): Ditto.
21053         (KJS::PropertyMap::save): Ditto.
21054
21055         - other changes
21056
21057         * kjs/protected_values.h: Remove unneeded class name qualifiers.
21058
21059         * kjs/reference.h:
21060         (KJS::Reference::baseIfMutable): New inline function: replaces isMutable().
21061         (KJS::Reference::Reference): Inlined.
21062         * kjs/reference.cpp:
21063         (KJS::Reference::getValue): Rewrite to not use getBase.
21064         (KJS::Reference::putValue): Ditto.
21065         (KJS::Reference::deleteValue): Dittol
21066
21067         * kjs/simple_number.h:
21068         (KJS::SimpleNumber::integerFits): Added. For use when the parameter is known to be integral.
21069
21070         * kjs/string_object.cpp: (StringProtoFuncImp::call): Create the number without first converting
21071         to double in various cases that involve integers.
21072
21073         * kjs/ustring.h:
21074         (KJS::UString::attach): Inlined.
21075         (KJS::UString::release): Inlined.
21076         * kjs/ustring.cpp:
21077         (KJS::UString::find): Get first character outside the loop instead of re-fetching it each time.
21078
21079         * kjs/value.cpp:
21080         (Value::Value): Added overloads for all the various specific types of values, so you don't have
21081         to convert from, say, Number to Value, just to create one.
21082         (Number::Number): Added an overload that takes a boolean to indicate the number is already
21083         known to be an integer.
21084
21085         * kjs/value.h: Added more Value constructors, added a version of toNumber that returns
21086         a boolean to indicate if the number is known to be an integer (because it was a "simple number").
21087         (KJS::ValueImp::marked): Inlined.
21088         (KJS::ValueImp::dispatchType): Inlined.
21089         (KJS::ValueImp::dispatchToPrimitive): Inlined.
21090         (KJS::ValueImp::dispatchToBoolean): Inlined.
21091         (KJS::ValueImp::dispatchToNumber): Inlined.
21092         (KJS::ValueImp::dispatchToString): Inlined.
21093         (KJS::ValueImp::dispatchToUInt32): Inlined.
21094
21095 2005-04-14  Maciej Stachowiak  <mjs@apple.com>
21096
21097         - make fast_malloc.h a private header, not project
21098
21099         * JavaScriptCore.pbproj/project.pbxproj:
21100
21101 2005-04-12  Maciej Stachowiak  <mjs@apple.com>
21102
21103         Reviewed by Richard.
21104
21105         <rdar://problem/4089734> JavaScript iBench can be sped up ~10% with custom allocator
21106
21107         - use custom single-threaded malloc for all non-GC JavaScriptCore
21108         allocations, for a 9.1% speedup on JavaScript iBench
21109         
21110         * JavaScriptCore.pbproj/project.pbxproj:
21111         * kjs/collector.cpp:
21112         (KJS::Collector::allocate): Use dlmalloc to allocate the collector blocks.
21113         (KJS::Collector::collect): And dlfree to free it.
21114         * kjs/fast_malloc.cpp: Added, just the standard dlmalloc here.
21115         * kjs/fast_malloc.h: Added. Declarations for the functions. Also added a handy
21116         macro to give a class custom operator new/delete
21117         * kjs/identifier.cpp:
21118         (KJS::Identifier::add): Use dlmalloc/dlfree.
21119         * kjs/nodes.h: make nodes KJS_FAST_ALLOCATED.
21120         * kjs/property_map.cpp:
21121         (KJS::PropertyMap::~PropertyMap): Use dlmalloc/dlfree.
21122         (KJS::PropertyMap::rehash): ditto
21123         * kjs/scope_chain.h:
21124         * kjs/ustring.cpp:
21125         (KJS::UString::Rep::createCopying): New named constructor that copies a passed-in
21126         buffer, to hide allocation details from webcore.
21127         (KJS::UString::UString): use createCopying when appropriate.
21128         (KJS::UString::Rep::destroy): Use dlmalloc/dlfree.
21129         (KJS::UString::expandedSize): likewise
21130         (KJS::UString::expandCapacity): likewise
21131         (KJS::UString::expandPreCapacity): likewise
21132         (KJS::UString::spliceSubstringsWithSeparators): likewise
21133         (KJS::UString::append): likewise
21134         (KJS::UString::operator=): likewise
21135         (KJS::UString::detach): likewise
21136         * kjs/ustring.h: make UString and UString::Rep KJS_FAST_ALLOCATED.
21137
21138 2005-04-11  Maciej Stachowiak  <mjs@apple.com>
21139
21140         Reviewed by John.
21141
21142         <rdar://problem/4086819> Avoid using protect count hash table so much for 5.6% JS iBench speedup
21143
21144         - Avoid using protected values hash for the two most common cases
21145         - Bump up ListImp high water mark, new testing shows 508 ListImps are
21146         created during JS iBench.
21147
21148         Net result is a 5.6% speedup on JavaScript iBench
21149         
21150         * kjs/collector.cpp:
21151         (KJS::Collector::collect): mark protected lists as appropriate.
21152         * kjs/context.h:
21153         * kjs/list.cpp:
21154         (KJS::ListImp::markValues): Moved implementation from List::markValues
21155         (KJS::List::markProtectedLists): Implemented - scan pool and overflow
21156         list.
21157         (KJS::allocateListImp): link lists outside the pool into a separate
21158         doubly linked list to be able to mark protected lists
21159         (KJS::deallocateListImp): do the corresponding delinking
21160         (KJS::List::derefValues): do nothing in conservative GC mode
21161         (KJS::List::refValues): do nothing in conservative GC mode
21162         (KJS::List::markValues): call ListImp version
21163         (KJS::List::append):
21164         * kjs/list.h:
21165
21166 === Safari-412 ===
21167
21168 === Safari-411 ===
21169
21170 === Safari-410 ===
21171
21172 === Safari-409 ===
21173
21174 === Safari-408 ===
21175
21176 === Safari-407 ===
21177
21178 2005-03-16  Jens Alfke  <jens@apple.com>
21179
21180         Reviewed by Kevin.
21181
21182         Fix for <rdar://problem/4025212> "REGRESSION (163-164): search not performed correctly; united.com"
21183         JavaScript unescape("") was returning a messed-up String object that appeared identical to an empty string, but would in some cases act as 'null' when passed to native functions, in this case the Option() constructor.
21184         In the implementation of unescape, the UString holding the result was not initialized to "", so it started out as a null string. If nothing was appended to it, it remained null, resulting in a JavaScript String object with some bad behaviors (namely, converting it to a DOMStringImpl results in a NULL pointer.)
21185         Darin says this regression occurred when we replaced our own implementation of unescape() with code from KJS.
21186
21187         * kjs/function.cpp:
21188         (KJS::GlobalFuncImp::call):
21189
21190 2005-03-15  Richard Williamson   <rjw@apple.com>
21191
21192         Fixed <rdar://problem/4053276> WebScripting protocol in WebKit cannot convert Boolean in Javascript to BOOL in Objective-C
21193
21194         Added JavaScript boolean to type that can be converted to
21195         ObjC scalar parameters.
21196
21197         Reviewed by Ken Kocienda.
21198
21199         * bindings/objc/objc_utility.mm:
21200         (KJS::Bindings::convertValueToObjcValue):
21201
21202 === Safari-406 ===
21203
21204 === Safari-405 ===
21205
21206 === Safari-403 ===
21207
21208 === Safari-402 ===
21209
21210 === Safari-401 ===
21211
21212 === Safari-400 ===
21213
21214 === Safari-188 ===
21215
21216 2005-02-21  Darin Adler  <darin@apple.com>
21217
21218         * kjs/date_object.cpp: (timetUsingCF): Fixed indenting.
21219
21220 2005-02-17  Richard Williamson   <rjw@apple.com>
21221
21222         Fixed <rdar://problem/4003251> Safari crashed at www.icelandair.com in LiveConnect code converting a Java object to a string
21223
21224         Added nil check.
21225
21226         Reviewed by John Sullivan.
21227
21228         * bindings/jni/jni_runtime.cpp:
21229         (JavaField::valueFromInstance):
21230
21231 === Safari-187 ===
21232
21233 2005-02-11  Richard Williamson   <rjw@apple.com>
21234
21235         Fixed <rdar://problem/3985118> DOM objects not being marshaled on JS->native calls
21236
21237         Re-factored how 'native' wrappers for JS objects are created.  The interpreter now
21238         creates these wrappers.  The WebCore subclass of the interpreter now overrides
21239         createLanguageInstanceForValue() and creates a DOM ObjC wrapper for DOM objects.
21240
21241         Reviewed by Ken.
21242
21243         * bindings/c/c_utility.cpp:
21244         (convertValueToNPVariant):
21245         * bindings/jni/jni_instance.cpp:
21246         (JavaInstance::invokeMethod):
21247         * bindings/jni/jni_objc.mm:
21248         (KJS::Bindings::dispatchJNICall):
21249         * bindings/jni/jni_runtime.cpp:
21250         (JavaField::valueFromInstance):
21251         (JavaArray::valueAt):
21252         * bindings/objc/WebScriptObject.mm:
21253         (-[WebScriptObject _setExecutionContext:KJS::Bindings::]):
21254         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
21255         * bindings/objc/WebScriptObjectPrivate.h:
21256         * bindings/objc/objc_utility.h:
21257         * bindings/objc/objc_utility.mm:
21258         (KJS::Bindings::convertObjcValueToValue):
21259         (KJS::Bindings::createObjcInstanceForValue):
21260         * bindings/runtime.cpp:
21261         (Instance::createBindingForLanguageInstance):
21262         (Instance::createRuntimeObject):
21263         (Instance::createLanguageInstanceForValue):
21264         * bindings/runtime.h:
21265         * kjs/interpreter.cpp:
21266         (Interpreter::createLanguageInstanceForValue):
21267         * kjs/interpreter.h:
21268
21269 === Safari-186 ===
21270
21271 2005-02-10  Darin Adler  <darin@apple.com>
21272
21273         "Reviewed" by Richard (he told me the file was obsolete).
21274
21275         - got rid of an obsolete file
21276
21277         * bindings/npsap.h: Removed.
21278
21279 === Safari-185 ===
21280
21281 === Safari-183 ===
21282
21283 2005-02-03  Richard Williamson   <rjw@apple.com>
21284
21285         Fixed <rdar://problem/3972905> CrashTracer: ...36 crashes at com.apple.WebCore: khtml::CSSStyleSelector::applyDeclarations + 120
21286
21287         Revert to old (and correct) behavior of returning runtime object
21288         when passed as a parameter, rather than it's corresponding DOM
21289         object.
21290
21291         Reviewed by Chris.
21292
21293         * bindings/objc/WebScriptObject.mm:
21294         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
21295
21296 === Safari-182 ===
21297
21298 2005-01-28  Richard Williamson   <rjw@apple.com>
21299
21300         Fixed <rdar://problem/3980389> JavaScript bindings access incorrect runtime object
21301
21302         Only use special 'back door' property to get the runtime object if thisObj isn't
21303         already a runtime object.
21304
21305         <gratuitous> Cleaned up a couple of strcmp on ClassInfo name.  Used == on
21306         ClassInfo pointer instead.
21307
21308         Reviewed by Chris.
21309
21310         * bindings/c/c_utility.cpp:
21311         (convertValueToNPVariant):
21312         * bindings/objc/WebScriptObject.mm:
21313         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
21314         * bindings/runtime_method.cpp:
21315         (RuntimeMethodImp::call):
21316
21317 === Safari-181 ===
21318
21319 2005-01-26  Richard Williamson   <rjw@apple.com>
21320
21321         Fixed <rdar://problem/3972522> (179-180) 40% slowdown on iBench JavaScript test
21322
21323         I added a member variable to ObjectImp.  This changed it's size and consequently
21324         hampered the optimizations built into the garbage collector.  Objects no longer
21325         fit within the allocators cell size, and thus allocation fell back to a slower
21326         allocator.
21327
21328         As a result of this fix I also dramatically cleaned up how runtime objects are
21329         accessed.  The path mostly *removes* code.
21330         
21331         Reviewed by Chris.
21332
21333         * bindings/runtime_method.cpp:
21334         (RuntimeMethodImp::call):
21335         * bindings/runtime_object.cpp:
21336         (RuntimeObjectImp::get):
21337         (RuntimeObjectImp::put):
21338         (RuntimeObjectImp::canPut):
21339         (RuntimeObjectImp::hasProperty):
21340         (RuntimeObjectImp::defaultValue):
21341         * bindings/runtime_object.h:
21342         * kjs/object.cpp:
21343         (KJS::ObjectImp::ObjectImp):
21344         * kjs/object.h:
21345
21346 2005-01-20  Darin Adler  <darin@apple.com>
21347
21348         Reviewed by me, changes by Han Ming Ong.
21349
21350         - <rdar://problem/3964302> SWB: A few files need to be updated to be compilable under GCC 4.0
21351
21352         * bindings/objc/WebScriptObjectPrivate.h: Make members public.
21353         * kjs/lookup.h: Change "value.h" to "object.h" because we need KJS::Object to compile a template.
21354
21355 2005-01-20  Richard Williamson   <rjw@apple.com>
21356
21357         Fixed <rdar://problem/3964634> undefined property value from binding seems to evaluate to true in an if statement
21358
21359         The comprehensive fix for this problem requires new API, as described in 3965326.  However,
21360         given that we can't add new API at this point, the 'ObjcFallbackObjectImp' will behave
21361         like and Undefined object if  invokeUndefinedMethodFromWebScript:withArguments: isn't
21362         implemented on the bound object.
21363
21364         Reviewed by Chris.
21365
21366         * bindings/objc/objc_runtime.h:
21367         * bindings/objc/objc_runtime.mm:
21368         (ObjcFallbackObjectImp::type):
21369         (ObjcFallbackObjectImp::implementsCall):
21370         (ObjcFallbackObjectImp::toBoolean):
21371         * bindings/testbindings.mm:
21372         (+[MyFirstInterface isSelectorExcludedFromWebScript:]):
21373         (+[MyFirstInterface isKeyExcludedFromWebScript:]):
21374
21375 === Safari-180 ===
21376
21377 2005-01-19  Richard Williamson   <rjw@apple.com>
21378
21379         Fixed <rdar://problem/3853676> Browser Crash when accessing CCWeb Progress Page - KJS::Bindings::convertValueToJValue
21380
21381         Fixed the following problems with LiveConnect that are demonstrated by the application
21382         described in 3853676.
21383
21384         1.  If a nil object is passed in an array from Java to JavaScript we will crash.
21385         2.  We sometimes will incorrectly attempt to access a generic JavaScript as a Java runtime object wrapper.
21386         3.  We will sometimes fail to find the correct static method ID.
21387
21388         Reviewed by Maciej.
21389
21390         * bindings/jni/jni_jsobject.cpp:
21391         (JSObject::convertJObjectToValue):
21392         (JSObject::listFromJArray):
21393         * bindings/jni/jni_runtime.cpp:
21394         (JavaField::valueFromInstance):
21395         (JavaField::setValueToInstance):
21396         * bindings/jni/jni_utility.cpp:
21397         (KJS::Bindings::getMethodID):
21398         (KJS::Bindings::convertValueToJValue):
21399         * bindings/runtime_array.h:
21400
21401 2005-01-18  Richard Williamson   <rjw@apple.com>
21402
21403         Fixed several issues all arising from analysis of plugin detection code at ifilm.com:
21404
21405         Fixed <rdar://problem/3958592> can't script plug-ins if plug-in is invoked with <object> element instead of <embed>
21406         Fixed <rdar://problem/3958597> <object> elements with IDs do not show up as named properties of the document
21407         Fixed <rdar://problem/3960973> DOM objects for plugin elements are not accessible
21408         Fixed <rdar://problem/3958601> need an additional class ID in WebCore for the Real plug-in
21409
21410         We now support accessing scriptable plugin objects that are specified with <applet>, <embed>, or <object>
21411         tags.  Also, if any of these elements are named they can be accessed from the document or window objects.
21412         Finally, DOM methods are properties will be forwarded appropriately for the plugin's root scriptable object.
21413
21414         Reviewed by Chris.
21415
21416         * bindings/objc/objc_instance.h:
21417         * bindings/objc/objc_instance.mm:
21418         (ObjcInstance::supportsSetValueOfUndefinedField):
21419         * bindings/runtime.h:
21420         (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
21421         * bindings/runtime_object.cpp:
21422         (RuntimeObjectImp::RuntimeObjectImp):
21423         (RuntimeObjectImp::get):
21424         (RuntimeObjectImp::put):
21425         (RuntimeObjectImp::canPut):
21426         (RuntimeObjectImp::hasProperty):
21427         (RuntimeObjectImp::defaultValue):
21428         * bindings/runtime_object.h:
21429         (KJS::RuntimeObjectImp::fallbackObject):
21430         * kjs/object.cpp:
21431         (KJS::ObjectImp::ObjectImp):
21432         * kjs/object.h:
21433         (KJS::ObjectImp::forwardingScriptMessage):
21434         (KJS::ObjectImp::setForwardingScriptMessage):
21435
21436 2005-01-18  Richard Williamson   <rjw@apple.com>
21437
21438         Back out a change that was incorrectly committed yesterday.
21439
21440         Reviewed by Chris.
21441
21442         * bindings/objc/objc_utility.mm:
21443         (KJS::Bindings::convertValueToObjcValue):
21444
21445 2005-01-17  Richard Williamson   <rjw@apple.com>
21446
21447         Fixed <rdar://problem/3753030> Need to ensure same origin for plugin binding invocations (origin security rules)
21448
21449         Keep track of originating execution context and target execution
21450         context for native JS object wrappers, and perform appropriate
21451         security checks.
21452
21453         Reviewed by David Harrison.
21454
21455         * bindings/NP_jsobject.cpp:
21456         (_isSafeScript):
21457         (_NPN_CreateScriptObject):
21458         (_NPN_Invoke):
21459         (_NPN_Evaluate):
21460         (_NPN_GetProperty):
21461         (_NPN_SetProperty):
21462         (_NPN_RemoveProperty):
21463         (_NPN_HasProperty):
21464         (_NPN_HasMethod):
21465         (_NPN_SetException):
21466         * bindings/NP_jsobject.h:
21467         * bindings/c/c_instance.cpp:
21468         (CInstance::CInstance):
21469         (CInstance::stringValue):
21470         * bindings/c/c_instance.h:
21471         * bindings/c/c_utility.cpp:
21472         (convertValueToNPVariant):
21473         * bindings/jni/jni_instance.cpp:
21474         (JavaInstance::JavaInstance):
21475         (JavaInstance::valueOf):
21476         * bindings/jni/jni_instance.h:
21477         * bindings/objc/WebScriptObject.mm:
21478         (-[WebScriptObject _initializeWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
21479         (-[WebScriptObject _initWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
21480         (-[WebScriptObject KJS::Bindings::]):
21481         (-[WebScriptObject _setOriginExecutionContext:KJS::Bindings::]):
21482         (-[WebScriptObject _isSafeScript]):
21483         (-[WebScriptObject callWebScriptMethod:withArguments:]):
21484         (-[WebScriptObject evaluateWebScript:]):
21485         (-[WebScriptObject setValue:forKey:]):
21486         (-[WebScriptObject valueForKey:]):
21487         (-[WebScriptObject removeWebScriptKey:]):
21488         (-[WebScriptObject stringRepresentation]):
21489         (-[WebScriptObject webScriptValueAtIndex:]):
21490         (-[WebScriptObject setWebScriptValueAtIndex:value:]):
21491         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
21492         * bindings/objc/WebScriptObjectPrivate.h:
21493         * bindings/objc/objc_instance.h:
21494         * bindings/objc/objc_runtime.mm:
21495         (convertValueToObjcObject):
21496         * bindings/objc/objc_utility.mm:
21497         (KJS::Bindings::convertValueToObjcValue):
21498         * bindings/runtime.cpp:
21499         (Instance::Instance):
21500         (Instance::operator=):
21501         * bindings/runtime.h:
21502         (KJS::Bindings::Instance::Instance):
21503         (KJS::Bindings::Instance::setExecutionContext):
21504         (KJS::Bindings::Instance::executionContext):
21505         * bindings/runtime_root.cpp:
21506         (RootObject::setInterpreter):
21507         * bindings/runtime_root.h:
21508         * kjs/interpreter.h:
21509         (KJS::Interpreter::isGlobalObject):
21510         (KJS::Interpreter::interpreterForGlobalObject):
21511         (KJS::Interpreter::isSafeScript):
21512
21513 === Safari-179 ===
21514
21515 2005-01-13  Vicki Murley <vicki@apple.com>
21516
21517         Reviewed by Adele.
21518
21519         - fix <rdar://problem/3946836> Safari about box lists 2004 instead of 2005
21520  
21521         * JavaScriptCore.pbproj/project.pbxproj: bump "2004" to "2005"
21522
21523 2005-01-12  Richard Williamson   <rjw@apple.com>
21524
21525         Avoid additional work on dealloc by adding early out to
21526         removeNativeReference().  (This will save time on dealloc
21527         for all ObjC DOM objects.)
21528
21529         Reviewed by Darin.
21530
21531         * bindings/runtime_root.cpp:
21532         (KJS::Bindings::removeNativeReference):
21533
21534 2005-01-12  Richard Williamson   <rjw@apple.com>
21535
21536         Fixed <rdar://problem/3923356> REGRESSION: Java/JavaScript security checks working incorrectly
21537
21538         We were always returning the first "root" object for all runtime
21539         objects.  Changed 0 in loop to i, the index.
21540
21541         Reviewed by David Harrison.
21542
21543         * bindings/runtime_root.cpp:
21544         (KJS::Bindings::rootForImp):
21545
21546 2005-01-11  Richard Williamson   <rjw@apple.com>
21547
21548         Fixed <rdar://problem/3887930> Must use new Java plug-in API to get/set fields so exception handling works (fixes many LiveConnect crashes)
21549
21550         Use the new dispatching API to invoke JNI, rather than calling JNI
21551         directly.
21552
21553         Reviewed by David Harrison.
21554
21555         * bindings/jni/jni_instance.cpp:
21556         (JavaInstance::invokeMethod):
21557         * bindings/jni/jni_runtime.cpp:
21558         (JavaField::dispatchValueFromInstance):
21559         (JavaField::valueFromInstance):
21560         (JavaField::dispatchSetValueToInstance):
21561         (JavaField::setValueToInstance):
21562         * bindings/jni/jni_runtime.h:
21563         * bindings/jni/jni_utility.cpp:
21564         (KJS::Bindings::convertValueToJValue):
21565
21566 === Safari-178 ===
21567
21568 === Safari-177 ===
21569
21570 === Safari-176 ===
21571
21572 2004-12-17  Maciej Stachowiak  <mjs@apple.com>
21573
21574         Reviewed by Kevin.
21575
21576         <rdar://problem/3926869> Opening caches window after running PLT causes crash
21577         
21578         * kjs/protected_values.cpp:
21579         (KJS::ProtectedValues::getProtectCount): Don't include simple numbers in
21580         the protected value table.
21581         (KJS::ProtectedValues::increaseProtectCount): Ditto.
21582         (KJS::ProtectedValues::decreaseProtectCount): Ditto.
21583
21584 2004-12-16  Darin Adler  <darin@apple.com>
21585
21586         Reviewed by Maciej.
21587
21588         - fixed <rdar://problem/3920764> Unimplemented String methods toLocaleLowerCase and toLocaleUpperCase
21589
21590         * kjs/string_object.h: Added toLocaleLowerCase and toLocaleUpperCase.
21591         * kjs/string_object.cpp: (StringProtoFuncImp::call): Made locale versions be synonmyms for the
21592         non-locale-specific versions.
21593         * kjs/string_object.lut.h: Regenerated.
21594
21595 2004-12-14  Richard Williamson   <rjw@apple.com>
21596
21597         Pass URL of plugin view when call into JNI.
21598
21599         Reviewed by Chris.
21600
21601         * bindings/jni/jni_objc.mm:
21602         (KJS::Bindings::dispatchJNICall):
21603
21604 2004-12-13  Richard Williamson   <rjw@apple.com>
21605
21606         Fixed <rdar://problem/3827799> repro. crash with IBM Rational ClearCase Web under Safari (Java/LiveConnect-related)
21607
21608         Add support for calling static Java methods from JavaScript.
21609
21610         Reviewed by Maciej.
21611
21612         * bindings/jni/jni_instance.cpp:
21613         (JavaInstance::invokeMethod):
21614         * bindings/jni/jni_runtime.cpp:
21615         (JavaMethod::JavaMethod):
21616         * bindings/jni/jni_runtime.h:
21617         (KJS::Bindings::JavaMethod::isStatic):
21618         * bindings/jni/jni_utility.cpp:
21619         (callJNIStaticMethod):
21620         (KJS::Bindings::callJNIBooleanMethod):
21621         (KJS::Bindings::callJNIStaticBooleanMethod):
21622         * bindings/jni/jni_utility.h:
21623
21624 2004-12-13  Richard Williamson   <rjw@apple.com>
21625
21626         Fixed <rdar://problem/3887767> LiveConnect doesn't propagate Java exceptions back to JavaScript (prevents security suite from running)
21627
21628         Reviewed by John.
21629
21630         * bindings/jni/jni_instance.cpp:
21631         (JavaInstance::invokeMethod):
21632         * bindings/jni/jni_objc.mm:
21633         (KJS::Bindings::dispatchJNICall):
21634         * bindings/jni/jni_runtime.h:
21635         * bindings/jni/jni_utility.h:
21636
21637 === Safari-175 ===
21638
21639 2004-12-07  Maciej Stachowiak  <mjs@apple.com>
21640
21641         Reviewed by Darin.
21642
21643         <rdar://problem/3908017> REGRESSION (172-173): assertion in ObjectImp::construct trying to create JS error (24hourfitness.com)
21644
21645         The fix was to implement copy constructor and assignment operator,
21646         the ones that worked on the base class did not replace the
21647         defaults apparently!
21648         
21649         * kjs/protect.h:
21650         (KJS::ProtectedValue::ProtectedValue):
21651         (KJS::ProtectedValue::operator=):
21652         (KJS::ProtectedObject::ProtectedObject):
21653         (KJS::ProtectedObject::operator=):
21654         
21655         Also fixed a bug in the GC test mode that compares the results of
21656         the old collector and the new collector.
21657
21658         * kjs/value.cpp:
21659         (ValueImp::mark):
21660
21661 === Safari-173 ===
21662
21663 2004-11-23  Richard Williamson   <rjw@apple.com>
21664
21665         Fixed <rdar://problem/3890385> field and method cache incorrectly capped (c bindings)
21666
21667         Reviewed by Ken.
21668
21669         * bindings/c/c_class.cpp:
21670         (CClass::_commonInit):
21671
21672 2004-11-21  Maciej Stachowiak  <mjs@apple.com>
21673
21674         Reviewed by Ken.
21675
21676         <rdar://problem/3889696> Enable conservative garbage collection for JavaScript
21677         
21678         * kjs/collector.cpp:
21679         (KJS::Collector::Thread::Thread):
21680         (KJS::destroyRegisteredThread):
21681         (KJS::initializeRegisteredThreadKey):
21682         (KJS::Collector::registerThread):
21683         (KJS::Collector::markStackObjectsConservatively):
21684         (KJS::Collector::markCurrentThreadConservatively):
21685         (KJS::Collector::markOtherThreadConservatively):
21686         * kjs/collector.h:
21687         * kjs/internal.cpp:
21688         (lockInterpreter):
21689         * kjs/value.h:
21690
21691 === Safari-172 ===
21692
21693 2004-11-15  Richard Williamson   <rjw@apple.com>
21694
21695         Fixed <rdar://problem/3880561> Default string value of ObjC object in JS should be [obj description].
21696
21697         Reviewed by Hyatt.
21698
21699         * bindings/objc/objc_instance.mm:
21700         (ObjcInstance::stringValue):
21701         * bindings/objc/objc_utility.h:
21702         * bindings/objc/objc_utility.mm:
21703         (KJS::Bindings::convertNSStringToString):
21704         (KJS::Bindings::convertObjcValueToValue):
21705
21706 === Safari-171 ===
21707
21708 2004-11-09  Chris Blumenberg  <cblu@apple.com>
21709
21710         Fixed: <rdar://problem/3872724> soft link against JavaVM to save ~2MB RSHRD
21711
21712         Reviewed by rjw.
21713
21714         * ChangeLog:
21715         * JavaScriptCore.pbproj/project.pbxproj: don't link against JavaVM
21716         * bindings/softlinking.c: Added.
21717         (loadFramework): new
21718         (getFunctionPointer): new
21719         (JNI_GetCreatedJavaVMs): load JavaVM if not already loaded, get _JNI_GetCreatedJavaVMs symbol if we don't already have it, call JNI_GetCreatedJavaVMs
21720
21721 === Safari-170 ===
21722
21723 2004-11-04  Darin Adler  <darin@apple.com>
21724
21725         Reviewed by Ken.
21726
21727         - fixed <rdar://problem/3865365> since -[WebScriptObject dealloc] does not call [super dealloc], the build will fail due to a warning
21728         - fixed behavior so that [[WebScriptObject alloc] initWithCoder:] doesn't leak WebUndefined instances
21729           and incidentally so that [[WebScriptObject alloc] init] returns the single shared instance rather
21730           than allocating a new one
21731
21732         * bindings/objc/WebScriptObject.mm: Removed some stray semicolons.
21733         (+[WebUndefined allocWithZone:]): Made this the common bottleneck that returns the single instance
21734         of WebUndefined, since it's the single method that normally allocates new instances. Calls super to
21735         actually allocate only the very first time it's called.
21736         (-[WebUndefined initWithCoder:]): Simplified to just return self (no reason to re-lookup the single
21737         shared instance since there can be only one).
21738         (-[WebUndefined copyWithZone:]): Ditto.
21739         (-[WebUndefined retain]): Ditto.
21740         (-[WebUndefined retainCount]): Use UINT_MAX constant here (matches usage in NSObject.m for retain count
21741         of class).
21742         (-[WebUndefined autorelease]): Simplified to just return self (see above).
21743         (-[WebUndefined copy]): No need to override this since it just turns around and calls copyWithZone:.
21744         (-[WebUndefined dealloc]): Added an assertion since this method should never be called. Also added
21745         a call to [super dealloc] after return; to make the new -Wdealloc-check compiler happy (fixing the
21746         bug mentioned above).
21747         (+[WebUndefined undefined]): Reimplemented; calls allocWithZone:NULL to get to the shared instance.
21748         No need to call init, since that's a no-op for this class.
21749
21750 2004-11-03  David Harrison  <harrison@apple.com>
21751
21752         Reviewed by Darin.
21753         
21754         Eliminate the use of a marker file to determine how to build.
21755
21756         * .cvsignore:
21757         * Makefile.am:
21758
21759 2004-11-01  Richard Williamson   <rjw@apple.com>
21760
21761         Fixed <rdar://problem/3861469> Latest Real player crashes Safari on some sites.
21762
21763         Reviewed by Ken.
21764
21765         * bindings/c/c_instance.cpp:
21766         (CInstance::invokeMethod):
21767         (CInstance::invokeDefaultMethod):
21768         Initialize out parameters to void type.
21769
21770         * bindings/c/c_runtime.cpp:
21771         (CField::valueFromInstance):
21772         (CField::setValueToInstance):
21773         Initialize out parameters to void type.
21774         Also added additional checks to protect against classes that 
21775         don't implement all functions.
21776
21777 2004-11-01  Richard Williamson   <rjw@apple.com>
21778
21779         Fixed <rdar://problem/3861257> WebUndefined should be returned for undefined values
21780
21781         Reviewed by John.
21782
21783         * ChangeLog:
21784         * bindings/objc/WebScriptObject.mm:
21785         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
21786         Added additional conversion Undefined -> WebUndefined.
21787         * bindings/objc/objc_utility.mm:
21788         (KJS::Bindings::convertObjcValueToValue):
21789         Added additional conversion WebUndefined -> Undefined.
21790
21791 2004-11-01  Darin Adler  <darin@apple.com>
21792
21793         - fixed <rdar://problem/3855573> Remove reference to "WebScriptMethods" from WebScriptObject.h comments
21794
21795         * bindings/objc/WebScriptObject.h: Removed unneeded #ifdef protection for multiple includes (since
21796         this is an Objective-C header and we use #import for those). Fixed comments as requested in the bug
21797         report to match the contents of the file.
21798
21799 === Safari-169 ===
21800
21801 === Safari-168 ===
21802
21803 2004-10-22  Ken Kocienda  <kocienda@apple.com>
21804
21805         Reviewed by me
21806
21807         * JavaScriptCore.pbproj/project.pbxproj:  
21808         Add GCC_ENABLE_OBJC_GC and GCC_FAST_OBJC_DISPATCH flags.
21809
21810 === Safari-167 ===
21811
21812 2004-10-13  Richard Williamson   <rjw@apple.com>
21813
21814         Moved boolean checks prior to NSNumber checks.  booleans are
21815         NSNumbers.
21816
21817         Follow on to <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number.
21818
21819         Reviewed by John.
21820
21821         * bindings/objc/objc_utility.mm:
21822         (KJS::Bindings::convertObjcValueToValue):
21823
21824 2004-10-12  Richard Williamson   <rjw@apple.com>
21825
21826         Fixed access to DOM object via WebScriptObject API.
21827         The execution context for DOM objects wasn't being found.
21828         <rdar://problem/3831372> The valueForKey method for @"offsetLeft" on a paragraph element causes a crash.
21829
21830         Reviewed by Chris.
21831
21832         * bindings/objc/WebScriptObject.mm:
21833         (_didExecute):
21834         (-[WebScriptObject KJS::Bindings::]):
21835         (-[WebScriptObject callWebScriptMethod:withArguments:]):
21836         (-[WebScriptObject evaluateWebScript:]):
21837         (-[WebScriptObject setValue:forKey:]):
21838         (-[WebScriptObject valueForKey:]):
21839         (-[WebScriptObject stringRepresentation]):
21840         * bindings/objc/WebScriptObjectPrivate.h:
21841
21842 2004-10-09  Darin Adler  <darin@apple.com>
21843
21844         Reviewed by Kevin.
21845
21846         - fixed <rdar://problem/3804661> REGRESSION: JavaScriptCore framework now has two init routines
21847
21848         * bindings/NP_jsobject.cpp: Fixed unnecessarily-complex globals set up that was
21849         creating an init routine.
21850
21851         * kjs/ustring.cpp: Changed around the UString::Rep::empty construction to not
21852         require a global constructor that creates an init routine.
21853
21854 2004-10-09  Darin Adler  <darin@apple.com>
21855
21856         Reviewed by Kevin.
21857
21858         - fixed <rdar://problem/3822618> REGRESSION (164-165): expedia.com's popup help doesn't work
21859
21860         * kjs/reference.cpp: (Reference::putValue): Change so that references not found in any object
21861         work with the window object of the page the function is in, not the page of the caller. This
21862         is what all other browsers do. This code was hidden before by the "everything is defined on
21863         window object" hack in WebCore.
21864
21865 2004-10-07  Richard Williamson   <rjw@apple.com>
21866
21867         Added simple JavaScript call tracing.  Very useful for
21868         debugging complex pages.
21869
21870         Tracing is only available in development builds and is
21871         enabled by:
21872
21873         (gdb) set traceJavaScript = 1
21874
21875         or programatically
21876
21877         setTraceJavaScript(true)
21878
21879         Function, args, and return values are printed to console.  Very
21880         verbose.
21881
21882         Reviewed by Ken.
21883
21884         * kjs/function_object.cpp:
21885         (FunctionProtoFuncImp::call):
21886         * kjs/object.cpp:
21887         (KJS::Object::call):
21888
21889 === Safari-166 ===
21890
21891 2004-10-05  Richard Williamson   <rjw@apple.com>
21892
21893         Fixed <rdar://problem/3819234> NPN_SetException (and throwException:) isn't implemented
21894
21895         Reviewed by Chris.
21896
21897         * bindings/NP_jsobject.cpp:
21898         (_NPN_SetException):
21899         * bindings/npruntime.cpp:
21900         (_NPN_SetExceptionWithUTF8):
21901         * bindings/objc/WebScriptObject.mm:
21902         (+[WebScriptObject throwException:]):
21903         * kjs/internal.h:
21904         (KJS::InterpreterImp::context):
21905
21906 2004-10-05  Richard Williamson   <rjw@apple.com>
21907
21908         Fixed <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number
21909
21910         Reviewed by Ken.
21911
21912         * bindings/objc/objc_utility.mm:
21913         (KJS::Bindings::convertObjcValueToValue):
21914
21915 2004-10-04  Darin Adler  <darin@apple.com>
21916
21917         Reviewed by Ken.
21918
21919         - rolled in a fix the KDE folks did for the operations that generate HTML fragments
21920
21921         * kjs/string_object.cpp: (StringProtoFuncImp::call): Added quote marks to generated HTML.
21922
21923         - rolled out an old workaround we don't need any more
21924
21925         * JavaScriptCore.pbproj/project.pbxproj: Remove -Wno-long-double because the <math.h> issue that
21926         required it is no longer there.
21927
21928 2004-09-30  Richard Williamson  <rjw@apple.com>
21929
21930         Fixed <rdar://problem/3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
21931
21932         Reviewed by Chris.
21933
21934         * bindings/NP_jsobject.cpp:
21935         (_NPN_GetProperty):
21936         (_NPN_HasProperty):
21937         (_NPN_HasMethod):
21938         * bindings/c/c_class.cpp:
21939         (CClass::methodsNamed):
21940         (CClass::fieldNamed):
21941         * bindings/c/c_class.h:
21942         * bindings/c/c_instance.cpp:
21943         (CInstance::invokeMethod):
21944         * bindings/jni/jni_class.cpp:
21945         (JavaClass::methodsNamed):
21946         * bindings/jni/jni_class.h:
21947         * bindings/npruntime.h:
21948         * bindings/objc/objc_class.h:
21949         * bindings/objc/objc_class.mm:
21950         (ObjcClass::methodsNamed):
21951         * bindings/runtime.h:
21952         * bindings/runtime_object.cpp:
21953         (RuntimeObjectImp::get):
21954         (RuntimeObjectImp::hasProperty):
21955
21956 2004-09-29  Chris Blumenberg  <cblu@apple.com>
21957
21958         Prepended underscores to NPN methods so that when the QT plug-in loads these symbols, it uses the non-underscore versions in WebKit. Without this, the QT plug-in was failing to load when launching Safari from the command-line.
21959
21960         Reviewed by rjw.
21961
21962         * JavaScriptCore.pbproj/project.pbxproj:
21963         * bindings/NP_jsobject.cpp:
21964         (_NPN_CreateScriptObject):
21965         (_NPN_InvokeDefault):
21966         (_NPN_Invoke):
21967         (_NPN_Evaluate):
21968         (_NPN_GetProperty):
21969         (_NPN_SetProperty):
21970         (_NPN_RemoveProperty):
21971         (_NPN_HasProperty):
21972         (_NPN_HasMethod):
21973         * bindings/c/c_class.cpp:
21974         (CClass::methodsNamed):
21975         (CClass::fieldNamed):
21976         * bindings/c/c_instance.cpp:
21977         (CInstance::CInstance):
21978         (CInstance::~CInstance):
21979         (CInstance::operator=):
21980         (CInstance::invokeMethod):
21981         (CInstance::invokeDefaultMethod):
21982         * bindings/c/c_runtime.cpp:
21983         * bindings/c/c_runtime.h:
21984         (KJS::Bindings::CField::name):
21985         (KJS::Bindings::CMethod::name):
21986         * bindings/npruntime.cpp:
21987         (_NPN_GetStringIdentifier):
21988         (_NPN_GetStringIdentifiers):
21989         (_NPN_GetIntIdentifier):
21990         (_NPN_IdentifierIsString):
21991         (_NPN_UTF8FromIdentifier):
21992         (_NPN_IntFromIdentifier):
21993         (NPN_InitializeVariantWithObject):
21994         (_NPN_ReleaseVariantValue):
21995         (_NPN_CreateObject):
21996         (_NPN_RetainObject):
21997         (_NPN_ReleaseObject):
21998         (_NPN_SetExceptionWithUTF8):
21999         (_NPN_SetException):
22000
22001 2004-09-26  Darin Adler  <darin@apple.com>
22002
22003         * kjs/string_object.cpp: (StringProtoFuncImp::call): Remove strange use of high() and
22004         low() to get Unicode value of character, and just use unicode().
22005
22006 2004-09-26  Darin Adler  <darin@apple.com>
22007
22008         - refine charAt/charCodeAt fix slightly
22009
22010         * kjs/string_object.cpp: (StringProtoFuncImp::call): Treat undefined the same was as an
22011         omitted parameter, as we do everywhere else, and as other browsers do here.
22012
22013 2004-09-26  Darin Adler  <darin@apple.com>
22014
22015         Reviewed by Kevin.
22016
22017         - fixed <rdar://problem/3816097> REGRESSION: mailblocks, and presumably many other pages, failing because variable not found
22018
22019         * kjs/internal.cpp: (InterpreterImp::evaluate): Process variable declarations before executing
22020         the program. We were doing this properly for functions, but not entire programs.
22021
22022         - fixed <rdar://problem/3814706> REGRESSION: text fields in mailblocks wizards do not accept keystrokes due to use of charCodeAt()
22023
22024         * kjs/string_object.cpp: (StringProtoFuncImp::call): Changed the implementation of charAt
22025         and charCodeAt to treat a missing parameter as an index of 0, rather than an invalid index.
22026
22027         * tests/mozilla/expected.html: Update for two tests that now pass with these changes.
22028
22029 === Safari-165 ===
22030
22031 === Safari-164 ===
22032
22033 2004-09-14  Richard Williamson   <rjw@apple.com>
22034
22035         1.  Add class parameter to object allocation function.  This is somewhat redundant, given that
22036         the allocation function is in the class function vector, but people wanted to use the same
22037         allocation function for different classes.
22038         
22039         2.  Renamed NPN_Class to NPN_Invoke to match the name in the function vector.
22040         
22041         3.  Add support for a default function on an object.  This is a feature that ActiveX supports,
22042         and will allow JavaScript code to be written that will look exactly the same for both ActiveX
22043         plugins and Netscape or WebKit plugins.  There are implementations included for the 'C' and
22044         'Objective-C' bindings.
22045         
22046         There bugs are covered by
22047         
22048         <rdar://problem/3776343> Support for default functions in the JavaScript bindings
22049         <rdar://problem/3779186> NPN_Call needs to be renamed to NPN_Invoke
22050         <rdar://problem/3674754> Need to implement latest npruntime.h
22051
22052         Reviewed by John.
22053
22054         * bindings/NP_jsobject.cpp:
22055         (jsAllocate):
22056         (NPN_InvokeDefault):
22057         (NPN_Invoke):
22058         * bindings/c/c_class.cpp:
22059         * bindings/c/c_instance.cpp:
22060         (CInstance::CInstance):
22061         (CInstance::operator=):
22062         (CInstance::invokeMethod):
22063         (CInstance::invokeDefaultMethod):
22064         * bindings/c/c_instance.h:
22065         * bindings/c/c_runtime.cpp:
22066         * bindings/c/c_runtime.h:
22067         * bindings/jni/jni_instance.cpp:
22068         (JavaInstance::invokeDefaultMethod):
22069         * bindings/jni/jni_instance.h:
22070         * bindings/npruntime.cpp:
22071         (NPN_CreateObject):
22072         * bindings/npruntime.h:
22073         * bindings/objc/WebScriptObject.h:
22074         * bindings/objc/objc_class.mm:
22075         (ObjcClass::fallbackObject):
22076         * bindings/objc/objc_instance.h:
22077         * bindings/objc/objc_instance.mm:
22078         (ObjcInstance::invokeDefaultMethod):
22079         * bindings/objc/objc_runtime.h:
22080         * bindings/objc/objc_runtime.mm:
22081         (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
22082         (ObjcFallbackObjectImp::get):
22083         (ObjcFallbackObjectImp::put):
22084         (ObjcFallbackObjectImp::canPut):
22085         (ObjcFallbackObjectImp::implementsCall):
22086         (ObjcFallbackObjectImp::call):
22087         (ObjcFallbackObjectImp::hasProperty):
22088         (ObjcFallbackObjectImp::deleteProperty):
22089         (ObjcFallbackObjectImp::defaultValue):
22090         * bindings/runtime.h:
22091         (KJS::Bindings::Class::fallbackObject):
22092         (KJS::Bindings::Instance::getValueOfUndefinedField):
22093         (KJS::Bindings::Instance::setValueOfUndefinedField):
22094         (KJS::Bindings::Instance::valueOf):
22095         * bindings/runtime_object.cpp:
22096         (RuntimeObjectImp::implementsCall):
22097         (RuntimeObjectImp::call):
22098         * bindings/runtime_object.h:
22099
22100 2004-09-13  Maciej Stachowiak  <mjs@apple.com>
22101
22102         Reviewed by Darin.
22103
22104         <rdar://problem/3794735> Gmail- sending a very long message with Safari is so slow it seems like a hang
22105         
22106         * kjs/string_object.cpp:
22107         (StringProtoFuncImp::call): Replaced implementation of replace()
22108         method with function below...
22109         (replace): In order to avoid excessive allocation and copying,
22110         figure out the ranges of the original string and replacement
22111         strings to be assembled, instead of constantly creating new
22112         strings at each substitution. The old behavior is basically O(N^2)
22113         for a global replace on a pattern that matches many places in the
22114         string.
22115         (regExpIsGlobal): Helper function for the above.
22116         (expandSourceRanges): ditto
22117         (pushSourceRange): ditto
22118         (expandReplacements): ditto
22119         (pushReplacement): ditto
22120         * kjs/ustring.cpp:
22121         (KJS::UString::spliceSubstringsWithSeparators): New method that
22122         pieces together substring ranges of this string together with
22123         specified separators, all at one go.
22124         * kjs/ustring.h:
22125         (KJS::UString::Range::Range): Added new helper class to represent
22126         substring choices.
22127
22128 2004-09-14  Maciej Stachowiak  <mjs@apple.com>
22129
22130         Reviewed by Darin.
22131
22132         - fixed <rdar://problem/3800315> encode-URI-test layout test is failing
22133         
22134         * kjs/function.cpp:
22135         (KJS::GlobalFuncImp::call): Make sure to escape null
22136         characters. This is a bug in the new code that made part of the
22137         test fail.
22138
22139 2004-09-13  Darin Adler  <darin@apple.com>
22140
22141         Reviewed by Kevin and Maciej.
22142
22143         - new function to support fix for DIG bug in WebCore
22144
22145         * kjs/scope_chain.h: Added new push function that pushes another entire scope chain.
22146         * kjs/scope_chain.cpp: (KJS::ScopeChain::push): Ditto.
22147
22148 2004-09-12  Darin Adler  <darin@apple.com>
22149
22150         * tests/mozilla/expected.html: Updated test results for 3 more tests that pass with the new version
22151         of escape and unescape.
22152
22153 2004-09-12  Darin Adler  <darin@apple.com>
22154
22155         Reviewed by Maciej.
22156
22157         - fixed <rdar://problem/3798209> any non-ASCII characters are garbled in the result of toLocaleString
22158
22159         * kjs/date_object.cpp:
22160         (formatLocaleDate): Replaced two old functions that used LongDateTime with this one new function that
22161         uses CFDateFormatter.
22162         (DateProtoFuncImp::call): Call the new formatLocaleDate instead of both formatLocaleDate and formatLocaleTime.
22163
22164 2004-09-09  Maciej Stachowiak  <mjs@apple.com>
22165
22166         Reviewed by Richard.
22167
22168         <rdar://problem/3493140> REGRESSION (85-100): cedille displays %-escaped in JavaScript message at hotmail.com
22169
22170         * kjs/function.cpp:
22171         (KJS::GlobalFuncImp::call): Replace our escape() and unescape() implementations with
22172         ones from KDE KJS, which have the proper latin-1 behavior to match Win IE.
22173         * kjs/lexer.cpp:
22174         (Lexer::isHexDigit): Made static and non-const.
22175         * kjs/lexer.h:
22176
22177 === Safari-163 ===
22178
22179 2004-09-06  Darin Adler  <darin@apple.com>
22180
22181         * JavaScriptCore.pbproj/project.pbxproj: Bump MACOSX_DEPLOYMENT_TARGET to 10.3.
22182
22183 === Safari-162 ===
22184
22185 2004-09-01  Richard Williamson   <rjw@apple.com>
22186
22187         Add pid to exception messages (to help debug dashboard clients).
22188
22189         Reviewed by Chris.
22190
22191         * kjs/interpreter.cpp:
22192         (Interpreter::evaluate):
22193
22194 === Safari-161 ===
22195
22196 2004-08-20  Richard Williamson   <rjw@apple.com>
22197
22198         Implemented new JNI abstraction.  We no longer invoke Java methods
22199         directly with JNI, rather we call into the plugin.  This allows the
22200         plugin to dispatch the call to the appropriate VM thread.  This
22201         change should (will?) fix a whole class of threading related problems with
22202         the Java VM.
22203
22204         Reviewed by Hyatt.
22205
22206         * JavaScriptCore.pbproj/project.pbxproj:
22207         * bindings/c/c_instance.h:
22208         (KJS::Bindings::CInstance::setExecutionContext):
22209         (KJS::Bindings::CInstance::executionContext):
22210         * bindings/jni/jni_instance.cpp:
22211         (JavaInstance::JavaInstance):
22212         (JavaInstance::invokeMethod):
22213         (JavaInstance::setExecutionContext):
22214         (JavaInstance::executionContext):
22215         * bindings/jni/jni_instance.h:
22216         * bindings/jni/jni_jsobject.cpp:
22217         (JSObject::convertJObjectToValue):
22218         * bindings/jni/jni_runtime.cpp:
22219         (JavaField::JavaField):
22220         (JavaArray::convertJObjectToArray):
22221         (JavaField::valueFromInstance):
22222         (JavaArray::JavaArray):
22223         (JavaArray::valueAt):
22224         * bindings/jni/jni_runtime.h:
22225         (KJS::Bindings::JavaArray::operator=):
22226         (KJS::Bindings::JavaArray::executionContext):
22227         * bindings/jni/jni_utility.h:
22228         * bindings/objc/objc_instance.h:
22229         (KJS::Bindings::ObjcInstance::setExecutionContext):
22230         (KJS::Bindings::ObjcInstance::executionContext):
22231         * bindings/runtime.cpp:
22232         (Instance::createBindingForLanguageInstance):
22233         * bindings/runtime.h:
22234         * bindings/runtime_root.h:
22235         (KJS::Bindings::RootObject::nativeHandle):
22236
22237 === Safari-158 ===
22238
22239 2004-08-19  Vicki Murley  <vicki@apple.com>
22240
22241         Reviewed by John.
22242
22243         * kjs/property_map.cpp:
22244         (KJS::PropertyMap::put): initialize deletedElementIndex to zero, to make the compiler happy
22245
22246 2004-08-17  Darin Adler  <darin@apple.com>
22247
22248         Reviewed by Adele.
22249
22250         - fixed <rdar://problem/3746676> SAP WebDynpro app hangs inside JavaScript property map hash table code (deleted sentinel problem)
22251
22252         * kjs/property_map.h: Added some private functions.
22253         * kjs/property_map.cpp:
22254         (KJS::PropertyMap::clear): Set sentinelCount to 0.
22255         (KJS::PropertyMap::put): Complete search for the element before choosing to use the deleted-element sentinel.
22256         Also keep sentinel count up to date when we destroy a sentinel by overwriting with a new added element.
22257         (KJS::PropertyMap::expand): Added. Calls rehash with a size 2x the old size, or 16.
22258         (KJS::PropertyMap::rehash): Added. Refactored the rehash code into a separate function.
22259         (KJS::PropertyMap::remove): Add one to sentinelCount, and rehash if 1/4 or more of the elements are
22260         deleted-element sentinels.
22261         (KJS::PropertyMap::checkConsistency): Check the sentinelCount.
22262
22263 2004-08-16  Maciej Stachowiak  <mjs@apple.com>
22264
22265         Code change by Eric Albert, reviewd by me.
22266
22267         <rdar://problem/3571960> washingtonpost.com claims I don't have cookies enabled and won't let me read articles
22268
22269         * kjs/date_object.cpp:
22270         (timetUsingCF): Clamp time to LONG_MAX (getting rid of time_t
22271         entirely would be even better, but is not required to fix this bug.
22272
22273 === Safari-157 ===
22274
22275 2004-08-16  Richard Williamson   <rjw@apple.com>
22276
22277         Fixed <rdar://problem/3581092> cash in KJS::Bindings::JSObject::eval at tcvetantcvetkov.com
22278
22279         Adds bullet proofing to protect against evaluation of bogus JS in all the flavors of bindings (Java, C, and ObjC).
22280
22281         Reviewed by Chris.
22282
22283         * bindings/NP_jsobject.cpp:
22284         (NPN_Evaluate):
22285         * bindings/jni/jni_jsobject.cpp:
22286         (JSObject::eval):
22287         * bindings/objc/WebScriptObject.mm:
22288         (-[WebScriptObject evaluateWebScript:]):
22289
22290 2004-08-15  Richard Williamson   <rjw@apple.com>
22291
22292         More updates to np headers.  Implemented new NPN functions.
22293
22294         Reviewed by Darin.
22295
22296         * bindings/NP_jsobject.cpp:
22297         (NPN_HasProperty):
22298         (NPN_HasMethod):
22299         * bindings/npapi.h:
22300         * bindings/npruntime.h:
22301
22302 2004-08-13  Darin Adler  <darin@apple.com>
22303
22304         - fix build so we can compile again
22305
22306         * bindings/npapi.h: Added. Richard forgot to check this in. The one I'm checking in here
22307         is good enough so that we can compile, but it's only a stopgap measure, because I think
22308         Richard has a newer one he wants to check in.
22309
22310 2004-08-12  Richard Williamson   <rjw@apple.com>
22311
22312         Bring npruntime.h and friends closer to compliance with
22313         latest spec.
22314
22315         Reviewed by Maciej.
22316
22317         * JavaScriptCore.pbproj/project.pbxproj:
22318         * bindings/NP_jsobject.cpp:
22319         (jsAllocate):
22320         (_NPN_CreateScriptObject):
22321         (NPN_Call):
22322         (NPN_Evaluate):
22323         (NPN_GetProperty):
22324         (NPN_SetProperty):
22325         (NPN_RemoveProperty):
22326         * bindings/NP_jsobject.h:
22327         * bindings/c/c_instance.cpp:
22328         (CInstance::invokeMethod):
22329         * bindings/c/c_utility.cpp:
22330         (convertNPVariantToValue):
22331         * bindings/npruntime.cpp:
22332         (NPN_IdentifierIsString):
22333         (NPN_VariantIsVoid):
22334         (NPN_VariantIsNull):
22335         (NPN_VariantIsUndefined):
22336         (NPN_VariantIsBool):
22337         (NPN_VariantIsInt32):
22338         (NPN_VariantIsDouble):
22339         (NPN_VariantIsString):
22340         (NPN_VariantIsObject):
22341         (NPN_VariantToBool):
22342         (NPN_VariantToString):
22343         (NPN_VariantToInt32):
22344         (NPN_VariantToDouble):
22345         (NPN_VariantToObject):
22346         (NPN_InitializeVariantAsVoid):
22347         (NPN_InitializeVariantAsNull):
22348         (NPN_InitializeVariantAsUndefined):
22349         (NPN_InitializeVariantWithBool):
22350         (NPN_InitializeVariantWithInt32):
22351         (NPN_InitializeVariantWithDouble):
22352         (NPN_InitializeVariantWithString):
22353         (NPN_InitializeVariantWithStringCopy):
22354         (NPN_InitializeVariantWithObject):
22355         (NPN_InitializeVariantWithVariant):
22356         (NPN_ReleaseVariantValue):
22357         (NPN_CreateObject):
22358         * bindings/npruntime.h:
22359         (_NPString::):
22360         (_NPString::_NPVariant::):
22361         * bindings/npruntime_priv.h: Added.
22362
22363 2004-08-12  Darin Adler  <darin@apple.com>
22364
22365         Reviewed by Adele.
22366
22367         - fixed 3 problems with parse functions that I just wrote, fixing 3 more Mozilla JavaScript tests
22368
22369         * kjs/function.cpp:
22370         (KJS::parseDigit): Fix typo, 'Z' instead of 'z', that prevented lowercase hex digits from working.
22371         (KJS::parseInt): Add octal support. Specification says it's optional, but I guess not.
22372         (KJS::parseFloat): Fix check for "0x" in parseFloat to return 0 rather than NaN. Also add code
22373         to skip leading "+" or "-".
22374
22375 === Safari-156 ===
22376
22377 2004-08-12  Darin Adler  <darin@apple.com>
22378
22379         Reviewed by Ken.
22380
22381         - fixed 43 Mozilla JavaScript tests
22382
22383         * kjs/date_object.h: Change parseDate and timeClip to take and return doubles.
22384         * kjs/date_object.cpp:
22385         (DateObjectImp::construct): Change to use a timeClip function that takes and returns a double rather
22386         than constructing a number object to pass to it.
22387         (DateObjectFuncImp::call): Change to use a parseDate function that returns a double.
22388         (KJS::parseDate): Change to return a double instead of creating the Number object here.
22389         (KJS::timeClip): Implement this as specified in the language standard.
22390
22391         * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set the DontDelete, ReadOnly, and DontEnum
22392         flags on the prototype property.
22393
22394         * kjs/function.cpp:
22395         (KJS::FunctionImp::get): Return null rather than undefined for arguments when the function is not
22396         currently in scope.
22397         (KJS::isStrWhiteSpace): Added. Matches specification for StrWhiteSpace. Could move it to some utility
22398         file later.
22399         (KJS::parseDigit): Added. Helper function for parseInt.
22400         (KJS::parseInt): Added. Integer parser that puts result in a double so we're not limited to what
22401         strtoll can handle. Also matches standard more closely.
22402         (KJS::parseFloat): Added. Handles "0x" properly and passes flag to make empty string turn into NaN
22403         instead of 0.
22404         (KJS::GlobalFuncImp::call): Use the new parseInt and parseFloat.
22405
22406         * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Add a length property.
22407
22408         * kjs/lexer.h: Added error flag and sawError() function for detecting errors.
22409         * kjs/lexer.cpp:
22410         (Lexer::setCode): Clear error state.
22411         (Lexer::lex): Set error state if the lexer encounters an error
22412
22413         * kjs/internal.cpp:
22414         (NumberImp::toString): Roll in change from KDE version to special case 0 so we handle -0 correctly.
22415         (Parser::parse): Use new lexer error method so those errors are treated like parser errors.
22416
22417         * kjs/math_object.cpp: (MathFuncImp::call): Change min and max to treat -0 as less than +0.
22418         Change round to round values between -0.5 and -0 to -0 instead of +0.
22419
22420         * kjs/nodes.h: Add evaluateReference function to GroupNode.
22421         * kjs/nodes.cpp: (GroupNode::evaluateReference): Pass references through groups (parenthesized
22422         expressions) properly so that expressions like "delete (x.y)" work. Before, the parentheses
22423         would change x.y into a value that can't be deleted as a side effect.
22424
22425         * kjs/string_object.cpp: Change parameter count for indexOf and lastIndexOf from 2 to 1 to match
22426         the specification.
22427
22428         * kjs/testkjs.cpp: Rolled in changes from KDE to add a "quit" function to the test tool and
22429         get rid of the fixed size limit for code.
22430
22431         * kjs/ustring.cpp: (KJS::UString::substr): Added optimized case for substr(0, length) so it just
22432         returns the string without creating a new Rep, since I'm using substr in a place where it will
22433         often be passed a 0.
22434
22435         * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed one wrong entry in the Unicode table I added to
22436         the other day that was making a couple tests fail.
22437         * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
22438         * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
22439         * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
22440         * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
22441         * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
22442
22443         * kjs/string_object.lut.h: Regenerated.
22444
22445 2004-08-11  Darin Adler  <darin@apple.com>
22446
22447         - fixed a tiny problem with the UTF-16 PCRE check-in
22448
22449         * pcre/maketables.c: (pcre_maketables): Fix mistake in table-generating code that sometimes caused
22450         the ctype_meta flag to get set in items that should not have it.
22451
22452         * pcre/chartables.c: Regenerated.
22453
22454 2004-08-10  Richard Williamson   <rjw@apple.com>
22455
22456         Fixed <rdar://problem/3674747> Need to implement invokeUndefinedMethodFromWebScript:withArguments:
22457
22458         The following WebScripting methods are now supported on bound
22459         objects:
22460
22461         - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
22462         - (void)setValue:(id)value forUndefinedKey:(NSString *)key
22463         - (id)valueForUndefinedKey:(NSString *)key
22464
22465         Reviewed by Chris.
22466
22467         * bindings/c/c_class.cpp:
22468         (CClass::fieldNamed):
22469         * bindings/c/c_class.h:
22470         * bindings/jni/jni_class.cpp:
22471         (JavaClass::fieldNamed):
22472         * bindings/jni/jni_class.h:
22473         * bindings/objc/objc_class.h:
22474         (KJS::Bindings::ObjcClass::isa):
22475         * bindings/objc/objc_class.mm:
22476         (ObjcClass::methodsNamed):
22477         (ObjcClass::fieldNamed):
22478         (ObjcClass::fallbackObject):
22479         * bindings/objc/objc_instance.h:
22480         * bindings/objc/objc_instance.mm:
22481         (ObjcInstance::invokeMethod):
22482         (ObjcInstance::setValueOfField):
22483         (ObjcInstance::setValueOfUndefinedField):
22484         (ObjcInstance::getValueOfField):
22485         (ObjcInstance::getValueOfUndefinedField):
22486         * bindings/objc/objc_runtime.h:
22487         (KJS::Bindings::ObjcField::~ObjcField):
22488         (KJS::Bindings::ObjcField::ObjcField):
22489         (KJS::Bindings::ObjcField::operator=):
22490         (KJS::Bindings::FallbackObjectImp::classInfo):
22491         * bindings/objc/objc_runtime.mm:
22492         (ObjcField::ObjcField):
22493         (ObjcField::name):
22494         (ObjcField::type):
22495         (ObjcField::valueFromInstance):
22496         (ObjcField::setValueToInstance):
22497         (FallbackObjectImp::FallbackObjectImp):
22498         (FallbackObjectImp::get):
22499         (FallbackObjectImp::put):
22500         (FallbackObjectImp::canPut):
22501         (FallbackObjectImp::implementsCall):
22502         (FallbackObjectImp::call):
22503         (FallbackObjectImp::hasProperty):
22504         (FallbackObjectImp::deleteProperty):
22505         (FallbackObjectImp::defaultValue):
22506         * bindings/runtime.h:
22507         (KJS::Bindings::Class::fallbackObject):
22508         (KJS::Bindings::Instance::getValueOfUndefinedField):
22509         (KJS::Bindings::Instance::setValueOfUndefinedField):
22510         * bindings/runtime_object.cpp:
22511         (RuntimeObjectImp::get):
22512         (RuntimeObjectImp::put):
22513         (RuntimeObjectImp::canPut):
22514         (RuntimeObjectImp::hasProperty):
22515         * bindings/testbindings.mm:
22516         (-[MyFirstInterface valueForUndefinedKey:]):
22517         (-[MyFirstInterface setValue:forUndefinedKey:]):
22518
22519 2004-08-10  Darin Adler  <darin@apple.com>
22520
22521         Reviewed by Dave.
22522
22523         - switch PCRE to do UTF-16 directly instead of converting to/from UTF-8 for speed
22524
22525         * pcre/pcre.h: Added PCRE_UTF16 switch, set to 1. Added pcre_char typedef, which is char
22526         or uint16_t depending on the mode, and used appropriate in the 7 public functions
22527         that need to use it.
22528         * pcre/pcre.c: Add UTF-16 support to all functions.
22529         * pcre/study.c: Ditto.
22530
22531         * pcre/internal.h: Added ichar typedef, which is unsigned char or uint16_t depending on
22532         the mode. Changed declarations to use symbolic constants and typedefs so we size
22533         things to ichar when needed.
22534
22535         * pcre/maketables.c: (pcre_maketables): Change code to make tables that are
22536         sized to 16-bit characters instead of 8-bit.
22537
22538         * pcre/get.c:
22539         (pcre_copy_substring): Use pcre_char instead of char.
22540         (pcre_get_substring_list): Ditto.
22541         (pcre_free_substring_list): Ditto.
22542         (pcre_get_substring): Ditto.
22543         (pcre_free_substring): Ditto.
22544
22545         * pcre/dftables.c: (main): Used a bit more const, and use ICHAR sizes instead
22546         of hard-coding 8-bit table sizes.
22547
22548         * pcre/chartables.c: Regenerated.
22549
22550         * kjs/ustring.h: Remove functions that convert UTF-16 to/from UTF-8 offsets.
22551         * kjs/ustring.cpp: Change the shared empty string to have a unicode pointer that
22552         is not null. The null string still has a null pointer. This prevents us from
22553         passing a null through to the regular expression engine (which results in a null
22554         error even when the string length is 0).
22555
22556         * kjs/regexp.cpp:
22557         (KJS::RegExp::RegExp): Null-terminate the pattern and pass it.
22558         (KJS::RegExp::match): Use the 16-bit string directly, no need to convert to UTF-8.
22559
22560 2004-08-09  Darin Adler  <darin@apple.com>
22561
22562         Reviewed by Maciej.
22563
22564         - fixed 28 Mozilla JavaScript tests
22565
22566         * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined rather than
22567         checking the number of arguments for the join method.
22568
22569         * kjs/lexer.cpp: (Lexer::lex): Parse hexadecimal and octal constants in doubles rather
22570         than integers, so we aren't limited to 32 bits.
22571
22572         * kjs/math_object.cpp: (MathFuncImp::call): Get rid of many unneeded special cases in
22573         the implementation of the pow operation. Also simplied a case that was handling positive
22574         and negative infinity separately.
22575
22576         * kjs/nodes.cpp: (ShiftNode::evaluate): Keep the result of shifts in a double instead of
22577         putting them in a long, so that unsigned shift will work properly.
22578
22579         * kjs/number_object.cpp: Add the DontDelete and ReadOnly flags to the numeric constants.
22580
22581         * kjs/operations.cpp:
22582         (KJS::isPosInf): Added an implementation inside APPLE_CHANGES that does not depend on the
22583         sign of isinf; our isinf function returns +1 even for negative infinity.
22584         (KJS::isNegInf): And again.
22585         (KJS::relation): Put in a nice simple implementation of comparison inside APPLE_CHANGES.
22586         Our floating point already handles the various infinity cases correctly.
22587
22588         * kjs/regexp_object.cpp:
22589         (RegExpProtoFuncImp::call): Add missing return before Null() in Exec method.
22590         (RegExpObjectImp::arrayOfMatches): Put undefined rather than an empty string into the
22591         array in cases where we did not match.
22592         (RegExpObjectImp::construct): Set the DontDelete, ReadOnly, and DontEnum flags for
22593         "global", "ignoreCase", "multiline", and "source".
22594
22595         * kjs/string_object.cpp: (StringProtoFuncImp::call): For the match method, turn a null
22596         string into undefined rather than an empty string. For the slice method, handle an
22597         undefined parameter for the limit properly as decribed in the specification, and add
22598         the limit to one case that didn't have the limit at all. For the methods that generate
22599         HTML strings, use lowercase tags instead of uppercase.
22600
22601         * kjs/ustring.cpp:
22602         (KJS::UChar::toLower): Use u_tolower from the ICU library.
22603         (KJS::UChar::toUpper): Use u_toupper from the ICU library.
22604         (KJS::UString::append): Fix some math that caused a buffer overflow.
22605         (KJS::convertUTF16OffsetsToUTF8Offsets): Ignore negative numbers (-1 is used as a special
22606         flag) rather than converting them all to 0.
22607         (KJS::convertUTF8OffsetsToUTF16Offsets): Ditto.
22608
22609         * tests/mozilla/jsDriver.pl: Fixed the relative links to point to our actual test files.
22610
22611         * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed the Unicode table in this test to match
22612         the Unicode specification in a few cases where it was wrong before.
22613         * tests/mozilla/ecma/String/15.5.4.11-2.js: Ditto.
22614         * tests/mozilla/ecma/String/15.5.4.11-3.js: Ditto.
22615         * tests/mozilla/ecma/String/15.5.4.11-5.js: Ditto.
22616         * tests/mozilla/ecma/String/15.5.4.11-6.js: Ditto.
22617         * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
22618         * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
22619         * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
22620         * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
22621         * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
22622
22623         * JavaScriptCore.pbproj/project.pbxproj: Link to libicu.
22624
22625         * kjs/number_object.lut.h: Regenerated.
22626
22627 2004-08-09  Darin Adler  <darin@apple.com>
22628
22629         Reviewed by Maciej.
22630
22631         - fixed <rdar://problem/3753467> REGRESSION (137-138): reproducible buffer overrun in UString manipulation code
22632
22633         * kjs/ustring.cpp: (KJS::UString::append): Fix incorrect size computation. Without it
22634         we get a buffer overflow.
22635
22636 === Safari-155 ===
22637
22638 2004-08-05  Richard Williamson   <rjw@apple.com>
22639
22640         Fixed part of 3674747.  The QT guys need this for feature freeze.
22641
22642         This patch implements support for the
22643
22644         - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
22645
22646         method of objects bound to JavaScript.
22647
22648         Reviewed by John.
22649
22650         * ChangeLog:
22651         * bindings/objc/objc_class.mm:
22652         (ObjcClass::methodsNamed):
22653         (ObjcClass::fieldNamed):
22654         * bindings/objc/objc_instance.mm:
22655         (ObjcInstance::invokeMethod):
22656         * bindings/objc/objc_runtime.h:
22657         (KJS::Bindings::ObjcMethod::~ObjcMethod):
22658         (KJS::Bindings::ObjcMethod::isFallbackMethod):
22659         (KJS::Bindings::ObjcMethod::javaScriptName):
22660         * bindings/objc/objc_runtime.mm:
22661         (ObjcMethod::ObjcMethod):
22662         (ObjcMethod::getMethodSignature):
22663         (ObjcMethod::setJavaScriptName):
22664         * bindings/testbindings.mm:
22665
22666 2004-08-04  Vicki Murley  <vicki@apple.com>
22667
22668         Reviewed by mjs.
22669  
22670         - fix <rdar://problem/3649789> SAP WebGUI has problems loading first page because of parse error        
22671
22672         * kjs/lexer.cpp:
22673         (Lexer::lex): if the current character is a '\' and the next character is a line terminator,
22674         go to the next line and continue parsing the string (instead of failing).  This matches 
22675         behavior in Mac IE and Mozilla.
22676
22677 2004-08-03  Kevin Decker  <kdecker@apple.com>
22678
22679         Reviewed by Darin.
22680
22681         Rolled in changes from the latest KJS sources that support additional 
22682         Number.prototype functions. 
22683
22684         Specifically this patch covers the follow parts of the ECMA 3 spec:
22685         15.7.4.5, 15.7.4.6, and 15.7.4.7 
22686         
22687         Fixes:
22688         <rdar://problem/3663716> missing Number.toFixed (and toPrecision, toExponential)
22689         <rdar://problem/3749492> missing Number.toPrecision prototype implementation
22690         <rdar://problem/3749591> missing Number.toExponential prototype implementation
22691
22692         * kjs/identifier.h: Added toFixed, toPrecision, and toExponential to the
22693         list of supported identifiers (a macro).
22694         * kjs/number_object.cpp: Implemented support for toFixed(), toPrecision(),
22695         and toExponential(). 
22696         (NumberPrototypeImp::NumberPrototypeImp):
22697         (NumberProtoFuncImp::call):
22698         * kjs/number_object.h: Added property names for toFixed, toPrecision,
22699         and toExponential. 
22700         (KJS::NumberProtoFuncImp::):
22701         * tests/mozilla/expected.html: Update results.
22702
22703 2004-08-03  Darin Adler  <darin@apple.com>
22704
22705         Reviewed by Ken.
22706
22707         - added support for copying RegExp objects so 7 more Mozilla regexp tests pass
22708
22709         * kjs/regexp_object.cpp: (RegExpObjectImp::construct): Check for case where
22710         we are supposed to just copy the regular expression object, and do so.
22711         Also tighten up arguments check to handle case where an actual "undefined"
22712         is passed rather than just omitting an argument.
22713
22714         * tests/mozilla/expected.html: Update results.
22715
22716 2004-08-02  Darin Adler  <darin@apple.com>
22717
22718         * tests/mozilla/.cvsignore: Added.
22719         * tests/mozilla/expected.html: Update results.
22720
22721 2004-08-02  Darin Adler  <darin@apple.com>
22722
22723         Reviewed by Ken.
22724
22725         - fixed RegExp.toString so 3 more Mozilla regexp tests pass
22726
22727         * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call):
22728         Append the flags here so more tests paseed.
22729
22730 2004-08-02  Darin Adler  <darin@apple.com>
22731
22732         Reviewed by Ken.
22733
22734         - fixed a couple things making 5 Mozilla regexp tests pass
22735
22736         * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Implement toString
22737         for the prototype.
22738         (RegExpObjectImp::construct): Fix bug where the string "undefined" would
22739         be used as the flags string when no parameter was passed.
22740
22741         * kjs/regexp_object.h: (KJS::RegExpPrototypeImp::classInfo):
22742         Added a class info object for RegExp prototype so it can return
22743         a string instead of raising an exception when converting to a string.
22744
22745         * tests/mozilla/expected.html: Update results.
22746
22747 2004-08-02  Darin Adler  <darin@apple.com>
22748
22749         Reviewed by Kevin.
22750
22751         - fix crashes in mozilla tests due to mishandling NaN
22752
22753         * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Rerranged range checks after
22754         calls to toInteger so that NaN will get turned into something that fits in an integer.
22755         These were the ones John already fixed, but his fix used isnan and the new fix is
22756         more efficient.
22757
22758         * kjs/number_object.cpp: (NumberProtoFuncImp::call): Rearranged radix range checks
22759         after a call to toInteger to handle NaN properly. Also removed separate check
22760         for undefined that's not needed.
22761
22762         * kjs/string_object.cpp: (StringProtoFuncImp::call): More of the same kinds of changes
22763         as in the above two files, but for a lot more functions. Also changed one place with
22764         an explicit check for undefined to instead just check isNaN.
22765
22766         * tests/mozilla/run-mozilla-tests: Changed to invoke jst using $SYMROOTS for people
22767         like me who don't keep $SYMROOTS in their $PATH.
22768
22769 === Safari-154 ===
22770
22771 === Safari-153 ===
22772
22773 2004-07-26  Kevin Decker  <kdecker@apple.com>
22774
22775         Changes done by Darin, reviewed by Kevin.
22776
22777         - changed testkjs to build in Xcode rather than from Makefile
22778
22779         * .cvsignore: Removed obsolete files from this list.
22780         * Makefile.am: Removed code to build testkjs; we do this in Xcode now.
22781         Changed to build target "All" rather than default target. This makes us
22782         build the testkjs test tool.
22783         * dummy.cpp: Removed.
22784         * kjs/.cvsignore: Removed obsolete files from this list, including
22785         the testkjs tool, which is now built in the symroots directory.
22786         * kjs/testkjs.cpp: Added copyright notice that was missing, since we have
22787         changed this file. Also this has the nice side effect of causing the tool
22788         to be rebuilt in the new location even if there are no other changes in
22789         your tree when you check this out.
22790         * tests/mozilla/run-mozilla-tests: Invoke perl explicitly so this works
22791         without setting the execute bit on jsDriver.pl.
22792
22793 2004-07-22  Kevin Decker  <kdecker@apple.com>
22794
22795         Reviewed by Darin
22796         
22797         Fixed <rdar://problem/3682340> (error console does not include source urls or line numbers of event exceptions). 
22798
22799         * kjs/function_object.cpp:
22800         (FunctionObjectImp::construct):
22801         * kjs/function_object.h:
22802         * kjs/object.cpp:
22803         (KJS::ObjectImp::construct):
22804         * kjs/object.h:
22805         (KJS::Object::construct):
22806
22807 2004-07-21  Darin Adler  <darin@apple.com>
22808
22809         * bindings/npruntime.h: Fixed typo.
22810
22811 2004-07-19  John Sullivan  <sullivan@apple.com>
22812
22813         Reviewed by Maciej.
22814         
22815         - bulletproofed array.slice() against NAN arguments. Harri noticed this
22816         vulnerability in my patch for 3714644
22817
22818         * kjs/array_object.cpp:
22819         (ArrayProtoFuncImp::call):
22820         handle NAN parameters passed to slice() by clamping to 0 and length.
22821
22822 2004-07-19  Richard Williamson   <rjw@apple.com>
22823
22824         Fixed 3733349.  Prevent Java applet callbacks into JavaScript after applet
22825         has been destroyed.
22826
22827         Reviewed by John.
22828
22829         * bindings/jni/jni_jsobject.cpp:
22830         (JSObject::invoke):
22831         (JSObject::JSObject):
22832
22833 2004-07-16  John Sullivan  <sullivan@apple.com>
22834
22835         Reviewed by Maciej.
22836         
22837         - fixed <rdar://problem/3714644> REGRESSION (125.8-146): bugzilla submit link 
22838         hangs browser with javascript
22839
22840         * kjs/array_object.cpp:
22841         (ArrayProtoFuncImp::call):
22842         Check for undefined type for args[0] the same way we were already checking
22843         for args[1]. In this case, args was zero-length, but we were treating
22844         args[0] like an integer anyway. Resulted in some code looping from a NAN
22845         value to 4, taking approximately forever.
22846
22847         * JavaScriptCore.pbproj/project.pbxproj:
22848         version wars
22849         
22850 === Safari-152 ===
22851
22852 2004-07-14  Maciej Stachowiak  <mjs@apple.com>
22853
22854         Reviewed by John.
22855
22856         <rdar://problem/3711474>: (REGRESSION (125-146): JavaScript 'toString(16)' is broken)
22857         <rdar://problem/3644873>: (REGRESSION (125-140u): secondary list doesn't fill in at Southwest.com)
22858
22859         * kjs/number_object.cpp:
22860         (NumberProtoFuncImp::call): Initialize radix from dradix, not from itself!
22861
22862 2004-07-13  Kevin Decker  <kdecker@apple.com>
22863
22864         Reviewed by kocienda.
22865
22866         - made testkjs and JavaScriptCore a subtarget of 'All'
22867         - testkjs now builds in $SYMROOTS
22868
22869         * JavaScriptCore.pbproj/project.pbxproj:
22870
22871 === Safari-151 ===
22872
22873 2004-06-24  Chris Blumenberg  <cblu@apple.com>
22874
22875         Ignore .mode1 files in JavaScriptCore.pbproj
22876
22877         Reviewed by kocienda.
22878
22879         * JavaScriptCore.pbproj/.cvsignore:
22880
22881 2004-06-23  Richard Williamson   <rjw@apple.com>
22882
22883         Implemented changes for latest npruntime.h.
22884         
22885         Reviewed by Chris.
22886
22887         * JavaScriptCore.pbproj/project.pbxproj:
22888         * bindings/NP_jsobject.cpp:
22889         (listFromVariantArgs):
22890         (identiferFromNPIdentifier):
22891         (_NPN_CreateScriptObject):
22892         (NPN_Call):
22893         (NPN_Evaluate):
22894         (NPN_GetProperty):
22895         (NPN_SetProperty):
22896         (NPN_RemoveProperty):
22897         * bindings/NP_jsobject.h:
22898         * bindings/c/c_class.cpp:
22899         (CClass::methodsNamed):
22900         (CClass::fieldNamed):
22901         * bindings/c/c_instance.cpp:
22902         (CInstance::invokeMethod):
22903         * bindings/c/c_utility.cpp:
22904         (convertNPVariantToValue):
22905         * bindings/c/c_utility.h:
22906         * bindings/npruntime.cpp:
22907         (stringIdentifierEqual):
22908         (stringIdentifierHash):
22909         (getStringIdentifierDictionary):
22910         (intIdentifierEqual):
22911         (intIdentifierHash):
22912         (getIntIdentifierDictionary):
22913         (NPN_GetStringIdentifier):
22914         (NPN_GetStringIdentifiers):
22915         (NPN_GetIntIdentifier):
22916         (NPN_IdentifierIsString):
22917         (NPN_UTF8FromIdentifier):
22918         (NPN_VariantToInt32):
22919         (NPN_VariantToDouble):
22920         (NPN_SetException):
22921         * bindings/npruntime.h:
22922         * bindings/objc/WebScriptObject.mm:
22923         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
22924         * bindings/runtime_object.cpp:
22925         (RuntimeObjectImp::~RuntimeObjectImp):
22926         * bindings/runtime_root.cpp:
22927         (KJS::Bindings::rootForInterpreter):
22928         * bindings/testbindings.cpp:
22929         (initializeIdentifiers):
22930         (logMessage):
22931         (setDoubleValue):
22932         (setIntValue):
22933         (setBooleanValue):
22934
22935 === JavaScriptCore-146.1 ===
22936
22937 2004-06-16  Richard Williamson   <rjw@apple.com>
22938
22939         Fixed <rdar://problem/3702287> Crash returning nil from bound ObjC
22940
22941         This turned out to be a show stopper for Dashboard.  Accessing a nil
22942         ObjC property from JS caused a crash.  Similar to the problem
22943         3696112 fixed below.
22944         
22945         Reviewed by Trey.
22946
22947         * bindings/objc/objc_runtime.mm:
22948         (KJS::Bindings::ObjcField::valueFromInstance):
22949
22950 === Safari-146 ===
22951
22952 2004-06-16  Richard Williamson   <rjw@apple.com>
22953
22954         Fixed <rdar://problem/3696112>: nil from an Objective-C class seems to get wrapped as a JavaScript proxy that will not print.
22955
22956         This turned out to be a show stopper for Dashboard.  We now
22957         return Undefined() when nil is returned from a ObjC method
22958         that returns an object type.
22959         
22960         Reviewed by Maciej.
22961
22962         * bindings/objc/objc_utility.mm:
22963         (KJS::Bindings::convertObjcValueToValue):
22964
22965 === Safari-145 ===
22966
22967 2004-06-15  Richard Williamson   <rjw@apple.com>
22968
22969         Fixed <rdar://problem/3695875>: Objective-C instances that are exported to JavaScript are too promiscuous
22970
22971         No longer need to check respondsToSelector: for
22972         isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript:
22973         because these now have a default implementation on NSObject.
22974
22975         Reviewed by Trey.
22976
22977         * bindings/objc/objc_class.mm:
22978         (ObjcClass::methodsNamed):
22979         (ObjcClass::fieldNamed):
22980
22981 2004-06-14  Darin Adler  <darin@apple.com>
22982
22983         Reviewed by Maciej.
22984
22985         - fixed some things for GC that Patrick missed, or that happened after the branch
22986
22987         * bindings/objc/WebScriptObject.mm:
22988         (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
22989         (-[WebScriptObject finalize]): Added.
22990
22991         - added some missing nil checks
22992
22993         * bindings/objc/objc_instance.mm:
22994         (ObjcInstance::ObjcInstance): Check for nil.
22995         (ObjcInstance::~ObjcInstance): Check for nil.
22996         (ObjcInstance::operator=): Check for nil.
22997
22998 2004-06-14  Darin Adler  <darin@apple.com>
22999
23000         Reviewed by me, code changes by Patrick Beard.
23001
23002         - fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
23003
23004         * bindings/objc/objc_instance.mm:
23005         (ObjcInstance::ObjcInstance): Use CFRetain instead of retain.
23006         (ObjcInstance::~ObjcInstance): Use CFRelease instead of release.
23007         (ObjcInstance::operator=): More of the same.
23008         (ObjcInstance::end): Use [pool drain] if compiling on Tiger.
23009
23010         * bindings/objc/objc_runtime.mm:
23011         (ObjcArray::ObjcArray): Use CFRetain instead of retain.
23012         (ObjcArray::~ObjcArray): Use CFRelease instead of release.
23013         (ObjcArray::operator=): More of the same.
23014
23015         * bindings/testbindings.mm: Fixed incorrect license.
23016         (main): Use [pool drain] if compiling on Tiger.
23017
23018 === Safari-144 ===
23019
23020 2004-06-10  Kevin Decker  <kdecker@apple.com>
23021
23022         Reviewed by John.
23023
23024         * kjs/lexer.cpp: 
23025         (Lexer::setCode):
23026             - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
23027         * kjs/lexer.h:
23028         (KJS::Lexer::lineNo):
23029             - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
23030
23031 === JavaScriptCore-143.2 ===
23032
23033 2004-06-07  Darin Adler  <darin@apple.com>
23034
23035         - fixed <rdar://problem/3682489>: (JavaScriptGlue no longer compiles because Interpreter::evaluate parameters changed)
23036
23037         * kjs/interpreter.h: Added an overload to make JavaScriptGlue compile.
23038         * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): Implemented the overload.
23039
23040 === JavaScriptCore-143.1 ===
23041
23042 2004-06-04  Kevin Decker  <kdecker@apple.com>
23043
23044         Reviewed by Darin
23045         
23046         - fixed <rdar://problem/3680594>
23047
23048         * kjs/object.cpp:
23049         (KJS::Error::create):
23050
23051 === Safari-143 ===
23052
23053 2004-06-04  Darin Adler  <darin@apple.com>
23054
23055         * kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters.
23056
23057 2004-06-04  Kevin Decker  <kdecker@apple.com>
23058
23059         Reviewed by Dave.
23060
23061         - ObjC bindings do not (yet) pass along sourceurl or line numbers
23062         - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
23063         - changed the wording of an error message
23064         - the lexer, parser, and interpreter have been made "sourceURL aware"
23065         - stored the url into Error
23066          
23067         * bindings/NP_jsobject.cpp:
23068         (NPN_Evaluate):
23069         * bindings/jni/jni_jsobject.cpp:
23070         (JSObject::eval):
23071         * bindings/objc/WebScriptObject.mm:
23072         (-[WebScriptObject evaluateWebScript:]):
23073         * kjs/function.cpp:
23074         (GlobalFuncImp::call):
23075         * kjs/function_object.cpp:
23076         (FunctionObjectImp::construct):
23077         * kjs/internal.cpp:
23078         (Parser::parse):
23079         (InterpreterImp::checkSyntax):
23080         (InterpreterImp::evaluate):
23081         * kjs/internal.h:
23082         * kjs/interpreter.cpp:
23083         (Interpreter::evaluate):
23084         * kjs/interpreter.h:
23085         * kjs/lexer.cpp:
23086         (Lexer::setCode):
23087         * kjs/lexer.h:
23088         (KJS::Lexer::sourceURL):
23089         * kjs/nodes.cpp:
23090         (Node::Node):
23091         (Node::throwError):
23092         (FunctionCallNode::evaluate):
23093         * kjs/nodes.h:
23094         * kjs/object.cpp:
23095         (KJS::Error::create):
23096         * kjs/object.h:
23097
23098 2004-06-04  Richard Williamson   <rjw@apple.com>
23099
23100         Fixed crash when attempting to access properties on nil
23101         object.
23102         
23103         Reviewed by John.
23104
23105         * bindings/objc/objc_instance.mm:
23106         (ObjcInstance::getClass):
23107         * bindings/runtime_object.cpp:
23108         (RuntimeObjectImp::get):
23109         * bindings/testM.js:
23110         * bindings/testbindings.mm:
23111         (-[MyFirstInterface getString]):
23112
23113 2004-05-27  Kevin Decker  <kdecker@apple.com>
23114
23115         Reviewed by Ken.
23116
23117         -revised generated error message content
23118         
23119         * kjs/error_object.cpp:
23120         (ErrorProtoFuncImp::call):
23121         * kjs/internal.cpp:
23122         (Parser::parse):
23123         * kjs/object.cpp:
23124         (KJS::Error::create):
23125
23126 === Safari-142 ===
23127
23128 2004-05-27  Richard Williamson   <rjw@apple.com>
23129
23130         Renamed WebScriptMethods to WebScripting based on feedback from Nancy.
23131
23132         Reviewed by Chris.
23133
23134         * bindings/objc/WebScriptObject.h:
23135
23136 2004-05-27  Darin Adler  <darin@apple.com>
23137
23138         Reviewed by Maciej.
23139
23140         - moved to new symlink technique for embedding frameworks
23141
23142         * JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step
23143         because we don't need it any more.
23144
23145 2004-05-24  Richard Williamson   <rjw@apple.com>
23146
23147         Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
23148         fixed ClassInfo to correctly reflect inheritance.  This is required
23149         because of the runtime checks in JSC for arrays, i.e. in
23150         the Function objects apply method.
23151
23152         Reviewed by Ken.
23153
23154         * bindings/jni/jni_runtime.cpp:
23155         (JavaArray::convertJObjectToArray):
23156         * bindings/objc/objc_utility.mm:
23157         (KJS::Bindings::convertObjcValueToValue):
23158         * bindings/runtime_array.cpp:
23159         (RuntimeArrayImp::RuntimeArrayImp):
23160         * bindings/runtime_array.h:
23161         * bindings/testM.js: Added.
23162         * bindings/testbindings.mm:
23163         (+[MyFirstInterface webScriptNameForSelector:]):
23164         (-[MyFirstInterface logMessages:]):
23165         (-[MyFirstInterface logMessage:prefix:]):
23166         (-[MyFirstInterface callJSObject::]):
23167
23168 2004-05-22  Darin Adler  <darin@apple.com>
23169
23170         Reviewed by Maciej.
23171
23172         - fixed <rdar://problem/3664260>: (JS needs to listen to timezone change notifications)
23173
23174         * kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use <notify.h>
23175         with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since
23176         CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as
23177         it hasn't been set explicitly.
23178
23179 === Safari-141 ===
23180
23181 2004-05-20  Richard Williamson   <rjw@apple.com>
23182
23183         Implemented WebScriptObject/DOM wrapper voodoo.  DOM wrappers
23184         can now be referenced like any other WebScriptObject, meaning
23185         you can do JS operations on them.
23186
23187         All added implementation of finalizeForWebScript.
23188
23189         Reviewed by Ken.
23190
23191         * bindings/objc/WebScriptObject.h:
23192         * bindings/objc/WebScriptObject.mm:
23193         (-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]):
23194         (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
23195         (-[WebScriptObject KJS::]):
23196         (-[WebScriptObject dealloc]):
23197         (-[WebScriptObject callWebScriptMethod:withArguments:]):
23198         (-[WebScriptObject evaluateWebScript:]):
23199         (-[WebScriptObject setValue:forKey:]):
23200         (-[WebScriptObject valueForKey:]):
23201         (-[WebScriptObject stringRepresentation]):
23202         * bindings/objc/WebScriptObjectPrivate.h:
23203         * bindings/objc/objc_instance.mm:
23204         (ObjcInstance::~ObjcInstance):
23205
23206 2004-05-19  Richard Williamson   <rjw@apple.com>
23207
23208         Removed extraneous tabs that were added (by XCode?).
23209
23210         * bindings/objc/WebScriptObject.h:
23211
23212 2004-05-19  Darin Adler  <darin@apple.com>
23213
23214         - fixed headers with licenses mangled by Xcode auto-indenting
23215
23216         * bindings/jni/jni_jsobject.cpp:
23217         * bindings/jni/jni_jsobject.h:
23218         * bindings/runtime_array.h:
23219         * bindings/runtime_root.cpp:
23220         * bindings/runtime_root.h:
23221
23222 2004-05-18  Richard Williamson   <rjw@apple.com>
23223
23224         Added exception logging.  Also check for exception and
23225         set results as appropriate.
23226
23227         Reviewed by Maciej (partially reviewed).
23228
23229         * bindings/objc/WebScriptObject.mm:
23230         (-[WebScriptObject callWebScriptMethod:withArguments:]):
23231         (-[WebScriptObject evaluateWebScript:]):
23232         (-[WebScriptObject setValue:forKey:]):
23233         (-[WebScriptObject valueForKey:]):
23234
23235 2004-05-18  Richard Williamson   <rjw@apple.com>
23236
23237         Finsished implementing support for windowScriptObject.
23238         Had to make WebScriptObjectPrivate.h accessible from
23239         WebCore.
23240
23241         Reviewed by Maciej.
23242
23243         * JavaScriptCore.pbproj/project.pbxproj:
23244         * bindings/objc/WebScriptObjectPrivate.h:
23245
23246 2004-05-18  Richard Williamson   <rjw@apple.com>
23247
23248         Use KVC to set/get values instead of directly accessing
23249         ivars.
23250
23251         Reviewed by Maciej.
23252
23253         * bindings/objc/WebScriptObject.mm:
23254         (-[WebScriptObject callWebScriptMethod:withArguments:]):
23255         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
23256         * bindings/objc/objc_runtime.mm:
23257         (ObjcField::valueFromInstance):
23258         (convertValueToObjcObject):
23259         (ObjcField::setValueToInstance):
23260
23261 2004-05-17  Richard Williamson   <rjw@apple.com>
23262
23263         Implemented new API for WebScriptObject.
23264
23265         Fixed <rdar://problem/3657145>: (objc to javascript method calls do not cause updates.)
23266         Fixed <rdar://problem/3654887>: (Update to JSC to refer to new JSObject LiveConnect object)  (w/ help from Vicki)
23267
23268         Reviewed by Hyatt.
23269
23270         * JavaScriptCore.pbproj/project.pbxproj:
23271         * bindings/c/c_instance.cpp:
23272         (CInstance::invokeMethod):
23273         * bindings/jni/jni_instance.cpp:
23274         (JavaInstance::invokeMethod):
23275         * bindings/jni/jni_jsobject.cpp:
23276         (JSObject::convertValueToJObject):
23277         * bindings/jni/jni_utility.cpp:
23278         (KJS::Bindings::getJNIField):
23279         * bindings/objc/WebScriptObject.mm:
23280         (_didExecute):
23281         (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
23282         (-[WebScriptObject KJS::]):
23283         (-[WebScriptObject dealloc]):
23284         (+[WebScriptObject throwException:]):
23285         (listFromNSArray):
23286         (-[WebScriptObject callWebScriptMethod:withArguments:]):
23287         (-[WebScriptObject evaluateWebScript:]):
23288         (-[WebScriptObject setValue:forKey:]):
23289         (-[WebScriptObject valueForKey:]):
23290         (-[WebScriptObject stringRepresentation]):
23291         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
23292         (+[WebUndefined undefined]):
23293         (-[WebUndefined initWithCoder:]):
23294         (-[WebUndefined encodeWithCoder:]):
23295         (-[WebUndefined copyWithZone:]):
23296         (-[WebUndefined retain]):
23297         (-[WebUndefined release]):
23298         (-[WebUndefined retainCount]):
23299         (-[WebUndefined autorelease]):
23300         (-[WebUndefined dealloc]):
23301         (-[WebUndefined copy]):
23302         (-[WebUndefined replacementObjectForPortCoder:]):
23303         * bindings/objc/WebScriptObjectPrivate.h: Added.
23304         * bindings/objc/objc_class.mm:
23305         (ObjcClass::methodsNamed):
23306         (ObjcClass::fieldNamed):
23307         * bindings/objc/objc_instance.mm:
23308         (ObjcInstance::invokeMethod):
23309         * bindings/objc/objc_jsobject.h:
23310         * bindings/objc/objc_jsobject.mm:
23311         * bindings/objc/objc_runtime.mm:
23312         (ObjcField::valueFromInstance):
23313         * bindings/objc/objc_utility.mm:
23314         (KJS::Bindings::JSMethodNameToObjCMethodName):
23315         (KJS::Bindings::convertValueToObjcValue):
23316         (KJS::Bindings::convertObjcValueToValue):
23317         * bindings/runtime.cpp:
23318         (Instance::setDidExecuteFunction):
23319         (Instance::didExecuteFunction):
23320         (Instance::setValueOfField):
23321         * bindings/runtime.h:
23322         * bindings/testbindings.mm:
23323         (+[MyFirstInterface webScriptNameForSelector:]):
23324         (-[MyFirstInterface callJSObject::]):
23325
23326 2004-05-14  Vicki Murley  <vicki@apple.com>
23327
23328         Reviewed by mjs.
23329  
23330         <rdar://problem/3642427>: framework marketing number should be 2.0 for DoubleBarrel release
23331
23332         * JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0
23333
23334 === Safari-140 ===
23335
23336 2004-05-13  Richard Williamson   <rjw@apple.com>
23337
23338         Fixed indentation.
23339
23340         Reviewed by Chris.
23341
23342         * ChangeLog:
23343         * bindings/objc/WebScriptObject.h:
23344
23345 2004-05-13  Richard Williamson   <rjw@apple.com>
23346
23347         Approved API changes.  Currently unimplemented.
23348
23349         Reviewed by Chris.
23350
23351         * ChangeLog:
23352         * JavaScriptCore.pbproj/project.pbxproj:
23353         * bindings/objc/WebScriptObject.h: Added.
23354         * bindings/objc/WebScriptObject.mm: Added.
23355         (+[WebScriptObject throwException:]):
23356         (-[WebScriptObject callWebScriptMethod:withArguments:]):
23357         (-[WebScriptObject evaluateWebScript:]):
23358         (-[WebScriptObject stringRepresentation]):
23359         (+[WebUndefined undefined]):
23360         (-[WebUndefined initWithCoder:]):
23361         (-[WebUndefined encodeWithCoder:]):
23362         (-[WebUndefined copyWithZone:]):
23363
23364 2004-05-07  Vicki Murley  <vicki@apple.com>
23365
23366         Reviewed by darin.
23367
23368         Turn off GC since it uses ppc only instructions (which breaks 
23369         the B&I build).   
23370     
23371         * kjs/value.h: set USE_CONSERVATIVE_GC to 0
23372
23373 === Safari-139 ===
23374
23375 2004-05-07  Maciej Stachowiak  <mjs@apple.com>
23376
23377         Reviewed by Darin.
23378
23379         - add -funroll-loops=16 compiler option for approx .5% speedup on
23380         HTML iBench and .5-1% speedup on JS iBench.
23381         
23382         * JavaScriptCore.pbproj/project.pbxproj:
23383
23384 2004-04-25  Maciej Stachowiak  <mjs@apple.com>
23385
23386         Reviewed by Darin.
23387
23388         Enable full conservative GC mode in addition to test mode. When
23389         conservative GC is enabled, we now get an 11% speed improvement on
23390         the iBench. Also fix some spots I missed before.
23391
23392         Specific noteworth changes:
23393         
23394         * kjs/collector.cpp:
23395         (KJS::Collector::markStackObjectsConservatively): Check possible
23396         cell pointers for 8-byte aligment and verify they are not 0.
23397
23398         * kjs/protected_values.cpp:
23399         (KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here...
23400         (KJS::ProtectedValues::decreaseProtectCount): ...and here...
23401         * kjs/protect.h:
23402         (KJS::gcProtectNullTolerant): ...to here...
23403         (KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null
23404         tolerance, and doing the check is expensive.
23405
23406         * kjs/protected_values.cpp:
23407         (KJS::ProtectedValues::computeHash): Replace hash function with a much faster one
23408         that is still very good.
23409
23410         * kjs/protect.h:
23411         (KJS::gcProtect):
23412         (KJS::gcUnprotect):
23413         (KJS::ProtectedValue::ProtectedValue):
23414         (KJS::ProtectedValue::~ProtectedValue):
23415         (KJS::ProtectedValue::operator=):
23416         (KJS::ProtectedObject::ProtectedObject):
23417         (KJS::ProtectedObject::~ProtectedObject):
23418         (KJS::ProtectedObject::operator=):
23419         (KJS::ProtectedReference::ProtectedReference):
23420         (KJS::ProtectedReference::~ProtectedReference):
23421         (KJS::ProtectedReference::operator=):
23422         * kjs/protected_values.cpp:
23423         (KJS::ProtectedValues::getProtectCount):
23424         (KJS::ProtectedValues::increaseProtectCount):
23425         (KJS::ProtectedValues::decreaseProtectCount):
23426         (KJS::ProtectedValues::computeHash):
23427         * bindings/runtime_root.cpp:
23428         (KJS::Bindings::addNativeReference):
23429         (KJS::Bindings::removeNativeReference):
23430         (RootObject::removeAllNativeReferences):
23431         * bindings/runtime_root.h:
23432         (KJS::Bindings::RootObject::~RootObject):
23433         (KJS::Bindings::RootObject::setRootObjectImp):
23434         * kjs/collector.cpp:
23435         (KJS::Collector::allocate):
23436         (KJS::Collector::collect):
23437         * kjs/collector.h:
23438         * kjs/internal.cpp:
23439         (NumberImp::create):
23440         (InterpreterImp::globalInit):
23441         (InterpreterImp::globalClear):
23442         (InterpreterImp::mark):
23443         * kjs/list.cpp:
23444         (KJS::List::derefValues):
23445         (KJS::List::refValues):
23446         (KJS::List::append):
23447         * kjs/object.cpp:
23448         (KJS::ObjectImp::setInternalValue):
23449         (KJS::ObjectImp::putDirect):
23450         * kjs/value.cpp:
23451         (ValueImp::mark):
23452         (ValueImp::marked):
23453         * kjs/value.h:
23454         (KJS::ValueImp::ValueImp):
23455         (KJS::ValueImp::~ValueImp):
23456         (KJS::ValueImp::):
23457         (KJS::Value::Value):
23458         (KJS::Value::~Value):
23459         (KJS::Value::operator=):
23460
23461 2004-04-30  Richard Williamson   <rjw@apple.com>
23462
23463         Asking an NSInvocation for it's return value when return type
23464         is void throws an exception.  Added check for void return types
23465         to avoid this exception.
23466
23467         Reviewed by Ken.
23468
23469         * bindings/objc/objc_instance.mm:
23470         (ObjcInstance::invokeMethod):
23471
23472 2004-04-29  Richard Williamson   <rjw@apple.com>
23473
23474         Fixed several bad problems with the ObjC bindings.  In particular, conversion
23475         to/from JavaScriptObject (soon to be WebScriptObject) was completely broken.
23476
23477         Reviewed by Chris.
23478
23479         * bindings/objc/objc_jsobject.h:
23480         * bindings/objc/objc_jsobject.mm:
23481         (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
23482         (-[JavaScriptObject KJS::]):
23483         (+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
23484         (-[JavaScriptObject call:arguments:]):
23485         (-[JavaScriptObject evaluate:]):
23486         (-[JavaScriptObject getMember:]):
23487         (-[JavaScriptObject getSlot:]):
23488         * bindings/objc/objc_runtime.mm:
23489         (ObjcField::valueFromInstance):
23490         (ObjcField::setValueToInstance):
23491         * bindings/objc/objc_utility.mm:
23492         (KJS::Bindings::convertValueToObjcValue):
23493         (KJS::Bindings::convertObjcValueToValue):
23494         * bindings/runtime.h:
23495         * bindings/runtime_root.cpp:
23496         (KJS::Bindings::rootForInterpreter):
23497         (KJS::Bindings::addNativeReference):
23498         (KJS::Bindings::removeNativeReference):
23499         * bindings/runtime_root.h:
23500         * bindings/testbindings.mm:
23501         (-[MyFirstInterface logMessage:]):
23502         (-[MyFirstInterface setJSObject:]):
23503         (-[MyFirstInterface callJSObject::]):
23504
23505 2004-04-24  Darin Adler  <darin@apple.com>
23506
23507         Reviewed by Dave.
23508
23509         * kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer
23510         that is 2x too big.
23511
23512 2004-04-23  Maciej Stachowiak  <mjs@apple.com>
23513
23514         Reviewed by Darin.
23515
23516         Implementation of conservative GC, based partly on code from
23517         Darin. It's turned off for now, so it shouldn't have any effect on
23518         the normal build.
23519         
23520         * JavaScriptCore.pbproj/project.pbxproj:
23521         * kjs/collector.cpp:
23522         (KJS::Collector::markStackObjectsConservatively):
23523         (KJS::Collector::markProtectedObjects):
23524         (KJS::Collector::collect):
23525         * kjs/collector.h:
23526         * kjs/protect.h:
23527         (KJS::gcProtect):
23528         (KJS::gcUnprotect):
23529         * kjs/protected_values.cpp: Added.
23530         (KJS::ProtectedValues::getProtectCount):
23531         (KJS::ProtectedValues::increaseProtectCount):
23532         (KJS::ProtectedValues::insert):
23533         (KJS::ProtectedValues::decreaseProtectCount):
23534         (KJS::ProtectedValues::expand):
23535         (KJS::ProtectedValues::shrink):
23536         (KJS::ProtectedValues::rehash):
23537         (KJS::ProtectedValues::computeHash):
23538         * kjs/protected_values.h: Added.
23539         * kjs/value.cpp:
23540         (ValueImp::useConservativeMark):
23541         (ValueImp::mark):
23542         (ValueImp::marked):
23543         * kjs/value.h:
23544         (KJS::ValueImp::):
23545
23546 === Safari-138 ===
23547
23548 2004-04-22  Richard Williamson   <rjw@apple.com>
23549
23550         Fixed build snafu (re-declaration of NPBool in npruntime.h and
23551         npapi.h).
23552
23553         * bindings/npruntime.h:
23554
23555 2004-04-22  Richard Williamson   <rjw@apple.com>
23556
23557         Updated plugin binding API to reflect latest revision from
23558         working group.
23559         
23560         Biggest change is the introduction of NPVariant used to represent
23561         value types.  NPVariant replaces the use of NPObject for the
23562         exchange of values between scripting environment and native code.
23563
23564         Reviewed by John.
23565
23566         * JavaScriptCore.pbproj/project.pbxproj:
23567         * bindings/NP_jsobject.cpp:
23568         (identiferFromNPIdentifier):
23569         (NPN_Call):
23570         (NPN_Evaluate):
23571         (NPN_GetProperty):
23572         (NPN_SetProperty):
23573         (NPN_ToString):
23574         (NPN_GetPropertyAtIndex):
23575         (NPN_SetPropertyAtIndex):
23576         * bindings/c/c_class.cpp:
23577         (CClass::methodsNamed):
23578         (CClass::fieldNamed):
23579         * bindings/c/c_instance.cpp:
23580         (CInstance::invokeMethod):
23581         (CInstance::defaultValue):
23582         * bindings/c/c_runtime.cpp:
23583         (CField::valueFromInstance):
23584         (CField::setValueToInstance):
23585         * bindings/c/c_utility.cpp:
23586         (convertNPStringToUTF16):
23587         (convertUTF8ToUTF16):
23588         (coerceValueToNPVariantStringType):
23589         (convertValueToNPVariant):
23590         (convertNPVariantToValue):
23591         * bindings/c/c_utility.h:
23592         * bindings/npruntime.cpp:
23593         (NPN_GetIdentifier):
23594         (NPN_GetIdentifiers):
23595         (NPN_UTF8FromIdentifier):
23596         (NPN_VariantIsVoid):
23597         (NPN_VariantIsNull):
23598         (NPN_VariantIsUndefined):
23599         (NPN_VariantIsBool):
23600         (NPN_VariantIsInt32):
23601         (NPN_VariantIsDouble):
23602         (NPN_VariantIsString):
23603         (NPN_VariantIsObject):
23604         (NPN_VariantToBool):
23605         (NPN_VariantToString):
23606         (NPN_VariantToInt32):
23607         (NPN_VariantToDouble):
23608         (NPN_VariantToObject):
23609         (NPN_InitializeVariantAsVoid):
23610         (NPN_InitializeVariantAsNull):
23611         (NPN_InitializeVariantAsUndefined):
23612         (NPN_InitializeVariantWithBool):
23613         (NPN_InitializeVariantWithInt32):
23614         (NPN_InitializeVariantWithDouble):
23615         (NPN_InitializeVariantWithString):
23616         (NPN_InitializeVariantWithStringCopy):
23617         (NPN_InitializeVariantWithObject):
23618         (NPN_InitializeVariantWithVariant):
23619         (NPN_ReleaseVariantValue):
23620         (NPN_CreateObject):
23621         (NPN_RetainObject):
23622         (NPN_ReleaseObject):
23623         (NPN_IsKindOfClass):
23624         (NPN_SetExceptionWithUTF8):
23625         (NPN_SetException):
23626         * bindings/npruntime.h:
23627         (_NPString::):
23628         (_NPString::_NPVariant::):
23629         * bindings/testbindings.cpp:
23630         (logMessage):
23631         (setDoubleValue):
23632         (setIntValue):
23633         (setStringValue):
23634         (setBooleanValue):
23635         (getDoubleValue):
23636         (getIntValue):
23637         (getStringValue):
23638         (getBooleanValue):
23639         (myGetProperty):
23640         (mySetProperty):
23641         (myInvoke):
23642         (myAllocate):
23643
23644 2004-04-22  Darin Adler  <darin@apple.com>
23645
23646         Reviewed by Maciej.
23647
23648         - fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
23649
23650         * kjs/ustring.cpp:
23651         (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
23652         Was resulting in a buffer 2x the needed size.
23653         (KJS::UString::expandPreCapacity): Ditto.
23654         (KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
23655
23656 2004-04-21  Maciej Stachowiak  <mjs@apple.com>
23657
23658         Reviewed by Darin.
23659
23660         Preliminary change for conservative GC. Create "protected"
23661         subclasses to GC-protect objects when on heap, since we will soon
23662         remove the built-in refcounting of the normal wrapper classes. Use
23663         them where needed.
23664         
23665         * JavaScriptCore.pbproj/project.pbxproj:
23666         * kjs/context.h:
23667         * kjs/internal.h:
23668         (KJS::InterpreterImp::globalObject):
23669         * kjs/interpreter.h:
23670         * kjs/property_map.cpp:
23671         * kjs/reference.h:
23672         * kjs/reference_list.cpp:
23673
23674 2004-04-19  Maciej Stachowiak  <mjs@apple.com>
23675
23676         Reviewed by Dave.
23677
23678         Optimize prepend using the shared substring optimization. Also,
23679         limit the applicability of shared append and shared prepend. If
23680         you overdo it, it does more harm than good, because you create a
23681         bunch of strings that are disqualified from future shared
23682         append/prepend, for not much immediate savings in allocate/copy
23683         expense.
23684         
23685         * kjs/ustring.cpp:
23686         (KJS::):
23687         (KJS::UString::Rep::create):
23688         (KJS::UString::expandedSize):
23689         (KJS::UString::usedPreCapacity):
23690         (KJS::UString::expandCapacity):
23691         (KJS::UString::expandPreCapacity):
23692         (KJS::UString::UString):
23693         (KJS::UString::append):
23694         (KJS::UString::operator=):
23695         * kjs/ustring.h:
23696         (KJS::UString::Rep::data):
23697
23698 2004-04-16  Maciej Stachowiak  <mjs@apple.com>
23699         Reviewed by Richard.
23700
23701         No more need for Completion or Reference to privately inherit from
23702         Value, none of the superclass functionality is used.
23703
23704         * kjs/completion.h:
23705         * kjs/reference.h:
23706
23707 === Safari-137 ===
23708
23709 2004-04-16  Richard Williamson   <rjw@apple.com>
23710
23711         Added interpreter lock protection around object creation.
23712
23713         Reviewed by Chris.
23714
23715         * bindings/runtime.cpp:
23716         (Instance::createRuntimeObject):
23717
23718 2004-04-16  Maciej Stachowiak  <mjs@apple.com>
23719
23720         Reviewed by Ken.
23721
23722         Another JavaScript speed improvement: use the mechanism from
23723         string append optimization to make taking a substring fast, again
23724         sharing the buffer.
23725
23726         A further 22% improvement on the 24fun string speed test.
23727         
23728         * kjs/ustring.cpp:
23729         (KJS::):
23730         (KJS::UString::Rep::create):
23731         (KJS::UString::UString):
23732         (KJS::UString::append):
23733         (KJS::UString::operator=):
23734         (KJS::UString::substr):
23735         * kjs/ustring.h:
23736         (KJS::UString::Rep::data):
23737
23738 2004-04-13  Maciej Stachowiak  <mjs@apple.com>
23739
23740         Reviewed by Darin.
23741
23742         - fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
23743         - fixed <rdar://problem/3600691>: Table generation test is really slow
23744         - fixed <rdar://problem/3600661>: 24fun date test is really slow
23745
23746         80% speedup on the string test, lesser speedups on the other two.
23747         
23748         Two different optimizations here:
23749
23750         1) Avoid large overhead of scanning strings to see if they are all
23751         ASCII before numeric conversion.
23752         
23753         * kjs/nodes.cpp:
23754         (AssignNode::evaluate): Don't convert to integer until we know for
23755         sure the operation will need it. Attempting to convert strings to
23756         numbers is a waste when they are being appended with +=.
23757
23758         2) Avoid huge cost of appending strings.
23759
23760         This is done by allowing multiple strings to share a buffer but
23761         actually use different ranges of it. The first time a string is
23762         appended to, we start leaving at least 10% extra space in the
23763         buffer, so doing N appends to the same string takes O(log N)
23764         mallocs instead of O(N).
23765         
23766         * kjs/identifier.cpp:
23767         (KJS::Identifier::equal):
23768         (KJS::Identifier::add):
23769         * kjs/ustring.cpp:
23770         (KJS::):
23771         (KJS::UCharReference::operator=):
23772         (KJS::UCharReference::ref):
23773         (KJS::UString::Rep::create):
23774         (KJS::UString::Rep::destroy):
23775         (KJS::UString::expandedSize):
23776         (KJS::UString::usedCapacity):
23777         (KJS::UString::expandCapacity):
23778         (KJS::UString::UString):
23779         (KJS::UString::null):
23780         (KJS::UString::append):
23781         (KJS::UString::operator=):
23782         (KJS::UString::toStrictUInt32):
23783         (KJS::UString::detach):
23784         (KJS::KJS::operator==):
23785         * kjs/ustring.h:
23786         (KJS::UString::Rep::data):
23787         (KJS::UString::Rep::hash):
23788
23789 2004-04-09  Maciej Stachowiak  <mjs@apple.com>
23790
23791         Reviewed by John.
23792
23793         - fix deployment build by avoiding deployment-only warning.
23794
23795         * kjs/scope_chain.cpp:
23796         (KJS::ScopeChain::bottom):
23797
23798 2004-04-09  Maciej Stachowiak  <mjs@apple.com>
23799
23800         Reviewed by John.
23801
23802         Changed things so that newly created objects get a prototype based
23803         on the scope chain of the current function, rather than the
23804         interpreter that started execution. This fixes the following bugs:
23805         
23806         <rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
23807         <rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
23808
23809         * JavaScriptCore.pbproj/project.pbxproj:
23810         * kjs/array_object.cpp:
23811         (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
23812         (ArrayProtoFuncImp::ArrayProtoFuncImp):
23813         (ArrayProtoFuncImp::call):
23814         (ArrayObjectImp::construct):
23815         * kjs/bool_object.cpp:
23816         (BooleanObjectImp::construct):
23817         * kjs/date_object.cpp:
23818         (DateProtoFuncImp::DateProtoFuncImp):
23819         (DateProtoFuncImp::call):
23820         (DateObjectImp::construct):
23821         * kjs/error_object.cpp:
23822         (ErrorObjectImp::construct):
23823         * kjs/function.cpp:
23824         (FunctionImp::FunctionImp):
23825         (FunctionImp::call):
23826         (DeclaredFunctionImp::construct):
23827         (ArgumentsImp::ArgumentsImp):
23828         (GlobalFuncImp::call):
23829         * kjs/function_object.cpp:
23830         (FunctionProtoFuncImp::call):
23831         (FunctionObjectImp::construct):
23832         * kjs/internal.cpp:
23833         (BooleanImp::toObject):
23834         (StringImp::toObject):
23835         (NumberImp::toObject):
23836         (InterpreterImp::InterpreterImp):
23837         (InterpreterImp::clear):
23838         (InterpreterImp::interpreterWithGlobalObject):
23839         * kjs/internal.h:
23840         * kjs/interpreter.cpp:
23841         (ExecState::lexicalInterpreter):
23842         * kjs/interpreter.h:
23843         (KJS::ExecState::dynamicInterpreter):
23844         (KJS::ExecState::interpreter):
23845         * kjs/math_object.cpp:
23846         (MathFuncImp::MathFuncImp):
23847         * kjs/nodes.cpp:
23848         (StatementNode::hitStatement):
23849         (StatementNode::abortStatement):
23850         (RegExpNode::evaluate):
23851         (ElementNode::evaluate):
23852         (ArrayNode::evaluate):
23853         (ObjectLiteralNode::evaluate):
23854         (PropertyValueNode::evaluate):
23855         (FunctionCallNode::evaluate):
23856         (FuncDeclNode::processFuncDecl):
23857         (FuncExprNode::evaluate):
23858         * kjs/number_object.cpp:
23859         (NumberObjectImp::construct):
23860         * kjs/object.cpp:
23861         (KJS::ObjectImp::defaultValue):
23862         (KJS::Error::create):
23863         * kjs/object_object.cpp:
23864         (ObjectObjectImp::construct):
23865         * kjs/reference.cpp:
23866         (Reference::putValue):
23867         * kjs/regexp_object.cpp:
23868         (RegExpProtoFuncImp::call):
23869         (RegExpObjectImp::arrayOfMatches):
23870         (RegExpObjectImp::construct):
23871         * kjs/scope_chain.cpp:
23872         (KJS::ScopeChain::bottom):
23873         * kjs/scope_chain.h:
23874         * kjs/string_object.cpp:
23875         (StringProtoFuncImp::StringProtoFuncImp):
23876         (StringProtoFuncImp::call):
23877         (StringObjectImp::construct):
23878
23879 === Safari-136 ===
23880
23881 === Safari-135 ===
23882
23883 2004-03-31  Richard Williamson   <rjw@apple.com>
23884
23885         Tedious renames based on feedback from plugin-futures list.
23886         NP_ functions are renamed with NPN_ prefix.
23887         Types prefix renamed from NP_ to NP.
23888         NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated. 
23889         
23890         No review because this was just a renaming patch.
23891
23892         * bindings/NP_jsobject.cpp:
23893         (listFromNPArray):
23894         (jsAllocate):
23895         (identiferFromNPIdentifier):
23896         (NPN_Call):
23897         (NPN_Evaluate):
23898         (NPN_GetProperty):
23899         (NPN_SetProperty):
23900         (NPN_RemoveProperty):
23901         (NPN_ToString):
23902         (NPN_GetPropertyAtIndex):
23903         (NPN_SetPropertyAtIndex):
23904         * bindings/NP_jsobject.h:
23905         * bindings/c/c_class.cpp:
23906         (CClass::_commonInit):
23907         (CClass::classForIsA):
23908         (CClass::CClass):
23909         (CClass::methodsNamed):
23910         (CClass::fieldNamed):
23911         * bindings/c/c_class.h:
23912         * bindings/c/c_instance.cpp:
23913         (CInstance::CInstance):
23914         (CInstance::~CInstance):
23915         (CInstance::operator=):
23916         (CInstance::invokeMethod):
23917         (CInstance::defaultValue):
23918         * bindings/c/c_instance.h:
23919         (KJS::Bindings::CInstance::getObject):
23920         * bindings/c/c_runtime.cpp:
23921         (CField::valueFromInstance):
23922         (CField::setValueToInstance):
23923         * bindings/c/c_runtime.h:
23924         (KJS::Bindings::CField::CField):
23925         (KJS::Bindings::CField::name):
23926         (KJS::Bindings::CMethod::CMethod):
23927         (KJS::Bindings::CMethod::name):
23928         * bindings/c/c_utility.cpp:
23929         (coerceValueToNPString):
23930         (convertValueToNPValueType):
23931         (convertNPValueTypeToValue):
23932         * bindings/c/c_utility.h:
23933         * bindings/npruntime.cpp:
23934         (NPN_IdentifierFromUTF8):
23935         (NPN_IsValidIdentifier):
23936         (NPN_GetIdentifiers):
23937         (NPN_UTF8FromIdentifier):
23938         (NPN_CreateObject):
23939         (NPN_RetainObject):
23940         (NPN_ReleaseObject):
23941         (NPN_IsKindOfClass):
23942         (NPN_SetExceptionWithUTF8):
23943         (NPN_SetException):
23944         (numberAllocate):
23945         (NPN_CreateNumberWithInt):
23946         (NPN_CreateNumberWithFloat):
23947         (NPN_CreateNumberWithDouble):
23948         (NPN_IntFromNumber):
23949         (NPN_FloatFromNumber):
23950         (NPN_DoubleFromNumber):
23951         (stringAllocate):
23952         (NPN_CreateStringWithUTF8):
23953         (NPN_CreateStringWithUTF16):
23954         (NPN_DeallocateUTF8):
23955         (NPN_UTF8FromString):
23956         (NPN_UTF16FromString):
23957         (NPN_StringLength):
23958         (booleanAllocate):
23959         (NPN_CreateBoolean):
23960         (NPN_BoolFromBoolean):
23961         (nullAllocate):
23962         (NPN_GetNull):
23963         (undefinedAllocate):
23964         (NPN_GetUndefined):
23965         (arrayAllocate):
23966         (arrayDeallocate):
23967         (NPN_CreateArray):
23968         (NPN_CreateArrayV):
23969         (NPN_ObjectAtIndex):
23970         * bindings/npruntime.h:
23971         * bindings/runtime.cpp:
23972         (Instance::createBindingForLanguageInstance):
23973         * bindings/testbindings.cpp:
23974         (initializeIdentifiers):
23975         (myHasProperty):
23976         (myHasMethod):
23977         (myGetProperty):
23978         (mySetProperty):
23979         (logMessage):
23980         (setDoubleValue):
23981         (setIntValue):
23982         (setStringValue):
23983         (setBooleanValue):
23984         (getDoubleValue):
23985         (getIntValue):
23986         (getStringValue):
23987         (getBooleanValue):
23988         (myInvoke):
23989         (myAllocate):
23990         (myInvalidate):
23991         (myDeallocate):
23992         (main):
23993
23994 2004-03-31  Richard Williamson   <rjw@apple.com>
23995
23996         Changed references to NP_runtime.h to npruntime.h
23997         
23998         * JavaScriptCore.pbproj/project.pbxproj:
23999         * bindings/NP_jsobject.h:
24000         * bindings/c/c_class.h:
24001         * bindings/c/c_instance.h:
24002         * bindings/c/c_runtime.h:
24003         * bindings/c/c_utility.h:
24004         * bindings/npruntime.cpp:
24005
24006 2004-03-31  Richard Williamson   <rjw@apple.com>
24007
24008         Renamed NP_runtime.h to npruntime.h to match Netscape SDK.
24009
24010         * JavaScriptCore.pbproj/project.pbxproj:
24011         * bindings/NP_jsobject.h:
24012         * bindings/npruntime.cpp:
24013
24014 === Safari-134 ===
24015
24016 2004-03-23  Richard Williamson   <rjw@apple.com>
24017
24018         Added implementation of KJS::Value <-> NP_Object conversion functions.
24019         Augmented test program for 'C' bindings.
24020         Added asserts and parameter checking to all public API.        
24021
24022         Reviewed by Ken.
24023
24024         * JavaScriptCore.pbproj/project.pbxproj:
24025         * bindings/NP_jsobject.cpp:
24026         (NP_ToString):
24027         * bindings/NP_jsobject.h: Added.
24028         * bindings/NP_runtime.cpp:
24029         (NP_IdentifierFromUTF8):
24030         (NP_IsValidIdentifier):
24031         (NP_GetIdentifiers):
24032         (NP_CreateObject):
24033         (NP_RetainObject):
24034         (NP_ReleaseObject):
24035         (NP_IsKindOfClass):
24036         (NP_SetExceptionWithUTF8):
24037         (NP_SetException):
24038         (NP_IntFromNumber):
24039         (NP_FloatFromNumber):
24040         (NP_DoubleFromNumber):
24041         (NP_CreateStringWithUTF8):
24042         (NP_CreateStringWithUTF16):
24043         (NP_DeallocateUTF8):
24044         (NP_UTF8FromString):
24045         (NP_UTF16FromString):
24046         (NP_StringLength):
24047         (NP_BoolFromBoolean):
24048         * bindings/NP_runtime.h:
24049         * bindings/c/c_instance.cpp:
24050         (CInstance::invokeMethod):
24051         * bindings/c/c_utility.cpp:
24052         (coerceValueToNPString):
24053         (convertValueToNPValueType):
24054         (convertNPValueTypeToValue):
24055         * bindings/c/c_utility.h:
24056         * bindings/test.js:
24057         * bindings/testC.js: Added.
24058         * bindings/testbindings.cpp:
24059         (logMessage):
24060         (setDoubleValue):
24061         (setIntValue):
24062         (setStringValue):
24063         (setBooleanValue):
24064         (getDoubleValue):
24065         (getIntValue):
24066         (getStringValue):
24067         (getBooleanValue):
24068         (myInterfaceInvoke):
24069         (myInterfaceAllocate):
24070
24071 === Safari-133 ===
24072
24073 2004-03-19  Darin Adler  <darin@apple.com>
24074
24075         Reviewed by Ken.
24076
24077         - fixed problem with methods like setUTCHour
24078
24079         * kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate
24080         GMT vs. local time function based on the utc flag.
24081
24082 2004-03-17  Richard Williamson   <rjw@apple.com>
24083
24084         Added a context parameter to result callbacks use by JavaScriptObject functions.  This was a change requested by Eric Carlson on the QT plugin team.
24085
24086         Reviewed by Ken.
24087
24088         * bindings/NP_jsobject.cpp:
24089         (NP_Call):
24090         (NP_Evaluate):
24091         (NP_GetProperty):
24092         (NP_ToString):
24093         (NP_GetPropertyAtIndex):
24094         * bindings/NP_runtime.h:
24095
24096 2004-03-16  Richard Williamson   <rjw@apple.com>
24097
24098         Fixed 3590169.  Regression (crash) caused by the switch to MethodLists.  Crash when attempting to invoke a method from JavaScript to Java that is not implemented.
24099
24100         Reviewed by John.
24101
24102         * bindings/jni/jni_class.cpp:
24103         (JavaClass::methodsNamed):
24104
24105 2004-03-15  Richard Williamson   <rjw@apple.com>
24106
24107         Fixed 3570854.  Don't attempt to convert Null to strings.  We
24108         were incorrectly converting to "Null".
24109
24110         Actually fixed by Scott Kovatch.
24111
24112         Reviewed by Richard.
24113
24114         * bindings/jni/jni_utility.cpp:
24115         (KJS::Bindings::convertValueToJValue):
24116
24117 === Safari-132 ===
24118
24119 2004-03-11  Richard Williamson   <rjw@apple.com>
24120
24121         Stitched together the NP stuff to our language independent
24122         JavaScript binding stuff.  Very close to being done.
24123         
24124         Added program to test C bindings (and NP stuff).  Just tests
24125         properties.  Will add methods and JavaScript access, etc.
24126
24127         Updated Makefile.am to account for new bindings/c directory.
24128
24129         Change NP_UTF8 from "const char *" to "char" to allow for
24130         declarations like "const NP_UTF8 *" and "NP_UTF8 *".  Ditto
24131         for NP_UTF16.
24132
24133         Added NP_IsValidIdentifier().
24134
24135         Reviewed by Chris.
24136
24137         * JavaScriptCore.pbproj/project.pbxproj:
24138         * Makefile.am:
24139         * bindings/NP_jsobject.cpp:
24140         (identiferFromNPIdentifier):
24141         (NP_Evaluate):
24142         * bindings/NP_runtime.cpp:
24143         (NP_IdentifierFromUTF8):
24144         (NP_IsValidIdentifier):
24145         (NP_GetIdentifiers):
24146         (NP_UTF8FromIdentifier):
24147         (NP_SetExceptionWithUTF8):
24148         (NP_SetException):
24149         (NP_CreateStringWithUTF8):
24150         (NP_CreateStringWithUTF16):
24151         (NP_UTF8FromString):
24152         (NP_UTF16FromString):
24153         * bindings/NP_runtime.h:
24154         * bindings/c/c_class.cpp: Added.
24155         (CClass::_commonDelete):
24156         (CClass::_commonCopy):
24157         (CClass::_commonInit):
24158         (_createClassesByIsAIfNecessary):
24159         (CClass::classForIsA):
24160         (CClass::CClass):
24161         (CClass::name):
24162         (CClass::methodsNamed):
24163         (CClass::fieldNamed):
24164         * bindings/c/c_class.h: Added.
24165         (KJS::Bindings::CClass::~CClass):
24166         (KJS::Bindings::CClass::CClass):
24167         (KJS::Bindings::CClass::operator=):
24168         (KJS::Bindings::CClass::constructorAt):
24169         (KJS::Bindings::CClass::numConstructors):
24170         * bindings/c/c_instance.cpp: Added.
24171         (CInstance::CInstance):
24172         (CInstance::~CInstance):
24173         (CInstance::operator=):
24174         (CInstance::getClass):
24175         (CInstance::begin):
24176         (CInstance::end):
24177         (CInstance::invokeMethod):
24178         (CInstance::defaultValue):
24179         (CInstance::stringValue):
24180         (CInstance::numberValue):
24181         (CInstance::booleanValue):
24182         (CInstance::valueOf):
24183         * bindings/c/c_instance.h: Added.
24184         (KJS::Bindings::CInstance::getObject):
24185         * bindings/c/c_runtime.cpp: Added.
24186         (CField::valueFromInstance):
24187         (CField::setValueToInstance):
24188         * bindings/c/c_runtime.h: Added.
24189         (KJS::Bindings::CField::CField):
24190         (KJS::Bindings::CField::name):
24191         (KJS::Bindings::CField::type):
24192         (KJS::Bindings::CMethod::CMethod):
24193         (KJS::Bindings::CMethod::name):
24194         (KJS::Bindings::CMethod::numParameters):
24195         * bindings/c/c_utility.cpp: Added.
24196         (coerceValueToNPValueType):
24197         (convertValueToNPValueType):
24198         (convertNPValueTypeToValue):
24199         * bindings/c/c_utility.h: Added.
24200         * bindings/make_testbindings:
24201         * bindings/runtime.cpp:
24202         (Instance::createBindingForLanguageInstance):
24203         * bindings/runtime.h:
24204         (KJS::Bindings::Instance::):
24205         * bindings/testbindings.cpp: Added.
24206         (initializeIdentifiers):
24207         (myInterfaceHasProperty):
24208         (myInterfaceHasMethod):
24209         (myInterfaceGetProperty):
24210         (myInterfaceSetProperty):
24211         (myInterfaceInvoke):
24212         (myInterfaceAllocate):
24213         (myInterfaceInvalidate):
24214         (myInterfaceDeallocate):
24215         (GlobalImp::className):
24216         (readJavaScriptFromFile):
24217         (main):
24218
24219 2004-03-10  Richard Williamson   <rjw@apple.com>
24220
24221         Made changes to support new asychronous approach to calls from
24222         plugin to JavaScript
24223
24224         Reviewed by Chris.
24225
24226         * bindings/NP_jsobject.cpp:
24227         (NP_Call):
24228         (NP_Evaluate):
24229         (NP_GetProperty):
24230         (NP_ToString):
24231         (NP_GetPropertyAtIndex):
24232         * bindings/NP_runtime.h:
24233         * bindings/make_testbindings:
24234         * bindings/runtime.cpp:
24235         (Instance::createBindingForLanguageInstance):
24236
24237 2004-03-10  Richard Williamson   <rjw@apple.com>
24238
24239         Updated header to include proposed changes from
24240         plugin-futures list.  Calls from plugin to JavaScript
24241         are now asynchronous.
24242
24243         Reviewed by Chris.
24244
24245         * bindings/NP_runtime.h:
24246
24247 === Safari-131 ===
24248
24249 2004-03-04  Richard Williamson   <rjw@apple.com>
24250
24251         Implementation of NP_JavaScriptObject.  This is the 'C' class
24252         that wraps a JavaScript object.
24253
24254         Reviewed by Chris.
24255
24256         * JavaScriptCore.pbproj/project.pbxproj:
24257         * bindings/NP_jsobject.cpp: Added.
24258         (coerceValueToNPValueType):
24259         (convertValueToNPValueType):
24260         (convertNPValueTypeToValue):
24261         (listFromNPArray):
24262         (jsAllocate):
24263         (jsDeallocate):
24264         (identiferFromNPIdentifier):
24265         (NP_Call):
24266         (NP_Evaluate):
24267         (NP_GetProperty):
24268         (NP_SetProperty):
24269         (NP_RemoveProperty):
24270         (NP_ToString):
24271         (NP_GetPropertyAtIndex):
24272         (NP_SetPropertyAtIndex):
24273         * bindings/NP_runtime.cpp:
24274         (NP_ObjectAtIndex):
24275         * bindings/NP_runtime.h:
24276         * bindings/runtime_object.h:
24277
24278 2004-03-04  Richard Williamson   <rjw@apple.com>
24279
24280         Added NP_Array implementation.  
24281
24282         Changed NP_Boolean to just depend on two static instances, no
24283         space is required for values.
24284
24285         Reviewed by Chris.
24286
24287         * bindings/NP_runtime.cpp:
24288         (NP_CreateBoolean):
24289         (NP_BoolFromBoolean):
24290         (arrayAllocate):
24291         (arrayDeallocate):
24292         (NP_CreateArray):
24293         (NP_CreateArrayV):
24294         (NP_ObjectAtIndex):
24295         * bindings/NP_runtime.h:
24296
24297 2004-03-03  Darin Adler  <darin@apple.com>
24298
24299         Reviewed by Vicki.
24300
24301         * English.lproj/InfoPlist.strings: Removed. No need to localize the version and
24302         copyright string, and that's all that was in here.
24303         * JavaScriptCore.pbproj/project.pbxproj: Removed InfoPlist.strings from build.
24304
24305 2004-03-03  Richard Williamson   <rjw@apple.com>
24306
24307         More 'C' binding implementation.  Fleshed out all the
24308         'primitive' data types.
24309
24310         Reviewed by Chris.
24311
24312         * bindings/NP_runtime.cpp:
24313         (NP_ReleaseObject):
24314         (numberAllocate):
24315         (stringAllocate):
24316         (stringDeallocate):
24317         (NP_CreateStringWithUTF8):
24318         (NP_CreateStringWithUTF16):
24319         (NP_UTF8FromString):
24320         (NP_UTF16FromString):
24321         (NP_StringLength):
24322         (booleanAllocate):
24323         (booleanDeallocate):
24324         (NP_CreateBoolean):
24325         (NP_BoolFromBoolean):
24326         (nullAllocate):
24327         (nullDeallocate):
24328         (NP_GetNull):
24329         (undefinedAllocate):
24330         (undefinedDeallocate):
24331         (NP_GetUndefined):
24332         * bindings/NP_runtime.h:
24333
24334 2004-03-03  Richard Williamson   <rjw@apple.com>
24335
24336         More 'C' binding implementation.
24337
24338         Reviewed by Chris.
24339
24340         * bindings/NP_runtime.cpp:
24341         (identifierEqual):
24342         (identifierHash):
24343         (getIdentifierDictionary):
24344         (NP_IdentifierFromUTF8):
24345         (NP_UTF8FromIdentifier):
24346         (NP_CreateObject):
24347         (NP_ReleaseObject):
24348         (NP_IsKindOfClass):
24349         (numberCreate):
24350         (NP_CreateNumberWithInt):
24351         (NP_CreateNumberWithFloat):
24352         (NP_CreateNumberWithDouble):
24353         (NP_IntFromNumber):
24354         (NP_FloatFromNumber):
24355         (NP_DoubleFromNumber):
24356         * bindings/NP_runtime.h:
24357
24358 2004-03-02  Richard Williamson   <rjw@apple.com>
24359
24360         Removed retain/release from NP_Class.  Classes will not be allowed to implement their
24361         own customer retain/release scheme.
24362
24363         Reviewed by Chris.
24364
24365         * bindings/NP_runtime.cpp:
24366         (NP_RetainObject):
24367         (NP_ReleaseObject):
24368         * bindings/NP_runtime.h:
24369
24370 2004-03-02  Richard Williamson   <rjw@apple.com>
24371
24372         C binding API.  Partial implementation.
24373
24374         Completed ObjectiveC bindings (not based on the C API).  These will re-implemented over the C binding API, but I wanted to get this code in the tree.
24375
24376         Factored root object reference counting scheme.  It is now useful independent
24377         of LiveConnect.
24378
24379         Reviewed by Chris.
24380
24381         * JavaScriptCore.pbproj/project.pbxproj:
24382         * bindings/NP_runtime.cpp: Added.
24383         (NP_IdentifierFromUTF8):
24384         (NP_GetIdentifiers):
24385         (NP_UTF8FromIdentifier):
24386         (NP_CreateObject):
24387         (NP_RetainObject):
24388         (NP_ReleaseObject):
24389         (NP_IsKindOfClass):
24390         (NP_SetException):
24391         (NP_Call):
24392         (NP_Evaluate):
24393         (NP_GetProperty):
24394         (NP_SetProperty):
24395         (NP_RemoveProperty):
24396         (NP_ToString):
24397         (NP_GetPropertyAtIndex):
24398         (NP_SetPropertyAtIndex):
24399         (NP_CreateNumberWithInt):
24400         (NP_CreateNumberWithFloat):
24401         (NP_CreateNumberWithDouble):
24402         (NP_IntFromNumber):
24403         (NP_FloatFromNumber):
24404         (NP_DoubleFromNumber):
24405         (NP_CreateStringWithUTF8):
24406         (NP_CreateStringWithUTF16):
24407         (NP_UTF8FromString):
24408         (NP_UTF16FromString):
24409         (NP_CreateBoolean):
24410         (NP_BoolFromBoolean):
24411         (NP_GetNull):
24412         (NP_GetUndefined):
24413         (NP_CreateArray):
24414         (NP_CreateArrayV):
24415         (NP_ObjectAtIndex):
24416         * bindings/NP_runtime.h: Added.
24417         * bindings/jni/jni_jsobject.cpp:
24418         (JSObject::invoke):
24419         (JSObject::finalize):
24420         (JSObject::createNative):
24421         (JSObject::convertValueToJObject):
24422         * bindings/jni/jni_jsobject.h:
24423         * bindings/objc/objc_jsobject.h:
24424         * bindings/objc/objc_jsobject.mm:
24425         (rootForView):
24426         (windowJavaScriptObject):
24427         (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
24428         (-[JavaScriptObject dealloc]):
24429         (-[JavaScriptObject _convertValueToObjcValue:KJS::]):
24430         (-[JavaScriptObject call:arguments:]):
24431         (-[JavaScriptObject evaluate:]):
24432         (-[JavaScriptObject getMember:]):
24433         (-[JavaScriptObject setMember:value:]):
24434         (-[JavaScriptObject removeMember:]):
24435         (-[JavaScriptObject toString]):
24436         (-[JavaScriptObject getSlot:]):
24437         (-[JavaScriptObject setSlot:value:]):
24438         * bindings/objc/objc_utility.h:
24439         * bindings/objc/objc_utility.mm:
24440         (KJS::Bindings::convertValueToObjcValue):
24441         * bindings/runtime_root.cpp: Added.
24442         (getReferencesByRootDictionary):
24443         (getReferencesDictionary):
24444         (KJS::Bindings::findReferenceDictionary):
24445         (KJS::Bindings::rootForImp):
24446         (KJS::Bindings::addNativeReference):
24447         (KJS::Bindings::removeNativeReference):
24448         (completedJavaScriptAccess):
24449         (initializeJavaScriptAccessLock):
24450         (lockJavaScriptAccess):
24451         (unlockJavaScriptAccess):
24452         (RootObject::dispatchToJavaScriptThread):
24453         (performJavaScriptAccess):
24454         (RootObject::setFindRootObjectForNativeHandleFunction):
24455         (RootObject::removeAllNativeReferences):
24456         * bindings/runtime_root.h: Added.
24457         (KJS::Bindings::RootObject::RootObject):
24458         (KJS::Bindings::RootObject::~RootObject):
24459         (KJS::Bindings::RootObject::setRootObjectImp):
24460         (KJS::Bindings::RootObject::rootObjectImp):
24461         (KJS::Bindings::RootObject::setInterpreter):
24462         (KJS::Bindings::RootObject::interpreter):
24463         (KJS::Bindings::RootObject::findRootObjectForNativeHandleFunction):
24464         (KJS::Bindings::RootObject::runLoop):
24465         (KJS::Bindings::RootObject::performJavaScriptSource):
24466
24467 === Safari-130 ===
24468
24469 === Safari-129 ===
24470
24471 2004-02-18  Richard Williamson   <rjw@apple.com>
24472
24473         Added NSNumber/Number conversion.
24474
24475         Removed some unnecessary KJS:: namespace specifiers.
24476
24477         Reviewed by Ken.
24478
24479         * bindings/objc/objc_utility.mm:
24480         (KJS::Bindings::convertValueToObjcValue):
24481         (KJS::Bindings::convertObjcValueToValue):
24482         * bindings/runtime_array.h:
24483
24484 2004-02-18  Richard Williamson   <rjw@apple.com>
24485
24486         Added support for export NSArrays.
24487
24488         Updated valueAt() to take an ExecState so we can throw
24489         JS exceptions.
24490
24491         Implemented excludeSelectorFromJavaScript: in ObjcClass.  This allows
24492         ObjectiveC classes to control the visibility of their methods in 
24493         JavaScript.
24494
24495         Reviewed by Ken.
24496
24497         * bindings/jni/jni_runtime.cpp:
24498         (JavaField::valueFromInstance):
24499         (JavaArray::valueAt):
24500         * bindings/jni/jni_runtime.h:
24501         * bindings/objc/objc_class.mm:
24502         (ObjcClass::methodsNamed):
24503         * bindings/objc/objc_runtime.h:
24504         (KJS::Bindings::ObjcArray::getObjcArray):
24505         * bindings/objc/objc_runtime.mm:
24506         (ObjcField::valueFromInstance):
24507         (ObjcField::setValueToInstance):
24508         (ObjcArray::ObjcArray):
24509         (ObjcArray::~ObjcArray):
24510         (ObjcArray::operator=):
24511         (ObjcArray::setValueAt):
24512         (ObjcArray::valueAt):
24513         (ObjcArray::getLength):
24514         * bindings/objc/objc_utility.mm:
24515         (KJS::Bindings::convertValueToObjcValue):
24516         (KJS::Bindings::convertObjcValueToValue):
24517         * bindings/runtime.cpp:
24518         (Instance::getValueOfField):
24519         * bindings/runtime.h:
24520         * bindings/runtime_array.cpp:
24521         (RuntimeArrayImp::get):
24522         * bindings/runtime_object.cpp:
24523         (RuntimeObjectImp::get):
24524
24525 2004-02-17  Richard Williamson   <rjw@apple.com>
24526
24527         Added String <-> NSString conversion.
24528         Added tests of String <-> NSString conversion to test program.
24529
24530         Reviewed by Chris.
24531
24532         * bindings/objc/objc_utility.mm:
24533         (KJS::Bindings::convertValueToObjcValue):
24534         (KJS::Bindings::convertObjcValueToValue):
24535         * bindings/test.js:
24536         * bindings/testbindings.mm:
24537         (-[MyFirstInterface getString]):
24538
24539 2004-02-15  Darin Adler  <darin@apple.com>
24540
24541         Reviewed by Dave.
24542
24543         * JavaScriptCore.pbproj/project.pbxproj: Tweak build styles a bit, fixing OptimizedWithSymbols,
24544         and removing redundant settings of things that match defaults in other build styles.
24545
24546 2004-02-13  Richard Williamson   <rjw@apple.com>
24547
24548         Work towards the JavaScript ObjC bindings.  The bindings now work for 
24549         simple scalar types.  testbindings.mm is an illustration of how the 
24550         bindings work.
24551
24552         Reviewed by Ken.
24553
24554         * JavaScriptCore.pbproj/project.pbxproj:
24555         * Makefile.am:
24556         * bindings/jni/jni_class.cpp:
24557         (JavaClass::methodsNamed):
24558         * bindings/jni/jni_class.h:
24559         * bindings/jni/jni_instance.cpp:
24560         (JavaInstance::invokeMethod):
24561         * bindings/jni/jni_instance.h:
24562         * bindings/jni/jni_runtime.h:
24563         (KJS::Bindings::JavaMethod::returnType):
24564         * bindings/make_testbindings: Added.
24565         * bindings/objc/objc_class.h: Added.
24566         (KJS::Bindings::ObjcClass::~ObjcClass):
24567         (KJS::Bindings::ObjcClass::ObjcClass):
24568         (KJS::Bindings::ObjcClass::operator=):
24569         (KJS::Bindings::ObjcClass::constructorAt):
24570         (KJS::Bindings::ObjcClass::numConstructors):
24571         * bindings/objc/objc_class.mm: Added.
24572         (ObjcClass::_commonDelete):
24573         (ObjcClass::_commonCopy):
24574         (ObjcClass::_commonInit):
24575         (_createClassesByIsAIfNecessary):
24576         (ObjcClass::classForIsA):
24577         (ObjcClass::ObjcClass):
24578         (ObjcClass::name):
24579         (ObjcClass::methodsNamed):
24580         (ObjcClass::fieldNamed):
24581         * bindings/objc/objc_header.h: Added.
24582         * bindings/objc/objc_instance.h: Added.
24583         (KJS::Bindings::ObjcInstance::getObject):
24584         * bindings/objc/objc_instance.mm: Added.
24585         (ObjcInstance::ObjcInstance):
24586         (ObjcInstance::~ObjcInstance):
24587         (ObjcInstance::operator=):
24588         (ObjcInstance::begin):
24589         (ObjcInstance::end):
24590         (ObjcInstance::getClass):
24591         (ObjcInstance::invokeMethod):
24592         (ObjcInstance::defaultValue):
24593         (ObjcInstance::stringValue):
24594         (ObjcInstance::numberValue):
24595         (ObjcInstance::booleanValue):
24596         (ObjcInstance::valueOf):
24597         * bindings/objc/objc_jsobject.h: Added.
24598         * bindings/objc/objc_jsobject.mm: Added.
24599         * bindings/objc/objc_runtime.h:
24600         (KJS::Bindings::ObjcField::~ObjcField):
24601         (KJS::Bindings::ObjcField::ObjcField):
24602         (KJS::Bindings::ObjcField::operator=):
24603         (KJS::Bindings::ObjcMethod::ObjcMethod):
24604         (KJS::Bindings::ObjcMethod::~ObjcMethod):
24605         (KJS::Bindings::ObjcMethod::operator=):
24606         * bindings/objc/objc_runtime.mm: Added.
24607         (ObjcMethod::ObjcMethod):
24608         (ObjcMethod::name):
24609         (ObjcMethod::numParameters):
24610         (ObjcMethod::getMethodSignature):
24611         (ObjcField::ObjcField):
24612         (ObjcField::name):
24613         (ObjcField::type):
24614         (ObjcField::valueFromInstance):
24615         (ObjcField::setValueToInstance):
24616         * bindings/objc/objc_utility.h: Added.
24617         (KJS::Bindings::):
24618         * bindings/objc/objc_utility.mm: Added.
24619         (KJS::Bindings::JSMethodNameToObjCMethodName):
24620         (KJS::Bindings::convertValueToObjcValue):
24621         (KJS::Bindings::convertObjcValueToValue):
24622         (KJS::Bindings::objcValueTypeForType):
24623         * bindings/runtime.cpp:
24624         (MethodList::MethodList):
24625         (MethodList::operator=):
24626         (Instance::setValueOfField):
24627         (Instance::createBindingForLanguageInstance):
24628         (Instance::createRuntimeObject):
24629         * bindings/runtime.h:
24630         * bindings/runtime_method.cpp:
24631         (RuntimeMethodImp::RuntimeMethodImp):
24632         (RuntimeMethodImp::get):
24633         (RuntimeMethodImp::call):
24634         * bindings/runtime_method.h:
24635         * bindings/runtime_object.cpp:
24636         (RuntimeObjectImp::get):
24637         (RuntimeObjectImp::hasProperty):
24638         * bindings/test.js: Added.
24639         * bindings/testbindings.mm: Added.
24640         (-[MySecondInterface init]):
24641         (-[MyFirstInterface init]):
24642         (-[MyFirstInterface dealloc]):
24643         (+[MyFirstInterface JavaScriptNameForSelector:]):
24644         (-[MyFirstInterface getInt]):
24645         (-[MyFirstInterface setInt:]):
24646         (-[MyFirstInterface getMySecondInterface]):
24647         (-[MyFirstInterface logMessage:]):
24648         (GlobalImp::className):
24649         (readJavaScriptFromFile):
24650         (main):
24651
24652 === Safari-128 ===
24653
24654 2004-02-08  Darin Adler  <darin@apple.com>
24655
24656         Reviewed by Dave.
24657
24658         - fixed things seen in the profile, for a total speedup of 4% on cvs-base (including changes across all projects)
24659
24660         * JavaScriptCorePrefix.h: Add a workaround for a bug in our system headers that prevents the <ctype.h>
24661         macros from working right in C++ code that uses the <cctype> header.
24662
24663         * kjs/ustring.cpp:
24664         (KJS::inlineUTF8SequenceLengthNonASCII): Added.
24665         (KJS::UTF8SequenceLengthNonASCII): Added.
24666         (KJS::inlineUTF8SequenceLength): Added.
24667         (KJS::UTF8SequenceLength): Calls inlineUTF8SequenceLengthNonASCII now.
24668         (KJS::decodeUTF8Sequence): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
24669         (KJS::createSortedOffsetsArray): Add special case for 1, 2, and 3 offsets, so we don't do qsort for those.
24670         (KJS::convertUTF16OffsetsToUTF8Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
24671         (KJS::convertUTF8OffsetsToUTF16Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
24672
24673         - fixed the test program so it won't hit the interpreter lock assertion
24674
24675         * kjs/testkjs.cpp: (main): Just lock around the whole thing, since the test is singly threaded.
24676
24677 === Safari-127 ===
24678
24679 2004-02-06  Richard Williamson   <rjw@apple.com>
24680
24681         Fixed 3550242 and 3546977.  The first diff prevents an assert from firing.  The second diff prevents a JavaScript exception, caused be an invalid conversion, which has a downstream consequence of preventing a valid conversion.
24682
24683         Reviewed by John.
24684
24685         * bindings/jni/jni_jsobject.cpp:
24686         (JSObject::toString):
24687         * bindings/jni/jni_utility.cpp:
24688         (KJS::Bindings::convertValueToJValue):
24689
24690 2004-02-02  Darin Adler  <darin@apple.com>
24691
24692         Reviewed by Maciej.
24693
24694         - fixed <rdar://problem/3546613>: array of negative size leads to crash (test page at oscar.the-rileys.net)
24695
24696         * kjs/array_object.cpp:
24697         (ArrayInstanceImp::ArrayInstanceImp): If the length is greater than 10,000, don't allocate an array until
24698         we start putting values in. This prevents new Array(2147483647) from causing trouble.
24699         (ArrayObjectImp::construct): Check number as described in specification, and raise a range error if the
24700         number is out of range. This prevents new Array(-1) from causing trouble.
24701
24702         - fixed <rdar://problem/3545756>: Math.round screws up on numbers bigger than 2^31 (incorrect results on HP-35 calculator page)
24703
24704         * kjs/math_object.cpp: (MathFuncImp::call): Change implementation to be much simpler and not involve
24705         casting to int. Results now match those in other browsers.
24706
24707 2004-02-02  Darin Adler  <darin@apple.com>
24708
24709         Reviewed by Maciej.
24710
24711         - fixed <rdar://problem/3519285>: integer operations on large negative numbers yield bad results (discovered with "HTMLCrypt")
24712         - fixed other related overflow issues
24713
24714         * kjs/value.h: Changed return types of toInteger, toInt32, toUInt32, and toUInt16.
24715         * kjs/value.cpp:
24716         (ValueImp::toInteger): Change to return a double, since this operation, from the ECMA specification,
24717         must not restrict values to the range of a particular integer type.
24718         (ValueImp::toInt32): Used a sized integer type for the result of this function, and also added
24719         proper handling for negative results from fmod.
24720         (ValueImp::toUInt32): Ditto.
24721         (ValueImp::toUInt16): Ditto.
24722         (ValueImp::dispatchToUInt32): Changed result type from unsigned to uint32_t.
24723
24724         * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Use a double instead of an int to handle
24725         out-of-integer-range values better in the slice function.
24726         * kjs/internal.cpp: (KJS::roundValue): Streamline the function, handling NAN and infinity properly.
24727         * kjs/number_object.cpp: (NumberProtoFuncImp::call): Use a double instead of an int to handle
24728         out-of-integer-range values better in the toString function.
24729         * kjs/string_object.cpp: (StringProtoFuncImp::call): Use a double instead of an int to handle
24730         out-of-integer-range values better in the charAt, charCodeAt, indexOf, lastIndexOf, slice,
24731         and substr functions.
24732
24733 === Safari-126 ===
24734
24735 2004-01-30  Richard Williamson   <rjw@apple.com>
24736
24737         Fixed 3542044.  Create KJS::String using UString constructor instead of passing UTF8 string to char* constructor.
24738
24739         Reviewed by Darin.
24740
24741         * bindings/jni/jni_instance.cpp:
24742         (JavaInstance::stringValue):
24743
24744 2004-01-26  Darin Adler  <darin@apple.com>
24745
24746         * Makefile.am: Switch from pbxbuild to xcodebuild.
24747
24748 2004-01-22  Richard Williamson   <rjw@apple.com>
24749
24750         Added stubs for ObjC language binding to JavaScript.
24751
24752         * JavaScriptCore.pbproj/project.pbxproj:
24753         * bindings/jni/jni_runtime.h:
24754         * bindings/objc/objc_runtime.h: Added.
24755         (KJS::Bindings::ObjcParameter::ObjcParameter):
24756         (KJS::Bindings::ObjcParameter::~ObjcParameter):
24757         (KJS::Bindings::ObjcParameter::operator=):
24758         (KJS::Bindings::ObjcParameter::type):
24759         (KJS::Bindings::ObjcConstructor::ObjcConstructor):
24760         (KJS::Bindings::ObjcConstructor::~ObjcConstructor):
24761         (KJS::Bindings::ObjcConstructor::_commonCopy):
24762         (KJS::Bindings::ObjcConstructor::operator=):
24763         (KJS::Bindings::ObjcConstructor::value):
24764         (KJS::Bindings::ObjcConstructor::parameterAt):
24765         (KJS::Bindings::ObjcConstructor::numParameters):
24766         (KJS::Bindings::ObjcField::ObjcField):
24767         (KJS::Bindings::ObjcField::~ObjcField):
24768         * bindings/runtime.h:
24769
24770 2004-01-22  Richard Williamson   <rjw@apple.com>
24771
24772         Simplified JavaString by using UString as backing store.  This
24773         revealed a bug in CString's assignment operator which I fixed.
24774
24775         Removed some dead code.
24776  
24777         Reviewed by John.
24778
24779         * bindings/jni/jni_runtime.h:
24780         (KJS::Bindings::JavaString::JavaString):
24781         (KJS::Bindings::JavaString::_commonInit):
24782         (KJS::Bindings::JavaString::UTF8String):
24783         (KJS::Bindings::JavaString::uchars):
24784         (KJS::Bindings::JavaString::length):
24785         (KJS::Bindings::JavaString::ustring):
24786         * bindings/runtime_object.cpp:
24787         (RuntimeObjectImp::RuntimeObjectImp):
24788         * bindings/runtime_object.h:
24789         * kjs/ustring.cpp:
24790         (KJS::CString::CString):
24791         (KJS::CString::operator=):
24792
24793 === Safari-125 ===
24794
24795 === Safari-124 ===
24796
24797 2004-01-16  Richard Williamson   <rjw@apple.com>
24798
24799         Fixed 3525853.  We weren't handling mapping to overloaded Java
24800         methods very well.  Even though this is undefined the other
24801         browsers support it.  Also fixed a bug with returning arrays
24802         from Java functions.
24803
24804         Reviewed by John.
24805
24806         * bindings/jni/jni_class.cpp:
24807         (JavaClass::_commonInit):
24808         (JavaClass::methodsNamed):
24809         * bindings/jni/jni_class.h:
24810         * bindings/jni/jni_instance.cpp:
24811         (JavaInstance::invokeMethod):
24812         * bindings/jni/jni_instance.h:
24813         * bindings/jni/jni_runtime.cpp:
24814         (JavaArray::convertJObjectToArray):
24815         (JavaField::valueFromInstance):
24816         (JavaMethod::signature):
24817         (JavaArray::valueAt):
24818         * bindings/jni/jni_runtime.h:
24819         * bindings/jni_jsobject.cpp:
24820         (JSObject::call):
24821         (JSObject::convertJObjectToValue):
24822         * bindings/runtime.cpp:
24823         (MethodList::addMethod):
24824         (MethodList::length):
24825         (MethodList::methodAt):
24826         (MethodList::~MethodList):
24827         * bindings/runtime.h:
24828         (KJS::Bindings::MethodList::MethodList):
24829         * bindings/runtime_method.cpp:
24830         (RuntimeMethodImp::RuntimeMethodImp):
24831         (RuntimeMethodImp::get):
24832         (RuntimeMethodImp::call):
24833         * bindings/runtime_method.h:
24834         * bindings/runtime_object.cpp:
24835         (RuntimeObjectImp::get):
24836         (RuntimeObjectImp::hasProperty):
24837
24838 2004-01-16  Richard Williamson   <rjw@apple.com>
24839
24840         Fixed 3531229.  Another place that needs the  Push/PopLocalFrame
24841         protection implemented for 3530401.
24842
24843         Reviewed by John.
24844
24845         * bindings/runtime_method.cpp:
24846         (RuntimeMethodImp::call):
24847
24848 2004-01-15  Richard Williamson   <rjw@apple.com>
24849
24850         Fixed 3530401.  JNI doesn't cleanup local refs created on the
24851         main thread.   IMO this is a bad bug in our JMI implementation.
24852
24853         To work-around the problem I explicitly delete all local refs.
24854         Further, I've added Push/PopLocalFrame calls to catch any refs
24855         that I may have missed.  This will guarantee that we don't leak
24856         any Java references.
24857
24858         Reviewed by John.
24859
24860         * bindings/jni/jni_class.cpp:
24861         (JavaClass::_commonInit):
24862         (JavaClass::JavaClass):
24863         * bindings/jni/jni_instance.cpp:
24864         (JavaInstance::begin):
24865         (JavaInstance::end):
24866         * bindings/jni/jni_instance.h:
24867         * bindings/jni/jni_runtime.cpp:
24868         (JavaConstructor::JavaConstructor):
24869         (JavaMethod::JavaMethod):
24870         * bindings/jni_jsobject.cpp:
24871         (JSObject::listFromJArray):
24872         * bindings/runtime.h:
24873         (KJS::Bindings::Instance::begin):
24874         (KJS::Bindings::Instance::end):
24875         * bindings/runtime_object.cpp:
24876         (RuntimeObjectImp::get):
24877         (RuntimeObjectImp::put):
24878         (RuntimeObjectImp::canPut):
24879         (RuntimeObjectImp::hasProperty):
24880         (RuntimeObjectImp::defaultValue):
24881
24882 2004-01-15  Vicki Murley  <vicki@apple.com>
24883
24884         Reviewed by Darin.
24885
24886         * JavaScriptCore.pbproj/project.pbxproj: Update copyright date to 2004.
24887
24888 2004-01-14  Richard Williamson   <rjw@apple.com>
24889         
24890         Fixed 3529466.  With recent changes to Java plugin we must no
24891         longer call DeleteLocalRef().  Not a problem, it was an optimization anyway.
24892
24893         Reviewed by John.
24894
24895         * bindings/jni/jni_instance.cpp:
24896         (JObjectWrapper::JObjectWrapper):
24897
24898 === Safari-122 ===
24899
24900 2004-01-14  Richard Williamson   <rjw@apple.com>
24901
24902         Fixed 3529010.
24903
24904         Finalize may be called on an JSObject after we've already remove all our references.  The assert in this case is firing because we've received a finalize call from Java for an instance that we no longer know about.  The fix is to check in finalize that we're getting a call on an instance that we still care about.
24905
24906         Reviewed by John.
24907
24908         * bindings/jni_jsobject.cpp:
24909         (addJavaReference):
24910         (removeJavaReference):
24911         (RootObject::removeAllJavaReferencesForRoot):
24912         (JSObject::invoke):
24913
24914 2004-01-13  Richard Williamson   <rjw@apple.com>
24915
24916         Fixed 3528324. 
24917
24918         The run loop that is used to execute JavaScript (in practice, always the main run loop) is held in a class variable.  It is set and retained once and should not be released.  Unfortunately is it being released when the 'root' object on a LiveConnect applet is released.  This has the symptom of eventually causing an deallocation of the main run loop!  Usually after about 5 instantiations/destructions of a LiveConnect applet.  The CFRelease of the run loop was removed.
24919
24920         Reviewed by Hyatt.
24921
24922         * bindings/jni_jsobject.h:
24923         (KJS::Bindings::RootObject::~RootObject):
24924
24925 === Safari-121 ===
24926
24927 === Safari-120 ===
24928
24929 2004-01-06  Richard Williamson   <rjw@apple.com>
24930
24931         Fixed 3521814.  Finalize messages weren't being dispatched!
24932
24933         Reviewed by John.
24934
24935         * bindings/jni_jsobject.cpp:
24936         (JSObject::invoke):
24937
24938 2004-01-05  Richard Williamson   <rjw@apple.com>
24939
24940         Added cache of JNI method IDs to minimize allocations.  This mitigates the problem
24941         described by 3515579.
24942
24943         Also cleanup up logging of Java exceptions.
24944
24945         Reviewed by John.
24946
24947         * bindings/jni/jni_class.cpp:
24948         (JavaClass::classForInstance):
24949         * bindings/jni/jni_instance.cpp:
24950         (JavaInstance::JavaInstance):
24951         (JavaInstance::getClass):
24952         (JavaInstance::invokeMethod):
24953         (JObjectWrapper::JObjectWrapper):
24954         (JObjectWrapper::~JObjectWrapper):
24955         * bindings/jni/jni_instance.h:
24956         (KJS::Bindings::JavaInstance::operator=):
24957         * bindings/jni/jni_runtime.cpp:
24958         (JavaMethod::JavaMethod):
24959         (JavaMethod::methodID):
24960         * bindings/jni/jni_runtime.h:
24961         (KJS::Bindings::JavaMethod::JavaMethod):
24962         * bindings/jni/jni_utility.cpp:
24963         (callJNIMethod):
24964         (callJNIMethodIDA):
24965         (callJNIMethodA):
24966         (KJS::Bindings::getMethodID):
24967         (KJS::Bindings::callJNIVoidMethodIDA):
24968         (KJS::Bindings::callJNIObjectMethodIDA):
24969         (KJS::Bindings::callJNIByteMethodIDA):
24970         (KJS::Bindings::callJNICharMethodIDA):
24971         (KJS::Bindings::callJNIShortMethodIDA):
24972         (KJS::Bindings::callJNIIntMethodIDA):
24973         (KJS::Bindings::callJNILongMethodIDA):
24974         (KJS::Bindings::callJNIFloatMethodIDA):
24975         (KJS::Bindings::callJNIDoubleMethodIDA):
24976         (KJS::Bindings::callJNIBooleanMethodIDA):
24977         (KJS::Bindings::getCharactersFromJStringInEnv):
24978         (KJS::Bindings::getUCharactersFromJStringInEnv):
24979         (KJS::Bindings::getJNIField):
24980         * bindings/jni/jni_utility.h:
24981
24982 l2003-12-23  John Sullivan  <sullivan@apple.com>
24983
24984         * JavaScriptCore.pbproj/project.pbxproj:
24985         Xcode version wars, harmless
24986
24987 2003-12-23  Darin Adler  <darin@apple.com>
24988
24989         Reviewed by John (concept, not code, which is just the old code coming back).
24990
24991         - fixed 3518092: REGRESSION (100-119): getting NaN instead of HH:MM times
24992
24993         * kjs/date_object.cpp: Added back our CF-based implementations of gmtime, localtime,
24994         mktime, timegm, and time, because mktime, at least, won't handle a year of 0.
24995
24996 2003-12-19  Richard Williamson   <rjw@apple.com>
24997
24998         Fixed 3515597.  When an error occurs we need
24999         to make sure result values are zeroed.
25000
25001         Cleaned up logs by adding a newline.
25002
25003         Reviewed by John.
25004
25005         * bindings/jni/jni_utility.cpp:
25006         (KJS::Bindings::getJavaVM):
25007         (KJS::Bindings::getJNIEnv):
25008         (callJNIMethod):
25009         (callJNIMethodA):
25010         (KJS::Bindings::getJNIField):
25011         * bindings/jni_jsobject.cpp:
25012         (JSObject::convertValueToJObject):
25013
25014 === Safari-119 ===
25015
25016 2003-12-17  Richard Williamson   <rjw@apple.com>
25017
25018         Ensure that all the symbols we export are in the KJS
25019         namespace (3512245).
25020
25021         Also renamed JavaString.characters() to JavaString.UTF8String()
25022         for enhanced clarity.
25023
25024         Added some sanity checking to constructor of JObjectWrapper.
25025
25026         Reviewed by Dave.
25027
25028         * ChangeLog:
25029         * bindings/jni/jni_class.cpp:
25030         * bindings/jni/jni_class.h:
25031         * bindings/jni/jni_instance.cpp:
25032         (JavaInstance::invokeMethod):
25033         (JObjectWrapper::JObjectWrapper):
25034         * bindings/jni/jni_instance.h:
25035         * bindings/jni/jni_runtime.cpp:
25036         (JavaParameter::JavaParameter):
25037         (JavaField::JavaField):
25038         (JavaMethod::JavaMethod):
25039         (JavaMethod::signature):
25040         * bindings/jni/jni_runtime.h:
25041         (KJS::Bindings::JavaString::ascii):
25042         (KJS::Bindings::JavaString::UTF8String):
25043         (KJS::Bindings::JavaString::JavaString):
25044         (KJS::Bindings::JavaString::_commonInit):
25045         (KJS::Bindings::JavaString::uchars):
25046         (KJS::Bindings::JavaString::length):
25047         (KJS::Bindings::JavaString::ustring):
25048         (KJS::Bindings::JavaParameter::type):
25049         (KJS::Bindings::JavaField::name):
25050         (KJS::Bindings::JavaField::type):
25051         (KJS::Bindings::JavaMethod::name):
25052         (KJS::Bindings::JavaMethod::returnType):
25053         * bindings/jni/jni_utility.cpp:
25054         (KJS::Bindings::getJavaVM):
25055         (KJS::Bindings::getJNIEnv):
25056         (KJS::Bindings::callJNIVoidMethod):
25057         (KJS::Bindings::callJNIObjectMethod):
25058         (KJS::Bindings::callJNIBooleanMethod):
25059         (KJS::Bindings::callJNIByteMethod):
25060         (KJS::Bindings::callJNICharMethod):
25061         (KJS::Bindings::callJNIShortMethod):
25062         (KJS::Bindings::callJNIIntMethod):
25063         (KJS::Bindings::callJNILongMethod):
25064         (KJS::Bindings::callJNIFloatMethod):
25065         (KJS::Bindings::callJNIDoubleMethod):
25066         (KJS::Bindings::callJNIVoidMethodA):
25067         (KJS::Bindings::callJNIObjectMethodA):
25068         (KJS::Bindings::callJNIByteMethodA):
25069         (KJS::Bindings::callJNICharMethodA):
25070         (KJS::Bindings::callJNIShortMethodA):
25071         (KJS::Bindings::callJNIIntMethodA):
25072         (KJS::Bindings::callJNILongMethodA):
25073         (KJS::Bindings::callJNIFloatMethodA):
25074         (KJS::Bindings::callJNIDoubleMethodA):
25075         (KJS::Bindings::callJNIBooleanMethodA):
25076         (KJS::Bindings::getCharactersFromJString):
25077         (KJS::Bindings::releaseCharactersForJString):
25078         (KJS::Bindings::getCharactersFromJStringInEnv):
25079         (KJS::Bindings::releaseCharactersForJStringInEnv):
25080         (KJS::Bindings::getUCharactersFromJStringInEnv):
25081         (KJS::Bindings::releaseUCharactersForJStringInEnv):
25082         (KJS::Bindings::JNITypeFromClassName):
25083         (KJS::Bindings::signatureFromPrimitiveType):
25084         (KJS::Bindings::JNITypeFromPrimitiveType):
25085         (KJS::Bindings::getJNIField):
25086         (KJS::Bindings::convertValueToJValue):
25087         * bindings/jni/jni_utility.h:
25088         * bindings/jni_jsobject.cpp:
25089         (KJS::Bindings::JSObject::invoke):
25090         (KJS::Bindings::JSObject::JSObject):
25091         (KJS::Bindings::JSObject::call):
25092         (KJS::Bindings::JSObject::eval):
25093         (KJS::Bindings::JSObject::getMember):
25094         (KJS::Bindings::JSObject::setMember):
25095         (KJS::Bindings::JSObject::removeMember):
25096         (KJS::Bindings::JSObject::getSlot):
25097         (KJS::Bindings::JSObject::setSlot):
25098         (KJS::Bindings::JSObject::toString):
25099         (KJS::Bindings::JSObject::finalize):
25100         (KJS::Bindings::JSObject::createNative):
25101         (KJS::Bindings::JSObject::convertValueToJObject):
25102         (KJS::Bindings::JSObject::convertJObjectToValue):
25103         (KJS::Bindings::JSObject::listFromJArray):
25104         * bindings/jni_jsobject.h:
25105         * bindings/runtime.cpp:
25106         * bindings/runtime.h:
25107         * bindings/runtime_method.cpp:
25108         * bindings/runtime_method.h:
25109
25110 === Safari-118 ===
25111
25112 2003-12-16  Richard Williamson   <rjw@apple.com>
25113
25114         Ack!  More assertions.  Lock ALL entry points into the interpreter!
25115         (3511733).
25116
25117         Reviewed by Ken.
25118
25119         * bindings/jni_jsobject.cpp:
25120         (Bindings::JSObject::call):
25121         (Bindings::JSObject::eval):
25122         (Bindings::JSObject::getMember):
25123         (Bindings::JSObject::setMember):
25124         (Bindings::JSObject::removeMember):
25125         (Bindings::JSObject::getSlot):
25126         (Bindings::JSObject::setSlot):
25127         (Bindings::JSObject::convertJObjectToValue):
25128
25129 2003-12-15  Richard Williamson   <rjw@apple.com>
25130
25131         Fixed a couple of snafus and removed some logging.
25132
25133         Reviewed by Maciej.
25134
25135         * bindings/jni_jsobject.cpp:
25136         (Bindings::performJavaScriptAccess):
25137         (Bindings::completedJavaScriptAccess):
25138         (Bindings::dispatchToJavaScriptThread):
25139         Removed some annoying JS_LOG clutter.
25140
25141         (Bindings::RootObject::removeAllJavaReferencesForRoot):
25142         Fixed allocation of key buffer that was called after it was needed.
25143
25144         (Bindings::JSObject::invoke):
25145         (Bindings::JSObject::JSObject):
25146         (Bindings::JSObject::getMember):
25147         (Bindings::JSObject::getSlot):
25148         Added additional interpreter locks around getMember and getSlot. 
25149         These functions may cause allocation of JS impls.  
25150
25151 2003-12-15  Richard Williamson   <rjw@apple.com>
25152
25153         args weren't passed to 'call' invocation.  d'oh.
25154         lock interpreter when we create instances of JS impls.        
25155
25156         Reviewed by Maciej.
25157
25158         * bindings/jni_jsobject.cpp:
25159         (Bindings::JSObject::call):
25160         (Bindings::JSObject::eval):
25161         (Bindings::JSObject::getMember):
25162         (Bindings::JSObject::setMember):
25163         (Bindings::JSObject::getSlot):
25164         (Bindings::JSObject::convertValueToJObject):
25165         (Bindings::JSObject::convertJObjectToValue):
25166         (Bindings::JSObject::listFromJArray):
25167         * bindings/jni_jsobject.h:
25168
25169 2003-12-15  Richard Williamson   <rjw@apple.com>
25170
25171         Last piece of LiveConnect!  This checkin adds implementation
25172         of the Java to JavaScript object conversion functions.
25173
25174         Reviewed by John.
25175
25176         * bindings/jni/jni_instance.cpp:
25177         (JavaInstance::invokeMethod):
25178         * bindings/jni/jni_utility.cpp:
25179         * bindings/jni/jni_utility.h:
25180         * bindings/jni_jsobject.cpp:
25181         (Bindings::JSObject::invoke):
25182         (Bindings::JSObject::call):
25183         (Bindings::JSObject::eval):
25184         (Bindings::JSObject::getMember):
25185         (Bindings::JSObject::setMember):
25186         (Bindings::JSObject::getSlot):
25187         (Bindings::JSObject::setSlot):
25188         (Bindings::JSObject::createNative):
25189         (Bindings::JSObject::convertValueToJObject):
25190         (Bindings::JSObject::convertJObjectToValue):
25191         (Bindings::JSObject::listFromJArray):
25192         * bindings/jni_jsobject.h:
25193         (Bindings::):
25194         * bindings/runtime_method.cpp:
25195         (RuntimeMethodImp::get):
25196         (RuntimeMethodImp::codeType):
25197         (RuntimeMethodImp::execute):
25198
25199 2003-12-12  Richard Williamson   <rjw@apple.com>
25200
25201         Added implementation of stubs in JSObject.  All that
25202         remains is a couple of simple conversion functions stubs and
25203         we're done with LiveConnect.  Also, changed string passing to
25204         JS to use uchars instead of chars.  
25205
25206         Reviewed by Maciej.
25207
25208         * bindings/jni/jni_runtime.h:
25209         (Bindings::JavaString::JavaString):
25210         (Bindings::JavaString::_commonInit):
25211         (Bindings::JavaString::_commonCopy):
25212         (Bindings::JavaString::_commonDelete):
25213         (Bindings::JavaString::~JavaString):
25214         (Bindings::JavaString::operator=):
25215         (Bindings::JavaString::uchars):
25216         (Bindings::JavaString::length):
25217         (Bindings::JavaString::ustring):
25218         * bindings/jni/jni_utility.cpp:
25219         (getUCharactersFromJStringInEnv):
25220         (releaseUCharactersForJStringInEnv):
25221         (convertValueToJObject):
25222         (convertJObjectToValue):
25223         * bindings/jni/jni_utility.h:
25224         * bindings/jni_jsobject.cpp:
25225         (Bindings::JSObject::invoke):
25226         (Bindings::JSObject::call):
25227         (Bindings::JSObject::eval):
25228         (Bindings::JSObject::getMember):
25229         (Bindings::JSObject::setMember):
25230         (Bindings::JSObject::removeMember):
25231         (Bindings::JSObject::getSlot):
25232         (Bindings::JSObject::setSlot):
25233         * bindings/jni_jsobject.h:
25234
25235 2003-12-12  Richard Williamson   <rjw@apple.com>
25236
25237         Ensure that all calls from Java into JavaScript are
25238         performed on a designated thread (the main thread).
25239
25240         Reviewed by Ken.
25241
25242         * bindings/jni_jsobject.cpp:
25243         (isJavaScriptThread):
25244         (rootForImp):
25245         (Bindings::performJavaScriptAccess):
25246         (Bindings::completedJavaScriptAccess):
25247         (Bindings::initializeJavaScriptAccessLock):
25248         (Bindings::lockJavaScriptAccess):
25249         (Bindings::unlockJavaScriptAccess):
25250         (Bindings::dispatchToJavaScriptThread):
25251         (Bindings::RootObject::setFindRootObjectForNativeHandleFunction):
25252         (Bindings::RootObject::removeAllJavaReferencesForRoot):
25253         (Bindings::JSObject::invoke):
25254         (Bindings::JSObject::JSObject):
25255         (Bindings::JSObject::call):
25256         (Bindings::JSObject::eval):
25257         (Bindings::JSObject::getMember):
25258         (Bindings::JSObject::setMember):
25259         (Bindings::JSObject::removeMember):
25260         (Bindings::JSObject::getSlot):
25261         (Bindings::JSObject::setSlot):
25262         (Bindings::JSObject::toString):
25263         (Bindings::JSObject::finalize):
25264         (Bindings::JSObject::getWindow):
25265         * bindings/jni_jsobject.h:
25266         (Bindings::RootObject::~RootObject):
25267         (Bindings::RootObject::findRootObjectForNativeHandleFunction):
25268         (Bindings::RootObject::runLoop):
25269         (Bindings::RootObject::performJavaScriptSource):
25270         (Bindings::):
25271
25272 2003-12-11  Richard Williamson   <rjw@apple.com>
25273
25274         Added support for calling a JavaScript function from
25275         Java.  Right now this only works for void func(void)
25276         functions, but the conversion of args and return values
25277         will come shortly.
25278
25279         Cleaned up and verified reference counting scheme, and
25280         dereferencing of vended JavaScript objects when applet is
25281         destroyed (actually when part is destroyed).
25282         
25283         Removed link hack for testkjs now that the Java folks think
25284         they have a solution for the 1.4.2 JavaVM link problem.  Although
25285         Greg B. thinks his solution may cause problems for the 1.3.1
25286         version of the VM!?!
25287
25288         Reviewed by Ken.
25289
25290         * Makefile.am:
25291         * bindings/jni/jni_runtime.h:
25292         (Bindings::JavaString::JavaString):
25293         * bindings/jni/jni_utility.cpp:
25294         (convertValueToJValue):
25295         (convertValueToJObject):
25296         (listFromJArray):
25297         * bindings/jni/jni_utility.h:
25298         * bindings/jni_jsobject.cpp:
25299         (KJS_setFindRootObjectForNativeHandleFunction):
25300         (KJS_findRootObjectForNativeHandleFunction):
25301         (getReferencesByRootDictionary):
25302         (getReferencesDictionary):
25303         (findReferenceDictionary):
25304         (rootForImp):
25305         (addJavaReference):
25306         (removeJavaReference):
25307         * bindings/jni_jsobject.h:
25308         (Bindings::RootObject::RootObject):
25309         (Bindings::RootObject::~RootObject):
25310         (Bindings::RootObject::setRootObjectImp):
25311         (Bindings::RootObject::rootObjectImp):
25312         (Bindings::RootObject::setInterpreter):
25313         (Bindings::RootObject::interpreter):
25314
25315 === Safari-117 ===
25316
25317 2003-12-10  Darin Adler  <darin@apple.com>
25318
25319         Reviewed by Maciej.
25320
25321         - fixed regression in JavaScript tests reported by the KDE guys
25322         - fixed 3506345: REGRESSION (115-116): VIP: chordfind.com no longer displays chords
25323
25324         * kjs/ustring.h: Add tolerateEmptyString parameter to toDouble and toULong.
25325         * kjs/ustring.cpp:
25326         (KJS::UString::toDouble): Separate the "tolerant" parameter into two separate ones:
25327         tolerateTrailingJunk and tolerateEmptyString. Add new overloads; better for code size
25328         and binary compatibility than default parameter values.
25329         (KJS::UString::toULong): Pass tolerateEmptyString down to toDouble. Add new overload.
25330
25331         * kjs/string_object.cpp: (StringProtoFuncImp::call): Pass false for the new
25332         "tolerate empty string" parameter.
25333
25334 2003-12-10  Richard Williamson   <rjw@apple.com>
25335
25336         Added code to manage reference counting of JavaScript
25337         objects passed to Java.   Also added implementation of
25338         KJS_JSCreateNativeJSObject.  This is the function that
25339         provides the root object to Java (KJS::Window).
25340
25341         Reviewed by Hyatt.
25342
25343         * JavaScriptCore.pbproj/project.pbxproj:
25344         * bindings/jni_jsobject.cpp:
25345         (KJS_setFindObjectForNativeHandleFunction):
25346         (KJS_findObjectForNativeHandleFunction):
25347         (getReferencesByOwnerDictionary):
25348         (getReferencesDictionary):
25349         (findReferenceDictionary):
25350         (addJavaReference):
25351         (removeJavaReference):
25352         (removeAllJavaReferencesForOwner):
25353         * bindings/jni_jsobject.h:
25354
25355 2003-12-09  Richard Williamson   <rjw@apple.com>
25356
25357         LiveConnect stubs that correspond to the native methods
25358         on JSObject.  These will be called from the new Java plugin
25359         when an instance of JSObject is instantiated and messaged.
25360         When these are implemented the Java will be able to originate
25361         calls into JavaScript.
25362
25363         Also a temporary work-around added to Makefile.am to solve
25364         a link problem.  The 1.4.2 JavaVM accidentally links against
25365         libobjc.  This call a failure linking testkjs.  Mike Hay is
25366         working with someone to fix the problem (3505587).
25367
25368         Reviewed by Chris.
25369
25370         * JavaScriptCore.pbproj/project.pbxproj:
25371         * Makefile.am:
25372         * bindings/jni_jsobject.cpp: Added.
25373         (KJS_JSCreateNativeJSObject):
25374         (KJS_JSObject_JSFinalize):
25375         (KJS_JSObject_JSObjectCall):
25376         (KJS_JSObject_JSObjectEval):
25377         (KJS_JSObject_JSObjectGetMember):
25378         (KJS_JSObject_JSObjectSetMember):
25379         (KJS_JSObject_JSObjectRemoveMember):
25380         (KJS_JSObject_JSObjectGetSlot):
25381         (KJS_JSObject_JSObjectSetSlot):
25382         (KJS_JSObject_JSObjectToString):
25383         * bindings/jni_jsobject.h: Added.
25384
25385 2003-12-09  Maciej Stachowiak  <mjs@apple.com>
25386
25387         Reviewed by John.
25388
25389         <rdar://problem/3505183>: JavaScriptCore should assert that interpreter is locked in collector
25390
25391         * kjs/collector.cpp:
25392         (KJS::Collector::allocate): Assert that interpreter lock count is not 0.
25393         (KJS::Collector::collect): likewise
25394
25395 2003-12-08  Richard Williamson   <rjw@apple.com>
25396
25397         LiveConnect:  The last piece of the JavaScript side of the
25398         LiveConnect implementation.  This change adds support for
25399         setting/getting values from Java arrays in JavaScript.
25400
25401         Reviewed by John.
25402
25403         * bindings/jni/jni_instance.h:
25404         * bindings/jni/jni_runtime.cpp:
25405         (JavaField::JavaField):
25406         (convertJObjectToArray):
25407         (JavaArray::JavaArray):
25408         (JavaArray::~JavaArray):
25409         (JavaArray::setValueAt):
25410         (JavaArray::valueAt):
25411         (JavaArray::getLength):
25412         * bindings/jni/jni_runtime.h:
25413         (Bindings::JavaArray::operator=):
25414         (Bindings::JavaArray::javaArray):
25415         * bindings/jni/jni_utility.cpp:
25416         (JNITypeFromPrimitiveType):
25417         (convertValueToJValue):
25418         * bindings/jni/jni_utility.h:
25419         * bindings/runtime.h:
25420         * bindings/runtime_array.cpp:
25421         (RuntimeArrayImp::RuntimeArrayImp):
25422         (RuntimeArrayImp::~RuntimeArrayImp):
25423         (RuntimeArrayImp::get):
25424         (RuntimeArrayImp::put):
25425         (RuntimeArrayImp::hasProperty):
25426         * bindings/runtime_array.h:
25427         (KJS::RuntimeArrayImp::getLength):
25428         (KJS::RuntimeArrayImp::getConcreteArray):
25429         * bindings/runtime_object.cpp:
25430         (RuntimeObjectImp::get):
25431         (RuntimeObjectImp::canPut):
25432         (RuntimeObjectImp::hasProperty):
25433
25434 2003-12-05  Richard Williamson   <rjw@apple.com>
25435
25436         LiveConnect:  Part 1 of supporting JS bindings to
25437         native language arrays.
25438
25439         Reviewed by Chris.
25440
25441         * JavaScriptCore.pbproj/project.pbxproj:
25442         * bindings/jni/jni_runtime.cpp:
25443         (JavaField::JavaField):
25444         (convertJObjectToArray):
25445         (JavaField::valueFromInstance):
25446         (JavaField::setValueToInstance):
25447         * bindings/jni/jni_runtime.h:
25448         * bindings/runtime.cpp:
25449         (Instance::setValueOfField):
25450         * bindings/runtime.h:
25451         (Bindings::Array::~Array):
25452
25453 2003-12-04  Richard Williamson   <rjw@apple.com>
25454
25455         LiveConnect:  Moved defaultValue into concrete implementation because
25456         more intelligent conversion can be perform with knowledge
25457         of the class of the original instance.
25458
25459         Reviewed by Chris.
25460
25461         * bindings/jni/jni_class.cpp:
25462         (JavaClass::isNumberClass):
25463         (JavaClass::isBooleanClass):
25464         (JavaClass::isStringClass):
25465         * bindings/jni/jni_class.h:
25466         * bindings/jni/jni_instance.cpp:
25467         (JavaInstance::defaultValue):
25468         (JavaInstance::valueOf):
25469         * bindings/jni/jni_instance.h:
25470         (Bindings::JavaInstance::javaInstance):
25471         * bindings/runtime.h:
25472         * bindings/runtime_object.cpp:
25473         (RuntimeObjectImp::defaultValue):
25474
25475 2003-12-04  Richard Williamson   <rjw@apple.com>
25476
25477         LiveConnect:  Added support for setting the value of Java
25478         fields.
25479
25480         Reviewed by Chris.
25481
25482         * bindings/jni/jni_instance.cpp:
25483         (JavaInstance::invokeMethod):
25484         * bindings/jni/jni_runtime.cpp:
25485         (JavaParameter::JavaParameter):
25486         (JavaField::JavaField):
25487         (JavaField::valueFromInstance):
25488         (JavaField::setValueToInstance):
25489         (JavaMethod::JavaMethod):
25490         * bindings/jni/jni_runtime.h:
25491         (Bindings::JavaField::getJNIType):
25492         * bindings/jni/jni_utility.cpp:
25493         (JNITypeFromClassName):
25494         (convertValueToJValue):
25495         * bindings/jni/jni_utility.h:
25496         * bindings/runtime.cpp:
25497         (Instance::setValueOfField):
25498         * bindings/runtime.h:
25499         * bindings/runtime_object.cpp:
25500         (RuntimeObjectImp::get):
25501         (RuntimeObjectImp::put):
25502         (RuntimeObjectImp::defaultValue):
25503
25504 2003-12-04  Richard Williamson   <rjw@apple.com>
25505
25506         Added support for string conversions.
25507         Changed various JavaString member variables to be inline.
25508         Implemented defaultValue for context relevant type coercion.
25509
25510         Reviewed by Chris.
25511
25512         * bindings/jni/jni_class.cpp:
25513         (JavaClass::JavaClass):
25514         (JavaClass::setClassName):
25515         (JavaClass::classForInstance):
25516         * bindings/jni/jni_class.h:
25517         * bindings/jni/jni_instance.cpp:
25518         (JavaInstance::stringValue):
25519         (JavaInstance::numberValue):
25520         (JavaInstance::booleanValue):
25521         (JavaInstance::invokeMethod):
25522         * bindings/jni/jni_instance.h:
25523         * bindings/jni/jni_runtime.cpp:
25524         (JavaParameter::JavaParameter):
25525         (JavaField::JavaField):
25526         (JavaMethod::JavaMethod):
25527         (appendClassName):
25528         (JavaMethod::signature):
25529         * bindings/jni/jni_runtime.h:
25530         (Bindings::JavaString::JavaString):
25531         (Bindings::JavaString::~JavaString):
25532         (Bindings::JavaString::operator=):
25533         (Bindings::JavaString::characters):
25534         (Bindings::JavaParameter::JavaParameter):
25535         (Bindings::JavaParameter::~JavaParameter):
25536         (Bindings::JavaParameter::operator=):
25537         (Bindings::JavaParameter::type):
25538         (Bindings::JavaField::JavaField):
25539         (Bindings::JavaField::~JavaField):
25540         (Bindings::JavaField::operator=):
25541         (Bindings::JavaField::name):
25542         (Bindings::JavaField::type):
25543         (Bindings::JavaMethod::JavaMethod):
25544         (Bindings::JavaMethod::_commonDelete):
25545         (Bindings::JavaMethod::name):
25546         (Bindings::JavaMethod::returnType):
25547         * bindings/jni/jni_utility.cpp:
25548         (convertValueToJValue):
25549         * bindings/runtime.h:
25550         (Bindings::Instance::valueOf):
25551         * bindings/runtime_method.cpp:
25552         (RuntimeMethodImp::call):
25553         * bindings/runtime_object.cpp:
25554         (RuntimeObjectImp::RuntimeObjectImp):
25555         (RuntimeObjectImp::get):
25556         (RuntimeObjectImp::defaultValue):
25557         * bindings/runtime_object.h:
25558         (KJS::RuntimeObjectImp::classInfo):
25559
25560 === Safari-116 ===
25561
25562 2003-12-03  Richard Williamson   <rjw@apple.com>
25563
25564         LiveConnect:  Added support for parameter passing to Java and conversion
25565         of return values.
25566
25567         Reviewed by Chris.
25568
25569         * bindings/jni/jni_instance.cpp:
25570         (JavaInstance::invokeMethod):
25571         * bindings/jni/jni_instance.h:
25572         * bindings/jni/jni_runtime.cpp:
25573         (JavaParameter::JavaParameter):
25574         (JavaMethod::JavaMethod):
25575         (JavaMethod::signature):
25576         * bindings/jni/jni_runtime.h:
25577         (Bindings::JavaParameter::JavaParameter):
25578         (Bindings::JavaParameter::operator=):
25579         (Bindings::JavaParameter::getJNIType):
25580         * bindings/jni/jni_utility.cpp:
25581         (callJNIBooleanMethodA):
25582         (convertValueToJValue):
25583         * bindings/jni/jni_utility.h:
25584         * bindings/runtime.h:
25585         * bindings/runtime_method.cpp:
25586         (RuntimeMethodImp::call):
25587         * bindings/runtime_object.cpp:
25588         (RuntimeObjectImp::get):
25589
25590 2003-12-02  Richard Williamson   <rjw@apple.com>
25591
25592         Added support for calling simple methods in Java from JavaScript.
25593         (void return and no parameters).  Yay, LiveConnect lives.
25594
25595         Still need write argument and return value conversion code.
25596
25597         Reviewed by Chris.
25598
25599         * JavaScriptCore.pbproj/project.pbxproj:
25600         * bindings/jni/jni_instance.cpp:
25601         (JavaInstance::getClass):
25602         (JavaInstance::invokeMethod):
25603         * bindings/jni/jni_instance.h:
25604         * bindings/jni/jni_runtime.cpp:
25605         (JavaMethod::JavaMethod):
25606         (JavaMethod::signature):
25607         (JavaMethod::JNIReturnType):
25608         * bindings/jni/jni_runtime.h:
25609         (Bindings::JavaMethod::_commonDelete):
25610         (Bindings::JavaMethod::_commonCopy):
25611         (Bindings::JavaMethod::name):
25612         * bindings/jni/jni_utility.cpp:
25613         (signatureFromPrimitiveType):
25614         * bindings/jni/jni_utility.h:
25615         * bindings/runtime.h:
25616         * bindings/runtime_method.cpp: Added.
25617         (RuntimeMethodImp::RuntimeMethodImp):
25618         (RuntimeMethodImp::~RuntimeMethodImp):
25619         (RuntimeMethodImp::get):
25620         (RuntimeMethodImp::implementsCall):
25621         (RuntimeMethodImp::call):
25622         (RuntimeMethodImp::codeType):
25623         (RuntimeMethodImp::execute):
25624         * bindings/runtime_method.h: Added.
25625         * bindings/runtime_object.cpp:
25626         (RuntimeObjectImp::RuntimeObjectImp):
25627         (RuntimeObjectImp::get):
25628         * bindings/runtime_object.h:
25629         * kjs/function.cpp:
25630         (FunctionImp::FunctionImp):
25631         * kjs/interpreter.h:
25632
25633 2003-12-01  Darin Adler  <darin@apple.com>
25634
25635         Reviewed by Maciej.
25636
25637         - fixed 3493799: JavaScript string.replace expands $ if it's the last character in replacement string
25638
25639         * kjs/ustring.cpp: (KJS::UString::toDouble): Fix backwards handling of the "tolerant" boolean.
25640         This indirectly caused the string.replace bug.
25641
25642 2003-12-02  Maciej Stachowiak  <mjs@apple.com>
25643
25644         Merged patches from Harri Porten and David Faure to fix:
25645
25646         <rdar://problem/3497643>: reproducible crash printing self-referential array
25647         
25648         * kjs/array_object.cpp:
25649         (ArrayProtoFuncImp::call): Break out of the loop if an exception was thrown.
25650         * kjs/nodes.cpp:
25651         (FunctionCallNode::evaluate): Move function call depth check from here...
25652         * kjs/object.cpp:
25653         (KJS::Object::call): ...to here.
25654         * kjs/object.h: Un-inline Object::call now that it does more.
25655
25656 2003-12-01  Richard Williamson   <rjw@apple.com>
25657
25658         Fixed mistake in method signatures used to get boolean and integer fields.
25659
25660         Reviewed by Chris.
25661
25662         * bindings/jni/jni_runtime.cpp:
25663         (JavaField::valueFromInstance):
25664
25665 2003-12-01  Richard Williamson   <rjw@apple.com>
25666
25667 Fixed parameter passing to applet.  Child elements are NOT valid in setStyle().  So we now create the widget before needed with createWidgetIfNecessary.  This either happens when doing the first layout, or when JavaScript first references the applet element.
25668
25669 Fixed early delete of the the main applet instance.  When the JS collector cleaned up the last JS object referring to the applet instance we were deleting the java instance.  This caused the applet instance cached on the applet element to be invalid.  The applet instance is the only Java object not to be cleaned up by the JS collector.
25670
25671 Added support for getting at Java object fields.
25672
25673         Reviewed by Chris.
25674
25675         * JavaScriptCore.pbproj/project.pbxproj:
25676         * Makefile.am:
25677         * bindings/jni/jni_instance.cpp:
25678         (JObjectWrapper::JObjectWrapper):
25679         * bindings/jni/jni_instance.h:
25680         (Bindings::JObjectWrapper::~JObjectWrapper):
25681         * bindings/jni/jni_runtime.cpp:
25682         (JavaField::valueFromInstance):
25683         * bindings/runtime_object.cpp:
25684         (RuntimeObjectImp::~RuntimeObjectImp):
25685         (RuntimeObjectImp::RuntimeObjectImp):
25686         (RuntimeObjectImp::get):
25687         (RuntimeObjectImp::deleteProperty):
25688         * bindings/runtime_object.h:
25689
25690 === Safari-115 ===
25691
25692 2003-11-21  Maciej Stachowiak  <mjs@apple.com>
25693
25694         Patch from Harri Porten, reviewed by me.
25695
25696         - fixed 3491712 - String slice with negative arguments does not offset from end of string
25697         
25698         * kjs/string_object.cpp:
25699         (StringProtoFuncImp::call): Handle negative arguments as offsets from end by
25700         adding length and clamping to [0,length-1].
25701
25702 2003-11-21  Maciej Stachowiak  <mjs@apple.com>
25703
25704         Patch from Harri Porten, reviewed by me.
25705
25706         - fixed 3491709 - using Function.apply with a primitive type as the arg list causes crash
25707         
25708         * kjs/function_object.cpp:
25709         (FunctionProtoFuncImp::call): Nest parentheses properly.
25710
25711 2003-11-20  Richard Williamson   <rjw@apple.com>
25712
25713         More LiveConnect stuff.  Primitive Java fields are now
25714         accessible from JavaScript!  Yay!
25715
25716         Reviewed by Maciej.
25717
25718         * bindings/jni/jni_class.cpp:
25719         (JavaClass::methodNamed):
25720         (JavaClass::fieldNamed):
25721         * bindings/jni/jni_class.h:
25722         (Bindings::JavaClass::_commonDelete):
25723         * bindings/jni/jni_instance.cpp:
25724         (JavaInstance::JavaInstance):
25725         (JavaInstance::~JavaInstance):
25726         (JavaInstance::getClass):
25727         * bindings/jni/jni_instance.h:
25728         (Bindings::JavaInstance::javaInstance):
25729         * bindings/jni/jni_runtime.cpp:
25730         (JavaField::JavaField):
25731         (JavaField::valueFromInstance):
25732         * bindings/jni/jni_runtime.h:
25733         (Bindings::JavaField::JavaField):
25734         (Bindings::JavaField::~JavaField):
25735         (Bindings::JavaField::operator=):
25736         * bindings/jni/jni_utility.cpp:
25737         (callJNIMethod):
25738         (callJNIMethodA):
25739         (callJNIVoidMethod):
25740         (callJNIObjectMethod):
25741         (callJNIBooleanMethod):
25742         (callJNIByteMethod):
25743         (callJNICharMethod):
25744         (callJNIShortMethod):
25745         (callJNIIntMethod):
25746         (callJNILongMethod):
25747         (callJNIFloatMethod):
25748         (callJNIDoubleMethod):
25749         (callJNIVoidMethodA):
25750         (callJNIObjectMethodA):
25751         (callJNIByteMethodA):
25752         (callJNICharMethodA):
25753         (callJNIShortMethodA):
25754         (callJNIIntMethodA):
25755         (callJNILongMethodA):
25756         (callJNIFloatMethodA):
25757         (callJNIDoubleMethodA):
25758         (releaseCharactersForJStringInEnv):
25759         (primitiveTypeFromClassName):
25760         (getJNIField):
25761         * bindings/jni/jni_utility.h:
25762         * bindings/runtime.cpp:
25763         (Instance::createBindingForLanguageInstance):
25764         (Instance::getValueOfField):
25765         * bindings/runtime.h:
25766         * bindings/runtime_object.cpp:
25767         (RuntimeObjectImp::get):
25768
25769 2003-11-20  Richard Williamson   <rjw@apple.com>
25770
25771         More LiveConnect stuff.
25772
25773         Reviewed by Chris.
25774
25775         * bindings/jni/jni_class.cpp:
25776         (JavaClass::classForName):
25777         (JavaClass::classForInstance):
25778         * bindings/jni/jni_instance.cpp:
25779         (JavaInstance::getValueOfField):
25780         * bindings/jni/jni_instance.h:
25781         (Bindings::JObjectWrapper::JObjectWrapper):
25782         * bindings/jni/jni_runtime.h:
25783         (Bindings::JavaConstructor::~JavaConstructor):
25784         (Bindings::JavaConstructor::operator=):
25785         (Bindings::JavaMethod::JavaMethod):
25786         (Bindings::JavaMethod::_commonDelete):
25787         (Bindings::JavaMethod::signature):
25788         * bindings/jni/jni_utility.cpp:
25789         (getJNIEnv):
25790         (attachToJavaVM):
25791         * bindings/jni/jni_utility.h:
25792         * bindings/runtime.h:
25793         * bindings/runtime_object.cpp:
25794         (RuntimeObjectImp::~RuntimeObjectImp):
25795         (RuntimeObjectImp::get):
25796         * bindings/runtime_object.h:
25797
25798 2003-11-19  Richard Williamson   <rjw@apple.com>
25799
25800         More LiveConnect stuff.
25801
25802         Reviewed by Ken.
25803
25804         * JavaScriptCore.pbproj/project.pbxproj:
25805         * bindings/jni/jni_class.cpp: Added.
25806         (JavaClass::_commonInit):
25807         (JavaClass::JavaClass):
25808         (_createClassesByNameIfNecessary):
25809         (JavaClass::classForName):
25810         (JavaClass::classForInstance):
25811         (JavaClass::methodNamed):
25812         (JavaClass::fieldNamed):
25813         * bindings/jni/jni_class.h: Added.
25814         (Bindings::JavaClass::_commonDelete):
25815         (Bindings::JavaClass::~JavaClass):
25816         (Bindings::JavaClass::_commonCopy):
25817         (Bindings::JavaClass::JavaClass):
25818         (Bindings::JavaClass::operator=):
25819         (Bindings::JavaClass::name):
25820         (Bindings::JavaClass::constructorAt):
25821         (Bindings::JavaClass::numConstructors):
25822         * bindings/jni/jni_instance.cpp: Added.
25823         (JavaInstance::JavaInstance):
25824         (JavaInstance::~JavaInstance):
25825         * bindings/jni/jni_instance.h: Added.
25826         (Bindings::JObjectWrapper::JObjectWrapper):
25827         (Bindings::JObjectWrapper::~JObjectWrapper):
25828         (Bindings::JObjectWrapper::ref):
25829         (Bindings::JObjectWrapper::deref):
25830         (Bindings::JavaInstance::getClass):
25831         (Bindings::JavaInstance::operator=):
25832         * bindings/jni/jni_runtime.cpp:
25833         (JavaMethod::JavaMethod):
25834         * bindings/jni/jni_runtime.h:
25835         (Bindings::JavaString::JavaString):
25836         (Bindings::JavaString::~JavaString):
25837         (Bindings::JavaString::operator=):
25838         * bindings/jni/jni_utility.cpp:
25839         (getJavaVM):
25840         (getJNIEnv):
25841         (getCharactersFromJString):
25842         (releaseCharactersForJString):
25843         (getCharactersFromJStringInEnv):
25844         (releaseCharactersForJStringInEnv):
25845         * bindings/jni/jni_utility.h:
25846         * bindings/runtime.cpp:
25847         (Instance::createBindingForLanguageInstance):
25848         * bindings/runtime.h:
25849         (Bindings::Instance::):
25850
25851 2003-11-18  Richard Williamson   <rjw@apple.com>
25852
25853         More live connect stubs.  We're getting close.
25854
25855         Reviewed by Chris.
25856
25857         * JavaScriptCore.pbproj/project.pbxproj:
25858         * bindings/jni/jni_runtime.cpp:
25859         (JavaClass::JavaClass):
25860         (JavaInstance::JavaInstance):
25861         (JavaInstance::~JavaInstance):
25862         * bindings/jni/jni_runtime.h:
25863         (Bindings::JavaConstructor::value):
25864         (Bindings::JavaField::value):
25865         (Bindings::JavaMethod::value):
25866         (Bindings::JavaClass::_commonDelete):
25867         (Bindings::JavaClass::_commonCopy):
25868         (Bindings::JavaClass::methodNamed):
25869         (Bindings::JavaClass::fieldNamed):
25870         (Bindings::JavaInstance::getClass):
25871         * bindings/runtime.cpp: Added.
25872         * bindings/runtime.h:
25873         (Bindings::Instance::~Instance):
25874         * bindings/runtime_object.cpp: Added.
25875         (RuntimeObjectImp::classInfo):
25876         (RuntimeObjectImp::RuntimeObjectImp):
25877         (RuntimeObjectImp::get):
25878         (RuntimeObjectImp::put):
25879         (RuntimeObjectImp::canPut):
25880         (RuntimeObjectImp::hasProperty):
25881         (RuntimeObjectImp::deleteProperty):
25882         (RuntimeObjectImp::defaultValue):
25883         (RuntimeObjectImp::_initializeClassInfoFromInstance):
25884         * bindings/runtime_object.h: Added.
25885         (KJS::RuntimeObjectImp::setInternalInstance):
25886         (KJS::RuntimeObjectImp::getInternalInstance):
25887         * kjs/object.cpp:
25888         (KJS::ObjectImp::get):
25889         (KJS::ObjectImp::hasProperty):
25890         * kjs/value.h:
25891         (KJS::):
25892
25893 2003-11-17  Maciej Stachowiak  <mjs@apple.com>
25894
25895         Patch from Harri, reviewed by me.
25896
25897         - fixed 3487375 - backwards array slice causes infinite loop
25898         
25899         * kjs/array_object.cpp:
25900         (ArrayProtoFuncImp::call):
25901
25902 2003-11-17  Maciej Stachowiak  <mjs@apple.com>
25903
25904         Patch from Harri Porten reviewed by me.
25905
25906         - fixed 3487371 - operator precedence for bitwise or, xor and and is wrong
25907
25908         * kjs/grammar.y: Correct the precedence.
25909
25910 2003-11-16  Maciej Stachowiak  <mjs@apple.com>
25911
25912         Reviewed by John.
25913
25914         - fixed 3483829 - JavaScriptCore needs workaround to compile on Merlot
25915         
25916         * JavaScriptCore.pbproj/project.pbxproj: Add -Wno-long-double to
25917         warning flags.
25918
25919 === Safari-114 ===
25920
25921 2003-11-13  Richard Williamson   <rjw@apple.com>
25922
25923         Factored common code between copy constructor and assignment operator.
25924
25925         Reviewed by Chris.
25926
25927         * ChangeLog:
25928         * bindings/jni/jni_runtime.h:
25929         (Bindings::JavaConstructor::_commonCopy):
25930         (Bindings::JavaConstructor::JavaConstructor):
25931         (Bindings::JavaConstructor::operator=):
25932         (Bindings::JavaField::type):
25933         * bindings/runtime.h:
25934
25935 2003-11-13  Richard Williamson   <rjw@apple.com>
25936
25937         More LiveConnect stuff.  This checkin adds abstract classes to model
25938         language runtimes and a JNI based set of concrete implementations for
25939         Java.
25940
25941         Reviewed by Chris.
25942
25943         * JavaScriptCore.pbproj/project.pbxproj:
25944         * Makefile.am:
25945         * bindings/Makefile.am: Removed.
25946         * bindings/jni/Makefile.am: Removed.
25947         * bindings/jni/jni_runtime.cpp: Added.
25948         (JavaField::JavaField):
25949         (JavaConstructor::JavaConstructor):
25950         (JavaMethod::JavaMethod):
25951         (JavaClass::JavaClass):
25952         * bindings/jni/jni_runtime.h: Added.
25953         (Bindings::JavaString::JavaString):
25954         (Bindings::JavaString::~JavaString):
25955         (Bindings::JavaString::operator=):
25956         (Bindings::JavaString::characters):
25957         (Bindings::JavaParameter::JavaParameter):
25958         (Bindings::JavaParameter::~JavaParameter):
25959         (Bindings::JavaParameter::operator=):
25960         (Bindings::JavaParameter::type):
25961         (Bindings::JavaConstructor::JavaConstructor):
25962         (Bindings::JavaConstructor::~JavaConstructor):
25963         (Bindings::JavaConstructor::operator=):
25964         (Bindings::JavaConstructor::parameterAt):
25965         (Bindings::JavaConstructor::numParameters):
25966         (Bindings::JavaField::JavaField):
25967         (Bindings::JavaField::~JavaField):
25968         (Bindings::JavaField::operator=):
25969         (Bindings::JavaField::name):
25970         (Bindings::JavaField::type):
25971         (Bindings::JavaMethod::JavaMethod):
25972         (Bindings::JavaMethod::_commonDelete):
25973         (Bindings::JavaMethod::~JavaMethod):
25974         (Bindings::JavaMethod::_commonCopy):
25975         (Bindings::JavaMethod::operator=):
25976         (Bindings::JavaMethod::name):
25977         (Bindings::JavaMethod::returnType):
25978         (Bindings::JavaMethod::parameterAt):
25979         (Bindings::JavaMethod::numParameters):
25980         (Bindings::JavaClass::_commonDelete):
25981         (Bindings::JavaClass::~JavaClass):
25982         (Bindings::JavaClass::_commonCopy):
25983         (Bindings::JavaClass::JavaClass):
25984         (Bindings::JavaClass::operator=):
25985         (Bindings::JavaClass::name):
25986         (Bindings::JavaClass::methodAt):
25987         (Bindings::JavaClass::numMethods):
25988         (Bindings::JavaClass::constructorAt):
25989         (Bindings::JavaClass::numConstructors):
25990         (Bindings::JavaClass::fieldAt):
25991         (Bindings::JavaClass::numFields):
25992         * bindings/jni/jni_utility.cpp:
25993         (callJNIMethod):
25994         (callJNIMethodA):
25995         (callJNIObjectMethod):
25996         (callJNIByteMethod):
25997         (callJNICharMethod):
25998         (callJNIShortMethod):
25999         (callJNIIntMethod):
26000         (callJNILongMethod):
26001         (callJNIFloatMethod):
26002         (callJNIDoubleMethod):
26003         (callJNIVoidMethodA):
26004         (callJNIObjectMethodA):
26005         (callJNIByteMethodA):
26006         (callJNICharMethodA):
26007         (callJNIShortMethodA):
26008         (callJNIIntMethodA):
26009         (callJNILongMethodA):
26010         (callJNIFloatMethodA):
26011         (callJNIDoubleMethodA):
26012         (getCharactersFromJString):
26013         (releaseCharactersForJString):
26014         * bindings/jni/jni_utility.h:
26015         * bindings/objc/Makefile.am: Removed.
26016         * bindings/runtime.h: Added.
26017         (Bindings::Parameter::~Parameter):
26018         (Bindings::Constructor::~Constructor):
26019         (Bindings::Field::~Field):
26020         (Bindings::Method::~Method):
26021         (Bindings::Class::~Class):
26022
26023 2003-11-13  Maciej Stachowiak  <mjs@apple.com>
26024
26025         Reviewed by John.
26026
26027         - fixed 3472562 - Null or Undefined variables passed to IN operator cause javascript exceptions
26028         
26029         * kjs/nodes.cpp:
26030         (ForInNode::execute): If the in value is null or undefined, bail
26031         out early, since attempting to iterate its properties will throw
26032         an exception.
26033
26034 2003-11-12  Darin Adler  <darin@apple.com>
26035
26036         - fixed the build
26037
26038         * Makefile.am: Fix the build by removing the bindings directory from SUBDIRS.
26039         Later, we can either add this back and add the Makefile.am files to the top
26040         level configure.in or leave it out and remove the Makefile.am files.
26041
26042 2003-11-12  Richard Williamson   <rjw@apple.com>
26043
26044         Added utility functions for calling JNI methods.
26045
26046         Reviewed by Chris.
26047
26048         * JavaScriptCore.pbproj/project.pbxproj:
26049         * Makefile.am:
26050         * bindings/Makefile.am: Added.
26051         * bindings/jni/Makefile.am: Added.
26052         * bindings/jni/jni_utility.cpp: Added.
26053         (attachToJavaVM):
26054         (callJNIMethod):
26055         (callJNIVoidMethod):
26056         (callJNIObjectMethod):
26057         (callJNIByteMethod):
26058         (callJNICharMethod):
26059         (callJNIShortMethod):
26060         (callJNIIntMethod):
26061         (callJNILongMethod):
26062         (callJNIFloatMethod):
26063         (callJNIDoubleMethod):
26064         * bindings/jni/jni_utility.h: Added.
26065         * bindings/objc/Makefile.am: Added.
26066
26067 2003-11-08  Darin Adler  <darin@apple.com>
26068
26069         Reviewed by John.
26070
26071         - fixed 3477528 -- array.sort(function) fails if the function returns a non-zero value that rounds to zero
26072
26073         * kjs/array_object.cpp:
26074         (compareByStringForQSort): Added checks for undefined values to match what the specification calls for.
26075         (compareWithCompareFunctionForQSort): Added checks for undefined values as above, and also changed the
26076         code that looks at the compare function result to look at the number returned without rounding to an integer.
26077         (ArrayProtoFuncImp::call): Changed the code that looks at the compare function result to look at the number
26078         returned without rounding to an integer.
26079
26080 === Safari-113 ===
26081
26082 2003-11-03  Vicki Murley <vicki@apple.com>
26083
26084         Reviewed by kocienda.
26085
26086         - fixed <rdar://problem/3471096>: non-B&I builds should not use order files, because they cause false "regressions" in perf.
26087
26088         * JavaScriptCore.pbproj/project.pbxproj: added empty SECTORDER_FLAGS variables to the Development and Deployment build styles
26089
26090 2003-11-02  Darin Adler  <darin@apple.com>
26091
26092         Reviewed by Maciej.
26093
26094         - changed list manipulation to use Harri Porten's idea of a circular
26095           linked list that is built from head to tail rather than building the
26096           list backwards and reversing the list when done
26097
26098         * kjs/grammar.y: Handle CatchNode and FinallyNode in a type-safe way.
26099         Change many places that passed 0L to pass nothing at all, or to pass 0.
26100
26101         * kjs/nodes.h:
26102         (KJS::ElementNode::ElementNode): Build a circular list instead of a 0-terminated
26103         backwards list.
26104         (KJS::ArrayNode::ArrayNode): Break the circular list instead of reversing the list.
26105         (KJS::PropertyValueNode::PropertyValueNode): Moved before ObjectLiteralNode so the
26106         inline code in ObjectLiteralNode works. Build a circular list instead of a 0-terminated
26107         backwards list. Made the case for the first node separate so we don't need a nil check.
26108         (KJS::ObjectLiteralNode::ObjectLiteralNode): Break the circular list instead of
26109         reversing the list.
26110         (KJS::ArgumentListNode::ArgumentListNode): Build a circular list instead of a 0-terminated
26111         backwards list. Also, made the constructors inline (moved here from .cpp file).
26112         (KJS::ArgumentsNode::ArgumentsNode): Break the circular list instead of
26113         reversing the list.
26114         (KJS::NewExprNode::NewExprNode): Changed a 0L to 0.
26115         (KJS::StatListNode::StatListNode): Make this constructor no longer inline (moved into
26116         .cpp file). The one in the .cpp file builds a circular list instead of a 0-terminated
26117         backwards list.
26118         (KJS::VarDeclListNode::VarDeclListNode): Build a circular list instead of a 0-terminated
26119         backwards list.
26120         (KJS::VarStatementNode::VarStatementNode): Break the circular list instead of reversing
26121         the list.
26122         (KJS::BlockNode::BlockNode): Make this constructor no longer inline (moved into .cpp file).
26123         The one in the .cpp file breaks the list instead of reversing it.
26124         (KJS::ForNode::ForNode): Break the circular list instead of reversing the list.
26125         (KJS::CaseClauseNode::CaseClauseNode): Break the circular list instead of reversing the
26126         list.
26127         (KJS::ClauseListNode::ClauseListNode): Build a circular list instead of a 0-terminated
26128         backwards list.
26129         (KJS::CaseBlockNode::CaseBlockNode): Make this constructor no longer inline (moved into
26130         .cpp file). The one in the .cpp file breaks the list instead of reversing it.
26131         (KJS::TryNode::TryNode): Changed constructor to take typed parameters for the catch and
26132         finally nodes rather than just Node.
26133         (KJS::ParameterNode::ParameterNode): Build a circular list instead of a 0-terminated
26134         backwards list.
26135         (KJS::FuncDeclNode::FuncDeclNode): Break the circular list instead of reversing the
26136         list.
26137         (KJS::FuncExprNode::FuncExprNode): Break the circular list instead of reversing the
26138         list.
26139
26140         * kjs/nodes.cpp:
26141         (StatListNode::StatListNode): Moved this constructor here, no longer inline.
26142         Did the "break circular list" thing instead of the "reverse list" thing.
26143         Added setLoc calls to match KJS in the KDE tree; since we don't currently
26144         use the JavaScript debugging support, it's unclear whether there's any benefit, but
26145         later we might be using it and it's good to be as close as possible.
26146         (BlockNode::BlockNode): Moved this constructor here, no longer inline.
26147         Did the "break circular list" thing instead of the "reverse list" thing.
26148         Added setLoc calls.
26149         (CaseBlockNode::CaseBlockNode): Moved this constructor here, no longer inline.
26150         Did the "break circular list" thing instead of the "reverse list" thing.
26151         (SourceElementsNode::SourceElementsNode): Moved this constructor here, no longer inline.
26152         Did the "break circular list" thing instead of the "reverse list" thing.
26153         Added setLoc calls.
26154
26155         * kjs/grammar.cpp: Regenerated.
26156         * kjs/grammar.cpp.h: Regenerated.
26157         * kjs/grammar.h: Regenerated.
26158
26159 === Safari-112 ===
26160
26161 2003-10-30  Maciej Stachowiak  <mjs@apple.com>
26162
26163         Reviewed by Ken.
26164
26165         - fixed 3427069 - browsing mp3.com causes leaks (KJS)
26166         
26167         * kjs/string_object.cpp:
26168         (StringProtoFuncImp::call): Don't do an early return, since that
26169         could leak a temporary regexp.
26170
26171 2003-10-29  Maciej Stachowiak  <mjs@apple.com>
26172
26173         Reviewed by Darin.
26174
26175         - fixed 3426076 - Leak of JS lexer data visiting http://www.ebay.com
26176         
26177         * kjs/grammar.cpp:
26178         (yyerror): Updated the commented code.
26179         * kjs/grammar.y: Don't delete string and identifier tokens when done
26180         with them any more, they'll get cleaned up by the lexer now.
26181         * kjs/internal.cpp:
26182         (Parser::parse): Tell lexer when done parsing.
26183         * kjs/lexer.cpp:
26184         (Lexer::Lexer): Initialize new data members.
26185         (Lexer::lex): Use new methods to make strings and identifiers, and
26186         save them.
26187         (Lexer::makeIdentifier): Make a new Identifier and save it in an
26188         auto-growing array.
26189         (Lexer::makeUString): Likewise for UStrings.
26190         (Lexer::doneParsing): Clean up arrays of Ifentifiers and UStrings.
26191         * kjs/lexer.h:
26192
26193 2003-10-28  Maciej Stachowiak  <mjs@apple.com>
26194
26195         Reviewed by Ken.
26196
26197         - fixed 3413962 -  malicious web pages can kill all future JavaScript execution by breaking recursion limit check
26198         
26199         * kjs/nodes.cpp:
26200         (FunctionCallNode::evaluate): If we're going to return early due
26201         to breaking the recursion limit, make sure to lower it again, or
26202         it will creep up by one each time it's exceeded.
26203
26204 2003-10-26  Darin Adler  <darin@apple.com>
26205
26206         * JavaScriptCorePrefix.h: Added a C case to the NULL definition since we use C as well
26207         as C++ in this project.
26208
26209 2003-10-26  Darin Adler  <darin@apple.com>
26210
26211         - rolled in some CString changes Harri Porten did on the KDE side
26212
26213         * kjs/ustring.cpp:
26214         (KJS::CString::CString): Use memcpy instead of strcpy for speed. Fix an off by one error
26215         in the copy constructor.
26216         (KJS::CString::operator=): Use memcpy instead of strcpy for speed.
26217
26218         * JavaScriptCorePrefix.h: Add a definition of NULL here that takes advantage of the GNU
26219         __null feature even if the system C library doesn't.
26220
26221 == Rolled over to ChangeLog-2003-10-25 ==