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