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