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