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