8d087c92f6d75769eb7bc782b8a62e05843fb3b5
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2005-10-11  Geoffrey Garen  <ggaren@apple.com>
2
3         Fixed build bustage from last checkin (stray characters
4         in the project file).
5
6         Reviewed by mitz.
7
8         * JavaScriptCore.xcodeproj/project.pbxproj:
9
10 2005-10-11  Geoffrey Garen  <ggaren@apple.com>
11
12         New JavaScriptCore test results to reflect the last change.
13
14         * tests/mozilla/expected.html:
15
16 2005-10-10  Geoffrey Garen  <ggaren@apple.com>
17
18         - Implemented caching of match state inside the global RegExp object
19           (lastParen, leftContext, rightContext, lastMatch, input).
20
21           exec(), test(), match(), search(), and replace() now dipatch regular
22           expression matching through the RegExp object's performMatch function, 
23           to facilitate caching. This replaces registerRegexp and 
24           setSubPatterns.
25         
26         - Implemented the special '$' aliases (e.g. RegExp.input aliases to 
27           RegExp.$_).
28
29         - Moved support for backreferences into the new static hash table
30           used for other special RegExp properties. Truncated backreferences
31           at $9 to match IE, FF, and the "What's New in Netscape 1.2?" doc.
32           (String.replace still supports double-digit backreferences.)
33
34         - Tweaked RegExp.prototype.exec to handle ginormous values in lastIndex.
35
36         Fixes 11 -- count em, 11 -- JavaScriptCore tests.
37
38         * fast/js/regexp-caching-expected.txt: Added.
39         * fast/js/regexp-caching.html: Added.
40
41         Reviewed by mjs.
42
43         * JavaScriptCore.xcodeproj/project.pbxproj: Added regexp_object.lut.h
44         * kjs/create_hash_table: Tweaked to allow for more exotic characters.
45                                  We now rely on the compiler to catch illegal
46                                  identifiers.
47         * kjs/regexp.cpp:
48         (KJS::RegExp::RegExp):
49         * kjs/regexp_object.cpp:
50         (RegExpProtoFuncImp::callAsFunction):
51         (RegExpObjectImp::RegExpObjectImp):
52         (RegExpObjectImp::performMatch):
53         (RegExpObjectImp::arrayOfMatches):
54         (RegExpObjectImp::backrefGetter):
55         (RegExpObjectImp::getLastMatch):
56         (RegExpObjectImp::getLastParen):
57         (RegExpObjectImp::getLeftContext):
58         (RegExpObjectImp::getRightContext):
59         (RegExpObjectImp::getOwnPropertySlot):
60         (RegExpObjectImp::getValueProperty):
61         (RegExpObjectImp::put):
62         (RegExpObjectImp::putValueProperty):
63         * kjs/regexp_object.h:
64         (KJS::RegExpObjectImp::):
65         * kjs/string_object.cpp:
66         (substituteBackreferences):
67         (replace):
68         (StringProtoFuncImp::callAsFunction):
69
70 2005-10-09  Darin Adler  <darin@apple.com>
71
72         Reviewed by Maciej; some changes done after review.
73
74         - fixed <rdar://problem/4092064> hanging loading page; rte.ie (works in IE and Firefox)
75         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5280
76           Date.setMonth fails with negative values
77         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5154
78           JSC should switch to _r variants of unix time/date functions
79         - fixed a few possible overflow cases
80
81         Retested all tests to be sure nothing broke; added layout test for bug 5280.
82
83         * kjs/config.h: Removed TIME_WITH_SYS_TIME define. Also set HAVE_SYS_TIMEB_H
84         for the __APPLE__ case (the latter is accurate but irrelevant).
85
86         * kjs/date_object.h: Reformatted. Removed unnecessary include of "function_object.h".
87         Moved declarations of helper classes and functions into the cpp file.
88
89         * kjs/date_object.cpp: Removed code at top to define macros to use CoreFoundation instead of
90         POSIX date functions.
91         (KJS::styleFromArgString): Tweaked to return early instead of using a variable.
92         (KJS::formatLocaleDate): Tweaked to check for undefined rather than checking argument count.
93         (KJS::formatDate): Made parameter const.
94         (KJS::formatDateUTCVariant): Ditto.
95         (KJS::formatTime): Ditto.
96         (KJS::DateProtoFuncImp::callAsFunction): Use gmtime_r and localtime_r instead of gmtime and
97         localtime.
98         (KJS::DateObjectImp::callAsFunction): Use localtime_r instead of localtime.
99         (KJS::ymdhmsToSeconds): Renamed from ymdhms_to_seconds. Changed computation to avoid possible
100         overflow if year is an extremely large or small number.
101         (KJS::makeTime): Removed code to move large month numbers from tm_mon to tm_year; this was
102         to accomodate CFGregorianDate, which is no longer used (and didn't handle negative values).
103         (KJS::parseDate): Renamed from KRFCDate_parseDate; changed to return a value in milliseconds
104         rather than in seconds. Reformatted the code. Changed to use UTF8String() instead of ascii(),
105         since ascii() is not thread safe. Changed some variables back from int to long to avoid
106         trouble if the result of strtol does not fit in an int (64-bit issue only).
107
108 2005-10-08  Mitz Pettel  <opendarwin.org@mitzpettel.com>
109
110         Reviewed by Geoff.
111         Tweaked and landed by Darin.
112
113         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5266
114           Support parenthesized comments in Date.parse()
115
116         * kjs/date_object.cpp:
117         (KJS::skipSpacesAndComments): Take a pointer, and advance it past spaces,
118         and also past anything enclosed in parentheses.
119         (KJS::KRFCDate_parseDate): Use skipSpacesAndComments wherever we formerly had
120         code to skip spaces.
121
122 2005-10-08  Justin Haygood  <justin@xiondigital.net>
123
124         Reviewed, tweaked, and landed by Darin.
125
126         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5189
127           pcre_exec.c fails to compile using MSVC
128         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5190
129           KJS config.h adjustment for Win32
130         
131         * kjs/config.h: Make sure HAVE_MMAP and HAVE_SBRK are off for Win32.
132         Turn HAVE_ERRNO_H on for Mac OS X. Sort defines so they are easy to compare
133         with each other. Remove #undef of DEBUG_COLLECTOR.
134         * pcre/pcre_exec.c: (match): Work around strange MSVC complaint by splitting
135         the definition of a local variable into a separate declaration and
136         initialization.
137
138 2005-10-05  Geoffrey Garen  <ggaren@apple.com>
139  
140         - Darin and I rewrote our implementation of the SimpleNumber class
141           to store number bit patterns in their floating point formats.
142  
143         My tweaks reviewed by Darin.
144         
145         ~1% speedup on JS iBench.
146         
147         * kjs/internal.h: removed obsolete jsNumber declarations.
148         * kjs/math_object.cpp:
149         (MathFuncImp::callAsFunction): changed KJS::isNaN to isNaN
150         * kjs/nodes.cpp:
151         (PostfixResolveNode::evaluate): removed obsolete knownToBeInteger
152         (PostfixBracketNode::evaluate): ditto
153         (PostfixDotNode::evaluate): ditto
154         (PrefixResolveNode::evaluate): ditto
155         (PrefixBracketNode::evaluate): ditto
156         (PrefixDotNode::evaluate): ditto
157         (NegateNode::evaluate): ditto
158         (valueForReadModifyAssignment): ditto
159         * kjs/number_object.cpp: removed obsolete comment
160         * kjs/operations.cpp:
161         (KJS::equal): removed unnecessary isNaN checks
162         (KJS::strictEqual): ditto
163         (KJS::add): removed obsolete knownToBeInteger
164         (KJS::mult): ditto
165         * kjs/operations.h: removed include of "value.h" to prevent circular reference
166         * kjs/simple_number.h: removed unnecessary #includes
167         (KJS::SimpleNumber::make): see above
168         (KJS::SimpleNumber::is): ditto
169         (KJS::SimpleNumber::value): ditto
170         * kjs/string_object.cpp:
171         (StringProtoFuncImp::callAsFunction): changed KJS::isNaN to isNaN
172         * kjs/ustring.cpp: removed unnecessary isNaN check
173         (KJS::UString::toUInt32): ditto
174         * kjs/value.cpp:
175         (KJS::jsNumber): removed obsolete jsNumber definitions
176         (KJS::ConstantValues::init): NaN is no longer a ConstantValue
177         (KJS::ConstantValues::clear): ditto
178         (KJS::ConstantValues::mark): ditto
179         * kjs/value.h: removed obsolete knownToBeInteger
180         (KJS::jsNaN): now returns a SimpleNumber
181         (KJS::ValueImp::getUInt32): changed to account for NaN being a SimpleNumber
182         (KJS::ValueImp::toBoolean): ditto
183         (KJS::ValueImp::toString): changed to account for +/- 0.0
184         (KJS::jsZero): changed to reflect that SimpleNumber::make takes a double
185         (KJS::jsOne): ditto
186         (KJS::jsTwo): ditto
187         (KJS::Number): removed obsolete non-double constructor declarations
188
189 2005-10-05  Maciej Stachowiak  <mjs@apple.com>
190
191         Reviewed by Eric.
192
193         - fixed <rdar://problem/4260481> Remove Reference type from JavaScriptCore
194
195         Also fixed some bugs with for..in enumeration while I was at it. object
196         properties now come before prototype properties and duplicates
197         between object and prototype are listed only once.
198
199         * JavaScriptCore.xcodeproj/project.pbxproj:
200         * kjs/IdentifierSequencedSet.cpp: Added.
201         (KJS::IdentifierSequencedSet::IdentifierSequencedSet):
202         (KJS::IdentifierSequencedSet::deallocateVector):
203         (KJS::IdentifierSequencedSet::~IdentifierSequencedSet):
204         (KJS::IdentifierSequencedSet::insert):
205         * kjs/IdentifierSequencedSet.h: Added.
206         (KJS::IdentifierSequencedSetIterator::IdentifierSequencedSetIterator):
207         (KJS::IdentifierSequencedSetIterator::operator*):
208         (KJS::IdentifierSequencedSetIterator::operator->):
209         (KJS::IdentifierSequencedSetIterator::operator++):
210         (KJS::IdentifierSequencedSetIterator::operator==):
211         (KJS::IdentifierSequencedSetIterator::operator!=):
212         (KJS::IdentifierSequencedSet::begin):
213         (KJS::IdentifierSequencedSet::end):
214         (KJS::IdentifierSequencedSet::size):
215         * kjs/array_instance.h:
216         * kjs/array_object.cpp:
217         (ArrayInstanceImp::getPropertyNames):
218         (ArrayInstanceImp::setLength):
219         (ArrayInstanceImp::pushUndefinedObjectsToEnd):
220         * kjs/nodes.cpp:
221         (ForInNode::execute):
222         * kjs/nodes.h:
223         * kjs/object.cpp:
224         (KJS::ObjectImp::getPropertyNames):
225         * kjs/object.h:
226         * kjs/property_map.cpp:
227         (KJS::PropertyMap::getEnumerablePropertyNames):
228         (KJS::PropertyMap::getSparseArrayPropertyNames):
229         * kjs/property_map.h:
230         * kjs/protect.h:
231         * kjs/protected_reference.h: Removed.
232         * kjs/reference.cpp: Removed.
233         * kjs/reference.h: Removed.
234         * kjs/reference_list.cpp: Removed.
235         * kjs/reference_list.h: Removed.
236         * kjs/ustring.h:
237         (KJS::UString::impl):
238         * kxmlcore/HashSet.h:
239
240 2005-10-04  Eric Seidel  <eseidel@apple.com>
241
242         Reviewed by mjs.
243
244         Code cleanup, which resulted in a small win on iBench.
245
246         * kjs/object.cpp:
247         (KJS::tryGetAndCallProperty): new static inline
248         (KJS::ObjectImp::defaultValue): code cleanup
249
250 2005-10-03  Maciej Stachowiak  <mjs@apple.com>
251
252         Patch from George Staikos <staikos@kde.org>, reviewed and tweaked a bit by me.
253
254         - more Linux build fixes
255         
256         * kjs/operations.cpp:
257         * kxmlcore/FastMalloc.h:
258         * kxmlcore/TCSystemAlloc.cpp:
259         (TCMalloc_SystemAlloc):
260
261 2005-10-03  Maciej Stachowiak  <mjs@apple.com>
262
263         Patch from George Staikos <staikos@kde.org>, reviewed and tweaked a bit by me.
264
265         http://bugzilla.opendarwin.org/show_bug.cgi?id=5174
266         Add support for compiling on Linux (likely to help for other POSIX systems too)
267
268         * kjs/collector.cpp:
269         (KJS::Collector::markCurrentThreadConservatively):
270         (KJS::Collector::markOtherThreadConservatively):
271         * kjs/config.h:
272         * kjs/date_object.cpp:
273         (KJS::formatDate):
274         (KJS::formatDateUTCVariant):
275         (KJS::formatTime):
276         (KJS::timeZoneOffset):
277         (KJS::DateProtoFuncImp::callAsFunction):
278         (KJS::DateObjectImp::construct):
279         (KJS::DateObjectImp::callAsFunction):
280         (KJS::makeTime):
281         * kjs/identifier.cpp:
282         * kjs/internal.cpp:
283         (KJS::initializeInterpreterLock):
284         (KJS::lockInterpreter):
285         (KJS::unlockInterpreter):
286         (KJS::UndefinedImp::toPrimitive):
287         (KJS::UndefinedImp::toBoolean):
288         (KJS::UndefinedImp::toNumber):
289         (KJS::UndefinedImp::toString):
290         (KJS::NullImp::toPrimitive):
291         (KJS::NullImp::toBoolean):
292         (KJS::NullImp::toNumber):
293         (KJS::NullImp::toString):
294         (KJS::BooleanImp::toPrimitive):
295         (KJS::BooleanImp::toBoolean):
296         (KJS::BooleanImp::toNumber):
297         (KJS::BooleanImp::toString):
298         (KJS::StringImp::toPrimitive):
299         (KJS::StringImp::toBoolean):
300         (KJS::StringImp::toNumber):
301         (KJS::StringImp::toString):
302         * kjs/internal.h:
303         * kjs/protected_values.cpp:
304
305 2005-10-03  Maciej Stachowiak  <mjs@apple.com>
306
307         - fix Development build after last checkin
308
309         * kxmlcore/FastMalloc.cpp:
310         (KXMLCore::fastMallocRegisterThread):
311
312 2005-10-02  Maciej Stachowiak  <mjs@apple.com>
313
314         Reviewed by Darin.
315
316         <rdar://problem/4283967> REGRESSION: 3% regression on PLT from new FastMalloc
317         http://bugzilla.opendarwin.org/show_bug.cgi?id=5243
318         
319         A number of optimizations to the new threadsafe malloc that make it actually as fast
320         as dlmalloc (I measured wrong before) and as memory-efficient as the system malloc.
321
322         - use fastMalloc for everything - it now gets applied to all new/delete allocations
323         via a private inline operator new that is now included into every file via config.h.
324
325         - tweaked some of the numeric parameters for size classes and amount of wasted memory
326         allowed per allocation - this saves on memory use and consequently improves speed.
327
328         - so long as the allocator is not being used on background threads, get the per-thread
329         cache from a global variable instead of from pthread_getspecific, since the latter is slow.
330
331         - inline more functions, and force the ones GCC refuses to inline with 
332         attribute(always_inline), nearly all of these have one call site so inlining them has 
333         to be a win.
334
335         - use some tricks to calculate allocation size more efficiently and fewer times for small
336         allocations, to avoid hitting the huge size table array.
337
338         - avoid hitting the per-thread cache on code paths that don't need it.
339
340         - implement inline assembly version of spinlock for PowerPC (was already done for x86)
341
342         * bindings/NP_jsobject.cpp:
343         * bindings/c/c_class.cpp:
344         * bindings/c/c_instance.cpp:
345         * bindings/c/c_runtime.cpp:
346         * bindings/c/c_utility.cpp:
347         * bindings/jni/jni_class.cpp:
348         * bindings/jni/jni_instance.cpp:
349         * bindings/jni/jni_jsobject.cpp:
350         * bindings/jni/jni_objc.mm:
351         * bindings/jni/jni_runtime.cpp:
352         * bindings/jni/jni_utility.cpp:
353         * bindings/npruntime.cpp:
354         * bindings/objc/WebScriptObject.mm:
355         * bindings/objc/objc_class.mm:
356         * bindings/objc/objc_instance.mm:
357         * bindings/objc/objc_runtime.mm:
358         * bindings/objc/objc_utility.mm:
359         * bindings/runtime.cpp:
360         * bindings/runtime_array.cpp:
361         * bindings/runtime_method.cpp:
362         * bindings/runtime_object.cpp:
363         * bindings/runtime_root.cpp:
364         * bindings/testbindings.cpp:
365         * bindings/testbindings.mm:
366         * kjs/array_object.cpp:
367         (ArrayInstanceImp::ArrayInstanceImp):
368         (ArrayInstanceImp::~ArrayInstanceImp):
369         (ArrayInstanceImp::resizeStorage):
370         * kjs/bool_object.cpp:
371         * kjs/collector.cpp:
372         (KJS::Collector::registerThread):
373         * kjs/config.h:
374         * kjs/debugger.cpp:
375         * kjs/error_object.cpp:
376         * kjs/function.cpp:
377         * kjs/function_object.cpp:
378         * kjs/identifier.cpp:
379         (KJS::Identifier::rehash):
380         * kjs/internal.cpp:
381         (KJS::Parser::saveNewNode):
382         (KJS::clearNewNodes):
383         * kjs/interpreter.cpp:
384         * kjs/lexer.cpp:
385         (Lexer::doneParsing):
386         (Lexer::makeIdentifier):
387         (Lexer::makeUString):
388         * kjs/list.cpp:
389         * kjs/math_object.cpp:
390         * kjs/nodes.cpp:
391         * kjs/nodes.h:
392         * kjs/nodes2string.cpp:
393         * kjs/number_object.cpp:
394         (integer_part_noexp):
395         (char_sequence):
396         * kjs/object.cpp:
397         * kjs/object_object.cpp:
398         * kjs/property_map.cpp:
399         * kjs/property_slot.cpp:
400         * kjs/protected_values.cpp:
401         (KJS::ProtectedValues::rehash):
402         * kjs/reference.cpp:
403         * kjs/reference_list.cpp:
404         * kjs/regexp.cpp:
405         * kjs/regexp_object.cpp:
406         * kjs/scope_chain.cpp:
407         * kjs/scope_chain.h:
408         * kjs/string_object.cpp:
409         * kjs/testkjs.cpp:
410         * kjs/ustring.h:
411         * kjs/value.cpp:
412         * kxmlcore/Assertions.mm:
413         * kxmlcore/FastMalloc.cpp:
414         (KXMLCore::InitSizeClasses):
415         (KXMLCore::DLL_IsEmpty):
416         (KXMLCore::DLL_Prepend):
417         (KXMLCore::TCMalloc_Central_FreeList::Insert):
418         (KXMLCore::TCMalloc_Central_FreeList::Remove):
419         (KXMLCore::TCMalloc_Central_FreeList::Populate):
420         (KXMLCore::TCMalloc_ThreadCache::Allocate):
421         (KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
422         (KXMLCore::fastMallocRegisterThread):
423         (KXMLCore::TCMalloc_ThreadCache::GetCache):
424         (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
425         (KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
426         (KXMLCore::do_malloc):
427         (KXMLCore::do_free):
428         (KXMLCore::realloc):
429         * kxmlcore/FastMalloc.h:
430         (operator new):
431         (operator delete):
432         (operator new[]):
433         (operator delete[]):
434         * kxmlcore/HashTable.cpp:
435         * kxmlcore/TCSpinLock.h:
436         (TCMalloc_SpinLock::Lock):
437         (TCMalloc_SpinLock::Unlock):
438         (TCMalloc_SlowLock):
439         * kxmlcore/TCSystemAlloc.cpp:
440
441 2005-09-30  Geoffrey Garen  <ggaren@apple.com>
442
443         - Second cut at fixing <rdar://problem/4275206> Denver Regression: Seed: 
444           Past Editions of Opinions display "NAN/Undefined" for www.washingtonpost.com
445                 
446         Reviewed by john.
447
448         * kjs/date_object.cpp:
449         (KJS::KRFCDate_parseDate): Intead of creating a timezone when one isn't specified,
450         just rely on the fallback logic, which will do it for you. Also, return invalidDate
451         if the date includes trailing garbage. (Somewhat accidentally, the timezone logic
452         used to catch trailing garbage.)
453
454         Added test case to fast/js/date-parse-test.html.
455
456 2005-09-29  Eric Seidel  <eseidel@apple.com>
457         Fix from Mitz Pettel <opendarwin.org@mitzpettel.com>
458
459         Reviewed by darin.
460
461         Fix JSC memory smasher in TOT.
462         http://bugzilla.opendarwin.org/show_bug.cgi?id=5176
463
464         * pcre/pcre_exec.c:
465         (match):
466
467 2005-09-29  Eric Seidel  <eseidel@apple.com>
468         Fix from Mitz Pettel <opendarwin.org@mitzpettel.com>
469
470         Reviewed by mjs.
471
472         * JavaScriptCore.xcodeproj/project.pbxproj:
473         Build fix for JSC+SVG after 5161.
474         http://bugzilla.opendarwin.org/show_bug.cgi?id=5179
475
476 2005-09-28  Geoffrey Garen  <ggaren@apple.com>
477
478         - Fixed <rdar://problem/4275206> Denver Regression: Seed: Past Editions of Opinions display 
479           "NAN/Undefined" for www.washingtonpost.com
480           
481         Reviewed by darin.
482
483         * kjs/date_object.cpp:
484         (KJS::KRFCDate_parseDate): If the timezone isn't specified, rather than returning
485         invalidDate, substitute the local timezone. This matches the behavior of FF/IE.
486
487 2005-09-28  Maciej Stachowiak  <mjs@apple.com>
488
489         Patch from George Staikos, reviewed by me.
490
491         - fixed some compile issues on Linux
492         
493         * kjs/property_slot.h:
494         * kjs/simple_number.h:
495
496 2005-09-27  Maciej Stachowiak  <mjs@apple.com>
497
498         Reviewed by Eric.
499
500         - move HashMap/HashSet code down to JavaScriptCore
501         http://bugzilla.opendarwin.org/show_bug.cgi?id=5161
502         
503         * JavaScriptCore.xcodeproj/project.pbxproj:
504         * kjs/internal.cpp:
505         (KJS::interpreterMap): Function that fetches the interpreter map on demand. 
506         (KJS::InterpreterImp::InterpreterImp): Replace use of InterpreterMap
507         class with an appropriate HashMap.
508         (KJS::InterpreterImp::clear): ditto
509         (KJS::InterpreterImp::interpreterWithGlobalObject): ditto
510         * kjs/interpreter_map.cpp: Removed.
511         * kjs/interpreter_map.h: Removed.
512
513         The HashMap/HashSet code (copied and slightly tweaked from WebCore)
514         
515         * kxmlcore/HashFunctions.h: Added.
516         (KXMLCore::4):
517         (KXMLCore::8):
518         (KXMLCore::):
519         (KXMLCore::PointerHash::hash):
520         (KXMLCore::PointerHash::equal):
521         * kxmlcore/HashMap.h: Added.
522         (KXMLCore::extractFirst):
523         (KXMLCore::HashMap::HashMap):
524         (KXMLCore::::size):
525         (KXMLCore::::capacity):
526         (KXMLCore::::isEmpty):
527         (KXMLCore::::begin):
528         (KXMLCore::::end):
529         (KXMLCore::::find):
530         (KXMLCore::::contains):
531         (KXMLCore::::set):
532         (KXMLCore::::get):
533         (KXMLCore::::remove):
534         (KXMLCore::::clear):
535         (KXMLCore::deleteAllValues):
536         * kxmlcore/HashMapPtrSpec.h: Added.
537         (KXMLCore::PointerHashIteratorAdapter::PointerHashIteratorAdapter):
538         (KXMLCore::PointerHashIteratorAdapter::operator*):
539         (KXMLCore::PointerHashIteratorAdapter::operator->):
540         (KXMLCore::PointerHashIteratorAdapter::operator++):
541         (KXMLCore::PointerHashIteratorAdapter::operator==):
542         (KXMLCore::PointerHashIteratorAdapter::operator!=):
543         (KXMLCore::PointerHashConstIteratorAdapter::PointerHashConstIteratorAdapter):
544         (KXMLCore::PointerHashConstIteratorAdapter::operator*):
545         (KXMLCore::PointerHashConstIteratorAdapter::operator->):
546         (KXMLCore::PointerHashConstIteratorAdapter::operator++):
547         (KXMLCore::PointerHashConstIteratorAdapter::operator==):
548         (KXMLCore::PointerHashConstIteratorAdapter::operator!=):
549         (KXMLCore::):
550         * kxmlcore/HashSet.h: Added.
551         (KXMLCore::identityExtract):
552         (KXMLCore::convertAdapter):
553         (KXMLCore::HashSet::HashSet):
554         (KXMLCore::::size):
555         (KXMLCore::::capacity):
556         (KXMLCore::::isEmpty):
557         (KXMLCore::::begin):
558         (KXMLCore::::end):
559         (KXMLCore::::find):
560         (KXMLCore::::contains):
561         (KXMLCore::::insert):
562         (KXMLCore::::remove):
563         (KXMLCore::::clear):
564         * kxmlcore/HashTable.cpp: Added.
565         (KXMLCore::HashTableStats::~HashTableStats):
566         (KXMLCore::HashTableStats::recordCollisionAtCount):
567         * kxmlcore/HashTable.h: Added.
568         (KXMLCore::HashTableIterator::skipEmptyBuckets):
569         (KXMLCore::HashTableIterator::HashTableIterator):
570         (KXMLCore::HashTableIterator::operator*):
571         (KXMLCore::HashTableIterator::operator->):
572         (KXMLCore::HashTableIterator::operator++):
573         (KXMLCore::HashTableIterator::operator==):
574         (KXMLCore::HashTableIterator::operator!=):
575         (KXMLCore::HashTableConstIterator::HashTableConstIterator):
576         (KXMLCore::HashTableConstIterator::operator*):
577         (KXMLCore::HashTableConstIterator::operator->):
578         (KXMLCore::HashTableConstIterator::skipEmptyBuckets):
579         (KXMLCore::HashTableConstIterator::operator++):
580         (KXMLCore::HashTableConstIterator::operator==):
581         (KXMLCore::HashTableConstIterator::operator!=):
582         (KXMLCore::HashTable::HashTable):
583         (KXMLCore::HashTable::~HashTable):
584         (KXMLCore::HashTable::begin):
585         (KXMLCore::HashTable::end):
586         (KXMLCore::HashTable::size):
587         (KXMLCore::HashTable::capacity):
588         (KXMLCore::HashTable::insert):
589         (KXMLCore::HashTable::isEmptyBucket):
590         (KXMLCore::HashTable::isDeletedBucket):
591         (KXMLCore::HashTable::isEmptyOrDeletedBucket):
592         (KXMLCore::HashTable::hash):
593         (KXMLCore::HashTable::equal):
594         (KXMLCore::HashTable::identityConvert):
595         (KXMLCore::HashTable::extractKey):
596         (KXMLCore::HashTable::lookup):
597         (KXMLCore::HashTable::shouldExpand):
598         (KXMLCore::HashTable::mustRehashInPlace):
599         (KXMLCore::HashTable::shouldShrink):
600         (KXMLCore::HashTable::shrink):
601         (KXMLCore::HashTable::clearBucket):
602         (KXMLCore::HashTable::deleteBucket):
603         (KXMLCore::HashTable::makeLookupResult):
604         (KXMLCore::HashTable::makeIterator):
605         (KXMLCore::HashTable::makeConstIterator):
606         (KXMLCore::::lookup):
607         (KXMLCore::::insert):
608         (KXMLCore::::reinsert):
609         (KXMLCore::::find):
610         (KXMLCore::::contains):
611         (KXMLCore::::remove):
612         (KXMLCore::::allocateTable):
613         (KXMLCore::::expand):
614         (KXMLCore::::rehash):
615         (KXMLCore::::clear):
616         (KXMLCore::::HashTable):
617         (KXMLCore::::swap):
618         (KXMLCore::::operator):
619         (KXMLCore::::checkTableConsistency):
620         (KXMLCore::::checkTableConsistencyExceptSize):
621         * kxmlcore/HashTraits.h: Added.
622         (KXMLCore::HashTraits::emptyValue):
623         (KXMLCore::):
624         (KXMLCore::PairHashTraits::emptyValue):
625         (KXMLCore::PairHashTraits::deletedValue):
626
627 2005-09-27  Darin Adler  <darin@apple.com>
628
629         Reviewed by Maciej.
630
631         - update grammar to fix conflicts; fixes one of our test cases
632           because it resolves the relationship between function expressions
633           and declarations in the way required by the ECMA specification
634
635         * kjs/grammar.y: Added lots of new grammar rules so we have no conflicts.
636         A new set of rules for "no bracket or function at start of expression" and
637         another set of rules for "no in anywhere in expression". Also simplified the
638         handling of try to use only a single node and used operator precedence to
639         get rid of the conflict in handling of if and else. Also used a macro to
640         streamline the handling of automatic semicolons and changed parenthesis
641         handling to use a virtual function.
642
643         * kjs/nodes.h: Added nodeInsideAllParens, removed unused abortStatement.
644         (KJS::TryNode::TryNode): Updated to hold catch and finally blocks directly instead
645         of using a special node for each.
646         * kjs/nodes.cpp:
647         (Node::createErrorCompletion): Added. Used instead of throwError when creating errors
648         that should not be in a completion rather than an ExecState.
649         (Node::throwUndefinedVariableError): Added. Sets source location unlike the call it
650         replaces.
651         (Node::nodeInsideAllParens): Added.
652         (GroupNode::nodeInsideAllParens): Added.
653         (StatListNode::execute): Removed code to move exceptions into completion objects;
654         that's now done solely by the KJS_CHECKEXCEPTION macro.
655         (TryNode::execute): Include execution of catch and finally here rather than using
656         separate nodes.
657         (FuncDeclNode::execute): Moved here, no longer inline.
658         * kjs/nodes2string.cpp:
659         (TryNode::streamTo): Updated for change.
660         (FuncDeclNode::streamTo): Ditto.
661         (FuncExprNode::streamTo): Ditto.
662
663         * kjs/kjs-test: Removed. Was part of "make check".
664         * kjs/kjs-test.chk: Ditto.
665         * kjs/test.js: Ditto.
666
667         * tests/mozilla/expected.html: Updated because one more test succeeds.
668
669 2005-09-27  Adele Peterson  <adele@apple.com>
670
671         Reviewed by Maciej.
672
673         Changed ints to size_t where appropriate.
674
675         * kjs/collector.cpp:
676         (KJS::Collector::allocate):
677         (KJS::Collector::markStackObjectsConservatively):
678         (KJS::Collector::collect):
679         (KJS::Collector::size):
680         (KJS::Collector::numInterpreters):
681         (KJS::Collector::numGCNotAllowedObjects):
682         (KJS::Collector::numReferencedObjects):
683         * kjs/collector.h:
684
685 2005-09-27  Eric Seidel  <eseidel@apple.com>
686
687         Reviewed by kevin.
688
689         * JavaScriptCore.xcodeproj/project.pbxproj: fix after malloc changes.
690
691 2005-09-27  Eric Seidel  <eseidel@apple.com>
692
693         Reviewed by mjs.
694
695         * kjs/nodes.cpp:
696         (FuncExprNode::evaluate): Now sets .constructor properly.
697         Test cases added to WebCore/layout-tests.
698         http://bugzilla.opendarwin.org/show_bug.cgi?id=3537
699
700 2005-09-26  Maciej Stachowiak  <mjs@apple.com>
701
702         Reviewed by John.
703
704         - replace dlmalloc with tcmalloc
705         http://bugzilla.opendarwin.org/show_bug.cgi?id=5145
706
707         I also moved SharedPtr and the assertion code from WebCore into a
708         new kxmlcore directory.
709         
710         * JavaScriptCore.xcodeproj/project.pbxproj:
711         * kjs/collector.cpp:
712         (KJS::Collector::allocate):
713         (KJS::Collector::collect):
714         * kjs/config.h:
715         * kjs/fast_malloc.cpp: Removed.
716         * kjs/fast_malloc.h: Removed.
717         * kjs/function.cpp:
718         * kjs/function.h:
719         * kjs/function_object.cpp:
720         * kjs/identifier.cpp:
721         (KJS::Identifier::add):
722         * kjs/internal.cpp:
723         * kjs/internal.h:
724         * kjs/nodes.h:
725         * kjs/nodes2string.cpp:
726         * kjs/property_map.cpp:
727         (KJS::PropertyMap::~PropertyMap):
728         (KJS::PropertyMap::rehash):
729         * kjs/scope_chain.h:
730         * kjs/shared_ptr.h: Removed.
731         * kjs/string_object.cpp:
732         (StringObjectFuncImp::callAsFunction):
733         * kjs/ustring.cpp:
734         (KJS::UString::Rep::createCopying):
735         (KJS::UString::Rep::destroy):
736         (KJS::UString::expandCapacity):
737         (KJS::UString::expandPreCapacity):
738         (KJS::UString::UString):
739         (KJS::UString::spliceSubstringsWithSeparators):
740         (KJS::UString::append):
741         (KJS::UString::operator=):
742         (KJS::UString::detach):
743         * kjs/ustring.h:
744         * kxmlcore/Assertions.h: Added.
745         * kxmlcore/Assertions.mm: Added.
746         * kxmlcore/FastMalloc.cpp: Added.
747         (KXMLCore::LgFloor):
748         (KXMLCore::SizeClass):
749         (KXMLCore::ByteSizeForClass):
750         (KXMLCore::InitSizeClasses):
751         (KXMLCore::MetaDataAlloc):
752         (KXMLCore::PageHeapAllocator::Init):
753         (KXMLCore::PageHeapAllocator::New):
754         (KXMLCore::PageHeapAllocator::Delete):
755         (KXMLCore::PageHeapAllocator::inuse):
756         (KXMLCore::pages):
757         (KXMLCore::AllocationSize):
758         (KXMLCore::Event):
759         (KXMLCore::NewSpan):
760         (KXMLCore::DeleteSpan):
761         (KXMLCore::DLL_Init):
762         (KXMLCore::DLL_Remove):
763         (KXMLCore::DLL_IsEmpty):
764         (KXMLCore::DLL_Length):
765         (KXMLCore::DLL_Print):
766         (KXMLCore::DLL_Prepend):
767         (KXMLCore::DLL_InsertOrdered):
768         (KXMLCore::):
769         (KXMLCore::TCMalloc_PageHeap::GetDescriptor):
770         (KXMLCore::TCMalloc_PageHeap::SystemBytes):
771         (KXMLCore::TCMalloc_PageHeap::FreeBytes):
772         (KXMLCore::TCMalloc_PageHeap::RecordSpan):
773         (KXMLCore::TCMalloc_PageHeap::TCMalloc_PageHeap):
774         (KXMLCore::TCMalloc_PageHeap::New):
775         (KXMLCore::TCMalloc_PageHeap::Split):
776         (KXMLCore::TCMalloc_PageHeap::Carve):
777         (KXMLCore::TCMalloc_PageHeap::Delete):
778         (KXMLCore::TCMalloc_PageHeap::RegisterSizeClass):
779         (KXMLCore::TCMalloc_PageHeap::Dump):
780         (KXMLCore::TCMalloc_PageHeap::GrowHeap):
781         (KXMLCore::TCMalloc_PageHeap::Check):
782         (KXMLCore::TCMalloc_PageHeap::CheckList):
783         (KXMLCore::TCMalloc_ThreadCache_FreeList::Init):
784         (KXMLCore::TCMalloc_ThreadCache_FreeList::length):
785         (KXMLCore::TCMalloc_ThreadCache_FreeList::empty):
786         (KXMLCore::TCMalloc_ThreadCache_FreeList::lowwatermark):
787         (KXMLCore::TCMalloc_ThreadCache_FreeList::clear_lowwatermark):
788         (KXMLCore::TCMalloc_ThreadCache_FreeList::Push):
789         (KXMLCore::TCMalloc_ThreadCache_FreeList::Pop):
790         (KXMLCore::TCMalloc_ThreadCache::freelist_length):
791         (KXMLCore::TCMalloc_ThreadCache::Size):
792         (KXMLCore::TCMalloc_Central_FreeList::length):
793         (KXMLCore::TCMalloc_Central_FreeList::Init):
794         (KXMLCore::TCMalloc_Central_FreeList::Insert):
795         (KXMLCore::TCMalloc_Central_FreeList::Remove):
796         (KXMLCore::TCMalloc_Central_FreeList::Populate):
797         (KXMLCore::TCMalloc_ThreadCache::SampleAllocation):
798         (KXMLCore::TCMalloc_ThreadCache::Init):
799         (KXMLCore::TCMalloc_ThreadCache::Cleanup):
800         (KXMLCore::TCMalloc_ThreadCache::Allocate):
801         (KXMLCore::TCMalloc_ThreadCache::Deallocate):
802         (KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
803         (KXMLCore::TCMalloc_ThreadCache::ReleaseToCentralCache):
804         (KXMLCore::TCMalloc_ThreadCache::Scavenge):
805         (KXMLCore::TCMalloc_ThreadCache::GetCache):
806         (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
807         (KXMLCore::TCMalloc_ThreadCache::PickNextSample):
808         (KXMLCore::TCMalloc_ThreadCache::InitModule):
809         (KXMLCore::TCMalloc_ThreadCache::InitTSD):
810         (KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
811         (KXMLCore::TCMalloc_ThreadCache::DeleteCache):
812         (KXMLCore::TCMalloc_ThreadCache::RecomputeThreadCacheSize):
813         (KXMLCore::TCMalloc_ThreadCache::Print):
814         (KXMLCore::ExtractStats):
815         (KXMLCore::DumpStats):
816         (KXMLCore::PrintStats):
817         (KXMLCore::DumpStackTraces):
818         (KXMLCore::TCMallocImplementation::GetStats):
819         (KXMLCore::TCMallocImplementation::ReadStackTraces):
820         (KXMLCore::TCMallocImplementation::GetNumericProperty):
821         (KXMLCore::TCMallocImplementation::SetNumericProperty):
822         (KXMLCore::DoSampledAllocation):
823         (KXMLCore::do_malloc):
824         (KXMLCore::do_free):
825         (KXMLCore::do_memalign):
826         (KXMLCore::TCMallocGuard::TCMallocGuard):
827         (KXMLCore::TCMallocGuard::~TCMallocGuard):
828         (KXMLCore::malloc):
829         (KXMLCore::free):
830         (KXMLCore::calloc):
831         (KXMLCore::cfree):
832         (KXMLCore::realloc):
833         (KXMLCore::memalign):
834         (KXMLCore::posix_memalign):
835         (KXMLCore::valloc):
836         (KXMLCore::pvalloc):
837         (KXMLCore::malloc_stats):
838         (KXMLCore::mallopt):
839         (KXMLCore::mallinfo):
840         * kxmlcore/FastMalloc.h: Added.
841         (KXMLCore::FastAllocated::operator new):
842         (KXMLCore::FastAllocated::operator delete):
843         (KXMLCore::FastAllocated::operator new[]):
844         (KXMLCore::FastAllocated::operator delete[]):
845         * kxmlcore/SharedPtr.h: Added.
846         (KXMLCore::SharedPtr::SharedPtr):
847         (KXMLCore::SharedPtr::~SharedPtr):
848         (KXMLCore::SharedPtr::isNull):
849         (KXMLCore::SharedPtr::notNull):
850         (KXMLCore::SharedPtr::reset):
851         (KXMLCore::SharedPtr::get):
852         (KXMLCore::SharedPtr::operator*):
853         (KXMLCore::SharedPtr::operator->):
854         (KXMLCore::SharedPtr::operator!):
855         (KXMLCore::SharedPtr::operator bool):
856         (KXMLCore::::operator):
857         (KXMLCore::operator==):
858         (KXMLCore::operator!=):
859         (KXMLCore::static_pointer_cast):
860         (KXMLCore::const_pointer_cast):
861         * kxmlcore/TCPageMap.h: Added.
862         (TCMalloc_PageMap1::TCMalloc_PageMap1):
863         (TCMalloc_PageMap1::Ensure):
864         (TCMalloc_PageMap1::get):
865         (TCMalloc_PageMap1::set):
866         (TCMalloc_PageMap2::TCMalloc_PageMap2):
867         (TCMalloc_PageMap2::get):
868         (TCMalloc_PageMap2::set):
869         (TCMalloc_PageMap2::Ensure):
870         (TCMalloc_PageMap3::NewNode):
871         (TCMalloc_PageMap3::TCMalloc_PageMap3):
872         (TCMalloc_PageMap3::get):
873         (TCMalloc_PageMap3::set):
874         (TCMalloc_PageMap3::Ensure):
875         * kxmlcore/TCSpinLock.h: Added.
876         (TCMalloc_SpinLock::Init):
877         (TCMalloc_SpinLock::Finalize):
878         (TCMalloc_SpinLock::Lock):
879         (TCMalloc_SpinLock::Unlock):
880         (TCMalloc_SlowLock):
881         (TCMalloc_SpinLockHolder::TCMalloc_SpinLockHolder):
882         (TCMalloc_SpinLockHolder::~TCMalloc_SpinLockHolder):
883         * kxmlcore/TCSystemAlloc.cpp: Added.
884         (TrySbrk):
885         (TryMmap):
886         (TryDevMem):
887         (TCMalloc_SystemAlloc):
888         * kxmlcore/TCSystemAlloc.h: Added.
889
890 2005-09-23  Maciej Stachowiak  <mjs@apple.com>
891
892         Reviewed by Darin.
893
894         <rdar://problem/4260479> Finish deploying PropertySlot in the interpreter
895         http://bugzilla.opendarwin.org/show_bug.cgi?id=5112
896         
897         Convert postfix, prefix, delete, prefix, and for..in expressions to use
898         PropertySlot-based lookup instead of evaluateReference.
899
900         3% speedup on JS iBench.
901
902         Fixed two of the JS tests:
903         * tests/mozilla/expected.html:
904
905         * kjs/grammar.y:
906         * kjs/nodes.cpp:
907         (PostfixResolveNode::evaluate):
908         (PostfixBracketNode::evaluate):
909         (PostfixDotNode::evaluate):
910         (DeleteResolveNode::evaluate):
911         (DeleteBracketNode::evaluate):
912         (DeleteDotNode::evaluate):
913         (DeleteValueNode::evaluate):
914         (typeStringForValue):
915         (TypeOfResolveNode::evaluate):
916         (TypeOfValueNode::evaluate):
917         (PrefixResolveNode::evaluate):
918         (PrefixBracketNode::evaluate):
919         (PrefixDotNode::evaluate):
920         (ForInNode::execute):
921         * kjs/nodes.h:
922         (KJS::PostfixResolveNode::PostfixResolveNode):
923         (KJS::PostfixBracketNode::PostfixBracketNode):
924         (KJS::PostfixDotNode::PostfixDotNode):
925         (KJS::DeleteResolveNode::DeleteResolveNode):
926         (KJS::DeleteBracketNode::DeleteBracketNode):
927         (KJS::DeleteDotNode::DeleteDotNode):
928         (KJS::DeleteValueNode::DeleteValueNode):
929         (KJS::TypeOfResolveNode::TypeOfResolveNode):
930         (KJS::TypeOfValueNode::TypeOfValueNode):
931         (KJS::PrefixResolveNode::PrefixResolveNode):
932         (KJS::PrefixBracketNode::PrefixBracketNode):
933         (KJS::PrefixDotNode::PrefixDotNode):
934         * kjs/nodes2string.cpp:
935         (PostfixResolveNode::streamTo):
936         (PostfixBracketNode::streamTo):
937         (PostfixDotNode::streamTo):
938         (DeleteResolveNode::streamTo):
939         (DeleteBracketNode::streamTo):
940         (DeleteDotNode::streamTo):
941         (DeleteValueNode::streamTo):
942         (TypeOfValueNode::streamTo):
943         (TypeOfResolveNode::streamTo):
944         (PrefixResolveNode::streamTo):
945         (PrefixBracketNode::streamTo):
946         (PrefixDotNode::streamTo):
947         * kjs/reference.cpp:
948         (KJS::Reference::Reference):
949         (KJS::Reference::getPropertyName):
950         (KJS::Reference::getValue):
951         (KJS::Reference::deleteValue):
952         * kjs/reference.h:
953
954 2005-09-23  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
955
956         Reviewed and landed by Darin.
957
958         - a Windows-specific file
959
960         * os-win32/stdint.h: Added. We plan to remove dependency on the <stdint.h> types,
961         and if we do so, we will remove this file.
962
963 2005-09-22  Geoffrey Garen  <ggaren@apple.com>
964
965         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5053
966         Need to restore int/long changes to simple_number.h
967         
968         Reviewed by darin and mjs.
969
970         * kjs/simple_number.h: changed enums to indenpendent constants to clarify types
971         (KJS::isNegativeZero): changed to static function - no reason to export
972         (KJS::SimpleNumber::rightShiftSignExtended): new function for clarity
973         (KJS::SimpleNumber::make): specified cast as reinterpret_cast
974         (KJS::SimpleNumber::is): changed to use uintptr_t for portability
975         (KJS::SimpleNumber::value): changed to use uintptr_t and rightShiftSignExtended
976         (KJS::SimpleNumber::fits): inverted tests - probably only a performance win for double
977         (KJS::SimpleNumber::integerFits): ditto
978
979 2005-09-20  Maciej Stachowiak  <mjs@apple.com>
980
981         Reviewed by Geoff and partly by Darin.
982
983         - fixed http://bugzilla.opendarwin.org/post_bug.cgi
984         (Reduce conflicts in JavaScriptCore grammar)
985
986         This change gets us down from over 200 shift/reduce and 45 reduce/reduce to
987         9 shift/reduce and 45 reduce/reduce.
988
989         * kjs/grammar.y:
990         * kjs/grammar_types.h: Removed.
991         * kjs/lexer.cpp:
992         * kjs/nodes.h:
993         (KJS::Node::isGroupNode):
994         (KJS::Node::isLocation):
995         (KJS::Node::isResolveNode):
996         (KJS::Node::isBracketAccessorNode):
997         (KJS::Node::isDotAccessorNode):
998         (KJS::ResolveNode::isLocation):
999         (KJS::ResolveNode::isResolveNode):
1000         (KJS::ResolveNode::identifier):
1001         (KJS::GroupNode::isGroupNode):
1002         (KJS::GroupNode::leafNode):
1003         (KJS::BracketAccessorNode::isLocation):
1004         (KJS::BracketAccessorNode::isBracketAccessorNode):
1005         (KJS::BracketAccessorNode::base):
1006         (KJS::BracketAccessorNode::subscript):
1007         (KJS::DotAccessorNode::isLocation):
1008         (KJS::DotAccessorNode::isDotAccessorNode):
1009         (KJS::DotAccessorNode::base):
1010         (KJS::DotAccessorNode::identifier):
1011         (KJS::FuncExprNode::FuncExprNode):
1012         (KJS::FuncExprNode::identifier):
1013         (KJS::FuncDeclNode::FuncDeclNode):
1014         (KJS::FuncDeclNode::execute):
1015
1016 2005-09-20  Geoffrey Garen  <ggaren@apple.com>
1017
1018         - Oops. The 4263434 change was only appropriate on the branch. Rolling out.
1019         
1020         Reviewed by eric.
1021         
1022         * kjs/internal.cpp:
1023         (KJS::InterpreterImp::mark):
1024
1025 2005-09-20  Geoffrey Garen  <ggaren@apple.com>
1026
1027         - More changes needed to fix <rdar://problem/4214783> 8F29 REGRESSION(Denver/Chardonnay):
1028           kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in
1029           the installer)
1030           
1031         Added InterpreterLocks in some places in the bindings we missed before.
1032         
1033         Reviewed by john.
1034
1035         * bindings/runtime_root.cpp:
1036         (KJS::Bindings::addNativeReference):
1037         (KJS::Bindings::removeNativeReference):
1038         (RootObject::removeAllNativeReferences):
1039         * bindings/runtime_root.h:
1040         (KJS::Bindings::RootObject::~RootObject):
1041         (KJS::Bindings::RootObject::setRootObjectImp):
1042
1043 2005-09-20  Geoffrey Garen  <ggaren@apple.com>
1044
1045         - Fixed <rdar://problem/4263434> <rdar://problem/4263434> Denver 8F29 Regression:
1046           KJS::InterpreterImp::mark() crash
1047           
1048         Fix by mjs, review by me.
1049
1050         * kjs/internal.cpp:
1051         (KJS::InterpreterImp::mark): Added a null check on globExec in case a
1052         garbage collection occurs inside InterpreterImp::globalInit (called
1053         from InterpreterImp::InterpreterImp), at which point globExec has not yet been initialized.
1054
1055 2005-09-20  Geoffrey Garen  <ggaren@apple.com>
1056
1057         - Rolled in fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=4892
1058           Date constructor has problems with months larger than 11
1059
1060         Test cases added:
1061
1062         * layout-tests/fast/js/date-big-constructor-expected.txt: Added.
1063         * layout-tests/fast/js/date-big-constructor.html: Added.
1064
1065         Reviewed by darin.
1066
1067         * kjs/date_object.cpp:
1068         (KJS::fillStructuresUsingDateArgs):
1069         (KJS::makeTime):
1070
1071 2005-09-19  Geoffrey Garen  <ggaren@apple.com>
1072
1073         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5028
1074           9 layout tests fail following the change from long to int
1075           
1076         - Rolled out changes to simple_number.h, and added fits(long long) 
1077           and SimpleNumber::fits(unsigned long long) to the old system.
1078         
1079         Reviewed by mjs.
1080
1081         * kjs/simple_number.h:
1082         (KJS::SimpleNumber::):
1083         (KJS::SimpleNumber::value):
1084         (KJS::SimpleNumber::fits):
1085         (KJS::SimpleNumber::integerFits):
1086         (KJS::SimpleNumber::make):
1087
1088 2005-09-14  Maciej Stachowiak  <mjs@apple.com>
1089
1090         Reviewed by Geoff.
1091
1092         - fixed <rdar://problem/4214783> REGRESSION: kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in the installer)
1093
1094         Make sure to lock using the InterpreterLock class in all places that need it
1095         (including anything that uses the collector, the parser, the protect count hash table,
1096         and anything that allocates via fast_malloc).
1097
1098         Also added assertions to ensure that the locking rules are followed for the relevant
1099         resources.
1100
1101         * Makefile.am:
1102         * bindings/NP_jsobject.cpp:
1103         (identifierFromNPIdentifier):
1104         (_NPN_Invoke):
1105         (_NPN_Evaluate):
1106         (_NPN_GetProperty):
1107         (_NPN_SetProperty):
1108         (_NPN_RemoveProperty):
1109         (_NPN_HasProperty):
1110         (_NPN_HasMethod):
1111         (_NPN_SetException):
1112         * bindings/jni/jni_jsobject.cpp:
1113         (JSObject::call):
1114         (JSObject::eval):
1115         (JSObject::getMember):
1116         (JSObject::setMember):
1117         (JSObject::removeMember):
1118         (JSObject::getSlot):
1119         (JSObject::setSlot):
1120         (JSObject::toString):
1121         (JSObject::convertJObjectToValue):
1122         * bindings/objc/WebScriptObject.mm:
1123         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1124         (-[WebScriptObject evaluateWebScript:]):
1125         (-[WebScriptObject setValue:forKey:]):
1126         (-[WebScriptObject valueForKey:]):
1127         (-[WebScriptObject removeWebScriptKey:]):
1128         (-[WebScriptObject stringRepresentation]):
1129         (-[WebScriptObject webScriptValueAtIndex:]):
1130         (-[WebScriptObject setWebScriptValueAtIndex:value:]):
1131         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
1132         * bindings/runtime.cpp:
1133         (Instance::createRuntimeObject):
1134         * bindings/runtime_root.h:
1135         * bindings/testbindings.cpp:
1136         (main):
1137         * bindings/testbindings.mm:
1138         (main):
1139         * kjs/fast_malloc.cpp:
1140         (KJS::kjs_fast_malloc):
1141         (KJS::kjs_fast_calloc):
1142         (KJS::kjs_fast_free):
1143         (KJS::kjs_fast_realloc):
1144         * kjs/fast_malloc.h:
1145         * kjs/identifier.h:
1146         * kjs/internal.cpp:
1147         (InterpreterImp::InterpreterImp):
1148         (InterpreterImp::clear):
1149         (InterpreterImp::mark):
1150         (InterpreterImp::checkSyntax):
1151         (InterpreterImp::evaluate):
1152         * kjs/internal.h:
1153         (KJS::InterpreterImp::globalObject):
1154         * kjs/interpreter.cpp:
1155         (Interpreter::evaluate):
1156         * kjs/interpreter.h:
1157         (KJS::InterpreterLock::InterpreterLock):
1158         (KJS::InterpreterLock::~InterpreterLock):
1159         * kjs/nodes.h:
1160         * kjs/protect.h:
1161         (KJS::ProtectedValue::ProtectedValue):
1162         (KJS::ProtectedValue::~ProtectedValue):
1163         (KJS::ProtectedValue::operator=):
1164         (KJS::ProtectedObject::ProtectedObject):
1165         (KJS::ProtectedObject::~ProtectedObject):
1166         (KJS::ProtectedObject::operator=):
1167         (KJS::ProtectedReference::ProtectedReference):
1168         (KJS::ProtectedReference::~ProtectedReference):
1169         (KJS::ProtectedReference::operator=):
1170         * kjs/protected_object.h:
1171         * kjs/protected_values.cpp:
1172         (KJS::ProtectedValues::getProtectCount):
1173         (KJS::ProtectedValues::increaseProtectCount):
1174         (KJS::ProtectedValues::decreaseProtectCount):
1175         * kjs/string_object.cpp:
1176         (StringObjectImp::StringObjectImp):
1177         * kjs/testkjs.cpp:
1178         (main):
1179
1180 2005-09-16  Adele Peterson  <adele@apple.com>
1181
1182         Change by Darin, reviewed by me and Maciej.
1183
1184         Fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=4547
1185         use int instead of long for 32-bit (to prepare for LP64 compiling)
1186
1187         * bindings/c/c_class.h:
1188         (KJS::Bindings::CClass::constructorAt):
1189         (KJS::Bindings::CClass::numConstructors):
1190         * bindings/c/c_runtime.h:
1191         (KJS::Bindings::CMethod::numParameters):
1192         * bindings/jni/jni_class.cpp:
1193         (JavaClass::JavaClass):
1194         * bindings/jni/jni_class.h:
1195         (KJS::Bindings::JavaClass::constructorAt):
1196         (KJS::Bindings::JavaClass::numConstructors):
1197         * bindings/jni/jni_instance.cpp:
1198         (JavaInstance::invokeMethod):
1199         * bindings/jni/jni_jsobject.cpp:
1200         (JSObject::convertJObjectToValue):
1201         (JSObject::listFromJArray):
1202         * bindings/jni/jni_runtime.cpp:
1203         (JavaMethod::JavaMethod):
1204         * bindings/jni/jni_runtime.h:
1205         (KJS::Bindings::JavaConstructor::_commonCopy):
1206         (KJS::Bindings::JavaConstructor::parameterAt):
1207         (KJS::Bindings::JavaConstructor::numParameters):
1208         (KJS::Bindings::JavaMethod::_commonCopy):
1209         (KJS::Bindings::JavaMethod::parameterAt):
1210         (KJS::Bindings::JavaMethod::numParameters):
1211         * bindings/npapi.h:
1212         * bindings/objc/WebScriptObject.mm:
1213         (listFromNSArray):
1214         * bindings/objc/objc_class.h:
1215         (KJS::Bindings::ObjcClass::constructorAt):
1216         (KJS::Bindings::ObjcClass::numConstructors):
1217         * bindings/objc/objc_instance.h:
1218         * bindings/objc/objc_runtime.h:
1219         * bindings/objc/objc_runtime.mm:
1220         (ObjcMethod::numParameters):
1221         * bindings/runtime.h:
1222         * kjs/identifier.h:
1223         * kjs/internal.h:
1224         * kjs/property_slot.h:
1225         (KJS::PropertySlot::setCustomIndex):
1226         (KJS::PropertySlot::index):
1227         (KJS::PropertySlot::):
1228         * kjs/regexp_object.cpp:
1229         (RegExpObjectImp::backrefGetter):
1230         (RegExpObjectImp::getOwnPropertySlot):
1231         * kjs/simple_number.h:
1232         (KJS::SimpleNumber::):
1233         (KJS::SimpleNumber::value):
1234         (KJS::SimpleNumber::fits):
1235         (KJS::SimpleNumber::integerFits):
1236         (KJS::SimpleNumber::make):
1237         * kjs/string_object.cpp:
1238         (substituteBackreferences):
1239         * kjs/ustring.cpp:
1240         (KJS::UString::from):
1241         (KJS::UString::toUInt32):
1242         (KJS::UString::find):
1243         (KJS::UString::rfind):
1244         * kjs/ustring.h:
1245         * kjs/value.cpp:
1246         (KJS::jsNumber):
1247         * kjs/value.h:
1248
1249 2005-09-11  Eric Seidel  <eseidel@apple.com>
1250
1251         No review requested, build fix affects only SVG.
1252
1253         * JavaScriptCore.xcodeproj/project.pbxproj: Fixed JSC+SVG
1254         Fixed JavaScriptCore+SVG after PCRE 6.1 merger.
1255         http://bugzilla.opendarwin.org/show_bug.cgi?id=4932
1256
1257 2005-09-10  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
1258
1259         Reviewed and landed by Darin.
1260
1261         * Makefile.vc: Added.
1262         * README-Win32.txt: Added.
1263
1264 2005-09-10  Darin Adler  <darin@apple.com>
1265
1266         - fixed compilation for WebCore (another try)
1267
1268         * kjs/simple_number.h: Added more "using" lines.
1269
1270 2005-09-10  Darin Adler  <darin@apple.com>
1271
1272         - fixed compilation for WebCore
1273
1274         * kjs/simple_number.h: Have to include <cmath> here to work around a bug in the GCC
1275         standard C++ library headers.
1276
1277 2005-09-10  Darin Adler  <darin@apple.com>
1278
1279         Windows changes by Krzysztof Kowalczyk <kkowalczyk@gmail.com>.
1280
1281         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4870
1282           win portability: fix IS_NEGATIVE_ZERO macro in simple_number.h
1283
1284         * kjs/simple_number.h:
1285         (KJS::isNegativeZero): Added. Inline function. Has a case for Windows that
1286         uses _fpclass and a case for other platforms that uses signbit.
1287         (KJS::SimpleNumber::fits): Use inline isNegativeZero instead of macro IS_NEGATIVE_ZERO.
1288
1289         * kjs/internal.cpp: Remove definition of now-unneeded negZero global.
1290
1291         * kjs/value.cpp: Touched the file because Xcode didn't know it needed to
1292         recompile it.
1293
1294         - improved test engine
1295
1296         * tests/mozilla/jsDriver.pl: Sort tests in numeric order instead of using
1297         a plain-ASCII sort; now test 33 will be after test 5 in any given set of
1298         numbered tests.
1299
1300 2005-09-08  Darin Adler  <darin@apple.com>
1301
1302         - fixed overloaded versions of throwError so that they substitute *all* 
1303           expected parameters into the message string -- some versions used to
1304           skip parameters, resulting in "%s" being printed in the error message.
1305         
1306         Reviewed by Geoff.
1307
1308         * kjs/nodes.h: Updated declarations to use "const &" and not to name parameters
1309         * kjs/nodes.cpp: (Node::throwError): Updated to match above and add one missing
1310         call to substitute.
1311
1312 2005-09-08  Darin Adler  <darin@apple.com>
1313
1314         Reviewed by Geoff.
1315
1316         - updated to PCRE 6.1
1317
1318         The original PCRE 6.1 sources are checked into the tree with the tag
1319         "pcre-6-1" for reference. What we're checking in right now is the original
1320         plus our changes to make it support UTF-16 and at least one other tweak
1321         (vertical tab considered whitespace). Our work to get our changes was
1322         done on "pcre-6-1-branch", with an anchor at "pcre-6-1-anchor" so you can
1323         see the evolution of the UTF-16 changes.
1324         
1325         Note also that there was one small change made here that's not on the branch
1326         in pcre_compile.c.
1327
1328         * Info.plist: Updated the part of the copyright message that's about PCRE.
1329
1330         * JavaScriptCore.xcodeproj/project.pbxproj: Added new PCRE source files,
1331         removed obsolete ones.
1332
1333         * pcre/AUTHORS: Updated to PCRE 6.1. Includes credits for Apple's UTF-16
1334         changes, but not the credits for Google's C++ wrapper, since we don't include that.
1335         * pcre/COPYING: Updated to PCRE 6.1.
1336         * pcre/LICENCE: Ditto.
1337         * pcre/dftables.c: Ditto.
1338         * pcre/pcre-config.h: Ditto.
1339         * pcre/pcre.h: Ditto.
1340
1341         * pcre/pcre_compile.c: Added for PCRE 6.1.
1342         * pcre/pcre_config.c: Ditto.
1343         * pcre/pcre_exec.c: Ditto.
1344         * pcre/pcre_fullinfo.c: Ditto.
1345         * pcre/pcre_get.c: Ditto.
1346         * pcre/pcre_globals.c: Ditto.
1347         * pcre/pcre_info.c: Ditto.
1348         * pcre/pcre_internal.h: Ditto.
1349         * pcre/pcre_maketables.c: Ditto.
1350         * pcre/pcre_ord2utf8.c: Ditto.
1351         * pcre/pcre_printint.c: Ditto.
1352         * pcre/pcre_refcount.c: Ditto.
1353         * pcre/pcre_study.c: Ditto.
1354         * pcre/pcre_tables.c: Ditto.
1355         * pcre/pcre_try_flipped.c: Ditto.
1356         * pcre/pcre_ucp_findchar.c: Ditto.
1357         * pcre/pcre_version.c: Ditto.
1358         * pcre/pcre_xclass.c: Ditto.
1359         * pcre/ucp.h: Ditto.
1360         * pcre/ucp_findchar.c: Ditto.
1361         * pcre/ucpinternal.h: Ditto.
1362         * pcre/ucptable.c: Ditto.
1363
1364         * pcre/get.c: Removed.
1365         * pcre/internal.h: Removed.
1366         * pcre/maketables.c: Removed.
1367         * pcre/pcre.c: Removed.
1368         * pcre/study.c: Removed.
1369
1370 2005-09-07  Geoffrey Garen  <ggaren@apple.com>
1371
1372         -fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4781
1373         Date.setMonth fails with big values due to overflow
1374
1375         Reviewed by darin.
1376
1377         * kjs/date_object.cpp:
1378         (timetUsingCF): for consistency, changed return statement to invalidDate instead of LONG_MAX
1379         (KJS::fillStructuresUsingTimeArgs): modified for readability
1380         (KJS::fillStructuresUsingDateArgs): new function analogous to fillStructuresUsingTimeArgs
1381         (KJS::DateProtoFuncImp::callAsFunction): modified to use fillStructuresUsingDateArgs
1382         (KJS::DateObjectImp::construct): moved variable declaration to proper scope
1383         (KJS::DateObjectFuncImp::callAsFunction): moved variable declaration to proper scope
1384
1385 2005-09-07  Geoffrey Garen  <ggaren@apple.com>
1386         -updated expected test results to reflect fix for 
1387         http://bugzilla.opendarwin.org/show_bug.cgi?id=4698
1388         kjs does not allow named functions in function expressions
1389  
1390         * tests/mozilla/expected.html:
1391
1392 2005-09-04  Darin Adler  <darin@apple.com>
1393
1394         * kjs/identifier.cpp: Fix comment, add missing include.
1395         (Follow-on to changes from yesterday.)
1396
1397 2005-09-03  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
1398
1399         Reviewed, tweaked and landed by Darin.
1400
1401         - another try at some of the Windows compilation fixes
1402           should fix these bugs: 4546, 4831, 4834, 4643, 4830, 4832, 4833, 4835
1403
1404         * kjs/collector.cpp: Add missing <setjmp.h> include.
1405         * kjs/date_object.cpp: Fix broken copysign macro.
1406         * kjs/dtoa.cpp: Move macro definitions down after all header includes.
1407         * kjs/fast_malloc.cpp: Add missing <assert.h> and <stddef.h> includes.
1408         * kjs/function.cpp: Remove broken isxdigit definition.
1409         * kjs/grammar.y: Add a missing semicolon (and remove an excess one).
1410         * kjs/identifier.cpp: Turn off AVOID_STATIC_CONSTRUCTORS because the placement new syntax
1411         doesn't seem to work in Visual C++ (I'm surprised to hear that, by the way).
1412         * kjs/value.h: Made ValueImp's destructor virtual because otherwise pointers to ValueImp
1413         on the stack aren't right for garbage collection on Windows (don't think it works that
1414         way with gcc's virtual table scheme, but it's a harmless change).
1415
1416 2005-09-03  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
1417
1418         Reviewed, tweaked and landed by Darin.
1419
1420         - some Windows compilation fixes, hoping to fix the problems reported in these bugs:
1421           4627, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4639, 4640, 4641, 4644, 4645
1422
1423         * kjs/collector.cpp: Include <windows.h> on WIN32. Put thread-related code inside
1424         KJS_MULTIPLE_THREADS #if directives.
1425         (KJS::Collector::markCurrentThreadConservatively): Use NT_TIB to find the stack base on Win32.
1426
1427         * kjs/config.h: Define HAVE_SYS_TIMEB_H for Win32.
1428
1429         * kjs/date_object.cpp: Add include of <limits.h>. Add definitions of strncasecmp, isfinite, and
1430         copysign for Win32.
1431         (KJS::KRFCDate_parseDate): Move "errno = 0" line down closer to the first call to strol -- I believe
1432         that on Win32 there's some other call before that setting errno.
1433
1434         * kjs/date_object.h: Remove unneeded include of <sys/time.h>.
1435
1436         * kjs/dtoa.cpp: Add an undef of strtod, needed on Win32.
1437
1438         * kjs/fast_malloc.cpp: Put #if !WIN32 around some customization that's not appropriate on Win32.
1439         (KJS::region_list_append): Add a missing cast so this Win32-specific function compiles in C++.
1440         (KJS::sbrk): Change parameter type to match the declaration.
1441
1442         * kjs/function.cpp: (isxdigit): Define a locale-independent isxdigit on Win32.
1443
1444         * kjs/function.h: Remove unneeded friend class Function for FunctionImp.
1445
1446         * kjs/identifier.cpp: Took out the APPLE_CHANGES from around the AVOID_STATIC_CONSTRUCTORS
1447         define. We ultimately intend to phase out APPLE_CHANGES entirely. Also fix the
1448         non-AVOID_STATIC_CONSTRUCTORS code path.
1449
1450         * kjs/internal.cpp: Remove uneeded include of <strings.h>, which was confused with <string.h>!
1451         Add a Win32 implementation of copysign. Put the threads code inside KJS_MULTIPLE_THREADS.
1452
1453         * kjs/internal.h: Define a KJS_MULTIPLE_THREADS macro on non-Win32 only. Later we can make this
1454         specific to Mac OS X if we like.
1455
1456         * kjs/interpreter_map.cpp: Add missing include of <stdlib.h>.
1457
1458         * kjs/list.cpp:
1459         (KJS::ListImp::markValues): Use std::min instead of MIN.
1460         (KJS::List::copy): Ditto.
1461         (KJS::List::copyTail): Ditto.
1462
1463         * kjs/math_object.cpp: (signbit): Add a Win32 implementation of signbit.
1464
1465         * kjs/nodes.cpp: (Node::finalCheck): Use unsigned instead of uint.
1466         Put the use of always_inline inside __GNUC__.
1467
1468         * kjs/number_object.cpp: (NumberProtoFuncImp::callAsFunction): Use "10.0" instead of "10"
1469         inside all the calls to pow to avoid ambiguity caused by overloading of pow on Win32, seen
1470         when passing an int rather than a double or float.
1471
1472         * kjs/operations.cpp:
1473         (KJS::isInf): Add Win32 implementation.
1474         (KJS::isPosInf): Add Win32 implementation.
1475         (KJS::isNegInf): Add Win32 implementation.
1476
1477         * kjs/regexp.cpp: Use unsigned instead of uint.
1478         * kjs/regexp.h: Ditto.
1479         * kjs/regexp_object.cpp: Ditto.
1480         * kjs/regexp_object.h: Ditto.
1481
1482 2005-09-02  Beth Dakin  <bdakin@apple.com>
1483
1484         Fix for <rdar://problem/4235531> Denver Regression: Safari crash in KWQStringData::makeUnicode
1485         The other half of the fix is in WebCore.
1486
1487         Fix written by Maciej and Darin.
1488         Reviewed by me/Maciej
1489
1490         As Maciej said in Radar: These problems was caused by a conflict between some of our custom 
1491         allocators, causing them to return null. Symptom is typically a null pointer dereference in 
1492         a place where it might be expected an allocation has just occurred.
1493
1494         * kjs/fast_malloc.cpp:  Added #define for MORECORE_CONTIGUOUS, MORECORE_CANNOT_TRIM, 
1495                                 and MALLOC_FAILURE_ACTION.
1496
1497 2005-08-31  Geoffrey Garen  <ggaren@apple.com>
1498
1499         -rolled in fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=4698
1500         kjs does not allow named functions in function expressions
1501         
1502         Fix by Arthur Langereis.
1503         
1504         Reviewed by darin.
1505         
1506         * kjs/grammar.y:
1507         * kjs/nodes.cpp:
1508         (FuncExprNode::evaluate):
1509         * kjs/nodes.h:
1510         (KJS::FuncExprNode::FuncExprNode):
1511
1512         Test cases added:
1513
1514         * layout-tests/fast/js/named-function-expression-expected.txt: Added.
1515         * layout-tests/fast/js/named-function-expression.html: Added.
1516         
1517 2005-08-31  Justin Haygood  <justin@xiondigital.net>
1518
1519         Reviewed, tweaked, and landed by Darin.
1520
1521         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4085
1522         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4087
1523         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4096
1524           Some fixes for compiling on windows.
1525
1526         * kjs/config.h: Added a WIN32 case in here, with suitable defines.
1527         (To be tweaked as necessary.)
1528         * kjs/function.cpp: Took out APPLE_CHANGES around use of ICU.
1529         * kjs/operations.cpp: Removed some bogus code that always set HAVE_FLOAT_H.
1530
1531 2005-08-30  Darin Adler  <darin@apple.com>
1532
1533         Reviewed by John Sullivan.
1534
1535         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4758
1536           unify SharedPtr in WebCore and JavaScriptCore
1537
1538         * kjs/shared_ptr.h: Updated namespace to KXMLCore instead of kxhmlcore.
1539         Made a few small improvements to use local variables a bit more and added
1540         an "operator int" to reduce the chance that we'll convert a SharedPtr to
1541         an int by accident. Also made the == operators normal functions rather than
1542         friend functions, added a couple of comemnts.
1543
1544         * kjs/function.h: Updated for namespace change.
1545         * kjs/function.cpp: Ditto.
1546         * kjs/function_object.cpp: Ditto.
1547         * kjs/internal.h: Ditto.
1548         * kjs/internal.cpp: Ditto.
1549         * kjs/nodes.h: Ditto.
1550         * kjs/nodes2string.cpp: Ditto.
1551
1552 2005-08-26  Maciej Stachowiak  <mjs@apple.com>
1553
1554         Reviewed by John.
1555
1556         <rdar://problem/4224911> many many leaks in kjsyyparse with malformed Javascript        
1557
1558         Record all nodes that are created during parsing, and delete any
1559         that are left floating with a refcount of 0.
1560         
1561         * kjs/internal.cpp:
1562         (KJS::Parser::saveNewNode):
1563         (KJS::clearNewNodes):
1564         (KJS::Parser::parse):
1565         * kjs/internal.h:
1566         * kjs/nodes.cpp:
1567         (Node::Node):
1568         * kjs/nodes.h:
1569         (KJS::Node::refcount):
1570
1571 2005-08-26  Maciej Stachowiak  <mjs@apple.com>
1572
1573         Reviewed by John.
1574
1575         - fixed <rdar://problem/4232452> many many leaks in kjsyyparse on some well-formed JavaScript (can repro on sony.com, webkit tests)
1576         
1577         Fixed by changing the refcounting scheme for nodes. Instead of each node implementing a custom ref and
1578         deref for all its children (and being responsible for deleting them), nodes use a smart pointer to
1579         hold their children, and smart pointers are used outside the node tree as well. This change mostly
1580         removes code.
1581         
1582         * JavaScriptCore.xcodeproj/project.pbxproj:
1583         * kjs/function.cpp:
1584         (KJS::DeclaredFunctionImp::DeclaredFunctionImp):
1585         (KJS::GlobalFuncImp::callAsFunction):
1586         * kjs/function.h:
1587         * kjs/function_object.cpp:
1588         (FunctionObjectImp::construct):
1589         * kjs/grammar.y:
1590         * kjs/internal.cpp:
1591         (KJS::Parser::parse):
1592         (KJS::Parser::accept):
1593         (KJS::InterpreterImp::checkSyntax):
1594         (KJS::InterpreterImp::evaluate):
1595         * kjs/internal.h:
1596         * kjs/nodes.cpp:
1597         (Node::Node):
1598         (Node::~Node):
1599         (ElementNode::evaluate):
1600         (PropertyValueNode::evaluate):
1601         (ArgumentListNode::evaluateList):
1602         (NewExprNode::evaluate):
1603         (FunctionCallValueNode::evaluate):
1604         (FunctionCallBracketNode::evaluate):
1605         (FunctionCallDotNode::evaluate):
1606         (RelationalNode::evaluate):
1607         (StatListNode::execute):
1608         (StatListNode::processVarDecls):
1609         (VarDeclListNode::evaluate):
1610         (VarDeclListNode::processVarDecls):
1611         (ForInNode::ForInNode):
1612         (ClauseListNode::processVarDecls):
1613         (CaseBlockNode::evalBlock):
1614         (FuncDeclNode::processFuncDecl):
1615         (FuncExprNode::evaluate):
1616         (SourceElementsNode::execute):
1617         (SourceElementsNode::processFuncDecl):
1618         (SourceElementsNode::processVarDecls):
1619         * kjs/nodes.h:
1620         (KJS::Node::ref):
1621         (KJS::Node::deref):
1622         (KJS::NumberNode::NumberNode):
1623         (KJS::GroupNode::GroupNode):
1624         (KJS::ElementNode::ElementNode):
1625         (KJS::ArrayNode::ArrayNode):
1626         (KJS::PropertyValueNode::PropertyValueNode):
1627         (KJS::ObjectLiteralNode::ObjectLiteralNode):
1628         (KJS::BracketAccessorNode::BracketAccessorNode):
1629         (KJS::DotAccessorNode::DotAccessorNode):
1630         (KJS::ArgumentListNode::ArgumentListNode):
1631         (KJS::ArgumentsNode::ArgumentsNode):
1632         (KJS::NewExprNode::NewExprNode):
1633         (KJS::FunctionCallValueNode::FunctionCallValueNode):
1634         (KJS::FunctionCallResolveNode::FunctionCallResolveNode):
1635         (KJS::FunctionCallBracketNode::FunctionCallBracketNode):
1636         (KJS::FunctionCallDotNode::FunctionCallDotNode):
1637         (KJS::PostfixNode::PostfixNode):
1638         (KJS::DeleteNode::DeleteNode):
1639         (KJS::VoidNode::VoidNode):
1640         (KJS::TypeOfNode::TypeOfNode):
1641         (KJS::PrefixNode::PrefixNode):
1642         (KJS::UnaryPlusNode::UnaryPlusNode):
1643         (KJS::NegateNode::NegateNode):
1644         (KJS::BitwiseNotNode::BitwiseNotNode):
1645         (KJS::LogicalNotNode::LogicalNotNode):
1646         (KJS::MultNode::MultNode):
1647         (KJS::AddNode::AddNode):
1648         (KJS::ShiftNode::ShiftNode):
1649         (KJS::RelationalNode::RelationalNode):
1650         (KJS::EqualNode::EqualNode):
1651         (KJS::BitOperNode::BitOperNode):
1652         (KJS::BinaryLogicalNode::BinaryLogicalNode):
1653         (KJS::ConditionalNode::ConditionalNode):
1654         (KJS::AssignResolveNode::AssignResolveNode):
1655         (KJS::AssignBracketNode::AssignBracketNode):
1656         (KJS::AssignDotNode::AssignDotNode):
1657         (KJS::CommaNode::CommaNode):
1658         (KJS::AssignExprNode::AssignExprNode):
1659         (KJS::VarDeclListNode::VarDeclListNode):
1660         (KJS::VarStatementNode::VarStatementNode):
1661         (KJS::ExprStatementNode::ExprStatementNode):
1662         (KJS::IfNode::IfNode):
1663         (KJS::DoWhileNode::DoWhileNode):
1664         (KJS::WhileNode::WhileNode):
1665         (KJS::ForNode::ForNode):
1666         (KJS::ReturnNode::ReturnNode):
1667         (KJS::WithNode::WithNode):
1668         (KJS::CaseClauseNode::CaseClauseNode):
1669         (KJS::ClauseListNode::ClauseListNode):
1670         (KJS::ClauseListNode::clause):
1671         (KJS::ClauseListNode::next):
1672         (KJS::SwitchNode::SwitchNode):
1673         (KJS::LabelNode::LabelNode):
1674         (KJS::ThrowNode::ThrowNode):
1675         (KJS::CatchNode::CatchNode):
1676         (KJS::FinallyNode::FinallyNode):
1677         (KJS::TryNode::TryNode):
1678         (KJS::ParameterNode::ParameterNode):
1679         (KJS::ParameterNode::nextParam):
1680         (KJS::FuncDeclNode::FuncDeclNode):
1681         (KJS::FuncExprNode::FuncExprNode):
1682         * kjs/nodes2string.cpp:
1683         (KJS::SourceStream::operator<<):
1684         (ElementNode::streamTo):
1685         (PropertyValueNode::streamTo):
1686         (ArgumentListNode::streamTo):
1687         (StatListNode::streamTo):
1688         (VarDeclListNode::streamTo):
1689         (CaseBlockNode::streamTo):
1690         (ParameterNode::streamTo):
1691         (SourceElementsNode::streamTo):
1692         * kjs/shared_ptr.h: Added.
1693         (kxmlcore::SharedPtr::SharedPtr):
1694         (kxmlcore::SharedPtr::~SharedPtr):
1695         (kxmlcore::SharedPtr::isNull):
1696         (kxmlcore::SharedPtr::notNull):
1697         (kxmlcore::SharedPtr::reset):
1698         (kxmlcore::SharedPtr::get):
1699         (kxmlcore::SharedPtr::operator*):
1700         (kxmlcore::SharedPtr::operator->):
1701         (kxmlcore::SharedPtr::operator!):
1702         (kxmlcore::SharedPtr::operator bool):
1703         (kxmlcore::SharedPtr::operator==):
1704         (kxmlcore::::operator):
1705         (kxmlcore::operator!=):
1706         (kxmlcore::static_pointer_cast):
1707         (kxmlcore::const_pointer_cast):
1708
1709 2005-08-26  Geoff Garen  <ggaren@apple.com>
1710
1711         Reviewed by John.
1712         Landed by Darin.
1713
1714         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4664
1715           TOT Crash from backwards null check in WebScriptObject.mm
1716
1717         * bindings/objc/WebScriptObject.mm:
1718         (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
1719         Remove bogus !.
1720
1721 2005-08-25  Darin Adler  <darin@apple.com>
1722
1723         Reviewed by John Sullivan.
1724
1725         - rename KJS::UString::string() to KJS::UString::domString()
1726         - rename KJS::Identifier::string() to KJS::Identifier::domString()
1727
1728         * kjs/identifier.h: Renamed.
1729         * kjs/ustring.h: Ditto.
1730
1731 2005-08-19  Darin Adler  <darin@apple.com>
1732
1733         Reviewed by Maciej.
1734
1735         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4435
1736           speed up JavaScript by tweaking the Identifier class
1737
1738         * kjs/identifier.h: Add a new global nullIdentifier and make Identifier::null a function
1739         that returns it.
1740         * kjs/identifier.cpp: (KJS::Identifier::init): Initialize a global for the null identifier
1741         as well as all the other globals for special identifiers.
1742
1743         * kjs/ustring.h: (KJS::UString::UString): Make this empty constructor inline.
1744         * kjs/ustring.cpp: Remove the old non-inline version.
1745
1746 2005-08-19  Mitz Pettel  <opendarwin.org@mitzpettel.com>
1747
1748         Reviewed by Maciej.
1749         Revised and landed by Darin.
1750
1751         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4474
1752           REGRESSION: Crash when using in-place operator on uninitialized array element
1753
1754         * kjs/nodes.cpp:
1755         (AssignResolveNode::evaluate): Remove unneeded "isSet" assertion.
1756         (AssignBracketNode::evaluate): Replace code that tested "isSet" with code that
1757         tests the return value of getPropertySlot.
1758
1759         * kjs/property_slot.h: Removed unneeded "isSet" function. Property slots are
1760         either uninitialized or set. There's no "initialized and not set" state.
1761
1762 2005-08-18  Adele Peterson  <adele@apple.com>
1763
1764         Checked "Inline Functions Hidden" box
1765
1766         * JavaScriptCore.xcodeproj/project.pbxproj:
1767
1768 2005-08-16  Darin Adler  <darin@apple.com>
1769
1770         Reviewed by Geoff.
1771
1772         - fixed crash in one of the JavaScript tests (introduced by my throwError change)
1773
1774         * kjs/nodes.cpp: (Node::setExceptionDetailsIfNeeded): Check if the exception is an
1775         object before setting the file and line number properties on it. Something to think
1776         about in the future -- do we really want to do this on any object that's thrown?
1777         How about limiting it to error objects that were created by the JavaScript engine?
1778
1779         - changed kjs_fast_malloc so we don't have two conflicting versions of the same function
1780
1781         * kjs/fast_malloc.h: Took out all the ifdefs from this header.
1782         * kjs/fast_malloc.cpp: Added non-NDEBUG versions of the functions that just call
1783         the system malloc, and put the NDEBUG versions in an #else.
1784
1785 2005-08-16  Darin Adler  <darin@apple.com>
1786
1787         Reviewed by Geoff.
1788
1789         - clean up exported symbols that are not in a "KJS" namespace
1790
1791         * bindings/NP_jsobject.cpp: (identiferFromNPIdentifier): Marked this function static
1792         so it no longer has external linkage.
1793         * bindings/c/c_utility.h: Put all this stuff inside the KJS namespace.
1794         * bindings/c/c_utility.cpp: Also marked some globals static so they don't have external
1795         linkage; not as important given the namespace.
1796         * bindings/npruntime.cpp: Marked functions static so they no longer have internal linkage.
1797         Also removed unused _NPN_SetExceptionWithUTF8 function (not in header, had C++ linkage!).
1798
1799         * bindings/jni/jni_utility.cpp: (KJS::Bindings::getJavaVM): Call KJS_GetCreatedJavaVMs
1800         using the soft linking header, instead of calling the JNI call. This allows processes
1801         to link both JavaScriptCore and JavaVM without a symbol conflict.
1802         * bindings/softlinking.c:
1803         (loadFramework): Marked this function static so it no longer has external linkage.
1804         (getFunctionPointer): Ditto.
1805         (KJS_GetCreatedJavaVMs): Renamed this so it has a KJS prefix.
1806
1807         * JavaScriptCore.xcodeproj/project.pbxproj: Added softlinking.h.
1808         * bindings/softlinking.h: Added.
1809
1810         * kjs/nodes2string.cpp: (streamAssignmentOperatorTo): Marked this function static so it
1811         no longer has external linkage.
1812
1813 2005-08-15  Darin Adler  <darin@apple.com>
1814
1815         Reviewed by Geoff.
1816
1817         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4437
1818           clean up error creation with new throwError function
1819
1820         * bindings/NP_jsobject.cpp:
1821         (_NPN_SetException):
1822         * bindings/jni/jni_instance.cpp:
1823         (JavaInstance::invokeMethod):
1824         * bindings/jni/jni_runtime.cpp:
1825         (JavaField::dispatchValueFromInstance):
1826         (JavaField::dispatchSetValueToInstance):
1827         * bindings/objc/WebScriptObject.mm:
1828         (-[WebScriptObject _initializeWithObjectImp:originExecutionContext:executionContext:]):
1829         (-[WebScriptObject _initWithObjectImp:originExecutionContext:executionContext:]):
1830         (+[WebScriptObject throwException:]):
1831         (-[WebScriptObject setException:]):
1832         (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
1833         * bindings/objc/objc_class.h:
1834         (KJS::Bindings::ObjcClass::~ObjcClass):
1835         (KJS::Bindings::ObjcClass::ObjcClass):
1836         (KJS::Bindings::ObjcClass::operator=):
1837         (KJS::Bindings::ObjcClass::constructorAt):
1838         (KJS::Bindings::ObjcClass::numConstructors):
1839         * bindings/objc/objc_header.h:
1840         * bindings/objc/objc_runtime.h:
1841         (KJS::Bindings::ObjcField::~ObjcField):
1842         (KJS::Bindings::ObjcField::ObjcField):
1843         (KJS::Bindings::ObjcField::operator=):
1844         (KJS::Bindings::ObjcMethod::ObjcMethod):
1845         (KJS::Bindings::ObjcMethod::~ObjcMethod):
1846         (KJS::Bindings::ObjcMethod::operator=):
1847         * bindings/objc/objc_runtime.mm:
1848         (ObjcField::valueFromInstance):
1849         (ObjcField::setValueToInstance):
1850         (ObjcArray::setValueAt):
1851         (ObjcArray::valueAt):
1852         * bindings/objc/objc_utility.h:
1853         * bindings/objc/objc_utility.mm:
1854         (KJS::Bindings::JSMethodNameToObjCMethodName):
1855         (KJS::Bindings::convertValueToObjcValue):
1856         (KJS::Bindings::convertNSStringToString):
1857         (KJS::Bindings::convertObjcValueToValue):
1858         (KJS::Bindings::objcValueTypeForType):
1859         (KJS::Bindings::createObjcInstanceForValue):
1860         (KJS::Bindings::throwError):
1861         * bindings/runtime.h:
1862         (KJS::Bindings::Parameter::~Parameter):
1863         (KJS::Bindings::Method::~Method):
1864         (KJS::Bindings::Instance::Instance):
1865         (KJS::Bindings::Instance::begin):
1866         (KJS::Bindings::Instance::end):
1867         (KJS::Bindings::Instance::getValueOfUndefinedField):
1868         (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
1869         (KJS::Bindings::Instance::setValueOfUndefinedField):
1870         (KJS::Bindings::Instance::valueOf):
1871         * bindings/runtime_array.cpp:
1872         (RuntimeArrayImp::put):
1873         * bindings/runtime_object.h:
1874         (KJS::RuntimeObjectImp::setInternalInstance):
1875         (KJS::RuntimeObjectImp::getInternalInstance):
1876         * kjs/array_object.cpp:
1877         (getProperty):
1878         (ArrayProtoFuncImp::callAsFunction):
1879         (ArrayObjectImp::construct):
1880         * kjs/bool_object.cpp:
1881         (BooleanProtoFuncImp::callAsFunction):
1882         * kjs/date_object.cpp:
1883         (KJS::DateProtoFuncImp::callAsFunction):
1884         * kjs/function.cpp:
1885         (KJS::decode):
1886         (KJS::GlobalFuncImp::callAsFunction):
1887         * kjs/function_object.cpp:
1888         (FunctionProtoFuncImp::callAsFunction):
1889         (FunctionObjectImp::construct):
1890         * kjs/internal.cpp:
1891         (KJS::UndefinedImp::toObject):
1892         (KJS::NullImp::toObject):
1893         (KJS::InterpreterImp::evaluate):
1894         (KJS::InternalFunctionImp::hasInstance):
1895         * kjs/nodes.cpp:
1896         (Node::throwError):
1897         (substitute):
1898         (Node::setExceptionDetailsIfNeeded):
1899         (undefinedVariableError):
1900         (ProgramNode::ProgramNode):
1901         * kjs/number_object.cpp:
1902         (NumberProtoFuncImp::callAsFunction):
1903         * kjs/object.cpp:
1904         (KJS::ObjectImp::call):
1905         (KJS::ObjectImp::defaultValue):
1906         (KJS::Error::create):
1907         (KJS::throwError):
1908         * kjs/object.h:
1909         (KJS::ObjectImp::clearProperties):
1910         (KJS::ObjectImp::getPropertySlot):
1911         (KJS::ObjectImp::getOwnPropertySlot):
1912         * kjs/object_object.cpp:
1913         (ObjectProtoFuncImp::callAsFunction):
1914         * kjs/reference.cpp:
1915         (KJS::Reference::getBase):
1916         (KJS::Reference::getValue):
1917         (KJS::Reference::putValue):
1918         (KJS::Reference::deleteValue):
1919         * kjs/regexp_object.cpp:
1920         (RegExpProtoFuncImp::callAsFunction):
1921         (RegExpObjectImp::construct):
1922         * kjs/string_object.cpp:
1923         (StringProtoFuncImp::callAsFunction):
1924
1925 2005-08-15  Anders Carlsson  <andersca@mac.com>
1926
1927         Reviewed by Darin.
1928
1929         * tests/mozilla/ecma_3/Date/15.9.5.5.js:
1930         Remove the code which tests that Date.toLocaleString should be parsable
1931         by Date.parse. That is not true according to the spec.
1932
1933 2005-08-15  Darin Adler  <darin@apple.com>
1934
1935         Reviewed by Geoff.
1936
1937         * kjs/collector.cpp: (KJS::Collector::allocate): Use a local instead of a global in one
1938         more place; slight speedup.
1939
1940 2005-08-14  Darin Adler  <darin@apple.com>
1941
1942         Reviewed by Maciej.
1943
1944         - fixed crash observed on one of the Apple-only layout tests
1945
1946         * kjs/property_map.cpp: (KJS::PropertyMap::mark): Change code to understand that deleted
1947         entries have a value of NULL, so the deleted sentinel count doesn't need to be included
1948         in the count of things to mark since we're ignoring the keys.
1949
1950 2005-08-14  Darin Adler  <darin@apple.com>
1951
1952         Reviewed by Maciej.
1953
1954         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4421
1955           speed up JavaScript by inlining some label stack functions
1956
1957         * kjs/internal.h: Removed the copy constructor and assignment operator for LabelStack.
1958         They were unused, and the implementations had bugs; I removed them rather than fixing them.
1959         Also removed the clear function, since that was only needed to help the assignment operator
1960         share code with the destructor, and was not efficient enough for the destructor.
1961         (KJS::LabelStack::~LabelStack): Made this inline. Also used an efficient implementation
1962         that's nice and fast when the stack is empty, better than the old clear() function which
1963         used to keep updating and refetching "tos" each time through the loop.
1964         (KJS::LabelStack::pop): Made this inline.
1965
1966         * kjs/internal.cpp: Deleted the now-inline functions and the obsolete functions. Also
1967         deleted a commented-out line of code.
1968
1969 2005-08-14  Darin Adler  <darin@apple.com>
1970
1971         Reviewed by Maciej.
1972
1973         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4419
1974           speed up JavaScript by improving KJS::List
1975
1976         my measurements show an improvement of 1% on iBench JavaScript
1977
1978         * kjs/list.cpp: Rearrange list to make the values and free list share the same storage,
1979         which saves 4 bytes per list. Also remove the pointers used only on the heap from the
1980         lists that are in the pool, which saves 8 bytes per list. Moving the free list pointer
1981         closer to the start of the list object also speeds up access to the free list. New
1982         "HeapListImp" struct is used only for the lists on the heap.
1983         (KJS::List::markProtectedLists): Shadowed global variable in local and updated for the
1984         new terminology ("heap" instead of "outside pool").
1985         (KJS::allocateListImp): Updated for new terminology.
1986         (KJS::List::release): Moved the code from deallocateListImp in here -- it wasn't being
1987         inlined and didn't need to be in a separate function.
1988
1989 2005-08-14  Darin Adler  <darin@apple.com>
1990
1991         Reviewed by Maciej.
1992
1993         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4417
1994           speed up JavaScript with some small changes to the property map code
1995
1996         my measurements show an improvement of 2% on iBench JavaScript
1997
1998         * kjs/property_map.h: (KJS::PropertyMap::PropertyMap): Made the default constructor inline.
1999         * kjs/property_map.cpp:
2000         (KJS::PropertyMap::~PropertyMap): Changed loop to exit early once we know we've processed
2001         all the hash table entries, based on the count.
2002         (KJS::PropertyMap::mark): Ditto.
2003
2004         * kjs/object.h: Made an arbitrary change here to force recompiling so we pick up changes to
2005         property_map.h. Works around what seems to be an Xcode header dependency bug.
2006
2007 2005-08-14  Darin Adler  <darin@apple.com>
2008
2009         Reviewed by Maciej.
2010
2011         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4416
2012           speed up JavaScript with some improvements to the garbage collector
2013
2014         my measurements show an improvement of 2% on iBench JavaScript
2015
2016         * kjs/collector.cpp:
2017         (KJS::Collector::allocate): Use local variables to shadow globals instead of repeatedly
2018         going at global variables. Tighten up loop implementations to make the common case fast.
2019         (KJS::Collector::markStackObjectsConservatively): Use local variables to shadow globals.
2020         Used a goto to eliminate a boolean since it was showing up in the profile.
2021         (KJS::Collector::markProtectedObjects): Iterate through the table using pointer rather
2022         than an index since the profile showed that generating better code.
2023         (KJS::Collector::collect): Added a special case for blocks where all cells are used,
2024         Use local variables to shadow globals. Eliminated a boolean by computing it another
2025         way (checking to see if the number of live objects changed). Also used local variables
2026         to shadow fields in the current cell when sweeping.
2027         (KJS::Collector::numReferencedObjects): Use AllocatedValueImp instead of ValueImp
2028         in one place -- means we get faster versions of various functions that don't worry
2029         about SimpleNumber.
2030         (KJS::className): Ditto.
2031         (KJS::Collector::rootObjectClasses): Ditto.
2032
2033 2005-08-14  Darin Adler  <darin@apple.com>
2034
2035         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4344
2036           REGRESSION: JavaScript crash when going back from viewing a thread (NULL protoype)
2037
2038         * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set proto in a more
2039         straightforward way. The old code set the proto to 0 and then to the correct value.
2040         This showed up as a "false positive" when searching for places that set prototype
2041         to NULL/0 so I fixed it.
2042
2043         * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Change to
2044         not pass an explicit "0" to the base class (InternalFunctionImp) constructor.
2045
2046         * kjs/internal.h: Added a default constructor for InternalFunctionImp.
2047         * kjs/internal.cpp: (KJS::InternalFunctionImp::InternalFunctionImp): Added the
2048         default constructor (empty body, just calls base class's default constructor).
2049
2050         * kjs/object.h:
2051         (KJS::ObjectImp::ObjectImp): Add an assertion to catch NULL prototypes earlier
2052         in Development builds.
2053         (KJS::ObjectImp::setPrototype): Ditto.
2054
2055 2005-08-12  Maciej Stachowiak  <mjs@apple.com>
2056
2057         Reviewed by John.
2058
2059         - two simple speed improvements for a 3% speed gain
2060         
2061         * JavaScriptCore.xcodeproj/project.pbxproj: turn on -fstrict-aliasing
2062
2063         * kjs/scope_chain.h:
2064         (KJS::ScopeChainIterator::ScopeChainIterator): Add a scope chain iterator
2065         so you can walk a scope chain without having to make a copy that you then mutate.
2066         (KJS::ScopeChainIterator::operator*): standard iterator operation
2067         (KJS::ScopeChainIterator::operator->): ditto
2068         (KJS::ScopeChainIterator::operator++): ditto
2069         (KJS::ScopeChainIterator::operator==): ditto
2070         (KJS::ScopeChainIterator::operator!=): ditto
2071         (KJS::ScopeChain::begin): Iterator for the top of the scope chain
2072         (KJS::ScopeChain::end): Iterator for one past the bottom (i.e. null)
2073         * kjs/nodes.cpp:
2074         (ResolveNode::evaluate): Use scope chain iterator instead of copying
2075         a scope chain and then modifying the copy
2076         (ResolveNode::evaluateReference): ditto
2077         (FunctionCallResolveNode::evaluate): ditto
2078         (AssignResolveNode::evaluate): ditto
2079
2080 2005-08-12  Maciej Stachowiak  <mjs@apple.com>
2081
2082         Patch from Anders Carlsson, reviewed by me.
2083
2084         * kjs/nodes.h: Fix build breakage.
2085
2086 2005-08-12  Maciej Stachowiak  <mjs@apple.com>
2087
2088         Reviewed by hyatt.
2089
2090         - refactor function calls, 3% speedup on JS iBench.
2091
2092         * kjs/grammar.y:
2093         * kjs/nodes.cpp:
2094         (Node::throwError): Added new useful variants.
2095         (FunctionCallValueNode::evaluate): New node to handle calls on expressions
2096         that are strictly values, not references.
2097         (FunctionCallValueNode::ref):  ditto
2098         (FunctionCallValueNode::deref): ditto
2099         (FunctionCallResolveNode::evaluate): New node to handle calls on identifier
2100         expressions, so that they are looked up in the scope chain.
2101         (FunctionCallResolveNode::ref): ditto
2102         (FunctionCallResolveNode::deref): ditto
2103         (FunctionCallBracketNode::evaluate): New node to handle calls on bracket
2104         dereferences, so that the expression before brackets is used as the this
2105         object.
2106         (FunctionCallBracketNode::ref): ditto
2107         (FunctionCallBracketNode::deref): ditto
2108         (FunctionCallDotNode::evaluate): New node to handle calls on dot
2109         dereferences, so that the expression before the dot is used as the this
2110         object.
2111         (FunctionCallDotNode::ref): ditto
2112         (FunctionCallDotNode::deref): ditto
2113         (dotExprNotAnObjectString): helper function to avoid global variable access.
2114         (dotExprDoesNotAllowCallsString): ditto
2115         * kjs/nodes.h: Declared new classes.
2116         * kjs/nodes2string.cpp:
2117         (FunctionCallValueNode::streamTo): Added - serializes the appropriate function call
2118         (FunctionCallResolveNode::streamTo): ditto
2119         (FunctionCallBracketNode::streamTo): ditto
2120         (FunctionCallParenBracketNode::streamTo): ditto
2121         (FunctionCallDotNode::streamTo): ditto
2122         (FunctionCallParenDotNode::streamTo): ditto
2123         * kjs/object.h:
2124         (KJS::ObjectImp::isActivation): Change how activation objects are
2125         detected in the scope chain, a virtual function is cheaper than the
2126         old inheritance test.
2127         * kjs/function.h:
2128         (KJS::ActivationImp::isActivation): Ditto.
2129
2130 2005-08-11  Maciej Stachowiak  <mjs@apple.com>
2131
2132         - added missing file from earlier checkin
2133
2134         * kjs/grammar_types.h: Added.
2135         (KJS::makeNodePair):
2136         (KJS::makeNodeWithIdent):
2137
2138 2005-08-11  Maciej Stachowiak  <mjs@apple.com>
2139
2140         Reviewed by Geoff.
2141
2142         * kjs/date_object.cpp:
2143         (timetUsingCF): Fix one of the date tests my making the CF version of mktime
2144         have the same quirk about the DST field as the real mktime.
2145         * tests/mozilla/expected.html: Updated for newly fixed test.
2146
2147 2005-08-11  Maciej Stachowiak  <mjs@apple.com>
2148
2149         - updated for one of the tests that Darin incidentally fixed.
2150
2151         * tests/mozilla/expected.html:
2152
2153 2005-08-10  Maciej Stachowiak  <mjs@apple.com>
2154
2155         Reviewed by Geoff.
2156
2157         Refactor assignment grammar to avoid Reference type, and to later
2158         be able to take advantage of writeable PropertySlots, when those
2159         are added. I also fixed a minor bug, turning a function to a
2160         string lost parentheses, I made sure they are printed at least
2161         where semantically significant.
2162         
2163         Test cases: see WebCore
2164         
2165         * kjs/grammar.y: Change grammar so that assignment expressions are parsed
2166         directly to nodes that know how to set the kind of location being assigned, instead
2167         of having a generic assign node that counts on evaluateReference.
2168         * kjs/lexer.cpp: Include grammar_types.h.
2169         * kjs/nodes.cpp:
2170         (BracketAccessorNode): Renamed from AccessorNode1 for clarity.
2171         (DotAccessorNode): Renamed from AccessorNode2 for clarity.
2172         (combineForAssignment): Inline function for doing the proper kind of
2173         operation for various update assignments like += or *=.
2174         (AssignResolveNode): Node that handles assignment to a bare identifier.
2175         (AssignDotNode): Node that handles assignments of the form EXPR . IDENT = EXPR
2176         (AssignBracketNode): EXPR [ IDENT ] = EXPR
2177         * kjs/nodes.h: Updated for declarations/renames of new classes.
2178         * kjs/nodes2string.cpp:
2179         (GroupNode::streamTo): Fixed to print parens around the expression.
2180         (BracketAccessorNode::streamTo): Renamed.
2181         (DotAccessorNode::streamTo): Renamed.
2182         (AssignResolveNode::streamTo): Added.
2183         (AssignBracketNode::streamTo): Added.
2184         (AssignDotNode::streamTo): Added.
2185         (streamAssignmentOperatorTo): helper function for the above
2186         * kjs/property_slot.h:
2187         (KJS::PropertySlot::isSet): Made this const.
2188
2189 2005-08-10  Adele Peterson  <adele@apple.com>
2190
2191         Bumping version to 420+
2192
2193         * Info.plist:
2194
2195 2005-08-10  Geoffrey Garen  <ggaren@apple.com>
2196
2197         -fixed <rdar://problem/4151132> REGRESSION: Some applet liveconnect calls 
2198         throws privilege exception.
2199         
2200         Reviewed by richard and mjs.
2201
2202         -I removed the global static JavaClass cache, since it violated Java
2203         security to cache classes between websites and applets.
2204         
2205         * bindings/jni/jni_class.cpp: 
2206             -removed global static cache dictionary
2207             -instance constructor and destructor now do the work that used to 
2208             be done by static factory methods
2209             -removed obsolete functions
2210         (JavaClass::JavaClass):
2211         (JavaClass::~JavaClass):
2212         * bindings/jni/jni_class.h:
2213             -removed obsolete function declarations
2214             -made copying private since it's unused and it's also not clear
2215             excatly how copying would work with Java security
2216             -made default construction private since it's meaningless
2217         * bindings/jni/jni_instance.cpp:
2218             -removed obsolete functions
2219         (JavaInstance::~JavaInstance):
2220         (JavaInstance::getClass):
2221         * bindings/jni/jni_instance.h:
2222            -made copying private since it's unused and it's also not clear
2223             excatly how copying would work with Java security
2224             -made default construction private since it's meaningless
2225
2226 2005-08-08  Geoffrey Garen  <ggaren@apple.com>
2227
2228         -fixed crash caused by fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=4313
2229         
2230         - exceptionDescription now gets explicitly initialized to NULL in all
2231         the places listed below -- our wrapper classes used to take care of this 
2232         automagically
2233         
2234         * bindings/jni/jni_instance.cpp:
2235         (JavaInstance::invokeMethod):
2236         * bindings/jni/jni_runtime.cpp:
2237         (JavaField::dispatchValueFromInstance):
2238         (JavaField::dispatchSetValueToInstance):
2239
2240 2005-08-08  Darin Adler  <darin@apple.com>
2241
2242         Reviewed by John Sullivan.
2243
2244         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4325
2245           Mozilla Date tests have an unnecessary loop that runs 1970 times before each test
2246
2247         * tests/mozilla/ecma/shell.js: Added TIME_YEAR_0 constant.
2248
2249         * tests/mozilla/ecma/Date/15.9.5.10-1.js: Removed the loop and changed code to use the constant.
2250         * tests/mozilla/ecma/Date/15.9.5.10-10.js: Ditto.
2251         * tests/mozilla/ecma/Date/15.9.5.10-11.js: Ditto.
2252         * tests/mozilla/ecma/Date/15.9.5.10-12.js: Ditto.
2253         * tests/mozilla/ecma/Date/15.9.5.10-13.js: Ditto.
2254         * tests/mozilla/ecma/Date/15.9.5.10-2.js: Ditto.
2255         * tests/mozilla/ecma/Date/15.9.5.10-3.js: Ditto.
2256         * tests/mozilla/ecma/Date/15.9.5.10-4.js: Ditto.
2257         * tests/mozilla/ecma/Date/15.9.5.10-5.js: Ditto.
2258         * tests/mozilla/ecma/Date/15.9.5.10-6.js: Ditto.
2259         * tests/mozilla/ecma/Date/15.9.5.10-7.js: Ditto.
2260         * tests/mozilla/ecma/Date/15.9.5.10-8.js: Ditto.
2261         * tests/mozilla/ecma/Date/15.9.5.10-9.js: Ditto.
2262         * tests/mozilla/ecma/Date/15.9.5.11-2.js: Ditto.
2263         * tests/mozilla/ecma/Date/15.9.5.12-1.js: Ditto.
2264         * tests/mozilla/ecma/Date/15.9.5.12-2.js: Ditto.
2265         * tests/mozilla/ecma/Date/15.9.5.12-3.js: Ditto.
2266         * tests/mozilla/ecma/Date/15.9.5.12-4.js: Ditto.
2267         * tests/mozilla/ecma/Date/15.9.5.12-5.js: Ditto.
2268         * tests/mozilla/ecma/Date/15.9.5.12-6.js: Ditto.
2269         * tests/mozilla/ecma/Date/15.9.5.12-7.js: Ditto.
2270         * tests/mozilla/ecma/Date/15.9.5.12-8.js: Ditto.
2271         * tests/mozilla/ecma/Date/15.9.5.13-2.js: Ditto.
2272         * tests/mozilla/ecma/Date/15.9.5.13-8.js: Ditto.
2273         * tests/mozilla/ecma/Date/15.9.5.14.js: Ditto.
2274         * tests/mozilla/ecma/Date/15.9.5.15.js: Ditto.
2275         * tests/mozilla/ecma/Date/15.9.5.16.js: Ditto.
2276         * tests/mozilla/ecma/Date/15.9.5.17.js: Ditto.
2277         * tests/mozilla/ecma/Date/15.9.5.18.js: Ditto.
2278         * tests/mozilla/ecma/Date/15.9.5.19.js: Ditto.
2279         * tests/mozilla/ecma/Date/15.9.5.20.js: Ditto.
2280         * tests/mozilla/ecma/Date/15.9.5.21-1.js: Ditto.
2281         * tests/mozilla/ecma/Date/15.9.5.21-2.js: Ditto.
2282         * tests/mozilla/ecma/Date/15.9.5.21-3.js: Ditto.
2283         * tests/mozilla/ecma/Date/15.9.5.21-4.js: Ditto.
2284         * tests/mozilla/ecma/Date/15.9.5.21-5.js: Ditto.
2285         * tests/mozilla/ecma/Date/15.9.5.21-6.js: Ditto.
2286         * tests/mozilla/ecma/Date/15.9.5.21-7.js: Ditto.
2287         * tests/mozilla/ecma/Date/15.9.5.21-8.js: Ditto.
2288         * tests/mozilla/ecma/Date/15.9.5.22-1.js: Ditto.
2289         * tests/mozilla/ecma/Date/15.9.5.22-2.js: Ditto.
2290         * tests/mozilla/ecma/Date/15.9.5.22-3.js: Ditto.
2291         * tests/mozilla/ecma/Date/15.9.5.22-4.js: Ditto.
2292         * tests/mozilla/ecma/Date/15.9.5.22-5.js: Ditto.
2293         * tests/mozilla/ecma/Date/15.9.5.22-6.js: Ditto.
2294         * tests/mozilla/ecma/Date/15.9.5.22-7.js: Ditto.
2295         * tests/mozilla/ecma/Date/15.9.5.22-8.js: Ditto.
2296         * tests/mozilla/ecma/Date/15.9.5.23-4.js: Ditto.
2297         * tests/mozilla/ecma/Date/15.9.5.23-5.js: Ditto.
2298         * tests/mozilla/ecma/Date/15.9.5.23-6.js: Ditto.
2299         * tests/mozilla/ecma/Date/15.9.5.23-7.js: Ditto.
2300         * tests/mozilla/ecma/Date/15.9.5.23-8.js: Ditto.
2301         * tests/mozilla/ecma/Date/15.9.5.23-9.js: Ditto.
2302         * tests/mozilla/ecma/Date/15.9.5.5.js: Ditto.
2303         * tests/mozilla/ecma/Date/15.9.5.6.js: Ditto.
2304         * tests/mozilla/ecma/Date/15.9.5.7.js: Ditto.
2305         * tests/mozilla/ecma/Date/15.9.5.8.js: Ditto.
2306         * tests/mozilla/ecma/Date/15.9.5.9.js: Ditto.
2307
2308 2005-08-08  Darin Adler  <darin@apple.com>
2309
2310         - forgot to delete an obsolete file
2311
2312         * kjs/object_wrapper.h: Deleted.
2313
2314 2005-08-07  Darin Adler  <darin@apple.com>
2315
2316         - fixed two problems compiling with gcc 4.0
2317
2318         * kjs/array_object.cpp: (ArrayProtoFuncImp::callAsFunction): Initialized a
2319         variable to quiet an erroneous warning.
2320         * kjs/date_object.cpp: (KJS::makeTime): Removed extraneous KJS:: prefix.
2321
2322 2005-08-07  Darin Adler  <darin@apple.com>
2323
2324         Rubber stamped by Maciej.
2325
2326         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4313
2327           eliminate KJS::Value and KJS::Object smart pointer wrappers (for simplicity and speed)
2328
2329         * JavaScriptCore.xcodeproj/project.pbxproj: Removed object_wrapper.h.
2330
2331         Global replaces and other wonderful stuff.
2332
2333         * bindings/NP_jsobject.cpp:
2334         (_NPN_Invoke):
2335         (_NPN_Evaluate):
2336         (_NPN_GetProperty):
2337         (_NPN_SetProperty):
2338         (_NPN_HasMethod):
2339         (_NPN_SetException):
2340         * bindings/c/c_instance.cpp:
2341         (KJS::Bindings::CInstance::CInstance):
2342         (KJS::Bindings::CInstance::invokeMethod):
2343         (KJS::Bindings::CInstance::invokeDefaultMethod):
2344         (KJS::Bindings::CInstance::defaultValue):
2345         (KJS::Bindings::CInstance::stringValue):
2346         (KJS::Bindings::CInstance::numberValue):
2347         (KJS::Bindings::CInstance::booleanValue):
2348         (KJS::Bindings::CInstance::valueOf):
2349         * bindings/c/c_instance.h:
2350         * bindings/c/c_runtime.cpp:
2351         (CField::valueFromInstance):
2352         (CField::setValueToInstance):
2353         * bindings/c/c_runtime.h:
2354         * bindings/c/c_utility.cpp:
2355         (convertNPStringToUTF16):
2356         (convertUTF8ToUTF16):
2357         (coerceValueToNPVariantStringType):
2358         (convertValueToNPVariant):
2359         (convertNPVariantToValue):
2360         * bindings/c/c_utility.h:
2361         * bindings/jni/jni_instance.cpp:
2362         (JavaInstance::stringValue):
2363         (JavaInstance::numberValue):
2364         (JavaInstance::booleanValue):
2365         (JavaInstance::invokeMethod):
2366         (JavaInstance::invokeDefaultMethod):
2367         (JavaInstance::defaultValue):
2368         (JavaInstance::valueOf):
2369         * bindings/jni/jni_instance.h:
2370         * bindings/jni/jni_jsobject.cpp:
2371         (JSObject::invoke):
2372         (JSObject::call):
2373         (JSObject::eval):
2374         (JSObject::getMember):
2375         (JSObject::getSlot):
2376         (JSObject::toString):
2377         (JSObject::convertValueToJObject):
2378         (JSObject::convertJObjectToValue):
2379         (JSObject::listFromJArray):
2380         * bindings/jni/jni_jsobject.h:
2381         * bindings/jni/jni_objc.mm:
2382         (KJS::Bindings::dispatchJNICall):
2383         * bindings/jni/jni_runtime.cpp:
2384         (JavaArray::convertJObjectToArray):
2385         (JavaField::dispatchValueFromInstance):
2386         (JavaField::valueFromInstance):
2387         (JavaField::dispatchSetValueToInstance):
2388         (JavaField::setValueToInstance):
2389         (JavaArray::setValueAt):
2390         (JavaArray::valueAt):
2391         * bindings/jni/jni_runtime.h:
2392         (KJS::Bindings::JavaString::ustring):
2393         * bindings/jni/jni_utility.cpp:
2394         (KJS::Bindings::getJavaVM):
2395         (KJS::Bindings::getJNIEnv):
2396         (KJS::Bindings::getMethodID):
2397         (KJS::Bindings::callJNIVoidMethod):
2398         (KJS::Bindings::callJNIObjectMethod):
2399         (KJS::Bindings::callJNIBooleanMethod):
2400         (KJS::Bindings::callJNIStaticBooleanMethod):
2401         (KJS::Bindings::callJNIByteMethod):
2402         (KJS::Bindings::callJNICharMethod):
2403         (KJS::Bindings::callJNIShortMethod):
2404         (KJS::Bindings::callJNIIntMethod):
2405         (KJS::Bindings::callJNILongMethod):
2406         (KJS::Bindings::callJNIFloatMethod):
2407         (KJS::Bindings::callJNIDoubleMethod):
2408         (KJS::Bindings::callJNIVoidMethodA):
2409         (KJS::Bindings::callJNIObjectMethodA):
2410         (KJS::Bindings::callJNIByteMethodA):
2411         (KJS::Bindings::callJNICharMethodA):
2412         (KJS::Bindings::callJNIShortMethodA):
2413         (KJS::Bindings::callJNIIntMethodA):
2414         (KJS::Bindings::callJNILongMethodA):
2415         (KJS::Bindings::callJNIFloatMethodA):
2416         (KJS::Bindings::callJNIDoubleMethodA):
2417         (KJS::Bindings::callJNIBooleanMethodA):
2418         (KJS::Bindings::callJNIVoidMethodIDA):
2419         (KJS::Bindings::callJNIObjectMethodIDA):
2420         (KJS::Bindings::callJNIByteMethodIDA):
2421         (KJS::Bindings::callJNICharMethodIDA):
2422         (KJS::Bindings::callJNIShortMethodIDA):
2423         (KJS::Bindings::callJNIIntMethodIDA):
2424         (KJS::Bindings::callJNILongMethodIDA):
2425         (KJS::Bindings::callJNIFloatMethodIDA):
2426         (KJS::Bindings::callJNIDoubleMethodIDA):
2427         (KJS::Bindings::callJNIBooleanMethodIDA):
2428         (KJS::Bindings::getCharactersFromJString):
2429         (KJS::Bindings::releaseCharactersForJString):
2430         (KJS::Bindings::getCharactersFromJStringInEnv):
2431         (KJS::Bindings::releaseCharactersForJStringInEnv):
2432         (KJS::Bindings::getUCharactersFromJStringInEnv):
2433         (KJS::Bindings::releaseUCharactersForJStringInEnv):
2434         (KJS::Bindings::JNITypeFromClassName):
2435         (KJS::Bindings::signatureFromPrimitiveType):
2436         (KJS::Bindings::JNITypeFromPrimitiveType):
2437         (KJS::Bindings::getJNIField):
2438         (KJS::Bindings::convertValueToJValue):
2439         * bindings/jni/jni_utility.h:
2440         * bindings/objc/WebScriptObject.mm:
2441         (_didExecute):
2442         (-[WebScriptObject _initializeWithObjectImp:originExecutionContext:Bindings::executionContext:Bindings::]):
2443         (-[WebScriptObject _initWithObjectImp:originExecutionContext:Bindings::executionContext:Bindings::]):
2444         (-[WebScriptObject _imp]):
2445         (-[WebScriptObject _executionContext]):
2446         (-[WebScriptObject _setExecutionContext:]):
2447         (-[WebScriptObject _originExecutionContext]):
2448         (-[WebScriptObject _setOriginExecutionContext:]):
2449         (+[WebScriptObject throwException:]):
2450         (listFromNSArray):
2451         (-[WebScriptObject callWebScriptMethod:withArguments:]):
2452         (-[WebScriptObject evaluateWebScript:]):
2453         (-[WebScriptObject setValue:forKey:]):
2454         (-[WebScriptObject valueForKey:]):
2455         (-[WebScriptObject removeWebScriptKey:]):
2456         (-[WebScriptObject stringRepresentation]):
2457         (-[WebScriptObject webScriptValueAtIndex:]):
2458         (-[WebScriptObject setException:]):
2459         (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:Bindings::]):
2460         * bindings/objc/WebScriptObjectPrivate.h:
2461         * bindings/objc/objc_class.h:
2462         * bindings/objc/objc_class.mm:
2463         (KJS::Bindings::ObjcClass::fallbackObject):
2464         * bindings/objc/objc_instance.h:
2465         * bindings/objc/objc_instance.mm:
2466         (ObjcInstance::invokeMethod):
2467         (ObjcInstance::invokeDefaultMethod):
2468         (ObjcInstance::setValueOfField):
2469         (ObjcInstance::setValueOfUndefinedField):
2470         (ObjcInstance::getValueOfField):
2471         (ObjcInstance::getValueOfUndefinedField):
2472         (ObjcInstance::defaultValue):
2473         (ObjcInstance::stringValue):
2474         (ObjcInstance::numberValue):
2475         (ObjcInstance::booleanValue):
2476         (ObjcInstance::valueOf):
2477         * bindings/objc/objc_runtime.h:
2478         * bindings/objc/objc_runtime.mm:
2479         (ObjcField::valueFromInstance):
2480         (convertValueToObjcObject):
2481         (ObjcField::setValueToInstance):
2482         (ObjcArray::setValueAt):
2483         (ObjcArray::valueAt):
2484         (ObjcFallbackObjectImp::put):
2485         (ObjcFallbackObjectImp::callAsFunction):
2486         (ObjcFallbackObjectImp::defaultValue):
2487         * bindings/objc/objc_utility.h:
2488         * bindings/objc/objc_utility.mm:
2489         (Bindings::JSMethodNameToObjCMethodName):
2490         (Bindings::convertValueToObjcValue):
2491         (Bindings::convertNSStringToString):
2492         (Bindings::convertObjcValueToValue):
2493         (Bindings::objcValueTypeForType):
2494         (Bindings::createObjcInstanceForValue):
2495         * bindings/runtime.cpp:
2496         (Instance::getValueOfField):
2497         (Instance::setValueOfField):
2498         (Instance::createRuntimeObject):
2499         (Instance::createLanguageInstanceForValue):
2500         * bindings/runtime.h:
2501         (KJS::Bindings::Constructor::~Constructor):
2502         (KJS::Bindings::Field::~Field):
2503         (KJS::Bindings::MethodList::MethodList):
2504         (KJS::Bindings::Class::fallbackObject):
2505         (KJS::Bindings::Class::~Class):
2506         (KJS::Bindings::Instance::Instance):
2507         (KJS::Bindings::Instance::getValueOfUndefinedField):
2508         (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
2509         (KJS::Bindings::Instance::setValueOfUndefinedField):
2510         (KJS::Bindings::Instance::valueOf):
2511         (KJS::Bindings::Instance::setExecutionContext):
2512         (KJS::Bindings::Instance::~Instance):
2513         (KJS::Bindings::Array::~Array):
2514         * bindings/runtime_array.cpp:
2515         (RuntimeArrayImp::RuntimeArrayImp):
2516         (RuntimeArrayImp::lengthGetter):
2517         (RuntimeArrayImp::indexGetter):
2518         (RuntimeArrayImp::put):
2519         * bindings/runtime_array.h:
2520         * bindings/runtime_method.cpp:
2521         (RuntimeMethodImp::lengthGetter):
2522         (RuntimeMethodImp::callAsFunction):
2523         * bindings/runtime_method.h:
2524         * bindings/runtime_object.cpp:
2525         (RuntimeObjectImp::fallbackObjectGetter):
2526         (RuntimeObjectImp::fieldGetter):
2527         (RuntimeObjectImp::methodGetter):
2528         (RuntimeObjectImp::getOwnPropertySlot):
2529         (RuntimeObjectImp::put):
2530         (RuntimeObjectImp::defaultValue):
2531         (RuntimeObjectImp::callAsFunction):
2532         * bindings/runtime_object.h:
2533         * kjs/array_instance.h:
2534         * kjs/array_object.cpp:
2535         (ArrayInstanceImp::ArrayInstanceImp):
2536         (ArrayInstanceImp::lengthGetter):
2537         (ArrayInstanceImp::getOwnPropertySlot):
2538         (ArrayInstanceImp::put):
2539         (ArrayInstanceImp::propList):
2540         (ArrayInstanceImp::setLength):
2541         (compareByStringForQSort):
2542         (compareWithCompareFunctionForQSort):
2543         (ArrayInstanceImp::sort):
2544         (ArrayInstanceImp::pushUndefinedObjectsToEnd):
2545         (ArrayPrototypeImp::ArrayPrototypeImp):
2546         (ArrayProtoFuncImp::ArrayProtoFuncImp):
2547         (ArrayProtoFuncImp::callAsFunction):
2548         (ArrayObjectImp::ArrayObjectImp):
2549         (ArrayObjectImp::construct):
2550         (ArrayObjectImp::callAsFunction):
2551         * kjs/array_object.h:
2552         * kjs/bool_object.cpp:
2553         (BooleanPrototypeImp::BooleanPrototypeImp):
2554         (BooleanProtoFuncImp::BooleanProtoFuncImp):
2555         (BooleanProtoFuncImp::callAsFunction):
2556         (BooleanObjectImp::BooleanObjectImp):
2557         (BooleanObjectImp::construct):
2558         (BooleanObjectImp::callAsFunction):
2559         * kjs/bool_object.h:
2560         * kjs/collector.cpp:
2561         (KJS::Collector::markStackObjectsConservatively):
2562         (KJS::Collector::collect):
2563         (KJS::className):
2564         * kjs/completion.h:
2565         (KJS::Completion::Completion):
2566         (KJS::Completion::value):
2567         (KJS::Completion::isValueCompletion):
2568         * kjs/context.h:
2569         (KJS::ContextImp::variableObject):
2570         (KJS::ContextImp::setVariableObject):
2571         (KJS::ContextImp::thisValue):
2572         (KJS::ContextImp::activationObject):
2573         (KJS::ContextImp::pushScope):
2574         * kjs/date_object.cpp:
2575         (formatLocaleDate):
2576         (KJS::timeFromArgs):
2577         (KJS::DatePrototypeImp::DatePrototypeImp):
2578         (KJS::DateProtoFuncImp::DateProtoFuncImp):
2579         (KJS::DateProtoFuncImp::callAsFunction):
2580         (KJS::DateObjectImp::DateObjectImp):
2581         (KJS::DateObjectImp::construct):
2582         (KJS::DateObjectImp::callAsFunction):
2583         (KJS::DateObjectFuncImp::DateObjectFuncImp):
2584         (KJS::DateObjectFuncImp::callAsFunction):
2585         (KJS::parseDate):
2586         (KJS::KRFCDate_parseDate):
2587         (KJS::timeClip):
2588         * kjs/date_object.h:
2589         * kjs/debugger.cpp:
2590         (Debugger::exception):
2591         (Debugger::callEvent):
2592         (Debugger::returnEvent):
2593         * kjs/debugger.h:
2594         * kjs/error_object.cpp:
2595         (ErrorPrototypeImp::ErrorPrototypeImp):
2596         (ErrorProtoFuncImp::ErrorProtoFuncImp):
2597         (ErrorProtoFuncImp::callAsFunction):
2598         (ErrorObjectImp::ErrorObjectImp):
2599         (ErrorObjectImp::construct):
2600         (ErrorObjectImp::callAsFunction):
2601         (NativeErrorPrototypeImp::NativeErrorPrototypeImp):
2602         (NativeErrorImp::NativeErrorImp):
2603         (NativeErrorImp::construct):
2604         (NativeErrorImp::callAsFunction):
2605         * kjs/error_object.h:
2606         * kjs/function.cpp:
2607         (KJS::FunctionImp::FunctionImp):
2608         (KJS::FunctionImp::callAsFunction):
2609         (KJS::FunctionImp::processParameters):
2610         (KJS::FunctionImp::argumentsGetter):
2611         (KJS::FunctionImp::lengthGetter):
2612         (KJS::FunctionImp::put):
2613         (KJS::DeclaredFunctionImp::DeclaredFunctionImp):
2614         (KJS::DeclaredFunctionImp::construct):
2615         (KJS::ArgumentsImp::ArgumentsImp):
2616         (KJS::ArgumentsImp::mappedIndexGetter):
2617         (KJS::ArgumentsImp::put):
2618         (KJS::ActivationImp::argumentsGetter):
2619         (KJS::GlobalFuncImp::GlobalFuncImp):
2620         (KJS::encode):
2621         (KJS::decode):
2622         (KJS::GlobalFuncImp::callAsFunction):
2623         * kjs/function.h:
2624         * kjs/function_object.cpp:
2625         (FunctionPrototypeImp::FunctionPrototypeImp):
2626         (FunctionPrototypeImp::callAsFunction):
2627         (FunctionProtoFuncImp::FunctionProtoFuncImp):
2628         (FunctionProtoFuncImp::callAsFunction):
2629         (FunctionObjectImp::FunctionObjectImp):
2630         (FunctionObjectImp::construct):
2631         (FunctionObjectImp::callAsFunction):
2632         * kjs/function_object.h:
2633         * kjs/internal.cpp:
2634         (KJS::UndefinedImp::toPrimitive):
2635         (KJS::UndefinedImp::toObject):
2636         (KJS::NullImp::toPrimitive):
2637         (KJS::NullImp::toObject):
2638         (KJS::BooleanImp::toPrimitive):
2639         (KJS::BooleanImp::toObject):
2640         (KJS::StringImp::toPrimitive):
2641         (KJS::StringImp::toObject):
2642         (KJS::NumberImp::toPrimitive):
2643         (KJS::NumberImp::toObject):
2644         (KJS::NumberImp::getUInt32):
2645         (KJS::LabelStack::push):
2646         (KJS::ContextImp::ContextImp):
2647         (KJS::InterpreterImp::globalInit):
2648         (KJS::InterpreterImp::globalClear):
2649         (KJS::InterpreterImp::InterpreterImp):
2650         (KJS::InterpreterImp::initGlobalObject):
2651         (KJS::InterpreterImp::clear):
2652         (KJS::InterpreterImp::mark):
2653         (KJS::InterpreterImp::evaluate):
2654         (KJS::InternalFunctionImp::hasInstance):
2655         (KJS::roundValue):
2656         (KJS::printInfo):
2657         * kjs/internal.h:
2658         (KJS::InterpreterImp::builtinObject):
2659         (KJS::InterpreterImp::builtinFunction):
2660         (KJS::InterpreterImp::builtinArray):
2661         (KJS::InterpreterImp::builtinBoolean):
2662         (KJS::InterpreterImp::builtinString):
2663         (KJS::InterpreterImp::builtinNumber):
2664         (KJS::InterpreterImp::builtinDate):
2665         (KJS::InterpreterImp::builtinRegExp):
2666         (KJS::InterpreterImp::builtinError):
2667         (KJS::InterpreterImp::builtinObjectPrototype):
2668         (KJS::InterpreterImp::builtinFunctionPrototype):
2669         (KJS::InterpreterImp::builtinArrayPrototype):
2670         (KJS::InterpreterImp::builtinBooleanPrototype):
2671         (KJS::InterpreterImp::builtinStringPrototype):
2672         (KJS::InterpreterImp::builtinNumberPrototype):
2673         (KJS::InterpreterImp::builtinDatePrototype):
2674         (KJS::InterpreterImp::builtinRegExpPrototype):
2675         (KJS::InterpreterImp::builtinErrorPrototype):
2676         (KJS::InterpreterImp::builtinEvalError):
2677         (KJS::InterpreterImp::builtinRangeError):
2678         (KJS::InterpreterImp::builtinReferenceError):
2679         (KJS::InterpreterImp::builtinSyntaxError):
2680         (KJS::InterpreterImp::builtinTypeError):
2681         (KJS::InterpreterImp::builtinURIError):
2682         (KJS::InterpreterImp::builtinEvalErrorPrototype):
2683         (KJS::InterpreterImp::builtinRangeErrorPrototype):
2684         (KJS::InterpreterImp::builtinReferenceErrorPrototype):
2685         (KJS::InterpreterImp::builtinSyntaxErrorPrototype):
2686         (KJS::InterpreterImp::builtinTypeErrorPrototype):
2687         (KJS::InterpreterImp::builtinURIErrorPrototype):
2688         * kjs/interpreter.cpp:
2689         (Context::variableObject):
2690         (Context::thisValue):
2691         (Interpreter::Interpreter):
2692         (Interpreter::globalObject):
2693         (Interpreter::evaluate):
2694         (Interpreter::builtinObject):
2695         (Interpreter::builtinFunction):
2696         (Interpreter::builtinArray):
2697         (Interpreter::builtinBoolean):
2698         (Interpreter::builtinString):
2699         (Interpreter::builtinNumber):
2700         (Interpreter::builtinDate):
2701         (Interpreter::builtinRegExp):
2702         (Interpreter::builtinError):
2703         (Interpreter::builtinObjectPrototype):
2704         (Interpreter::builtinFunctionPrototype):
2705         (Interpreter::builtinArrayPrototype):
2706         (Interpreter::builtinBooleanPrototype):
2707         (Interpreter::builtinStringPrototype):
2708         (Interpreter::builtinNumberPrototype):
2709         (Interpreter::builtinDatePrototype):
2710         (Interpreter::builtinRegExpPrototype):
2711         (Interpreter::builtinErrorPrototype):
2712         (Interpreter::builtinEvalError):
2713         (Interpreter::builtinRangeError):
2714         (Interpreter::builtinReferenceError):
2715         (Interpreter::builtinSyntaxError):
2716         (Interpreter::builtinTypeError):
2717         (Interpreter::builtinURIError):
2718         (Interpreter::builtinEvalErrorPrototype):
2719         (Interpreter::builtinRangeErrorPrototype):
2720         (Interpreter::builtinReferenceErrorPrototype):
2721         (Interpreter::builtinSyntaxErrorPrototype):
2722         (Interpreter::builtinTypeErrorPrototype):
2723         (Interpreter::builtinURIErrorPrototype):
2724         (Interpreter::createLanguageInstanceForValue):
2725         * kjs/interpreter.h:
2726         (KJS::Interpreter::isGlobalObject):
2727         (KJS::ExecState::setException):
2728         (KJS::ExecState::clearException):
2729         (KJS::ExecState::exception):
2730         (KJS::ExecState::hadException):
2731         (KJS::ExecState::ExecState):
2732         * kjs/list.cpp:
2733         (KJS::List::at):
2734         * kjs/list.h:
2735         (KJS::List::operator[]):
2736         (KJS::ListIterator::operator->):
2737         (KJS::ListIterator::operator*):
2738         (KJS::ListIterator::operator++):
2739         (KJS::ListIterator::operator--):
2740         * kjs/lookup.h:
2741         (KJS::staticFunctionGetter):
2742         (KJS::staticValueGetter):
2743         (KJS::lookupPut):
2744         (KJS::cacheGlobalObject):
2745         * kjs/math_object.cpp:
2746         (MathObjectImp::getValueProperty):
2747         (MathFuncImp::MathFuncImp):
2748         (MathFuncImp::callAsFunction):
2749         * kjs/math_object.h:
2750         * kjs/nodes.cpp:
2751         (Node::evaluateReference):
2752         (Node::throwError):
2753         (Node::setExceptionDetailsIfNeeded):
2754         (NullNode::evaluate):
2755         (BooleanNode::evaluate):
2756         (NumberNode::evaluate):
2757         (StringNode::evaluate):
2758         (RegExpNode::evaluate):
2759         (ThisNode::evaluate):
2760         (ResolveNode::evaluate):
2761         (ResolveNode::evaluateReference):
2762         (GroupNode::evaluate):
2763         (ElementNode::evaluate):
2764         (ArrayNode::evaluate):
2765         (ObjectLiteralNode::evaluate):
2766         (PropertyValueNode::evaluate):
2767         (PropertyNode::evaluate):
2768         (AccessorNode1::evaluate):
2769         (AccessorNode1::evaluateReference):
2770         (AccessorNode2::evaluate):
2771         (AccessorNode2::evaluateReference):
2772         (ArgumentListNode::evaluate):
2773         (ArgumentListNode::evaluateList):
2774         (ArgumentsNode::evaluate):
2775         (NewExprNode::evaluate):
2776         (FunctionCallNode::evaluate):
2777         (PostfixNode::evaluate):
2778         (DeleteNode::evaluate):
2779         (VoidNode::evaluate):
2780         (TypeOfNode::evaluate):
2781         (PrefixNode::evaluate):
2782         (UnaryPlusNode::evaluate):
2783         (NegateNode::evaluate):
2784         (BitwiseNotNode::evaluate):
2785         (LogicalNotNode::evaluate):
2786         (MultNode::evaluate):
2787         (AddNode::evaluate):
2788         (ShiftNode::evaluate):
2789         (RelationalNode::evaluate):
2790         (EqualNode::evaluate):
2791         (BitOperNode::evaluate):
2792         (BinaryLogicalNode::evaluate):
2793         (ConditionalNode::evaluate):
2794         (AssignNode::evaluate):
2795         (CommaNode::evaluate):
2796         (StatListNode::execute):
2797         (AssignExprNode::evaluate):
2798         (VarDeclNode::evaluate):
2799         (VarDeclNode::processVarDecls):
2800         (VarDeclListNode::evaluate):
2801         (ExprStatementNode::execute):
2802         (IfNode::execute):
2803         (DoWhileNode::execute):
2804         (WhileNode::execute):
2805         (ForNode::execute):
2806         (ForInNode::execute):
2807         (ContinueNode::execute):
2808         (BreakNode::execute):
2809         (ReturnNode::execute):
2810         (WithNode::execute):
2811         (CaseClauseNode::evaluate):
2812         (ClauseListNode::evaluate):
2813         (CaseBlockNode::evaluate):
2814         (CaseBlockNode::evalBlock):
2815         (SwitchNode::execute):
2816         (ThrowNode::execute):
2817         (CatchNode::execute):
2818         (TryNode::execute):
2819         (ParameterNode::evaluate):
2820         (FuncDeclNode::processFuncDecl):
2821         (FuncExprNode::evaluate):
2822         (SourceElementsNode::execute):
2823         * kjs/nodes.h:
2824         (KJS::StatementNode::evaluate):
2825         * kjs/number_object.cpp:
2826         (NumberPrototypeImp::NumberPrototypeImp):
2827         (NumberProtoFuncImp::NumberProtoFuncImp):
2828         (NumberProtoFuncImp::callAsFunction):
2829         (NumberObjectImp::NumberObjectImp):
2830         (NumberObjectImp::getValueProperty):
2831         (NumberObjectImp::construct):
2832         (NumberObjectImp::callAsFunction):
2833         * kjs/number_object.h:
2834         * kjs/object.cpp:
2835         (KJS::ObjectImp::call):
2836         (KJS::ObjectImp::mark):
2837         (KJS::ObjectImp::classInfo):
2838         (KJS::ObjectImp::get):
2839         (KJS::ObjectImp::getProperty):
2840         (KJS::ObjectImp::getPropertySlot):
2841         (KJS::ObjectImp::put):
2842         (KJS::ObjectImp::hasOwnProperty):
2843         (KJS::ObjectImp::defaultValue):
2844         (KJS::ObjectImp::findPropertyHashEntry):
2845         (KJS::ObjectImp::construct):
2846         (KJS::ObjectImp::callAsFunction):
2847         (KJS::ObjectImp::hasInstance):
2848         (KJS::ObjectImp::propList):
2849         (KJS::ObjectImp::toPrimitive):
2850         (KJS::ObjectImp::toNumber):
2851         (KJS::ObjectImp::toString):
2852         (KJS::ObjectImp::toObject):
2853         (KJS::ObjectImp::putDirect):
2854         (KJS::Error::create):
2855         (KJS::error):
2856         * kjs/object.h:
2857         (KJS::):
2858         (KJS::ObjectImp::getPropertySlot):
2859         (KJS::AllocatedValueImp::isObject):
2860         (KJS::ObjectImp::ObjectImp):
2861         (KJS::ObjectImp::internalValue):
2862         (KJS::ObjectImp::setInternalValue):
2863         (KJS::ObjectImp::prototype):
2864         (KJS::ObjectImp::setPrototype):
2865         (KJS::ObjectImp::inherits):
2866         * kjs/object_object.cpp:
2867         (ObjectPrototypeImp::ObjectPrototypeImp):
2868         (ObjectProtoFuncImp::ObjectProtoFuncImp):
2869         (ObjectProtoFuncImp::callAsFunction):
2870         (ObjectObjectImp::ObjectObjectImp):
2871         (ObjectObjectImp::construct):
2872         (ObjectObjectImp::callAsFunction):
2873         * kjs/object_object.h:
2874         * kjs/operations.cpp:
2875         (KJS::equal):
2876         (KJS::strictEqual):
2877         (KJS::relation):
2878         (KJS::add):
2879         (KJS::mult):
2880         * kjs/operations.h:
2881         * kjs/property_map.cpp:
2882         (KJS::PropertyMap::mark):
2883         (KJS::PropertyMap::addEnumerablesToReferenceList):
2884         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList):
2885         (KJS::PropertyMap::save):
2886         (KJS::PropertyMap::restore):
2887         * kjs/property_map.h:
2888         * kjs/property_slot.cpp:
2889         (KJS::PropertySlot::undefinedGetter):
2890         * kjs/property_slot.h:
2891         (KJS::PropertySlot::getValue):
2892         * kjs/protect.h:
2893         (KJS::gcUnprotectNullTolerant):
2894         (KJS::ProtectedValue::ProtectedValue):
2895         (KJS::ProtectedValue::~ProtectedValue):
2896         (KJS::ProtectedValue::operator=):
2897         (KJS::ProtectedValue::operator ValueImp *):
2898         (KJS::ProtectedValue::operator->):
2899         * kjs/protected_object.h:
2900         (KJS::ProtectedObject::ProtectedObject):
2901         (KJS::ProtectedObject::operator=):
2902         (KJS::ProtectedObject::operator ValueImp *):
2903         (KJS::ProtectedObject::operator ObjectImp *):
2904         (KJS::ProtectedObject::operator->):
2905         (KJS::ProtectedReference::ProtectedReference):
2906         (KJS::ProtectedReference::~ProtectedReference):
2907         (KJS::ProtectedReference::operator=):
2908         * kjs/protected_values.cpp:
2909         (KJS::ProtectedValues::getProtectCount):
2910         (KJS::ProtectedValues::increaseProtectCount):
2911         (KJS::ProtectedValues::insert):
2912         (KJS::ProtectedValues::decreaseProtectCount):
2913         * kjs/protected_values.h:
2914         * kjs/reference.cpp:
2915         (KJS::Reference::Reference):
2916         (KJS::Reference::makeValueReference):
2917         (KJS::Reference::getBase):
2918         (KJS::Reference::getValue):
2919         (KJS::Reference::putValue):
2920         (KJS::Reference::deleteValue):
2921         * kjs/reference.h:
2922         (KJS::Reference::baseIfMutable):
2923         * kjs/regexp_object.cpp:
2924         (RegExpPrototypeImp::RegExpPrototypeImp):
2925         (RegExpProtoFuncImp::RegExpProtoFuncImp):
2926         (RegExpProtoFuncImp::callAsFunction):
2927         (RegExpObjectImp::RegExpObjectImp):
2928         (RegExpObjectImp::arrayOfMatches):
2929         (RegExpObjectImp::backrefGetter):
2930         (RegExpObjectImp::construct):
2931         (RegExpObjectImp::callAsFunction):
2932         * kjs/regexp_object.h:
2933         * kjs/string_object.cpp:
2934         (StringInstanceImp::lengthGetter):
2935         (StringInstanceImp::indexGetter):
2936         (StringInstanceImp::getOwnPropertySlot):
2937         (StringInstanceImp::put):
2938         (StringPrototypeImp::StringPrototypeImp):
2939         (StringProtoFuncImp::StringProtoFuncImp):
2940         (regExpIsGlobal):
2941         (replace):
2942         (StringProtoFuncImp::callAsFunction):
2943         (StringObjectImp::StringObjectImp):
2944         (StringObjectImp::construct):
2945         (StringObjectImp::callAsFunction):
2946         (StringObjectFuncImp::StringObjectFuncImp):
2947         (StringObjectFuncImp::callAsFunction):
2948         * kjs/string_object.h:
2949         * kjs/testkjs.cpp:
2950         (TestFunctionImp::callAsFunction):
2951         (VersionFunctionImp::callAsFunction):
2952         (main):
2953         * kjs/value.cpp:
2954         (KJS::AllocatedValueImp::operator new):
2955         (KJS::AllocatedValueImp::getUInt32):
2956         (KJS::ValueImp::toInteger):
2957         (KJS::ValueImp::toInt32):
2958         (KJS::ValueImp::toUInt32):
2959         (KJS::ValueImp::toUInt16):
2960         (KJS::ValueImp::toObject):
2961         (KJS::AllocatedValueImp::getBoolean):
2962         (KJS::AllocatedValueImp::getNumber):
2963         (KJS::AllocatedValueImp::getString):
2964         (KJS::AllocatedValueImp::getObject):
2965         (KJS::jsString):
2966         (KJS::jsNumber):
2967         (KJS::ConstantValues::init):
2968         (KJS::ConstantValues::clear):
2969         (KJS::ConstantValues::mark):
2970         * kjs/value.h:
2971         (KJS::):
2972         (KJS::jsUndefined):
2973         (KJS::jsNull):
2974         (KJS::jsBoolean):
2975         (KJS::jsNaN):
2976         (KJS::ValueImp::ValueImp):
2977         (KJS::ValueImp::~ValueImp):
2978         (KJS::AllocatedValueImp::AllocatedValueImp):
2979         (KJS::AllocatedValueImp::~AllocatedValueImp):
2980         (KJS::AllocatedValueImp::isBoolean):
2981         (KJS::AllocatedValueImp::isNumber):
2982         (KJS::AllocatedValueImp::isString):
2983         (KJS::AllocatedValueImp::isObject):
2984         (KJS::AllocatedValueImp::marked):
2985         (KJS::AllocatedValueImp::mark):
2986         (KJS::ValueImp::downcast):
2987         (KJS::ValueImp::isUndefined):
2988         (KJS::ValueImp::isNull):
2989         (KJS::ValueImp::isUndefinedOrNull):
2990         (KJS::ValueImp::isBoolean):
2991         (KJS::ValueImp::isNumber):
2992         (KJS::ValueImp::isString):
2993         (KJS::ValueImp::isObject):
2994         (KJS::ValueImp::getBoolean):
2995         (KJS::ValueImp::getNumber):
2996         (KJS::ValueImp::getString):
2997         (KJS::ValueImp::getObject):
2998         (KJS::ValueImp::getUInt32):
2999         (KJS::ValueImp::mark):
3000         (KJS::ValueImp::marked):
3001         (KJS::ValueImp::type):
3002         (KJS::ValueImp::toPrimitive):
3003         (KJS::ValueImp::toBoolean):
3004         (KJS::ValueImp::toNumber):
3005         (KJS::ValueImp::toString):
3006         (KJS::jsZero):
3007         (KJS::jsOne):
3008         (KJS::jsTwo):
3009         (KJS::Undefined):
3010         (KJS::Null):
3011         (KJS::Boolean):
3012         (KJS::Number):
3013         (KJS::String):
3014
3015 2005-08-06  Maciej Stachowiak  <mjs@apple.com>
3016
3017         Reviewed by Darin.
3018
3019         Change over to the new PropertySlot mechanism for property
3020         lookup. This allows the elimination of hasOwnProperty
3021         methods. Also did some of the performance tuning enabled by this
3022         (but not yet all the possible improvements for function calls,
3023         assignment, ++, and so forth). And also much code cleanup.
3024
3025         Net result is about a 2% speedup on the JS iBench.
3026         
3027         Also redid Geoff's fix for the chrashing applet by avoiding a NULL
3028         prototype in the bindings code and using the default of Null()
3029         instead.
3030         
3031         * JavaScriptCore.xcodeproj/project.pbxproj:
3032         * bindings/objc/objc_runtime.h:
3033         * bindings/objc/objc_runtime.mm:
3034         (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
3035         (ObjcFallbackObjectImp::getOwnPropertySlot):
3036         * bindings/runtime_array.cpp:
3037         (RuntimeArrayImp::lengthGetter):
3038         (RuntimeArrayImp::indexGetter):
3039         (RuntimeArrayImp::getOwnPropertySlot):
3040         * bindings/runtime_array.h:
3041         * bindings/runtime_method.cpp:
3042         (RuntimeMethodImp::lengthGetter):
3043         (RuntimeMethodImp::getOwnPropertySlot):
3044         * bindings/runtime_method.h:
3045         * bindings/runtime_object.cpp:
3046         (RuntimeObjectImp::RuntimeObjectImp):
3047         (RuntimeObjectImp::fallbackObjectGetter):
3048         (RuntimeObjectImp::fieldGetter):
3049         (RuntimeObjectImp::methodGetter):
3050         (RuntimeObjectImp::getOwnPropertySlot):
3051         * bindings/runtime_object.h:
3052         * bindings/runtime_root.h:
3053         * kjs/array_instance.h:
3054         * kjs/array_object.cpp:
3055         (ArrayInstanceImp::lengthGetter):
3056         (ArrayInstanceImp::getOwnPropertySlot):
3057         (ArrayPrototypeImp::getOwnPropertySlot):
3058         * kjs/array_object.h:
3059         * kjs/date_object.cpp:
3060         (DatePrototypeImp::getOwnPropertySlot):
3061         * kjs/date_object.h:
3062         * kjs/function.cpp:
3063         (KJS::FunctionImp::argumentsGetter):
3064         (KJS::FunctionImp::lengthGetter):
3065         (KJS::FunctionImp::getOwnPropertySlot):
3066         (KJS::FunctionImp::put):
3067         (KJS::FunctionImp::deleteProperty):
3068         (KJS::ArgumentsImp::mappedIndexGetter):
3069         (KJS::ArgumentsImp::getOwnPropertySlot):
3070         (KJS::ActivationImp::argumentsGetter):
3071         (KJS::ActivationImp::getArgumentsGetter):
3072         (KJS::ActivationImp::getOwnPropertySlot):
3073         (KJS::ActivationImp::deleteProperty):
3074         * kjs/function.h:
3075         * kjs/internal.cpp:
3076         (InterpreterImp::InterpreterImp):
3077         (InterpreterImp::initGlobalObject):
3078         (InterpreterImp::~InterpreterImp):
3079         (InterpreterImp::evaluate):
3080         * kjs/internal.h:
3081         (KJS::InterpreterImp::globalExec):
3082         * kjs/interpreter.cpp:
3083         (Interpreter::Interpreter):
3084         (Interpreter::createLanguageInstanceForValue):
3085         * kjs/interpreter.h:
3086         (KJS::Interpreter::argumentsIdentifier):
3087         (KJS::Interpreter::specialPrototypeIdentifier):
3088         * kjs/lookup.h:
3089         (KJS::staticFunctionGetter):
3090         (KJS::staticValueGetter):
3091         (KJS::getStaticPropertySlot):
3092         (KJS::getStaticFunctionSlot):
3093         (KJS::getStaticValueSlot):
3094         * kjs/math_object.cpp:
3095         (MathObjectImp::getOwnPropertySlot):
3096         * kjs/math_object.h:
3097         * kjs/nodes.cpp:
3098         (ResolveNode::evaluate):
3099         (ResolveNode::evaluateReference):
3100         (AccessorNode1::evaluate):
3101         (AccessorNode2::evaluate):
3102         * kjs/number_object.cpp:
3103         (NumberObjectImp::getOwnPropertySlot):
3104         * kjs/number_object.h:
3105         * kjs/object.cpp:
3106         (KJS::ObjectImp::get):
3107         (KJS::ObjectImp::getProperty):
3108         (KJS::ObjectImp::getPropertySlot):
3109         (KJS::ObjectImp::getOwnPropertySlot):
3110         (KJS::ObjectImp::put):
3111         (KJS::ObjectImp::hasProperty):
3112         (KJS::ObjectImp::hasOwnProperty):
3113         * kjs/object.h:
3114         (KJS::ObjectImp::getDirectLocation):
3115         (KJS::ObjectImp::getPropertySlot):
3116         (KJS::ObjectImp::getOwnPropertySlot):
3117         * kjs/object_wrapper.h: Added.
3118         (KJS::):
3119         (KJS::Object::Object):
3120         (KJS::Object::operator ObjectImp *):
3121         * kjs/property_map.cpp:
3122         (KJS::PropertyMap::getLocation):
3123         * kjs/property_map.h:
3124         * kjs/property_slot.cpp: Added.
3125         (KJS::PropertySlot::undefinedGetter):
3126         * kjs/property_slot.h: Added.
3127         (KJS::PropertySlot::isSet):
3128         (KJS::PropertySlot::getValue):
3129         (KJS::PropertySlot::setValueSlot):
3130         (KJS::PropertySlot::setStaticEntry):
3131         (KJS::PropertySlot::setCustom):
3132         (KJS::PropertySlot::setCustomIndex):
3133         (KJS::PropertySlot::setUndefined):
3134         (KJS::PropertySlot::slotBase):
3135         (KJS::PropertySlot::staticEntry):
3136         (KJS::PropertySlot::index):
3137         (KJS::PropertySlot::):
3138         * kjs/protect.h:
3139         * kjs/protected_object.h: Added.
3140         (KJS::ProtectedObject::ProtectedObject):
3141         (KJS::ProtectedObject::~ProtectedObject):
3142         (KJS::ProtectedObject::operator=):
3143         (KJS::ProtectedReference::ProtectedReference):
3144         (KJS::ProtectedReference::~ProtectedReference):
3145         (KJS::ProtectedReference::operator=):
3146         * kjs/reference.h:
3147         * kjs/reference_list.cpp:
3148         * kjs/regexp_object.cpp:
3149         (RegExpObjectImp::backrefGetter):
3150         (RegExpObjectImp::getOwnPropertySlot):
3151         * kjs/regexp_object.h:
3152         * kjs/string_object.cpp:
3153         (StringInstanceImp::lengthGetter):
3154         (StringInstanceImp::indexGetter):
3155         (StringInstanceImp::getOwnPropertySlot):
3156         (StringPrototypeImp::getOwnPropertySlot):
3157         * kjs/string_object.h:
3158
3159 2005-08-05  Adele Peterson  <adele@apple.com>
3160
3161         Reviewed by Darin.
3162
3163         * JavaScriptCore.xcodeproj/project.pbxproj: Unchecked 'statics are thread safe' option.
3164
3165 2005-08-05  Geoffrey Garen  <ggaren@apple.com>
3166
3167         -fixed <rdar://problem/4207220> REGRESSION (DENVER): Crash occurs 
3168         after clicking on Hangman applet
3169
3170         Reviewed by darin.
3171
3172         * kjs/object.cpp:
3173         (KJS::ObjectImp::hasProperty): added check for null prototype.
3174
3175         FIXME: The long-term plan is to make runtime objects use JS Null()
3176         instead of null pointers, which will allow us to eliminate null
3177         checks, improving performance.
3178
3179 2005-08-05  Geoffrey Garen  <ggaren@apple.com>
3180
3181         Fix by darin, reviewed by me.
3182         
3183         - rolled in fix for: <rdar://problem/4161606> JavaScript regular 
3184         expressions with certain ranges of Unicode characters cause a crash
3185
3186         Test cases added:
3187
3188         * layout-tests/fast/js/regexp-big-unicode-ranges-expected.txt: Added.
3189         * layout-tests/fast/js/regexp-big-unicode-ranges.html: Added.
3190
3191         * pcre/pcre.c:
3192         (compile_branch): added checks for characters > 255
3193
3194 2005-08-04  Maciej Stachowiak  <mjs@apple.com>
3195
3196         - updated expected test results now that we no longer exlude the
3197         date tests (apparently this was overlooked)
3198
3199         * tests/mozilla/expected.html:
3200
3201 2005-07-31  Darin Adler  <darin@apple.com>
3202
3203         Reviewed by Maciej.
3204
3205         - remove uses of Mac-OS-X-specific MAX macro
3206         - remove one of the many excess "APPLE_CHANGES" ifdefs
3207
3208         * kjs/collector.cpp: (KJS::Collector::allocate): Use std::max instead of MAX.
3209         * kjs/property_map.cpp: (KJS::PropertyMap::rehash): Ditto.
3210         * kjs/ustring.cpp:
3211         (KJS::UChar::toLower): Take out non-ICU code path.
3212         (KJS::UChar::toUpper): Ditto.
3213         (KJS::UString::spliceSubstringsWithSeparators): Use std::max instead of MAX.
3214
3215 2005-07-27  Geoffrey Garen  <ggaren@apple.com>
3216
3217         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4147
3218         Array.toString() and toLocaleString() improvements from KDE KJS
3219         (rolled in KDE changes)
3220
3221         Test cases added:
3222
3223         * layout-tests/fast/js/toString-overrides-expected.txt: Added.
3224         * layout-tests/fast/js/toString-overrides.html: Added.
3225         
3226         * kjs/array_object.cpp:
3227         (ArrayProtoFuncImp::call):
3228
3229 2005-07-27  Maciej Stachowiak  <mjs@apple.com>
3230
3231         Changes by Michael Kahl, reviewed by me.
3232
3233         - fixed <rdar://problem/4194278> Need better debugging support in JavaScriptCore
3234         
3235         * JavaScriptCore.xcodeproj/project.pbxproj:
3236         * kjs/debugger.cpp:
3237         (KJS::AttachedInterpreter::AttachedInterpreter):
3238         (KJS::AttachedInterpreter::~AttachedInterpreter):
3239         (Debugger::~Debugger):
3240         (Debugger::attach):
3241         (Debugger::detach):
3242         (Debugger::sourceParsed):
3243         * kjs/debugger.h:
3244         * kjs/function.cpp:
3245         (KJS::FunctionImp::call):
3246         (KJS::GlobalFuncImp::call):
3247         * kjs/function_object.cpp:
3248         (FunctionObjectImp::construct):
3249         * kjs/grammar.y:
3250         * kjs/internal.cpp:
3251         (Parser::parse):
3252         (InterpreterImp::evaluate):
3253         * kjs/internal.h:
3254         (KJS::InterpreterImp::setDebugger):
3255         * kjs/interpreter.cpp:
3256         * kjs/interpreter.h:
3257         (KJS::Interpreter::imp):
3258         * kjs/nodes.cpp:
3259
3260 2005-07-27  Geoffrey Garen  <ggaren@apple.com>
3261
3262         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3381
3263         Date.prototype.setDate() incorrect for values >=128
3264         
3265         - Test cases added:
3266
3267         * layout-tests/fast/js/date-big-setdate-expected.txt: Added.
3268         * layout-tests/fast/js/date-big-setdate.html: Added.
3269
3270         Reviewed by darin.
3271
3272         * kjs/date_object.cpp:
3273         (DateProtoFuncImp::call):
3274
3275 2005-07-27  Geoffrey Garen  <ggaren@apple.com>
3276
3277         -rolled in patch by Carsten Guenther <cguenther@gmail.com>
3278         for http://bugzilla.opendarwin.org/show_bug.cgi?id=3759
3279         Date object enhancements
3280         
3281         Test cases added:
3282
3283         * layout-tests/fast/js/date-preserve-milliseconds-expected.txt: Added.
3284         * layout-tests/fast/js/date-preserve-milliseconds.html: Added.
3285
3286         Reviewed by darin.
3287
3288         * kjs/date_object.cpp:
3289         (timeFromArgs):
3290         (DateProtoFuncImp::call):
3291         (DateObjectImp::construct):
3292         (DateObjectFuncImp::call):
3293         (KJS::makeTime):
3294         * kjs/date_object.h:
3295         * tests/mozilla/expected.html:
3296
3297 2005-07-26  Justin Garcia  <justin.garcia@apple.com>
3298
3299         Added a forward declaration to fix gcc4 build error
3300
3301         * kjs/function.h:
3302
3303 2005-07-25  Geoffrey Garen  <ggaren@apple.com>
3304         - fixed mistake in my last checkin -- the expected results included
3305         results from a patch that hasn't landed yet.
3306         
3307         * tests/mozilla/expected.html:
3308
3309 2005-07-25  Maciej Stachowiak  <mjs@apple.com>
3310
3311         - fix mistake in last change that leads to assertion failure in the Development build
3312
3313         * kjs/lookup.h:
3314         (KJS::lookupGetOwnValue):
3315
3316 2005-07-24  Maciej Stachowiak  <mjs@apple.com>
3317
3318         Reviewed by Darin.
3319
3320         - http://bugzilla.opendarwin.org/show_bug.cgi?id=4124
3321         (change JavaScript property access to avoid double lookup)
3322
3323         - 10% speedup on JavaScript iBench
3324         - 5% speedup on 24fun BenchJS benchmark
3325
3326         Changed all get methods to getOwnProperty - they are no longer
3327         responsible for prototype lookup, and determine if the property
3328         was found as a side efect. 
3329
3330         get() is now a nonvirtual ObjectImp method which calls the virtual
3331         getOwnProperty and walks the prototype chain. A few selected
3332         methods were inlined.
3333
3334         Changed ResolveNode::evaluate plus some other places to use
3335         getProperty which does get() and hasProperty() in one lookup.
3336
3337         Also miscellaneous code cleanup.
3338         
3339         * bindings/objc/objc_runtime.h:
3340         * bindings/objc/objc_runtime.mm:
3341         (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
3342         (ObjcFallbackObjectImp::getOwnProperty):
3343         * bindings/runtime_array.cpp:
3344         (RuntimeArrayImp::RuntimeArrayImp):
3345         (RuntimeArrayImp::getOwnProperty):
3346         * bindings/runtime_array.h:
3347         * bindings/runtime_method.cpp:
3348         (RuntimeMethodImp::getOwnProperty):
3349         * bindings/runtime_method.h:
3350         * bindings/runtime_object.cpp:
3351         (RuntimeObjectImp::getOwnProperty):
3352         * bindings/runtime_object.h:
3353         * kjs/array_instance.h:
3354         * kjs/array_object.cpp:
3355         (ArrayInstanceImp::getOwnProperty):
3356         (ArrayPrototypeImp::getOwnProperty):
3357         (ArrayProtoFuncImp::call):
3358         * kjs/array_object.h:
3359         * kjs/date_object.cpp:
3360         (DatePrototypeImp::getOwnProperty):
3361         * kjs/date_object.h:
3362         * kjs/function.cpp:
3363         (KJS::FunctionImp::getOwnProperty):
3364         (KJS::ArgumentsImp::getOwnProperty):
3365         (KJS::ActivationImp::getOwnProperty):
3366         * kjs/function.h:
3367         * kjs/lookup.h:
3368         (KJS::lookupGetOwnProperty):
3369         (KJS::lookupGetOwnFunction):
3370         (KJS::lookupGetOwnValue):
3371         * kjs/math_object.cpp:
3372         (MathObjectImp::getOwnProperty):
3373         (MathObjectImp::getValueProperty):
3374         * kjs/math_object.h:
3375         * kjs/nodes.cpp:
3376         (ResolveNode::evaluate):
3377         * kjs/number_object.cpp:
3378         (NumberObjectImp::getOwnProperty):
3379         * kjs/number_object.h:
3380         * kjs/object.cpp:
3381         (KJS::ObjectImp::get):
3382         (KJS::ObjectImp::getOwnProperty):
3383         (KJS::ObjectImp::getProperty):
3384         * kjs/object.h:
3385         (KJS::ObjectImp::getProperty):
3386         (KJS::ObjectImp::getOwnProperty):
3387         * kjs/object_object.cpp:
3388         (ObjectProtoFuncImp::call):
3389         * kjs/regexp_object.cpp:
3390         (RegExpObjectImp::getOwnProperty):
3391         * kjs/regexp_object.h:
3392         * kjs/string_object.cpp:
3393         (StringInstanceImp::getOwnProperty):
3394         (StringPrototypeImp::getOwnProperty):
3395         * kjs/string_object.h:
3396
3397 2005-07-25  Geoffrey Garen  <ggaren@apple.com>
3398
3399         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3971
3400         JS test suite depends on JS 1.2 behavior
3401         
3402         Reviewed by darin.
3403
3404         * tests/mozilla/js1_2/Array/tostring_1.js: now tests only for JS 1.5 behavior
3405         * tests/mozilla/js1_2/Array/tostring_2.js: ditto
3406         * tests/mozilla/expected.html:
3407
3408 2005-07-24  Justin Garcia  <justin.garcia@apple.com>
3409
3410         Reviewed by kevin.
3411
3412         Fixes make clean problem introduced in xcode2.1 transition
3413
3414         * Makefile.am:
3415
3416 2005-07-22  Geoffrey Garen  <ggaren@apple.com>
3417
3418         Reviewed by darin.
3419
3420         * kjs/date_object.cpp: DatePrototypeImp now identifies itself as a
3421         child class of DateInstanceImp -- this enables calls to Date.ValueOf().
3422         
3423         fixes: ecma/Date/15.9.5.js (once we enable the date tests).
3424
3425 2005-07-22  Geoffrey Garen  <ggaren@apple.com>
3426
3427         
3428         Reviewed by darin.
3429
3430         * tests/mozilla/jsDriver.pl: now takes the path to testkjs as a command-line argument
3431         * tests/mozilla/run-mozilla-tests: Removed.
3432
3433 2005-07-21  Geoffrey Garen  <ggaren@apple.com>
3434
3435         * JavaScriptCore.xcodeproj/.cvsignore: Added.
3436
3437 2005-07-21  Geoffrey Garen  <ggaren@apple.com>
3438
3439         * JavaScriptCore.pbproj/project.pbxproj: Removed.
3440         * JavaScriptCore.xcodeproj/ggaren.pbxuser: Added.
3441         * JavaScriptCore.xcodeproj/ggaren.perspective: Added.
3442         * JavaScriptCore.xcodeproj/project.pbxproj: Added.
3443         * Makefile.am:
3444
3445 2005-07-20  Maciej Stachowiak  <mjs@apple.com>
3446
3447         Patch from Trey Matteson <trey@usa.net>, reviewed by me.
3448
3449         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3956
3450         some of WebKit builds with symbols, some doesn't
3451         
3452         * JavaScriptCore.pbproj/project.pbxproj: Generate symbols even for
3453         Deployment.
3454
3455 2005-07-19  Geoffrey Garen  <ggaren@apple.com>
3456
3457         -fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3991
3458         JSC doesn't implement Array.prototype.toLocaleString()
3459
3460         -test failure: ecma_3/Array/15.4.4.3-1.js
3461
3462         Reviewed by mjs.
3463
3464         * kjs/array_object.cpp:
3465         (ArrayProtoFuncImp::call): now searches for toString and
3466         toLocaleString overrides in the array's elements
3467
3468         * tests/mozilla/expected.html: failures are under 100! woohoo!
3469
3470 2005-07-19  Darin Adler  <darin@apple.com>
3471
3472         - fixed the build
3473
3474         * kjs/lookup.h: (KJS::lookupPut): Remove bogus const; was preventing WebCore from
3475         compiling (not sure why this didn't affect my other build machine).
3476
3477         - one other tiny tweak (so sue me)
3478
3479         * bindings/runtime_root.cpp: Remove unneeded declaration.
3480
3481 2005-07-19  Darin Adler  <darin@apple.com>
3482
3483         Reviewed by Geoff Garen.
3484
3485         - eliminated try wrappers for get/put/call since we don't use C++ exceptions any more
3486
3487         * kjs/lookup.h: Changed tryCall in IMPLEMENT_PROTOFUNC here to call. It doesn't make
3488         sense for this macro to use the name tryCall anyway, since that's specific to how
3489         WebCore used this, so this is good anyway. On the other hand, it might be a problem
3490         for KDOM or KSVG, in which case we'll need another macro for them, since JavaScriptCore
3491         should presumably not have the C++ exception support.
3492
3493 2005-07-18  Geoffrey Garen  <ggaren@apple.com>
3494
3495         -fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4008
3496         Error objects report incorrect length
3497         
3498         Reviewed by darin.
3499
3500         * kjs/error_object.cpp: Error objects now include a length property
3501         (ErrorObjectImp::ErrorObjectImp):
3502
3503         * tests/mozilla/expected.html: updated expected results to reflect fix
3504         * tests/mozilla/js1_5/Exceptions/regress-123002.js: test now expects 
3505         ecma compliant results
3506
3507 2005-07-15  Geoffrey Garen  <ggaren@apple.com>
3508
3509         -rolled in KDE fixes for http://bugzilla.opendarwin.org/show_bug.cgi?id=3601
3510         Error instance type info
3511         
3512         Reviewed by mjs.
3513
3514         * kjs/error_object.cpp:
3515         - Created ErrorInstanceImp class for Error() objects. 
3516         - Changed parent object for Native Errors to "Function" (matches
3517         ECMA spec).
3518         (ErrorInstanceImp::ErrorInstanceImp):
3519         (ErrorProtoFuncImp::call):
3520         (ErrorObjectImp::construct):
3521         (NativeErrorImp::construct):
3522
3523         * kjs/error_object.h:
3524         (KJS::ErrorInstanceImp::classInfo):
3525         * kjs/object.h: made comment more informative about ClassInfo
3526
3527         * tests/mozilla/expected.html:
3528
3529 2005-07-14  Geoffrey Garen  <ggaren@apple.com>
3530
3531         - fixed: JS test suite expects an out of memory error
3532         that our memory efficiency avoids
3533         
3534         Reviewed by mjs.
3535
3536         * tests/mozilla/js1_5/Array/regress-157652.js:
3537         test now expects normal execution
3538         
3539         * tests/mozilla/expected.html:
3540
3541 2005-07-14  Geoffrey Garen  <ggaren@apple.com>
3542         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4006
3543         testkjs doesn't implement gc()
3544         
3545         - test failure:
3546         ecma_3/Function/regress-104584.js
3547         
3548         Reviewed by mjs.
3549
3550         * kjs/interpreter.cpp:
3551         (Interpreter::finalCheck): removed misleading while && comment
3552
3553         * kjs/testkjs.cpp: added "gc" function to global object
3554         (TestFunctionImp::):
3555         (TestFunctionImp::call):
3556         (main):
3557
3558         * tests/mozilla/expected.html:
3559
3560 2005-07-14  Geoffrey Garen  <ggaren@apple.com>
3561
3562         -rolled in patches for http://bugzilla.opendarwin.org/show_bug.cgi?id=3945
3563         [PATCH] Safe merges of comments and other trivialities from KDE's kjs
3564         
3565         -patch by Martijn Klingens <klingens@kde.org>
3566         
3567         * kjs/array_instance.h:
3568         * kjs/array_object.cpp:
3569         * kjs/array_object.h:
3570         * kjs/bool_object.cpp:
3571         * kjs/bool_object.h:
3572         * kjs/collector.cpp:
3573         * kjs/collector.h:
3574         * kjs/completion.h:
3575         * kjs/context.h:
3576         * kjs/date_object.cpp:
3577         * kjs/date_object.h:
3578         * kjs/debugger.cpp:
3579         * kjs/debugger.h:
3580         * kjs/dtoa.h:
3581         * kjs/error_object.cpp:
3582         * kjs/error_object.h:
3583         * kjs/function.cpp:
3584         * kjs/function.h:
3585         * kjs/function_object.cpp:
3586         * kjs/function_object.h:
3587         * kjs/grammar.y:
3588         * kjs/identifier.cpp:
3589         * kjs/identifier.h:
3590         * kjs/internal.cpp:
3591         * kjs/internal.h:
3592         * kjs/interpreter.cpp:
3593         * kjs/interpreter.h:
3594         * kjs/interpreter_map.cpp:
3595         * kjs/interpreter_map.h:
3596         * kjs/lexer.cpp:
3597         * kjs/lexer.h:
3598         * kjs/list.cpp:
3599         * kjs/list.h:
3600         * kjs/lookup.cpp:
3601         * kjs/lookup.h:
3602         * kjs/math_object.cpp:
3603         * kjs/math_object.h:
3604         * kjs/nodes.cpp:
3605         * kjs/nodes.h:
3606         * kjs/nodes2string.cpp:
3607         * kjs/number_object.cpp:
3608         * kjs/number_object.h:
3609         * kjs/object.cpp:
3610         * kjs/object.h:
3611         * kjs/object_object.cpp:
3612         * kjs/object_object.h:
3613         * kjs/operations.cpp:
3614         * kjs/operations.h:
3615         * kjs/property_map.cpp:
3616         * kjs/property_map.h:
3617         * kjs/reference.cpp:
3618         * kjs/reference.h:
3619         * kjs/reference_list.cpp:
3620         * kjs/reference_list.h:
3621         * kjs/regexp.cpp:
3622         * kjs/regexp.h:
3623         * kjs/regexp_object.cpp:
3624         * kjs/regexp_object.h:
3625         * kjs/scope_chain.cpp:
3626         * kjs/scope_chain.h:
3627         * kjs/simple_number.h:
3628         * kjs/string_object.cpp:
3629         * kjs/string_object.h:
3630         * kjs/testkjs.cpp:
3631         * kjs/types.h:
3632         * kjs/ustring.cpp:
3633         * kjs/ustring.h:
3634         * kjs/value.cpp:
3635         * kjs/value.h:
3636
3637 2005-07-14  Geoffrey Garen  <ggaren@apple.com>
3638
3639         -fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3970
3640         throw statements fail inside eval statements
3641         
3642         Reviewed by mjs.
3643
3644         * kjs/function.cpp:
3645         (KJS::GlobalFuncImp::call):
3646         Big change since I fixed the tabbing. The important part is:
3647         if (c.complType() == Throw)
3648           exec->setException(c.value());
3649
3650         * kjs/nodes.cpp:
3651         (ThrowNode::execute): removed duplicate KJS_CHECKEXCEPTION
3652         (TryNode::execute): 
3653         try now clears the exception state before the finally block executes,
3654         and checks the state after the block executes, so that exceptions in
3655         finally code get caught.
3656
3657         * tests/mozilla/expected.html:
3658
3659 2005-07-14  Geoffrey Garen  <ggaren@apple.com>
3660         
3661         -landed fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=3412
3662         Object.prototype is missing toLocaleString
3663
3664         - patch by Mark Rowe (bdash) <opendarwin.org@bdash.net.nz>
3665         
3666         -layout test info in webcore changelog
3667
3668         Reviewed by mjs.
3669
3670         * kjs/object_object.cpp:
3671         (ObjectPrototypeImp::ObjectPrototypeImp):
3672         (ObjectProtoFuncImp::call):
3673         * kjs/object_object.h:
3674         (KJS::ObjectProtoFuncImp::):
3675
3676 2005-07-12  Geoffrey Garen  <ggaren@apple.com>
3677
3678         Reviewed by mjs.
3679
3680         * kjs/function.cpp:
3681         (KJS::IndexToNameMap::operator[]): fixed infinite recursion
3682         bug in last checkin
3683
3684 2005-07-12  Geoffrey Garen  <ggaren@apple.com>
3685
3686         -fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3881
3687         arguments object should share values with function parameters
3688
3689         Reviewed by mjs.
3690
3691         ArgumentsImp now uses a simple hash lookup to share values
3692         with the activation object.
3693
3694         * kjs/function.cpp:
3695         (KJS::FunctionImp::getParameterName):
3696         (KJS::IndexToNameMap::IndexToNameMap):
3697         (KJS::IndexToNameMap::~IndexToNameMap):
3698         (KJS::IndexToNameMap::isMapped):
3699         (KJS::IndexToNameMap::unMap):
3700         (KJS::IndexToNameMap::operator[]):
3701         (KJS::ArgumentsImp::ArgumentsImp):
3702         (KJS::ArgumentsImp::mark):
3703         (KJS::ArgumentsImp::get):
3704         (KJS::ArgumentsImp::put):
3705         (KJS::ArgumentsImp::deleteProperty):
3706         (KJS::ArgumentsImp::hasOwnProperty):
3707         (KJS::ActivationImp::createArgumentsObject):
3708         * kjs/function.h:
3709         * tests/mozilla/expected.html: updated results
3710
3711 2005-07-09  Maciej Stachowiak  <mjs@apple.com>
3712
3713         - backing out my earlier collector change, it causes a performance regression in TOT
3714
3715         * kjs/collector.cpp:
3716         (KJS::Collector::allocate):
3717
3718 2005-07-08  Eric Seidel  <eseidel@apple.com>
3719
3720         Reviewed by mjs/hyatt (only in concept).
3721
3722         * JavaScriptCore.pbproj/project.pbxproj: Added JavaScriptCore+SVG
3723         Turns on RTTI support for JavaScriptCore.framework when
3724         building the JavaScriptCore+SVG target.  This is needed as
3725         kdom (part of WebCore+SVG) requires RTTI for the time being.
3726
3727 2005-07-08  Maciej Stachowiak  <mjs@apple.com>
3728
3729         Reviewed by hyatt.
3730
3731         - When there are many live objects, GC less often, to try to make
3732         GC cost proportional to garbage, not proportional to total memory used.
3733
3734         * kjs/collector.cpp:
3735         (KJS::Collector::allocate):
3736
3737 2005-07-08  Vicki Murley  <vicki@apple.com>
3738
3739         Fix from Carsten Guenther, reviewed by Maciej
3740
3741         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3644 (Error string representation)
3742
3743         Switch from "-" to ":" in error strings.
3744
3745         * kjs/error_object.cpp:
3746         (ErrorProtoFuncImp::call):
3747         * tests/mozilla/expected.html:
3748
3749 2005-07-08  Geoffrey Garen  <ggaren@apple.com>
3750
3751         -rolled in patch for http://bugzilla.opendarwin.org/show_bug.cgi?id=3878
3752         arguments object should be an object not an array
3753
3754         Reviewed by mjs.
3755
3756         * kjs/function.cpp:
3757         (KJS::ArgumentsImp::ArgumentsImp): now manually handles initialization
3758         we used to get for free by inheriting from ArrayInstanceImp
3759         * kjs/function.h: ArgumentsImp now inherits from ObjectImp
3760         * tests/mozilla/expected.html: updated expected test results
3761
3762 2005-07-07  Eric Seidel  <eseidel@apple.com>
3763
3764         Reviewed by mjs.
3765
3766         * kjs/grammar.y: removed #define YYMAXDEPTH 0 for bison 2.0
3767         http://bugzilla.opendarwin.org/show_bug.cgi?id=3882
3768
3769 2005-07-03  Maciej Stachowiak  <mjs@apple.com>
3770
3771         Original patch from Mark Rowe <opendarwin.org@bdash.net.nz>, reviewed by me.
3772         Fixes to patch by me, reviewed by John Sullivan.
3773
3774         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3293
3775
3776         Test cases added:
3777         * tests/mozilla/expected.html: Two tests newly pass.
3778
3779         * bindings/objc/objc_runtime.h:
3780         * bindings/objc/objc_runtime.mm:
3781         (ObjcFallbackObjectImp::hasOwnProperty):
3782         * bindings/runtime_array.cpp:
3783         (RuntimeArrayImp::hasOwnProperty):
3784         * bindings/runtime_array.h:
3785         * bindings/runtime_object.cpp:
3786         (RuntimeObjectImp::hasOwnProperty):
3787         * bindings/runtime_object.h:
3788         * kjs/array_instance.h:
3789         * kjs/array_object.cpp:
3790         (ArrayInstanceImp::hasOwnProperty):
3791         * kjs/function.cpp:
3792         (KJS::FunctionImp::hasOwnProperty):
3793         (KJS::ActivationImp::hasOwnProperty):
3794         * kjs/function.h:
3795         * kjs/lookup.h:
3796         * kjs/object.cpp:
3797         (KJS::ObjectImp::hasProperty):
3798         (KJS::ObjectImp::hasOwnProperty):
3799         * kjs/object.h:
3800         (KJS::Object::hasOwnProperty):
3801         * kjs/object_object.cpp:
3802         (ObjectPrototypeImp::ObjectPrototypeImp):
3803         (ObjectProtoFuncImp::call):
3804         * kjs/object_object.h:
3805         (KJS::ObjectProtoFuncImp::):
3806         * kjs/string_object.cpp:
3807         (StringInstanceImp::hasOwnProperty):
3808         * kjs/string_object.h:
3809
3810 2005-07-01  Geoffrey Garen  <ggaren@apple.com>
3811
3812         -landed patch by Eric Seidel <macdome@opendarwin.org>
3813         
3814         -for http://bugzilla.opendarwin.org/show_bug.cgi?id=3657
3815         GroundWork:  Moving some functions from khtml->jsc following kjs TOT
3816         
3817         - no layout test necessary yet - only groundwork
3818
3819         Reviewed by darin.
3820
3821         * kjs/lookup.h:
3822         (KJS::cacheGlobalObject):
3823
3824 2005-07-01  Geoffrey Garen  <ggaren@apple.com>
3825
3826         -landed patch by Carsten Guenther <cguenther@gmail.com>
3827
3828         -fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3477
3829         some US-centric date formats not parsed by JavaScript (clock at news8austin.com)
3830
3831         -relevant tests:
3832                mozilla/ecma_3/Date/15.9.5.5.js 
3833                layout-tests/fast/js/date-parse-test.html
3834
3835         Reviewed by darin.
3836
3837         * kjs/date_object.cpp:
3838         (formatLocaleDate):
3839         (day):
3840         (dayFromYear):
3841         (daysInYear):
3842         (timeFromYear):
3843         (yearFromTime):
3844         (weekDay):
3845         (timeZoneOffset):
3846         (DateProtoFuncImp::call):
3847         (DateObjectImp::construct):
3848         (KJS::parseDate):
3849         (ymdhms_to_seconds):
3850         (KJS::makeTime):
3851         (findMonth):
3852         (KJS::KRFCDate_parseDate):
3853         * kjs/date_object.h:
3854         * tests/mozilla/expected.html: updated expected results to reflect fix
3855
3856 2005-07-01  Geoffrey Garen  <ggaren@apple.com>
3857
3858         -fixed <rdar://problem/4168186> JavaScript fails to throw exceptions 
3859         for invalid return statements
3860         
3861         relevant tests:
3862             ecma/Statements/12.9-1-n.js
3863             ecma_2/Exceptions/lexical-052.js
3864             ecma_2/Exceptions/statement-009.js
3865
3866         Reviewed by sullivan.
3867
3868         * kjs/nodes.cpp:
3869         (ReturnNode::execute): now throws exception if return is not inside
3870         a function.
3871
3872         * tests/mozilla/expected.html: updated to reflect fix
3873
3874 2005-07-01  Geoffrey Garen  <ggaren@apple.com>
3875
3876         Reviewed by sullivan.
3877
3878         * tests/mozilla/expected.html: Updated test results for last fix.
3879
3880 2005-07-01  Geoffrey Garen  <ggaren@apple.com>
3881
3882         -fixed <rdar://problem/4168161> JavaScript fails to throw an exception 
3883         for invalid function calls
3884         
3885         Reviewed by sullivan.
3886
3887         Relevant mozilla test: ecma_3/Exceptions/regress-95101.js 
3888
3889         * kjs/nodes.cpp:
3890         (FunctionCallNode::evaluate): evaluate now checks for an exception
3891         after resolving a function name (in case the function is undefined)
3892
3893 2005-07-01  Eric Seidel  <eseidel@apple.com>
3894
3895         Reviewed by darin.
3896
3897         * kjs/interpreter.h:
3898         (KJS::Context::curStmtFirstLine): stub for compatibility with KDE
3899         * kjs/value.h:
3900         (KJS::Value::isValid): compatibility with KDE
3901         http://bugzilla.opendarwin.org/show_bug.cgi?id=3687
3902
3903 2005-07-01  Eric Seidel  <eseidel@apple.com>
3904
3905         Reviewed by darin.
3906
3907         * kjs/create_hash_table: rolled in changes from KDE, including
3908         -n <namespace> support from KDOM and support for newer comments
3909         http://bugzilla.opendarwin.org/show_bug.cgi?id=3771
3910
3911 2005-06-30  Geoffrey Garen  <ggaren@apple.com>
3912
3913         -rolled in KDE fix to <rdar://problem/4167660> JavaScript fails to 
3914         throw exceptions for invalid break/continue statements
3915
3916         No layout tests because it's already covered by the Mozilla suite
3917
3918         Reviewed by mjs.
3919
3920         * kjs/internal.h: LabelStack now tracks where you are relative to
3921         switch and iteration (loop) statements
3922         
3923         (KJS::LabelStack::LabelStack):
3924         (KJS::LabelStack::pushIteration):
3925         (KJS::LabelStack::popIteration):
3926         (KJS::LabelStack::inIteration):
3927         (KJS::LabelStack::pushSwitch):
3928         (KJS::LabelStack::popSwitch):
3929         (KJS::LabelStack::inSwitch):
3930
3931         * kjs/nodes.cpp: 
3932         These files were updated to use the new LabelStack:
3933         (DoWhileNode::execute): 
3934         (WhileNode::execute):
3935         (ForNode::execute):
3936         (ForInNode::execute):
3937         (SwitchNode::execute):
3938         
3939         These files were updated to throw exceptions for invalid
3940         break/continue statements:
3941         (BreakNode::execute): 
3942         (ContinueNode::execute):
3943
3944         * tests/mozilla/expected.html: Updated expected results to reflect fix
3945
3946 2005-06-30  Kevin Decker  <kdecker@apple.com>
3947
3948         Reviewed by rjw.
3949
3950         fixed: <rdar://problem/4166838> failed assertion in`Interpreter::lockCount() > 0
3951
3952         no layout test added; this is in the bindings code.
3953
3954         * bindings/objc/WebScriptObject.mm:
3955         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]): make sure to lock and unlock the interpreter around allocations. 
3956
3957 2005-06-29  Geoffrey Garen  <ggaren@apple.com>
3958
3959         Patch by Francisco Tolmasky <tolmasky@gmail.com>
3960
3961         - fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3667
3962         Core JavaScript 1.5 Reference:Objects:Array:forEach
3963
3964         See WebCore Changelog for layout tests added.
3965
3966         Reviewed by darin.
3967
3968         * kjs/array_object.cpp:
3969         (ArrayProtoFuncImp::call):
3970         * kjs/array_object.h:
3971         (KJS::ArrayProtoFuncImp::):
3972
3973 2005-06-29  Geoffrey Garen  <ggaren@apple.com>
3974
3975         Patch contributed by Oliver Hunt <ojh16@student.canterbury.ac.nz>
3976
3977         -fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3743
3978         Incorrect error message given for certain calls
3979
3980         See WebCore Changelog for layout test added.
3981
3982         Reviewed by mjs.
3983
3984         * kjs/object.cpp:
3985         (KJS::ObjectImp::defaultValue):
3986
3987 2005-06-29  Geoffrey Garen  <ggaren@apple.com>
3988
3989         Rolling out date patch from 6-28-05 because it breaks 
3990         fast/js/date-parse-test
3991
3992         * kjs/date_object.cpp:
3993         (formatLocaleDate):
3994         (DateProtoFuncImp::call):
3995         (DateObjectImp::construct):
3996         (KJS::parseDate):
3997         (ymdhms_to_seconds):
3998         (isSpaceOrTab):
3999         (KJS::KRFCDate_parseDate):
4000         * kjs/date_object.h:
4001         * tests/mozilla/expected.html:
4002
4003 2005-06-29  Geoffrey Garen  <ggaren@apple.com>
4004
4005         Reviewed by Darin.
4006
4007         -fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3750
4008         build fails with KJS_VERBOSE set
4009
4010         * kjs/nodes.cpp: changed debug print statement to use UString
4011         (VarDeclNode::evaluate):
4012         * kjs/reference.cpp: ditto
4013         (KJS::Reference::putValue):
4014
4015 2005-06-28  Geoffrey Garen  <ggaren@apple.com>
4016
4017         Patch contributed by Carsten Guenther <cguenther@gmail.com>.
4018
4019         -fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3477
4020         some US-centric date formats not parsed by JavaScript (clock at news8austin.com)
4021
4022         Reviewed by darin.
4023
4024         * kjs/date_object.cpp:
4025         (formatLocaleDate):
4026         (day):
4027         (dayFromYear):
4028         (daysInYear):
4029         (timeFromYear):
4030         (yearFromTime):
4031         (weekDay):
4032         (timeZoneOffset):
4033         (DateProtoFuncImp::call):
4034         (DateObjectImp::construct):
4035         (KJS::parseDate):
4036         (ymdhms_to_seconds):
4037         (KJS::makeTime):
4038         (findMonth):
4039         (KJS::KRFCDate_parseDate):
4040         * kjs/date_object.h:
4041         * tests/mozilla/expected.html: updated expected test results to reflect fix
4042
4043 2005-06-26  Maciej Stachowiak  <mjs@apple.com>
4044
4045         Reviewed by Darin.
4046
4047         - replace hash functions  with better ones
4048
4049         * JavaScriptCore.pbproj/project.pbxproj: Add new file to build.
4050         * kjs/interpreter_map.cpp:
4051         (KJS::InterpreterMap::computeHash): Use shared pointer hash.
4052         * kjs/pointer_hash.h: Added.
4053         (KJS::pointerHash): Pointer hash based on 32-bit mix and 64-bit mix hashes.
4054         * kjs/protected_values.cpp:
4055         (KJS::ProtectedValues::computeHash): Use shared pointer hash.
4056         * kjs/ustring.cpp:
4057         (KJS::UString::Rep::computeHash): Use SuperFastHash algorithm.
4058
4059 2005-06-22  Darin Adler  <darin@apple.com>
4060
4061         Change by Anders Carlsson.
4062         Reviewed by me.
4063
4064         - fixed <http://bugzilla.opendarwin.org/show_bug.cgi?id=3294>
4065           String.prototype.replace() fails with function as second param
4066
4067         * kjs/string_object.cpp: (replace): Added code to handle functions.
4068
4069         * tests/mozilla/expected.html: Updated since ecma_3/RegExp/regress-209067.js is fixed now.
4070
4071         * tests/mozilla/run-mozilla-tests: Fix a minor coding style issue that leads to a warning each
4072         time we run the tests.
4073
4074 2005-06-21  Adele Peterson  <adele@apple.com>
4075
4076         rolling out fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=3293, since it caused layout test failures.
4077         fast/forms/element-by-name
4078         fast/loader/loadInProgress
4079
4080         * ChangeLog:
4081         * bindings/objc/objc_runtime.h:
4082         * bindings/objc/objc_runtime.mm:
4083         (ObjcFallbackObjectImp::hasProperty):
4084         * bindings/runtime_array.cpp:
4085         (RuntimeArrayImp::hasProperty):
4086         * bindings/runtime_array.h:
4087         * bindings/runtime_object.cpp:
4088         (RuntimeObjectImp::hasProperty):
4089         * bindings/runtime_object.h:
4090         * kjs/array_instance.h:
4091         * kjs/array_object.cpp:
4092         (ArrayInstanceImp::hasProperty):
4093         * kjs/function.cpp:
4094         (KJS::FunctionImp::hasProperty):
4095         (KJS::ActivationImp::hasProperty):
4096         * kjs/function.h:
4097         * kjs/object.cpp:
4098         (KJS::ObjectImp::hasProperty):
4099         * kjs/object.h:
4100         * kjs/object_object.cpp:
4101         (ObjectPrototypeImp::ObjectPrototypeImp):
4102         (ObjectProtoFuncImp::call):
4103         * kjs/object_object.h:
4104         (KJS::ObjectProtoFuncImp::):
4105         * kjs/string_object.cpp:
4106         (StringInstanceImp::hasProperty):
4107         * kjs/string_object.h:
4108         * tests/mozilla/expected.html:
4109
4110 2005-06-21  Darin Adler  <darin@apple.com>
4111
4112         * JavaScriptCore.pbproj/project.pbxproj: Switched to a build rule rather than a build phase for
4113         .y files -- this gets rid of the problem where modifying the .y file would not cause sufficient
4114         compilation.
4115
4116         * kjs/grammar_wrapper.cpp: Removed.
4117
4118 2005-06-21  Adele Peterson  <adele@apple.com>
4119
4120         Patch from Anders Carlsson <andersca@mac.com>, reviewed by Darin.
4121
4122         Fixed: <http://bugzilla.opendarwin.org/show_bug.cgi?id=3450>
4123         <rdar://problem/3881901> String.replace() method not working when regex pattern contains {n, m}
4124
4125         * pcre/pcre.c: (pcre_compile): Remember the last char length so it can be subtracted correctly if needed.
4126