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