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