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