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