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