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