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