bb37e630d55941d734de10838b22d3b19d6592ec
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2006-04-08  Alexey Proskuryakov  <ap@nypop.com>
2
3         Reviewed by Darin.
4
5         An attempt to fix Win32 build - ICU uses wchar_t on Windows, so we need a type cast.
6
7         * kxmlcore/unicode/icu/UnicodeIcu.h:
8         (KXMLCore::Unicode::toLower):
9         (KXMLCore::Unicode::toUpper):
10
11 2006-04-08  Alexey Proskuryakov  <ap@nypop.com>
12
13         Reviewed by Darin.
14
15         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8264
16         toLowerCase and toUpperCase don't honor special mappings
17
18         Test: fast/js/string-capitalization.html
19
20         * JavaScriptCore.xcodeproj/project.pbxproj: Added KXMLCore::Unicode headers to the project.
21         * icu/unicode/putil.h: Added (copied from WebCore).
22         * icu/unicode/uiter.h: Ditto.
23         * icu/unicode/ustring.h: Ditto.
24         * kjs/string_object.cpp:
25         (StringProtoFunc::callAsFunction): Use the new KXMLCore::Unicode::toUpper() and toLower().
26         * kjs/ustring.cpp: Removed unused (and evil) UChar::toLower() and toUpper().
27         * kjs/ustring.h: Ditto.
28
29         * kxmlcore/unicode/Unicode.h: Corrected capitalization of the word Unicode.
30         * kxmlcore/unicode/UnicodeCategory.h: Renamed include guard macro to match file name.
31
32         * kxmlcore/unicode/icu/UnicodeIcu.h:
33         (KXMLCore::Unicode::toLower): Work on strings, not individual characters. Use ICU root locale.
34         (KXMLCore::Unicode::toUpper): Ditto.
35         (KXMLCore::Unicode::isFormatChar): Use int32_t, which can hold a complete code point.
36         (KXMLCore::Unicode::isSeparatorSpace): Ditto.
37         (KXMLCore::Unicode::category): Ditto.
38         * kxmlcore/unicode/qt4/UnicodeQt4.h:
39         (KXMLCore::Unicode::toLower): Work on strings, not individual characters.
40         (KXMLCore::Unicode::toUpper): Ditto.
41         (KXMLCore::Unicode::isFormatChar): Use int32_t, which can hold a complete code point.
42         (KXMLCore::Unicode::isSeparatorSpace): Ditto.
43         (KXMLCore::Unicode::category): Ditto.
44
45         * tests/mozilla/ecma/String/15.5.4.12-1.js: Corrected expected results.
46         * tests/mozilla/ecma/String/15.5.4.12-5.js: Corrected expected results.
47
48 2006-04-05  Darin Adler  <darin@apple.com>
49
50         - attempt to fix Windows build
51
52         * kxmlcore/HashMap.h: (KXMLCore::HashMap::remove): Use (*it). instead of it->.
53         * kxmlcore/HashSet.h: (KXMLCore::HashSet::remove): Ditto.
54
55 2006-04-05  Darin Adler  <darin@apple.com>
56
57         - attempt to fix Windows build
58
59         * os-win32/stdint.h: Add int8_t, uint8_t, int64_t.
60
61 2006-04-05  Darin Adler  <darin@apple.com>
62
63         Reviewed by Maciej.
64
65         - fix memory leak introduced by the previous change
66
67         * kxmlcore/HashTable.h: Specialize NeedsRef so that it correctly returns true when
68         the value in question is a pair where one of the pair needs a ref and the other
69         of the pair does not.
70
71 2006-04-05  Darin Adler  <darin@apple.com>
72
73         Reviewed by Maciej.
74
75         - JavaScriptCore part of fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=8049
76           StringImpl hash traits deleted value creates an init routine for WebCore
77           <rdar://problem/4442248> REGRESSION: WebCore has init routines (8049)
78
79         Change HashMap and HashSet implementation so they fold various types together.
80         This allows us to implement maps and sets that use RefPtr<WebCore::StringImpl>
81         and WebCore::String in terms of the underlying raw pointer type, and hence use
82         -1 for the deleted value.
83
84         * kxmlcore/HashTraits.h: Added a new type to HashTraits, StorageTraits, which is a
85         type to be used when storing a value that has the same layout as the type itself.
86         This is used only for non-key cases. In the case of keys, the hash function must also
87         be considered. Moved emptyValue out of GenericHashTraitsBase into GenericHashTraits.
88         Added a new bool to HashTraits, needsRef, which indicates whether the type needs
89         explicit reference counting. If the type itself has needsRef true, but the storage
90         type has needsRef false, then the HashSet or HashMap has to handle the reference
91         counting explicitly. Added hash trait specializations for all signed integer values
92         that give -1 as the deleted value. Gave all integers StorageTraits of the canonical
93         integer type of the same size so int and long will share code. Gave all pointers and
94         RefPtrs StorageTraits of the appropriately sized integer type. Removed redundant
95         TraitType and emptyValue definitions in the pointer specialization for HashTraits.
96         Added PairBaseHashTraits, which doesn't try to set up needsDestruction and deletedValue.
97         Useful for types where we don't want to force the existence of deletedValue, such as
98         the type of a pair in a HashMap which is not the actual storage type. Removed an
99         unneeded parameter from the DeletedValueAssigner template. Added HashKeyStorageTraits
100         template, which determines what type can be used to store a given hash key type with
101         a given hash function, and specialized it for pointers and RefPtr so that pointer
102         hash tables share an underlying HashTable that uses IntHash.
103
104         * kxmlcore/HashTable.h: Added HashTableConstIteratorAdapter, HashTableIteratorAdapter,
105         NeedsRef, RefCountManagerBase, RefCountManager, HashTableRefCountManagerBase, and
106         HashTableRefCountManager. All are used by both HashSet and HashMap to handle hash
107         tables where the type stored is not the same as the real value type.
108         
109         * kxmlcore/HashFunctions.h: Added a new struct named IntTypes that finds an
110         integer type given a sizeof value. Renamed pointerHash to intHash and made it
111         use overloading and take integer parameters. Added an IntHash struct which is
112         a hash function that works for integers. Changed PtrHash to call IntHash with
113         an appropriately sized integer. Made IntHash the default hash function for
114         many integer types. Made PtrHash the default hash function for RefPtr as well
115         as for raw pointers.
116
117         * kxmlcore/HashSet.h: Changed implementation to use a separate "storage type"
118         derived from the new traits. The HashTable will use the storage type and all
119         necessary translation and ref/deref is done at the HashSet level. Also reorganized
120         the file so that the HashSet is at the top and has no inline implementation inside
121         it so it's easy to read the interface to HashSet.
122
123         * kxmlcore/HashMap.h: Changed implementation to use a separate "storage type"
124         derived from the new traits. The HashTable will use the storage type and all
125         necessary translation and ref/deref is done at the HashMap level. Also reorganized
126         the file so that the HashMap is at the top and has no inline implementation inside
127         it so it's easy to read the interface to HashMap.
128
129         * kxmlcore/HashMapPtrSpec.h: Removed. Superceded by optimizations in HashMap itself.
130
131         * JavaScriptCore.xcodeproj/project.pbxproj: Remove HashMapPtrSpec.h, resort files,
132         and also remove some unnecessary build settings from the aggregate target that
133         generates derived sources.
134         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
135
136 2006-04-04  Timothy Hatcher  <timothy@apple.com>
137
138         Reviewed by Darin.
139
140         The Debug and Release frameworks are now built with install paths relative to the build products directory.
141         This removes the need for other projects to build with -framework WebCore and -framework JavaScriptCore. 
142
143         * JavaScriptCore.xcodeproj/project.pbxproj:
144
145 2006-04-04  Eric Seidel  <eseidel@apple.com>
146
147         Reviewed by ggaren.
148
149         Fix win32 build.
150         Disable ASSERT redefinition warnings for now.
151
152         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
153         * kxmlcore/Assertions.h:
154
155 2006-04-04  Bjrn Graf  <bjoern.graf@gmail.com>
156
157         Reviewed by ggaren & darin.  Landed by eseidel.
158
159         Integrate CURL version of gettimeofday
160         http://bugzilla.opendarwin.org/show_bug.cgi?id=7399
161         Disable crash report dialogs for testkjs.exe in Release mode
162         http://bugzilla.opendarwin.org/show_bug.cgi?id=8113
163
164         * kjs/testkjs.cpp:
165         (StopWatch::start):
166         (StopWatch::stop):
167         (StopWatch::getElapsedMS):
168         (main):
169         (kjsmain):
170
171 2006-04-04  Eric Seidel  <eseidel@apple.com>
172
173         Reviewed by mjs.
174
175         * kjs/number_object.cpp:
176         (NumberProtoFunc::callAsFunction): remove trunc() to fix win32.
177
178 2006-03-12  Maciej Stachowiak  <mjs@apple.com>
179
180         Reviewed by Darin.
181         
182         - fixed "toPrecision sometimes messes up the last digit on intel Macs"
183         http://bugzilla.opendarwin.org/show_bug.cgi?id=7748
184
185         * kjs/number_object.cpp:
186         (intPow10): Compute integer powers of 10 using exponentiation by squaring.
187         (NumberProtoFunc::callAsFunction): Use intPow10(n) in place of all pow(10.0, n),
188         plus a bit of refactoring.
189
190 2006-04-03  Darin Adler  <darin@apple.com>
191
192         - tweak config.h and Platform.h to try to get buildbot working
193           (making some small changes at the same time)
194
195         * kjs/config.h: Removed now-unneeded HAVE_ICU.
196         * kxmlcore/Platform.h: Tweak how platform gets set up. Move all the
197         USE stuff to the end.
198
199 2006-04-03  George Staikos   <staikos@opensource.apple.com>
200
201         Reviewed by Maciej.
202
203         Fix Win32 build breakage from previous commit, remove unused forward.
204
205 2006-04-03  George Staikos   <staikos@opensource.apple.com>
206
207         Reviewed by Maciej.
208
209         Implement a unicode abstraction layer to make JavaScriptCore much more
210         easily ported to other platforms without having to take in libicu.  Also
211         makes the unicode related code easier to understand.
212
213 2006-04-03  Timothy Hatcher  <timothy@apple.com>
214
215         Reviewed by Adele.
216
217         Fixes <rdar://problem/4498338> JavaScriptCore fails to compile for ppc64
218         Other 64 bit build fixes.
219
220         * kjs/collector.cpp:
221         (KJS::Collector::markOtherThreadConservatively): test for __DARWIN_UNIX03 and use __r1
222         * kjs/dtoa.cpp:
223         (Bigint::): cast PRIVATE_mem to unsigned to prevent warning
224         * bindings/jni/jni_utility.cpp:
225         (KJS::Bindings::getJavaVM): cast jniError to long to prevent format warning
226         (KJS::Bindings::getJNIEnv): cast jniError to long to prevent format warning
227         * bindings/runtime_root.cpp:
228         (KJS::Bindings::addNativeReference): cast CFDictionaryGetValue to unsigned long to prevent warning
229         (KJS::Bindings::removeNativeReference): cast CFDictionaryGetValue to unsigned long to prevent warning
230
231 2006-03-31  Darin Adler  <darin@apple.com>
232
233         Reviewed by Geoff.
234
235         - <rdar://problem/4395622> API: WebScriptObject.h incorrectly reports that -isSelectorExcludedFromWebScript returns NO by default
236
237         * bindings/objc/WebScriptObject.h: Fixed comment.
238
239 2006-03-31  Eric Seidel  <eseidel@apple.com>
240
241         Reviewed by mjs.
242
243         A bit more code cleanup.
244
245         * bindings/c/c_utility.cpp:
246         (KJS::Bindings::convertValueToNPVariant):
247         * bindings/objc/objc_runtime.mm:
248         (convertValueToObjcObject):
249         * bindings/objc/objc_utility.mm:
250         (KJS::Bindings::convertValueToObjcValue):
251         * kjs/function.cpp:
252         (KJS::GlobalFuncImp::callAsFunction):
253         * kjs/interpreter.cpp:
254         (KJS::ExecState::lexicalInterpreter):
255         * kjs/interpreter.h:
256         * kjs/operations.cpp:
257         (KJS::equal):
258
259 2006-03-30  Eric Seidel  <eseidel@apple.com>
260
261         Reviewed by anders.
262
263         Small code-style update.
264
265         * kjs/operations.cpp:
266         (KJS::isNaN):
267         (KJS::isInf):
268         (KJS::isPosInf):
269         (KJS::isNegInf):
270         (KJS::equal):
271         (KJS::strictEqual):
272         (KJS::relation):
273         (KJS::maxInt):
274         (KJS::minInt):
275         (KJS::add):
276         (KJS::mult):
277
278 2006-03-31  Anders Carlsson  <andersca@mac.com>
279
280         Reviewed by Maciej.
281
282         Make sure the GetterSetterImp objects are marked as well.
283         
284         * kjs/internal.cpp:
285         (KJS::GetterSetterImp::mark):
286         Call JSCell::mark().
287
288 2006-03-30  Eric Seidel  <eseidel@apple.com>
289
290         Reviewed by ggaren.
291
292         * kjs/nodes.h: Some various small style fixes.
293
294 2006-03-30  Eric Seidel  <eseidel@apple.com>
295
296         Reviewed by ggaren.
297
298         Clean-up style issues in node.h, remove redundant initializations.
299
300         * kjs/nodes.h:
301         (KJS::StatementNode::evaluate):
302         (KJS::ArrayNode::ArrayNode):
303         (KJS::ObjectLiteralNode::ObjectLiteralNode):
304         (KJS::ArgumentsNode::ArgumentsNode):
305         (KJS::NewExprNode::NewExprNode):
306         (KJS::CaseClauseNode::CaseClauseNode):
307         (KJS::FuncDeclNode::FuncDeclNode):
308
309 2006-03-30  Tim Omernick  <timo@apple.com>
310
311         Reviewed by Geoff.
312
313         <rdar://problem/4212626> REGRESSION: LIVECONNECT: JavaScript type for Java Strings is function,
314         not object
315
316         * bindings/runtime.h:
317         (KJS::Bindings::Instance::implementsCall):
318         New method.  Returns false by default.  Concrete subclasses can override this return true when
319         the bound object may be called as a function.
320         (KJS::Bindings::Instance::invokeDefaultMethod):
321         Since bound objects are no longer treated as functions by default, we can return jsUndefined()
322         here instead of in concrete subclasses that decide not to implement the default method
323         functionality.
324
325         * bindings/runtime_object.cpp:
326         (RuntimeObjectImp::implementsCall):
327         Don't assume that the bound object is a function; instead, let the object instance decide whether
328         it is callable.
329
330         * bindings/c/c_instance.h:
331         * bindings/c/c_instance.cpp:
332         (KJS::Bindings::CInstance::implementsCall):
333         The object is callable if its class has an invokeDefault function.
334
335         * bindings/objc/objc_instance.h:
336         * bindings/objc/objc_instance.mm:
337         (ObjcInstance::implementsCall):
338         The object is callable if the ObjC instance responds to -invokeDefaultMethodWithArguments:.
339
340         * bindings/jni/jni_instance.h:
341         * bindings/jni/jni_instance.cpp:
342         Moved bogus invokeDefaultMethod() to superclass.
343
344 2006-03-29  Geoffrey Garen  <ggaren@apple.com>
345
346         Reviewed by Darin.
347
348         - JavaScriptCore side of fix for <rdar://problem/4308243> 8F36 
349         Regression: crash in malloc_consolidate if you use a .PAC file
350
351         The crash was a result of threaded deallocation of thread-unsafe
352         objects. Pure JS objects are thread-safe because all JS execution
353         is synchronized through JSLock. However, JS objects that wrap WebCore 
354         objects are thread-unsafe because JS and WebCore execution are not 
355         synchronized.  That unsafety comes into play when the collector 
356         deallocates a JS object that wraps a WebCore object, thus causing the 
357         WebCore object to be deallocated.
358
359         The solution here is to have each JSCell know whether it is safe to
360         collect on a non-main thread, and to avoid collecting unsafe cells
361         when on a non-main thread.
362
363         We don't have a way to test PAC files yet, so there's no test
364         attached to this patch.
365
366         * kjs/collector.cpp:
367         (KJS::Collector::collect):
368         (1) Added the test "currentThreadIsMainThread || 
369         imp->m_destructorIsThreadSafe". 
370
371         * kjs/protect.h:
372         (KJS::gcProtectNullTolerant):
373         (KJS::gcUnprotectNullTolerant):
374         * kjs/value.h:
375         (KJS::JSCell::JSCell): The bools here must be bitfields, otherwise
376         m_destructorIsThreadSafe becomes another whole word, ruining the
377         collector optimizations we've made based on the size of a JSObject.
378         * kxmlcore/FastMalloc.cpp:
379         (KXMLCore::currentThreadIsMainThread):
380         (KXMLCore::fastMallocRegisterThread):
381         * kxmlcore/FastMalloc.h:
382
383 2006-03-28  Darin Adler  <darin@apple.com>
384
385         Reviewed by Geoff.
386
387         - change some code that resulted in init routines on Mac OS X -- if the framework has
388           init routines it will use memory and slow down applications that link with WebKit
389           even in cases where those applications don't use WebKit
390
391         * kjs/date_object.cpp: Changed constants that were derived by multiplying other constants
392         to use immediate numbers instead. Apparently, double constant expressions of the type we
393         had here are evaluated at load time.
394
395         * kjs/list.cpp: Can't use OwnArrayPtr in ListImp because of the global instances of
396         ListImp, so go back to using a plain old pointer.
397         (KJS::List::List): Set overflow to 0 when initializing ListImp.
398         (KJS::List::release): Replace a clear call with a delete and explicit set to 0.
399         (KJS::List::append): Use raw pointers, and do a delete [] instead of finessing it with
400         a swap of OwnArrayPtr.
401         (KJS::List::copyFrom): Remove now-unneeded get().
402         (KJS::List::copyTail): Ditto.
403
404         * kjs/ustring.cpp: Changed UString::Rep::empty initializer a bit so that it doesn't get
405         a static initializer routine. Had to get rid of one level of constant to get the compiler
406         to understand it could initialize without any code.
407
408         - added a build step that checks for init routines
409
410         * JavaScriptCore.xcodeproj/project.pbxproj: Deleted now-unused custom build rule that
411         was replaced by the generate-derived-sources script a while back. Added a custom build
412         phase that invokes the check-for-global-initializers script.
413
414 2006-03-28  Timothy Hatcher  <timothy@apple.com>
415
416         Reviewed by Eric.
417
418         fixes <rdar://problem/4458539> Unable to include Security(public) and WebKit(private) headers
419
420         * bindings/npapi.h: added #defines after the #ifndefs
421
422 2006-03-27  Maciej Stachowiak  <mjs@apple.com>
423
424         Reviewed by Anders.
425         
426         - fixed <rdar://problem/4489745> REGRESSION: Safari crashes at to display http://www.lgphilips-lcd.com/
427
428         * kjs/nodes.cpp:
429         (Node::deref): take into account the case where the extra refcount table was never created
430
431 2006-03-23  David Carson <dacarson@gmail.com>
432
433         Reviewed by Darin.
434         
435         - JSObject in LiveConnect not working.
436         http://bugzilla.opendarwin.org/show_bug.cgi?id=7917
437
438         * bindings/jni_jsobject.cpp:
439         (JavaJSObject::convertJObjectToValue): Was trying to retrieve the native pointer from the wrong base
440         class, and the GetFieldID was using the wrong signature.
441
442 2006-03-23  Darin Adler  <darin@apple.com>
443
444         Reviewed by Maciej.
445
446         - fix buildbot
447
448         * JavaScriptCore.xcodeproj/project.pbxproj: Change target name to JavaScriptCore (it was "include"!?).
449         Also add -Y 3 option for linker.
450
451 2006-03-23  Darin Adler  <darin@apple.com>
452
453         Reviewed by Maciej.
454
455         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7726
456           REGRESSION: orbitz calendar fails (JavaScript function serialization/parsing)
457
458         * kjs/object.h: Take function name, as well as source URL and line number, when
459         using the special overloaded construct for making functions.
460         * kjs/object.cpp: (KJS::JSObject::construct): Ditto.
461         * kjs/function_object.h: Ditto.
462         * kjs/function_object.cpp: (FunctionObjectImp::construct): Pass a name when
463         constructing the function rather than null. Use "anonymous" when making a
464         function using the default function constructor.
465
466         * kjs/nodes2string.cpp: (FuncDeclNode::streamTo): Put a line break just before
467         a function declaration.
468
469         - unrelated fix
470
471         * kxmlcore/HashMapPtrSpec.h: Add missing needed friend declaration.
472
473 2006-03-23  Darin Adler  <darin@apple.com>
474
475         Reviewed by Maciej.
476
477         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7805
478           LEAK: method name leaks in KJS::Bindings::CInstance::invokeMethod
479
480         * bindings/c/c_utility.h: Remove NPN_UTF16FromString declaration (not implemented).
481         * bindings/c/c_utility.cpp:
482         (KJS::Bindings::convertValueToNPVariant): Use DOUBLE_TO_NPVARIANT,
483         BOOLEAN_TO_NPVARIANT, VOID_TO_NPVARIANT, NULL_TO_NPVARIANT, and
484         OBJECT_TO_NPVARIANT. In the case of OBJECT, call _NPN_RetainObject in
485         one case and remove a _NPN_ReleaseObject in another because this
486         should return a retained value.
487         (KJS::Bindings::convertNPVariantToValue): Use NPVARIANT_TO_BOOLEAN,
488         NPVARIANT_TO_INT32, and NPVARIANT_TO_DOUBLE.
489
490         * bindings/c/c_runtime.h: Removed implementations of CMethod::name and
491         CField::name that called _NPN_UTF8FromIdentifier and hence leaked.
492         * bindings/c/c_runtime.cpp:
493         (KJS::Bindings::CMethod::name): Added. Returns the string from inside the
494         method object.
495         (KJS::Bindings::CField::name): Added. Returns the string from inside the
496         field object.
497         (KJS::Bindings::CField::valueFromInstance): Added call to _NPN_ReleaseVariantValue
498         on the result of getProperty after using it to fix a storage leak.
499         (KJS::Bindings::CField::setValueToInstance): Added call to _NPN_ReleaseVariantValue
500         after pasing a value to setProperty now that the conversion function does a retain.
501
502         * bindings/c/c_instance.cpp:
503         (KJS::Bindings::CInstance::invokeMethod): Changed to use Vector for a local
504         stack buffer. Removed special case for NPVARIANT_IS_VOID because the
505         convertNPVariantToValue function handles that properly.
506         (KJS::Bindings::CInstance::invokeDefaultMethod): Ditto.
507
508         * bindings/NP_jsobject.h: Formatting changes only.
509         * bindings/NP_jsobject.cpp:
510         (jsDeallocate): Changed parameter type so we don't need a function cast.
511         (_NPN_InvokeDefault): Use VOID_TO_NPVARIANT.
512         (_NPN_Invoke): Use NULL_TO_NPVARIANT and VOID_TO_NPVARIANT.
513         (_NPN_Evaluate): Use VOID_TO_NPVARIANT.
514         (_NPN_GetProperty): Use NULL_TO_NPVARIANT and VOID_TO_NPVARIANT.
515
516         * bindings/c/c_class.cpp: Formatting changes only.
517         * bindings/c/c_class.h: Formatting changes only.
518
519         * bindings/npruntime_priv.h: Removed obsolete and now-unused functions:
520         NPN_VariantIsVoid, NPN_VariantIsNull, NPN_VariantIsUndefined,
521         NPN_VariantIsBool, NPN_VariantIsInt32, NPN_VariantIsDouble,
522         NPN_VariantIsString, NPN_VariantIsObject, NPN_VariantToBool,
523         NPN_VariantToInt32, NPN_VariantToDouble, NPN_VariantToString,
524         NPN_VariantToStringCopy, NPN_VariantToObject, NPN_InitializeVariantAsVoid,
525         NPN_InitializeVariantAsNull, NPN_InitializeVariantAsUndefined,
526         NPN_InitializeVariantWithBool, NPN_InitializeVariantWithInt32,
527         NPN_InitializeVariantWithDouble, NPN_InitializeVariantWithString,
528         NPN_InitializeVariantWithObject, and NPN_InitializeVariantWithVariant.
529         * bindings/npruntime.cpp:
530         (getIntIdentifierDictionary): Don't bother creating custom callbacks for the
531         integer dictionary since the default behavior is fine for integers.
532
533 2006-03-23  Mark Rowe  <opendarwin.org@bdash.net.nz>
534
535         Reviewed and landed by Maciej.
536
537         - WebKit no longer builds with bison 2.1
538         http://bugzilla.opendarwin.org/show_bug.cgi?id=7923
539
540         * generate-derived-sources:  Handle generated header named either grammar.cpp.h
541         or grammar.hpp.
542
543 2006-03-22  Maciej Stachowiak  <mjs@apple.com>
544
545         - fix the build
546
547         * JavaScriptCore.xcodeproj/project.pbxproj:
548
549 2006-03-21  Maciej Stachowiak  <mjs@apple.com>
550
551         * kjs/generate-derived-sources: Set executable property.
552
553 2006-03-21  Maciej Stachowiak  <mjs@apple.com>
554
555         Reviewed by Darin.
556         
557         Ensure that generated source dependencies are handled properly, as follows:
558         
559         - Made an external script that generates the sources into a
560           DerivedSources dir in the build products directory.
561         - Added a new build target that builds all the generated sources
562           if needed. Sadly it has to be a target, not a phase for Xcode to notice changes.
563         - Added the DerivedSources dir in question to the include path.
564         - Added the new DerivedSources dir and its contents to the project as build-relative.
565         
566         * JavaScriptCore.xcodeproj/project.pbxproj:
567         * kjs/generate-derived-sources: Added. Based on the windows version - maybe someday they
568         can share more.
569
570 2006-03-11  Maciej Stachowiak  <mjs@apple.com>
571
572         Reviewed by Darin.
573         
574         - fixed "charAt layout test fails on intel macs; some NaNs are printed as -NaN"
575         http://bugzilla.opendarwin.org/show_bug.cgi?id=7745
576
577         * kjs/ustring.cpp:
578         (KJS::UString::from): Use "NaN" for all NaN values, regardless of sign.
579
580 2006-03-16  Maciej Stachowiak  <mjs@apple.com>
581
582         Reviewed by Darin.
583         
584         - tweaks to my change to redo KJS::Node refcounting
585
586         * kjs/nodes.cpp:
587         (Node::ref):
588         (Node::deref):
589         (Node::refcount):
590         (Node::clearNewNodes):
591         * kjs/nodes.h:
592
593 2006-03-16  Darin Adler  <darin@apple.com>
594
595         Reviewed by Maciej.
596
597         - fixed Vector so that you can pass a reference to something in the vector
598           to the append or insert functions
599
600         * kxmlcore/Vector.h:
601         (KXMLCore::Vector::expandCapacity): Added new overloads that take a pointer to adjust
602         and return the adjusted value of the pointer.
603         (KXMLCore::Vector::append): Pass a pointer when expanding the vector, and use it when
604         adding the new element. Makes the case where the element moves when the vector
605         is expanded work.
606         (KXMLCore::Vector::insert): Ditto.
607
608 2006-03-15  Eric Seidel  <eseidel@apple.com>
609
610         Reviewed by adele.
611
612         Build fix.
613
614         * kjs/date_object.cpp:
615         (KJS::DateProtoFunc::callAsFunction): use size() not "len()"
616
617 2006-03-15  Eric Seidel  <eseidel@apple.com>
618
619         Reviewed by mjs.
620
621         Fix CString copy constructor, fixes Date.parse("") on Win32.
622
623         * kjs/date_object.cpp:
624         (KJS::DateProtoFunc::callAsFunction):
625         * kjs/ustring.cpp:
626         (KJS::CString::CString):
627         (KJS::CString::operator=):
628
629 2006-03-13  Maciej Stachowiak  <mjs@apple.com>
630
631         Reviewed by Anders.
632         
633         - KJS::Node and KJS::StatementNode are bigger than they need to be
634         http://bugzilla.opendarwin.org/show_bug.cgi?id=7775
635
636         The memory usage of Node was reduced by 2 machine words per node:
637
638         - sourceURL was removed and only kept on FunctionBodyNode. The
639         source URL can only be distinct per function or top-level program node, 
640         and you always have one.
641         
642         - refcount was removed and kept in a separate hashtable when
643         greater than 1. newNodes set represents floating nodes with
644         refcount of 0. This helps because almost all nodes have a refcount of 1
645         for almost all of their lifetime.
646         
647         * bindings/runtime_method.cpp:
648         (RuntimeMethod::RuntimeMethod): Pass null body, added FIXME.
649         * kjs/Parser.cpp:
650         (KJS::clearNewNodes): New nodes are tracked in nodes.cpp now, but still clear
651         them at the appropriate time.
652         * kjs/context.h:
653         (KJS::ContextImp::currentBody): added; used to retrieve source URL and sid
654         for current code.
655         (KJS::ContextImp::pushIteration): moved here from LabelStack
656         (KJS::ContextImp::popIteration): ditto
657         (KJS::ContextImp::inIteration): ditto
658         (KJS::ContextImp::pushSwitch): ditto
659         (KJS::ContextImp::popSwitch): ditto
660         (KJS::ContextImp::inSwitch): ditto
661         * kjs/function.cpp:
662         (KJS::FunctionImp::FunctionImp): Add FunctionBodyNode* parameter.
663         (KJS::FunctionImp::callAsFunction): Pass body to ContextImp.
664         (KJS::FunctionImp::argumentsGetter): _context renamed to m_context.
665         (KJS::DeclaredFunctionImp::DeclaredFunctionImp): Pass body to superclass
666         constructor.
667         (KJS::GlobalFuncImp::callAsFunction): Pass progNode as body for ContextImp in
668         eval.
669         * kjs/function.h: Move body field from DeclaredFunctionImp to
670         FunctionImp.
671         * kjs/grammar.y: Change DBG; statements no longer have a sourceid.
672         * kjs/internal.cpp:
673         (KJS::ContextImp::ContextImp): Initialize new m_currentBody, m_iterationDepth
674         and m_switchDepth data members. New FunctionBodyNode* parameter - the
675         function body provides source URL and SourceId.
676         (KJS::InterpreterImp::mark): Use exception() function, not _exception directly.
677         (KJS::InterpreterImp::evaluate): Pass progNode to ContextImp constructor
678         to use as the body.
679         * kjs/internal.h:
680         (KJS::LabelStack::LabelStack): Remove iteration depth and switch depth;
681         statement label stacks don't need these and it bloats their size. Put them
682         in the ContextImp instead.
683         * kjs/interpreter.cpp:
684         (KJS::ExecState::lexicalInterpreter): Renamed _context to m_context.
685         * kjs/interpreter.h:
686         (KJS::ExecState::dynamicInterpreter): Renamed _context to m_context.
687         (KJS::ExecState::context): ditto
688         (KJS::ExecState::setException): Renamed _exception to m_exception
689         (KJS::ExecState::clearException): ditto
690         (KJS::ExecState::exception): ditto
691         (KJS::ExecState::hadException): ditto
692         (KJS::ExecState::ExecState): ditto both above renames
693         * kjs/nodes.cpp:
694         (Node::Node): Removed initialization of line, source URL and refcount. Add to
695         local newNodes set instead of involving parser.
696         (Node::ref): Instead of managing refcount directly, story refcount over 1 in a
697         HashCountedSet, and keep a separate HashSet of "floating" nodes with refcount
698         0.
699         (Node::deref): ditto
700         (Node::refcount): ditto
701         (Node::clearNewNodes): Destroy anything left in the new nodes set.
702         (currentSourceId): Inline helper to get sourceId from function body via context.
703         (currentSourceURL): ditto for sourceURL.
704         (Node::createErrorCompletion): use new helper
705         (Node::throwError): ditto
706         (Node::setExceptionDetailsIfNeeded): ditto
707         (StatementNode::StatementNode): remove initialization of l0 and sid, rename
708         l1 to m_lastLine.
709         (StatementNode::setLoc): Set own m_lastLine and Node's m_line.
710         (StatementNode::hitStatement): Get sid, first line, last line in the proper new ways.
711         (StatListNode::StatListNode): updated for setLoc changes
712         (BlockNode::BlockNode): ditto
713         (DoWhileNode::execute): excpect iteraton counts on ContextImp, not LabelStack
714         (WhileNode::execute): ditto
715         (ForNode::execute): ditto
716         (ForInNode::execute): ditto
717         (ContinueNode::execute): excpect inIteration on ContextImp, not LabelStack
718         (BreakNode::execute): excpect inIteration and inSwitch on ContextImp, not LabelStack
719         (SwitchNode::execute): expect switch counts on ContextImp, not LabelStack
720         (FunctionBodyNode::FunctionBodyNode): update for new setLoc
721         (FunctionBodyNode::processFuncDecl): reindent
722         (SourceElementsNode::SourceElementsNode): update for new setLoc
723         * kjs/nodes.h:
724         (KJS::Node::lineNo): Renamed _line to m_line
725         (KJS::StatementNode::firstLine): Use lineNo()
726         (KJS::StatementNode::lastLine): Renamed l1 to m_lastLine
727         (KJS::FunctionBodyNode::sourceId): added
728         (KJS::FunctionBodyNode::sourceURL): added
729         * kjs/testkjs.cpp:
730
731 2006-03-14  Geoffrey Garen  <ggaren@apple.com>
732
733         - Fixed <rdar://problem/4478239> string sort puts "closed" before 
734         "close"
735
736         Reviewed by Eric.
737
738         * kjs/ustring.cpp:
739         (KJS::compare): Inverted a < in order to treat the longer string as > 
740         the shorter string.
741
742 2006-03-12  Alexey Proskuryakov  <ap@nypop.com>
743
744         Reviewed by Maciej.
745
746         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7708
747         REGRESSION: Flash callback to JavaScript function not working.
748
749         Test: plugins/invoke.html
750
751         * bindings/c/c_utility.cpp:
752         (KJS::Bindings::convertUTF8ToUTF16): Return a correct string length.
753
754 2006-03-08  Eric Seidel  <eseidel@apple.com>
755
756         Reviewed by darin.
757
758         Partially fix JS on win32 by fixing hash table generation.
759
760         * kjs/create_hash_table: limit << results to 32 bits.
761         * kjs/testkjs.cpp:
762         (TestFunctionImp::callAsFunction):
763
764 2006-03-07  Darin Adler  <darin@apple.com>
765
766         * kxmlcore/Vector.h: Quick fix to try to get Windows compiling again.
767
768 2006-03-07  Darin Adler  <darin@apple.com>
769
770         Reviewed by Anders.
771
772         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7655
773           unwanted output while running layout tests
774
775         * kjs/lexer.cpp: (Lexer::lex): Turn off the "yylex: ERROR" message.
776         * kjs/regexp.cpp: (KJS::RegExp::RegExp): Remove the code to log errors from PCRE
777         to standard output. I think we should arrange for the error text to be in JavaScript
778         exceptions instead at some point.
779         * kxmlcore/Vector.h: Add a check for overflow so that we'll abort if we pass a
780         too-large size rather than allocating a buffer smaller than requested.
781
782 2006-03-06  David Carson <dacarson@gmail.com>
783
784         Reviewed by Darin, landed by ap.
785
786         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=7582
787         c_utility.cpp contains CFString OS X platform-dependent code; should use ICU
788
789         Tested with test case from:
790         http://bugzilla.opendarwin.org/show_bug.cgi?id=5163
791
792         * bindings/c_utility.cpp
793         (convertUTF8ToUTF16): Changed to using Unicode converter from ICU, and manual Latin-1 conversion.
794         * icu/unicode/ucnv.h: Copied from WebCore.
795         * icu/unicode/ucnv_err.h: Ditto.
796         * icu/unicode/uenum.h: Ditto.
797
798 2006-03-05  Darin Adler  <darin@apple.com>
799
800         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Updated.
801
802 2006-03-06  Mitz Pettel  <opendarwin.org@mitzpettel.com>
803
804         Fix suggested by Alexey Proskuryakov <ap@nypop.com>, reviewed by Maciej and Hyatt.
805         
806         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7601
807           REGRESSION (r13089): Reproducible crash dereferencing a deallocated element on google image search
808
809         * kxmlcore/Platform.h: Corrected the define to enable USE(MULTIPLE_THREADS) on Mac OS X.
810
811 2006-03-05  Darin Adler  <darin@apple.com>
812
813         Reviewed by Maciej.
814
815         - http://bugzilla.opendarwin.org/show_bug.cgi?id=7616
816           get all references to KJS::Node out of internal.h
817
818         * JavaScriptCore.xcodeproj/project.pbxproj: Updated for file changes.
819
820         * kjs/Parser.cpp: Added.
821         * kjs/Parser.h: Added.
822
823         * kjs/internal.cpp: Removed the Parser class.
824         * kjs/internal.h: Ditto. Also removed unnecessary declarations of classes
825         not used in this header.
826
827         * kjs/nodes.h: Added an include of "Parser.h".
828         * kjs/function.h: Added a declaration of FunctionBodyNode.
829
830 2006-03-05  Geoffrey Garen  <ggaren@apple.com>
831
832         Reviewed by Maciej.
833
834         - JSC support for the fix for <rdar://problem/4467143> JavaScript 
835         enumeration of HTML element properties skips DOM node properties
836
837         * kjs/lookup.h: 
838         (1) Added the KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE macro. The 
839         class definiton macro needs to know about the prototype's prototype so 
840         that the class constructor properly sets it. 
841         (2) Removed the KJS_IMPLEMENT_PROTOTYPE_WITH_PARENT macro. The class
842         implementation macro does not need to know about the prototype's
843         prototype, since getOwnPropertySlot should only look in the current 
844         object's property map, and not its prototype's.
845
846 2006-03-05  Andrew Wellington  <proton@wiretapped.net>
847
848         Reviewed by Eric, landed by ap.
849         
850         - Remove unused breakpoint bool from StatementNodes. No test provided as
851         there is no functionality change.
852
853         * kjs/nodes.cpp:
854         (StatementNode::StatementNode):
855         * kjs/nodes.h:
856
857 2006-03-03  Geoffrey Garen  <ggaren@apple.com>
858
859         Reviewed by Darin.
860
861         - Fixed <rdar://problem/4465598> REGRESSION (TOT): Crash occurs at 
862         http://maps.google.com/?output=html ( KJS::Identifier::add(KJS::UString::Rep*)
863
864         This regression was caused by my fix for 4448098. I failed to account for the
865         deleted entry sentinel in the mehtod that saves the contents of a property map to 
866         the back/forward cache.
867
868         Manual test in WebCore/manual-tests/property-map-save-crash.html
869
870         * kjs/property_map.cpp:
871         (KJS::deletedSentinel): Use 1 instead of -1 to facilitate an easy bit mask
872         (KJS::isValid): New function: checks if a key is null or the deleted sentinel
873         (KJS::PropertyMap::~PropertyMap): Fixed up the branch logic here for readability
874         and a slight performance win
875         (KJS::PropertyMap::clear):
876         (KJS::PropertyMap::rehash):
877         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList):
878         (KJS::PropertyMap::save): Check keys with isValid()
879
880 2006-03-02  Maciej Stachowiak  <mjs@apple.com>
881
882         - now fix mac build again
883
884         * kjs/identifier.cpp:
885
886 2006-03-02  Maciej Stachowiak  <mjs@apple.com>
887
888         Rubber stamped by Anders and Eric.
889
890         - add fpconst.cpp to win32 build, it is now needed
891
892         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
893         * kjs/fpconst.cpp:
894
895 2006-03-02  Maciej Stachowiak  <mjs@apple.com>
896
897         Reviewed by Eric.
898
899         - fix windows build, broken by my last patch
900
901         * kjs/JSImmediate.cpp:
902         * kjs/identifier.cpp:
903         * kxmlcore/FastMalloc.cpp:
904         * kxmlcore/Platform.h:
905
906 2006-03-01  Maciej Stachowiak  <mjs@apple.com>
907
908         Reviewed by Darin.
909         
910         - Set up new prototype macros and avoid using #if without defined() in JSC
911         
912         Added new PLATFORM macros and related, to make sure #if's all check if relevant macros
913         are defined, and to separate core OS-level dependencies from operating environment
914         dependencies so you can, e.g., build KDE on Mac or Windows.
915
916         * kxmlcore/Platform.h: Added.
917
918         - deploy them everywhere in JavaScriptCore
919         
920         * JavaScriptCore.xcodeproj/project.pbxproj:
921         * bindings/jni/jni_utility.cpp:
922         (KJS::Bindings::convertValueToJValue):
923         * bindings/objc/WebScriptObject.mm:
924         * bindings/objc/objc_instance.mm:
925         (ObjcInstance::end):
926         * bindings/softlinking.h:
927         * bindings/testbindings.mm:
928         (main):
929         * kjs/JSLock.cpp:
930         * kjs/collector.cpp:
931         (KJS::Collector::markCurrentThreadConservatively):
932         (KJS::Collector::markOtherThreadConservatively):
933         (KJS::Collector::markStackObjectsConservatively):
934         * kjs/config.h:
935         * kjs/date_object.cpp:
936         (gmtoffset):
937         (KJS::formatTime):
938         (KJS::DateProtoFunc::callAsFunction):
939         (KJS::DateObjectImp::construct):
940         (KJS::makeTime):
941         * kjs/dtoa.cpp:
942         * kjs/fpconst.cpp:
943         (KJS::sizeof):
944         (KJS::):
945         * kjs/grammar.y:
946         * kjs/identifier.cpp:
947         * kjs/internal.cpp:
948         * kjs/interpreter.cpp:
949         (KJS::Interpreter::evaluate):
950         (KJS::Interpreter::createLanguageInstanceForValue):
951         * kjs/interpreter.h:
952         * kjs/lookup.cpp:
953         * kjs/lookup.h:
954         * kjs/math_object.cpp:
955         * kjs/object.cpp:
956         * kjs/object.h:
957         * kjs/operations.cpp:
958         (KJS::isNaN):
959         (KJS::isInf):
960         (KJS::isPosInf):
961         (KJS::isNegInf):
962         * kjs/operations.h:
963         * kjs/regexp.cpp:
964         (KJS::RegExp::RegExp):
965         (KJS::RegExp::~RegExp):
966         (KJS::RegExp::match):
967         * kjs/regexp.h:
968         * kjs/testkjs.cpp:
969         (StopWatch::start):
970         (StopWatch::stop):
971         (StopWatch::getElapsedMS):
972         * kjs/ustring.cpp:
973         * kjs/ustring.h:
974         * kxmlcore/AlwaysInline.h:
975         * kxmlcore/Assertions.cpp:
976         * kxmlcore/Assertions.h:
977         * kxmlcore/FastMalloc.cpp:
978         (KXMLCore::):
979         * kxmlcore/FastMalloc.h:
980         * kxmlcore/FastMallocInternal.h:
981         * kxmlcore/HashTable.h:
982         * kxmlcore/TCPageMap.h:
983         * kxmlcore/TCSpinLock.h:
984         (TCMalloc_SpinLock::Lock):
985         (TCMalloc_SpinLock::Unlock):
986         (TCMalloc_SlowLock):
987         * kxmlcore/TCSystemAlloc.cpp:
988         (TCMalloc_SystemAlloc):
989         * os-win32/stdint.h:
990
991 2006-02-28  Geoffrey Garen  <ggaren@apple.com>
992
993         Reviewed by Darin.
994
995         - Fixed <rdar://problem/4448098> Switch PropertyMap deleted entry 
996         placeholder to -1 from UString::Rep::null
997
998         This turned out to be only a small speedup (.12%). That's within the 
999         margin of error for super accurate JS iBench, but Shark confirms the 
1000         same, so I think it's worth landing.
1001
1002         FYI, I also confirmed that the single entry optimization in 
1003         PropertyMap is a 3.2% speedup.
1004
1005         * kjs/property_map.cpp:
1006         (KJS::PropertyMap::~PropertyMap):
1007         (KJS::PropertyMap::clear):
1008         (KJS::PropertyMap::put):
1009         (KJS::PropertyMap::insert):
1010         (KJS::PropertyMap::rehash):
1011         (KJS::PropertyMap::remove):
1012         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList):
1013         (KJS::PropertyMap::checkConsistency):
1014         * kjs/property_map.h:
1015         (KJS::PropertyMap::deletedSentinel):
1016
1017 2006-02-27  Eric Seidel  <eseidel@apple.com>
1018
1019         Rubber-stamped by darin.
1020
1021         Remove fpconst.cpp, unused on win32 and the cause of linker warnings.
1022
1023         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1024
1025 2006-02-27  Eric Seidel  <eseidel@apple.com>
1026
1027         Reviewed by mjs.
1028
1029         Fix Assertions.cpp to compile on win32.
1030
1031         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1032         * kxmlcore/Assertions.cpp:
1033
1034 2006-02-27  Eric Seidel  <eseidel@apple.com>
1035
1036         Reviewed by mjs.
1037
1038         Made Assertions.cpp platform independent.
1039         Moved mac-specific logging logic up into WebCore.
1040         http://bugzilla.opendarwin.org/show_bug.cgi?id=7503
1041
1042         * JavaScriptCore.xcodeproj/project.pbxproj:
1043         * kxmlcore/Assertions.cpp: Added.
1044         * kxmlcore/Assertions.h:
1045         * kxmlcore/Assertions.mm: Removed.
1046
1047 2006-02-27  Darin Adler  <darin@apple.com>
1048
1049         - fixed Mac Debug build, there was an unused parameter
1050
1051         * kxmlcore/FastMalloc.cpp: (KXMLCore::fastMallocRegisterThread):
1052         Remove parameter name.
1053
1054         * kjs/debugger.h: Fixed comment.
1055
1056 2006-02-27  Eric Seidel  <eseidel@apple.com>
1057
1058         Reviewed by darin.
1059
1060         * kxmlcore/Vector.h:
1061         (KXMLCore::deleteAllValues): fix unused variable warning
1062
1063 2006-02-21  Maciej Stachowiak  <mjs@apple.com>
1064
1065         Reviewed by Darin.
1066         
1067         - Turn off -Wno-unused-param for JavaScriptCore and get rid of unused params
1068         http://bugzilla.opendarwin.org/show_bug.cgi?id=7384
1069
1070         * JavaScriptCore.xcodeproj/project.pbxproj:
1071         * bindings/NP_jsobject.cpp:
1072         (jsAllocate):
1073         (_NPN_InvokeDefault):
1074         (_NPN_Evaluate):
1075         (_NPN_GetProperty):
1076         (_NPN_SetProperty):
1077         (_NPN_RemoveProperty):
1078         (_NPN_HasProperty):
1079         (_NPN_HasMethod):
1080         * bindings/c/c_class.h:
1081         (KJS::Bindings::CClass::constructorAt):
1082         * bindings/c/c_utility.cpp:
1083         (KJS::Bindings::convertNPVariantToValue):
1084         * bindings/jni/jni_class.cpp:
1085         (JavaClass::methodsNamed):
1086         (JavaClass::fieldNamed):
1087         * bindings/jni/jni_instance.cpp:
1088         (JavaInstance::invokeDefaultMethod):
1089         * bindings/jni/jni_jsobject.cpp:
1090         * bindings/jni/jni_objc.mm:
1091         (-[NSObject KJS::Bindings::]):
1092         * bindings/objc/WebScriptObject.mm:
1093         (+[WebUndefined allocWithZone:]):
1094         (-[WebUndefined initWithCoder:]):
1095         (-[WebUndefined encodeWithCoder:]):
1096         (-[WebUndefined copyWithZone:]):
1097         * bindings/objc/objc_class.h:
1098         (KJS::Bindings::ObjcClass::constructorAt):
1099         * bindings/objc/objc_class.mm:
1100         (KJS::Bindings::ObjcClass::methodsNamed):
1101         (KJS::Bindings::ObjcClass::fallbackObject):
1102         * bindings/objc/objc_instance.mm:
1103         (ObjcInstance::getValueOfUndefinedField):
1104         * bindings/objc/objc_runtime.mm:
1105         (ObjcFallbackObjectImp::getOwnPropertySlot):
1106         (ObjcFallbackObjectImp::put):
1107         (ObjcFallbackObjectImp::canPut):
1108         (ObjcFallbackObjectImp::deleteProperty):
1109         (ObjcFallbackObjectImp::toBoolean):
1110         * bindings/runtime.cpp:
1111         (KJS::Bindings::Instance::createLanguageInstanceForValue):
1112         * bindings/runtime.h:
1113         (KJS::Bindings::Instance::getValueOfUndefinedField):
1114         (KJS::Bindings::Instance::setValueOfUndefinedField):
1115         * bindings/runtime_array.cpp:
1116         (RuntimeArray::lengthGetter):
1117         (RuntimeArray::indexGetter):
1118         (RuntimeArray::put):
1119         (RuntimeArray::deleteProperty):
1120         * bindings/runtime_method.cpp:
1121         (RuntimeMethod::lengthGetter):
1122         (RuntimeMethod::execute):
1123         * bindings/runtime_object.cpp:
1124         (RuntimeObjectImp::fallbackObjectGetter):
1125         (RuntimeObjectImp::fieldGetter):
1126         (RuntimeObjectImp::methodGetter):
1127         (RuntimeObjectImp::put):
1128         (RuntimeObjectImp::canPut):
1129         (RuntimeObjectImp::deleteProperty):
1130         (RuntimeObjectImp::defaultValue):
1131         (RuntimeObjectImp::callAsFunction):
1132         * bindings/runtime_root.cpp:
1133         (performJavaScriptAccess):
1134         * kjs/array_object.cpp:
1135         (ArrayInstance::lengthGetter):
1136         (ArrayInstance::getOwnPropertySlot):
1137         (ArrayPrototype::ArrayPrototype):
1138         (ArrayPrototype::getOwnPropertySlot):
1139         * kjs/bool_object.cpp:
1140         (BooleanObjectImp::BooleanObjectImp):
1141         * kjs/date_object.cpp:
1142         (KJS::DateObjectFuncImp::DateObjectFuncImp):
1143         (KJS::DateObjectFuncImp::callAsFunction):
1144         * kjs/error_object.cpp:
1145         (ErrorObjectImp::ErrorObjectImp):
1146         (NativeErrorPrototype::NativeErrorPrototype):
1147         (NativeErrorImp::NativeErrorImp):
1148         * kjs/function.cpp:
1149         (KJS::FunctionImp::argumentsGetter):
1150         (KJS::FunctionImp::lengthGetter):
1151         (KJS::Arguments::mappedIndexGetter):
1152         (KJS::ActivationImp::argumentsGetter):
1153         (KJS::ActivationImp::put):
1154         * kjs/function_object.cpp:
1155         (FunctionObjectImp::FunctionObjectImp):
1156         * kjs/internal.cpp:
1157         (KJS::GetterSetterImp::toPrimitive):
1158         (KJS::GetterSetterImp::toBoolean):
1159         * kjs/interpreter.cpp:
1160         (KJS::Interpreter::evaluate):
1161         * kjs/interpreter.h:
1162         (KJS::Interpreter::isGlobalObject):
1163         (KJS::Interpreter::interpreterForGlobalObject):
1164         (KJS::Interpreter::isSafeScript):
1165         * kjs/lexer.cpp:
1166         (Lexer::makeIdentifier):
1167         (Lexer::makeUString):
1168         * kjs/lookup.h:
1169         (KJS::staticFunctionGetter):
1170         (KJS::staticValueGetter):
1171         * kjs/nodes.cpp:
1172         (StatementNode::processFuncDecl):
1173         (PropertyNode::evaluate):
1174         (PropertyNameNode::evaluate):
1175         * kjs/number_object.cpp:
1176         (NumberObjectImp::NumberObjectImp):
1177         (NumberObjectImp::getOwnPropertySlot):
1178         * kjs/object.cpp:
1179         (KJS::JSObject::defineGetter):
1180         (KJS::JSObject::defineSetter):
1181         (KJS::JSObject::hasInstance):
1182         (KJS::JSObject::propertyIsEnumerable):
1183         * kjs/object_object.cpp:
1184         (ObjectObjectImp::ObjectObjectImp):
1185         * kjs/property_slot.cpp:
1186         (KJS::PropertySlot::undefinedGetter):
1187         (KJS::PropertySlot::functionGetter):
1188         * kjs/reference.cpp:
1189         (KJS::Reference::getPropertyName):
1190         * kjs/reference_list.cpp:
1191         (ReferenceListIterator::operator++):
1192         * kjs/regexp_object.cpp:
1193         (RegExpObjectImp::RegExpObjectImp):
1194         (RegExpObjectImp::getValueProperty):
1195         (RegExpObjectImp::putValueProperty):
1196         * kjs/string_object.cpp:
1197         (StringInstance::lengthGetter):
1198         (StringInstance::indexGetter):
1199         (StringPrototype::StringPrototype):
1200         * kxmlcore/Assertions.mm:
1201         * kxmlcore/FastMalloc.cpp:
1202         (KXMLCore::TCMalloc_PageHeap::CheckList):
1203         * kxmlcore/HashTable.h:
1204         (KXMLCore::HashTableConstIterator::checkValidity):
1205         (KXMLCore::IdentityHashTranslator::translate):
1206         * pcre/pcre_get.c:
1207         (pcre_get_stringnumber):
1208
1209 2006-02-23  Darin Adler  <darin@apple.com>
1210
1211         - try to fix buildbot failure
1212
1213         * bindings/c/c_utility.cpp: Touch this file, which seems to not have been
1214         recompiled after additional inlining was introduced (Xcode bug?).
1215
1216 2006-02-23  Geoffrey Garen  <ggaren@apple.com>
1217
1218         Reviewed by Darin, Maciej.
1219
1220         - Inline some functions suggested by Shark. 2.9% speedup on super
1221         accurate JS iBench.
1222
1223         http://bugzilla.opendarwin.org/show_bug.cgi?id=7411
1224         <rdar://problem/4448116>
1225
1226         * kjs/nodes.h:
1227         (KJS::ArgumentsNode::evaluateList):
1228         * kjs/object.cpp:
1229         * kjs/object.h:
1230         (KJS::ScopeChain::release):
1231         (KJS::JSObject::toPrimitive):
1232         * kjs/scope_chain.cpp:
1233         * kjs/ustring.cpp:
1234         * kjs/ustring.h:
1235         (KJS::UString::toArrayIndex):
1236         * kjs/value.cpp:
1237         * kjs/value.h:
1238         (KJS::JSValue::toObject):
1239         * kxmlcore/FastMalloc.cpp:
1240         (KXMLCore::TCMalloc_ThreadCache_FreeList::Push):
1241         (KXMLCore::TCMalloc_ThreadCache_FreeList::Pop):
1242
1243 2006-02-21  Eric Seidel  <eseidel@apple.com>
1244
1245         Added *.user to ignore list.
1246
1247 2006-02-21  Eric Seidel  <eseidel@apple.com>
1248
1249         Reviewed by ggaren.
1250
1251         Add grammarWrapper.cpp to work around visual studio bug plaguing buildbot.
1252
1253         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1254         * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Added.
1255
1256 2006-02-21  Eric Seidel  <eseidel@apple.com>
1257
1258         Reviewed by ggaren.
1259
1260         * kjs/testkjs.cpp: #if out timeval code on win32
1261
1262 2006-02-21  Michael Emmel  <mike.emmel@gmail.com>
1263
1264         Reviewed by Darin.
1265
1266         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7397
1267           TCPageMap.h would not compile for me because string.h was missing
1268
1269         * kxmlcore/TCPageMap.h: Added <string.h> include.
1270
1271 2006-02-21  Darin Adler  <darin@apple.com>
1272
1273         Reviewed by John Sullivan.
1274
1275         - http://bugzilla.opendarwin.org/show_bug.cgi?id=7404
1276           remove a bunch of extra implementsCall overrides
1277
1278         * JavaScriptCore.xcodeproj/project.pbxproj: Sorted files.
1279
1280         * kjs/internal.h: Made InternalFunctionImp::callAsFunction pure virtual so that
1281         we'll get a compile error if some derived class neglects to implement it.
1282
1283         * kjs/function.cpp: (KJS::FunctionImp::FunctionImp): Remove unneeded initialization
1284         of param, which is an OwnPtr so it gets initialized by default.
1285
1286         * bindings/runtime_method.cpp:
1287         * bindings/runtime_method.h:
1288         * kjs/array_object.cpp:
1289         * kjs/array_object.h:
1290         * kjs/bool_object.cpp:
1291         * kjs/bool_object.h:
1292         * kjs/date_object.cpp:
1293         * kjs/date_object.h:
1294         * kjs/error_object.cpp:
1295         * kjs/error_object.h:
1296         * kjs/function.cpp:
1297         * kjs/function.h:
1298         * kjs/function_object.cpp:
1299         * kjs/function_object.h:
1300         * kjs/math_object.cpp:
1301         * kjs/math_object.h:
1302         * kjs/number_object.cpp:
1303         * kjs/number_object.h:
1304         * kjs/object_object.cpp:
1305         * kjs/object_object.h:
1306         * kjs/regexp_object.cpp:
1307         * kjs/regexp_object.h:
1308         * kjs/string_object.cpp:
1309         * kjs/string_object.h:
1310         Removed many rendundant implementations of implementsCall from subclasses of
1311         InternalFunctionImp.
1312
1313 2006-02-21  Darin Adler  <darin@apple.com>
1314
1315         - fixed build
1316
1317         * kjs/internal.cpp: (KJS::InternalFunctionImp::implementsCall):
1318         Oops, fixed name.
1319
1320 2006-02-21  Darin Adler  <darin@apple.com>
1321
1322         Change suggested by Mitz.
1323
1324         - http://bugzilla.opendarwin.org/show_bug.cgi?id=7402
1325           REGRESSION: Methods do not execute
1326
1327         * kjs/internal.h: Add implementsHasCall to InternalFunctionImp.
1328         * kjs/internal.cpp: (KJS::InternalFunctionImp::implementsHasCall):
1329         Return true. All the classes derived from InternalFunctionImp need
1330         to return true from this -- later we can remove all the extra
1331         implementations too.
1332
1333 2006-02-21  Maciej Stachowiak  <mjs@apple.com>
1334
1335         - fix build breakage caused by last-minute change to my patch
1336
1337         * kjs/lookup.h:
1338
1339 2006-02-20  Maciej Stachowiak  <mjs@apple.com>
1340
1341         Reviewed by Geoff and Darin.
1342         
1343         Patch from Maks Orlovich, based on work by David Faure, hand-applied and 
1344         significantly reworked by me.
1345         
1346         - Patch: give internal function names (KJS merge)
1347         http://bugzilla.opendarwin.org/show_bug.cgi?id=6279
1348
1349         * tests/mozilla/expected.html: Updated for newly fixed test.
1350
1351         * kjs/array_object.cpp:
1352         (ArrayProtoFunc::ArrayProtoFunc):
1353         * kjs/array_object.h:
1354         * kjs/bool_object.cpp:
1355         (BooleanPrototype::BooleanPrototype):
1356         (BooleanProtoFunc::BooleanProtoFunc):
1357         * kjs/bool_object.h:
1358         * kjs/date_object.cpp:
1359         (KJS::DateProtoFunc::DateProtoFunc):
1360         (KJS::DateObjectImp::DateObjectImp):
1361         (KJS::DateObjectFuncImp::DateObjectFuncImp):
1362         * kjs/error_object.cpp:
1363         (ErrorPrototype::ErrorPrototype):
1364         (ErrorProtoFunc::ErrorProtoFunc):
1365         * kjs/error_object.h:
1366         * kjs/function.cpp:
1367         (KJS::FunctionImp::FunctionImp):
1368         (KJS::GlobalFuncImp::GlobalFuncImp):
1369         * kjs/function.h:
1370         * kjs/function_object.cpp:
1371         (FunctionPrototype::FunctionPrototype):
1372         (FunctionProtoFunc::FunctionProtoFunc):
1373         (FunctionProtoFunc::callAsFunction):
1374         * kjs/function_object.h:
1375         * kjs/internal.cpp:
1376         (KJS::InterpreterImp::initGlobalObject):
1377         (KJS::InternalFunctionImp::InternalFunctionImp):
1378         * kjs/internal.h:
1379         (KJS::InternalFunctionImp::functionName):
1380         * kjs/lookup.h:
1381         (KJS::staticFunctionGetter):
1382         (KJS::HashEntryFunction::HashEntryFunction):
1383         (KJS::HashEntryFunction::implementsCall):
1384         (KJS::HashEntryFunction::toBoolean):
1385         (KJS::HashEntryFunction::implementsHasInstance):
1386         (KJS::HashEntryFunction::hasInstance):
1387         * kjs/math_object.cpp:
1388         (MathFuncImp::MathFuncImp):
1389         * kjs/math_object.h:
1390         * kjs/number_object.cpp:
1391         (NumberPrototype::NumberPrototype):
1392         (NumberProtoFunc::NumberProtoFunc):
1393         * kjs/number_object.h:
1394         * kjs/object.cpp:
1395         (KJS::JSObject::putDirectFunction):
1396         (KJS::Error::create):
1397         * kjs/object.h:
1398         * kjs/object_object.cpp:
1399         (ObjectPrototype::ObjectPrototype):
1400         (ObjectProtoFunc::ObjectProtoFunc):
1401         * kjs/object_object.h:
1402         * kjs/regexp_object.cpp:
1403         (RegExpPrototype::RegExpPrototype):
1404         (RegExpProtoFunc::RegExpProtoFunc):
1405         * kjs/regexp_object.h:
1406         * kjs/string_object.cpp:
1407         (StringProtoFunc::StringProtoFunc):
1408         (StringObjectImp::StringObjectImp):
1409         (StringObjectFuncImp::StringObjectFuncImp):
1410         * kjs/string_object.h:
1411         
1412 2006-02-20  Geoffrey Garen  <ggaren@apple.com>
1413
1414         Reviewed by Darin, with help from Eric, Maciej.
1415
1416         - More changes to support super-accurate JS iBench. Doesn't work on 
1417         Windows. (Doesn't break Windows, either.) I've filed [http://bugzilla.
1418         opendarwin.org/show_bug.cgi?id= 7399] about that. 
1419
1420         * kjs/interpreter.cpp:
1421         (KJS::Interpreter::evaluate): Print line numbers with exception output
1422         * kjs/testkjs.cpp: Changed " *" to "* " because Eric says that's the 
1423         way we roll with .cpp files.
1424         (StopWatch::StopWatch): New class. Provides microsecond-accurate 
1425         timings.
1426         (StopWatch::~StopWatch):
1427         (StopWatch::start):
1428         (StopWatch::stop):
1429         (StopWatch::getElapsedMS):
1430         (TestFunctionImp::callAsFunction): Added missing return statement. 
1431         Fixed up "run" to use refactored helper functions. Removed bogus 
1432         return statement from "quit" case. Made "print" output to stdout 
1433         instead of stderr because that makes more sense, and PERL handles 
1434         stdout better.
1435         (main): Factored out KXMLCore unit tests. Removed custom exception 
1436         printing code because the interpreter prints exceptions for you. Added 
1437         a "delete" call for the GlobalImp we allocate.
1438         (testIsInteger): New function, result of refacotring.
1439         (createStringWithContentsOfFile): New function, result of refactoring. 
1440         Renamed "code" to "buffer" to match factored-out-ness.
1441
1442 2006-02-20  Eric Seidel  <eseidel@apple.com>
1443
1444         Reviewed by hyatt.
1445
1446         Fix "Copy ICU DLLs..." phase.
1447
1448         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1449         * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
1450
1451 2006-02-19  Darin Adler  <darin@apple.com>
1452
1453         - renamed ERROR to LOG_ERROR to fix build
1454           presumably Maciej had this change and forgot to land it
1455
1456         * kjs/collector.cpp: Removed now-unneeded #undef ERROR.
1457         * kxmlcore/Assertions.h: Renamed ERROR to LOG_ERROR.
1458         * kxmlcore/FastMalloc.cpp: Changed MESSAGE macro to use LOG_ERROR.
1459
1460 2006-02-18  Mitz Pettel  <opendarwin.org@mitzpettel.com>
1461
1462         Test: fast/js/toString-exception.html
1463
1464         Reviewed by Maciej.
1465
1466         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7343
1467           REGRESSION: fast/js/toString-overrides.html fails when run multiple times
1468
1469         * kjs/array_object.cpp:
1470         (ArrayProtoFunc::callAsFunction): Remove the object from the visited elements set before
1471         returning an error.
1472
1473 2006-02-18  Darin Adler  <darin@apple.com>
1474
1475         Reviewed by Maciej.
1476
1477         - http://bugzilla.opendarwin.org/show_bug.cgi?id=7345
1478           add insert and remove to KXMLCore::Vector
1479
1480         * kxmlcore/Vector.h: Added "moveOverlapping", which is used in both
1481         insert and remove to slide elements within the vector. Also added
1482         "insert" and "remove" functions.
1483
1484 2006-02-16  Geoffrey Garen  <ggaren@apple.com>
1485
1486         Reviewed by John.
1487
1488         - Fixed <rdar://problem/4448534> TOT REGRESSION: crash in KJS::
1489         Bindings::Instance::deref when leaving page @ gigaom.com
1490
1491         * bindings/c/c_instance.cpp:
1492         (KJS::Bindings::CInstance::~CInstance): Since we cache the class object
1493         globally, we shouldn't delete it, so don't.
1494
1495 2006-02-16  Timothy Hatcher  <timothy@apple.com>
1496
1497         Added -Wno-deprecated-declarations to all the ObjC binding files to prevent deprecation
1498         warnings. Using <rdar://problem/4448350> to track this.
1499
1500         * JavaScriptCore.xcodeproj/project.pbxproj:
1501         * bindings/objc/objc_jsobject.h: Removed empty file.
1502         * bindings/objc/objc_jsobject.mm: Removed empty file.
1503
1504 2006-02-16  Tim Omernick  <timo@apple.com>
1505
1506         Reviewed by Geoff.
1507
1508         <rdar://problem/4428609> Flash Player 8.0.22 can crash Safari (and WebKit apps) with
1509         javascript disabled (7015)
1510
1511         * bindings/NP_jsobject.cpp:
1512         (_NPN_CreateNoScriptObject):
1513         Returns an NPObject which is not bound to a JavaScript object.  This kind of NPObject
1514         can be given to a plugin as the "window script object" when JavaScript is disabled.
1515         The object has a custom NPClass, NPNoScriptObjectClass, which has no defined methods.
1516         Because of this, none of the NPN_* functions called by the plugin on this "no script
1517         object" will cause entry into JavaScript code.
1518         (_NPN_InvokeDefault):
1519         Make sure the NPVariant is filled before returning from this function.  This never
1520         mattered before because we never reached this case, having only created NPObjects of
1521         the class NPScriptObjectClass.
1522         (_NPN_Invoke):
1523         ditto
1524         (_NPN_Evaluate):
1525         ditto
1526         (_NPN_GetProperty):
1527         ditto
1528
1529         * bindings/NP_jsobject.h:
1530         Declared _NPN_CreateNoScriptObject().
1531
1532 2006-02-16  Darin Adler  <darin@apple.com>
1533
1534         Reviewed by me, change by Peter Kuemmel.
1535
1536         * kjs/operations.cpp: (KJS::isNegInf): Fix Windows code, which was
1537         checking for positive infinity (rolling in fix from KDE side).
1538
1539 2006-02-15  Geoffrey Garen  <ggaren@apple.com>
1540
1541         Reviewed by Maciej, Eric.
1542
1543         - WebCore half of fix for <rdar://problem/4176077> CrashTracer: 6569
1544         crashes in DashboardClient at com.apple.JavaScriptCore:
1545         KJS::Bindings::ObjcFallbackObjectImp::type()
1546
1547         WebCore and JavaScriptCore weren't sharing Instance objects very
1548         nicely. I made them use RefPtrs, and sent them to bed without dessert.
1549
1550         * bindings/jni/jni_instance.cpp: Made _instance a RefPtr
1551         (JavaInstance::~JavaInstance):
1552         (JObjectWrapper::JObjectWrapper):
1553         * bindings/jni/jni_instance.h:
1554         (KJS::Bindings::JObjectWrapper::ref):
1555         (KJS::Bindings::JObjectWrapper::deref):
1556         * bindings/jni/jni_runtime.cpp: Made _array a RefPtr
1557         (JavaArray::~JavaArray):
1558         (JavaArray::JavaArray):
1559         * bindings/jni/jni_runtime.h:
1560         (KJS::Bindings::JavaArray::operator=):
1561         * bindings/objc/objc_runtime.h:
1562         - Prohibited copying because that would muss the ref count.
1563         - Prohibited construction without instance because an instance wrapper
1564         without an instance is almost certainly a bug.
1565         * bindings/objc/objc_runtime.mm:
1566         (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
1567         * bindings/runtime.cpp:
1568         (KJS::Bindings::Instance::Instance):
1569         (KJS::Bindings::Instance::createBindingForLanguageInstance):
1570         (KJS::Bindings::Instance::createRuntimeObject):
1571         * bindings/runtime.h:
1572         (KJS::Bindings::Instance::ref):
1573         (KJS::Bindings::Instance::deref):
1574         * bindings/runtime_object.cpp:
1575         (RuntimeObjectImp::RuntimeObjectImp):
1576         (RuntimeObjectImp::fallbackObjectGetter):
1577         (RuntimeObjectImp::fieldGetter):
1578         (RuntimeObjectImp::methodGetter):
1579         (RuntimeObjectImp::getOwnPropertySlot):
1580         (RuntimeObjectImp::put):
1581         (RuntimeObjectImp::canPut):
1582         * bindings/runtime_object.h: 
1583         - Removed ownsInstance data member because RefPtr takes care of 
1584         instance lifetime now. 
1585         - Prohibited copying because that would muss the ref count.
1586         - Prohibited construction without instance because an instance wrapper
1587         without an instance is almost certainly a bug.
1588         (KJS::RuntimeObjectImp::getInternalInstance):
1589
1590 2006-02-15  Geoffrey Garen  <ggaren@apple.com>
1591
1592         Reviewed by John.
1593
1594         - Applied the 4330457 change to CClass and ObjcClass as well.
1595
1596         Once plugins work in DumpRenderTree, running run-webkit-tests --leaks
1597         will catch this. 
1598
1599         This change isn't as critical because CClass and ObjcClass objects get 
1600         cached globally and never deleted, but it's good practice, in case we 
1601         ever do decide to delete CClass and ObjcClass objects.
1602
1603         This change requires prohibiting copying, because we don't do any 
1604         intelligent ref-counting -- when a Class is destroyed, it destroys its 
1605         methods and fields unconditionally. (Java classes already prohibited
1606         copying.)
1607
1608         * bindings/c/c_class.cpp:
1609         - Merged _commonInit and _commonDelete into constructor and destructor.
1610         (CClass::CClass):
1611         (CClass::~CClass):
1612         (CClass::methodsNamed): Added delete callbacks
1613         (CClass::fieldNamed): Added delete callbacks
1614         * bindings/c/c_class.h: Prohibited copying
1615         * bindings/c/c_instance.cpp: 
1616         (KJS::Bindings::CInstance::getClass): Changed to use the preferred 
1617         class factory method, to take advantage of the global cache.
1618
1619         [ Repeated changes applied to CClass for ObjcClass: ]
1620
1621         * bindings/objc/objc_class.h: 
1622         * bindings/objc/objc_class.mm:
1623         (KJS::Bindings::ObjcClass::ObjcClass):
1624         (KJS::Bindings::ObjcClass::~ObjcClass):
1625         (KJS::Bindings::ObjcClass::methodsNamed):
1626         (KJS::Bindings::ObjcClass::fieldNamed):
1627         * bindings/objc/objc_runtime.h:
1628         (KJS::Bindings::ObjcMethod::ObjcMethod): Initialized uninitialized
1629         variable to prevent bad CFRelease.
1630         (KJS::Bindings::ObjcMethod::~ObjcMethod): Removed erroneous ';' from
1631         if statement to prevent bad CFRelease.
1632         * bindings/objc/objc_runtime.cpp: Changed to use the preferred
1633         ObjectStructPtr, for clarity.
1634
1635 2006-02-14  Geoffrey Garen  <ggaren@apple.com>
1636
1637         Reviewed by John.
1638
1639         - Fixed <rdar://problem/4330457> CrashTracer: [REGRESSION] 3763 crashes
1640         in Safari at com.apple.JavaScriptCore: KJS::Bindings::JavaInstance::
1641         getClass const + 56
1642
1643         Once plugins work in DumpRenderTree, running run-webkit-tests --leaks
1644         will catch this. 
1645
1646         This was a memory leak in the bindings code. The leak was so extreme
1647         that it would cause Safari or the JVM to abort from lack of memory.
1648         Upon construction, Class objects create field and method objects, 
1649         storing them in CFDictionaries. The bug was that upon destruction, the 
1650         class objects released the dictionaries but didn't destroy the stored 
1651         objects.
1652
1653         The fix is to supply CFDictionary callbacks for destroying the values
1654         added to the dictionary. 
1655         
1656         * bindings/jni/jni_class.cpp: 
1657         (JavaClass::JavaClass): Added delete callbacks
1658         * bindings/runtime.cpp: Added definitions for delete callbacks
1659         (KJS::Bindings::deleteMethodList):
1660         (KJS::Bindings::deleteMethod):
1661         (KJS::Bindings::deleteField):
1662         * bindings/runtime.h: Added declarations for delete callbacks
1663
1664 2006-02-14  Timothy Hatcher  <timothy@apple.com>
1665
1666         Reviewed by Justin.
1667
1668         Fixed <rdar://problem/4415050> STD: WebCore build steps use echo -n, which will change
1669         behavior due to POSIX version of sh
1670
1671         * JavaScriptCore.xcodeproj/project.pbxproj: removed the use of echo -n, replaced with printf ""
1672
1673 2006-02-13   Dave Hyatt <hyatt@apple.com>
1674
1675         Fix Win32 bustage in JavaScriptCore.
1676
1677         Reviewed by darin
1678
1679         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1680         Add JSImmediate to the Win32 project.
1681
1682         * kjs/JSImmediate.h:
1683         (KJS::JSImmediate::fromDouble):
1684         (KJS::JSImmediate::toDouble):
1685         (KJS::JSImmediate::NanAsBits):
1686         (KJS::JSImmediate::oneAsBits):
1687         Win32 needs explicit returns after abort() for non-void functions.
1688
1689         * kjs/testkjs.cpp:
1690         (run):
1691         Win32 catches a bug in testkjs!  The "return 2" should actually
1692         have been a return false.
1693
1694         * kjs/value.h:
1695         The extern decls of NaN and Inf need to be const.
1696
1697 === JavaScriptCore-521.7 ===
1698
1699 2006-02-13  Timothy Hatcher  <timothy@apple.com>
1700
1701         Reviewed by Darin.
1702
1703         Replaced the old NS_DURING exception blocking with @try/@catch.
1704
1705         * JavaScriptCorePrefix.h: undef try and catch to workaround a C++ conflict
1706         * bindings/objc/objc_instance.mm:
1707         (ObjcInstance::invokeMethod):
1708         (ObjcInstance::invokeDefaultMethod):
1709         (ObjcInstance::setValueOfUndefinedField):
1710         (ObjcInstance::getValueOfUndefinedField):
1711         * bindings/objc/objc_runtime.mm:
1712         (ObjcField::valueFromInstance):
1713         (ObjcField::setValueToInstance):
1714         (ObjcArray::setValueAt):
1715         (ObjcArray::valueAt):
1716
1717 2006-02-13  Darin Adler  <darin@apple.com>
1718
1719         - fix a couple problems building on Windows, based on requests
1720           from Krzysztof Kowalczyk <kkowalczyk@gmail.com>
1721
1722         * kjs/JSImmediate.h: Change code using non-standard u_int32/64_t types
1723         to the standard uint32/64_t. Also removed curious "isIEEE()" function
1724         that checked the sizes of some types (and type sizes alone don't tell you if
1725         the floating point conforms to the IEEE-standard). Added missing include
1726         of <stdint.h>.
1727
1728         * kjs/property_slot.h: Added missing include of <assert.h>.
1729
1730 2006-02-12  Geoffrey Garen  <ggaren@apple.com>
1731
1732         Reviewed by darin.
1733
1734         Cleaned up testkjs, added new "run" functionality to allow scripting 
1735         tests from within JS. ("run" is a part of my new super-accurate
1736         JS iBench.)
1737
1738         No regressions in run-javascriptcore-tests.
1739
1740         * kjs/testkjs.cpp:
1741         (GlobalImp::className):
1742         (TestFunctionImp::):
1743         (TestFunctionImp::callAsFunction):
1744         (main):
1745         (run):
1746
1747 2006-02-11  Alexey Proskuryakov  <ap@nypop.com>
1748
1749         Reviewed by Darin.
1750
1751         - improve fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=5163
1752         RealPlayer.GetTitle() Crashes Safari/Dashboard
1753
1754         * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16):
1755         Use kCFStringEncodingISOLatin1 rather than kCFStringEncodingWindowsLatin1, 
1756         because the latter encoding has holes, and conversion can still fail.
1757
1758 2006-02-10  Geoffrey Garen  <ggaren@apple.com>
1759
1760         Reviewed by Darin.
1761
1762         - Inlined RefPtr assignment operators. .7% performance win on 
1763         super-accurate JS iBench.
1764
1765         * kxmlcore/RefPtr.h:
1766         (KXMLCore::::operator):
1767
1768 2006-02-10  Geoffrey Garen  <ggaren@apple.com>
1769
1770         No review needed, just a build fix. This time for sure.
1771
1772         * kjs/JSType.h:
1773
1774 2006-02-10  Geoffrey Garen  <ggaren@apple.com>
1775
1776         Reviewed by eric.
1777         
1778         - Fixed build. As it goes without saying, I will not mention that I
1779         blame Kevin.
1780
1781         * JavaScriptCore.xcodeproj/project.pbxproj:
1782         * kjs/JSImmediate.cpp:
1783         (KJS::JSImmediate::toObject):
1784
1785 2006-02-09  Geoffrey Garen  <ggaren@apple.com>
1786
1787         Reviewed by mjs.
1788
1789         - Fixed <rdar://problem/4343730> Should switch ConstantValues (null, 
1790         undefined, true, false) from JS objects to immediate values similar to
1791         SimpleNumber
1792
1793         2.0% performance gain on my new super-accurate version of JS iBench.
1794         (I promise to land a version of it soon.)
1795
1796         The gist of the change:
1797         (1) The SimpleNumber class (simple_number.h) is now the JSImmediate
1798         class (JSImmediate.h/.cpp), and it handles not only numbers but also 
1799         null, undefined, true, and false. 
1800         (2) JSImmediate provides convenience methods for the bit masking
1801         necessary to encode and decode immediate values.
1802         (3) ConstantValues, BooleanImp, NullImp, and UndefinedImp are gone.
1803         (4) JSCell no longer implements functions like getBoolean, because
1804         only a JSImmediate can be a boolean.
1805         (5) JSImmediate no longer uses ALWAYS_INLINE because there's no need,
1806         and ALWAYS_INLINE is a non-portable option of last resort.
1807         (6) Type is now JSType, and it resides in its own file, JSType.h.
1808         Since I was there, I did some header include sorting as part of this
1809         change.
1810
1811         The rest pretty much explains itself.
1812
1813         * JavaScriptCore.xcodeproj/project.pbxproj: Removed simple_number.h,
1814         added JSImmediate.h/.cpp.
1815         * bindings/c/c_instance.cpp:
1816         (KJS::Bindings::CInstance::defaultValue):
1817         * bindings/c/c_instance.h:
1818         * bindings/c/c_utility.cpp:
1819         (KJS::Bindings::convertValueToNPVariant):
1820         * bindings/jni/jni_instance.cpp:
1821         (JavaInstance::defaultValue):
1822         * bindings/jni/jni_instance.h:
1823         * bindings/jni/jni_jsobject.cpp:
1824         (JavaJSObject::convertValueToJObject):
1825         * bindings/objc/WebScriptObject.mm:
1826         (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
1827         Standardized calls to use getXXX instead of hand-rolling JSValue 
1828         functionality.
1829         * bindings/objc/objc_instance.h:
1830         * bindings/objc/objc_instance.mm:
1831         (ObjcInstance::getValueOfUndefinedField):
1832         (ObjcInstance::defaultValue):
1833         * bindings/objc/objc_runtime.h:
1834         * bindings/objc/objc_runtime.mm:
1835         (ObjcFallbackObjectImp::type):
1836         (ObjcFallbackObjectImp::defaultValue):
1837         * bindings/runtime.h:
1838         (KJS::Bindings::Instance::getValueOfUndefinedField):
1839         * bindings/runtime_object.cpp:
1840         (RuntimeObjectImp::defaultValue):
1841         * bindings/runtime_object.h:
1842         * kjs/JSImmediate.h: Added.
1843         (KJS::JSImmediate::isImmediate):
1844         (KJS::JSImmediate::isNumber):
1845         (KJS::JSImmediate::isBoolean):
1846         (KJS::JSImmediate::isUndefinedOrNull):
1847         (KJS::JSImmediate::fromDouble):
1848         (KJS::JSImmediate::toDouble):
1849         (KJS::JSImmediate::toBoolean):
1850         (KJS::JSImmediate::trueImmediate):
1851         (KJS::JSImmediate::falseImmediate):
1852         (KJS::JSImmediate::NaNImmediate):
1853         (KJS::JSImmediate::undefinedImmediate):
1854         (KJS::JSImmediate::nullImmediate):
1855         (KJS::JSImmediate::tag):
1856         (KJS::JSImmediate::unTag):
1857         (KJS::JSImmediate::getTag):
1858         (KJS::JSImmediate::):
1859         (KJS::JSImmediate::isIEEE):
1860         (KJS::JSImmediate::is32bit):
1861         (KJS::JSImmediate::is64bit):
1862         (KJS::JSImmediate::NanAsBits):
1863         (KJS::JSImmediate::zeroAsBits):
1864         (KJS::JSImmediate::oneAsBits):
1865         * kjs/JSLock.cpp:
1866         (KJS::JSLock::lock): Removed hack-o-rama to initialize ConstantValues.
1867         * kjs/JSType.h: Added.
1868         * kjs/collector.cpp:
1869         (KJS::Collector::protect):
1870         (KJS::Collector::unprotect):
1871         (KJS::Collector::collect):
1872         * kjs/internal.cpp:
1873         (KJS::StringImp::toPrimitive):
1874         (KJS::NumberImp::toPrimitive):
1875         (KJS::NumberImp::toBoolean):
1876         (KJS::GetterSetterImp::toPrimitive):
1877         * kjs/internal.h:
1878         (KJS::StringImp::type):
1879         (KJS::NumberImp::type):
1880         * kjs/object.cpp:
1881         (KJS::JSObject::type):
1882         (KJS::tryGetAndCallProperty): Replaced "Are you one of the six things
1883         I'm looking for?" test with "Are you not the one thing I'm not looking
1884         for" test.
1885         (KJS::JSObject::defaultValue):
1886         (KJS::JSObject::toPrimitive):
1887         * kjs/object.h:
1888         (KJS::GetterSetterImp::type):
1889         (KJS::JSValue::isObject):
1890         * kjs/operations.cpp:
1891         (KJS::equal):
1892         (KJS::strictEqual):
1893         (KJS::add):
1894         * kjs/reference.cpp:
1895         (KJS::Reference::deleteValue):
1896         * kjs/simple_number.h: Removed.
1897         * kjs/string_object.cpp:
1898         (StringInstance::getOwnPropertySlot): fixed indentation
1899         * kjs/value.cpp:
1900         (KJS::JSValue::toObject):
1901         (KJS::jsNumberCell): New function to quarantine a PIC branch -- allows
1902         us to inline jsNumber without adding PIC branches to callers.
1903         * kjs/value.h:
1904         (KJS::jsUndefined):
1905         (KJS::jsNull):
1906         (KJS::jsNaN):
1907         (KJS::jsBoolean):
1908         (KJS::jsNumber):
1909         (KJS::JSValue::downcast):
1910         (KJS::JSValue::isUndefinedOrNull):
1911         (KJS::JSValue::isBoolean):
1912         (KJS::JSValue::isNumber):
1913         (KJS::JSValue::isString):
1914         (KJS::JSValue::isObject):
1915         (KJS::JSValue::getBoolean):
1916         (KJS::JSValue::getNumber):
1917         (KJS::JSValue::getString):
1918         (KJS::JSValue::getObject):
1919         (KJS::JSValue::getUInt32):
1920         (KJS::JSValue::mark): Replaced !JSImmediate::is() test with assertion,
1921         resulting in a slight performance gain. Callers should always check
1922         !marked() before calling mark(), so it's impossible to call mark on
1923         a JSImmediate.
1924         (KJS::JSValue::marked):
1925         (KJS::JSValue::type):
1926         (KJS::JSValue::toPrimitive):
1927         (KJS::JSValue::toBoolean):
1928         (KJS::JSValue::toNumber):
1929         (KJS::JSValue::toString):
1930
1931 2006-02-06  Eric Seidel  <eseidel@apple.com>
1932
1933         Add svn:ignore properties for visual studio internals.
1934
1935 2006-02-06  Alexey Proskuryakov  <ap@nypop.com>
1936
1937         Reviewed by Darin.
1938
1939         - Refactor DateInstance to provide direct access to data. Several WIN32 modifications.
1940         http://bugzilla.opendarwin.org/show_bug.cgi?id=7107
1941
1942         - No tests added - only changed functionality on WIN32, which should be covered by 
1943         existing tests.
1944
1945         * kjs/date_object.cpp:
1946         (gmtoffset): On WIN32, use the recommended global (_timezone rather than timezone).
1947         Updated comments. 
1948         (KJS::timeZoneOffset): Removed, was basically the same as the above.
1949         (KJS::formatTime): Pass an UTC flag - UTC/local cannot be correctly selected on
1950         Windows based on struct tm itself.
1951         (KJS::DateInstance::getTime): Added.
1952         (KJS::DateInstance::getUTCTime): Added.
1953         (KJS::millisecondsToTM): Factored out from DateProtoFunc::callAsFunction().
1954         (KJS::DateObjectImp::callAsFunction): Use the new parameter to formatTime().
1955         (KJS::DateProtoFunc::callAsFunction): Updated for the other changes. The code for
1956         GetTimezoneOffset was incorrect on WIN32 - _daylight global has nothing to do
1957         with daylight savings time being in effect.
1958
1959         * kjs/date_object.h: Added prototypes for new functions.
1960
1961 2006-02-05  Maciej Stachowiak  <mjs@apple.com>
1962
1963         Reviewed by Anders.
1964         
1965         - fixed ~1100 KJS::Node leaked on layout tests
1966         http://bugzilla.opendarwin.org/show_bug.cgi?id=7097
1967
1968         * kjs/internal.cpp:
1969         (KJS::Parser::noteNodeCycle):
1970         (KJS::Parser::removeNodeCycle):
1971         (KJS::clearNewNodes):
1972         * kjs/internal.h:
1973         * kjs/nodes.cpp:
1974         (ElementNode::breakCycle):
1975         (PropertyListNode::breakCycle):
1976         (ArgumentListNode::breakCycle):
1977         (StatListNode::StatListNode):
1978         (StatListNode::breakCycle):
1979         (VarDeclListNode::breakCycle):
1980         (BlockNode::BlockNode):
1981         (ClauseListNode::breakCycle):
1982         (CaseBlockNode::CaseBlockNode):
1983         (ParameterNode::breakCycle):
1984         (SourceElementsNode::SourceElementsNode):
1985         (SourceElementsNode::breakCycle):
1986         * kjs/nodes.h:
1987         (KJS::Node::breakCycle):
1988         (KJS::ElementNode::ElementNode):
1989         (KJS::ArrayNode::ArrayNode):
1990         (KJS::PropertyListNode::PropertyListNode):
1991         (KJS::ObjectLiteralNode::ObjectLiteralNode):
1992         (KJS::ArgumentListNode::ArgumentListNode):
1993         (KJS::ArgumentsNode::ArgumentsNode):
1994         (KJS::VarDeclListNode::VarDeclListNode):
1995         (KJS::VarStatementNode::VarStatementNode):
1996         (KJS::ForNode::ForNode):
1997         (KJS::CaseClauseNode::CaseClauseNode):
1998         (KJS::ClauseListNode::ClauseListNode):
1999         (KJS::ParameterNode::ParameterNode):
2000         (KJS::FuncExprNode::FuncExprNode):
2001         (KJS::FuncDeclNode::FuncDeclNode):
2002
2003 2006-02-05  Maciej Stachowiak  <mjs@apple.com>
2004
2005         Reviewed by Hyatt.
2006         
2007         - fix default traits for classes to make sure default constructors get called
2008
2009         * kxmlcore/VectorTraits.h:
2010         (KXMLCore::):
2011
2012 2006-02-04  Darin Adler  <darin@apple.com>
2013
2014         Reviewed by Maciej.
2015
2016         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5210
2017           REGRESSION: for/in loop with var changes global variable instead of making local
2018
2019         Test: fast/js/for-in-var-scope.html
2020
2021         * kjs/nodes.cpp:
2022         (valueForReadModifyAssignment): Use ALWAYS_INLINE macro.
2023         (ForInNode::execute): Break out of the scope chain loop once we find and set the
2024         loop variable. We don't want to set multiple loop variables.
2025         (ForInNode::processVarDecls): Process the declaration of the loop variable.
2026
2027         - other cleanup
2028
2029         * kjs/object.cpp: (KJS::tryGetAndCallProperty): Use ALWAYS_INLINE macro.
2030         * kxmlcore/FastMalloc.cpp: Change to use ALWAYS_INLINE macro from AlwaysInline.h
2031         instead of defining it here a second time.
2032
2033 2006-02-04  Maciej Stachowiak  <mjs@apple.com>
2034
2035         Reviewed by Hyatt.
2036         
2037         - change JavaScript collector statistics calls to use HashCountedSet instead
2038         of CFSet; other misc cleanup
2039         http://bugzilla.opendarwin.org/show_bug.cgi?id=7072
2040         
2041         * kjs/collector.cpp:
2042         (KJS::Collector::numProtectedObjects): renamed from numReferencedObjects
2043         (KJS::typeName):
2044         (KJS::Collector::rootObjectTypeCounts): renamed from rootObjectClasses,
2045         use HashSet
2046         * kjs/collector.h:
2047         (KJS::Collector::isOutOfMemory): Renamed from outOfMemory.
2048         * kjs/nodes.cpp:
2049
2050 2006-02-03  Timothy Hatcher  <timothy@apple.com>
2051
2052         Reviewed by Justin.
2053
2054         Renamed configuration names to Debug, Release and Production.
2055
2056         * JavaScriptCore.xcodeproj/project.pbxproj:
2057
2058 2006-02-02  George Staikos <staikos@opensource.apple.com>
2059
2060         Reviewed by Maciej.
2061
2062         * kjs/lookup.h: Fix compile, merged from KDE.
2063
2064 2006-02-02  Darin Adler  <darin@apple.com>
2065
2066         Reviewed by Maciej.
2067
2068         - http://bugzilla.opendarwin.org/show_bug.cgi?id=7005
2069           add Noncopyable, OwnPtr, OwnArrayPtr to KXMLCore
2070
2071         * kxmlcore/Noncopyable.h: Added.
2072         * kxmlcore/OwnArrayPtr.h: Added.
2073         * kxmlcore/OwnPtr.h: Added.
2074
2075         * JavaScriptCore.xcodeproj/project.pbxproj: Added new files.
2076
2077         * kjs/function.h:
2078         * kjs/function.cpp: Use OwnPtr for Parameter pointers.
2079
2080         * kjs/internal.h: Use Noncopyable for LabelStack.
2081
2082         * kjs/list.cpp: Use OwnArrayPtr for overflow.
2083
2084         * kjs/property_map.h:
2085         * kjs/property_map.cpp: Use OwnArrayPtr for SavedProperties.
2086         Use Vector for some stack buffers.
2087
2088         * kjs/regexp_object.h:
2089         * kjs/regexp_object.cpp: Use OwnArrayPtr for lastOvector.
2090
2091 2006-01-31  Maciej Stachowiak  <mjs@apple.com>
2092
2093         Reviewed by Darin.
2094         
2095         - fixed leak of hundreds of thousands of JS parser nodes on the layout tests, and added an exit counter
2096         that would catch them
2097
2098         * kjs/nodes.cpp:
2099         (NodeCounter::~NodeCounter): Added debug-only node counter.
2100         (Node::Node):
2101         (Node::~Node):
2102         * kxmlcore/VectorTraits.h: Simple classes like RefPtr do in fact need destruction.
2103
2104 2006-01-31  Darin Adler  <darin@apple.com>
2105
2106         Reviewed by Maciej.
2107
2108         - added deleteAllValues for HashSet as well as HashMap
2109         - fixed conversion from const_iterator to iterator, which I broke a while back
2110
2111         * kxmlcore/HashMap.h: Updated copyright date.
2112         * kxmlcore/HashSet.h: (KXMLCore::deleteAllValues): Added.
2113         * kxmlcore/HashTable.h: (KXMLCore::HashTableIterator::operator const_iterator): Added.
2114
2115 2006-01-31  Tim Omernick  <timo@apple.com>
2116
2117         Reviewed by Geoff Garen.
2118
2119         * bindings/c/c_utility.cpp:
2120         (KJS::Bindings::convertUTF8ToUTF16):
2121         Fixed an invalid assertion that UTF8Chars is not NULL.  It is valid for it to be NULL as long as
2122         UTF8Length is 0.
2123         This fixes an assertion failure on TOT at <http://www.musicindiaonline.com/p/x/tJO0OOBME9.As1NMvHdW/>,
2124         where JavaScript is getting a NULL string back from some call on the Real Player plugin.
2125
2126 2006-01-30  Anders Carlsson  <andersca@mac.com>
2127
2128         Reviewed by Darin.
2129
2130         Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6907
2131         REGRESSION: United.com menus messed up due to document.all/MSIE sniff
2132         
2133         * kjs/nodes.cpp:
2134         (typeStringForValue):
2135         Return "undefined" if the given object should masquerade as undefined.
2136         
2137         * kjs/object.h:
2138         (KJS::JSObject::masqueradeAsUndefined):
2139         Rename from isEqualToNull.
2140         
2141         * kjs/operations.cpp:
2142         (KJS::equal):
2143         Update for name change.
2144
2145 2006-01-29  Maciej Stachowiak  <mjs@apple.com>
2146
2147         Reviewed by Darin.
2148         
2149         - properly define Vector assignment operator; the private version was accidentally left
2150         in, and the template version is not enough to replace the default
2151
2152         * kxmlcore/Vector.h:
2153         (KXMLCore::Vector::operator=):
2154
2155 2006-01-29  Eric Seidel  <eseidel@apple.com>
2156
2157         Reviewed by darin.
2158
2159         Fix the build by applying a GCC-specific namespace hack.
2160
2161         * kjs/lookup.h:
2162
2163 2006-01-29  Eric Seidel <eseidel@apple.com>
2164
2165         Reviewed by hyatt.
2166
2167         Fix build on Win32.
2168
2169         * kjs/lookup.h: fixed ::cacheGlobalObject
2170         * kxmlcore/Vector.h:
2171         (KXMLCore::Vector::operator[]): use unsigned long
2172
2173 2006-01-29  Maciej Stachowiak  <mjs@apple.com>
2174
2175         Reviewed by Dave Hyatt.
2176
2177         * kxmlcore/Vector.h:
2178         (KXMLCore::Vector::operator[]): Add unsigned overload
2179
2180 2006-01-28  Darin Adler  <darin@apple.com>
2181
2182         Reviewed by John Sullivan.
2183
2184         - http://bugzilla.opendarwin.org/show_bug.cgi?id=6895
2185           include exception names in JavaScript form of DOM exception
2186
2187         * khtml/ecma/kjs_binding.cpp: (KJS::setDOMException): Include the name of the
2188         exception in the error message.
2189
2190 2006-01-28  Maciej Stachowiak  <mjs@apple.com>
2191
2192         Reviewed by Darin.
2193         
2194         - miscellaneous Vector improvements
2195
2196         * kxmlcore/Vector.h:
2197         (KXMLCore::Vector::at): Add range-checking asserts.
2198         (KXMLCore::Vector::first): Added as a convenience.
2199         (KXMLCore::Vector::last): Convenience for stack-style use.
2200         (KXMLCore::Vector::removeLast): ditto
2201
2202 2006-01-28  Darin Adler  <darin@apple.com>
2203
2204         Reviewed by John Sullivan
2205
2206         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6870
2207           REGRESSION: JavaScript Date constructor won't accept another Date object
2208
2209         Test: fast/js/date-constructor.html
2210
2211         * kjs/date_object.cpp: (KJS::DateObjectImp::construct):
2212         Added a special case for constructing one date from another (to avoid losing
2213         milliseconds, which are not in the text form, to match Firefox), and changed
2214         the base code to convert to primitive before checking for string to match
2215         the standard. Also corrected a couple silly things in the "construct from
2216         current time" code path (removed a floor that does no good, and changed
2217         the constant used to convert microseconds to milliseconds to be a 1000
2218         rather than "msPerSecond").
2219
2220 2006-01-28  Darin Adler  <darin@apple.com>
2221
2222         * kjs/create_hash_table: Added missing license.
2223
2224 2006-01-28  Maciej Stachowiak  <mjs@apple.com>
2225
2226         Reviewed by Dave Hyatt.
2227         
2228         - added a Vector class
2229         http://bugzilla.opendarwin.org/show_bug.cgi?id=6894
2230
2231         * JavaScriptCore.xcodeproj/project.pbxproj:
2232         * kjs/internal.cpp:
2233         (KJS::Parser::saveNewNode): Apply Vector.
2234         (KJS::clearNewNodes): ditto
2235         * kjs/number_object.cpp:
2236         (integer_part_noexp): ditto
2237         (char_sequence): ditto
2238         * kjs/ustring.cpp:
2239         (KJS::UString::UTF8String): ditto
2240         * kxmlcore/HashMap.h:
2241         (KXMLCore::deleteAllValues): Tweaked this to only apply to HashMap,
2242         other versions are useful for other containers.
2243         * kxmlcore/Vector.h: Added. Implemented a Vector class, which should
2244         be usable for all Array/QVector style purposes, and also as a stack buffer
2245         with oversize handling. Also some helper classes to make vector operations
2246         as efficient as possible for POD types and for simple non-PODs like RefPtr.
2247         (KXMLCore::):
2248         (KXMLCore::VectorTypeOperations::destruct):
2249         (KXMLCore::VectorTypeOperations::initialize):
2250         (KXMLCore::VectorTypeOperations::move):
2251         (KXMLCore::VectorTypeOperations::uninitializedCopy):
2252         (KXMLCore::VectorTypeOperations::uninitializedFill):
2253         (KXMLCore::VectorBuffer::VectorBuffer):
2254         (KXMLCore::VectorBuffer::~VectorBuffer):
2255         (KXMLCore::VectorBuffer::deallocateBuffer):
2256         (KXMLCore::VectorBuffer::inlineBuffer):
2257         (KXMLCore::Vector::Vector):
2258         (KXMLCore::Vector::~Vector):
2259         (KXMLCore::Vector::size):
2260         (KXMLCore::Vector::capacity):
2261         (KXMLCore::Vector::isEmpty):
2262         (KXMLCore::Vector::at):
2263         (KXMLCore::Vector::operator[]):
2264         (KXMLCore::Vector::data):
2265         (KXMLCore::Vector::operator T*):
2266         (KXMLCore::Vector::operator const T*):
2267         (KXMLCore::Vector::begin):
2268         (KXMLCore::Vector::end):
2269         (KXMLCore::Vector::clear):
2270         (KXMLCore::Vector::fill):
2271         (KXMLCore::Vector::operator=):
2272         (KXMLCore::::Vector):
2273         (KXMLCore::::operator):
2274         (KXMLCore::::fill):
2275         (KXMLCore::::expandCapacity):
2276         (KXMLCore::::resize):
2277         (KXMLCore::::reserveCapacity):
2278         (KXMLCore::::append):
2279         (KXMLCore::deleteAllValues):
2280         * kxmlcore/VectorTraits.h: Added.
2281         (KXMLCore::VectorTraits): Traits to enable making Vector efficient for
2282         simple types.
2283
2284 2006-01-28  Alexey Proskuryakov  <ap@nypop.com>
2285
2286         Reviewed by Darin.
2287
2288         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5163
2289         RealPlayer.GetTitle() Crashes Safari/Dashboard
2290
2291         * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16):
2292         Fallback to kCFStringEncodingWindowsLatin1 if the passed buffer is not valid UTF-8, preventing crashes.
2293
2294 2006-01-25  George Staikos <staikos@opensource.apple.com>
2295
2296         Reviewed by Darin.
2297
2298         * kxmlcore/HashFunctions.h: Merge build fix from KDE.
2299
2300 2006-01-25  Darin Adler  <darin@apple.com>
2301
2302         - removed an unused source file
2303
2304         * kjs/pointer_hash.h: Removed.
2305         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Removed reference to pointer_hash.h.
2306
2307 2006-01-23  Anders Carlsson  <andersca@mac.com>
2308
2309         Reviewed by Maciej.
2310
2311         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6737
2312         KJS_DEFINE_PROTOTYPE should work outside of the KJS namespace
2313         
2314         * kjs/lookup.h:
2315         Prefix all KJS types with KJS:: in KJS_DEFINE_PROTOTYPE.
2316         
2317         (cacheGlobalObject):
2318         Move this out of the KJS namespace.
2319
2320 2006-01-23  Maciej Stachowiak  <mjs@apple.com>
2321
2322         Reviewed by Eric.
2323
2324         - renamed PointerHash to PtrHash
2325         - made PtrHash the default hash function for int and pointer types that aren't further specialized
2326         - added an AtomicStringImpl class to make it easier and more typesafe to identity hash atomic strings
2327         - did appropriate consequent cleanup (very few places now need to declare a hash function)
2328         http://bugzilla.opendarwin.org/show_bug.cgi?id=6752
2329         
2330         * kjs/array_object.cpp:
2331         (ArrayProtoFunc::callAsFunction): no need to mention PointerHash
2332         * kjs/collector.cpp: ditto
2333         * kjs/identifier.cpp:
2334         (KXMLCore::): declare DefaultHash the new way
2335         * kjs/internal.cpp: no need to mention PointerHash
2336         * kjs/ustring.h:
2337         * kxmlcore/HashCountedSet.h: change how we get the default hash to make it
2338         easier to specialize on PtrHash
2339         * kxmlcore/HashFunctions.h:
2340         (KXMLCore::): renamed PointerHash to PtrHash; changed DefaultHash so that it has
2341         a Hash typedef rather than being a hash function class itself; declared DefaultHash
2342         for int and partializy specialized for pointer types
2343         * kxmlcore/HashMapPtrSpec.h:
2344         (KXMLCore::PtrHashIteratorAdapter::PtrHashIteratorAdapter): Slight tweaks for new
2345         way of handling pointer hash
2346         (KXMLCore::PtrHashConstIteratorAdapter::PtrHashConstIteratorAdapter): ditto
2347         (KXMLCore::): ditto
2348         * kxmlcore/HashMap.h: ditto
2349         * kxmlcore/HashSet.h: ditto
2350
2351 2006-01-23  Maciej Stachowiak  <mjs@apple.com>
2352
2353         Reviewed by Tim Omernick.
2354         
2355         - use classes instead of free functions for extractors, this better matches how other
2356         things work and should avoid the need for hacky workarounds on other compilers
2357         http://bugzilla.opendarwin.org/show_bug.cgi?id=6748
2358
2359         * kjs/array_object.cpp:
2360         * kjs/identifier.cpp:
2361         * kjs/internal.cpp:
2362         * kxmlcore/HashMap.h:
2363         (KXMLCore::PairFirstExtractor::extract):
2364         * kxmlcore/HashMapPtrSpec.h:
2365         (KXMLCore::):
2366         * kxmlcore/HashSet.h:
2367         (KXMLCore::IdentityExtractor::extract):
2368         * kxmlcore/HashTable.h:
2369         (KXMLCore::addIterator):
2370         (KXMLCore::removeIterator):
2371         (KXMLCore::HashTable::add):
2372         (KXMLCore::HashTable::isEmptyBucket):
2373         (KXMLCore::HashTable::isDeletedBucket):
2374         (KXMLCore::HashTable::HashTable):
2375         (KXMLCore::HashTable::lookup):
2376         (KXMLCore::HashTable::add):
2377         (KXMLCore::HashTable::reinsert):
2378         (KXMLCore::HashTable::find):
2379         (KXMLCore::HashTable::contains):
2380         (KXMLCore::HashTable::remove):
2381         (KXMLCore::HashTable::allocateTable):
2382         (KXMLCore::HashTable::deallocateTable):
2383         (KXMLCore::HashTable::expand):
2384         (KXMLCore::HashTable::rehash):
2385         (KXMLCore::HashTable::clear):
2386         (KXMLCore::HashTable::swap):
2387         (KXMLCore::HashTable::operator):
2388         (KXMLCore::HashTable::checkTableConsistency):
2389         (KXMLCore::HashTable::checkTableConsistencyExceptSize):
2390         (KXMLCore::HashTable::invalidateIterators):
2391
2392 2006-01-23  Maciej Stachowiak  <mjs@apple.com>
2393
2394         Rubber stamped by Tim Hatcher.
2395         
2396         - renamed inert() operation on HashSet, HashCountedSet and HashTable to add()
2397         for consistency with HashMap
2398
2399         * kjs/array_object.cpp:
2400         (ArrayProtoFunc::callAsFunction):
2401         * kjs/collector.cpp:
2402         (KJS::Collector::protect):
2403         * kjs/identifier.cpp:
2404         (KJS::Identifier::add):
2405         * kxmlcore/HashCountedSet.h:
2406         (KXMLCore::::add):
2407         * kxmlcore/HashMap.h:
2408         (KXMLCore::::inlineAdd):
2409         * kxmlcore/HashSet.h:
2410         (KXMLCore::::add):
2411         * kxmlcore/HashTable.h:
2412         (KXMLCore::HashTable::add):
2413         (KXMLCore::::add):
2414         (KXMLCore::::HashTable):
2415
2416 2006-01-23  Justin Garcia  <justin.garcia@apple.com>
2417
2418         Reviewed by thatcher
2419         
2420         Turned on -O2 for B&I build.
2421
2422         * JavaScriptCore.xcodeproj/project.pbxproj:
2423
2424 2006-01-23  Maciej Stachowiak  <mjs@apple.com>
2425
2426         Reviewed by Tim Hatcher.
2427         
2428         - it's "Franklin Street", not "Franklin Steet"
2429
2430         * kjs/array_instance.h:
2431         * kjs/array_object.cpp:
2432         * kjs/array_object.h:
2433         * kjs/bool_object.cpp:
2434         * kjs/bool_object.h:
2435         * kjs/collector.cpp:
2436         * kjs/collector.h:
2437         * kjs/completion.h:
2438         * kjs/context.h:
2439         * kjs/date_object.cpp:
2440         * kjs/date_object.h:
2441         * kjs/debugger.cpp:
2442         * kjs/debugger.h:
2443         * kjs/dtoa.h:
2444         * kjs/error_object.cpp:
2445         * kjs/error_object.h:
2446         * kjs/function.cpp:
2447         * kjs/function.h:
2448         * kjs/function_object.cpp:
2449         * kjs/function_object.h:
2450         * kjs/grammar.y:
2451         * kjs/identifier.cpp:
2452         * kjs/identifier.h:
2453         * kjs/internal.cpp:
2454         * kjs/internal.h:
2455         * kjs/interpreter.cpp:
2456         * kjs/interpreter.h:
2457         * kjs/lexer.cpp:
2458         * kjs/lexer.h:
2459         * kjs/list.cpp:
2460         * kjs/list.h:
2461         * kjs/lookup.cpp:
2462         * kjs/lookup.h:
2463         * kjs/math_object.cpp:
2464         * kjs/math_object.h:
2465         * kjs/nodes.cpp:
2466         * kjs/nodes.h:
2467         * kjs/nodes2string.cpp:
2468         * kjs/number_object.cpp:
2469         * kjs/number_object.h:
2470         * kjs/object.cpp:
2471         * kjs/object.h:
2472         * kjs/object_object.cpp:
2473         * kjs/object_object.h:
2474         * kjs/operations.cpp:
2475         * kjs/operations.h:
2476         * kjs/property_map.cpp:
2477         * kjs/property_map.h:
2478         * kjs/property_slot.cpp:
2479         * kjs/property_slot.h:
2480         * kjs/reference.cpp:
2481         * kjs/reference.h:
2482         * kjs/reference_list.cpp:
2483         * kjs/reference_list.h:
2484         * kjs/regexp.cpp:
2485         * kjs/regexp.h:
2486         * kjs/regexp_object.cpp:
2487         * kjs/regexp_object.h:
2488         * kjs/scope_chain.cpp:
2489         * kjs/scope_chain.h:
2490         * kjs/simple_number.h:
2491         * kjs/string_object.cpp:
2492         * kjs/string_object.h:
2493         * kjs/testkjs.cpp:
2494         * kjs/types.h:
2495         * kjs/ustring.cpp:
2496         * kjs/ustring.h:
2497         * kjs/value.cpp:
2498         * kjs/value.h:
2499         * kxmlcore/AlwaysInline.h:
2500         * kxmlcore/ListRefPtr.h:
2501         * kxmlcore/PassRefPtr.h:
2502         * kxmlcore/RefPtr.h:
2503
2504 2006-01-23  Darin Adler  <darin@apple.com>
2505
2506         Reviewed by John Sullivan.
2507
2508         - change needed for fix to http://bugzilla.opendarwin.org/show_bug.cgi?id=6617
2509           REGRESSION: Crash in cloneChildNodes when clicking element
2510
2511         * kxmlcore/PassRefPtr.h: Fix assignment operator from RefPtr of a different
2512         type by calling get() instead of going directly at m_ptr.
2513         * kxmlcore/RefPtr.h: Ditto.
2514
2515         - other changes
2516
2517         * JavaScriptCore.xcodeproj/project.pbxproj: Xcode decided to change this file.
2518         It's just a resorted list of keys in a dictionary.
2519
2520         * kjs/fpconst.cpp: Wrap this file in #if __APPLE__ since the alternate version
2521         in internal.cpp is in #if !__APPLE__. This file is to give us the "no init
2522         routine" property we want to have on OS X.
2523
2524 2006-01-22  Maciej Stachowiak  <mjs@apple.com>
2525
2526         Reviewed by Darin.
2527
2528         - Set up Page class and invert Frame / WebCoreFrameBridge ownership
2529         http://bugzilla.opendarwin.org/show_bug.cgi?id=6577
2530
2531         * kjs/interpreter.h: make globalExec virtual so ScriptInterpreter can 
2532         override it
2533
2534 2006-01-23  George Staikos <staikos@opensource.apple.com>
2535
2536         Reviewed by Maciej and Darin.
2537
2538         * kxmlcore/Assertions.h: This file only works with __APPLE__ right now
2539         * kjs/interpreter.cpp: ditto
2540         * kjs/simple_number.h: Add assert.h and remove from config.h
2541         * kjs/array_object.cpp: Use relative paths for kxmlcore includes
2542         * kjs/testkjs.cpp: Use relative paths for kxmlcore includes
2543
2544 2006-01-23  George Staikos <staikos@opensource.apple.com>
2545
2546         Reviewed by Maciej.
2547
2548         * kjs/config.h: unbreak preprocessor change
2549
2550 2006-01-23  George Staikos <staikos@opensource.apple.com>
2551
2552         Approved by Maciej and Darin.
2553
2554         * kjs/:
2555         * kxmlcore/:
2556              Update FSF address in license to make merging easier
2557
2558 2006-01-22  George Staikos <staikos@opensource.apple.com>
2559
2560         Reviewed by Maciej.
2561
2562         * kjs/collector.cpp: merge major speedup from KDE on Linux
2563                              patch by Maks Orlovich, bug #6145
2564                              Also unify cpu detection
2565         * kjs/config.h: define simpler CPU macros
2566
2567 2006-01-22  George Staikos <staikos@opensource.apple.com>
2568
2569         Reviewed by Maciej.
2570
2571         * kjs/collector.cpp: merge FreeBSD compile fix from KDE
2572                              -> requires build magic for use
2573
2574 2006-01-21  George Staikos <staikos@opensource.apple.com>
2575
2576         Reviewed by Maciej.
2577
2578         * kjs/nodes2string.cpp
2579         * kjs/operations.h
2580         * kjs/debugger.h
2581           Fix pedantic compile with some gcc versions (Merge from KDE)
2582
2583         * kjs/create_hash_table:
2584           Fix build with Perl 5.8.0 (Merge from KDE)
2585
2586 2006-01-18  Darin Adler  <darin@apple.com>
2587
2588         Reviewed by Hyatt.
2589
2590         - hash table fixes needed for my WebCore changes
2591
2592         * kxmlcore/HashTable.h: (KXMLCore::HashTableConstIterator::operator=):
2593         Added a missing return statement.
2594
2595         * kxmlcore/HashTraits.h: Fix traits so they work properly for classes where you
2596         can't instantiate with a 0 by using traits rather than ? : to select the default
2597         emtpy value of hash table keys.
2598
2599         - small cleanup of "runtime" code left over from recent JavaScript crash fix
2600
2601         * bindings/runtime_root.h:
2602         (KJS::Bindings::RootObject::RootObject): No explicit initialization of _imp needed
2603         since it's now a ProtectedPtr.
2604         (KJS::Bindings::RootObject::setRootObjectImp): Remove old code that relied on the
2605         fact that _imp was 0 and replaced with use of ProtectedPtr.
2606         (KJS::Bindings::RootObject::rootObjectImp): Updated since _imp is a ProtectedPtr.
2607
2608 2006-01-17  Darin Adler  <darin@apple.com>
2609
2610         Reviewed by Anders.
2611
2612         - http://bugzilla.opendarwin.org/show_bug.cgi?id=6611
2613           add assertions to check correct use of hash table iterators
2614
2615         * kxmlcore/HashTable.h:
2616         (KXMLCore::addIterator): Added. Helper function that adds an iterator to the list
2617         maintained by the specified hash table.
2618         (KXMLCore::removeIterator): Added. Helper function that removes an iterator from
2619         the list maintained by the hash table it's in.
2620         (KXMLCore::HashTableConstIterator::HashTableConstIterator): Added a HashTable
2621         parameter, ignored when not debugging. Call addIterator.
2622         (KXMLCore::HashTableConstIterator::~HashTableConstIterator):
2623         (KXMLCore::HashTableConstIterator::operator=): Call removeIterator.
2624         (KXMLCore::HashTableConstIterator::operator*): Call checkValidity.
2625         (KXMLCore::HashTableConstIterator::operator->): Ditto.
2626         (KXMLCore::HashTableConstIterator::operator++): Ditto.
2627         (KXMLCore::HashTableConstIterator::operator==): Ditto.
2628         (KXMLCore::HashTableConstIterator::operator!=): Ditto.
2629         (KXMLCore::HashTableConstIterator::checkValidity): Checks that the hash table
2630         pointer is not 0 and if there are two iterators that both point at the same table.
2631         (KXMLCore::HashTableIterator::HashTableIterator): Changed to use the const iterator
2632         as an implementation detail, to avoid having two separate iterator implementations.
2633         (KXMLCore::HashTableIterator::operator*): Ditto.
2634         (KXMLCore::HashTableIterator::operator->): Ditto.
2635         (KXMLCore::HashTableIterator::operator++): Ditto.
2636         (KXMLCore::HashTableIterator::operator==): Ditto.
2637         (KXMLCore::HashTableIterator::operator!=): Ditto.
2638         (KXMLCore::HashTable::HashTable): Initialize pointer to head of iterators list.
2639         (KXMLCore::HashTable::~HashTable): Added call to invalidateIterators.
2640         (KXMLCore::HashTable::makeIterator): Pass this pointer.
2641         (KXMLCore::HashTable::makeConstIterator): Ditto.
2642         (KXMLCore::HashTable::insert): Call invalidateIterators, since this is a public
2643         entry point that modifies the hash table.
2644         (KXMLCore::HashTable::remove): Ditto.
2645         (KXMLCore::HashTable::clear): Ditto.
2646         (KXMLCore::HashTable::swap): Ditto.
2647         (KXMLCore::HashTable::invalidateIterators): Added. Walks the iterators list and
2648         clears out the table, next, and previous pointers in all of them, and then clears
2649         the head so we have an empty list.
2650         (KXMLCore::addIterator): Added. Adds the iterator the the linked list in the
2651         passed-in table, and points the iterator at the table.
2652         (KXMLCore::removeIterator): Added. Removes the iterator from the linked list in
2653         the passed-in table.
2654
2655         * kxmlcore/HashTraits.h: A bit of tweaking and formatting.
2656
2657 2006-01-17  Justin Garcia  <justin.garcia@apple.com>
2658
2659         Reviewed by eric
2660         
2661         Deployment builds now use -O2
2662
2663         * JavaScriptCore.xcodeproj/project.pbxproj:
2664
2665 2006-01-17  Darin Adler  <darin@apple.com>
2666
2667         Reviewed by Anders.
2668
2669         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6610
2670           change RefPtr so that it works when deref ends up deleting the RefPtr
2671
2672         * kxmlcore/PassRefPtr.h: Always set m_ptr before calling deref.
2673         * kxmlcore/RefPtr.h: Ditto.
2674
2675 2006-01-16  Geoffrey Garen  <ggaren@apple.com>
2676
2677         Reviewed by darin.
2678
2679         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6322
2680         DateProtoFuncImp::callAsFunction can crash due to lack of type checking
2681
2682         * kjs/date_object.cpp:
2683         (KJS::DateProtoFunc::callAsFunction): Type check calls to all methods. 
2684         This matches section 15.9.5 in the spec.
2685
2686 2006-01-16  Tim Omernick  <timo@apple.com>
2687
2688         Reviewed by John Sullivan.
2689
2690         JavaScriptCore part of <rdar://problem/4211707> NPAPI ref count behavior differs with Mozilla
2691
2692         * bindings/npruntime.cpp:
2693         (_NPN_ReleaseObject):
2694         Refactored part of this function out into _NPN_DeallocateObject.
2695         (_NPN_DeallocateObject):
2696         Forcibly deallocates the passed object, even if its refcount is
2697         greater than zero.
2698         
2699         * bindings/npruntime_impl.h:
2700         Declared _NPN_DeallocateObject().
2701
2702 2006-01-16  Darin Adler  <darin@apple.com>
2703
2704         Reviewed by Maciej.
2705
2706         - fix problem with ++, ==, and != on const iterators in
2707           HashMaps that are using the pointer specialization
2708
2709         * kxmlcore/HashMapPtrSpec.h:
2710         (KXMLCore::PointerHashConstIteratorAdapter::operator++): Change type to const_iterator.
2711         (KXMLCore::PointerHashConstIteratorAdapter::operator==): Ditto.
2712         (KXMLCore::PointerHashConstIteratorAdapter::operator!=): Ditto.
2713
2714 2006-01-15  Alexey Proskuryakov  <ap@nypop.com>
2715
2716         Reviewed by Anders.
2717
2718         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6561
2719         run-javascriptcore-tests doesn't work
2720
2721         * JavaScriptCore/tests/mozilla/Getopt/Mixed.pm: 
2722         Changed revision number to 1.8 (broken by svn migration).
2723
2724 2006-01-14  David Kilzer  <ddkilzer@kilzer.net>
2725
2726         Reviewed and landed by Anders.
2727
2728         * kjs/create_hash_table: Fixed comment typo.
2729
2730 2006-01-13  Maks Orlovich   <maksim@kde.org>
2731
2732         Mostly merging work by Peter Kelly. Reviewed by Maciej, landed by ap.
2733
2734         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6261
2735         Misc. array object fixes from KJS
2736
2737         * kjs/array_object.cpp: Don't treat 2^32-1 as a real array index property.
2738         (ArrayInstance::getOwnPropertySlot): Ditto.
2739         (ArrayInstance::deleteProperty): Ditto.
2740         (ArrayInstance::put): Ditto.
2741         (ArrayInstance::propList): Added a FIXME comment.
2742         (ArrayInstance::put): Throw exception on trying to set invalid array length.
2743         (ArrayProtoFunc::callAsFunction): Do not use a separator argument when doing toString/toLocalString.
2744         * kjs/array_object.h: Added MAX_ARRAY_INDEX.
2745
2746 2006-01-13  Darin Adler  <darin@apple.com>
2747
2748         - Replaced tabs with spaces in source files that had less than 10 lines with tabs.
2749         - Set allow-tabs Subversion property in source files that have more than 10 lines with tabs.
2750
2751 2006-01-13  Anders Carlsson  <andersca@mac.com>
2752
2753         Reviewed by Eric.
2754
2755         * kjs/create_hash_table:
2756         Use correct size variables.
2757
2758 2006-01-13  Anders Carlsson  <andersca@mac.com>
2759
2760         Reviewed by Darin.
2761
2762         * kjs/create_hash_table:
2763         Don't create an empty entry array, instead add a entry with all fields
2764         set to null and set the hash table size to 1.
2765         
2766         * kjs/lookup.cpp:
2767         (findEntry):
2768         Remove the hash table size check
2769
2770 2006-01-12  Anders Carlsson  <andersca@mac.com>
2771
2772         Reviewed by Maciej.
2773
2774         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6494
2775         Crash when assigning a new function to a DOMParser object
2776         
2777         * JavaScriptCore.xcodeproj/project.pbxproj:
2778         Move lookup.cpp before lookup.h
2779         
2780         * kjs/lookup.cpp:
2781         (findEntry):
2782         If the hash table is empty, return 0 early.
2783
2784 2006-01-12  George Staikos <staikos@kde.org>
2785
2786         Reviewed by Darin.
2787
2788         * kjs/interpreter.cpp:
2789         * kjs/testkjs.cpp:
2790         * kjs/interpreter.h:
2791         Add helper to interpreter to call the collector in order to facilitate
2792         visibility rules in KDE.
2793
2794 2006-01-12  George Staikos <staikos@kde.org>
2795
2796         Reviewed by Maciej.
2797
2798         * kjs/kjs.pro: Updates to build the whole thing on Linux at least.
2799
2800         * kxmlcore/HashTable.h: Add missing assert.h
2801
2802 2006-01-12  Darin Adler  <darin@apple.com>
2803
2804         Reviewed by Geoff.
2805
2806         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6505
2807           retire APPLE_CHANGES from JavaScriptCore
2808
2809         * JavaScriptCore.xcodeproj/project.pbxproj: Removed both
2810         APPLE_CHANGES and HAVE_CONFIG_H from all targets.
2811
2812         * README: Removed. This had obsolete information in it
2813         and it wasn't clear what to replace it with.
2814
2815         * kjs/collector.h: Removed an APPLE_CHANGES if around something
2816         that's not really platform-specific (although it does use a
2817         platform-specific API at the moment).
2818         * kjs/collector.cpp: Removed a mistaken comment.
2819
2820         * kjs/grammar.y:
2821         * kjs/internal.cpp:
2822         * kjs/object.h:
2823         * kjs/operations.cpp:
2824         * kjs/operations.h:
2825         * kjs/ustring.h:
2826         Use __APPLE__ instead of APPLE_CHANGES for code that should be
2827         used only on Mac OS X.
2828
2829         * kjs/interpreter.cpp: Removed APPLE_CHANGES ifdef around the include
2830         of the runtime.h header. Even though that header isn't needed at the
2831         moment on platforms other than Mac OS X, the conditional stuff should
2832         be in the header itself, not in this one client.
2833
2834         * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed some
2835         code inside APPLE_CHANGES. I'm pretty sure this code isn't needed on
2836         any platform where pow is implemented corrrectly according to the IEEE
2837         standard. If it is needed on some, we can add it back with an appropriate
2838         #if for the platforms where it is needed.
2839
2840 2006-01-12  Justin Haygood  <justin@xiondigital.net>
2841
2842         Reviewed, tweaked, and landed by Darin.
2843
2844         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6416
2845           lexer.cpp, grammar.y protect include of config.h with "HAVE_CONFIG_H"
2846
2847         * kjs/dtoa.cpp: Removed HAVE_CONFIG_H, changed config.h to use
2848         quotes instead of angle brackets. Moved dtoa.h include to the top.
2849         Changed system header includes to use angle brackets instead of quotes.
2850         * kjs/grammar.y: Removed HAVE_CONFIG_H, changed config.h to use
2851         quotes instead of angle brackets.
2852         * kjs/lexer.cpp: Removed HAVE_CONFIG_H, changed config.h to use
2853         quotes instead of angle brackets. Moved lexer.h include to the top.
2854         * kjs/ustring.cpp: Removed HAVE_CONFIG_H, changed config.h to use
2855         quotes instead of angle brackets. Moved ustring.h include to the top.
2856
2857 2006-01-12  George Staikos <staikos@kde.org>
2858
2859         Reviewed by Maciej
2860
2861         - Import initial QMake file.  Doesn't fully work yet.
2862
2863 2006-01-11  Ricci Adams  <ricciadams@apple.com>
2864
2865         Reviewed by Maciej and Darin, landed by Darin.
2866
2867         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5939
2868           final comma in javascript object prevents parsing
2869
2870         * kjs/grammar.y: Added rule to allow trailing comma in
2871         object construction.
2872
2873 2006-01-11  Ricci Adams  <ricciadams@apple.com>
2874
2875         Reviewed by Geoff, landed by Darin.
2876
2877         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5308
2878           Number.toFixed doesn't include leading 0
2879
2880         * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
2881         Fixed a "<" that should have been a "<=".
2882
2883 2006-01-11  Ricci Adams  <ricciadams@apple.com>
2884
2885         Reviewed by Geoff, landed by Darin.
2886
2887         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5307
2888           Number.toFixed doesn't round 0.5 up
2889
2890         * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
2891         Fixed a ">" that should have been a ">=".
2892
2893 2006-01-11  Justin Haygood  <justin@xiondigital.net>
2894
2895         Reviewed and landed by Darin.
2896
2897         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6486
2898           JavaScriptCore should use system malloc on Windows
2899
2900         * kjs/config.h: Add USE_SYSTEM_MALLOC to the Win32 section.
2901
2902 2006-01-10  Darin Adler  <darin@apple.com>
2903
2904         * Makefile: Took out unneeded "export" line.
2905         * <many-files>: Changed a lot of flags (cleared bogus executable bits, set
2906           MIME types, other small corrections).
2907
2908 2006-01-09  Darin Adler  <darin@apple.com>
2909
2910         * Makefile.am: Removed.
2911
2912 2006-01-07  Anders Carlsson  <andersca@mac.com>
2913
2914         Reviewed by Maciej.
2915         
2916         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6373
2917         REGRESSION: JavaScript hang when comparing large array to null
2918         
2919         * kjs/object.h:
2920         (KJS::JSObject::isEqualToNull):
2921         Add new function which returns true if an object should be treated as null when
2922         doing comparisons.
2923         
2924         * kjs/operations.cpp:
2925         (KJS::equal):
2926         Use isEqualToNull.
2927
2928 2006-01-07  Alexey Proskuryakov  <ap@nypop.com>
2929
2930         Reviewed by Maciej.
2931
2932         - Fix WebCore development build
2933         http://bugzilla.opendarwin.org/show_bug.cgi?id=6408
2934
2935         * kxmlcore/Assertions.h: Use __VA_ARGS__ in variadic macros.
2936
2937 2006-01-06  Maciej Stachowiak  <mjs@apple.com>
2938
2939         Reviewed by Darin.
2940
2941         - miscellaneous changes for 4% speedup on the JavaScript iBench
2942         http://bugzilla.opendarwin.org/show_bug.cgi?id=6396
2943         
2944         Changes mostly thanks to Maks Orlovich, tweaked a little by me.
2945
2946         * kjs/create_hash_table: Use the same hash as the one used by Identifier.
2947         * kjs/function.cpp:
2948         (KJS::FunctionImp::processParameters): Use the new List::copyFrom
2949         (KJS::ActivationImp::ActivationImp): track variable while iterating
2950         * kjs/internal.cpp:
2951         (KJS::StringImp::toObject): create StringInstance directly
2952         * kjs/list.cpp:
2953         (KJS::List::copy): implement in terms of copyFrom
2954         (KJS::List::copyFrom): more efficient way to copy in another list
2955         * kjs/list.h:
2956         * kjs/lookup.cpp:
2957         (keysMatch): updated to work with identifier hash
2958         (findEntry): ditto
2959         (Lookup::findEntry): ditto
2960         (Lookup::find): ditto
2961         * kjs/lookup.h:
2962
2963 2006-01-06  Maciej Stachowiak  <mjs@apple.com>
2964
2965         - fix development build failure from the previous checkin
2966
2967         * kjs/function.cpp:
2968         (KJS::ActivationImp::put): Use prototype() accessor in assert.
2969
2970 2006-01-05  Maciej Stachowiak  <mjs@apple.com>
2971
2972         Reviewed by Eric.
2973
2974         - fix remaining performance regression from Getter/Setter change
2975         http://bugzilla.opendarwin.org/show_bug.cgi?id=6249
2976
2977         - Activation objects should not have __proto__ property
2978         http://bugzilla.opendarwin.org/show_bug.cgi?id=6395
2979
2980         * kjs/function.cpp:
2981         (KJS::ActivationImp::getOwnPropertySlot): Implement directly, thus
2982         skipping getter/setter handling and __proto__ handling, as well
2983         as inlining needed superclass stuff.
2984         (KJS::ActivationImp::put): Implement directly, skipping getter/setter,
2985         __proto__, and do canPut directly in PropertyMap::put since there's no
2986         static property table either.
2987         * kjs/function.h:
2988         * kjs/property_map.cpp:
2989         (KJS::PropertyMap::put): Allow optionally inlining canPut check.
2990         * kjs/property_map.h:
2991
2992 2006-01-04  Geoffrey Garen  <ggaren@apple.com>
2993
2994         Patch by kimmo.t.kinnunen@nokia.com, reviewed by darin, tweaked by me.
2995
2996         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4921
2997         \u escape sequences in JavaScript identifiers
2998
2999         * kjs/function_object.cpp:
3000         (FunctionObjectImp::construct):
3001         * kjs/lexer.cpp:
3002         (Lexer::shift):
3003         (Lexer::lex):
3004         (Lexer::isWhiteSpace):
3005         (Lexer::isLineTerminator):
3006         (Lexer::isIdentStart):
3007         (Lexer::isIdentPart):
3008         (isDecimalDigit):
3009         (Lexer::scanRegExp):
3010         * kjs/lexer.h:
3011         (KJS::Lexer::):
3012
3013         * tests/mozilla/expected.html: Updated test results.
3014
3015 2005-12-30  Maciej Stachowiak  <mjs@apple.com>
3016
3017         No review, just test result update.
3018
3019         * tests/mozilla/expected.html: Updated for newly passing test from recent fixes.
3020
3021 2005-12-30  Anders Carlsson  <andersca@mac.com>
3022
3023         Reviewed by Maciej.
3024
3025         - Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6298
3026         Getter setter test is failing
3027                 
3028         * kjs/object.cpp:
3029         (KJS::JSObject::put):
3030         Rework the getter setter part. We now walk the prototype chain, checking for
3031         getter/setter properties and only take the slow path if any are found. 
3032
3033 2005-12-30  Maks Orlovich <maksim@kde.org>
3034
3035         Reviewed and committed by Maciej.
3036
3037         - Handle negative, FP numbers with non-10 radix in toString
3038         http://bugzilla.opendarwin.org/show_bug.cgi?id=6259
3039
3040         (Merged from KJS, original work by Harri Porten)
3041         
3042         * kjs/number_object.cpp:
3043         (NumberProtoFunc::callAsFunction): rewrote Number.toString(radix) to work with  
3044         negative numbers, floating point and very large numbers.
3045
3046 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
3047
3048         Patch by Maks Orlovich, reviewed and landed by me.
3049
3050         - http://bugzilla.opendarwin.org/show_bug.cgi?id=6267
3051         Fix Number.prototype.toFixed/toExponential(undefined)
3052
3053         * kjs/number_object.cpp:
3054         (NumberProtoFunc::callAsFunction):
3055
3056 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
3057
3058         Patch by Maks Orlovich, Reviewed and landed by me.
3059
3060         - http://bugzilla.opendarwin.org/show_bug.cgi?id=6266
3061         Minor object naming updates (to match Mozilla, KJS)
3062
3063         * kjs/number_object.cpp:
3064         * kjs/regexp_object.cpp:
3065
3066 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
3067
3068         Patch by Maks Orlovich, reviewed by mjs.
3069
3070         This has 2 very minor fixes, covered by KJS testsuite:    
3071         1. Enumerates string indices in property list (with the same bug as array    
3072            object has in corresponding code). This is a mozilla emulation thing. 
3073         2. Permits properties with integer names in prototypes to be found    
3074
3075         * kjs/string_object.cpp:
3076         (StringInstance::getOwnPropertySlot):
3077         (StringInstanceImp::propList):
3078         * kjs/string_object.h:
3079
3080 2005-12-26  Geoffrey Garen  <ggaren@apple.com>
3081
3082         Reviewed by mjs.
3083
3084         - Fixed <rdar://problem/4364705> run-javascriptcore-tests crashes in 
3085         KJS::BlockNode::deref 
3086         AKA 
3087         http://bugzilla.opendarwin.org/show_bug.cgi?id=6233
3088         Reproducible stack-overflow crash in ~RefPtr<T> due to RefPtr<T> use in 
3089         linked lists
3090
3091         This patch does four things: 
3092         (1) Standardizes all our linked list nodes to use "next" as their next 
3093         pointers. 
3094         (2) Creates the ListRefPtr<T> class, a subclass of RefPtr<T> specialized
3095         to iteratively deref "next" pointers.
3096         (3) Standardizes our linked list nodes to use ListRefPtr<T> and 
3097         implement the releaseNext() function used by ~ListRefPtr<T>().
3098         (4) Adds to RefPtr<T> the release() method used by releaseNext().
3099
3100         - Modified existing mozilla test to ensure it would make deployment 
3101         builds crash as well.
3102
3103         * JavaScriptCore.xcodeproj/project.pbxproj:
3104         * kjs/nodes.cpp:
3105         (ElementNode::evaluate):
3106         (PropertyListNode::evaluate):
3107         (ArgumentListNode::evaluateList):
3108         (StatListNode::StatListNode):
3109         (StatListNode::execute):
3110         (StatListNode::processVarDecls):
3111         (VarDeclListNode::evaluate):
3112         (VarDeclListNode::processVarDecls):
3113         (VarStatementNode::execute):
3114         (VarStatementNode::processVarDecls):
3115         (BlockNode::BlockNode):
3116         (CaseClauseNode::evalStatements):
3117         (CaseClauseNode::processVarDecls):
3118         (ClauseListNode::processVarDecls):
3119         (CaseBlockNode::CaseBlockNode):
3120         (CaseBlockNode::evalBlock):
3121         (SourceElementsNode::SourceElementsNode):
3122         (SourceElementsNode::execute):
3123         (SourceElementsNode::processFuncDecl):
3124         (SourceElementsNode::processVarDecls):
3125         * kjs/nodes.h:
3126         (KJS::ElementNode::ElementNode):
3127         (KJS::ElementNode::releaseNext):
3128         (KJS::ArrayNode::ArrayNode):
3129         (KJS::PropertyListNode::PropertyListNode):
3130         (KJS::PropertyListNode::releaseNext):
3131         (KJS::ObjectLiteralNode::ObjectLiteralNode):
3132         (KJS::ArgumentListNode::ArgumentListNode):
3133         (KJS::ArgumentListNode::releaseNext):
3134         (KJS::ArgumentsNode::ArgumentsNode):
3135         (KJS::StatListNode::releaseNext):
3136         (KJS::VarDeclListNode::VarDeclListNode):
3137         (KJS::VarDeclListNode::releaseNext):
3138         (KJS::VarStatementNode::VarStatementNode):
3139         (KJS::ForNode::ForNode):
3140         (KJS::CaseClauseNode::CaseClauseNode):
3141         (KJS::ClauseListNode::ClauseListNode):
3142         (KJS::ClauseListNode::getClause):
3143         (KJS::ClauseListNode::getNext):
3144         (KJS::ClauseListNode::releaseNext):
3145         (KJS::ParameterNode::ParameterNode):
3146         (KJS::ParameterNode::releaseNext):
3147         (KJS::SourceElementsNode::releaseNext):
3148         * kjs/nodes2string.cpp:
3149         (ElementNode::streamTo):
3150         (PropertyListNode::streamTo):
3151         (ArgumentListNode::streamTo):
3152         (StatListNode::streamTo):
3153         (VarDeclListNode::streamTo):
3154         (VarStatementNode::streamTo):
3155         (CaseClauseNode::streamTo):
3156         (ClauseListNode::streamTo):
3157         (CaseBlockNode::streamTo):
3158         (SourceElementsNode::streamTo):
3159         * kxmlcore/ListRefPtr.h: Added.
3160         (KXMLCore::ListRefPtr::ListRefPtr):
3161         (KXMLCore::ListRefPtr::~ListRefPtr):
3162         (KXMLCore::ListRefPtr::operator=):
3163         * kxmlcore/RefPtr.h:
3164         (KXMLCore::RefPtr::release):
3165
3166 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
3167
3168         Reviewed by mjs.
3169
3170         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4026
3171         Math.random() not seeded.
3172
3173         Added call to sranddev() -- it executes the first time a process
3174         calls Math.random().
3175
3176         * kjs/math_object.cpp:
3177         (MathFuncImp::callAsFunction):
3178
3179 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
3180
3181         Reviewed by darin.
3182
3183         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6265
3184         Name change regression: Java doesn't know what JavaJSObject is
3185
3186         Changed strings passed to Java back to original "JSObject".
3187
3188         * bindings/jni/jni_jsobject.cpp:
3189         (JavaJSObject::convertValueToJObject):
3190         (JavaJSObject::convertJObjectToValue):
3191
3192 2005-12-28  Anders Carlsson  <andersca@mac.com>
3193
3194         Reviewed by Maciej.
3195
3196         - The JSC part of http://bugzilla.opendarwin.org/show_bug.cgi?id=6268
3197         Add undetectable document.all
3198         
3199         * kjs/operations.cpp:
3200         (KJS::equal):
3201         When comparing an object with null or undefined, call toPrimitive with 
3202         NullType as the preferred type.
3203
3204 2005-12-27  Anders Carlsson  <andersca@mac.com>
3205
3206         Reviewed by Darin.
3207
3208         * kjs/array_object.cpp:
3209         (ArrayProtoFunc::callAsFunction):
3210         Implement filter and map. Also, make the existing
3211         array iteration functions not invoke the callback for
3212         non-existing properties, just as Mozilla does now.
3213         
3214         * kjs/array_object.h:
3215         (KJS::ArrayProtoFunc::):
3216         Add filter and map.
3217         
3218         * tests/mozilla/expected.html:
3219         Update, two 1.6 tests now pass.
3220
3221 2005-12-27  Maciej Stachowiak  <mjs@apple.com>
3222
3223         - updated test results for new JS 1.6 tests
3224
3225         * tests/mozilla/expected.html:
3226
3227 2005-12-27  Anders Carlsson  <andersca@mac.com>
3228
3229         Reviewed by Maciej.
3230
3231         Add Mozilla JS 1.6 tests.
3232         
3233         * tests/mozilla/js1_6/Array/browser.js: Added.
3234         * tests/mozilla/js1_6/Array/regress-290592.js: Added.
3235         * tests/mozilla/js1_6/Array/regress-304828.js: Added.
3236         * tests/mozilla/js1_6/Array/regress-305002.js: Added.
3237         * tests/mozilla/js1_6/Array/regress-310425-01.js: Added.
3238         * tests/mozilla/js1_6/Array/regress-310425-02.js: Added.
3239         * tests/mozilla/js1_6/Array/regress-320887.js: Added.
3240         * tests/mozilla/js1_6/Array/shell.js: Added.
3241         * tests/mozilla/js1_6/README: Added.
3242         * tests/mozilla/js1_6/Regress/browser.js: Added.
3243         * tests/mozilla/js1_6/Regress/regress-301574.js: Added.
3244         * tests/mozilla/js1_6/Regress/regress-309242.js: Added.
3245         * tests/mozilla/js1_6/Regress/regress-311157-01.js: Added.
3246         * tests/mozilla/js1_6/Regress/regress-311157-02.js: Added.
3247         * tests/mozilla/js1_6/Regress/regress-314887.js: Added.
3248         * tests/mozilla/js1_6/Regress/regress-320172.js: Added.
3249         * tests/mozilla/js1_6/Regress/shell.js: Added.
3250         * tests/mozilla/js1_6/String/browser.js: Added.
3251         * tests/mozilla/js1_6/String/regress-306591.js: Added.
3252         * tests/mozilla/js1_6/String/shell.js: Added.
3253         * tests/mozilla/js1_6/browser.js: Added.
3254         * tests/mozilla/js1_6/shell.js: Added.
3255         * tests/mozilla/js1_6/template.js: Added.
3256
3257 2005-12-27  Maks Orlovich <maksim@kde.org>
3258
3259         Reviewed and landed by Maciej.
3260
3261         - fixed 6234: Can delete array index property incorrectly.
3262         http://bugzilla.opendarwin.org/show_bug.cgi?id=6234
3263
3264         * kjs/array_object.cpp:
3265         (ArrayInstance::deleteProperty): use toArrayIndex instead of toUInt32 when
3266         looking for array properties.
3267
3268 2005-12-27  Anders Carlsson  <andersca@mac.com>
3269
3270         Reviewed by Maciej.
3271
3272         * kjs/object.cpp:
3273         (KJS::JSObject::defineSetter):
3274         Remove duplicate call to putDirect.
3275
3276 2005-12-26  Maciej Stachowiak  <mjs@apple.com>
3277
3278         Reviewed by Darin and Geoff.
3279
3280         Changes by me and Anders.
3281
3282         - mostly fixed REGRESSION: 5-10% performance regression on JS iBench from getter/setter change
3283         http://bugzilla.opendarwin.org/show_bug.cgi?id=6083
3284
3285         - also fixed some warnings reported by -Winline
3286         
3287         * JavaScriptCorePrefix.h: Move new and delete definitions higher so there
3288         aren't conflicts with use in standard C++ headers
3289         * kjs/object.cpp:
3290         (KJS::throwSetterError): Moved this piece of put into a seprate function
3291         to avoid the PIC branch.
3292         (KJS::JSObject::put): Use hasGetterSetterProperties to avoid expensive stuff
3293         when not needed. Also use GetterSetter properties attribute.
3294         (KJS::JSObject::deleteProperty): Recompute whether any properties are getter/setter
3295         properties any more, if this one was one.
3296         (KJS::JSObject::defineGetter): Let the PropertyMap know that it has getter/setter
3297         properties now (and use the new attribute).
3298         (KJS::JSObject::defineSetter): Ditto.
3299         (KJS::JSObject::fillGetterPropertySlot): Out-of-line helper for getOwnPropertySlot,
3300         to avoid global variable access in the hot code path.
3301         * kjs/object.h:
3302         (KJS::): Added GetterSetter attribute.
3303         (KJS::JSCell::isObject): Moved lower to be after inline methods it uses.
3304         (KJS::JSValue::isObject): ditto
3305         (KJS::JSObject::getOwnPropertySlot): try to avoid impact of getters and setters
3306         as much as possible in the case where they are not being used
3307         * kjs/property_map.cpp:
3308         (KJS::PropertyMap::containsGettersOrSetters): New method to help with this
3309         * kjs/property_map.h:
3310         (KJS::PropertyMap::hasGetterSetterProperties): Ditto
3311         (KJS::PropertyMap::setHasGetterSetterProperties): Ditto
3312         (KJS::PropertyMap::PropertyMap): Added a crazy hack to store the
3313         global "has getter/setter properties" flag in the property map
3314         single entry, to avoid making objects any bigger.
3315         * kjs/value.h: Moved some things to object.h to make -Winline happier
3316
3317 2005-12-24  Maciej Stachowiak  <mjs@apple.com>
3318
3319         Reviewed by Eric and Dave Hyatt.
3320
3321         - make even const PassRefPtrs give transfer of ownership semantics
3322         http://bugzilla.opendarwin.org/show_bug.cgi?id=6238
3323         
3324         This is a somewhat cheesy change. Having to use PassRefPtr_Ref creates ambiguities
3325         in assignment and copy construction. And this makes life way easier and removes
3326         the need for pass(). It is not really correct, but we pretty much never need a real
3327         const PassRefPtr, and this takes care of things for PassRefPtr temporaries.
3328         
3329         * kjs/identifier.cpp:
3330         (KJS::Identifier::add): No more need for pass()
3331         * kjs/property_map.cpp:
3332         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): No more need for pass()
3333         * kjs/ustring.cpp:
3334         (KJS::UString::Rep::create): Use adoptRef
3335         (KJS::UString::UString): No more need for pass
3336         (KJS::UString::append): No more need for pass
3337         (KJS::UString::substr): No more need for pass
3338         * kxmlcore/PassRefPtr.h: made m_ptr mutable (ugh)
3339         (KXMLCore::PassRefPtr::PassRefPtr): Take a const PassRefPtr reference
3340         (KXMLCore::PassRefPtr::release): Made this a const method (ugh)
3341         (KXMLCore::PassRefPtr::operator=): clean up appropriately
3342         (KXMLCore::adoptRef): Added this to use instead of PassRefPtr<T>::adopt, I think
3343         it makes the behavior more clear and it is less verbose.
3344         (KXMLCore::static_pointer_cast): use adoptRef
3345         (KXMLCore::const_pointer_cast): use adoptRef
3346         * kxmlcore/RefPtr.h:
3347         (KXMLCore::RefPtr::RefPtr): take const PassRefPtr&
3348         (KXMLCore::PassRefPtr::operator=): take const PassRefPtr&
3349
3350 2005-12-25  Eric Seidel  <eseidel@apple.com>
3351
3352         Reviewed by mjs.
3353
3354         Unbreak HashTableConstIterator++ by returning const_iterator
3355
3356         * kxmlcore/HashTable.h:
3357         (KXMLCore::HashTableConstIterator::operator++): use const_iterator
3358
3359 2005-12-25  Eric Seidel  <eseidel@apple.com>
3360
3361         Reviewed by mjs.
3362
3363         Un-break HashTable copy constructor.
3364
3365         * kxmlcore/HashTable.h:
3366         (KXMLCore::::HashTable): use const_iterator instead
3367
3368 2005-12-23  Maciej Stachowiak  <mjs@apple.com>
3369
3370         Reviewed by Eric.
3371
3372         - fixed "HashMap does not work with const pointer keys or values"
3373         http://bugzilla.opendarwin.org/show_bug.cgi?id=6222
3374         
3375         * kxmlcore/HashMapPtrSpec.h:
3376         (KXMLCore::HashMap): In all methods, explicitly cast all pointers
3377         to void * before passing to internal implementation. Use C-style
3378         casts instead of new-style casts, because the real solution would
3379         require a combo of reinterpret_cast anc const_cast.
3380
3381
3382 2005-12-23  Maciej Stachowiak  <mjs@apple.com>
3383
3384         - this time for sure
3385
3386         * kxmlcore/RefPtr.h:
3387         (KXMLCore::::swap):
3388
3389 2005-12-22  Maciej Stachowiak  <mjs@apple.com>
3390
3391         - fix build problem from last commit.
3392
3393         * kxmlcore/RefPtr.h:
3394         (KXMLCore::::swap):
3395
3396 2005-12-21  Maciej Stachowiak  <mjs@apple.com>
3397
3398         Reviewed by Darin.
3399
3400         - Make HashMap/HashSet support non-POD types
3401         http://bugzilla.opendarwin.org/show_bug.cgi?id=5332
3402
3403         The changes for support are relatively simple, but I also made extensive changes to
3404         avoid copying, so that there isn't refcount thrash when you put RefPtrs into a HashMap.
3405
3406         * kxmlcore/HashTable.h:
3407         (KXMLCore::swap): specialize swap for pairs, to swap elements individually,
3408         so that excess copies can be avoided.
3409         (KXMLCore::Mover::move): Template function to either copy or swap, used
3410         when transferring elements from old table to new.
3411         (KXMLCore::IdentityHashTranslator::hash): The old "converting lookup" templates
3412         that took two or three function parameters now take a class parameter, this is
3413         the class used to do a normal lookup.
3414         (KXMLCore::IdentityHashTranslator::equal): Ditto.
3415         (KXMLCore::IdentityHashTranslator::translate): Ditto. Translate now takes a reference
3416         to write into instead of returning a value to avoid redundant copies.
3417         (KXMLCore::HashTable::~HashTable): Use deallocateTable instead of freeing directly.
3418         (KXMLCore::HashTable::insert): Based on HashTranslator now instead of separate
3419         functions. Added a FIXME about a remaining rare excess copy.
3420         (KXMLCore::HashTable::isEmptyBucket): Use KeyTraits directly instead of unwrapping
3421         the key from Traits, to avoid creating and destroying pair, which copies.
3422         (KXMLCore::HashTable::isDeletedBucket): ditto
3423         (KXMLCore::HashTable::lookup): Use HashTranslator now instead of separate functions.
3424         (KXMLCore::HashTable::initializeBucket): Renamed from emptyBucket. Use placement new to
3425         work right for non-POD types.
3426         (KXMLCore::HashTable::deleteBucket): Use assignDeleted to avoid excess copies.
3427         (KXMLCore::HashTable::reinsert): use Mover template to copy or swap as appropriate
3428         (KXMLCore::HashTable::allocateTable): Initialize every bucket if calloc won't do.
3429         (KXMLCore::HashTable::deallocateTable): Destruct every bucket if needed.
3430         (KXMLCore::HashTable::rehash): Avoid copy before reinserting, so that swap can do its magic.
3431         (KXMLCore::HashTable::clear): use deallocateTable instead of freeing directly.
3432         (KXMLCore::HashTable::HashTable): be more dumb when copying to ensure that non-POD types
3433         work right
3434         * kxmlcore/HashFunctions.h:
3435         (KXMLCore::PointerHash): Specialize PointerHash for RefPtr
3436         * kxmlcore/HashMap.h:
3437         (KXMLCore::extractFirst): Return a reference not a full object to avoid
3438         copies.
3439         (KXMLCore::HashMapTranslator::hash): Use a special translator for insertion
3440         to defer making the pair as long as possible, thus avoiding needless copies.
3441         (KXMLCore::HashMapTranslator::equal): ditto
3442         (KXMLCore::HashMapTranslator::translate): ditto
3443         (KXMLCore::::inlineAdd): Shared by set and add to insert using HashMapTranslator
3444         (KXMLCore::::set): Use inlineAdd
3445         (KXMLCore::::add): Use inlineAdd
3446         * kxmlcore/HashMapPtrSpec.h:
3447         (KXMLCore::): Pass KeyTraits along
3448         * kxmlcore/HashSet.h:
3449         (KXMLCore::identityExtract): Return a reference not a full object to avoid copies.
3450         (KXMLCore::HashSetTranslatorAdapter::hash): Redo adapter stuff to work with
3451         the new HashTranslator approach.
3452         (KXMLCore::HashSetTranslatorAdapter::equal): ditto
3453         (KXMLCore::HashSetTranslatorAdapter::translate): ditto
3454         (KXMLCore::::insert): ditto
3455         * kxmlcore/HashTraits.h:
3456         (KXMLCore::GenericHashTraits): This is intended be used as a base class for
3457         customized traits: sensible defaults.
3458         (KXMLCore::): Use it a bunch
3459         (KXMLCore::assignDeleted): template function to allow pairs to be assigned the
3460         deleted value w/o excess copies.
3461         (KXMLCore::PairHashTraits::emptyValue): Updated
3462         (KXMLCore::PairHashTraits::deletedValue): Updated
3463         (KXMLCore::PairHashTraits::assignDeletedValue): part of assignDeleted hack
3464         (KXMLCore::DeletedValueAssigner::assignDeletedValue): Use template magic
3465         to either use use deletedValue or assignDeletedValue for the cases where we care.
3466         * kxmlcore/RefPtr.h:
3467         (KXMLCore::RefPtr::swap): Added swap method.
3468         (KXMLCore::swap): Added swap free function.
3469         * kjs/identifier.cpp:
3470         (KJS::CStringTranslator::hash): Use new HashTranslator class approach to
3471         alternate type based insertion.
3472         (KJS::CStringTranslator::equal): ditto
3473         (KJS::CStringTranslator::translate): ditto
3474         (KJS::Identifier::add): ditto
3475         (KJS::UCharBufferTranslator::hash): ditto
3476         (KJS::UCharBufferTranslator::equal): ditto
3477         (KJS::UCharBufferTranslator::translate): ditto
3478
3479         - irrelevant change:
3480         
3481         * kjs/array_object.cpp:
3482         (ArrayProtoFunc::callAsFunction): Removed a stray space.
3483
3484 2005-12-22  Anders Carlsson  <andersca@mac.com>
3485
3486         Reviewed by Eric and Darin.
3487
3488         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6196
3489         Would like to be able to define prototypes in headers
3490         
3491         * kjs/lookup.h:
3492         Move ClassName from KJS_DECLARE_PROTOTYPE to KJS_IMPLEMENT_PROTOTYPE.
3493         Also, namespace all macros by prefixing them with KJS_. 
3494
3495 2005-12-22  Darin Adler  <darin@apple.com>
3496
3497         Reviewed by Maciej.
3498
3499         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6191
3500           RefPtr/PassRefPtr have a leak issue, operator== issues
3501
3502         * kxmlcore/PassRefPtr.h:
3503         (KXMLCore::PassRefPtr::PassRefPtr): Remove non-template constructor that takes RefPtr
3504         since the constructor template that takes RefPtr should be sufficient. Add a constructor
3505         template that takes PassRefPtr&.
3506         (KXMLCore::PassRefPtr::adopt): Use PassRefPtr_Ref to avoid setting pointer first to
3507         0 and then to the pointer.
3508         (KXMLCore::PassRefPtr::operator=): Added template versions that take PassRefPtr& and
3509         RefPtr parameters.