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