b053c93f1c93e44304b07af8cc94af5b341e7d1c
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2006-01-21  George Staikos <staikos@opensource.apple.com>
2
3         Reviewed by Maciej.
4
5         * kjs/nodes2string.cpp
6         * kjs/operations.h
7         * kjs/debugger.h
8           Fix pedantic compile with some gcc versions (Merge from KDE)
9
10         * kjs/create_hash_table:
11           Fix build with Perl 5.8.0 (Merge from KDE)
12
13 2006-01-18  Darin Adler  <darin@apple.com>
14
15         Reviewed by Hyatt.
16
17         - hash table fixes needed for my WebCore changes
18
19         * kxmlcore/HashTable.h: (KXMLCore::HashTableConstIterator::operator=):
20         Added a missing return statement.
21
22         * kxmlcore/HashTraits.h: Fix traits so they work properly for classes where you
23         can't instantiate with a 0 by using traits rather than ? : to select the default
24         emtpy value of hash table keys.
25
26         - small cleanup of "runtime" code left over from recent JavaScript crash fix
27
28         * bindings/runtime_root.h:
29         (KJS::Bindings::RootObject::RootObject): No explicit initialization of _imp needed
30         since it's now a ProtectedPtr.
31         (KJS::Bindings::RootObject::setRootObjectImp): Remove old code that relied on the
32         fact that _imp was 0 and replaced with use of ProtectedPtr.
33         (KJS::Bindings::RootObject::rootObjectImp): Updated since _imp is a ProtectedPtr.
34
35 2006-01-17  Darin Adler  <darin@apple.com>
36
37         Reviewed by Anders.
38
39         - http://bugzilla.opendarwin.org/show_bug.cgi?id=6611
40           add assertions to check correct use of hash table iterators
41
42         * kxmlcore/HashTable.h:
43         (KXMLCore::addIterator): Added. Helper function that adds an iterator to the list
44         maintained by the specified hash table.
45         (KXMLCore::removeIterator): Added. Helper function that removes an iterator from
46         the list maintained by the hash table it's in.
47         (KXMLCore::HashTableConstIterator::HashTableConstIterator): Added a HashTable
48         parameter, ignored when not debugging. Call addIterator.
49         (KXMLCore::HashTableConstIterator::~HashTableConstIterator):
50         (KXMLCore::HashTableConstIterator::operator=): Call removeIterator.
51         (KXMLCore::HashTableConstIterator::operator*): Call checkValidity.
52         (KXMLCore::HashTableConstIterator::operator->): Ditto.
53         (KXMLCore::HashTableConstIterator::operator++): Ditto.
54         (KXMLCore::HashTableConstIterator::operator==): Ditto.
55         (KXMLCore::HashTableConstIterator::operator!=): Ditto.
56         (KXMLCore::HashTableConstIterator::checkValidity): Checks that the hash table
57         pointer is not 0 and if there are two iterators that both point at the same table.
58         (KXMLCore::HashTableIterator::HashTableIterator): Changed to use the const iterator
59         as an implementation detail, to avoid having two separate iterator implementations.
60         (KXMLCore::HashTableIterator::operator*): Ditto.
61         (KXMLCore::HashTableIterator::operator->): Ditto.
62         (KXMLCore::HashTableIterator::operator++): Ditto.
63         (KXMLCore::HashTableIterator::operator==): Ditto.
64         (KXMLCore::HashTableIterator::operator!=): Ditto.
65         (KXMLCore::HashTable::HashTable): Initialize pointer to head of iterators list.
66         (KXMLCore::HashTable::~HashTable): Added call to invalidateIterators.
67         (KXMLCore::HashTable::makeIterator): Pass this pointer.
68         (KXMLCore::HashTable::makeConstIterator): Ditto.
69         (KXMLCore::HashTable::insert): Call invalidateIterators, since this is a public
70         entry point that modifies the hash table.
71         (KXMLCore::HashTable::remove): Ditto.
72         (KXMLCore::HashTable::clear): Ditto.
73         (KXMLCore::HashTable::swap): Ditto.
74         (KXMLCore::HashTable::invalidateIterators): Added. Walks the iterators list and
75         clears out the table, next, and previous pointers in all of them, and then clears
76         the head so we have an empty list.
77         (KXMLCore::addIterator): Added. Adds the iterator the the linked list in the
78         passed-in table, and points the iterator at the table.
79         (KXMLCore::removeIterator): Added. Removes the iterator from the linked list in
80         the passed-in table.
81
82         * kxmlcore/HashTraits.h: A bit of tweaking and formatting.
83
84 2006-01-17  Justin Garcia  <justin.garcia@apple.com>
85
86         Reviewed by eric
87         
88         Deployment builds now use -O2
89
90         * JavaScriptCore.xcodeproj/project.pbxproj:
91
92 2006-01-17  Darin Adler  <darin@apple.com>
93
94         Reviewed by Anders.
95
96         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6610
97           change RefPtr so that it works when deref ends up deleting the RefPtr
98
99         * kxmlcore/PassRefPtr.h: Always set m_ptr before calling deref.
100         * kxmlcore/RefPtr.h: Ditto.
101
102 2006-01-16  Geoffrey Garen  <ggaren@apple.com>
103
104         Reviewed by darin.
105
106         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6322
107         DateProtoFuncImp::callAsFunction can crash due to lack of type checking
108
109         * kjs/date_object.cpp:
110         (KJS::DateProtoFunc::callAsFunction): Type check calls to all methods. 
111         This matches section 15.9.5 in the spec.
112
113 2006-01-16  Tim Omernick  <timo@apple.com>
114
115         Reviewed by John Sullivan.
116
117         JavaScriptCore part of <rdar://problem/4211707> NPAPI ref count behavior differs with Mozilla
118
119         * bindings/npruntime.cpp:
120         (_NPN_ReleaseObject):
121         Refactored part of this function out into _NPN_DeallocateObject.
122         (_NPN_DeallocateObject):
123         Forcibly deallocates the passed object, even if its refcount is
124         greater than zero.
125         
126         * bindings/npruntime_impl.h:
127         Declared _NPN_DeallocateObject().
128
129 2006-01-16  Darin Adler  <darin@apple.com>
130
131         Reviewed by Maciej.
132
133         - fix problem with ++, ==, and != on const iterators in
134           HashMaps that are using the pointer specialization
135
136         * kxmlcore/HashMapPtrSpec.h:
137         (KXMLCore::PointerHashConstIteratorAdapter::operator++): Change type to const_iterator.
138         (KXMLCore::PointerHashConstIteratorAdapter::operator==): Ditto.
139         (KXMLCore::PointerHashConstIteratorAdapter::operator!=): Ditto.
140
141 2006-01-15  Alexey Proskuryakov  <ap@nypop.com>
142
143         Reviewed by Anders.
144
145         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6561
146         run-javascriptcore-tests doesn't work
147
148         * JavaScriptCore/tests/mozilla/Getopt/Mixed.pm: 
149         Changed revision number to 1.8 (broken by svn migration).
150
151 2006-01-14  David Kilzer  <ddkilzer@kilzer.net>
152
153         Reviewed and landed by Anders.
154
155         * kjs/create_hash_table: Fixed comment typo.
156
157 2006-01-13  Maks Orlovich   <maksim@kde.org>
158
159         Mostly merging work by Peter Kelly. Reviewed by Maciej, landed by ap.
160
161         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6261
162         Misc. array object fixes from KJS
163
164         * kjs/array_object.cpp: Don't treat 2^32-1 as a real array index property.
165         (ArrayInstance::getOwnPropertySlot): Ditto.
166         (ArrayInstance::deleteProperty): Ditto.
167         (ArrayInstance::put): Ditto.
168         (ArrayInstance::propList): Added a FIXME comment.
169         (ArrayInstance::put): Throw exception on trying to set invalid array length.
170         (ArrayProtoFunc::callAsFunction): Do not use a separator argument when doing toString/toLocalString.
171         * kjs/array_object.h: Added MAX_ARRAY_INDEX.
172
173 2006-01-13  Darin Adler  <darin@apple.com>
174
175         - Replaced tabs with spaces in source files that had less than 10 lines with tabs.
176         - Set allow-tabs Subversion property in source files that have more than 10 lines with tabs.
177
178 2006-01-13  Anders Carlsson  <andersca@mac.com>
179
180         Reviewed by Eric.
181
182         * kjs/create_hash_table:
183         Use correct size variables.
184
185 2006-01-13  Anders Carlsson  <andersca@mac.com>
186
187         Reviewed by Darin.
188
189         * kjs/create_hash_table:
190         Don't create an empty entry array, instead add a entry with all fields
191         set to null and set the hash table size to 1.
192         
193         * kjs/lookup.cpp:
194         (findEntry):
195         Remove the hash table size check
196
197 2006-01-12  Anders Carlsson  <andersca@mac.com>
198
199         Reviewed by Maciej.
200
201         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6494
202         Crash when assigning a new function to a DOMParser object
203         
204         * JavaScriptCore.xcodeproj/project.pbxproj:
205         Move lookup.cpp before lookup.h
206         
207         * kjs/lookup.cpp:
208         (findEntry):
209         If the hash table is empty, return 0 early.
210
211 2006-01-12  George Staikos <staikos@kde.org>
212
213         Reviewed by Darin.
214
215         * kjs/interpreter.cpp:
216         * kjs/testkjs.cpp:
217         * kjs/interpreter.h:
218         Add helper to interpreter to call the collector in order to facilitate
219         visibility rules in KDE.
220
221 2006-01-12  George Staikos <staikos@kde.org>
222
223         Reviewed by Maciej.
224
225         * kjs/kjs.pro: Updates to build the whole thing on Linux at least.
226
227         * kxmlcore/HashTable.h: Add missing assert.h
228
229 2006-01-12  Darin Adler  <darin@apple.com>
230
231         Reviewed by Geoff.
232
233         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6505
234           retire APPLE_CHANGES from JavaScriptCore
235
236         * JavaScriptCore.xcodeproj/project.pbxproj: Removed both
237         APPLE_CHANGES and HAVE_CONFIG_H from all targets.
238
239         * README: Removed. This had obsolete information in it
240         and it wasn't clear what to replace it with.
241
242         * kjs/collector.h: Removed an APPLE_CHANGES if around something
243         that's not really platform-specific (although it does use a
244         platform-specific API at the moment).
245         * kjs/collector.cpp: Removed a mistaken comment.
246
247         * kjs/grammar.y:
248         * kjs/internal.cpp:
249         * kjs/object.h:
250         * kjs/operations.cpp:
251         * kjs/operations.h:
252         * kjs/ustring.h:
253         Use __APPLE__ instead of APPLE_CHANGES for code that should be
254         used only on Mac OS X.
255
256         * kjs/interpreter.cpp: Removed APPLE_CHANGES ifdef around the include
257         of the runtime.h header. Even though that header isn't needed at the
258         moment on platforms other than Mac OS X, the conditional stuff should
259         be in the header itself, not in this one client.
260
261         * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed some
262         code inside APPLE_CHANGES. I'm pretty sure this code isn't needed on
263         any platform where pow is implemented corrrectly according to the IEEE
264         standard. If it is needed on some, we can add it back with an appropriate
265         #if for the platforms where it is needed.
266
267 2006-01-12  Justin Haygood  <justin@xiondigital.net>
268
269         Reviewed, tweaked, and landed by Darin.
270
271         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6416
272           lexer.cpp, grammar.y protect include of config.h with "HAVE_CONFIG_H"
273
274         * kjs/dtoa.cpp: Removed HAVE_CONFIG_H, changed config.h to use
275         quotes instead of angle brackets. Moved dtoa.h include to the top.
276         Changed system header includes to use angle brackets instead of quotes.
277         * kjs/grammar.y: Removed HAVE_CONFIG_H, changed config.h to use
278         quotes instead of angle brackets.
279         * kjs/lexer.cpp: Removed HAVE_CONFIG_H, changed config.h to use
280         quotes instead of angle brackets. Moved lexer.h include to the top.
281         * kjs/ustring.cpp: Removed HAVE_CONFIG_H, changed config.h to use
282         quotes instead of angle brackets. Moved ustring.h include to the top.
283
284 2006-01-12  George Staikos <staikos@kde.org>
285
286         Reviewed by Maciej
287
288         - Import initial QMake file.  Doesn't fully work yet.
289
290 2006-01-11  Ricci Adams  <ricciadams@apple.com>
291
292         Reviewed by Maciej and Darin, landed by Darin.
293
294         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5939
295           final comma in javascript object prevents parsing
296
297         * kjs/grammar.y: Added rule to allow trailing comma in
298         object construction.
299
300 2006-01-11  Ricci Adams  <ricciadams@apple.com>
301
302         Reviewed by Geoff, landed by Darin.
303
304         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5308
305           Number.toFixed doesn't include leading 0
306
307         * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
308         Fixed a "<" that should have been a "<=".
309
310 2006-01-11  Ricci Adams  <ricciadams@apple.com>
311
312         Reviewed by Geoff, landed by Darin.
313
314         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5307
315           Number.toFixed doesn't round 0.5 up
316
317         * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
318         Fixed a ">" that should have been a ">=".
319
320 2006-01-11  Justin Haygood  <justin@xiondigital.net>
321
322         Reviewed and landed by Darin.
323
324         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6486
325           JavaScriptCore should use system malloc on Windows
326
327         * kjs/config.h: Add USE_SYSTEM_MALLOC to the Win32 section.
328
329 2006-01-10  Darin Adler  <darin@apple.com>
330
331         * Makefile: Took out unneeded "export" line.
332         * <many-files>: Changed a lot of flags (cleared bogus executable bits, set
333           MIME types, other small corrections).
334
335 2006-01-09  Darin Adler  <darin@apple.com>
336
337         * Makefile.am: Removed.
338
339 2006-01-07  Anders Carlsson  <andersca@mac.com>
340
341         Reviewed by Maciej.
342         
343         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6373
344         REGRESSION: JavaScript hang when comparing large array to null
345         
346         * kjs/object.h:
347         (KJS::JSObject::isEqualToNull):
348         Add new function which returns true if an object should be treated as null when
349         doing comparisons.
350         
351         * kjs/operations.cpp:
352         (KJS::equal):
353         Use isEqualToNull.
354
355 2006-01-07  Alexey Proskuryakov  <ap@nypop.com>
356
357         Reviewed by Maciej.
358
359         - Fix WebCore development build
360         http://bugzilla.opendarwin.org/show_bug.cgi?id=6408
361
362         * kxmlcore/Assertions.h: Use __VA_ARGS__ in variadic macros.
363
364 2006-01-06  Maciej Stachowiak  <mjs@apple.com>
365
366         Reviewed by Darin.
367
368         - miscellaneous changes for 4% speedup on the JavaScript iBench
369         http://bugzilla.opendarwin.org/show_bug.cgi?id=6396
370         
371         Changes mostly thanks to Maks Orlovich, tweaked a little by me.
372
373         * kjs/create_hash_table: Use the same hash as the one used by Identifier.
374         * kjs/function.cpp:
375         (KJS::FunctionImp::processParameters): Use the new List::copyFrom
376         (KJS::ActivationImp::ActivationImp): track variable while iterating
377         * kjs/internal.cpp:
378         (KJS::StringImp::toObject): create StringInstance directly
379         * kjs/list.cpp:
380         (KJS::List::copy): implement in terms of copyFrom
381         (KJS::List::copyFrom): more efficient way to copy in another list
382         * kjs/list.h:
383         * kjs/lookup.cpp:
384         (keysMatch): updated to work with identifier hash
385         (findEntry): ditto
386         (Lookup::findEntry): ditto
387         (Lookup::find): ditto
388         * kjs/lookup.h:
389
390 2006-01-06  Maciej Stachowiak  <mjs@apple.com>
391
392         - fix development build failure from the previous checkin
393
394         * kjs/function.cpp:
395         (KJS::ActivationImp::put): Use prototype() accessor in assert.
396
397 2006-01-05  Maciej Stachowiak  <mjs@apple.com>
398
399         Reviewed by Eric.
400
401         - fix remaining performance regression from Getter/Setter change
402         http://bugzilla.opendarwin.org/show_bug.cgi?id=6249
403
404         - Activation objects should not have __proto__ property
405         http://bugzilla.opendarwin.org/show_bug.cgi?id=6395
406
407         * kjs/function.cpp:
408         (KJS::ActivationImp::getOwnPropertySlot): Implement directly, thus
409         skipping getter/setter handling and __proto__ handling, as well
410         as inlining needed superclass stuff.
411         (KJS::ActivationImp::put): Implement directly, skipping getter/setter,
412         __proto__, and do canPut directly in PropertyMap::put since there's no
413         static property table either.
414         * kjs/function.h:
415         * kjs/property_map.cpp:
416         (KJS::PropertyMap::put): Allow optionally inlining canPut check.
417         * kjs/property_map.h:
418
419 2006-01-04  Geoffrey Garen  <ggaren@apple.com>
420
421         Patch by kimmo.t.kinnunen@nokia.com, reviewed by darin, tweaked by me.
422
423         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4921
424         \u escape sequences in JavaScript identifiers
425
426         * kjs/function_object.cpp:
427         (FunctionObjectImp::construct):
428         * kjs/lexer.cpp:
429         (Lexer::shift):
430         (Lexer::lex):
431         (Lexer::isWhiteSpace):
432         (Lexer::isLineTerminator):
433         (Lexer::isIdentStart):
434         (Lexer::isIdentPart):
435         (isDecimalDigit):
436         (Lexer::scanRegExp):
437         * kjs/lexer.h:
438         (KJS::Lexer::):
439
440         * tests/mozilla/expected.html: Updated test results.
441
442 2005-12-30  Maciej Stachowiak  <mjs@apple.com>
443
444         No review, just test result update.
445
446         * tests/mozilla/expected.html: Updated for newly passing test from recent fixes.
447
448 2005-12-30  Anders Carlsson  <andersca@mac.com>
449
450         Reviewed by Maciej.
451
452         - Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6298
453         Getter setter test is failing
454                 
455         * kjs/object.cpp:
456         (KJS::JSObject::put):
457         Rework the getter setter part. We now walk the prototype chain, checking for
458         getter/setter properties and only take the slow path if any are found. 
459
460 2005-12-30  Maks Orlovich <maksim@kde.org>
461
462         Reviewed and committed by Maciej.
463
464         - Handle negative, FP numbers with non-10 radix in toString
465         http://bugzilla.opendarwin.org/show_bug.cgi?id=6259
466
467         (Merged from KJS, original work by Harri Porten)
468         
469         * kjs/number_object.cpp:
470         (NumberProtoFunc::callAsFunction): rewrote Number.toString(radix) to work with  
471         negative numbers, floating point and very large numbers.
472
473 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
474
475         Patch by Maks Orlovich, reviewed and landed by me.
476
477         - http://bugzilla.opendarwin.org/show_bug.cgi?id=6267
478         Fix Number.prototype.toFixed/toExponential(undefined)
479
480         * kjs/number_object.cpp:
481         (NumberProtoFunc::callAsFunction):
482
483 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
484
485         Patch by Maks Orlovich, Reviewed and landed by me.
486
487         - http://bugzilla.opendarwin.org/show_bug.cgi?id=6266
488         Minor object naming updates (to match Mozilla, KJS)
489
490         * kjs/number_object.cpp:
491         * kjs/regexp_object.cpp:
492
493 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
494
495         Patch by Maks Orlovich, reviewed by mjs.
496
497         This has 2 very minor fixes, covered by KJS testsuite:    
498         1. Enumerates string indices in property list (with the same bug as array    
499            object has in corresponding code). This is a mozilla emulation thing. 
500         2. Permits properties with integer names in prototypes to be found    
501
502         * kjs/string_object.cpp:
503         (StringInstance::getOwnPropertySlot):
504         (StringInstanceImp::propList):
505         * kjs/string_object.h:
506
507 2005-12-26  Geoffrey Garen  <ggaren@apple.com>
508
509         Reviewed by mjs.
510
511         - Fixed <rdar://problem/4364705> run-javascriptcore-tests crashes in 
512         KJS::BlockNode::deref 
513         AKA 
514         http://bugzilla.opendarwin.org/show_bug.cgi?id=6233
515         Reproducible stack-overflow crash in ~RefPtr<T> due to RefPtr<T> use in 
516         linked lists
517
518         This patch does four things: 
519         (1) Standardizes all our linked list nodes to use "next" as their next 
520         pointers. 
521         (2) Creates the ListRefPtr<T> class, a subclass of RefPtr<T> specialized
522         to iteratively deref "next" pointers.
523         (3) Standardizes our linked list nodes to use ListRefPtr<T> and 
524         implement the releaseNext() function used by ~ListRefPtr<T>().
525         (4) Adds to RefPtr<T> the release() method used by releaseNext().
526
527         - Modified existing mozilla test to ensure it would make deployment 
528         builds crash as well.
529
530         * JavaScriptCore.xcodeproj/project.pbxproj:
531         * kjs/nodes.cpp:
532         (ElementNode::evaluate):
533         (PropertyListNode::evaluate):
534         (ArgumentListNode::evaluateList):
535         (StatListNode::StatListNode):
536         (StatListNode::execute):
537         (StatListNode::processVarDecls):
538         (VarDeclListNode::evaluate):
539         (VarDeclListNode::processVarDecls):
540         (VarStatementNode::execute):
541         (VarStatementNode::processVarDecls):
542         (BlockNode::BlockNode):
543         (CaseClauseNode::evalStatements):
544         (CaseClauseNode::processVarDecls):
545         (ClauseListNode::processVarDecls):
546         (CaseBlockNode::CaseBlockNode):
547         (CaseBlockNode::evalBlock):
548         (SourceElementsNode::SourceElementsNode):
549         (SourceElementsNode::execute):
550         (SourceElementsNode::processFuncDecl):
551         (SourceElementsNode::processVarDecls):
552         * kjs/nodes.h:
553         (KJS::ElementNode::ElementNode):
554         (KJS::ElementNode::releaseNext):
555         (KJS::ArrayNode::ArrayNode):
556         (KJS::PropertyListNode::PropertyListNode):
557         (KJS::PropertyListNode::releaseNext):
558         (KJS::ObjectLiteralNode::ObjectLiteralNode):
559         (KJS::ArgumentListNode::ArgumentListNode):
560         (KJS::ArgumentListNode::releaseNext):
561         (KJS::ArgumentsNode::ArgumentsNode):
562         (KJS::StatListNode::releaseNext):
563         (KJS::VarDeclListNode::VarDeclListNode):
564         (KJS::VarDeclListNode::releaseNext):
565         (KJS::VarStatementNode::VarStatementNode):
566         (KJS::ForNode::ForNode):
567         (KJS::CaseClauseNode::CaseClauseNode):
568         (KJS::ClauseListNode::ClauseListNode):
569         (KJS::ClauseListNode::getClause):
570         (KJS::ClauseListNode::getNext):
571         (KJS::ClauseListNode::releaseNext):
572         (KJS::ParameterNode::ParameterNode):
573         (KJS::ParameterNode::releaseNext):
574         (KJS::SourceElementsNode::releaseNext):
575         * kjs/nodes2string.cpp:
576         (ElementNode::streamTo):
577         (PropertyListNode::streamTo):
578         (ArgumentListNode::streamTo):
579         (StatListNode::streamTo):
580         (VarDeclListNode::streamTo):
581         (VarStatementNode::streamTo):
582         (CaseClauseNode::streamTo):
583         (ClauseListNode::streamTo):
584         (CaseBlockNode::streamTo):
585         (SourceElementsNode::streamTo):
586         * kxmlcore/ListRefPtr.h: Added.
587         (KXMLCore::ListRefPtr::ListRefPtr):
588         (KXMLCore::ListRefPtr::~ListRefPtr):
589         (KXMLCore::ListRefPtr::operator=):
590         * kxmlcore/RefPtr.h:
591         (KXMLCore::RefPtr::release):
592
593 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
594
595         Reviewed by mjs.
596
597         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4026
598         Math.random() not seeded.
599
600         Added call to sranddev() -- it executes the first time a process
601         calls Math.random().
602
603         * kjs/math_object.cpp:
604         (MathFuncImp::callAsFunction):
605
606 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
607
608         Reviewed by darin.
609
610         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6265
611         Name change regression: Java doesn't know what JavaJSObject is
612
613         Changed strings passed to Java back to original "JSObject".
614
615         * bindings/jni/jni_jsobject.cpp:
616         (JavaJSObject::convertValueToJObject):
617         (JavaJSObject::convertJObjectToValue):
618
619 2005-12-28  Anders Carlsson  <andersca@mac.com>
620
621         Reviewed by Maciej.
622
623         - The JSC part of http://bugzilla.opendarwin.org/show_bug.cgi?id=6268
624         Add undetectable document.all
625         
626         * kjs/operations.cpp:
627         (KJS::equal):
628         When comparing an object with null or undefined, call toPrimitive with 
629         NullType as the preferred type.
630
631 2005-12-27  Anders Carlsson  <andersca@mac.com>
632
633         Reviewed by Darin.
634
635         * kjs/array_object.cpp:
636         (ArrayProtoFunc::callAsFunction):
637         Implement filter and map. Also, make the existing
638         array iteration functions not invoke the callback for
639         non-existing properties, just as Mozilla does now.
640         
641         * kjs/array_object.h:
642         (KJS::ArrayProtoFunc::):
643         Add filter and map.
644         
645         * tests/mozilla/expected.html:
646         Update, two 1.6 tests now pass.
647
648 2005-12-27  Maciej Stachowiak  <mjs@apple.com>
649
650         - updated test results for new JS 1.6 tests
651
652         * tests/mozilla/expected.html:
653
654 2005-12-27  Anders Carlsson  <andersca@mac.com>
655
656         Reviewed by Maciej.
657
658         Add Mozilla JS 1.6 tests.
659         
660         * tests/mozilla/js1_6/Array/browser.js: Added.
661         * tests/mozilla/js1_6/Array/regress-290592.js: Added.
662         * tests/mozilla/js1_6/Array/regress-304828.js: Added.
663         * tests/mozilla/js1_6/Array/regress-305002.js: Added.
664         * tests/mozilla/js1_6/Array/regress-310425-01.js: Added.
665         * tests/mozilla/js1_6/Array/regress-310425-02.js: Added.
666         * tests/mozilla/js1_6/Array/regress-320887.js: Added.
667         * tests/mozilla/js1_6/Array/shell.js: Added.
668         * tests/mozilla/js1_6/README: Added.
669         * tests/mozilla/js1_6/Regress/browser.js: Added.
670         * tests/mozilla/js1_6/Regress/regress-301574.js: Added.
671         * tests/mozilla/js1_6/Regress/regress-309242.js: Added.
672         * tests/mozilla/js1_6/Regress/regress-311157-01.js: Added.
673         * tests/mozilla/js1_6/Regress/regress-311157-02.js: Added.
674         * tests/mozilla/js1_6/Regress/regress-314887.js: Added.
675         * tests/mozilla/js1_6/Regress/regress-320172.js: Added.
676         * tests/mozilla/js1_6/Regress/shell.js: Added.
677         * tests/mozilla/js1_6/String/browser.js: Added.
678         * tests/mozilla/js1_6/String/regress-306591.js: Added.
679         * tests/mozilla/js1_6/String/shell.js: Added.
680         * tests/mozilla/js1_6/browser.js: Added.
681         * tests/mozilla/js1_6/shell.js: Added.
682         * tests/mozilla/js1_6/template.js: Added.
683
684 2005-12-27  Maks Orlovich <maksim@kde.org>
685
686         Reviewed and landed by Maciej.
687
688         - fixed 6234: Can delete array index property incorrectly.
689         http://bugzilla.opendarwin.org/show_bug.cgi?id=6234
690
691         * kjs/array_object.cpp:
692         (ArrayInstance::deleteProperty): use toArrayIndex instead of toUInt32 when
693         looking for array properties.
694
695 2005-12-27  Anders Carlsson  <andersca@mac.com>
696
697         Reviewed by Maciej.
698
699         * kjs/object.cpp:
700         (KJS::JSObject::defineSetter):
701         Remove duplicate call to putDirect.
702
703 2005-12-26  Maciej Stachowiak  <mjs@apple.com>
704
705         Reviewed by Darin and Geoff.
706
707         Changes by me and Anders.
708
709         - mostly fixed REGRESSION: 5-10% performance regression on JS iBench from getter/setter change
710         http://bugzilla.opendarwin.org/show_bug.cgi?id=6083
711
712         - also fixed some warnings reported by -Winline
713         
714         * JavaScriptCorePrefix.h: Move new and delete definitions higher so there
715         aren't conflicts with use in standard C++ headers
716         * kjs/object.cpp:
717         (KJS::throwSetterError): Moved this piece of put into a seprate function
718         to avoid the PIC branch.
719         (KJS::JSObject::put): Use hasGetterSetterProperties to avoid expensive stuff
720         when not needed. Also use GetterSetter properties attribute.
721         (KJS::JSObject::deleteProperty): Recompute whether any properties are getter/setter
722         properties any more, if this one was one.
723         (KJS::JSObject::defineGetter): Let the PropertyMap know that it has getter/setter
724         properties now (and use the new attribute).
725         (KJS::JSObject::defineSetter): Ditto.
726         (KJS::JSObject::fillGetterPropertySlot): Out-of-line helper for getOwnPropertySlot,
727         to avoid global variable access in the hot code path.
728         * kjs/object.h:
729         (KJS::): Added GetterSetter attribute.
730         (KJS::JSCell::isObject): Moved lower to be after inline methods it uses.
731         (KJS::JSValue::isObject): ditto
732         (KJS::JSObject::getOwnPropertySlot): try to avoid impact of getters and setters
733         as much as possible in the case where they are not being used
734         * kjs/property_map.cpp:
735         (KJS::PropertyMap::containsGettersOrSetters): New method to help with this
736         * kjs/property_map.h:
737         (KJS::PropertyMap::hasGetterSetterProperties): Ditto
738         (KJS::PropertyMap::setHasGetterSetterProperties): Ditto
739         (KJS::PropertyMap::PropertyMap): Added a crazy hack to store the
740         global "has getter/setter properties" flag in the property map
741         single entry, to avoid making objects any bigger.
742         * kjs/value.h: Moved some things to object.h to make -Winline happier
743
744 2005-12-24  Maciej Stachowiak  <mjs@apple.com>
745
746         Reviewed by Eric and Dave Hyatt.
747
748         - make even const PassRefPtrs give transfer of ownership semantics
749         http://bugzilla.opendarwin.org/show_bug.cgi?id=6238
750         
751         This is a somewhat cheesy change. Having to use PassRefPtr_Ref creates ambiguities
752         in assignment and copy construction. And this makes life way easier and removes
753         the need for pass(). It is not really correct, but we pretty much never need a real
754         const PassRefPtr, and this takes care of things for PassRefPtr temporaries.
755         
756         * kjs/identifier.cpp:
757         (KJS::Identifier::add): No more need for pass()
758         * kjs/property_map.cpp:
759         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): No more need for pass()
760         * kjs/ustring.cpp:
761         (KJS::UString::Rep::create): Use adoptRef
762         (KJS::UString::UString): No more need for pass
763         (KJS::UString::append): No more need for pass
764         (KJS::UString::substr): No more need for pass
765         * kxmlcore/PassRefPtr.h: made m_ptr mutable (ugh)
766         (KXMLCore::PassRefPtr::PassRefPtr): Take a const PassRefPtr reference
767         (KXMLCore::PassRefPtr::release): Made this a const method (ugh)
768         (KXMLCore::PassRefPtr::operator=): clean up appropriately
769         (KXMLCore::adoptRef): Added this to use instead of PassRefPtr<T>::adopt, I think
770         it makes the behavior more clear and it is less verbose.
771         (KXMLCore::static_pointer_cast): use adoptRef
772         (KXMLCore::const_pointer_cast): use adoptRef
773         * kxmlcore/RefPtr.h:
774         (KXMLCore::RefPtr::RefPtr): take const PassRefPtr&
775         (KXMLCore::PassRefPtr::operator=): take const PassRefPtr&
776
777 2005-12-25  Eric Seidel  <eseidel@apple.com>
778
779         Reviewed by mjs.
780
781         Unbreak HashTableConstIterator++ by returning const_iterator
782
783         * kxmlcore/HashTable.h:
784         (KXMLCore::HashTableConstIterator::operator++): use const_iterator
785
786 2005-12-25  Eric Seidel  <eseidel@apple.com>
787
788         Reviewed by mjs.
789
790         Un-break HashTable copy constructor.
791
792         * kxmlcore/HashTable.h:
793         (KXMLCore::::HashTable): use const_iterator instead
794
795 2005-12-23  Maciej Stachowiak  <mjs@apple.com>
796
797         Reviewed by Eric.
798
799         - fixed "HashMap does not work with const pointer keys or values"
800         http://bugzilla.opendarwin.org/show_bug.cgi?id=6222
801         
802         * kxmlcore/HashMapPtrSpec.h:
803         (KXMLCore::HashMap): In all methods, explicitly cast all pointers
804         to void * before passing to internal implementation. Use C-style
805         casts instead of new-style casts, because the real solution would
806         require a combo of reinterpret_cast anc const_cast.
807
808
809 2005-12-23  Maciej Stachowiak  <mjs@apple.com>
810
811         - this time for sure
812
813         * kxmlcore/RefPtr.h:
814         (KXMLCore::::swap):
815
816 2005-12-22  Maciej Stachowiak  <mjs@apple.com>
817
818         - fix build problem from last commit.
819
820         * kxmlcore/RefPtr.h:
821         (KXMLCore::::swap):
822
823 2005-12-21  Maciej Stachowiak  <mjs@apple.com>
824
825         Reviewed by Darin.
826
827         - Make HashMap/HashSet support non-POD types
828         http://bugzilla.opendarwin.org/show_bug.cgi?id=5332
829
830         The changes for support are relatively simple, but I also made extensive changes to
831         avoid copying, so that there isn't refcount thrash when you put RefPtrs into a HashMap.
832
833         * kxmlcore/HashTable.h:
834         (KXMLCore::swap): specialize swap for pairs, to swap elements individually,
835         so that excess copies can be avoided.
836         (KXMLCore::Mover::move): Template function to either copy or swap, used
837         when transferring elements from old table to new.
838         (KXMLCore::IdentityHashTranslator::hash): The old "converting lookup" templates
839         that took two or three function parameters now take a class parameter, this is
840         the class used to do a normal lookup.
841         (KXMLCore::IdentityHashTranslator::equal): Ditto.
842         (KXMLCore::IdentityHashTranslator::translate): Ditto. Translate now takes a reference
843         to write into instead of returning a value to avoid redundant copies.
844         (KXMLCore::HashTable::~HashTable): Use deallocateTable instead of freeing directly.
845         (KXMLCore::HashTable::insert): Based on HashTranslator now instead of separate
846         functions. Added a FIXME about a remaining rare excess copy.
847         (KXMLCore::HashTable::isEmptyBucket): Use KeyTraits directly instead of unwrapping
848         the key from Traits, to avoid creating and destroying pair, which copies.
849         (KXMLCore::HashTable::isDeletedBucket): ditto
850         (KXMLCore::HashTable::lookup): Use HashTranslator now instead of separate functions.
851         (KXMLCore::HashTable::initializeBucket): Renamed from emptyBucket. Use placement new to
852         work right for non-POD types.
853         (KXMLCore::HashTable::deleteBucket): Use assignDeleted to avoid excess copies.
854         (KXMLCore::HashTable::reinsert): use Mover template to copy or swap as appropriate
855         (KXMLCore::HashTable::allocateTable): Initialize every bucket if calloc won't do.
856         (KXMLCore::HashTable::deallocateTable): Destruct every bucket if needed.
857         (KXMLCore::HashTable::rehash): Avoid copy before reinserting, so that swap can do its magic.
858         (KXMLCore::HashTable::clear): use deallocateTable instead of freeing directly.
859         (KXMLCore::HashTable::HashTable): be more dumb when copying to ensure that non-POD types
860         work right
861         * kxmlcore/HashFunctions.h:
862         (KXMLCore::PointerHash): Specialize PointerHash for RefPtr
863         * kxmlcore/HashMap.h:
864         (KXMLCore::extractFirst): Return a reference not a full object to avoid
865         copies.
866         (KXMLCore::HashMapTranslator::hash): Use a special translator for insertion
867         to defer making the pair as long as possible, thus avoiding needless copies.
868         (KXMLCore::HashMapTranslator::equal): ditto
869         (KXMLCore::HashMapTranslator::translate): ditto
870         (KXMLCore::::inlineAdd): Shared by set and add to insert using HashMapTranslator
871         (KXMLCore::::set): Use inlineAdd
872         (KXMLCore::::add): Use inlineAdd
873         * kxmlcore/HashMapPtrSpec.h:
874         (KXMLCore::): Pass KeyTraits along
875         * kxmlcore/HashSet.h:
876         (KXMLCore::identityExtract): Return a reference not a full object to avoid copies.
877         (KXMLCore::HashSetTranslatorAdapter::hash): Redo adapter stuff to work with
878         the new HashTranslator approach.
879         (KXMLCore::HashSetTranslatorAdapter::equal): ditto
880         (KXMLCore::HashSetTranslatorAdapter::translate): ditto
881         (KXMLCore::::insert): ditto
882         * kxmlcore/HashTraits.h:
883         (KXMLCore::GenericHashTraits): This is intended be used as a base class for
884         customized traits: sensible defaults.
885         (KXMLCore::): Use it a bunch
886         (KXMLCore::assignDeleted): template function to allow pairs to be assigned the
887         deleted value w/o excess copies.
888         (KXMLCore::PairHashTraits::emptyValue): Updated
889         (KXMLCore::PairHashTraits::deletedValue): Updated
890         (KXMLCore::PairHashTraits::assignDeletedValue): part of assignDeleted hack
891         (KXMLCore::DeletedValueAssigner::assignDeletedValue): Use template magic
892         to either use use deletedValue or assignDeletedValue for the cases where we care.
893         * kxmlcore/RefPtr.h:
894         (KXMLCore::RefPtr::swap): Added swap method.
895         (KXMLCore::swap): Added swap free function.
896         * kjs/identifier.cpp:
897         (KJS::CStringTranslator::hash): Use new HashTranslator class approach to
898         alternate type based insertion.
899         (KJS::CStringTranslator::equal): ditto
900         (KJS::CStringTranslator::translate): ditto
901         (KJS::Identifier::add): ditto
902         (KJS::UCharBufferTranslator::hash): ditto
903         (KJS::UCharBufferTranslator::equal): ditto
904         (KJS::UCharBufferTranslator::translate): ditto
905
906         - irrelevant change:
907         
908         * kjs/array_object.cpp:
909         (ArrayProtoFunc::callAsFunction): Removed a stray space.
910
911 2005-12-22  Anders Carlsson  <andersca@mac.com>
912
913         Reviewed by Eric and Darin.
914
915         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6196
916         Would like to be able to define prototypes in headers
917         
918         * kjs/lookup.h:
919         Move ClassName from KJS_DECLARE_PROTOTYPE to KJS_IMPLEMENT_PROTOTYPE.
920         Also, namespace all macros by prefixing them with KJS_. 
921
922 2005-12-22  Darin Adler  <darin@apple.com>
923
924         Reviewed by Maciej.
925
926         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6191
927           RefPtr/PassRefPtr have a leak issue, operator== issues
928
929         * kxmlcore/PassRefPtr.h:
930         (KXMLCore::PassRefPtr::PassRefPtr): Remove non-template constructor that takes RefPtr
931         since the constructor template that takes RefPtr should be sufficient. Add a constructor
932         template that takes PassRefPtr&.
933         (KXMLCore::PassRefPtr::adopt): Use PassRefPtr_Ref to avoid setting pointer first to
934         0 and then to the pointer.
935         (KXMLCore::PassRefPtr::operator=): Added template versions that take PassRefPtr& and
936         RefPtr parameters.
937         (KXMLCore::PassRefPtr::operator PassRefPtr<U>): Changed to fix leak -- old version
938         would release and then ref.
939         (KXMLCore::operator==): Make templates have two parameters so you can mix types.
940         Also remove unneeded const in raw pointer versions.
941         (KXMLCore::operator!=): Ditto.
942
943         * kxmlcore/RefPtr.h:
944         (KXMLCore::RefPtr::RefPtr): Add constructor template that takes PassRefPtr.
945         (KXMLCore::RefPtr::operator=): Add assignment operator templates that take
946         RefPtr and PassRefPtr.
947         (KXMLCore::operator==): Make templates have two parameters so you can mix types.
948         Also remove unneeded const in raw pointer versions.
949         (KXMLCore::operator!=): Ditto.
950
951 2005-12-21  Timothy Hatcher  <timothy@apple.com>
952
953         * JavaScriptCore.xcodeproj/project.pbxproj:
954           Set tab width to 8, indent width to 4 and uses tabs to false per file.
955
956 2005-12-21  Geoffrey Garen  <ggaren@apple.com>
957
958         Reviewed by Darin.
959
960         Removed evil hack for determining if a type is an integer, replaced
961         with template metaprogramming.
962
963         * JavaScriptCore.xcodeproj/project.pbxproj: Set tab size to 2 for
964         testkjs.cpp
965         * kjs/testkjs.cpp:
966         (main): Inserted asserts to test IsInteger. FIXME: Move these to
967         KXMLCore unit tests directory when we create one.
968         * kxmlcore/HashTraits.h:
969         (KXMLCore::): Added IsInteger class for querying types.
970
971 2005-12-20  Maciej Stachowiak  <mjs@apple.com>
972
973         Reviewed by Darin.
974
975         - made ALWAYS_INLINE declare things inline as well as __attribute__((always_inline))
976         http://bugzilla.opendarwin.org/show_bug.cgi?id=6159
977
978         * kxmlcore/AlwaysInline.h:
979
980 2005-12-19  Maciej Stachowiak  <mjs@apple.com>
981
982         Reviewed by Darin.
983
984         - fixed a leak in the assignment operator from PassRefPtr to RefPtr
985         http://bugzilla.opendarwin.org/show_bug.cgi?id=6158
986
987         * kxmlcore/RefPtr.h:
988         (KXMLCore::RefPtr::operator=):
989
990         - fix problem with PassRefPtr that darin spotted - it lacked a copy constructor
991         and therefore was using the default one, which can lead to excess derefs
992
993         I fixed this by adding a copy constructor from non-const
994         reference, and by adding a template pass() function that you have
995         to use when raw pointer or RefPtr are passed where PassRefPtr is
996         expected.
997
998         * kjs/identifier.cpp:
999         (KJS::Identifier::add): Changed to have PassRefPtr return type and
1000         pass() the results.     
1001         * kjs/identifier.h:
1002         * kjs/property_map.cpp:
1003         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): Use pass()
1004         where required.
1005         * kjs/ustring.cpp:
1006         (KJS::UString::UString): Use pass() as needed.
1007         (KJS::UString::append): ditto
1008         (KJS::UString::substr): ditto
1009         * kjs/ustring.h:
1010         (KJS::UString::UString): Use initializer instead of assignment
1011         * kxmlcore/PassRefPtr.h:
1012         (KXMLCore::PassRefPtr::PassRefPtr): Added copy constructor
1013         (KXMLCore::pass): new template function to make it convenient to pass
1014         a PassRefPtr
1015
1016 2005-12-19  Geoffrey Garen  <ggaren@apple.com>
1017   
1018         Reviewed by Maciej.
1019
1020         Fixed <rdar://problem/4370397> Missing return statement in
1021         JSMethodNameToObjcMethodName.
1022
1023         JSMethodNameToObjcMethodName had a check for a name being too long, but
1024         the check was missing a return statement.
1025
1026         A lot of this code was confusing and some of it was wrong, so I fixed
1027         it up, added some asserts to catch this type of bug in the future, 
1028         changed some comments, and renamed some variables.
1029
1030         The two advantages of the new algorithm are (1) It makes writing past
1031         the end of the buffer virtually impossible because the test on the main
1032         loop is "while (not past end of buffer)" and (2) It's twice as fast
1033         because it doesn't call strlen. (There's no need to call strlen when
1034         we're walking the string ourselves.) 
1035         
1036         methodsNamed also supports arbitrary-length method names now. Just in 
1037         case the AppKit folks start getting REALLY verbose...
1038
1039         * bindings/objc/objc_class.mm:
1040         (KJS::Bindings::ObjcClass::methodsNamed):
1041         * bindings/objc/objc_utility.h:
1042         * bindings/objc/objc_utility.mm:
1043         (KJS::Bindings::JSMethodNameToObjcMethodName):
1044
1045 2005-12-19  Darin Adler  <darin@apple.com>
1046
1047         Originally done by both George Staikos and Alexey Proskuryakov.
1048
1049         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5706
1050           Sharedptr dependency can be removed
1051
1052         Our coding guidelines say "use 0 instead of NULL" and both RefPtr and
1053         PassRefPtr were using NULL, which required including a header that
1054         defines NULL.
1055
1056         * kxmlcore/PassRefPtr.h:
1057         (KXMLCore::PassRefPtr::PassRefPtr): Use 0 instead of NULL.
1058         (KXMLCore::PassRefPtr::operator!): Use ! instead of == NULL.
1059         * kxmlcore/RefPtr.h:
1060         (KXMLCore::RefPtr::RefPtr): Use 0 instead of NULL.
1061         (KXMLCore::RefPtr::operator!): Use ! instead of == NULL.
1062         Also did some reformatting.
1063
1064 2005-12-19  Darin Adler  <darin@apple.com>
1065
1066         Reviewed by Geoff Garen and Eric Seidel.
1067
1068         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=4923
1069           stop using <ostream> in WebCore, eliminating the <cmath> troubles it causes
1070
1071         * kjs/simple_number.h: Removed many unnecessary includes, including
1072         the <cmath> one to work around GCC library header bugs. We may have to
1073         add some includes elsewhere for platforms other than OS X, since our
1074         prefix header takes care of some things.
1075
1076         * kxmlcore/AlwaysInline.h: Added. Now clients that don't include
1077         simple_number.h can still get the ALWAYS_INLINE macro.
1078         * JavaScriptCore.xcodeproj/project.pbxproj: Added AlwaysInline.h.
1079
1080         * bindings/NP_jsobject.h: Removed a lot of unnecessary includes
1081         and removed C-specific stuff from this C++-only header.
1082         * bindings/jni/jni_jsobject.h: Removed a lot of unnecessary includes
1083         and did some reformatting.
1084         * bindings/objc/objc_runtime.h:  Removed an unnecessary include.
1085         * bindings/runtime.h: Removed some unneeded includes. Reformatted.
1086         * bindings/runtime.cpp: Updated to compile with header changes,
1087         including a lot of reformatting.
1088         * bindings/runtime_object.h: Removed an unnecessary include.
1089
1090 2005-12-13  Maciej Stachowiak  <mjs@apple.com>
1091
1092         Reviewed by Geoff and Adele
1093
1094         - replaced custom Identifier hashtable with HashSet
1095
1096         * kjs/identifier.cpp:
1097         (KXMLCore::):
1098         (KJS::identifierTable):
1099         (KJS::Identifier::equal):
1100         (KJS::hash):
1101         (KJS::equal):
1102         (KJS::convert):
1103         (KJS::Identifier::add):
1104         (KJS::Identifier::remove):
1105         * kjs/identifier.h:
1106         * kjs/internal.cpp:
1107         (KJS::InterpreterImp::initGlobalObject):
1108
1109 2005-12-18  Justin Haygood  <justin@xiondigital.net>
1110
1111         Reviewed, tweaked, and landed by Darin.
1112
1113         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5227
1114           Array indexOf() extension for JavaScript 1.5 Core
1115
1116         * kjs/array_object.h:
1117         * kjs/array_object.cpp: (ArrayProtoFunc::callAsFunction): Added implementation of indexOf.
1118
1119 2005-12-18  Anders Carlsson  <andersca@mac.com>
1120
1121         Reviewed by Darin and Geoffrey.
1122
1123         - fix for <http://bugzilla.opendarwin.org/show_bug.cgi?id=4000>
1124         Object.prototype is missing isPrototypeOf
1125         
1126         * kjs/object_object.cpp:
1127         (ObjectPrototype::ObjectPrototype):
1128         Add isPrototypeOf to object prototype.
1129         
1130         (ObjectProtoFunc::callAsFunction):
1131         Implement isPrototypeOf
1132         
1133         * kjs/object_object.h:
1134         (KJS::ObjectProtoFunc::):
1135         Add id for isPrototypeOf.
1136
1137 2005-12-17  Geoffrey Garen  <ggaren@apple.com>
1138
1139         Reviewed by Darin.
1140
1141         Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6119
1142         split() function ignores case insensitive modifier.
1143
1144         Glossary:
1145         RegExpImp: The C++ object you get when JavaScript executes
1146                    "new RegExp()".
1147         RegExp:    A C++ wrapper object that performs regular expression
1148                    matching on behalf of a RegExpImp.
1149
1150         Instead of unnecessarily constructing a RegExp which (wrongly) lacks
1151         any modifiers, String.split() now uses the RegExp built in to the 
1152         RegExpImp passed to it, which has the right modifiers already.
1153
1154         I also cleaned up other bits of the string code to standardized how
1155         we handle RegExpImp arguments.
1156
1157         * ChangeLog:
1158         * kjs/string_object.cpp:
1159         (replace):
1160         (StringProtoFunc::callAsFunction):
1161
1162 2005-12-16  David Hyatt  <hyatt@apple.com>
1163
1164         Remove unused RefPtr constructors that can create an ambiguity in ustring on some platforms.
1165         
1166         Reviewed by mjs
1167
1168         * kxmlcore/RefPtr.h:
1169         (KXMLCore::RefPtr::RefPtr):
1170
1171 2005-12-15  Darin Adler  <darin@apple.com>
1172
1173         Reviewed by Maciej.
1174
1175         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5688
1176           speed up JavaScript parsing by not creating a UString just to parse
1177
1178         * kjs/internal.h:
1179         * kjs/internal.cpp: (KJS::InterpreterImp::evaluate): Change to take a character pointer
1180         and length rather than a UString.
1181
1182         * kjs/interpreter.h:
1183         * kjs/interpreter.cpp: (Interpreter::evaluate): Ditto.
1184
1185         * kjs/protect.h: Remove uneeded "convert to bool" operator since we already have a
1186         "convert to raw pointer" operator in this class.
1187
1188 === Safari-521~5 ===
1189
1190 2005-12-13  Geoffrey Garen  <ggaren@apple.com>
1191
1192         Updated test results to match Anders's last fix.
1193
1194         * tests/mozilla/expected.html:
1195
1196 2005-12-13  Anders Carlsson  <andersca@mac.com>
1197
1198         * ChangeLog: Add titles for my bugzilla bugs.
1199
1200 2005-12-13  Anders Carlsson  <andersca@mac.com>
1201
1202         Reviewed by Darin.
1203
1204         - Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=6041>
1205         Support property getters and setters.
1206         
1207         * bindings/runtime_array.cpp:
1208         (RuntimeArray::lengthGetter):
1209         (RuntimeArray::indexGetter):
1210         * bindings/runtime_array.h:
1211         * bindings/runtime_method.cpp:
1212         (RuntimeMethod::lengthGetter):
1213         * bindings/runtime_method.h:
1214         * bindings/runtime_object.cpp:
1215         (RuntimeObjectImp::fallbackObjectGetter):
1216         (RuntimeObjectImp::fieldGetter):
1217         (RuntimeObjectImp::methodGetter):
1218         * bindings/runtime_object.h:
1219         * kjs/array_instance.h:
1220         * kjs/array_object.cpp:
1221         (ArrayInstance::lengthGetter):
1222         (getProperty):
1223         Update for changes to PropertySlot::getValue and
1224         PropertySlot::GetValueFunc.
1225         
1226         * kjs/collector.cpp:
1227         (KJS::className):
1228         Handle GetterSetterType.
1229         
1230         * kjs/function.cpp:
1231         (KJS::FunctionImp::argumentsGetter):
1232         (KJS::FunctionImp::lengthGetter):
1233         (KJS::Arguments::mappedIndexGetter):
1234         (KJS::ActivationImp::argumentsGetter):
1235         * kjs/function.h:
1236         Update for changes to PropertySlot::getValue and
1237         PropertySlot::GetValueFunc.
1238         
1239         * kjs/grammar.y:
1240         Rework grammar parts for get set declarations directly
1241         in the object literal.
1242         
1243         * kjs/internal.cpp:
1244         (KJS::GetterSetterImp::mark):
1245         (KJS::GetterSetterImp::toPrimitive):
1246         (KJS::GetterSetterImp::toBoolean):
1247         (KJS::GetterSetterImp::toNumber):
1248         (KJS::GetterSetterImp::toString):
1249         (KJS::GetterSetterImp::toObject):
1250         Add type conversion functions. These aren't meant to be called.
1251         
1252         (KJS::printInfo):
1253         Handle GetterSetterType.
1254         
1255         * kjs/lookup.h:        
1256         (KJS::staticFunctionGetter):
1257         (KJS::staticValueGetter):
1258         Update for changes to PropertySlot::GetValueFunc.
1259         
1260         * kjs/nodes.cpp:
1261         Refactor they way properties nodes are implemented.
1262         We now have a PropertyListNode which is a list of PropertyNodes.
1263         Each PropertyNode has a name (which is a PropertyNameNode) and an associated
1264         value node. PropertyNodes can be of different types. The Constant type is the
1265         old constant declaration and the Getter and Setter types are for property getters
1266         and setters.
1267         (ResolveNode::evaluate):
1268         Update for changes to PropertySlot::getValue.
1269         
1270         (PropertyListNode::evaluate):
1271         Go through all property nodes and set them on the newly created object. If the
1272         property nodes are of type Getter or Setter, define getters and setters. Otherwise,
1273         just add the properties like before.
1274         
1275         (PropertyNode::evaluate):
1276         This should never be called directly.
1277         
1278         (PropertyNameNode::evaluate):
1279         Rename from PropertyNode::evaluate.
1280         
1281         (FunctionCallResolveNode::evaluate):
1282         (FunctionCallBracketNode::evaluate):
1283         (FunctionCallDotNode::evaluate):
1284         (PostfixResolveNode::evaluate):
1285         (PostfixBracketNode::evaluate):
1286         (PostfixDotNode::evaluate):
1287         (TypeOfResolveNode::evaluate):
1288         (PrefixResolveNode::evaluate):
1289         (PrefixBracketNode::evaluate):
1290         (PrefixDotNode::evaluate):
1291         (AssignResolveNode::evaluate):
1292         (AssignDotNode::evaluate):
1293         (AssignBracketNode::evaluate):
1294         Update for changes to PropertySlot::getValue.
1295         
1296         * kjs/nodes.h:
1297         (KJS::PropertyNameNode::PropertyNameNode):
1298         Rename from PropertyNode.
1299         
1300         (KJS::PropertyNode::):
1301         (KJS::PropertyNode::PropertyNode):
1302         New class, representing a single property.
1303         
1304         (KJS::PropertyListNode::PropertyListNode):
1305         Rename from PropertyValueNode.
1306         
1307         (KJS::FuncExprNode::FuncExprNode):
1308         Put ParameterNode parameter last, and make it optional.
1309         
1310         (KJS::ObjectLiteralNode::ObjectLiteralNode):
1311         Use a PropertyListNode here now.
1312         
1313         * kjs/nodes2string.cpp:
1314         (PropertyListNode::streamTo):
1315         Iterate through all property nodes.
1316         
1317         (PropertyNode::streamTo):
1318         Print out the name and value. Doesn't handle getters and setters currently.
1319         
1320         (PropertyNameNode::streamTo):
1321         Rename from PropertyNode::streamTo.
1322         
1323         * kjs/object.cpp:
1324         (KJS::JSObject::get):
1325         Update for changes to PropertySlot::getValue.
1326         
1327         (KJS::JSObject::put):
1328         If the property already exists and has a Setter, invoke
1329         the setter function instead of setting the property directly.
1330         
1331         (KJS::JSObject::defineGetter):
1332         (KJS::JSObject::defineSetter):
1333         New functions for defining property getters and setters on the object.
1334         
1335         * kjs/object.h:
1336         (KJS::GetterSetterImp::type):
1337         (KJS::GetterSetterImp::GetterSetterImp):
1338         (KJS::GetterSetterImp::getGetter):
1339         (KJS::GetterSetterImp::setGetter):
1340         (KJS::GetterSetterImp::getSetter):
1341         (KJS::GetterSetterImp::setSetter):
1342         New class for properties which have getters and setters defined.
1343         This class is only used internally and should never be seen from the outside.
1344         
1345         (KJS::JSObject::getOwnPropertySlot):
1346          If the property is a getter, call setGetterSlot on the property slot.
1347          
1348         * kjs/object_object.cpp:
1349         (ObjectPrototype::ObjectPrototype):
1350         Add __defineGetter__, __defineSetter, __lookupGetter__, __lookupSetter__
1351         to prototype.
1352         
1353         (ObjectProtoFunc::callAsFunction):
1354         Implement handlers for new functions.
1355         
1356         * kjs/object_object.h:
1357         (KJS::ObjectProtoFunc::):
1358         Add ids for new functions.
1359         
1360         * kjs/property_slot.cpp:
1361         (KJS::PropertySlot::undefinedGetter):
1362         Update for changes to PropertySlot::GetValueFunc.
1363         
1364         (KJS::PropertySlot::functionGetter):
1365         Call the function getter object and return its value.
1366         
1367         * kjs/property_slot.h:
1368         (KJS::PropertySlot::getValue):
1369         Add a new argument which is the original object that
1370         getPropertySlot was called on.
1371         
1372         (KJS::PropertySlot::setGetterSlot):
1373         (KJS::PropertySlot::):
1374         New function which sets a getter slot. When getValue is called on a 
1375         getter slot, the getter function object is invoked.
1376         
1377         * kjs/string_object.cpp:
1378         (StringInstance::lengthGetter):
1379         (StringInstance::indexGetter):
1380         * kjs/string_object.h:
1381         Update for changes to PropertySlot::GetValueFunc.
1382         
1383         * kjs/value.h:
1384         (KJS::):
1385         Add GetterSetterType and make GetterSetterImp a friend class of JSCell.
1386
1387 2005-12-12  Maciej Stachowiak  <mjs@apple.com>
1388
1389         Reviewed by Eric.
1390
1391         - added a new HashCountedSet class for the common pattern of mapping items to counts that can change
1392         
1393         * kxmlcore/HashCountedSet.h: Added.
1394         (KXMLCore::HashCountedSet::*): Implemented, on top of HashMap.
1395         * kxmlcore/HashMap.h:
1396         (KXMLCore::HashMap::add): New method - does not replace existing value if key already present
1397         but otherwise like set().
1398         (KXMLCore::HashMap::set): Improved comments.
1399         * kxmlcore/HashMapPtrSpec.h:
1400         (KXMLCore::HashMap::add): Added to specializations too.
1401         * JavaScriptCore.xcodeproj/project.pbxproj: Add new  file.
1402         * kxmlcore/HashFunctions.h: Added include of stdint.h
1403         
1404         - replaced the custom hashtable for values protected from GC with HashCountedSet
1405
1406         * kjs/collector.cpp:
1407         (KJS::Collector::protect): Moved code here from ProtectedValues::increaseProtectCount
1408         since the code is so simple now.
1409         (KJS::Collector::unprotect): Ditto for ProtectedValues::decreaseProtectCount.
1410         (KJS::Collector::markProtectedObjects): Updated for new way of doing things, now
1411         simpler and safer.
1412         (KJS::Collector::numReferencedObjects): ditto
1413         (KJS::Collector::rootObjectClasses): ditto
1414         * kjs/collector.h: Added protect and unprotect static methods
1415         * kjs/protect.h:
1416         (KJS::gcProtect): Updated for removal of ProtectedValues class
1417         (KJS::gcUnprotect): likewise
1418         * kjs/protected_values.cpp: Removed.
1419         * kjs/protected_values.h: Removed.
1420
1421 2005-12-10  Darin Adler  <darin@apple.com>
1422
1423         Rubber stamped by Maciej.
1424
1425         - did long-promised KJS renaming:
1426         
1427             ValueImp -> JSValue
1428             ObjectImp -> JSObject
1429             AllocatedValueImp -> JSCell
1430         
1431         A renaming to get a class out of the way
1432         
1433             KJS::Bindings::JSObject -> JavaJSObject
1434  
1435         and some other "imp-reduction" renaming
1436         
1437             *InstanceImp -> *Instance
1438             *ProtoFuncImp -> *ProtoFunc
1439             *PrototypeImp -> *Prototype
1440             ArgumentsImp -> Arguments
1441             RuntimeArrayImp -> RuntimeArray
1442             RuntimeMethodImp -> RuntimeMethod
1443
1444         * most files and functions
1445
1446 2005-12-10  Darin Adler  <darin@apple.com>
1447
1448         Reviewed by Maciej.
1449
1450         - eliminated the old Undefined(), Null(), Boolean(), Number(), and String()
1451
1452         Code now uses jsUndefined(), jsNull(), jsBoolean(), jsNumber(), and jsString().
1453
1454         * bindings/NP_jsobject.cpp:
1455         (_NPN_Evaluate):
1456         * bindings/c/c_instance.cpp:
1457         (KJS::Bindings::CInstance::invokeMethod):
1458         (KJS::Bindings::CInstance::invokeDefaultMethod):
1459         * bindings/c/c_runtime.cpp:
1460         (CField::valueFromInstance):
1461         * bindings/c/c_utility.cpp:
1462         (KJS::Bindings::convertNPVariantToValue):
1463         * bindings/jni/jni_instance.cpp:
1464         (JavaInstance::invokeMethod):
1465         (JavaInstance::invokeDefaultMethod):
1466         * bindings/jni/jni_jsobject.cpp:
1467         (JSObject::eval):
1468         (JSObject::convertJObjectToValue):
1469         * bindings/jni/jni_runtime.cpp:
1470         (JavaArray::convertJObjectToArray):
1471         (JavaField::valueFromInstance):
1472         (JavaArray::valueAt):
1473         * bindings/objc/WebScriptObject.mm:
1474         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1475         (-[WebScriptObject evaluateWebScript:]):
1476         (-[WebScriptObject valueForKey:]):
1477         (-[WebScriptObject webScriptValueAtIndex:]):
1478         * bindings/objc/objc_instance.mm:
1479         (ObjcInstance::invokeMethod):
1480         (ObjcInstance::invokeDefaultMethod):
1481         (ObjcInstance::getValueOfUndefinedField):
1482         * bindings/objc/objc_runtime.mm:
1483         (ObjcField::valueFromInstance):
1484         (ObjcFallbackObjectImp::callAsFunction):
1485         * bindings/objc/objc_utility.mm:
1486         (KJS::Bindings::convertNSStringToString):
1487         (KJS::Bindings::convertObjcValueToValue):
1488         * bindings/runtime.h:
1489         (KJS::Bindings::Class::fallbackObject):
1490         (KJS::Bindings::Instance::getValueOfUndefinedField):
1491         (KJS::Bindings::Instance::valueOf):
1492         * bindings/runtime_array.cpp:
1493         (RuntimeArrayImp::lengthGetter):
1494         * bindings/runtime_method.cpp:
1495         (RuntimeMethodImp::lengthGetter):
1496         (RuntimeMethodImp::callAsFunction):
1497         (RuntimeMethodImp::execute):
1498         * kjs/array_object.cpp:
1499         (ArrayInstanceImp::lengthGetter):
1500         (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
1501         (ArrayPrototypeImp::ArrayPrototypeImp):
1502         (ArrayProtoFuncImp::ArrayProtoFuncImp):
1503         (ArrayProtoFuncImp::callAsFunction):
1504         (ArrayObjectImp::ArrayObjectImp):
1505         * kjs/bool_object.cpp:
1506         (BooleanPrototypeImp::BooleanPrototypeImp):
1507         (BooleanProtoFuncImp::callAsFunction):
1508         (BooleanObjectImp::BooleanObjectImp):
1509         (BooleanObjectImp::callAsFunction):
1510         * kjs/error_object.cpp:
1511         (ErrorPrototypeImp::ErrorPrototypeImp):
1512         (ErrorProtoFuncImp::ErrorProtoFuncImp):
1513         (ErrorProtoFuncImp::callAsFunction):
1514         (ErrorObjectImp::ErrorObjectImp):
1515         (NativeErrorImp::NativeErrorImp):
1516         * kjs/function.cpp:
1517         (KJS::FunctionImp::callAsFunction):
1518         (KJS::FunctionImp::processParameters):
1519         (KJS::FunctionImp::argumentsGetter):
1520         (KJS::FunctionImp::lengthGetter):
1521         (KJS::DeclaredFunctionImp::execute):
1522         (KJS::encode):
1523         (KJS::decode):
1524         (KJS::GlobalFuncImp::callAsFunction):
1525         * kjs/function_object.cpp:
1526         (FunctionPrototypeImp::FunctionPrototypeImp):
1527         (FunctionPrototypeImp::callAsFunction):
1528         (FunctionProtoFuncImp::callAsFunction):
1529         (FunctionObjectImp::FunctionObjectImp):
1530         * kjs/internal.cpp:
1531         (KJS::InterpreterImp::initGlobalObject):
1532         * kjs/interpreter.h:
1533         * kjs/lookup.h:
1534         * kjs/math_object.cpp:
1535         (MathObjectImp::getValueProperty):
1536         (MathFuncImp::callAsFunction):
1537         * kjs/nodes.cpp:
1538         (Node::setExceptionDetailsIfNeeded):
1539         (NullNode::evaluate):
1540         (PropertyNode::evaluate):
1541         (FunctionCallBracketNode::evaluate):
1542         (FunctionCallDotNode::evaluate):
1543         (PostfixBracketNode::evaluate):
1544         (PostfixDotNode::evaluate):
1545         (VoidNode::evaluate):
1546         (PrefixBracketNode::evaluate):
1547         (PrefixDotNode::evaluate):
1548         (ShiftNode::evaluate):
1549         (valueForReadModifyAssignment):
1550         (AssignDotNode::evaluate):
1551         (AssignBracketNode::evaluate):
1552         (VarDeclNode::evaluate):
1553         (VarDeclNode::processVarDecls):
1554         (VarDeclListNode::evaluate):
1555         (ReturnNode::execute):
1556         (CaseClauseNode::evalStatements):
1557         (ParameterNode::evaluate):
1558         (FuncDeclNode::processFuncDecl):
1559         * kjs/nodes.h:
1560         (KJS::StatementNode::evaluate):
1561         * kjs/number_object.cpp:
1562         (NumberPrototypeImp::NumberPrototypeImp):
1563         (NumberProtoFuncImp::callAsFunction):
1564         (NumberObjectImp::NumberObjectImp):
1565         (NumberObjectImp::getValueProperty):
1566         (NumberObjectImp::callAsFunction):
1567         * kjs/object.cpp:
1568         (KJS::ObjectImp::get):
1569         (KJS::Error::create):
1570         * kjs/object_object.cpp:
1571         (ObjectPrototypeImp::ObjectPrototypeImp):
1572         (ObjectProtoFuncImp::callAsFunction):
1573         (ObjectObjectImp::ObjectObjectImp):
1574         * kjs/property_slot.cpp:
1575         (KJS::PropertySlot::undefinedGetter):
1576         * kjs/regexp_object.cpp:
1577         (RegExpPrototypeImp::RegExpPrototypeImp):
1578         (RegExpProtoFuncImp::callAsFunction):
1579         (RegExpObjectImp::RegExpObjectImp):
1580         (RegExpObjectImp::arrayOfMatches):
1581         (RegExpObjectImp::getBackref):
1582         (RegExpObjectImp::getLastMatch):
1583         (RegExpObjectImp::getLastParen):
1584         (RegExpObjectImp::getLeftContext):
1585         (RegExpObjectImp::getRightContext):
1586         (RegExpObjectImp::getValueProperty):
1587         (RegExpObjectImp::construct):
1588         * kjs/string_object.cpp:
1589         (StringInstanceImp::StringInstanceImp):
1590         (StringPrototypeImp::StringPrototypeImp):
1591         (replace):
1592         (StringProtoFuncImp::callAsFunction):
1593         (StringObjectImp::StringObjectImp):
1594         (StringObjectImp::callAsFunction):
1595         (StringObjectFuncImp::StringObjectFuncImp):
1596         (StringObjectFuncImp::callAsFunction):
1597         * kjs/testkjs.cpp:
1598         (TestFunctionImp::callAsFunction):
1599         (VersionFunctionImp::callAsFunction):
1600         * kjs/value.h:
1601
1602 2005-12-10  Oliver Hunt  <ojh16@student.canterbury.ac.nz>
1603
1604         Reviewed by Maciej, landed by Darin.
1605
1606         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=3539
1607           Array join and toString methods do not support circular references
1608
1609         * kjs/array_object.cpp: (ArrayProtoFuncImp::callAsFunction):
1610         Added set of visited objects -- don't recurse if item is already in the set.
1611
1612 2005-12-08  Maciej Stachowiak  <mjs@apple.com>
1613
1614         Reviewed by John.
1615
1616         - fix major memory leak and resultant slowdown on JavaScript iBench from
1617         my PassRefPtr changes
1618         
1619         * kjs/ustring.cpp:
1620         (KJS::UString::Rep::create): I forgot to change one of the two overloads to create
1621         with a refcount of 0 instead of 1 (the smart pointer then bumps it. But instead of
1622         changing it, I changed both to start with a refcounter of 1 and use PassRefPtr::adopt
1623         to adopt the initial refcount, this may be a hair more efficient.
1624
1625         - made the assignment operators for smart pointers inline because Shark said so
1626         
1627         * kxmlcore/PassRefPtr.h:
1628         (KXMLCore::::operator=):
1629         * kxmlcore/RefPtr.h:
1630         (KXMLCore::::operator=):
1631
1632 2005-12-06  Anders Carlsson  <andersca@mac.com>
1633
1634         Reviewed by Darin.
1635
1636         - fix build when using gcc 4
1637                 
1638         * kjs/ustring.h:
1639         Make Rep public.
1640
1641         * kxmlcore/PassRefPtr.h:
1642         (KXMLCore::::operator):
1643         Fix a typo.
1644
1645 2005-12-05  Maciej Stachowiak  <mjs@apple.com>
1646
1647         Reviewed by Eric.
1648
1649         - add PassRefPtr, a smart pointer class that works in conjunction
1650         with RefPtr but has transfer-of-ownership semantics
1651         - apply RefPtr and PassRefPtr to UString
1652         - cleaned up UString a little so that it doesn't need to have so many friend classes
1653
1654         * JavaScriptCore.xcodeproj/project.pbxproj:
1655         * kjs/identifier.cpp:
1656         (KJS::Identifier::add):
1657         * kjs/identifier.h:
1658         (KJS::Identifier::Identifier):
1659         (KJS::Identifier::equal):
1660         * kjs/property_map.cpp:
1661         (KJS::PropertyMap::get):
1662         (KJS::PropertyMap::getLocation):
1663         (KJS::PropertyMap::put):
1664         (KJS::PropertyMap::remove):
1665         * kjs/ustring.cpp:
1666         (KJS::UCharReference::operator=):
1667         (KJS::UCharReference::ref):
1668         (KJS::UString::Rep::createCopying):
1669         (KJS::UString::Rep::create):
1670         (KJS::UString::usedCapacity):
1671         (KJS::UString::usedPreCapacity):
1672         (KJS::UString::expandCapacity):
1673         (KJS::UString::expandPreCapacity):
1674         (KJS::UString::UString):
1675         (KJS::UString::spliceSubstringsWithSeparators):
1676         (KJS::UString::append):
1677         (KJS::UString::operator=):
1678         (KJS::UString::toStrictUInt32):
1679         (KJS::UString::substr):
1680         (KJS::UString::copyForWriting):
1681         (KJS::operator==):
1682         * kjs/ustring.h:
1683         (KJS::UString::UString):
1684         (KJS::UString::~UString):
1685         (KJS::UString::data):
1686         (KJS::UString::isNull):
1687         (KJS::UString::isEmpty):
1688         (KJS::UString::size):
1689         (KJS::UString::rep):
1690         * kxmlcore/RefPtr.h:
1691         (KXMLCore::RefPtr::RefPtr):
1692         (KXMLCore::RefPtr::operator*):
1693         (KXMLCore::::operator):
1694         (KXMLCore::operator==):
1695         (KXMLCore::operator!=):
1696         (KXMLCore::static_pointer_cast):
1697         (KXMLCore::const_pointer_cast):
1698
1699 2005-12-04  Geoffrey Garen  <ggaren@apple.com>
1700
1701         Update test results to match Anders's last checkin.
1702
1703         * tests/mozilla/expected.html:
1704
1705 2005-12-04  Anders Carlsson  <andersca@mac.com>
1706
1707         Reviewed by Geoffrey.
1708
1709         - Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=3999>
1710         Object.prototype is missing propertyIsEnumerable
1711         
1712         * kjs/object.cpp:
1713         (KJS::ObjectImp::canPut):
1714         Refactor to use getPropertyAttributes.
1715
1716         (KJS::ObjectImp::propertyIsEnumerable):
1717         New function which checks if a property is enumerable.
1718
1719         (KJS::ObjectImp::getPropertyAttributes):
1720         * kjs/object.h:
1721         Add getPropertyAttributes and propertyIsEnumerable.
1722
1723         * kjs/object_object.cpp:
1724         (ObjectPrototypeImp::ObjectPrototypeImp):
1725         (ObjectProtoFuncImp::callAsFunction):
1726         * kjs/object_object.h:
1727         (KJS::ObjectProtoFuncImp::):
1728         Add propertyIsEnumerable to the Object prototype.
1729
1730 2005-12-01  Maciej Stachowiak  <mjs@apple.com>
1731
1732         Reviewed by Tim Hatcher.
1733
1734         - removed deprecated reset, isNull and nonNull methods
1735
1736         * kxmlcore/RefPtr.h:
1737
1738 2005-12-01  Anders Carlsson  <andersca@mac.com>
1739
1740         Reviewed by Darin.
1741
1742         - Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=3382>
1743         nodes2strings.cpp fails to print left expression of ForInNode when 'var' is not used
1744         
1745         Patch by Mark Rowe.
1746
1747         * kjs/nodes2string.cpp:
1748         (ForInNode::streamTo):
1749         Add lexpr if there's no varDecl.
1750
1751 2005-12-01  Maciej Stachowiak  <mjs@apple.com>
1752
1753         Rubber stamped by Eric.
1754
1755         - renamed SharedPtr to RefPtr via script
1756
1757         * JavaScriptCore.xcodeproj/project.pbxproj:
1758         * kjs/function.cpp:
1759         (KJS::GlobalFuncImp::callAsFunction):
1760         * kjs/function.h:
1761         * kjs/function_object.cpp:
1762         (FunctionObjectImp::construct):
1763         * kjs/internal.cpp:
1764         (KJS::Parser::parse):
1765         (KJS::InterpreterImp::checkSyntax):
1766         (KJS::InterpreterImp::evaluate):
1767         * kjs/internal.h:
1768         * kjs/nodes.h:
1769         * kjs/nodes2string.cpp:
1770         (KJS::SourceStream::operator<<):
1771         * kjs/protect.h:
1772         * kxmlcore/RefPtr.h: Added.
1773         (KXMLCore::RefPtr::RefPtr):
1774         (KXMLCore::RefPtr::~RefPtr):
1775         (KXMLCore::RefPtr::isNull):
1776         (KXMLCore::RefPtr::notNull):
1777         (KXMLCore::RefPtr::reset):
1778         (KXMLCore::RefPtr::get):
1779         (KXMLCore::RefPtr::operator*):
1780         (KXMLCore::RefPtr::operator->):
1781         (KXMLCore::RefPtr::operator!):
1782         (KXMLCore::RefPtr::operator UnspecifiedBoolType):
1783         (KXMLCore::::operator):
1784         (KXMLCore::operator==):
1785         (KXMLCore::operator!=):
1786         (KXMLCore::static_pointer_cast):
1787         (KXMLCore::const_pointer_cast):
1788         * kxmlcore/SharedPtr.h: Removed.
1789
1790 2005-11-30  Maciej Stachowiak  <mjs@apple.com>
1791
1792         Reviewed by Dave Hyatt.
1793
1794         - change idiom used for implicit bool conversion of smart pointers, because the old one gives weird error messages sometimes
1795
1796         * kjs/protect.h:
1797         (KJS::ProtectedPtr::operator UnspecifiedBoolType):
1798         * kxmlcore/SharedPtr.h:
1799         (KXMLCore::SharedPtr::operator UnspecifiedBoolType):
1800
1801 2005-11-29  Mitz Pettel  <opendarwin.org@mitzpettel.com>
1802
1803         Reviewed by ggaren.  Committed by eseidel.
1804
1805         Date conversion to local time gets the DST flag wrong sometimes
1806         http://bugzilla.opendarwin.org/show_bug.cgi?id=5514
1807
1808         * kjs/date_object.cpp:
1809         (KJS::isTime_tSigned):
1810         (KJS::DateProtoFuncImp::callAsFunction):
1811
1812 2005-11-26  Maciej Stachowiak  <mjs@apple.com>
1813
1814         Rubber stamped by Eric.
1815
1816         - renamed InterpreterLock to JSLock
1817
1818         * bindings/NP_jsobject.cpp:
1819         (_NPN_Invoke):
1820         (_NPN_Evaluate):
1821         (_NPN_GetProperty):
1822         (_NPN_SetProperty):
1823         (_NPN_RemoveProperty):
1824         (_NPN_HasProperty):
1825         (_NPN_HasMethod):
1826         (_NPN_SetException):
1827         * bindings/jni/jni_jsobject.cpp:
1828         (JSObject::call):
1829         (JSObject::eval):
1830         (JSObject::getMember):
1831         (JSObject::setMember):
1832         (JSObject::removeMember):
1833         (JSObject::getSlot):
1834         (JSObject::setSlot):
1835         (JSObject::toString):
1836         (JSObject::convertJObjectToValue):
1837         * bindings/objc/WebScriptObject.mm:
1838         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1839         (-[WebScriptObject evaluateWebScript:]):
1840         (-[WebScriptObject setValue:forKey:]):
1841         (-[WebScriptObject valueForKey:]):
1842         (-[WebScriptObject removeWebScriptKey:]):
1843         (-[WebScriptObject stringRepresentation]):
1844         (-[WebScriptObject webScriptValueAtIndex:]):
1845         (-[WebScriptObject setWebScriptValueAtIndex:value:]):
1846         (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
1847         * bindings/runtime.cpp:
1848         (Instance::createRuntimeObject):
1849         * bindings/runtime_root.cpp:
1850         (KJS::Bindings::addNativeReference):
1851         (KJS::Bindings::removeNativeReference):
1852         (RootObject::removeAllNativeReferences):
1853         * bindings/runtime_root.h:
1854         (KJS::Bindings::RootObject::~RootObject):
1855         (KJS::Bindings::RootObject::setRootObjectImp):
1856         * bindings/testbindings.cpp:
1857         (main):
1858         * bindings/testbindings.mm:
1859         (main):
1860         * kjs/JSLock.cpp:
1861         (KJS::initializeJSLock):
1862         (KJS::JSLock::lock):
1863         (KJS::JSLock::unlock):
1864         (KJS::JSLock::lockCount):
1865         (KJS::JSLock::DropAllLocks::DropAllLocks):
1866         (KJS::JSLock::DropAllLocks::~DropAllLocks):
1867         * kjs/JSLock.h:
1868         (KJS::JSLock::JSLock):
1869         (KJS::JSLock::~JSLock):
1870         * kjs/collector.cpp:
1871         (KJS::Collector::allocate):
1872         (KJS::Collector::collect):
1873         * kjs/internal.cpp:
1874         (KJS::InterpreterImp::InterpreterImp):
1875         (KJS::InterpreterImp::clear):
1876         (KJS::InterpreterImp::checkSyntax):
1877         (KJS::InterpreterImp::evaluate):
1878         * kjs/interpreter.cpp:
1879         (Interpreter::evaluate):
1880         * kjs/protect.h:
1881         (KJS::::ProtectedPtr):
1882         (KJS::::~ProtectedPtr):
1883         (KJS::::operator):
1884         * kjs/protected_reference.h:
1885         (KJS::ProtectedReference::ProtectedReference):
1886         (KJS::ProtectedReference::~ProtectedReference):
1887         (KJS::ProtectedReference::operator=):
1888         * kjs/protected_values.cpp:
1889         (KJS::ProtectedValues::getProtectCount):
1890         (KJS::ProtectedValues::increaseProtectCount):
1891         (KJS::ProtectedValues::decreaseProtectCount):
1892         * kjs/testkjs.cpp:
1893         (TestFunctionImp::callAsFunction):
1894         (main):
1895
1896 2005-11-26  Darin Adler  <darin@apple.com>
1897
1898         Reviewed by eseidel.  Committed by eseidel.
1899
1900         Inline ScopeChain functions for speed.
1901         http://bugzilla.opendarwin.org/show_bug.cgi?id=5687
1902
1903         * kjs/object.h:
1904         (KJS::ScopeChain::mark):
1905         * kjs/scope_chain.cpp:
1906         * kjs/scope_chain.h:
1907         (KJS::ScopeChain::ref):
1908         (KJS::ScopeChain::operator=):
1909         (KJS::ScopeChain::bottom):
1910         (KJS::ScopeChain::push):
1911         (KJS::ScopeChain::pop):
1912
1913 2005-11-21  Maciej Stachowiak  <mjs@apple.com>
1914
1915         Reviewed by Geoff.
1916
1917         <rdar://problem/4139620> Seed: WebKit: hang when sending XMLHttpRequest if automatic proxy config is used
1918
1919         Also factored locking code completely into a separate class, and
1920         added a convenient packaged way to temporarily drop locks.
1921
1922         * JavaScriptCore.xcodeproj/project.pbxproj:
1923         * kjs/JSLock.cpp: Added.
1924         (KJS::initializeInterpreterLock):
1925         (KJS::InterpreterLock::lock):
1926         (KJS::InterpreterLock::unlock):
1927         (KJS::InterpreterLock::lockCount):
1928         (KJS::InterpreterLock::DropAllLocks::DropAllLocks):
1929         (KJS::InterpreterLock::DropAllLocks::~DropAllLocks):
1930         * kjs/JSLock.h: Added.
1931         (KJS::InterpreterLock::InterpreterLock):
1932         (KJS::InterpreterLock::~InterpreterLock):
1933         * kjs/internal.cpp:
1934         * kjs/internal.h:
1935         * kjs/interpreter.cpp:
1936         * kjs/interpreter.h:
1937         * kjs/protect.h:
1938         * kjs/testkjs.cpp:
1939         (TestFunctionImp::callAsFunction):
1940
1941 2005-11-21  Eric Seidel  <eseidel@apple.com>
1942
1943         Rubber-stamped by hyatt.
1944         
1945         Removed JavaScriptCore+SVG target.
1946
1947         * JavaScriptCore.xcodeproj/project.pbxproj:
1948
1949 2005-11-15  Geoffrey Garen  <ggaren@apple.com>
1950
1951         Reviewed by mjs.
1952         
1953         - Fixed <rdar://problem/4342216> Installer crash in 
1954           KJS::ValueImp::marked() when garbage collector runs inside call to 
1955           ConstantValues::init()
1956           
1957         I took responsibility for initializing and marking ConstantValues away 
1958         from InterpreterImp, since it's possible to reference such a value 
1959         before any interpreter has been created and after the last interpreter 
1960         has been destroyed.
1961
1962         InterpreterImp::lock now initializes ConstantValues. It's a good
1963         place for the initialization because you have to call it before
1964         creating any objects. Since ::lock can be called more than once,
1965         I added a check in ConstantValues::init to ensure that it executes 
1966         only once.
1967
1968         Collector:collect is now responsible for marking ConstantValues.
1969
1970         We no longer clear the ConstantValues since we can't guarantee that no 
1971         one has a reference to them.
1972
1973         FIXME: This is hackery. The long-term plan is to make ConstantValues
1974         use immediate values that require no initialization.
1975
1976         * ChangeLog:
1977         * kjs/collector.cpp:
1978         (KJS::Collector::collect):
1979         * kjs/internal.cpp:
1980         (KJS::InterpreterImp::InterpreterImp):
1981         (KJS::InterpreterImp::lock):
1982         (KJS::InterpreterImp::clear):
1983         (KJS::InterpreterImp::mark):
1984         * kjs/internal.h:
1985         * kjs/value.cpp:
1986         (KJS::ConstantValues::initIfNeeded):
1987         * kjs/value.h:
1988
1989 2005-11-08  Geoffrey Garen  <ggaren@apple.com>
1990
1991         Reviewed by Darin.
1992
1993         This patch fixes some naughty naughty code -- 5 crashes and 2 
1994         may-go-haywire-in-the-futures.
1995         
1996         One such crash is <rdar://problem/4247330> 8C46 Crash with with 
1997         incomplete parameter list to webScript object function.
1998         
1999         I replaced early returns from within NS_DURINGs with calls to
2000         NS_VALUERETURN because the doc says, "You cannot use goto or 
2001         return to exit an exception handling domain -- errors will result."
2002         
2003         I replaced hard-coded analyses of -[NSMethodSignature 
2004         methodReturnType] with more abstracted alternatives, since
2005         the documentation says "This encoding is implementation-specific, 
2006         so applications should use it with caution," and then emits an
2007         evil cackle.
2008         
2009         I removed the early return in the case where a JavaScript caller
2010         supplies an insufficient number of arguments, because the right
2011         thing to do in such a case is to use JavaScript's defined behavior
2012         of supplying "undefined" for any missing arguments.
2013         
2014         I also changed ObjcInstance::invokeMethod so that it no longer
2015         deletes the method passed to it. It doesn't create the method,
2016         so it shouldn't delete it. A friend of mine named
2017         KERNEL_PROTECTION_FAILURE agrees with me on this point.
2018         
2019         Finally, I changed an assert(true) to assert(false) because
2020         all the other asserts were making fun of it.
2021
2022         * bindings/objc/objc_instance.mm:
2023         (ObjcInstance::invokeMethod):
2024         (ObjcInstance::invokeDefaultMethod):
2025
2026 2005-11-06  Geoffrey Garen  <ggaren@apple.com>
2027
2028         Reviewed by Darin.
2029
2030         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5571
2031           REGRESSION (412.5-TOT): duplicated words/sentences at 
2032           shakespeer.sourceforge.net
2033
2034         Our UTF16-modified PCRE didn't work with extended character classes
2035         (classes involving characters > 255) because it used the GETCHARINC
2036         macro to read through them. In UTF16 mode, GETCHARINC expects UTF16 
2037         input, but PCRE encodes character classes in UTF8 regardless of the
2038         input mode of the subject string.
2039
2040         The fix is to explicitly define GETUTF8CHARINC, and to use it,
2041         rather than GETCHARINC, when reading extended character classes. 
2042         
2043         In UTF8 mode, we simply define GETCHARINC to be GETUTF8CHARINC.
2044
2045         * pcre/pcre_internal.h:
2046         * pcre/pcre_xclass.c:
2047         (_pcre_xclass):
2048
2049 2005-11-05  Geoffrey Garen  <ggaren@apple.com>
2050
2051         Patch by Mitz Pettel, reviewed by Maciej.
2052
2053         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5357
2054           REGRESSION: Scriptable plugin hides properties of OBJECT element
2055
2056         * bindings/objc/objc_class.mm:
2057         (KJS::Bindings::ObjcClass::fallbackObject):
2058
2059 2005-11-05  Geoffrey Garen  <ggaren@apple.com>
2060
2061         Reviewed by Darin.
2062
2063         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5409
2064         slice() testcase doesn't pass
2065
2066         Modified String.slice to deal with funky values.
2067         Updated test results. We now pass <js1_2/String/slice.js>.
2068
2069         * kjs/string_object.cpp:
2070         (StringProtoFuncImp::callAsFunction):
2071         * tests/mozilla/expected.html:
2072
2073 2005-11-04  Darin Adler  <darin@apple.com>
2074
2075         Reviewed by Tim Hatcher.
2076
2077         * kxmlcore/HashSet.h: Fixed case of "hashfunctions.h" -- needs to be "HashFunctions.h".
2078
2079 2005-11-03  Timothy Hatcher  <timothy@apple.com>
2080
2081         Reviewed by Darin and Vicki.
2082
2083         * JavaScriptCore.xcodeproj/project.pbxproj:
2084           Change to use $(SYSTEM_LIBRARY_DIR) consistently and place
2085           $(NEXT_ROOT) in a few spots to make build-root work.
2086
2087 2005-11-03  Geoffrey Garen  <ggaren@apple.com>
2088
2089         - Updated JavaScriptCore test results to reflect recent fixes.
2090
2091         * tests/mozilla/expected.html:
2092
2093 2005-11-03  Geoffrey Garen  <ggaren@apple.com>
2094
2095         Reviewed by darin.
2096
2097         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5602
2098           REGRESSION: RegExp("[^\\s$]+", "g") returns extra matches
2099
2100         We now update lastIndex relative to the start of the last match,
2101         rather than the start of the last search. We used to assume that
2102         the two were equal, but that is not the case when a pattern
2103         matches at a character after the first in the string.
2104
2105         * kjs/regexp_object.cpp:
2106         (RegExpProtoFuncImp::callAsFunction):
2107
2108 2005-10-24  John Sullivan  <sullivan@apple.com>
2109
2110         Reviewed by Darin Adler. Code changes by Alexey Proskuryakov.
2111         
2112         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4931
2113         Unicode format characters (Cf) should be removed from JavaScript source
2114
2115         * kjs/lexer.cpp:
2116         include <unicode/uchar.h>
2117         (Lexer::Lexer):
2118         use KJS::UChar instead of UChar to avoid ambiguity caused by new include
2119         (Lexer::setCode):
2120         ditto; also, use shift(4) to skip first 4 chars to take advantage of new
2121         logic there.
2122         (Lexer::shift):
2123         skip chars of type U_FORMAT_CHAR
2124         (Lexer::convertUnicode):
2125         use KJS::UChar instead of UChar to avoid ambiguity caused by new include
2126         (Lexer::record16):
2127         ditto
2128         (Lexer::makeIdentifier):
2129         ditto
2130         (Lexer::makeUString):
2131         ditto
2132         
2133         * tests/mozilla/ecma/Array/15.4.5.1-1.js:
2134         updated to skip soft hyphens
2135
2136 2005-10-24  John Sullivan  <sullivan@apple.com>
2137
2138         Reviewed by Darin Adler. Code changes by George Staikos/Geoff Garen.
2139         
2140         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4142
2141         Date object does not always adjust daylight savings correctly
2142
2143         * kjs/date_object.cpp:
2144         (KJS::makeTime):
2145         Fix the case where a time change crosses the daylight savings start/end dates.
2146
2147 2005-10-17  Maciej Stachowiak  <mjs@apple.com>
2148
2149         Reviewed by Geoff. Code changes by Darin.
2150
2151         - some micro-optimizations to FastMalloc to reduce math and branches.
2152
2153         * kxmlcore/FastMalloc.cpp:
2154         (KXMLCore::TCMalloc_Central_FreeList::Populate):
2155         (KXMLCore::fastMallocRegisterThread):
2156         (KXMLCore::TCMalloc_ThreadCache::GetCache):
2157         (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
2158
2159 2005-10-15  Maciej Stachowiak  <mjs@apple.com>
2160
2161         Reverted fix for this bug, because it was part of a time range that caused a performance
2162         regression:
2163         
2164         <rdar://problem/4260481> Remove Reference type from JavaScriptCore
2165
2166 2005-10-15  Darin Adler  <darin@apple.com>
2167
2168         * kxmlcore/HashTable.cpp: Fixed build failure (said hashtable.h instead of HashTable.h).
2169
2170 2005-10-14  Geoffrey Garen  <ggaren@apple.com>
2171
2172         Style changes recommended by Darin.
2173         
2174         Changed to camelCase, changed ValueImp* to ValueImp *.
2175
2176         * kjs/simple_number.h:
2177         (KJS::SimpleNumber::make):
2178         (KJS::SimpleNumber::value):
2179
2180 2005-10-11  Geoffrey Garen  <ggaren@apple.com>
2181
2182         Added regexp_object.lut.h build phase from JavaScriptCore
2183         to JavaScriptCore+SVG.
2184
2185         Reviewed by mitz.
2186
2187         * JavaScriptCore.xcodeproj/project.pbxproj:
2188
2189 2005-10-11  Geoffrey Garen  <ggaren@apple.com>
2190
2191         Fixed build bustage from last checkin (stray characters
2192         in the project file).
2193
2194         Reviewed by mitz.
2195
2196         * JavaScriptCore.xcodeproj/project.pbxproj:
2197
2198 2005-10-11  Geoffrey Garen  <ggaren@apple.com>
2199
2200         New JavaScriptCore test results to reflect the last change.
2201
2202         * tests/mozilla/expected.html:
2203
2204 2005-10-10  Geoffrey Garen  <ggaren@apple.com>
2205
2206         - Implemented caching of match state inside the global RegExp object
2207           (lastParen, leftContext, rightContext, lastMatch, input).
2208
2209           exec(), test(), match(), search(), and replace() now dipatch regular
2210           expression matching through the RegExp object's performMatch function, 
2211           to facilitate caching. This replaces registerRegexp and 
2212           setSubPatterns.
2213         
2214         - Implemented the special '$' aliases (e.g. RegExp.input aliases to 
2215           RegExp.$_).
2216
2217         - Moved support for backreferences into the new static hash table
2218           used for other special RegExp properties. Truncated backreferences
2219           at $9 to match IE, FF, and the "What's New in Netscape 1.2?" doc.
2220           (String.replace still supports double-digit backreferences.)
2221
2222         - Tweaked RegExp.prototype.exec to handle ginormous values in lastIndex.
2223
2224         Fixes 11 -- count em, 11 -- JavaScriptCore tests.
2225
2226         * fast/js/regexp-caching-expected.txt: Added.
2227         * fast/js/regexp-caching.html: Added.
2228
2229         Reviewed by mjs.
2230
2231         * JavaScriptCore.xcodeproj/project.pbxproj: Added regexp_object.lut.h
2232         * kjs/create_hash_table: Tweaked to allow for more exotic characters.
2233                                  We now rely on the compiler to catch illegal
2234                                  identifiers.
2235         * kjs/regexp.cpp:
2236         (KJS::RegExp::RegExp):
2237         * kjs/regexp_object.cpp:
2238         (RegExpProtoFuncImp::callAsFunction):
2239         (RegExpObjectImp::RegExpObjectImp):
2240         (RegExpObjectImp::performMatch):
2241         (RegExpObjectImp::arrayOfMatches):
2242         (RegExpObjectImp::backrefGetter):
2243         (RegExpObjectImp::getLastMatch):
2244         (RegExpObjectImp::getLastParen):
2245         (RegExpObjectImp::getLeftContext):
2246         (RegExpObjectImp::getRightContext):
2247         (RegExpObjectImp::getOwnPropertySlot):
2248         (RegExpObjectImp::getValueProperty):
2249         (RegExpObjectImp::put):
2250         (RegExpObjectImp::putValueProperty):
2251         * kjs/regexp_object.h:
2252         (KJS::RegExpObjectImp::):
2253         * kjs/string_object.cpp:
2254         (substituteBackreferences):
2255         (replace):
2256         (StringProtoFuncImp::callAsFunction):
2257
2258 2005-10-09  Darin Adler  <darin@apple.com>
2259
2260         Reviewed by Maciej; some changes done after review.
2261
2262         - fixed <rdar://problem/4092064> hanging loading page; rte.ie (works in IE and Firefox)
2263         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5280
2264           Date.setMonth fails with negative values
2265         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5154
2266           JSC should switch to _r variants of unix time/date functions
2267         - fixed a few possible overflow cases
2268
2269         Retested all tests to be sure nothing broke; added layout test for bug 5280.
2270
2271         * kjs/config.h: Removed TIME_WITH_SYS_TIME define. Also set HAVE_SYS_TIMEB_H
2272         for the __APPLE__ case (the latter is accurate but irrelevant).
2273
2274         * kjs/date_object.h: Reformatted. Removed unnecessary include of "function_object.h".
2275         Moved declarations of helper classes and functions into the cpp file.
2276
2277         * kjs/date_object.cpp: Removed code at top to define macros to use CoreFoundation instead of
2278         POSIX date functions.
2279         (KJS::styleFromArgString): Tweaked to return early instead of using a variable.
2280         (KJS::formatLocaleDate): Tweaked to check for undefined rather than checking argument count.
2281         (KJS::formatDate): Made parameter const.
2282         (KJS::formatDateUTCVariant): Ditto.
2283         (KJS::formatTime): Ditto.
2284         (KJS::DateProtoFuncImp::callAsFunction): Use gmtime_r and localtime_r instead of gmtime and
2285         localtime.
2286         (KJS::DateObjectImp::callAsFunction): Use localtime_r instead of localtime.
2287         (KJS::ymdhmsToSeconds): Renamed from ymdhms_to_seconds. Changed computation to avoid possible
2288         overflow if year is an extremely large or small number.
2289         (KJS::makeTime): Removed code to move large month numbers from tm_mon to tm_year; this was
2290         to accomodate CFGregorianDate, which is no longer used (and didn't handle negative values).
2291         (KJS::parseDate): Renamed from KRFCDate_parseDate; changed to return a value in milliseconds
2292         rather than in seconds. Reformatted the code. Changed to use UTF8String() instead of ascii(),
2293         since ascii() is not thread safe. Changed some variables back from int to long to avoid
2294         trouble if the result of strtol does not fit in an int (64-bit issue only).
2295
2296 2005-10-08  Mitz Pettel  <opendarwin.org@mitzpettel.com>
2297
2298         Reviewed by Geoff.
2299         Tweaked and landed by Darin.
2300
2301         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5266
2302           Support parenthesized comments in Date.parse()
2303
2304         * kjs/date_object.cpp:
2305         (KJS::skipSpacesAndComments): Take a pointer, and advance it past spaces,
2306         and also past anything enclosed in parentheses.
2307         (KJS::KRFCDate_parseDate): Use skipSpacesAndComments wherever we formerly had
2308         code to skip spaces.
2309
2310 2005-10-08  Justin Haygood  <justin@xiondigital.net>
2311
2312         Reviewed, tweaked, and landed by Darin.
2313
2314         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5189
2315           pcre_exec.c fails to compile using MSVC
2316         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5190
2317           KJS config.h adjustment for Win32
2318         
2319         * kjs/config.h: Make sure HAVE_MMAP and HAVE_SBRK are off for Win32.
2320         Turn HAVE_ERRNO_H on for Mac OS X. Sort defines so they are easy to compare
2321         with each other. Remove #undef of DEBUG_COLLECTOR.
2322         * pcre/pcre_exec.c: (match): Work around strange MSVC complaint by splitting
2323         the definition of a local variable into a separate declaration and
2324         initialization.
2325
2326 2005-10-05  Geoffrey Garen  <ggaren@apple.com>
2327  
2328         - Darin and I rewrote our implementation of the SimpleNumber class
2329           to store number bit patterns in their floating point formats.
2330  
2331         My tweaks reviewed by Darin.
2332         
2333         ~1% speedup on JS iBench.
2334         
2335         * kjs/internal.h: removed obsolete jsNumber declarations.
2336         * kjs/math_object.cpp:
2337         (MathFuncImp::callAsFunction): changed KJS::isNaN to isNaN
2338         * kjs/nodes.cpp:
2339         (PostfixResolveNode::evaluate): removed obsolete knownToBeInteger
2340         (PostfixBracketNode::evaluate): ditto
2341         (PostfixDotNode::evaluate): ditto
2342         (PrefixResolveNode::evaluate): ditto
2343         (PrefixBracketNode::evaluate): ditto
2344         (PrefixDotNode::evaluate): ditto
2345         (NegateNode::evaluate): ditto
2346         (valueForReadModifyAssignment): ditto
2347         * kjs/number_object.cpp: removed obsolete comment
2348         * kjs/operations.cpp:
2349         (KJS::equal): removed unnecessary isNaN checks
2350         (KJS::strictEqual): ditto
2351         (KJS::add): removed obsolete knownToBeInteger
2352         (KJS::mult): ditto
2353         * kjs/operations.h: removed include of "value.h" to prevent circular reference
2354         * kjs/simple_number.h: removed unnecessary #includes
2355         (KJS::SimpleNumber::make): see above
2356         (KJS::SimpleNumber::is): ditto
2357         (KJS::SimpleNumber::value): ditto
2358         * kjs/string_object.cpp:
2359         (StringProtoFuncImp::callAsFunction): changed KJS::isNaN to isNaN
2360         * kjs/ustring.cpp: removed unnecessary isNaN check
2361         (KJS::UString::toUInt32): ditto
2362         * kjs/value.cpp:
2363         (KJS::jsNumber): removed obsolete jsNumber definitions
2364         (KJS::ConstantValues::init): NaN is no longer a ConstantValue
2365         (KJS::ConstantValues::clear): ditto
2366         (KJS::ConstantValues::mark): ditto
2367         * kjs/value.h: removed obsolete knownToBeInteger
2368         (KJS::jsNaN): now returns a SimpleNumber
2369         (KJS::ValueImp::getUInt32): changed to account for NaN being a SimpleNumber
2370         (KJS::ValueImp::toBoolean): ditto
2371         (KJS::ValueImp::toString): changed to account for +/- 0.0
2372         (KJS::jsZero): changed to reflect that SimpleNumber::make takes a double
2373         (KJS::jsOne): ditto
2374         (KJS::jsTwo): ditto
2375         (KJS::Number): removed obsolete non-double constructor declarations
2376
2377 2005-10-05  Maciej Stachowiak  <mjs@apple.com>
2378
2379         Reviewed by Eric.
2380
2381         - fixed <rdar://problem/4260481> Remove Reference type from JavaScriptCore
2382
2383         Also fixed some bugs with for..in enumeration while I was at it. object
2384         properties now come before prototype properties and duplicates
2385         between object and prototype are listed only once.
2386
2387         * JavaScriptCore.xcodeproj/project.pbxproj:
2388         * kjs/IdentifierSequencedSet.cpp: Added.
2389         (KJS::IdentifierSequencedSet::IdentifierSequencedSet):
2390         (KJS::IdentifierSequencedSet::deallocateVector):
2391         (KJS::IdentifierSequencedSet::~IdentifierSequencedSet):
2392         (KJS::IdentifierSequencedSet::insert):
2393         * kjs/IdentifierSequencedSet.h: Added.
2394         (KJS::IdentifierSequencedSetIterator::IdentifierSequencedSetIterator):
2395         (KJS::IdentifierSequencedSetIterator::operator*):
2396         (KJS::IdentifierSequencedSetIterator::operator->):
2397         (KJS::IdentifierSequencedSetIterator::operator++):
2398         (KJS::IdentifierSequencedSetIterator::operator==):
2399         (KJS::IdentifierSequencedSetIterator::operator!=):
2400         (KJS::IdentifierSequencedSet::begin):
2401         (KJS::IdentifierSequencedSet::end):
2402         (KJS::IdentifierSequencedSet::size):
2403         * kjs/array_instance.h:
2404         * kjs/array_object.cpp:
2405         (ArrayInstanceImp::getPropertyNames):
2406         (ArrayInstanceImp::setLength):
2407         (ArrayInstanceImp::pushUndefinedObjectsToEnd):
2408         * kjs/nodes.cpp:
2409         (ForInNode::execute):
2410         * kjs/nodes.h:
2411         * kjs/object.cpp:
2412         (KJS::ObjectImp::getPropertyNames):
2413         * kjs/object.h:
2414         * kjs/property_map.cpp:
2415         (KJS::PropertyMap::getEnumerablePropertyNames):
2416         (KJS::PropertyMap::getSparseArrayPropertyNames):
2417         * kjs/property_map.h:
2418         * kjs/protect.h:
2419         * kjs/protected_reference.h: Removed.
2420         * kjs/reference.cpp: Removed.
2421         * kjs/reference.h: Removed.
2422         * kjs/reference_list.cpp: Removed.
2423         * kjs/reference_list.h: Removed.
2424         * kjs/ustring.h:
2425         (KJS::UString::impl):
2426         * kxmlcore/HashSet.h:
2427
2428 2005-10-04  Eric Seidel  <eseidel@apple.com>
2429
2430         Reviewed by mjs.
2431
2432         Code cleanup, which resulted in a small win on iBench.
2433
2434         * kjs/object.cpp:
2435         (KJS::tryGetAndCallProperty): new static inline
2436         (KJS::ObjectImp::defaultValue): code cleanup
2437
2438 2005-10-03  Maciej Stachowiak  <mjs@apple.com>
2439
2440         Patch from George Staikos <staikos@kde.org>, reviewed and tweaked a bit by me.
2441
2442         - more Linux build fixes
2443         
2444         * kjs/operations.cpp:
2445         * kxmlcore/FastMalloc.h:
2446         * kxmlcore/TCSystemAlloc.cpp:
2447         (TCMalloc_SystemAlloc):
2448
2449 2005-10-03  Maciej Stachowiak  <mjs@apple.com>
2450
2451         Patch from George Staikos <staikos@kde.org>, reviewed and tweaked a bit by me.
2452
2453         http://bugzilla.opendarwin.org/show_bug.cgi?id=5174
2454         Add support for compiling on Linux (likely to help for other POSIX systems too)
2455
2456         * kjs/collector.cpp:
2457         (KJS::Collector::markCurrentThreadConservatively):
2458         (KJS::Collector::markOtherThreadConservatively):
2459         * kjs/config.h:
2460         * kjs/date_object.cpp:
2461         (KJS::formatDate):
2462         (KJS::formatDateUTCVariant):
2463         (KJS::formatTime):
2464         (KJS::timeZoneOffset):
2465         (KJS::DateProtoFuncImp::callAsFunction):
2466         (KJS::DateObjectImp::construct):
2467         (KJS::DateObjectImp::callAsFunction):
2468         (KJS::makeTime):
2469         * kjs/identifier.cpp:
2470         * kjs/internal.cpp:
2471         (KJS::initializeInterpreterLock):
2472         (KJS::lockInterpreter):
2473         (KJS::unlockInterpreter):
2474         (KJS::UndefinedImp::toPrimitive):
2475         (KJS::UndefinedImp::toBoolean):
2476         (KJS::UndefinedImp::toNumber):
2477         (KJS::UndefinedImp::toString):
2478         (KJS::NullImp::toPrimitive):
2479         (KJS::NullImp::toBoolean):
2480         (KJS::NullImp::toNumber):
2481         (KJS::NullImp::toString):
2482         (KJS::BooleanImp::toPrimitive):
2483         (KJS::BooleanImp::toBoolean):
2484         (KJS::BooleanImp::toNumber):
2485         (KJS::BooleanImp::toString):
2486         (KJS::StringImp::toPrimitive):
2487         (KJS::StringImp::toBoolean):
2488         (KJS::StringImp::toNumber):
2489         (KJS::StringImp::toString):
2490         * kjs/internal.h:
2491         * kjs/protected_values.cpp:
2492
2493 2005-10-03  Maciej Stachowiak  <mjs@apple.com>
2494
2495         - fix Development build after last checkin
2496
2497         * kxmlcore/FastMalloc.cpp:
2498         (KXMLCore::fastMallocRegisterThread):
2499
2500 2005-10-02  Maciej Stachowiak  <mjs@apple.com>
2501
2502         Reviewed by Darin.
2503
2504         <rdar://problem/4283967> REGRESSION: 3% regression on PLT from new FastMalloc
2505         http://bugzilla.opendarwin.org/show_bug.cgi?id=5243
2506         
2507         A number of optimizations to the new threadsafe malloc that make it actually as fast
2508         as dlmalloc (I measured wrong before) and as memory-efficient as the system malloc.
2509
2510         - use fastMalloc for everything - it now gets applied to all new/delete allocations
2511         via a private inline operator new that is now included into every file via config.h.
2512
2513         - tweaked some of the numeric parameters for size classes and amount of wasted memory
2514         allowed per allocation - this saves on memory use and consequently improves speed.
2515
2516         - so long as the allocator is not being used on background threads, get the per-thread
2517         cache from a global variable instead of from pthread_getspecific, since the latter is slow.
2518
2519         - inline more functions, and force the ones GCC refuses to inline with 
2520         attribute(always_inline), nearly all of these have one call site so inlining them has 
2521         to be a win.
2522
2523         - use some tricks to calculate allocation size more efficiently and fewer times for small
2524         allocations, to avoid hitting the huge size table array.
2525
2526         - avoid hitting the per-thread cache on code paths that don't need it.
2527
2528         - implement inline assembly version of spinlock for PowerPC (was already done for x86)
2529
2530         * bindings/NP_jsobject.cpp:
2531         * bindings/c/c_class.cpp:
2532         * bindings/c/c_instance.cpp:
2533         * bindings/c/c_runtime.cpp:
2534         * bindings/c/c_utility.cpp:
2535         * bindings/jni/jni_class.cpp:
2536         * bindings/jni/jni_instance.cpp:
2537         * bindings/jni/jni_jsobject.cpp:
2538         * bindings/jni/jni_objc.mm:
2539         * bindings/jni/jni_runtime.cpp:
2540         * bindings/jni/jni_utility.cpp:
2541         * bindings/npruntime.cpp:
2542         * bindings/objc/WebScriptObject.mm:
2543         * bindings/objc/objc_class.mm:
2544         * bindings/objc/objc_instance.mm:
2545         * bindings/objc/objc_runtime.mm:
2546         * bindings/objc/objc_utility.mm:
2547         * bindings/runtime.cpp:
2548         * bindings/runtime_array.cpp:
2549         * bindings/runtime_method.cpp:
2550         * bindings/runtime_object.cpp:
2551         * bindings/runtime_root.cpp:
2552         * bindings/testbindings.cpp:
2553         * bindings/testbindings.mm:
2554         * kjs/array_object.cpp:
2555         (ArrayInstanceImp::ArrayInstanceImp):
2556         (ArrayInstanceImp::~ArrayInstanceImp):
2557         (ArrayInstanceImp::resizeStorage):
2558         * kjs/bool_object.cpp:
2559         * kjs/collector.cpp:
2560         (KJS::Collector::registerThread):
2561         * kjs/config.h:
2562         * kjs/debugger.cpp:
2563         * kjs/error_object.cpp:
2564         * kjs/function.cpp:
2565         * kjs/function_object.cpp:
2566         * kjs/identifier.cpp:
2567         (KJS::Identifier::rehash):
2568         * kjs/internal.cpp:
2569         (KJS::Parser::saveNewNode):
2570         (KJS::clearNewNodes):
2571         * kjs/interpreter.cpp:
2572         * kjs/lexer.cpp:
2573         (Lexer::doneParsing):
2574         (Lexer::makeIdentifier):
2575         (Lexer::makeUString):
2576         * kjs/list.cpp:
2577         * kjs/math_object.cpp:
2578         * kjs/nodes.cpp:
2579         * kjs/nodes.h:
2580         * kjs/nodes2string.cpp:
2581         * kjs/number_object.cpp:
2582         (integer_part_noexp):
2583         (char_sequence):
2584         * kjs/object.cpp:
2585         * kjs/object_object.cpp:
2586         * kjs/property_map.cpp:
2587         * kjs/property_slot.cpp:
2588         * kjs/protected_values.cpp:
2589         (KJS::ProtectedValues::rehash):
2590         * kjs/reference.cpp:
2591         * kjs/reference_list.cpp:
2592         * kjs/regexp.cpp:
2593         * kjs/regexp_object.cpp:
2594         * kjs/scope_chain.cpp:
2595         * kjs/scope_chain.h:
2596         * kjs/string_object.cpp:
2597         * kjs/testkjs.cpp:
2598         * kjs/ustring.h:
2599         * kjs/value.cpp:
2600         * kxmlcore/Assertions.mm:
2601         * kxmlcore/FastMalloc.cpp:
2602         (KXMLCore::InitSizeClasses):
2603         (KXMLCore::DLL_IsEmpty):
2604         (KXMLCore::DLL_Prepend):
2605         (KXMLCore::TCMalloc_Central_FreeList::Insert):
2606         (KXMLCore::TCMalloc_Central_FreeList::Remove):
2607         (KXMLCore::TCMalloc_Central_FreeList::Populate):
2608         (KXMLCore::TCMalloc_ThreadCache::Allocate):
2609         (KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
2610         (KXMLCore::fastMallocRegisterThread):
2611         (KXMLCore::TCMalloc_ThreadCache::GetCache):
2612         (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
2613         (KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2614         (KXMLCore::do_malloc):
2615         (KXMLCore::do_free):
2616         (KXMLCore::realloc):
2617         * kxmlcore/FastMalloc.h:
2618         (operator new):
2619         (operator delete):
2620         (operator new[]):
2621         (operator delete[]):
2622         * kxmlcore/HashTable.cpp:
2623         * kxmlcore/TCSpinLock.h:
2624         (TCMalloc_SpinLock::Lock):
2625         (TCMalloc_SpinLock::Unlock):
2626         (TCMalloc_SlowLock):
2627         * kxmlcore/TCSystemAlloc.cpp:
2628
2629 2005-09-30  Geoffrey Garen  <ggaren@apple.com>
2630
2631         - Second cut at fixing <rdar://problem/4275206> Denver Regression: Seed: 
2632           Past Editions of Opinions display "NAN/Undefined" for www.washingtonpost.com
2633                 
2634         Reviewed by john.
2635
2636         * kjs/date_object.cpp:
2637         (KJS::KRFCDate_parseDate): Intead of creating a timezone when one isn't specified,
2638         just rely on the fallback logic, which will do it for you. Also, return invalidDate
2639         if the date includes trailing garbage. (Somewhat accidentally, the timezone logic
2640         used to catch trailing garbage.)
2641
2642         Added test case to fast/js/date-parse-test.html.
2643
2644 2005-09-29  Eric Seidel  <eseidel@apple.com>
2645         Fix from Mitz Pettel <opendarwin.org@mitzpettel.com>
2646
2647         Reviewed by darin.
2648
2649         Fix JSC memory smasher in TOT.
2650         http://bugzilla.opendarwin.org/show_bug.cgi?id=5176
2651
2652         * pcre/pcre_exec.c:
2653         (match):
2654
2655 2005-09-29  Eric Seidel  <eseidel@apple.com>
2656         Fix from Mitz Pettel <opendarwin.org@mitzpettel.com>
2657
2658         Reviewed by mjs.
2659
2660         * JavaScriptCore.xcodeproj/project.pbxproj:
2661         Build fix for JSC+SVG after 5161.
2662         http://bugzilla.opendarwin.org/show_bug.cgi?id=5179
2663
2664 2005-09-28  Geoffrey Garen  <ggaren@apple.com>
2665
2666         - Fixed <rdar://problem/4275206> Denver Regression: Seed: Past Editions of Opinions display 
2667           "NAN/Undefined" for www.washingtonpost.com
2668           
2669         Reviewed by darin.
2670
2671         * kjs/date_object.cpp:
2672         (KJS::KRFCDate_parseDate): If the timezone isn't specified, rather than returning
2673         invalidDate, substitute the local timezone. This matches the behavior of FF/IE.
2674
2675 2005-09-28  Maciej Stachowiak  <mjs@apple.com>
2676
2677         Patch from George Staikos, reviewed by me.
2678
2679         - fixed some compile issues on Linux
2680         
2681         * kjs/property_slot.h:
2682         * kjs/simple_number.h:
2683
2684 2005-09-27  Maciej Stachowiak  <mjs@apple.com>
2685
2686         Reviewed by Eric.
2687
2688         - move HashMap/HashSet code down to JavaScriptCore
2689         http://bugzilla.opendarwin.org/show_bug.cgi?id=5161
2690         
2691         * JavaScriptCore.xcodeproj/project.pbxproj:
2692         * kjs/internal.cpp:
2693         (KJS::interpreterMap): Function that fetches the interpreter map on demand. 
2694         (KJS::InterpreterImp::InterpreterImp): Replace use of InterpreterMap
2695         class with an appropriate HashMap.
2696         (KJS::InterpreterImp::clear): ditto
2697         (KJS::InterpreterImp::interpreterWithGlobalObject): ditto
2698         * kjs/interpreter_map.cpp: Removed.
2699         * kjs/interpreter_map.h: Removed.
2700
2701         The HashMap/HashSet code (copied and slightly tweaked from WebCore)
2702         
2703         * kxmlcore/HashFunctions.h: Added.
2704         (KXMLCore::4):
2705         (KXMLCore::8):
2706         (KXMLCore::):
2707         (KXMLCore::PointerHash::hash):
2708         (KXMLCore::PointerHash::equal):
2709         * kxmlcore/HashMap.h: Added.
2710         (KXMLCore::extractFirst):
2711         (KXMLCore::HashMap::HashMap):
2712         (KXMLCore::::size):
2713         (KXMLCore::::capacity):
2714         (KXMLCore::::isEmpty):
2715         (KXMLCore::::begin):
2716         (KXMLCore::::end):
2717         (KXMLCore::::find):
2718         (KXMLCore::::contains):
2719         (KXMLCore::::set):
2720         (KXMLCore::::get):
2721         (KXMLCore::::remove):
2722         (KXMLCore::::clear):
2723         (KXMLCore::deleteAllValues):
2724         * kxmlcore/HashMapPtrSpec.h: Added.
2725         (KXMLCore::PointerHashIteratorAdapter::PointerHashIteratorAdapter):
2726         (KXMLCore::PointerHashIteratorAdapter::operator*):
2727         (KXMLCore::PointerHashIteratorAdapter::operator->):
2728         (KXMLCore::PointerHashIteratorAdapter::operator++):
2729         (KXMLCore::PointerHashIteratorAdapter::operator==):
2730         (KXMLCore::PointerHashIteratorAdapter::operator!=):
2731         (KXMLCore::PointerHashConstIteratorAdapter::PointerHashConstIteratorAdapter):
2732         (KXMLCore::PointerHashConstIteratorAdapter::operator*):
2733         (KXMLCore::PointerHashConstIteratorAdapter::operator->):
2734         (KXMLCore::PointerHashConstIteratorAdapter::operator++):
2735         (KXMLCore::PointerHashConstIteratorAdapter::operator==):
2736         (KXMLCore::PointerHashConstIteratorAdapter::operator!=):
2737         (KXMLCore::):
2738         * kxmlcore/HashSet.h: Added.
2739         (KXMLCore::identityExtract):
2740         (KXMLCore::convertAdapter):
2741         (KXMLCore::HashSet::HashSet):
2742         (KXMLCore::::size):
2743         (KXMLCore::::capacity):
2744         (KXMLCore::::isEmpty):
2745         (KXMLCore::::begin):
2746         (KXMLCore::::end):
2747         (KXMLCore::::find):
2748         (KXMLCore::::contains):
2749         (KXMLCore::::insert):
2750         (KXMLCore::::remove):
2751         (KXMLCore::::clear):
2752         * kxmlcore/HashTable.cpp: Added.
2753         (KXMLCore::HashTableStats::~HashTableStats):
2754         (KXMLCore::HashTableStats::recordCollisionAtCount):
2755         * kxmlcore/HashTable.h: Added.
2756         (KXMLCore::HashTableIterator::skipEmptyBuckets):
2757         (KXMLCore::HashTableIterator::HashTableIterator):
2758         (KXMLCore::HashTableIterator::operator*):
2759         (KXMLCore::HashTableIterator::operator->):
2760         (KXMLCore::HashTableIterator::operator++):
2761         (KXMLCore::HashTableIterator::operator==):
2762         (KXMLCore::HashTableIterator::operator!=):
2763         (KXMLCore::HashTableConstIterator::HashTableConstIterator):
2764         (KXMLCore::HashTableConstIterator::operator*):
2765         (KXMLCore::HashTableConstIterator::operator->):
2766         (KXMLCore::HashTableConstIterator::skipEmptyBuckets):
2767         (KXMLCore::HashTableConstIterator::operator++):
2768         (KXMLCore::HashTableConstIterator::operator==):
2769         (KXMLCore::HashTableConstIterator::operator!=):
2770         (KXMLCore::HashTable::HashTable):
2771         (KXMLCore::HashTable::~HashTable):
2772         (KXMLCore::HashTable::begin):
2773         (KXMLCore::HashTable::end):
2774         (KXMLCore::HashTable::size):
2775         (KXMLCore::HashTable::capacity):
2776         (KXMLCore::HashTable::insert):
2777         (KXMLCore::HashTable::isEmptyBucket):
2778         (KXMLCore::HashTable::isDeletedBucket):
2779         (KXMLCore::HashTable::isEmptyOrDeletedBucket):
2780         (KXMLCore::HashTable::hash):
2781         (KXMLCore::HashTable::equal):
2782         (KXMLCore::HashTable::identityConvert):
2783         (KXMLCore::HashTable::extractKey):
2784         (KXMLCore::HashTable::lookup):
2785         (KXMLCore::HashTable::shouldExpand):
2786         (KXMLCore::HashTable::mustRehashInPlace):
2787         (KXMLCore::HashTable::shouldShrink):
2788         (KXMLCore::HashTable::shrink):
2789         (KXMLCore::HashTable::clearBucket):
2790         (KXMLCore::HashTable::deleteBucket):
2791         (KXMLCore::HashTable::makeLookupResult):
2792         (KXMLCore::HashTable::makeIterator):
2793         (KXMLCore::HashTable::makeConstIterator):
2794         (KXMLCore::::lookup):
2795         (KXMLCore::::insert):
2796         (KXMLCore::::reinsert):
2797         (KXMLCore::::find):
2798         (KXMLCore::::contains):
2799         (KXMLCore::::remove):
2800         (KXMLCore::::allocateTable):
2801         (KXMLCore::::expand):
2802         (KXMLCore::::rehash):
2803         (KXMLCore::::clear):
2804         (KXMLCore::::HashTable):
2805         (KXMLCore::::swap):
2806         (KXMLCore::::operator):
2807         (KXMLCore::::checkTableConsistency):
2808         (KXMLCore::::checkTableConsistencyExceptSize):
2809         * kxmlcore/HashTraits.h: Added.
2810         (KXMLCore::HashTraits::emptyValue):
2811         (KXMLCore::):
2812         (KXMLCore::PairHashTraits::emptyValue):
2813         (KXMLCore::PairHashTraits::deletedValue):
2814
2815 2005-09-27  Darin Adler  <darin@apple.com>
2816
2817         Reviewed by Maciej.
2818
2819         - update grammar to fix conflicts; fixes one of our test cases
2820           because it resolves the relationship between function expressions
2821           and declarations in the way required by the ECMA specification
2822
2823         * kjs/grammar.y: Added lots of new grammar rules so we have no conflicts.
2824         A new set of rules for "no bracket or function at start of expression" and
2825         another set of rules for "no in anywhere in expression". Also simplified the
2826         handling of try to use only a single node and used operator precedence to
2827         get rid of the conflict in handling of if and else. Also used a macro to
2828         streamline the handling of automatic semicolons and changed parenthesis
2829         handling to use a virtual function.
2830
2831         * kjs/nodes.h: Added nodeInsideAllParens, removed unused abortStatement.
2832         (KJS::TryNode::TryNode): Updated to hold catch and finally blocks directly instead
2833         of using a special node for each.
2834         * kjs/nodes.cpp:
2835         (Node::createErrorCompletion): Added. Used instead of throwError when creating errors
2836         that should not be in a completion rather than an ExecState.
2837         (Node::throwUndefinedVariableError): Added. Sets source location unlike the call it
2838         replaces.
2839         (Node::nodeInsideAllParens): Added.
2840         (GroupNode::nodeInsideAllParens): Added.
2841         (StatListNode::execute): Removed code to move exceptions into completion objects;
2842         that's now done solely by the KJS_CHECKEXCEPTION macro.
2843         (TryNode::execute): Include execution of catch and finally here rather than using
2844         separate nodes.
2845         (FuncDeclNode::execute): Moved here, no longer inline.
2846         * kjs/nodes2string.cpp:
2847         (TryNode::streamTo): Updated for change.
2848         (FuncDeclNode::streamTo): Ditto.
2849         (FuncExprNode::streamTo): Ditto.
2850
2851         * kjs/kjs-test: Removed. Was part of "make check".
2852         * kjs/kjs-test.chk: Ditto.
2853         * kjs/test.js: Ditto.
2854
2855         * tests/mozilla/expected.html: Updated because one more test succeeds.
2856
2857 2005-09-27  Adele Peterson  <adele@apple.com>
2858
2859         Reviewed by Maciej.
2860
2861         Changed ints to size_t where appropriate.
2862
2863         * kjs/collector.cpp:
2864         (KJS::Collector::allocate):
2865         (KJS::Collector::markStackObjectsConservatively):
2866         (KJS::Collector::collect):
2867         (KJS::Collector::size):
2868         (KJS::Collector::numInterpreters):
2869         (KJS::Collector::numGCNotAllowedObjects):
2870         (KJS::Collector::numReferencedObjects):
2871         * kjs/collector.h:
2872
2873 2005-09-27  Eric Seidel  <eseidel@apple.com>
2874
2875         Reviewed by kevin.
2876
2877         * JavaScriptCore.xcodeproj/project.pbxproj: fix after malloc changes.
2878
2879 2005-09-27  Eric Seidel  <eseidel@apple.com>
2880
2881         Reviewed by mjs.
2882
2883         * kjs/nodes.cpp:
2884         (FuncExprNode::evaluate): Now sets .constructor properly.
2885         Test cases added to WebCore/layout-tests.
2886         http://bugzilla.opendarwin.org/show_bug.cgi?id=3537
2887
2888 2005-09-26  Maciej Stachowiak  <mjs@apple.com>
2889
2890         Reviewed by John.
2891
2892         - replace dlmalloc with tcmalloc
2893         http://bugzilla.opendarwin.org/show_bug.cgi?id=5145
2894
2895         I also moved SharedPtr and the assertion code from WebCore into a
2896         new kxmlcore directory.
2897         
2898         * JavaScriptCore.xcodeproj/project.pbxproj:
2899         * kjs/collector.cpp:
2900         (KJS::Collector::allocate):
2901         (KJS::Collector::collect):
2902         * kjs/config.h:
2903         * kjs/fast_malloc.cpp: Removed.
2904         * kjs/fast_malloc.h: Removed.
2905         * kjs/function.cpp:
2906         * kjs/function.h:
2907         * kjs/function_object.cpp:
2908         * kjs/identifier.cpp:
2909         (KJS::Identifier::add):
2910         * kjs/internal.cpp:
2911         * kjs/internal.h:
2912         * kjs/nodes.h:
2913         * kjs/nodes2string.cpp:
2914         * kjs/property_map.cpp:
2915         (KJS::PropertyMap::~PropertyMap):
2916         (KJS::PropertyMap::rehash):
2917         * kjs/scope_chain.h:
2918         * kjs/shared_ptr.h: Removed.
2919         * kjs/string_object.cpp:
2920         (StringObjectFuncImp::callAsFunction):
2921         * kjs/ustring.cpp:
2922         (KJS::UString::Rep::createCopying):
2923         (KJS::UString::Rep::destroy):
2924         (KJS::UString::expandCapacity):
2925         (KJS::UString::expandPreCapacity):
2926         (KJS::UString::UString):
2927         (KJS::UString::spliceSubstringsWithSeparators):
2928         (KJS::UString::append):
2929         (KJS::UString::operator=):
2930         (KJS::UString::detach):
2931         * kjs/ustring.h:
2932         * kxmlcore/Assertions.h: Added.
2933         * kxmlcore/Assertions.mm: Added.
2934         * kxmlcore/FastMalloc.cpp: Added.
2935         (KXMLCore::LgFloor):
2936         (KXMLCore::SizeClass):
2937         (KXMLCore::ByteSizeForClass):
2938         (KXMLCore::InitSizeClasses):
2939         (KXMLCore::MetaDataAlloc):
2940         (KXMLCore::PageHeapAllocator::Init):
2941         (KXMLCore::PageHeapAllocator::New):
2942         (KXMLCore::PageHeapAllocator::Delete):
2943         (KXMLCore::PageHeapAllocator::inuse):
2944         (KXMLCore::pages):
2945         (KXMLCore::AllocationSize):
2946         (KXMLCore::Event):
2947         (KXMLCore::NewSpan):
2948         (KXMLCore::DeleteSpan):
2949         (KXMLCore::DLL_Init):
2950         (KXMLCore::DLL_Remove):
2951         (KXMLCore::DLL_IsEmpty):
2952         (KXMLCore::DLL_Length):
2953         (KXMLCore::DLL_Print):
2954         (KXMLCore::DLL_Prepend):
2955         (KXMLCore::DLL_InsertOrdered):
2956         (KXMLCore::):
2957         (KXMLCore::TCMalloc_PageHeap::GetDescriptor):
2958         (KXMLCore::TCMalloc_PageHeap::SystemBytes):
2959         (KXMLCore::TCMalloc_PageHeap::FreeBytes):
2960         (KXMLCore::TCMalloc_PageHeap::RecordSpan):
2961         (KXMLCore::TCMalloc_PageHeap::TCMalloc_PageHeap):
2962         (KXMLCore::TCMalloc_PageHeap::New):
2963         (KXMLCore::TCMalloc_PageHeap::Split):
2964         (KXMLCore::TCMalloc_PageHeap::Carve):
2965         (KXMLCore::TCMalloc_PageHeap::Delete):
2966         (KXMLCore::TCMalloc_PageHeap::RegisterSizeClass):
2967         (KXMLCore::TCMalloc_PageHeap::Dump):
2968         (KXMLCore::TCMalloc_PageHeap::GrowHeap):
2969         (KXMLCore::TCMalloc_PageHeap::Check):
2970         (KXMLCore::TCMalloc_PageHeap::CheckList):
2971         (KXMLCore::TCMalloc_ThreadCache_FreeList::Init):
2972         (KXMLCore::TCMalloc_ThreadCache_FreeList::length):
2973         (KXMLCore::TCMalloc_ThreadCache_FreeList::empty):
2974         (KXMLCore::TCMalloc_ThreadCache_FreeList::lowwatermark):
2975         (KXMLCore::TCMalloc_ThreadCache_FreeList::clear_lowwatermark):
2976         (KXMLCore::TCMalloc_ThreadCache_FreeList::Push):
2977         (KXMLCore::TCMalloc_ThreadCache_FreeList::Pop):
2978         (KXMLCore::TCMalloc_ThreadCache::freelist_length):
2979         (KXMLCore::TCMalloc_ThreadCache::Size):
2980         (KXMLCore::TCMalloc_Central_FreeList::length):
2981         (KXMLCore::TCMalloc_Central_FreeList::Init):
2982         (KXMLCore::TCMalloc_Central_FreeList::Insert):
2983         (KXMLCore::TCMalloc_Central_FreeList::Remove):
2984         (KXMLCore::TCMalloc_Central_FreeList::Populate):
2985         (KXMLCore::TCMalloc_ThreadCache::SampleAllocation):
2986         (KXMLCore::TCMalloc_ThreadCache::Init):
2987         (KXMLCore::TCMalloc_ThreadCache::Cleanup):
2988         (KXMLCore::TCMalloc_ThreadCache::Allocate):
2989         (KXMLCore::TCMalloc_ThreadCache::Deallocate):
2990         (KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
2991         (KXMLCore::TCMalloc_ThreadCache::ReleaseToCentralCache):
2992         (KXMLCore::TCMalloc_ThreadCache::Scavenge):
2993         (KXMLCore::TCMalloc_ThreadCache::GetCache):
2994         (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
2995         (KXMLCore::TCMalloc_ThreadCache::PickNextSample):
2996         (KXMLCore::TCMalloc_ThreadCache::InitModule):
2997         (KXMLCore::TCMalloc_ThreadCache::InitTSD):
2998         (KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2999         (KXMLCore::TCMalloc_ThreadCache::DeleteCache):
3000         (KXMLCore::TCMalloc_ThreadCache::RecomputeThreadCacheSize):
3001         (KXMLCore::TCMalloc_ThreadCache::Print):
3002         (KXMLCore::ExtractStats):
3003         (KXMLCore::DumpStats):
3004         (KXMLCore::PrintStats):
3005         (KXMLCore::DumpStackTraces):
3006         (KXMLCore::TCMallocImplementation::GetStats):
3007         (KXMLCore::TCMallocImplementation::ReadStackTraces):
3008         (KXMLCore::TCMallocImplementation::GetNumericProperty):
3009         (KXMLCore::TCMallocImplementation::SetNumericProperty):
3010         (KXMLCore::DoSampledAllocation):
3011         (KXMLCore::do_malloc):
3012         (KXMLCore::do_free):
3013         (KXMLCore::do_memalign):
3014         (KXMLCore::TCMallocGuard::TCMallocGuard):
3015         (KXMLCore::TCMallocGuard::~TCMallocGuard):
3016         (KXMLCore::malloc):
3017         (KXMLCore::free):
3018         (KXMLCore::calloc):
3019         (KXMLCore::cfree):
3020         (KXMLCore::realloc):
3021         (KXMLCore::memalign):
3022         (KXMLCore::posix_memalign):
3023         (KXMLCore::valloc):
3024         (KXMLCore::pvalloc):
3025         (KXMLCore::malloc_stats):
3026         (KXMLCore::mallopt):
3027         (KXMLCore::mallinfo):
3028         * kxmlcore/FastMalloc.h: Added.
3029         (KXMLCore::FastAllocated::operator new):
3030         (KXMLCore::FastAllocated::operator delete):
3031         (KXMLCore::FastAllocated::operator new[]):
3032         (KXMLCore::FastAllocated::operator delete[]):
3033         * kxmlcore/SharedPtr.h: Added.
3034         (KXMLCore::SharedPtr::SharedPtr):
3035         (KXMLCore::SharedPtr::~SharedPtr):
3036         (KXMLCore::SharedPtr::isNull):
3037         (KXMLCore::SharedPtr::notNull):
3038         (KXMLCore::SharedPtr::reset):
3039         (KXMLCore::SharedPtr::get):
3040         (KXMLCore::SharedPtr::operator*):
3041         (KXMLCore::SharedPtr::operator->):
3042         (KXMLCore::SharedPtr::operator!):
3043         (KXMLCore::SharedPtr::operator bool):
3044         (KXMLCore::::operator):
3045         (KXMLCore::operator==):
3046         (KXMLCore::operator!=):
3047         (KXMLCore::static_pointer_cast):
3048         (KXMLCore::const_pointer_cast):
3049         * kxmlcore/TCPageMap.h: Added.
3050         (TCMalloc_PageMap1::TCMalloc_PageMap1):
3051         (TCMalloc_PageMap1::Ensure):
3052         (TCMalloc_PageMap1::get):
3053         (TCMalloc_PageMap1::set):
3054         (TCMalloc_PageMap2::TCMalloc_PageMap2):
3055         (TCMalloc_PageMap2::get):
3056         (TCMalloc_PageMap2::set):
3057         (TCMalloc_PageMap2::Ensure):
3058         (TCMalloc_PageMap3::NewNode):
3059         (TCMalloc_PageMap3::TCMalloc_PageMap3):
3060         (TCMalloc_PageMap3::get):
3061         (TCMalloc_PageMap3::set):
3062         (TCMalloc_PageMap3::Ensure):
3063         * kxmlcore/TCSpinLock.h: Added.
3064         (TCMalloc_SpinLock::Init):
3065         (TCMalloc_SpinLock::Finalize):
3066         (TCMalloc_SpinLock::Lock):
3067         (TCMalloc_SpinLock::Unlock):
3068         (TCMalloc_SlowLock):
3069         (TCMalloc_SpinLockHolder::TCMalloc_SpinLockHolder):
3070         (TCMalloc_SpinLockHolder::~TCMalloc_SpinLockHolder):
3071         * kxmlcore/TCSystemAlloc.cpp: Added.
3072         (TrySbrk):
3073         (TryMmap):
3074         (TryDevMem):
3075         (TCMalloc_SystemAlloc):
3076         * kxmlcore/TCSystemAlloc.h: Added.
3077
3078 2005-09-23  Maciej Stachowiak  <mjs@apple.com>
3079
3080         Reviewed by Darin.
3081
3082         <rdar://problem/4260479> Finish deploying PropertySlot in the interpreter
3083         http://bugzilla.opendarwin.org/show_bug.cgi?id=5112
3084         
3085         Convert postfix, prefix, delete, prefix, and for..in expressions to use
3086         PropertySlot-based lookup instead of evaluateReference.
3087
3088         3% speedup on JS iBench.
3089
3090         Fixed two of the JS tests:
3091         * tests/mozilla/expected.html:
3092
3093         * kjs/grammar.y:
3094         * kjs/nodes.cpp:
3095         (PostfixResolveNode::evaluate):
3096         (PostfixBracketNode::evaluate):
3097         (PostfixDotNode::evaluate):
3098         (DeleteResolveNode::evaluate):
3099         (DeleteBracketNode::evaluate):
3100         (DeleteDotNode::evaluate):
3101         (DeleteValueNode::evaluate):
3102         (typeStringForValue):
3103         (TypeOfResolveNode::evaluate):
3104         (TypeOfValueNode::evaluate):
3105         (PrefixResolveNode::evaluate):
3106         (PrefixBracketNode::evaluate):
3107         (PrefixDotNode::evaluate):
3108         (ForInNode::execute):
3109         * kjs/nodes.h:
3110         (KJS::PostfixResolveNode::PostfixResolveNode):
3111         (KJS::PostfixBracketNode::PostfixBracketNode):
3112         (KJS::PostfixDotNode::PostfixDotNode):
3113         (KJS::DeleteResolveNode::DeleteResolveNode):
3114         (KJS::DeleteBracketNode::DeleteBracketNode):
3115         (KJS::DeleteDotNode::DeleteDotNode):
3116         (KJS::DeleteValueNode::DeleteValueNode):
3117         (KJS::TypeOfResolveNode::TypeOfResolveNode):
3118         (KJS::TypeOfValueNode::TypeOfValueNode):
3119         (KJS::PrefixResolveNode::PrefixResolveNode):
3120         (KJS::PrefixBracketNode::PrefixBracketNode):
3121         (KJS::PrefixDotNode::PrefixDotNode):
3122         * kjs/nodes2string.cpp:
3123         (PostfixResolveNode::streamTo):
3124         (PostfixBracketNode::streamTo):
3125         (PostfixDotNode::streamTo):
3126         (DeleteResolveNode::streamTo):
3127         (DeleteBracketNode::streamTo):
3128         (DeleteDotNode::streamTo):
3129         (DeleteValueNode::streamTo):
3130         (TypeOfValueNode::streamTo):
3131         (TypeOfResolveNode::streamTo):
3132         (PrefixResolveNode::streamTo):
3133         (PrefixBracketNode::streamTo):
3134         (PrefixDotNode::streamTo):
3135         * kjs/reference.cpp:
3136         (KJS::Reference::Reference):
3137         (KJS::Reference::getPropertyName):
3138         (KJS::Reference::getValue):
3139         (KJS::Reference::deleteValue):
3140         * kjs/reference.h:
3141
3142 2005-09-23  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
3143
3144         Reviewed and landed by Darin.
3145
3146         - a Windows-specific file
3147
3148         * os-win32/stdint.h: Added. We plan to remove dependency on the <stdint.h> types,
3149         and if we do so, we will remove this file.
3150
3151 2005-09-22  Geoffrey Garen  <ggaren@apple.com>
3152
3153         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5053
3154         Need to restore int/long changes to simple_number.h
3155         
3156         Reviewed by darin and mjs.
3157
3158         * kjs/simple_number.h: changed enums to indenpendent constants to clarify types
3159         (KJS::isNegativeZero): changed to static function - no reason to export
3160         (KJS::SimpleNumber::rightShiftSignExtended): new function for clarity
3161         (KJS::SimpleNumber::make): specified cast as reinterpret_cast
3162         (KJS::SimpleNumber::is): changed to use uintptr_t for portability
3163         (KJS::SimpleNumber::value): changed to use uintptr_t and rightShiftSignExtended
3164         (KJS::SimpleNumber::fits): inverted tests - probably only a performance win for double
3165         (KJS::SimpleNumber::integerFits): ditto
3166
3167 2005-09-20  Maciej Stachowiak  <mjs@apple.com>
3168
3169         Reviewed by Geoff and partly by Darin.
3170
3171         - fixed http://bugzilla.opendarwin.org/post_bug.cgi
3172         (Reduce conflicts in JavaScriptCore grammar)
3173
3174         This change gets us down from over 200 shift/reduce and 45 reduce/reduce to
3175         9 shift/reduce and 45 reduce/reduce.
3176
3177         * kjs/grammar.y:
3178         * kjs/grammar_types.h: Removed.
3179         * kjs/lexer.cpp:
3180         * kjs/nodes.h:
3181         (KJS::Node::isGroupNode):
3182         (KJS::Node::isLocation):
3183         (KJS::Node::isResolveNode):
3184         (KJS::Node::isBracketAccessorNode):
3185         (KJS::Node::isDotAccessorNode):
3186         (KJS::ResolveNode::isLocation):
3187         (KJS::ResolveNode::isResolveNode):
3188         (KJS::ResolveNode::identifier):
3189         (KJS::GroupNode::isGroupNode):
3190         (KJS::GroupNode::leafNode):
3191         (KJS::BracketAccessorNode::isLocation):
3192         (KJS::BracketAccessorNode::isBracketAccessorNode):
3193         (KJS::BracketAccessorNode::base):
3194         (KJS::BracketAccessorNode::subscript):
3195         (KJS::DotAccessorNode::isLocation):
3196         (KJS::DotAccessorNode::isDotAccessorNode):
3197         (KJS::DotAccessorNode::base):
3198         (KJS::DotAccessorNode::identifier):
3199         (KJS::FuncExprNode::FuncExprNode):
3200         (KJS::FuncExprNode::identifier):
3201         (KJS::FuncDeclNode::FuncDeclNode):
3202         (KJS::FuncDeclNode::execute):
3203
3204 2005-09-20  Geoffrey Garen  <ggaren@apple.com>
3205
3206         - Oops. The 4263434 change was only appropriate on the branch. Rolling out.
3207         
3208         Reviewed by eric.
3209         
3210         * kjs/internal.cpp:
3211         (KJS::InterpreterImp::mark):
3212
3213 2005-09-20  Geoffrey Garen  <ggaren@apple.com>
3214
3215         - More changes needed to fix <rdar://problem/4214783> 8F29 REGRESSION(Denver/Chardonnay):
3216           kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in
3217           the installer)
3218           
3219         Added InterpreterLocks in some places in the bindings we missed before.
3220         
3221         Reviewed by john.
3222
3223         * bindings/runtime_root.cpp:
3224         (KJS::Bindings::addNativeReference):
3225         (KJS::Bindings::removeNativeReference):
3226         (RootObject::removeAllNativeReferences):
3227         * bindings/runtime_root.h:
3228         (KJS::Bindings::RootObject::~RootObject):
3229         (KJS::Bindings::RootObject::setRootObjectImp):
3230
3231 2005-09-20  Geoffrey Garen  <ggaren@apple.com>
3232
3233         - Fixed <rdar://problem/4263434> <rdar://problem/4263434> Denver 8F29 Regression:
3234           KJS::InterpreterImp::mark() crash
3235           
3236         Fix by mjs, review by me.
3237
3238         * kjs/internal.cpp:
3239         (KJS::InterpreterImp::mark): Added a null check on globExec in case a
3240         garbage collection occurs inside InterpreterImp::globalInit (called
3241         from InterpreterImp::InterpreterImp), at which point globExec has not yet been initialized.
3242
3243 2005-09-20  Geoffrey Garen  <ggaren@apple.com>
3244
3245         - Rolled in fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=4892
3246           Date constructor has problems with months larger than 11
3247
3248         Test cases added:
3249
3250         * layout-tests/fast/js/date-big-constructor-expected.txt: Added.
3251         * layout-tests/fast/js/date-big-constructor.html: Added.
3252
3253         Reviewed by darin.
3254
3255         * kjs/date_object.cpp:
3256         (KJS::fillStructuresUsingDateArgs):
3257         (KJS::makeTime):
3258
3259 2005-09-19  Geoffrey Garen  <ggaren@apple.com>
3260
3261         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5028
3262           9 layout tests fail following the change from long to int
3263           
3264         - Rolled out changes to simple_number.h, and added fits(long long) 
3265           and SimpleNumber::fits(unsigned long long) to the old system.
3266         
3267         Reviewed by mjs.
3268
3269         * kjs/simple_number.h:
3270         (KJS::SimpleNumber::):
3271         (KJS::SimpleNumber::value):
3272         (KJS::SimpleNumber::fits):
3273         (KJS::SimpleNumber::integerFits):
3274         (KJS::SimpleNumber::make):
3275
3276 2005-09-14  Maciej Stachowiak  <mjs@apple.com>
3277
3278         Reviewed by Geoff.
3279
3280         - fixed <rdar://problem/4214783> REGRESSION: kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in the installer)
3281
3282         Make sure to lock using the InterpreterLock class in all places that need it
3283         (including anything that uses the collector, the parser, the protect count hash table,
3284         and anything that allocates via fast_malloc).
3285
3286         Also added assertions to ensure that the locking rules are followed for the relevant
3287         resources.
3288
3289         * Makefile.am:
3290         * bindings/NP_jsobject.cpp:
3291         (identifierFromNPIdentifier):
3292         (_NPN_Invoke):
3293         (_NPN_Evaluate):
3294         (_NPN_GetProperty):
3295         (_NPN_SetProperty):
3296         (_NPN_RemoveProperty):
3297         (_NPN_HasProperty):
3298         (_NPN_HasMethod):
3299         (_NPN_SetException):
3300         * bindings/jni/jni_jsobject.cpp:
3301         (JSObject::call):
3302         (JSObject::eval):
3303         (JSObject::getMember):
3304         (JSObject::setMember):
3305         (JSObject::removeMember):
3306         (JSObject::getSlot):
3307         (JSObject::setSlot):
3308         (JSObject::toString):
3309         (JSObject::convertJObjectToValue):
3310         * bindings/objc/WebScriptObject.mm:
3311         (-[WebScriptObject callWebScriptMethod:withArguments:]):
3312         (-[WebScriptObject evaluateWebScript:]):
3313         (-[WebScriptObject setValue:forKey:]):
3314         (-[WebScriptObject valueForKey:]):
3315         (-[WebScriptObject removeWebScriptKey:]):
3316         (-[WebScriptObject stringRepresentation]):
3317         (-[WebScriptObject webScriptValueAtIndex:]):
3318         (-[WebScriptObject setWebScriptValueAtIndex:value:]):
3319         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
3320         * bindings/runtime.cpp:
3321         (Instance::createRuntimeObject):
3322         * bindings/runtime_root.h:
3323         * bindings/testbindings.cpp:
3324         (main):
3325         * bindings/testbindings.mm:
3326         (main):
3327         * kjs/fast_malloc.cpp:
3328         (KJS::kjs_fast_malloc):
3329         (KJS::kjs_fast_calloc):
3330         (KJS::kjs_fast_free):
3331         (KJS::kjs_fast_realloc):
3332         * kjs/fast_malloc.h:
3333         * kjs/identifier.h:
3334         * kjs/internal.cpp:
3335         (InterpreterImp::InterpreterImp):
3336         (InterpreterImp::clear):
3337         (InterpreterImp::mark):
3338         (InterpreterImp::checkSyntax):
3339         (InterpreterImp::evaluate):
3340         * kjs/internal.h:
3341         (KJS::InterpreterImp::globalObject):
3342         * kjs/interpreter.cpp:
3343         (Interpreter::evaluate):
3344         * kjs/interpreter.h:
3345         (KJS::InterpreterLock::InterpreterLock):
3346         (KJS::InterpreterLock::~InterpreterLock):
3347         * kjs/nodes.h:
3348         * kjs/protect.h:
3349         (KJS::ProtectedValue::ProtectedValue):
3350         (KJS::ProtectedValue::~ProtectedValue):
3351         (KJS::ProtectedValue::operator=):
3352         (KJS::ProtectedObject::ProtectedObject):
3353         (KJS::ProtectedObject::~ProtectedObject):
3354         (KJS::ProtectedObject::operator=):
3355         (KJS::ProtectedReference::ProtectedReference):
3356         (KJS::ProtectedReference::~ProtectedReference):
3357         (KJS::ProtectedReference::operator=):
3358         * kjs/protected_object.h:
3359         * kjs/protected_values.cpp:
3360         (KJS::ProtectedValues::getProtectCount):
3361         (KJS::ProtectedValues::increaseProtectCount):
3362         (KJS::ProtectedValues::decreaseProtectCount):
3363         * kjs/string_object.cpp:
3364         (StringObjectImp::StringObjectImp):
3365         * kjs/testkjs.cpp:
3366         (main):
3367
3368 2005-09-16  Adele Peterson  <adele@apple.com>
3369
3370         Change by Darin, reviewed by me and Maciej.
3371
3372         Fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=4547
3373         use int instead of long for 32-bit (to prepare for LP64 compiling)
3374
3375         * bindings/c/c_class.h:
3376         (KJS::Bindings::CClass::constructorAt):
3377         (KJS::Bindings::CClass::numConstructors):
3378         * bindings/c/c_runtime.h:
3379         (KJS::Bindings::CMethod::numParameters):
3380         * bindings/jni/jni_class.cpp:
3381         (JavaClass::JavaClass):
3382         * bindings/jni/jni_class.h:
3383         (KJS::Bindings::JavaClass::constructorAt):
3384         (KJS::Bindings::JavaClass::numConstructors):
3385         * bindings/jni/jni_instance.cpp:
3386         (JavaInstance::invokeMethod):
3387         * bindings/jni/jni_jsobject.cpp:
3388         (JSObject::convertJObjectToValue):
3389         (JSObject::listFromJArray):
3390         * bindings/jni/jni_runtime.cpp:
3391         (JavaMethod::JavaMethod):
3392         * bindings/jni/jni_runtime.h:
3393         (KJS::Bindings::JavaConstructor::_commonCopy):
3394         (KJS::Bindings::JavaConstructor::parameterAt):
3395         (KJS::Bindings::JavaConstructor::numParameters):
3396         (KJS::Bindings::JavaMethod::_commonCopy):
3397         (KJS::Bindings::JavaMethod::parameterAt):
3398         (KJS::Bindings::JavaMethod::numParameters):
3399         * bindings/npapi.h:
3400         * bindings/objc/WebScriptObject.mm:
3401         (listFromNSArray):
3402         * bindings/objc/objc_class.h:
3403         (KJS::Bindings::ObjcClass::constructorAt):
3404         (KJS::Bindings::ObjcClass::numConstructors):
3405         * bindings/objc/objc_instance.h:
3406         * bindings/objc/objc_runtime.h:
3407         * bindings/objc/objc_runtime.mm:
3408         (ObjcMethod::numParameters):
3409         * bindings/runtime.h:
3410         * kjs/identifier.h:
3411         * kjs/internal.h:
3412         * kjs/property_slot.h:
3413         (KJS::PropertySlot::setCustomIndex):
3414         (KJS::PropertySlot::index):
3415         (KJS::PropertySlot::):
3416         * kjs/regexp_object.cpp:
3417         (RegExpObjectImp::backrefGetter):
3418         (RegExpObjectImp::getOwnPropertySlot):
3419         * kjs/simple_number.h:
3420         (KJS::SimpleNumber::):
3421         (KJS::SimpleNumber::value):
3422         (KJS::SimpleNumber::fits):
3423         (KJS::SimpleNumber::integerFits):
3424         (KJS::SimpleNumber::make):
3425         * kjs/string_object.cpp:
3426         (substituteBackreferences):
3427         * kjs/ustring.cpp:
3428         (KJS::UString::from):
3429         (KJS::UString::toUInt32):
3430         (KJS::UString::find):
3431         (KJS::UString::rfind):
3432         * kjs/ustring.h:
3433         * kjs/value.cpp:
3434         (KJS::jsNumber):
3435         * kjs/value.h:
3436
3437 2005-09-11  Eric Seidel  <eseidel@apple.com>
3438
3439         No review requested, build fix affects only SVG.
3440
3441         * JavaScriptCore.xcodeproj/project.pbxproj: Fixed JSC+SVG
3442         Fixed JavaScriptCore+SVG after PCRE 6.1 merger.
3443         http://bugzilla.opendarwin.org/show_bug.cgi?id=4932
3444
3445 2005-09-10  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
3446
3447         Reviewed and landed by Darin.
3448
3449         * Makefile.vc: Added.
3450         * README-Win32.txt: Added.
3451
3452 2005-09-10  Darin Adler  <darin@apple.com>
3453
3454         - fixed compilation for WebCore (another try)
3455
3456         * kjs/simple_number.h: Added more "using" lines.
3457
3458 2005-09-10  Darin Adler  <darin@apple.com>
3459
3460         - fixed compilation for WebCore
3461
3462         * kjs/simple_number.h: Have to include <cmath> here to work around a bug in the GCC
3463         standard C++ library headers.
3464
3465 2005-09-10  Darin Adler  <darin@apple.com>
3466
3467         Windows changes by Krzysztof Kowalczyk <kkowalczyk@gmail.com>.
3468
3469         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4870
3470           win portability: fix IS_NEGATIVE_ZERO macro in simple_number.h
3471
3472         * kjs/simple_number.h:
3473         (KJS::isNegativeZero): Added. Inline function. Has a case for Windows that
3474         uses _fpclass and a case for other platforms that uses signbit.
3475         (KJS::SimpleNumber::fits): Use inline isNegativeZero instead of macro IS_NEGATIVE_ZERO.
3476
3477         * kjs/internal.cpp: Remove definition of now-unneeded negZero global.
3478
3479         * kjs/value.cpp: Touched the file because Xcode didn't know it needed to
3480         recompile it.
3481
3482         - improved test engine
3483
3484         * tests/mozilla/jsDriver.pl: Sort tests in numeric order instead of using
3485         a plain-ASCII sort; now test 33 will be after test 5 in any given set of
3486         numbered tests.
3487
3488 2005-09-08  Darin Adler  <darin@apple.com>
3489
3490         - fixed overloaded versions of throwError so that they substitute *all* 
3491           expected parameters into the message string -- some versions used to
3492           skip parameters, resulting in "%s" being printed in the error message.
3493         
3494         Reviewed by Geoff.
3495
3496         * kjs/nodes.h: Updated declarations to use "const &" and not to name parameters
3497         * kjs/nodes.cpp: (Node::throwError): Updated to match above and add one missing
3498         call to substitute.
3499
3500 2005-09-08  Darin Adler  <darin@apple.com>
3501
3502         Reviewed by Geoff.
3503
3504         - updated to PCRE 6.1
3505
3506         The original PCRE 6.1 sources are checked into the tree with the tag
3507         "pcre-6-1" for reference. What we're checking in right now is the original
3508         plus our changes to make it support UTF-16 and at least one other tweak
3509         (vertical tab considered whitespace). Our work to get our changes was
3510         done on "pcre-6-1-branch", with an anchor at "pcre-6-1-anchor" so you can
3511         see the evolution of the UTF-16 changes.
3512         
3513         Note also that there was one small change made here that's not on the branch
3514         in pcre_compile.c.
3515
3516         * Info.plist: Updated the part of the copyright message that's about PCRE.
3517
3518         * JavaScriptCore.xcodeproj/project.pbxproj: Added new PCRE source files,
3519         removed obsolete ones.
3520
3521         * pcre/AUTHORS: Updated to PCRE 6.1. Includes credits for Apple's UTF-16
3522         changes, but not the credits for Google's C++ wrapper, since we don't include that.
3523         * pcre/COPYING: Updated to PCRE 6.1.
3524         * pcre/LICENCE: Ditto.
3525         * pcre/dftables.c: Ditto.
3526         * pcre/pcre-config.h: Ditto.
3527         * pcre/pcre.h: Ditto.
3528
3529         * pcre/pcre_compile.c: Added for PCRE 6.1.
3530         * pcre/pcre_config.c: Ditto.
3531         * pcre/pcre_exec.c: Ditto.
3532         * pcre/pcre_fullinfo.c: Ditto.
3533         * pcre/pcre_get.c: Ditto.
3534         * pcre/pcre_globals.c: Ditto.
3535         * pcre/pcre_info.c: Ditto.
3536         * pcre/pcre_internal.h: Ditto.
3537         * pcre/pcre_maketables.c: Ditto.
3538         * pcre/pcre_ord2utf8.c: Ditto.
3539         * pcre/pcre_printint.c: Ditto.
3540         * pcre/pcre_refcount.c: Ditto.
3541         * pcre/pcre_study.c: Ditto.
3542         * pcre/pcre_tables.c: Ditto.
3543         * pcre/pcre_try_flipped.c: Ditto.
3544         * pcre/pcre_ucp_findchar.c: Ditto.
3545         * pcre/pcre_version.c: Ditto.
3546         * pcre/pcre_xclass.c: Ditto.
3547         * pcre/ucp.h: Ditto.
3548         * pcre/ucp_findchar.c: Ditto.
3549         * pcre/ucpinternal.h: Ditto.
3550         * pcre/ucptable.c: Ditto.
3551
3552         * pcre/get.c: Removed.
3553         * pcre/internal.h: Removed.
3554         * pcre/maketables.c: Removed.
3555         * pcre/pcre.c: Removed.
3556         * pcre/study.c: Removed.
3557
3558 2005-09-07  Geoffrey Garen  <ggaren@apple.com>
3559
3560         -fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4781
3561         Date.setMonth fails with big values due to overflow
3562
3563         Reviewed by darin.
3564
3565         * kjs/date_object.cpp:
3566         (timetUsingCF): for consistency, changed return statement to invalidDate instead of LONG_MAX
3567         (KJS::fillStructuresUsingTimeArgs): modified for readability
3568         (KJS::fillStructuresUsingDateArgs): new function analogous to fillStructuresUsingTimeArgs
3569         (KJS::DateProtoFuncImp::callAsFunction): modified to use fillStructuresUsingDateArgs
3570         (KJS::DateObjectImp::construct): moved variable declaration to proper scope
3571         (KJS::DateObjectFuncImp::callAsFunction): moved variable declaration to proper scope
3572
3573 2005-09-07  Geoffrey Garen  <ggaren@apple.com>
3574         -updated expected test results to reflect fix for 
3575         http://bugzilla.opendarwin.org/show_bug.cgi?id=4698
3576         kjs does not allow named functions in function expressions
3577  
3578         * tests/mozilla/expected.html:
3579
3580 2005-09-04  Darin Adler  <darin@apple.com>
3581
3582         * kjs/identifier.cpp: Fix comment, add missing include.
3583         (Follow-on to changes from yesterday.)
3584
3585 2005-09-03  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
3586
3587         Reviewed, tweaked and landed by Darin.
3588
3589         - another try at some of the Windows compilation fixes
3590           should fix these bugs: 4546, 4831, 4834, 4643, 4830, 4832, 4833, 4835
3591
3592         * kjs/collector.cpp: Add missing <setjmp.h> include.
3593         * kjs/date_object.cpp: Fix broken copysign macro.
3594         * kjs/dtoa.cpp: Move macro definitions down after all header includes.
3595         * kjs/fast_malloc.cpp: Add missing <assert.h> and <stddef.h> includes.
3596         * kjs/function.cpp: Remove broken isxdigit definition.
3597         * kjs/grammar.y: Add a missing semicolon (and remove an excess one).
3598         * kjs/identifier.cpp: Turn off AVOID_STATIC_CONSTRUCTORS because the placement new syntax
3599         doesn't seem to work in Visual C++ (I'm surprised to hear that, by the way).
3600         * kjs/value.h: Made ValueImp's destructor virtual because otherwise pointers to ValueImp
3601         on the stack aren't right for garbage collection on Windows (don't think it works that
3602         way with gcc's virtual table scheme, but it's a harmless change).
3603
3604 2005-09-03  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
3605
3606         Reviewed, tweaked and landed by Darin.
3607
3608         - some Windows compilation fixes, hoping to fix the problems reported in these bugs:
3609           4627, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4639, 4640, 4641, 4644, 4645
3610
3611         * kjs/collector.cpp: Include <windows.h> on WIN32. Put thread-related code inside
3612         KJS_MULTIPLE_THREADS #if directives.
3613         (KJS::Collector::markCurrentThreadConservatively): Use NT_TIB to find the stack base on Win32.
3614
3615         * kjs/config.h: Define HAVE_SYS_TIMEB_H for Win32.
3616
3617         * kjs/date_object.cpp: Add include of <limits.h>. Add definitions of strncasecmp, isfinite, and
3618         copysign for Win32.
3619         (KJS::KRFCDate_parseDate): Move "errno = 0" line down closer to the first call to strol -- I believe
3620         that on Win32 there's some other call before that setting errno.
3621
3622         * kjs/date_object.h: Remove unneeded include of <sys/time.h>.
3623
3624         * kjs/dtoa.cpp: Add an undef of strtod, needed on Win32.
3625
3626         * kjs/fast_malloc.cpp: Put #if !WIN32 around some customization that's not appropriate on Win32.
3627         (KJS::region_list_append): Add a missing cast so this Win32-specific function compiles in C++.
3628         (KJS::sbrk): Change parameter type to match the declaration.
3629
3630         * kjs/function.cpp: (isxdigit): Define a locale-independent isxdigit on Win32.
3631
3632         * kjs/function.h: Remove unneeded friend class Function for FunctionImp.
3633
3634         * kjs/identifier.cpp: Took out the APPLE_CHANGES from around the AVOID_STATIC_CONSTRUCTORS
3635         define. We ultimately intend to phase out APPLE_CHANGES entirely. Also fix the
3636         non-AVOID_STATIC_CONSTRUCTORS code path.
3637
3638         * kjs/internal.cpp: Remove uneeded include of <strings.h>, which was confused with <string.h>!
3639         Add a Win32 implementation of copysign. Put the threads code inside KJS_MULTIPLE_THREADS.
3640
3641         * kjs/internal.h: Define a KJS_MULTIPLE_THREADS macro on non-Win32 only. Later we can make this
3642         specific to Mac OS X if we like.
3643
3644         * kjs/interpreter_map.cpp: Add missing include of <stdlib.h>.
3645
3646         * kjs/list.cpp:
3647         (KJS::ListImp::markValues): Use std::min instead of MIN.
3648         (KJS::List::copy): Ditto.
3649         (KJS::List::copyTail): Ditto.
3650
3651         * kjs/math_object.cpp: (signbit): Add a Win32 implementation of signbit.
3652
3653         * kjs/nodes.cpp: (Node::finalCheck): Use unsigned instead of uint.
3654         Put the use of always_inline inside __GNUC__.
3655
3656         * kjs/number_object.cpp: (NumberProtoFuncImp::callAsFunction): Use "10.0" instead of "10"
3657         inside all the calls to pow to avoid ambiguity caused by overloading of pow on Win32, seen
3658         when passing an int rather than a double or float.
3659
3660         * kjs/operations.cpp:
3661         (KJS::isInf): Add Win32 implementation.
3662         (KJS::isPosInf): Add Win32 implementation.
3663         (KJS::isNegInf): Add Win32 implementation.
3664
3665         * kjs/regexp.cpp: Use unsigned instead of uint.
3666         * kjs/regexp.h: Ditto.
3667         * kjs/regexp_object.cpp: Ditto.
3668         * kjs/regexp_object.h: Ditto.
3669
3670 2005-09-02  Beth Dakin  <bdakin@apple.com>
3671
3672         Fix for <rdar://problem/4235531> Denver Regression: Safari crash in KWQStringData::makeUnicode
3673         The other half of the fix is in WebCore.
3674
3675         Fix written by Maciej and Darin.
3676         Reviewed by me/Maciej
3677
3678         As Maciej said in Radar: These problems was caused by a conflict between some of our custom 
3679         allocators, causing them to return null. Symptom is typically a null pointer dereference in 
3680         a place where it might be expected an allocation has just occurred.
3681
3682         * kjs/fast_malloc.cpp:  Added #define for MORECORE_CONTIGUOUS, MORECORE_CANNOT_TRIM, 
3683                                 and MALLOC_FAILURE_ACTION.
3684
3685 2005-08-31  Geoffrey Garen  <ggaren@apple.com>
3686
3687         -rolled in fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=4698
3688         kjs does not allow named functions in function expressions
3689         
3690         Fix by Arthur Langereis.
3691         
3692         Reviewed by darin.
3693         
3694         * kjs/grammar.y:
3695         * kjs/nodes.cpp:
3696         (FuncExprNode::evaluate):
3697         * kjs/nodes.h:
3698         (KJS::FuncExprNode::FuncExprNode):
3699
3700         Test cases added:
3701
3702         * layout-tests/fast/js/named-function-expression-expected.txt: Added.
3703         * layout-tests/fast/js/named-function-expression.html: Added.
3704         
3705 2005-08-31  Justin Haygood  <justin@xiondigital.net>
3706
3707         Reviewed, tweaked, and landed by Darin.
3708
3709         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4085
3710         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4087
3711         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4096
3712           Some fixes for compiling on windows.
3713
3714         * kjs/config.h: Added a WIN32 case in here, with suitable defines.
3715         (To be tweaked as necessary.)
3716         * kjs/function.cpp: Took out APPLE_CHANGES around use of ICU.
3717         * kjs/operations.cpp: Removed some bogus code that always set HAVE_FLOAT_H.
3718
3719 2005-08-30  Darin Adler  <darin@apple.com>
3720
3721         Reviewed by John Sullivan.
3722
3723         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4758
3724           unify SharedPtr in WebCore and JavaScriptCore
3725
3726         * kjs/shared_ptr.h: Updated namespace to KXMLCore instead of kxhmlcore.
3727         Made a few small improvements to use local variables a bit more and added
3728         an "operator int" to reduce the chance that we'll convert a SharedPtr to
3729         an int by accident. Also made the == operators normal functions rather than
3730         friend functions, added a couple of comemnts.
3731
3732         * kjs/function.h: Updated for namespace change.
3733         * kjs/function.cpp: Ditto.
3734         * kjs/function_object.cpp: Ditto.
3735         * kjs/internal.h: Ditto.
3736         * kjs/internal.cpp: Ditto.
3737         * kjs/nodes.h: Ditto.
3738         * kjs/nodes2string.cpp: Ditto.
3739
3740 2005-08-26  Maciej Stachowiak  <mjs@apple.com>
3741
3742         Reviewed by John.
3743
3744         <rdar://problem/4224911> many many leaks in kjsyyparse with malformed Javascript        
3745
3746         Record all nodes that are created during parsing, and delete any
3747         that are left floating with a refcount of 0.
3748         
3749         * kjs/internal.cpp:
3750         (KJS::Parser::saveNewNode):
3751         (KJS::clearNewNodes):
3752         (KJS::Parser::parse):
3753         * kjs/internal.h:
3754         * kjs/nodes.cpp:
3755         (Node::Node):
3756         * kjs/nodes.h:
3757         (KJS::Node::refcount):
3758
3759 2005-08-26  Maciej Stachowiak  <mjs@apple.com>
3760
3761         Reviewed by John.
3762
3763         - fixed <rdar://problem/4232452> many many leaks in kjsyyparse on some well-formed JavaScript (can repro on sony.com, webkit tests)
3764         
3765         Fixed by changing the refcounting scheme for nodes. Instead of each node implementing a custom ref and
3766         deref for all its children (and being responsible for deleting them), nodes use a smart pointer to
3767         hold their children, and smart pointers are used outside the node tree as well. This change mostly
3768         removes code.
3769         
3770         * JavaScriptCore.xcodeproj/project.pbxproj:
3771         * kjs/function.cpp:
3772         (KJS::DeclaredFunctionImp::DeclaredFunctionImp):
3773         (KJS::GlobalFuncImp::callAsFunction):
3774         * kjs/function.h:
3775         * kjs/function_object.cpp:
3776         (FunctionObjectImp::construct):
3777         * kjs/grammar.y:
3778         * kjs/internal.cpp:
3779         (KJS::Parser::parse):
3780         (KJS::Parser::accept):
3781         (KJS::InterpreterImp::checkSyntax):
3782         (KJS::InterpreterImp::evaluate):
3783         * kjs/internal.h:
3784         * kjs/nodes.cpp:
3785         (Node::Node):
3786         (Node::~Node):
3787         (ElementNode::evaluate):
3788         (PropertyValueNode::evaluate):
3789         (ArgumentListNode::evaluateList):
3790         (NewExprNode::evaluate):
3791         (FunctionCallValueNode::evaluate):
3792         (FunctionCallBracketNode::evaluate):
3793         (FunctionCallDotNode::evaluate):
3794         (RelationalNode::evaluate):
3795         (StatListNode::execute):
3796         (StatListNode::processVarDecls):
3797         (VarDeclListNode::evaluate):
3798         (VarDeclListNode::processVarDecls):
3799         (ForInNode::ForInNode):
3800         (ClauseListNode::processVarDecls):
3801         (CaseBlockNode::evalBlock):
3802         (FuncDeclNode::processFuncDecl):
3803         (FuncExprNode::evaluate):
3804         (SourceElementsNode::execute):
3805         (SourceElementsNode::processFuncDecl):
3806         (SourceElementsNode::processVarDecls):
3807         * kjs/nodes.h:
3808         (KJS::Node::ref):
3809         (KJS::Node::deref):
3810         (KJS::NumberNode::NumberNode):
3811         (KJS::GroupNode::GroupNode):
3812         (KJS::ElementNode::ElementNode):
3813         (KJS::ArrayNode::ArrayNode):
3814         (KJS::PropertyValueNode::PropertyValueNode):
3815         (KJS::ObjectLiteralNode::ObjectLiteralNode):
3816         (KJS::BracketAccessorNode::BracketAccessorNode):
3817         (KJS::DotAccessorNode::DotAccessorNode):
3818         (KJS::ArgumentListNode::ArgumentListNode):
3819         (KJS::ArgumentsNode::ArgumentsNode):
3820         (KJS::NewExprNode::NewExprNode):
3821         (KJS::FunctionCallValueNode::FunctionCallValueNode):
3822         (KJS::FunctionCallResolveNode::FunctionCallResolveNode):
3823         (KJS::FunctionCallBracketNode::FunctionCallBracketNode):
3824         (KJS::FunctionCallDotNode::FunctionCallDotNode):
3825         (KJS::PostfixNode::PostfixNode):
3826         (KJS::DeleteNode::DeleteNode):
3827         (KJS::VoidNode::VoidNode):
3828         (KJS::TypeOfNode::TypeOfNode):
3829         (KJS::PrefixNode::PrefixNode):
3830         (KJS::UnaryPlusNode::UnaryPlusNode):
3831         (KJS::NegateNode::NegateNode):
3832         (KJS::BitwiseNotNode::BitwiseNotNode):
3833         (KJS::LogicalNotNode::LogicalNotNode):
3834         (KJS::MultNode::MultNode):
3835         (KJS::AddNode::AddNode):
3836         (KJS::ShiftNode::ShiftNode):
3837         (KJS::RelationalNode::RelationalNode):
3838         (KJS::EqualNode::EqualNode):
3839         (KJS::BitOperNode::BitOperNode):
3840         (KJS::BinaryLogicalNode::BinaryLogicalNode):
3841         (KJS::ConditionalNode::ConditionalNode):
3842         (KJS::AssignResolveNode::AssignResolveNode):
3843         (KJS::AssignBracketNode::AssignBracketNode):
3844         (KJS::AssignDotNode::AssignDotNode):
3845         (KJS::CommaNode::CommaNode):
3846         (KJS::AssignExprNode::AssignExprNode):
3847         (KJS::VarDeclListNode::VarDeclListNode):
3848         (KJS::VarStatementNode::VarStatementNode):
3849         (KJS::ExprStatementNode::ExprStatementNode):
3850         (KJS::IfNode::IfNode):
3851         (KJS::DoWhileNode::DoWhileNode):
3852         (KJS::WhileNode::WhileNode):
3853         (KJS::ForNode::ForNode):
3854         (KJS::ReturnNode::ReturnNode):
3855         (KJS::WithNode::WithNode):
3856         (KJS::CaseClauseNode::CaseClauseNode):
3857         (KJS::ClauseListNode::ClauseListNode):
3858         (KJS::ClauseListNode::clause):
3859         (KJS::ClauseListNode::next):
3860         (KJS::SwitchNode::SwitchNode):
3861         (KJS::LabelNode::LabelNode):
3862         (KJS::ThrowNode::ThrowNode):
3863         (KJS::CatchNode::CatchNode):
3864         (KJS::FinallyNode::FinallyNode):
3865         (KJS::TryNode::TryNode):
3866         (KJS::ParameterNode::ParameterNode):
3867         (KJS::ParameterNode::nextParam):
3868         (KJS::FuncDeclNode::FuncDeclNode):
3869         (KJS::FuncExprNode::FuncExprNode):
3870         * kjs/nodes2string.cpp:
3871         (KJS::SourceStream::operator<<):
3872         (ElementNode::streamTo):
3873         (PropertyValueNode::streamTo):
3874         (ArgumentListNode::streamTo):
3875         (StatListNode::streamTo):
3876         (VarDeclListNode::streamTo):
3877         (CaseBlockNode::streamTo):
3878         (ParameterNode::streamTo):
3879         (SourceElementsNode::streamTo):
3880         * kjs/shared_ptr.h: Added.
3881         (kxmlcore::SharedPtr::SharedPtr):
3882         (kxmlcore::SharedPtr::~SharedPtr):
3883         (kxmlcore::SharedPtr::isNull):
3884         (kxmlcore::SharedPtr::notNull):
3885         (kxmlcore::SharedPtr::reset):
3886         (kxmlcore::SharedPtr::get):
3887         (kxmlcore::SharedPtr::operator*):
3888         (kxmlcore::SharedPtr::operator->):
3889         (kxmlcore::SharedPtr::operator!):
3890         (kxmlcore::SharedPtr::operator bool):
3891         (kxmlcore::SharedPtr::operator==):
3892         (kxmlcore::::operator):
3893         (kxmlcore::operator!=):
3894         (kxmlcore::static_pointer_cast):
3895         (kxmlcore::const_pointer_cast):
3896
3897 2005-08-26  Geoff Garen  <ggaren@apple.com>
3898
3899         Reviewed by John.
3900         Landed by Darin.
3901
3902         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4664
3903           TOT Crash from backwards null check in WebScriptObject.mm
3904
3905         * bindings/objc/WebScriptObject.mm:
3906         (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
3907         Remove bogus !.
3908
3909 2005-08-25  Darin Adler  <darin@apple.com>
3910
3911         Reviewed by John Sullivan.
3912
3913         - rename KJS::UString::string() to KJS::UString::domString()
3914         - rename KJS::Identifier::string() to KJS::Identifier::domString()
3915
3916         * kjs/identifier.h: Renamed.
3917         * kjs/ustring.h: Ditto.
3918
3919 2005-08-19  Darin Adler  <darin@apple.com>
3920
3921         Reviewed by Maciej.
3922
3923         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4435
3924           speed up JavaScript by tweaking the Identifier class
3925
3926         * kjs/identifier.h: Add a new global nullIdentifier and make Identifier::null a function
3927         that returns it.
3928         * kjs/identifier.cpp: (KJS::Identifier::init): Initialize a global for the null identifier
3929         as well as all the other globals for special identifiers.
3930
3931         * kjs/ustring.h: (KJS::UString::UString): Make this empty constructor inline.
3932         * kjs/ustring.cpp: Remove the old non-inline version.
3933
3934 2005-08-19  Mitz Pettel  <opendarwin.org@mitzpettel.com>
3935
3936         Reviewed by Maciej.
3937         Revised and landed by Darin.
3938
3939         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4474
3940           REGRESSION: Crash when using in-place operator on uninitialized array element
3941
3942         * kjs/nodes.cpp:
3943         (AssignResolveNode::evaluate): Remove unneeded "isSet" assertion.
3944         (AssignBracketNode::evaluate): Replace code that tested "isSet" with code that
3945         tests the return value of getPropertySlot.
3946
3947         * kjs/property_slot.h: Removed unneeded "isSet" function. Property slots are
3948         either uninitialized or set. There's no "initialized and not set" state.
3949
3950 2005-08-18  Adele Peterson  <adele@apple.com>
3951
3952         Checked "Inline Functions Hidden" box
3953
3954         * JavaScriptCore.xcodeproj/project.pbxproj:
3955
3956 2005-08-16  Darin Adler  <darin@apple.com>
3957
3958         Reviewed by Geoff.
3959
3960         - fixed crash in one of the JavaScript tests (introduced by my throwError change)
3961
3962         * kjs/nodes.cpp: (Node::setExceptionDetailsIfNeeded): Check if the exception is an
3963         object before setting the file and line number properties on it. Something to think
3964         about in the future -- do we really want to do this on any object that's thrown?
3965         How about limiting it to error objects that were created by the JavaScript engine?
3966
3967         - changed kjs_fast_malloc so we don't have two conflicting versions of the same function
3968
3969         * kjs/fast_malloc.h: Took out all the ifdefs from this header.
3970         * kjs/fast_malloc.cpp: Added non-NDEBUG versions of the functions that just call
3971         the system malloc, and put the NDEBUG versions in an #else.
3972
3973 2005-08-16  Darin Adler  <darin@apple.com>
3974
3975         Reviewed by Geoff.
3976
3977         - clean up exported symbols that are not in a "KJS" namespace
3978
3979         * bindings/NP_jsobject.cpp: (identiferFromNPIdentifier): Marked this function static
3980         so it no longer has external linkage.
3981         * bindings/c/c_utility.h: Put all this stuff inside the KJS namespace.
3982         * bindings/c/c_utility.cpp: Also marked some globals static so they don't have external
3983         linkage; not as important given the namespace.
3984         * bindings/npruntime.cpp: Marked functions static so they no longer have internal linkage.
3985         Also removed unused _NPN_SetExceptionWithUTF8 function (not in header, had C++ linkage!).
3986
3987         * bindings/jni/jni_utility.cpp: (KJS::Bindings::getJavaVM): Call KJS_GetCreatedJavaVMs
3988         using the soft linking header, instead of calling the JNI call. This allows processes
3989         to link both JavaScriptCore and JavaVM without a symbol conflict.
3990         * bindings/softlinking.c:
3991         (loadFramework): Marked this function static so it no longer has external linkage.
3992         (getFunctionPointer): Ditto.
3993         (KJS_GetCreatedJavaVMs): Renamed this so it has a KJS prefix.
3994
3995         * JavaScriptCore.xcodeproj/project.pbxproj: Added softlinking.h.
3996         * bindings/softlinking.h: Added.
3997
3998         * kjs/nodes2string.cpp: (streamAssignmentOperatorTo): Marked this function static so it
3999         no longer has external linkage.
4000
4001 2005-08-15  Darin Adler  <darin@apple.com>
4002
4003         Reviewed by Geoff.
4004
4005         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4437
4006           clean up error creation with new throwError function
4007
4008         * bindings/NP_jsobject.cpp:
4009         (_NPN_SetException):
4010         * bindings/jni/jni_instance.cpp:
4011         (JavaInstance::invokeMethod):
4012         * bindings/jni/jni_runtime.cpp:
4013         (JavaField::dispatchValueFromInstance):
4014         (JavaField::dispatchSetValueToInstance):
4015         * bindings/objc/WebScriptObject.mm:
4016         (-[WebScriptObject _initializeWithObjectImp:originExecutionContext:executionContext:]):
4017         (-[WebScriptObject _initWithObjectImp:originExecutionContext:executionContext:]):
4018         (+[WebScriptObject throwException:]):
4019         (-[WebScriptObject setException:]):
4020         (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
4021         * bindings/objc/objc_class.h:
4022         (KJS::Bindings::ObjcClass::~ObjcClass):
4023         (KJS::Bindings::ObjcClass::ObjcClass):
4024         (KJS::Bindings::ObjcClass::operator=):
4025         (KJS::Bindings::ObjcClass::constructorAt):
4026         (KJS::Bindings::ObjcClass::numConstructors):
4027         * bindings/objc/objc_header.h:
4028         * bindings/objc/objc_runtime.h:
4029         (KJS::Bindings::ObjcField::~ObjcField):
4030         (KJS::Bindings::ObjcField::ObjcField):
4031         (KJS::Bindings::ObjcField::operator=):
4032         (KJS::Bindings::ObjcMethod::ObjcMethod):
4033         (KJS::Bindings::ObjcMethod::~ObjcMethod):
4034         (KJS::Bindings::ObjcMethod::operator=):
4035         * bindings/objc/objc_runtime.mm:
4036         (ObjcField::valueFromInstance):
4037         (ObjcField::setValueToInstance):
4038         (ObjcArray::setValueAt):
4039         (ObjcArray::valueAt):
4040         * bindings/objc/objc_utility.h:
4041         * bindings/objc/objc_utility.mm:
4042         (KJS::Bindings::JSMethodNameToObjCMethodName):
4043         (KJS::Bindings::convertValueToObjcValue):
4044         (KJS::Bindings::convertNSStringToString):
4045         (KJS::Bindings::convertObjcValueToValue):
4046         (KJS::Bindings::objcValueTypeForType):
4047         (KJS::Bindings::createObjcInstanceForValue):
4048         (KJS::Bindings::throwError):
4049         * bindings/runtime.h:
4050         (KJS::Bindings::Parameter::~Parameter):
4051         (KJS::Bindings::Method::~Method):
4052         (KJS::Bindings::Instance::Instance):
4053         (KJS::Bindings::Instance::begin):
4054         (KJS::Bindings::Instance::end):
4055         (KJS::Bindings::Instance::getValueOfUndefinedField):
4056         (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
4057         (KJS::Bindings::Instance::setValueOfUndefinedField):
4058         (KJS::Bindings::Instance::valueOf):
4059         * bindings/runtime_array.cpp:
4060         (RuntimeArrayImp::put):
4061         * bindings/runtime_object.h:
4062         (KJS::RuntimeObjectImp::setInternalInstance):
4063         (KJS::RuntimeObjectImp::getInternalInstance):
4064         * kjs/array_object.cpp:
4065         (getProperty):
4066         (ArrayProtoFuncImp::callAsFunction):
4067         (ArrayObjectImp::construct):
4068         * kjs/bool_object.cpp:
4069         (BooleanProtoFuncImp::callAsFunction):
4070         * kjs/date_object.cpp:
4071         (KJS::DateProtoFuncImp::callAsFunction):
4072         * kjs/function.cpp:
4073         (KJS::decode):
4074         (KJS::GlobalFuncImp::callAsFunction):
4075         * kjs/function_object.cpp:
4076         (FunctionProtoFuncImp::callAsFunction):
4077         (FunctionObjectImp::construct):
4078         * kjs/internal.cpp:
4079         (KJS::UndefinedImp::toObject):
4080         (KJS::NullImp::toObject):
4081         (KJS::InterpreterImp::evaluate):
4082         (KJS::InternalFunctionImp::hasInstance):
4083         * kjs/nodes.cpp:
4084         (Node::throwError):
4085         (substitute):
4086         (Node::setExceptionDetailsIfNeeded):
4087         (undefinedVariableError):
4088         (ProgramNode::ProgramNode):
4089         * kjs/number_object.cpp:
4090         (NumberProtoFuncImp::callAsFunction):
4091         * kjs/object.cpp:
4092         (KJS::ObjectImp::call):
4093         (KJS::ObjectImp::defaultValue):
4094         (KJS::Error::create):
4095         (KJS::throwError):
4096         * kjs/object.h:
4097         (KJS::ObjectImp::clearProperties):
4098         (KJS::ObjectImp::getPropertySlot):
4099         (KJS::ObjectImp::getOwnPropertySlot):
4100         * kjs/object_object.cpp:
4101         (ObjectProtoFuncImp::callAsFunction):
4102         * kjs/reference.cpp:
4103         (KJS::Reference::getBase):
4104         (KJS::Reference::getValue):
4105         (KJS::Reference::putValue):
4106         (KJS::Reference::deleteValue):
4107         * kjs/re