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