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