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