1 2007-09-24 Kevin McCullough <kmccullough@apple.com>
5 - Continued to update project files to not use Edit and Continue for Debug Information since it doesn't work and breaks some functionality.
7 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
8 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
10 2007-09-21 Kevin McCullough <kmccullough@apple.com>
14 - Updated project files to not use Edit and Continue for Debug Information since it doesn't work and breaks some functionality.
16 * JavaScriptCore.vcproj/dftables/dftables.vcproj:
17 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
19 2007-09-20 Holger Hans Peter Freyther <zecke@selfish.org>
21 Rubber stamped by Adam.
23 Renamed files from *Gdk to *Gtk (see #14732) using the
24 work of Juan A. Suarez Romero as a base.
31 * wtf/Platform.h: PLATFORM(GDK) to PLATFORM(GTK)
33 2007-09-21 Mark Rowe <mrowe@apple.com>
35 Reviewed by Antti Koivisto.
37 http://bugs.webkit.org/show_bug.cgi?id=15250
38 <rdar://problem/5496942> REGRESSION: Reproducible crash in Safari when evaluating script in Drosera console (15250)
41 (KJS::GlobalFuncImp::callAsFunction): Null-check thisObj before passing it to interpreterForGlobalObject.
43 2007-09-19 Holger Hans Peter Freyther <zecke@selfish.org>
45 Rubber stamped by Adam.
47 Make the guard/#if use the same name (ENABLE_FTPDIR) as the #define. This follows
48 the ENABLE_ICONDATABASE example from a couple of lines above.
52 2007-09-19 Mark Rowe <mrowe@apple.com>
56 <rdar://problem/5487107> NULL dereference crash in FastMallocZone::enumerate when running leaks against Safari
58 Storing remote pointers to their local equivalents in mapped memory was leading to the local pointer being
59 interpreted as a remote pointer. This caused a crash when using the result of mapping this invalid remote pointer.
60 The fix is to follow the pattern used elsewhere in FastMallocZone by always doing the mapping after reading and
61 never storing the mapped pointer.
64 (WTF::FastMallocZone::enumerate):
66 2007-09-15 Darin Adler <darin@apple.com>
70 * JavaScriptCore.exp: Export WTFLogVerbose.
72 2007-09-14 Kevin McCullough <kmccullough@apple.com>
76 - Copy JSRetainPtr to include folder.
78 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
80 2007-09-13 Geoffrey Garen <ggaren@apple.com>
87 2007-09-12 Geoff Garen <ggaren@apple.com>
89 Reviewed by Sam Weinig.
91 Fixed <rdar://problem/5429064> 141885 Safari JavaScript: Math.random() slightly less randomly distributed than on Safari / Mac
93 Math.random was skewed slightly upward because it assumed that RAND_MAX was outside the range of
94 values that rand() might return. This problem was particularly pronounced on Windows because
95 the range of values returned by rand() on Windows is 2^16 smaller than the range of values
96 return by rand() on Mac.
98 Fixed by accounting for RAND_MAX return values. Also, switched Windows over to rand_s, which has
99 a range that's equal to rand()'s range on Mac.
103 * kjs/math_object.cpp:
104 (MathFuncImp::callAsFunction): Use the new new thing.
106 * wtf/MathExtras.h: Platform abstraction for random numbers, to cover over differences on Windows.
110 2007-09-13 Antti Koivisto <antti@apple.com>
114 Small addition to previous path to cover
115 http://bugs.webkit.org/show_bug.cgi?id=11399
116 window.eval runs in the global scope of the calling window
118 Switch variable scope as well.
121 (KJS::GlobalFuncImp::callAsFunction):
123 2007-09-12 Antti Koivisto <antti@apple.com>
125 Reviewed by Geoff, Maciej.
127 Fix <rdar://problem/5445058>
128 REGRESSION: Unable to upload picture to eBay auction due to domain security check
130 eBay uses window.eval() between windows. In Firefox window.eval() switches execution
131 and security context to the target window, something WebKit did not do. With WebKit
132 security tightening in r24781, this broke picture uploads.
134 Fix by making WebKit switch context in window.eval().
137 (KJS::Context::Context):
138 (KJS::Context::~Context):
140 Save and restore interpreter context independently from calling context.
143 (KJS::GlobalFuncImp::callAsFunction):
144 If eval is called for global object different than current one, switch execution context
145 to that object and push it to scope.
147 2007-09-12 Sam Weinig <sam@webkit.org>
149 Reviewed by Geoffrey Garen.
151 <rdar://problem/5478717> JSStringCreateWithCFString leaks when passed a zero length CFStringRef
153 * API/JSStringRefCF.cpp:
154 (JSStringCreateWithCFString): Special case the zero length string and remove the
155 UTF16 optimized path since it will always leak due to the fact that we won't be
156 able to free the backing store that the CFStringRef provides.
158 2007-09-10 Timothy Hatcher <timothy@apple.com>
160 Reviewed by Darin Adler.
162 <rdar://problem/5456224> CrashTracer: [USER] 2 crashes in Toast Titanium at com.apple.CoreServices.CarbonCore: CSMemDisposePtr + 37
164 Removed the implementation of these malloc zone functions. We do not have the ability to
165 check if a pointer is valid or not, so we can't correctly implement them. The system free
166 does not fail if you pass in a bad pointer.
168 * wtf/FastMalloc.cpp:
169 (WTF::FastMallocZone::size):
170 (WTF::FastMallocZone::zoneMalloc):
171 (WTF::FastMallocZone::zoneCalloc):
172 (WTF::FastMallocZone::zoneFree):
173 (WTF::FastMallocZone::zoneRealloc):
175 2007-09-07 Darin Adler <darin@apple.com>
177 Reviewed by Steve Falkenburg.
179 - fix crash seen on Windows release builds
181 * wtf/FastMalloc.cpp: Change pthread_getspecific optimization to be done only
182 on the DARWIN platform. Also correct a couple reinterpret_cast that should be
185 2007-09-06 Kevin McCullough <kmccullough@apple.com>
189 - Moved JSRetainPtr to the API.
191 * API/JSRetainPtr.h: Copied from kjs/JSRetainPtr.h.
194 (JSRetainPtr::JSRetainPtr):
195 (JSRetainPtr::~JSRetainPtr):
197 (JSRetainPtr::releaseRef):
198 (JSRetainPtr::operator->):
199 (JSRetainPtr::operator!):
200 (JSRetainPtr::operator UnspecifiedBoolType):
207 * JavaScriptCore.xcodeproj/project.pbxproj:
208 * kjs/JSRetainPtr.h: Removed.
210 2007-09-05 Maciej Stachowiak <mjs@apple.com>
214 - Remove single-threaded optimization for FastMalloc.
216 It does not appear to help anywhere but Mac OS X on PPC, due to
217 pthread_getspecific being slow there. On Intel, removing the
218 optimization results in a ~1.5% PLT speedup, a ~1-5% JS iBench
219 speedup, and a ~1.5% HTML iBench speedup. On PPC this change is a
220 speedup on some benchmarks, a slight hit on others.
222 * JavaScriptCore.xcodeproj/project.pbxproj:
224 (KJS::Collector::registerThread):
225 * wtf/FastMalloc.cpp:
226 (WTF::TCMalloc_ThreadCache::GetCache):
227 (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
228 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
230 * wtf/FastMallocInternal.h: Removed.
232 2007-09-05 Kevin McCullough <kmccullough@apple.com>
234 Reviewed by Adam, Sam, Darin.
236 - Created a JSRetainPtr specifically for JSStringRefs so they can be automatically refed and derefed.
238 * JavaScriptCore.xcodeproj/project.pbxproj:
239 * kjs/JSRetainPtr.h: Copied from wtf/RetainPtr.h.
243 (KJS::JSRetainPtr::JSRetainPtr):
244 (KJS::JSRetainPtr::~JSRetainPtr):
245 (KJS::JSRetainPtr::get):
246 (KJS::JSRetainPtr::releaseRef):
247 (KJS::JSRetainPtr::operator->):
248 (KJS::JSRetainPtr::operator UnspecifiedBoolType):
256 2007-09-05 Mark Rowe <mrowe@apple.com>
258 Unreviewed Qt build fix.
260 * wtf/unicode/qt4/UnicodeQt4.h: Fix the constness of the src argument to toUpper to prevent build failures.
262 2007-09-04 Maciej Stachowiak <mjs@apple.com>
264 Back out accidentally committed change.
266 * JavaScriptCore.xcodeproj/project.pbxproj:
268 (KJS::Collector::registerThread):
269 * wtf/FastMalloc.cpp:
270 (WTF::fastMallocSetIsMultiThreaded):
271 (WTF::TCMalloc_ThreadCache::GetCache):
272 (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
273 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
275 * wtf/FastMallocInternal.h: Added.
277 2007-09-04 Maciej Stachowiak <mjs@apple.com>
281 - Added Vector::appendRange(), which appends to a vector based on a given start and end iterator
282 - Added keys() and values() functions to HashMap iterators, which give keys-only and values-only iterators
284 Together, these allow easy copying of a set, or the keys or values of a map, into a Vector. Examples:
286 HashMap<int, int> map;
290 vec.appendRange(set.begin(), set.end());
291 vec.appendRange(map.begin().keys(), map.end().keys());
292 vec.appendRange(map.begin().values(), map.end().values());
294 This also allows for a slightly nicer syntax when iterating a map. Instead of saying
295 (*it)->first, you can say *it.values(). Similarly for keys. Example:
297 HashMap<int, int>::const_iterator end = map.end();
298 for (HashMap<int, int>::const_iterator it = map.begin(); it != end; ++it)
299 printf(" [%d => %d]", *it.keys(), *it.values());
301 * JavaScriptCore.xcodeproj/project.pbxproj:
302 * wtf/HashIterators.h: Added.
304 (WTF::HashTableConstKeysIterator::HashTableConstKeysIterator):
305 (WTF::HashTableConstKeysIterator::get):
306 (WTF::HashTableConstKeysIterator::operator*):
307 (WTF::HashTableConstKeysIterator::operator->):
308 (WTF::HashTableConstKeysIterator::operator++):
309 (WTF::HashTableConstValuesIterator::HashTableConstValuesIterator):
310 (WTF::HashTableConstValuesIterator::get):
311 (WTF::HashTableConstValuesIterator::operator*):
312 (WTF::HashTableConstValuesIterator::operator->):
313 (WTF::HashTableConstValuesIterator::operator++):
314 (WTF::HashTableKeysIterator::HashTableKeysIterator):
315 (WTF::HashTableKeysIterator::get):
316 (WTF::HashTableKeysIterator::operator*):
317 (WTF::HashTableKeysIterator::operator->):
318 (WTF::HashTableKeysIterator::operator++):
319 (WTF::HashTableKeysIterator::operator HashTableConstKeysIterator<HashTableType, KeyType, MappedType>):
320 (WTF::HashTableValuesIterator::HashTableValuesIterator):
321 (WTF::HashTableValuesIterator::get):
322 (WTF::HashTableValuesIterator::operator*):
323 (WTF::HashTableValuesIterator::operator->):
324 (WTF::HashTableValuesIterator::operator++):
325 (WTF::HashTableValuesIterator::operator HashTableConstValuesIterator<HashTableType, KeyType, MappedType>):
330 (WTF::::appendRange):
332 2007-09-04 Maciej Stachowiak <mjs@apple.com>
336 - Remove single-threaded optimization for FastMalloc.
338 It does not appear to help anywhere but Mac OS X on PPC, due to
339 pthread_getspecific being slow there. On Intel, removing the
340 optimization results in a 1% PLT speedup, a 2% JS iBench speedup,
341 and no measurable effect on HTML iBench (maybe a slight speedup).
343 * JavaScriptCore.xcodeproj/project.pbxproj:
345 (KJS::Collector::registerThread):
346 * wtf/FastMalloc.cpp:
347 (WTF::TCMalloc_ThreadCache::GetCache):
348 (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
349 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
351 * wtf/FastMallocInternal.h: Removed.
353 2007-09-03 Mark Rowe <mrowe@apple.com>
355 Reviewed by Tim Hatcher.
357 <rdar://problem/5452164> Production build with in symbols directory has no debug info
359 Enable debug symbol generation on all build configurations. Production builds are stripped
360 of symbols by Xcode during deployment post-processing.
362 * Configurations/Base.xcconfig:
363 * JavaScriptCore.xcodeproj/project.pbxproj:
365 2007-08-30 Riku Voipio <riku.voipio@iki.fi>
367 Reviewed by Dave Kilzer.
371 * kjs/ustring.h: Update comments to reflect the change and update test
372 to fit changes to Platform.h.
373 * wtf/Platform.h: Forced packing is only needed on oldabi ARM.
374 Set middle-endian floats only for little-endian oldabi ARM.
375 Set big-endian define for big-endian ARM.
377 2007-08-29 Ryan Leavengood <leavengood@gmail.com>
381 http://bugs.webkit.org/show_bug.cgi?id=15043
382 - posix_memalign takes a void** as its first parameter. My port makes use of this function call.
385 (KJS::allocateBlock):
387 2007-08-26 Darin Adler <darin@apple.com>
389 - quick follow on to that last check-in
391 * API/JSCallbackObject.cpp: (KJS::JSCallbackObject::JSCallbackObject):
392 Need to initialize m_class to 0.
394 2007-08-26 Mark Rowe <mrowe@apple.com>
396 Reviewed by Darin Adler.
398 <rdar://problem/4949002> JSGlobalContextCreate can cause crashes because it passes a NULL JSContextRef to the globalObjectClass's initialize callback
400 JSCallbackObject now tracks whether it was constructed with a null ExecState. This will happen when the object is being used as the global object,
401 as the Interpreter needs to be created after the global object. In this situation the initialization is deferred until after the Interpreter's
402 ExecState is available to be passed down to the initialize callbacks.
404 * API/JSCallbackObject.cpp:
405 (KJS::JSCallbackObject::init): Track whether we successfully initialized.
406 (KJS::JSCallbackObject::initializeIfNeeded): Attempt to initialize with the new ExecState.
407 * API/JSCallbackObject.h:
408 * API/JSContextRef.cpp:
409 (JSGlobalContextCreate): Initialize the JSCallbackObject with the Interpreter's ExecState.
411 (testInitializeOfGlobalObjectClassHasNonNullContext):
412 (main): Verify that the context passed to the initialize callback is non-null.
414 2007-08-26 Mark Rowe <mrowe@apple.com>
416 Reviewed by Darin Adler.
418 <rdar://problem/5438496> JSGlobalContextCreate crashes when passed a custom class
420 * API/JSContextRef.cpp:
421 (JSGlobalContextCreate): Specify jsNull() as the prototype and let Interpreter's constructor fix it up to point at builtinObjectPrototype().
423 (main): Use an instance of a custom class as the global object to ensure the code path is exercised in the test.
425 2007-08-26 Mike Hommey <glandium@debian.org>
427 Reviewed by Mark Rowe and David Kilzer.
429 Fix build failure on arm.
431 * wtf/Platform.h: Also test if __arm__ is defined.
433 2007-08-25 Peter Kasting <zerodpx@gmail.org>
435 Reviewed by Maciej Stachowiak.
437 Part 3 of http://bugs.webkit.org/show_bug.cgi?id=14967
438 Bug 14967: Reduce wtf::Vector::operator[]() overloads
441 (WTF::Vector::operator[]): Only provide versions of operator[] that takes a size_t argument.
443 2007-08-25 Peter Kasting <zerodpx@gmail.org>
445 Reviewed by Sam Weinig.
447 Part 2 of http://bugs.webkit.org/show_bug.cgi?id=14967.
448 Eliminate all remaining implicit conversions of wtf::Vector<T> to T*. Where code was
449 previously checking that the Vector's data pointer was non-NULL, check !Vector::isEmpty()
455 2007-08-16 Kevin McCullough <kmccullough@apple.com>
457 Reviewed by Geoff and Adam.
459 - Changing stack depth to 500 (from 100 on mac and win) to help out some apps specifically gmail. <rdar://problem/3590522> JavaScript call stack limit of 99 is too small for some applications; needs to be closer to 500 (4045)
463 2007-08-15 Peter Kasting <zerodpx@gmail.org>
467 http://bugs.webkit.org/show_bug.cgi?id=14967 part 1 - Eliminate most implicit
468 conversions of wtf::Vector<T> to T* by explicitly calling .data()
470 * API/JSCallbackConstructor.cpp:
471 (KJS::JSCallbackConstructor::construct):
472 * API/JSCallbackFunction.cpp:
473 (KJS::JSCallbackFunction::callAsFunction):
474 * API/JSCallbackObject.cpp:
475 (KJS::JSCallbackObject::construct):
476 (KJS::JSCallbackObject::callAsFunction):
477 * bindings/c/c_instance.cpp:
478 (KJS::Bindings::CInstance::invokeMethod):
479 (KJS::Bindings::CInstance::invokeDefaultMethod):
480 * kjs/number_object.cpp:
481 (integer_part_noexp):
484 (KJS::UString::UTF8String):
486 2007-08-14 Darin Adler <darin@apple.com>
490 - fix <rdar://problem/5410570> Global initializer introduced by use of std::numeric_limits in r24919
493 (KJS::overflowIndicator): Turned into a function.
494 (KJS::maxUChars): Ditto.
495 (KJS::allocChars): Use the functions.
496 (KJS::reallocChars): Ditto.
497 (KJS::UString::expandedSize): Ditto.
499 2007-08-12 Darin Adler <darin@apple.com>
503 - fix http://bugs.webkit.org/show_bug.cgi?id=14931
504 <rdar://problem/5403816> JavaScript regular expression non-participating capturing parentheses
505 fail in 3 different ways
507 Test: fast/js/regexp-non-capturing-groups.html
509 * kjs/string_object.cpp:
510 (KJS::replace): Add missing code to handle undefined backreferences; before we'd get the empty string
511 instead of a JavaScript "undefined" value.
512 (KJS::StringProtoFunc::callAsFunction): Implemented backreference support for split.
513 * pcre/pcre_exec.c: (match): Made backreferences to undefined groups match the empty string instead
514 of always failing. Only in JAVASCRIPT mode.
516 * tests/mozilla/expected.html: Add a new expected test success, since this fixed one test result.
518 2007-08-10 Timothy Hatcher <timothy@apple.com>
522 <rdar://problem/5394449> Stop using some Carbon UI APIs for 64 bit
524 Disable the NPAPI for 64-bit on Mac OS X.
526 * Configurations/JavaScriptCore.xcconfig: Use the 64-bit export file.
527 * JavaScriptCore.xcodeproj/project.pbxproj: Create a 64-bit export file
528 that filters out the NPN fnctions.
529 * bindings/NP_jsobject.cpp: #ifdef out this for 64-bit on Mac OS X
530 * bindings/NP_jsobject.h: Ditto.
531 * bindings/c/c_class.cpp: Ditto.
532 * bindings/c/c_class.h: Ditto.
533 * bindings/c/c_instance.cpp: Ditto.
534 * bindings/c/c_instance.h: Ditto.
535 * bindings/c/c_runtime.cpp: Ditto.
536 * bindings/c/c_runtime.h: Ditto.
537 * bindings/c/c_utility.cpp: Ditto.
538 * bindings/c/c_utility.h: Ditto.
539 * bindings/npapi.h: Ditto.
540 * bindings/npruntime.cpp: Ditto.
541 * bindings/npruntime.h: Ditto.
542 * bindings/npruntime_impl.h: Ditto.
543 * bindings/npruntime_priv.h: Ditto.
544 * bindings/runtime.cpp:
545 (KJS::Bindings::Instance::createBindingForLanguageInstance):
546 don't creat an NPObject on Mac OS X in 64-bit.
548 2007-08-09 Mark Rowe <mrowe@apple.com>
552 <rdar://problem/5400709> Versioning in debug and release builds should include minor and tiny version before +
554 * Configurations/Version.xcconfig:
555 * JavaScriptCore.xcodeproj/project.pbxproj: Add a shell script phase to make to dependency between
556 Version.xcconfig and Info.plist explicit to Xcode.
558 2007-08-08 George Staikos <staikos@kde.org>
560 Make it compile with Qt again.
562 * wtf/unicode/qt4/UnicodeQt4.h:
563 (WTF::Unicode::toUpper):
565 2007-08-07 Sam Weinig <sam@webkit.org>
569 Fix for http://bugs.webkit.org/show_bug.cgi?id=14897
570 Decompilation of double negation fails and produces invalid or incorrect code
572 Test: fast/js/function-decompilation-operators.html
574 * kjs/nodes2string.cpp:
575 (UnaryPlusNode::streamTo): Put space after unary operator. Matches Firefox.
576 (NegateNode::streamTo): Diito.
577 (MultNode::streamTo): Put spaces around binary operator. Matches Firefox.
578 (AddNode::streamTo): Ditto.
580 2007-08-07 Darin Adler <darin@apple.com>
584 - fix <rdar://problem/5383104> REGRESSION: XHR.responseText is null instead of empty string
585 in http/tests/xmlhttprequest/zero-length-response.html
587 The new code to handle out of memory conditions was turning a "" into a null string.
589 * kjs/ustring.h: Removed UCharReference, which has long been obsolete and unused.
590 Removed copyForWriting, which was only used for the upper/lowercasing code and for
593 (KJS::allocChars): Removed special case that made this fail (return 0) when passed 0.
594 Instead assert that we're not passed 0. Also added an overflow check for two reasons:
595 1) for sizes that aren't checked this prevents us from allocating a buffer that's too
596 small, and 2) for sizes where we overflowed in the expandedSize function and returned
597 overflowIndicator, it guarantees we fail.
598 (KJS::reallocChars): Ditto.
599 (KJS::UString::expandedSize): Return a large number, overflowIndicator, rather than 0
600 for cases where we overflow.
601 (KJS::UString::spliceSubstringsWithSeparators): Added a special case for empty string so
602 we don't call allocChars with a length of 0.
603 (KJS::UString::operator=): Added special characters for both 0 and empty string so we
604 match the behavior of the constructor. This avoids calling allocChars with a length of 0
605 and making a null string rather than an empty string in that case, and also matches the
606 pattern used in the rest of the functions.
607 (KJS::UString::operator[]): Made the return value const so code that tries to use the
608 operator to modify the string will fail.
610 * kjs/string_object.cpp: (KJS::StringProtoFunc::callAsFunction): Rewrote uppercasing and
611 lowercasing functions so they don't need copyForWriting any more -- it wasn't really doing
612 any good for optimization purposes. Instead use a Vector and releaseBuffer.
614 * wtf/unicode/icu/UnicodeIcu.h: Eliminate one of the versions of toLower/toUpper -- we now
615 only need the version where both a source and destination buffer is passed in, not the one
617 * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
619 2007-08-06 Sam Weinig <sam@webkit.org>
623 Fix for http://bugs.webkit.org/show_bug.cgi?id=14891
624 Decompilation of try block immediately following "else" fails
626 Test: fast/js/toString-try-else.html
628 * kjs/nodes2string.cpp:
629 (TryNode::streamTo): Add newline before "try".
631 2007-08-07 Mark Rowe <mrowe@apple.com>
635 <rdar://problem/5388774> REGRESSION: Hang occurs after clicking "Attach a file " link in a new .Mac message
637 Attempting to acquire the JSLock inside CollectorHeap::forceLock can lead to a deadlock if the thread currently
638 holding the lock is waiting on the thread that is forking. It is not considered safe to use system frameworks
639 after a fork without first execing[*] so it is not particularly important to ensure that the collector and
640 fastMalloc allocators are unlocked in the child process. If the child process wishes to use JavaScriptCore it
641 should exec after forking like it would to use any other system framework.
642 [*]: <http://lists.apple.com/archives/Cocoa-dev/2005/Jan/msg00676.html>
644 * kjs/CollectorHeapIntrospector.cpp: Remove forceLock and forceUnlock implementations.
645 * kjs/CollectorHeapIntrospector.h: Stub out forceLock and forceUnlock methods.
646 * wtf/FastMalloc.cpp: Ditto.
648 2007-08-06 Darin Adler <darin@apple.com>
650 Rubber stamped by Geoff.
652 * kjs/ustring.h: Added an assertion which would have helped us find the
653 previous bug more easily.
655 2007-08-06 Darin Adler <darin@apple.com>
659 - fix <rdar://problem/5387589> 9A514: Quartz Composer crash on launch in KJS::jsString
662 (JSEvaluateScript): Turn NULL for sourceURL into UString::null(), just as JSObjectMakeFunction already does.
663 (JSCheckScriptSyntax): Ditto.
665 2007-08-06 Matt Lilek <pewtermoose@gmail.com>
667 Not reviewed, build fix.
669 * kjs/string_object.cpp:
670 (KJS::StringProtoFunc::callAsFunction):
672 2007-08-04 Darin Adler <darin@apple.com>
676 - fix <rdar://problem/5371862> crash in Dashcode due to Quartz Composer JavaScript garbage collector reentrancy
678 * API/JSBase.cpp: (JSGarbageCollect): Don't call collector() if isBusy() returns true.
680 * kjs/collector.h: Added isBusy(), removed the unused return value from collect()
681 * kjs/collector.cpp: Added an "operation in progress" flag to the allocator.
682 (KJS::Collector::allocate): Call abort() if an operation is already in progress. Set the new flag instead
683 of using the debug-only GCLock.
684 (KJS::Collector::collect): Ditto.
685 (KJS::Collector::isBusy): Added.
687 2007-08-04 Maciej Stachowiak <mjs@apple.com>
689 Reviewed by Darin and Adam.
691 <rdar://problem/5368990> REGRESSION: newsgator.com sign-on 6x slower than Safari 3 beta due to GC changes (14808)
693 * kjs/string_object.cpp:
694 (KJS::replace): if the string didn't change (very common in some cases) reuse the original string value.
695 (KJS::StringProtoFunc::callAsFunction): Pass in the StringImp* when replacing, not just the UString.
696 * kjs/string_object.h:
697 (KJS::StringInstance::internalValue): covariant override to return StringImp for convenience
699 2007-08-04 Mark Rowe <mrowe@apple.com>
701 Reviewed by Oliver Hunt.
703 <rdar://problem/5385145> r24843 introduces a crash on calling fork() (14878)
704 http://bugs.webkit.org/show_bug.cgi?id=14878
706 Provide no-op functions for all members of the malloc_zone_t and malloc_introspection_t structures that we
707 register to avoid crashes in system code that assumes they will be non-null.
709 * kjs/CollectorHeapIntrospector.cpp:
710 (KJS::CollectorHeapIntrospector::CollectorHeapIntrospector):
711 (KJS::CollectorHeapIntrospector::forceLock): Grab the lock.
712 (KJS::CollectorHeapIntrospector::forceUnlock): Release the lock.
713 * kjs/CollectorHeapIntrospector.h:
714 (KJS::CollectorHeapIntrospector::goodSize):
715 (KJS::CollectorHeapIntrospector::check):
716 (KJS::CollectorHeapIntrospector::print):
717 (KJS::CollectorHeapIntrospector::log):
718 (KJS::CollectorHeapIntrospector::statistics):
719 (KJS::CollectorHeapIntrospector::size):
720 (KJS::CollectorHeapIntrospector::zoneMalloc):
721 (KJS::CollectorHeapIntrospector::zoneCalloc):
722 (KJS::CollectorHeapIntrospector::zoneFree):
723 * wtf/FastMalloc.cpp:
724 (WTF::FastMallocZone::goodSize):
725 (WTF::FastMallocZone::check):
726 (WTF::FastMallocZone::print):
727 (WTF::FastMallocZone::log):
728 (WTF::FastMallocZone::forceLock): Grab the TCMalloc locks.
729 (WTF::FastMallocZone::forceUnlock): Release the TCMalloc locks.
730 (WTF::FastMallocZone::FastMallocZone):
732 2007-08-04 Mark Rowe <mrowe@apple.com>
734 Rubber-stamped by Anders.
736 * pcre/pcre_compile.c: Remove non-ASCII character from a comment.
738 2007-08-02 Mark Rowe <mrowe@apple.com>
740 Reviewed by Geoff Garen.
742 <rdar://problem/4212199> 'leaks' reports false leaks in WebKit (because the WTF allocator uses mmap?)
744 Implement malloc zone introspection routines to allow leaks, heap, and friends to request information
745 about specific memory regions that were allocated by FastMalloc or the JavaScriptCore collector.
747 This requires tool-side support before the regions will be displayed. The addition of that support is
748 tracked by <rdar://problems/5353057&5353060>.
750 * JavaScriptCore.exp: Export the two variables that are used by leaks to introspect the allocators.
751 * JavaScriptCore.xcodeproj/project.pbxproj:
752 * kjs/AllInOneFile.cpp:
753 * kjs/CollectorHeapIntrospector.cpp: Added.
755 (KJS::CollectorHeapIntrospector::init):
756 (KJS::CollectorHeapIntrospector::CollectorHeapIntrospector): Create and register our zone with the system.
757 (KJS::CollectorHeapIntrospector::enumerate): Iterate over the CollectorBlocks that are in use and report them to the caller as being used.
758 * kjs/CollectorHeapIntrospector.h: Added.
759 (KJS::CollectorHeapIntrospector::size): Return zero to indicate the specified pointer does not belong to this zone.
761 (KJS::Collector::registerThread): Register the CollectorHeapIntrospector with the system when the first thread is registered with the collector.
762 * wtf/FastMalloc.cpp:
763 (WTF::TCMalloc_PageHeap::GetDescriptorEnsureSafe):
764 (WTF::TCMalloc_ThreadCache_FreeList::enumerateFreeObjects): Enumerate the objects on the free list.
765 (WTF::TCMalloc_ThreadCache::enumerateFreeObjects): Ditto.
766 (WTF::TCMalloc_Central_FreeList::enumerateFreeObjects): Ditto.
767 (WTF::TCMalloc_ThreadCache::InitModule): Register the FastMallocZone with the system when initializing TCMalloc.
768 (WTF::FreeObjectFinder::FreeObjectFinder):
769 (WTF::FreeObjectFinder::visit): Add an object to the free list.
770 (WTF::FreeObjectFinder::isFreeObject):
771 (WTF::FreeObjectFinder::freeObjectCount):
772 (WTF::FreeObjectFinder::findFreeObjects): Find the free objects within a thread cache or free list.
773 (WTF::PageMapFreeObjectFinder::PageMapFreeObjectFinder): Find the free objects within a TC_PageMap.
774 (WTF::PageMapFreeObjectFinder::visit): Called once per allocated span. Record whether the span or any subobjects are free.
775 (WTF::PageMapMemoryUsageRecorder::PageMapMemoryUsageRecorder):
776 (WTF::PageMapMemoryUsageRecorder::visit): Called once per allocated span. Report the range of memory as being allocated, and the span or
777 its subobjects as being used if they do not appear on the free list.
778 (WTF::FastMallocZone::enumerate): Map the key remote TCMalloc data structures into our address space. We then locate all free memory ranges
779 before reporting the other ranges as being in use.
780 (WTF::FastMallocZone::size): Determine whether the given pointer originates from within our allocation zone. If so,
781 we return its allocation size.
782 (WTF::FastMallocZone::zoneMalloc):
783 (WTF::FastMallocZone::zoneCalloc):
784 (WTF::FastMallocZone::zoneFree):
785 (WTF::FastMallocZone::zoneRealloc):
787 (WTF::FastMallocZone::FastMallocZone): Create and register our zone with the system.
788 (WTF::FastMallocZone::init):
789 * wtf/MallocZoneSupport.h: Added.
790 (WTF::RemoteMemoryReader::RemoteMemoryReader): A helper class to ease the process of mapping memory in a different process into
791 our local address space
792 (WTF::RemoteMemoryReader::operator()):
794 (TCMalloc_PageMap2::visit): Walk over the heap and visit each allocated span.
795 (TCMalloc_PageMap3::visit): Ditto.
797 2007-08-02 Mark Rowe <mrowe@apple.com>
802 (KJS::UString::expandedSize): Use std::numeric_limits<size_t>::max() rather than the non-portable SIZE_T_MAX.
804 2007-08-02 Mark Rowe <mrowe@apple.com>
808 <rdar://problem/5352887> "Out of memory" error during repeated JS string concatenation leaks hundreds of MBs of RAM
810 A call to fastRealloc was failing which lead to UString::expandCapacity leaking the buffer it was trying to reallocate.
811 It also resulted in the underlying UString::rep having both a null baseString and buf field, which meant that attempting
812 to access the contents of the string after the failed memory reallocation would crash.
814 A third issue is that expandedSize size was calculating the new length in a way that led to an integer overflow occurring.
815 Attempting to allocate a string more than 190,000,000 characters long would fail a the integer overflow would lead to a
816 memory allocation of around 3.6GB being attempted rather than the expected 390MB. Sizes that would lead to an overflow
817 are now returned as zero and callers are updated to treat this as though the memory allocation has failed.
819 * kjs/array_object.cpp:
820 (ArrayProtoFunc::callAsFunction): Check whether the append failed and raise an "Out of memory" exception if it did.
822 (KJS::allocChars): Wrapper around fastMalloc that takes a length in characters. It will return 0 when asked to allocate a zero-length buffer.
823 (KJS::reallocChars): Wrapper around fastRealloc that takes a length in characters. It will return 0 when asked to allocate a zero-length buffer.
824 (KJS::UString::expandedSize): Split the size calculation in two and guard against overflow during each step.
825 (KJS::UString::expandCapacity): Don't leak r->buf if reallocation fails. Instead free the memory and use the null representation.
826 (KJS::UString::expandPreCapacity): If fastMalloc fails then use the null representation rather than crashing in memcpy.
827 (KJS::UString::UString): If calls to expandCapacity, expandPreCapacity or fastMalloc fail then use the null representation rather than crashing in memcpy.
828 (KJS::UString::append): Ditto.
829 (KJS::UString::operator=): Ditto.
830 * kjs/ustring.h: Change return type of expandedSize from int to size_t.
832 2007-08-01 Darin Adler <darin@apple.com>
834 Reviewed by Kevin McCullough.
836 - fix <rdar://problem/5375186> pointers to pieces of class definition passed to JSClassCreate should all be const
838 * API/JSObjectRef.h: Added const.
840 * API/JSClassRef.cpp:
841 (OpaqueJSClass::OpaqueJSClass): Added const.
842 (OpaqueJSClass::create): Added const.
843 * API/JSObjectRef.cpp:
844 (JSClassCreate): Added const.
846 2007-08-01 Steve Falkenburg <sfalken@apple.com>
848 Build mod: Fix sln to match configs in vcproj.
852 * JavaScriptCore.vcproj/JavaScriptCore.make:
853 * JavaScriptCore.vcproj/JavaScriptCore.sln:
855 2007-07-30 Simon Hausmann <hausmann@kde.org>
857 Done with and reviewed by Lars.
859 Removed the __BUILDING_QT ifdef in JSStringRef.h and changed UChar for the Qt build to use wchar_t on Windows.
862 * wtf/unicode/qt4/UnicodeQt4.h:
864 2007-07-27 Simon Hausmann <hausmann@kde.org>
866 Done with and reviewed by Lars and Zack.
868 Always define JSChar to be unsigned short for the Qt builds, to ensure compatibility with UChar.
872 2007-07-27 Simon Hausmann <hausmann@kde.org>
874 Done with and reviewed by Lars and Zack.
876 Fix compilation with Qt on Windows with MingW: Implemented currentThreadStackBase() for this platform.
879 (KJS::currentThreadStackBase):
881 2007-07-27 Simon Hausmann <hausmann@kde.org>
883 Done with and reviewed by Lars and Zack.
885 Fix compilation with Qt on Windows with MingW: The MingW headers do not provide a prototype for a reentrant version of localtime. But since we don't use multiple threads for the Qt build we can use the plain localtime() function.
888 (KJS::getDSTOffsetSimple):
890 2007-07-27 Simon Hausmann <hausmann@kde.org>
892 Done with and reviewed by Lars and Zack.
894 Use $(MOVE) instead of mv to eliminated the shell dependency and replaced the long shell line to call bison and modify the css grammar file with a few lines of portable perl code.
896 * JavaScriptCore.pri:
898 2007-07-27 Simon Hausmann <hausmann@kde.org>
900 Done with and reviewed by Lars and Zack.
902 Implemented currentTime() in the interpreter by using QDateTime, so that we don't need timeGetTime() on Windows and therefore also don't need to link against Winmm.dll.
904 * kjs/interpreter.cpp:
905 (KJS::getCurrentTime):
910 2007-07-27 Simon Hausmann <hausmann@kde.org>
912 Done with and reviewed by Lars and Zack.
914 Replace the use of snprintf with QByteArray to compile under msvc 2005 express.
916 * bindings/qt/qt_instance.cpp:
917 (KJS::Bindings::QtInstance::stringValue):
919 2007-07-27 Simon Hausmann <hausmann@kde.org>
921 Done with and reviewed by Lars and Zack.
923 Don't use pthread.h unless thread support is enabled.
926 (KJS::Collector::registerAsMainThread):
929 2007-07-27 Simon Hausmann <hausmann@kde.org>
931 Done with and reviewed by Lars and Zack.
933 Removed TCSystemMalloc from the Qt build, it's not necessary it seems.
935 * JavaScriptCore.pri:
937 2007-07-27 Simon Hausmann <hausmann@kde.org>
939 Done with and reviewed by Lars and Zack.
941 Added os-win32 to the include search path for the Qt windows build in order to provide the fake stdint.h header file.
943 * JavaScriptCore.pri:
945 2007-07-25 Maciej Stachowiak <mjs@apple.com>
949 - follow-up to previous change
952 (KJS::UString::operator=): Make sure to reset the length when
953 replacing the buffer contents for a single-owned string.
955 2007-07-25 Maciej Stachowiak <mjs@apple.com>
959 - JavaScriptCore part of fix for <rdar://problem/5300291> Optimize GC to reclaim big, temporary objects (like XMLHttpRequest.responseXML) quickly
961 Also, as a side effect of optimizations included in this patch:
962 - 7% speedup on JavaScript iBench
963 - 4% speedup on "Celtic Kane" JS benchmark
965 The basic idea is explained in a big comment in collector.cpp. When unusually
966 large objecs are allocated, we push the next GC closer on the assumption that
967 most objects are short-lived.
969 I also did the following two optimizations in the course of tuning
970 this not to be a performance regression:
972 1) Change UString::Rep to hold a self-pointer as the baseString in
973 the unshared case, instead of a null pointer; this removes a
974 number of null checks in hot code because many places already
975 wanted to use the rep itself or the baseString as appropriate.
977 2) Avoid creating duplicate StringImpls when creating a
978 StringInstance (the object wrapper for a JS string) or calling
979 their methods. Since a temporary wrapper object is made every time
980 a string method is called, this resulted in two useless extra
981 StringImpls being allocated for no reason whenever a String method
982 was invoked on a string value. Now we bypass those.
986 (KJS::Collector::recordExtraCost): Basics of the extra cost mechanism.
987 (KJS::Collector::allocate): ditto
988 (KJS::Collector::collect): ditto
990 (KJS::Collector::reportExtraMemoryCost): ditto
991 * kjs/array_object.cpp:
992 (ArrayInstance::ArrayInstance): record extra cost
994 (KJS::StringImp::toObject): don't create a whole new StringImpl just
995 to be the internal value of a StringInstance! StringImpls are immutable
996 so there's no point tot his.
998 (KJS::StringImp::StringImp): report extra cost
999 * kjs/string_object.cpp:
1000 (KJS::StringInstance::StringInstance): new version that takes a StringImp
1001 (KJS::StringProtoFunc::callAsFunction): don't create a whole new StringImpl
1002 just to convert self to string! we already have one in the internal value
1003 * kjs/string_object.h: report extra cost
1004 * kjs/ustring.cpp: All changes to handle baseString being self instead of null in the
1007 (KJS::UString::Rep::create):
1008 (KJS::UString::Rep::destroy):
1009 (KJS::UString::usedCapacity):
1010 (KJS::UString::usedPreCapacity):
1011 (KJS::UString::expandCapacity):
1012 (KJS::UString::expandPreCapacity):
1013 (KJS::UString::UString):
1014 (KJS::UString::append):
1015 (KJS::UString::operator=):
1016 (KJS::UString::copyForWriting):
1018 (KJS::UString::Rep::baseIsSelf): new method, now that baseString is
1019 self instead of null in the unshared case we can't just null check.
1020 (KJS::UString::Rep::data): adjusted as mentioned above
1021 (KJS::UString::cost): new method to compute the cost for a UString, for
1025 (KJS::jsString): style fixups.
1026 (KJS::jsOwnedString): new method, use this for strings allocated from UStrings
1027 held by the parse tree. Tracking their cost as part of string cost is pointless,
1028 because garbage collecting them will not actually free the relevant string buffer.
1029 * kjs/value.h: prototyped jsOwnedString.
1031 (StringNode::evaluate): use jsOwnedString as appropriate
1032 (RegExpNode::evaluate): ditto
1033 (PropertyNameNode::evaluate): ditto
1034 (ForInNode::execute): ditto
1036 * JavaScriptCore.exp: Exported some new symbols.
1038 2007-07-23 Anders Carlsson <andersca@apple.com>
1042 <rdar://problem/5121461> REGRESSION: Unable to load JigZone puzzle
1044 * bindings/jni/jni_jsobject.cpp:
1045 (JavaJSObject::createNative):
1047 Call RootObject::gcProtect on the global object, thereby putting it in the
1048 "protect count" set which is used for checking if a native handle is valid.
1050 2007-07-23 Darin Adler <darin@apple.com>
1052 * pcre/pcre_compile.c: Roll back a tiny accidental change in the unused !JAVASCRIPT
1053 side of an #ifdef. This has no effect when using PCRE in JAVASCRIPT mode as we do,
1054 but seems worth rolling back.
1056 2007-07-23 Maciej Stachowiak <mjs@apple.com>
1060 - fix remaining problems with Window shadowing
1063 (VarDeclNode::evaluate): Tweak the special case a little.
1065 2007-07-23 Maciej Stachowiak <mjs@apple.com>
1069 - fix Window shadowing regressions caused by the previous commit.
1072 (VarDeclNode::evaluate): Handle the case of global scope specially.
1074 2007-07-22 Maciej Stachowiak <mjs@apple.com>
1078 -fixed <rdar://problem/5353293> REGRESSION (r24287): 1% i-Bench JS slowdown from JavaScript compatibility fix (14719)
1079 http://bugs.webkit.org/show_bug.cgi?id=14719
1081 My fix for this actually resulted in JS iBench being 1% faster than before the regression
1082 and the Celtic Kane benchmark being 5% faster than before the regression.
1085 (VarDeclNode::handleSlowCase): factored out the slow code path to be out of line.
1086 (VarDeclNode::evaluate): I did a couple of things:
1087 (1) Don't check if the variable is already declared by looking for the property in
1088 the variable object, that code path was dead code.
1089 (2) Special-case the common case where the top of the scope and the variable object
1090 are the same; in that case the variable must always be in the variable object.
1091 (3) Don't return a jsString() of the variable name, nothing uses the return value
1092 from this node types evaluate method.
1095 2007-07-22 Darin Adler <darin@apple.com>
1097 Reviewed by Kevin Decker.
1099 - fix <rdar://problem/5126394> REGRESSION: Crash after clicking back button in test application (13250)
1100 http://bugs.webkit.org/show_bug.cgi?id=13250
1102 * bindings/objc/objc_utility.mm: (KJS::Bindings::convertObjcValueToValue):
1103 If the object returns 0 for _imp, convert that to "undefined", since callers
1104 can't cope with a JSValue of 0.
1106 2007-07-19 Geoffrey Garen <ggaren@apple.com>
1108 Reviewed by Darin Adler.
1110 Fixed http://bugs.webkit.org/show_bug.cgi?id=10880 | <rdar://problem/5335694>
1111 REGRESSION: JavaScript menu doesn't appear on pricepoint.com (14595)
1113 Though the ECMA spec says auto-semicolon insertion should not occur
1114 without a newline or '}', Firefox treats do-while specially, and the
1115 library used by pricepoint.com requires that special treatment.
1117 * JavaScriptCore.xcodeproj/project.pbxproj:
1120 2007-07-19 Darin Adler <darin@apple.com>
1124 - fix <rdar://problem/5345440> PCRE computes wrong length for expressions with quantifiers
1125 on named recursion or subexpressions
1127 It's challenging to implement proper preflighting for compiling these advanced features.
1128 But we don't want them in the JavaScript engine anyway.
1130 Turned off the following features of PCRE (some of these are simply parsed and not implemented):
1132 \C \E \G \L \N \P \Q \U \X \Z
1135 (?#) (?<=) (?<!) (?>)
1140 Added the following:
1144 Because of \v, the js1_2/regexp/special_characters.js test now passes.
1146 To be conservative, I left some features that JavaScript doesn't want, such as
1147 \012 and \x{2013}, in place. We can revisit these later; they're not directly-enough
1148 related to avoiding the incorrect preflighting.
1150 I also didn't try to remove unused opcodes and remove code from the execution engine.
1151 That could save code size and speed things up a bit, but it would require more changes.
1154 * kjs/regexp.cpp: (KJS::RegExp::RegExp): Remove the sanitizePattern workaround for
1155 lack of \u support, since the PCRE code now has \u support.
1157 * pcre/pcre-config.h: Set JAVASCRIPT to 1.
1158 * pcre/pcre_internal.h: Added ESC_v.
1160 * pcre/pcre_compile.c: Added a different escape table for when JAVASCRIPT is set that
1161 omits all the escapes we don't want interpreted and includes '\v'.
1162 (check_escape): Put !JAVASCRIPT around the code for '\l', '\L', '\N', '\u', and '\U',
1163 and added code to handle '\u2013' inside JAVASCRIPT.
1164 (compile_branch): Put !JAVASCRIPT if around all the code implementing the features we
1166 (pcre_compile2): Ditto.
1168 * tests/mozilla/expected.html: Updated since js1_2/regexp/special_characters.js now
1171 2007-07-18 Darin Adler <darin@apple.com>
1173 Reviewed by Oliver Hunt.
1175 - fix <rdar://problem/5345432> PCRE computes length wrong for expressions such as "[**]"
1177 Test: fast/js/regexp-charclass-crash.html
1179 * pcre/pcre_compile.c: (pcre_compile2): Fix the preflight code that calls
1180 check_posix_syntax to match the actual regular expression compilation code;
1181 before it was missing the check of the first character.
1183 2007-07-19 Holger Hans Peter Freyther <zecke@selfish.org>
1187 Define __BUILDING_GDK when building for Gdk to fix building testkjs on OSX.
1189 * JavaScriptCore.pri:
1191 2007-07-18 Simon Hausmann <hausmann@kde.org>
1193 * Fix the Qt build, call dftables from the right directory.
1195 Reviewed by Adam Treat.
1199 2007-07-18 Simon Hausmann <hausmann@kde.org>
1203 Don't call gcc directly when building the dftables tool but use a separate .pro file for the Qt build.
1205 * pcre/dftables.pro: Added.
1208 2007-07-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1210 Reviewed by Darin, Maciej, and Adam.
1212 Fixes <http://bugs.webkit.org/show_bug.cgi?id=9697>,
1213 the failure of ecma/GlobalObject/15.1.2.2-2.js,
1214 the failure of ecma/LexicalConventions/7.7.3-1.js,
1215 and most of the failures of tests in ecma/TypeConversion/9.3.1-3.js.
1217 Bug 9697: parseInt results may be inaccurate for numbers greater than 2^53
1219 This patch also fixes similar issues in the lexer and UString::toDouble().
1222 (KJS::parseIntOverflow):
1228 (KJS::UString::toDouble):
1229 * tests/mozilla/expected.html:
1231 2007-07-16 Sam Weinig <sam@webkit.org>
1235 Turn off -Wshorten-64-to-32 warning for 64-bit builds.
1237 * Configurations/Base.xcconfig:
1239 2007-07-14 Brady Eidson <beidson@apple.com>
1241 Reviewed by Sam Weinig
1243 Initial check-in for <rdar://problem/3154486> - Supporting FTP directory listings in the browser
1245 * wtf/Platform.h: Add ENABLE_FTPDIR feature to handle building on platforms that don't have the
1246 proper network-layer support
1248 2007-07-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1252 Fixes http://bugs.webkit.org/show_bug.cgi?id=13517,
1253 http://bugs.webkit.org/show_bug.cgi?id=14237, and
1254 the failure of test js1_5/Scope/regress-185485.js
1256 Bug 13517: DOM Exception 8 in finance.aol.com sub-page
1257 Bug 14237: Javascript "var" statement interprets initialization in the topmost function scope
1260 (VarDeclNode::evaluate):
1261 * tests/mozilla/expected.html:
1263 2007-07-12 Alexey Proskuryakov <ap@webkit.org>
1267 http://bugs.webkit.org/show_bug.cgi?id=14596
1268 Fix JSC compilation with KJS_VERBOSE.
1271 (KJS::FunctionImp::passInParameters):
1273 2007-07-11 George Staikos <staikos@kde.org>
1277 * ForwardingHeaders: Added.
1278 * ForwardingHeaders/JavaScriptCore: Added.
1279 * ForwardingHeaders/JavaScriptCore/APICast.h: Added.
1280 * ForwardingHeaders/JavaScriptCore/JSBase.h: Added.
1281 * ForwardingHeaders/JavaScriptCore/JSContextRef.h: Added.
1282 * ForwardingHeaders/JavaScriptCore/JSLock.h: Added.
1283 * ForwardingHeaders/JavaScriptCore/JSObjectRef.h: Added.
1284 * ForwardingHeaders/JavaScriptCore/JSStringRef.h: Added.
1285 * ForwardingHeaders/JavaScriptCore/JSStringRefCF.h: Added.
1286 * ForwardingHeaders/JavaScriptCore/JSValueRef.h: Added.
1287 * ForwardingHeaders/JavaScriptCore/JavaScriptCore.h: Added.
1289 2007-07-11 Holger Hans Peter Freyther <zecke@selfish.org>
1293 As of http://bugs.webkit.org/show_bug.cgi?id=14527 move the
1294 WebCore/ForwardingHeader/JavaScriptCore to JavaScriptCore
1296 * ForwardingHeaders: Added.
1297 * ForwardingHeaders/JavaScriptCore: Copied from WebCore/ForwardingHeaders/JavaScriptCore.
1299 2007-07-11 Nikolas Zimmermann <zimmermann@kde.org>
1303 Forwardport the hash table fix from CodeGeneratorJS.pm to create_hash_table.
1304 Reran run-jsc-tests, couldn't find any regressions. Suggested by Darin.
1306 * kjs/create_hash_table:
1308 2007-07-09 Maciej Stachowiak <mjs@apple.com>
1312 - JavaScriptCore part of fix for: <rdar://problem/5295734> Repro crash closing tab/window @ maps.google.com in WTF::HashSet<KJS::RuntimeObjectImp*, WTF::PtrHash<KJS::RuntimeObjectImp*>, WTF::HashTraits<KJS::RuntimeObjectImp*> >::add + 11
1314 * JavaScriptCore.exp: Added needed export.
1316 2007-07-06 Maciej Stachowiak <mjs@apple.com>
1320 - <rdar://problem/5311093> JavaScriptCore fails to build with strict-aliasing warnings
1322 * Configurations/Base.xcconfig: Re-enable -Wstrict-aliasing
1323 * bindings/jni/jni_utility.cpp:
1324 (KJS::Bindings::getJNIEnv): Type-pun via a union instead of a pointer cast.
1326 (WTF::): Instead of doing type-punned assignments via pointer cast, do one of three things:
1327 (1) assign directly w/o cast if storage type matches real type; (2) assign using cast
1328 via union if type does not need reffing; (3) copy with memcpy and ref/deref manually if type
1329 needs reffing. This is ok peref-wise because memcpy of a constant length gets optomized.
1330 HashTraits are now expected to make ref()/deref() take the storage type, not the true type.
1332 (WTF::): Same basic idea.
1334 (WTF::): Added Assigner template for use by HashMap/HashSet. Change RefCounter to call ref()
1335 and deref() via storage type, avoiding the need to
1337 (WTF::RefCounter::ref): ditto
1338 (WTF::RefCounter::deref): ditto
1340 (WTF::): Change ref() and deref() for RefPtr HashTraits to take the storage type; cast
1341 via union to pointer type.
1342 * wtf/FastMalloc.cpp:
1343 (WTF::TCMalloc_PageHeap::init): Changed from constructor to init function so this can go in a union.
1344 (WTF::): redefine pageheap macro in terms of getPageHeap().
1345 (WTF::getPageHeap): new inline function, helper for pageheap macro. This hides the cast in a union.
1346 (WTF::TCMalloc_ThreadCache::InitModule): Call init() instead of using placement new to initialize page
1349 (TCMalloc_PageMap1::init): Changed from constructor to init function.
1350 (TCMalloc_PageMap2::init): ditto
1351 (TCMalloc_PageMap3::init): ditto
1354 2007-07-06 George Staikos <staikos@kde.org>
1358 Switch USE(ICONDATABASE) to ENABLE(ICONDATABASE)
1362 2007-07-03 Sam Weinig <sam@webkit.org>
1366 Eleventh round of fixes for implicit 64-32 bit conversion errors.
1367 <rdar://problem/5292262>
1369 - Fixes a real bug where where we were setting long long and unsigned long long
1370 values to a long field.
1372 * bindings/objc/objc_utility.mm:
1373 (KJS::Bindings::convertValueToObjcValue):
1375 2007-07-03 Sam Weinig <sam@webkit.org>
1377 Reviewed by Brady Eidson.
1379 Tenth round of fixes for implicit 64-32 bit conversion errors.
1380 <rdar://problem/5292262>
1382 - Add explicit casts.
1387 2007-07-02 Sam Weinig <sam@webkit.org>
1389 Reviewed by Kevin McCullough.
1391 Fourth round of fixes for implicit 64-32 bit conversion errors.
1392 <rdar://problem/5292262>
1394 Add custom piDouble and piFloat constants to use instead of M_PI.
1396 * kjs/math_object.cpp:
1397 (MathObjectImp::getValueProperty):
1401 2007-06-29 Sam Weinig <sam@webkit.org>
1405 Second pass at fixing implicit 64-32 bit conversion errors.
1406 <rdar://problem/5292262>
1408 - Add a toFloat() method to JSValue for float conversion.
1410 * JavaScriptCore.exp:
1412 (KJS::JSValue::toFloat):
1415 2007-06-27 Kevin McCullough <kmccullough@apple.com>
1419 - <rdar://problem/5271937> REGRESSION: Apparent WebKit JavaScript memory smasher when submitting comment to iWeb site (crashes in kjs_pcre_compile2)
1420 - Correctly evaluate the return value of _pcre_ucp_findchar.
1422 * pcre/pcre_compile.c:
1427 2007-06-27 Sam Weinig <sam@webkit.org>
1431 First pass at fixing implicit 64-32 bit conversion errors.
1432 <rdar://problem/5292262>
1434 - Add 'f' suffix where necessary.
1437 (StopWatch::getElapsedMS):
1439 2007-06-26 Geoffrey Garen <ggaren@apple.com>
1441 Reviewed by Maciej Stachowiak.
1443 Fixed <rdar://problem/5296627> JSGarbageCollect headerdoc suggests that
1444 using JavaScriptCore requires leaking memory
1446 * API/JSBase.h: Changed documentation to explain that you can pass NULL
1447 to JSGarbageCollect.
1449 2007-06-26 Adam Treat <adam@staikos.net>
1451 Reviewed by Adam Roben.
1453 Make the SQLite icon database optional.
1457 2007-06-15 George Staikos <staikos@kde.org>
1459 More missing files for Qt.
1461 * JavaScriptCore.pri:
1464 2007-06-15 George Staikos <staikos@kde.org>
1466 Another Qt build fix.
1468 * JavaScriptCore.pri:
1471 2007-06-15 George Staikos <staikos@kde.org>
1475 * JavaScriptCore.pri:
1477 2007-06-20 Mark Rowe <mrowe@apple.com>
1481 Fix http://bugs.webkit.org/show_bug.cgi?id=14244
1482 Bug 14244: Data corruption when using a replace() callback function with data containing "$"
1484 * kjs/string_object.cpp:
1485 (KJS::replace): When 'replacement' is a function, do not replace $n placeholders in its return value.
1486 This matches the behaviour described in ECMA 262 3rd Ed section 15.5.4.1, and as implemented in Firefox.
1488 2007-06-14 Anders Carlsson <andersca@apple.com>
1492 * bindings/runtime_object.cpp:
1493 (RuntimeObjectImp::canPut):
1495 2007-06-14 Anders Carlsson <andersca@apple.com>
1499 <rdar://problem/5103077>
1500 Crash at _NPN_ReleaseObject when quitting page at http://eshop.macsales.com/shop/ModBook
1502 <rdar://problem/5183692>
1503 http://bugs.webkit.org/show_bug.cgi?id=13547
1504 REGRESSION: Crash in _NPN_ReleaseObject when closing Safari on nba.com (13547)
1506 <rdar://problem/5261499>
1507 CrashTracer: [USER] 75 crashes in Safari at com.apple.JavaScriptCore: KJS::Bindings::CInstance::~CInstance + 40
1509 Have the root object track all live instances of RuntimeObjectImp. When invalidating
1510 the root object, also invalidate all live runtime objects by zeroing out their instance ivar.
1511 This prevents instances from outliving their plug-ins which lead to crashes.
1513 * bindings/c/c_utility.cpp:
1514 (KJS::Bindings::convertValueToNPVariant):
1515 * bindings/jni/jni_jsobject.cpp:
1516 (JavaJSObject::convertValueToJObject):
1517 * bindings/jni/jni_utility.cpp:
1518 (KJS::Bindings::convertValueToJValue):
1519 * bindings/objc/objc_runtime.mm:
1520 (ObjcFallbackObjectImp::callAsFunction):
1521 * bindings/runtime_array.cpp:
1522 (RuntimeArray::RuntimeArray):
1523 * bindings/runtime_array.h:
1524 (KJS::RuntimeArray::getConcreteArray):
1525 * bindings/runtime_method.cpp:
1526 (RuntimeMethod::callAsFunction):
1527 * bindings/runtime_method.h:
1528 * bindings/runtime_object.cpp:
1529 (RuntimeObjectImp::RuntimeObjectImp):
1530 (RuntimeObjectImp::~RuntimeObjectImp):
1531 (RuntimeObjectImp::invalidate):
1532 (RuntimeObjectImp::fallbackObjectGetter):
1533 (RuntimeObjectImp::fieldGetter):
1534 (RuntimeObjectImp::methodGetter):
1535 (RuntimeObjectImp::getOwnPropertySlot):
1536 (RuntimeObjectImp::put):
1537 (RuntimeObjectImp::canPut):
1538 (RuntimeObjectImp::defaultValue):
1539 (RuntimeObjectImp::implementsCall):
1540 (RuntimeObjectImp::callAsFunction):
1541 (RuntimeObjectImp::getPropertyNames):
1542 (RuntimeObjectImp::throwInvalidAccessError):
1543 * bindings/runtime_object.h:
1544 * bindings/runtime_root.cpp:
1545 (KJS::Bindings::RootObject::invalidate):
1546 (KJS::Bindings::RootObject::addRuntimeObject):
1547 (KJS::Bindings::RootObject::removeRuntimeObject):
1548 * bindings/runtime_root.h:
1550 2007-06-14 Anders Carlsson <andersca@apple.com>
1554 <rdar://problem/5244948>
1555 Safari keeps on complaining about slow script playing NBC TV video (14133)
1557 http://bugs.webkit.org/show_bug.cgi?id=14133
1558 Runaway JavaScript timer fires when spinning around in Google Maps street view
1560 Make sure to start and stop the timeout checker around calls to JS.
1562 * bindings/NP_jsobject.cpp:
1563 (_NPN_InvokeDefault):
1566 * bindings/jni/jni_jsobject.cpp:
1567 (JavaJSObject::call):
1568 (JavaJSObject::eval):
1570 2007-06-13 Darin Adler <darin@apple.com>
1572 Reviewed by Mark Rowe.
1574 - fix http://bugs.webkit.org/show_bug.cgi?id=14132
1575 array sort with > 10000 elements sets elements > 10000 undefined
1577 Test: fast/js/sort-large-array.html
1579 * kjs/array_instance.h: Replaced pushUndefinedObjectsToEnd with
1580 compactForSorting, and removed ExecState parameters.
1582 * kjs/array_object.cpp:
1583 (ArrayInstance::sort): Changed to call compactForSorting.
1584 (ArrayInstance::compactForSorting): Do the get and delete of the
1585 properties directly on the property map instead of using public
1586 calls from JSObject. The public calls would just read the undefined
1587 values from the compacted sort results array!
1589 2007-06-13 George Staikos <staikos@kde.org>
1593 Fix Mac OS X build after last checkin.
1597 2007-06-14 Lars Knoll <lars@trolltech.com>
1601 Disable FastMalloc for the Qt build and make sure we
1602 don't reimplement the global new/delete operators
1603 when using the system malloc.
1605 * wtf/FastMalloc.cpp:
1609 2007-06-13 Anders Carlsson <andersca@apple.com>
1613 Make sure that bindings instances get correct root objects.
1615 * JavaScriptCore.exp:
1616 * bindings/NP_jsobject.cpp:
1617 (listFromVariantArgs):
1618 (_NPN_InvokeDefault):
1621 * bindings/c/c_instance.cpp:
1622 (KJS::Bindings::CInstance::invokeMethod):
1623 (KJS::Bindings::CInstance::invokeDefaultMethod):
1624 * bindings/c/c_runtime.cpp:
1625 (KJS::Bindings::CField::valueFromInstance):
1626 * bindings/c/c_utility.cpp:
1627 (KJS::Bindings::convertNPVariantToValue):
1628 * bindings/c/c_utility.h:
1629 * bindings/objc/objc_instance.mm:
1630 (ObjcInstance::invokeMethod):
1631 (ObjcInstance::invokeDefaultMethod):
1632 (ObjcInstance::getValueOfUndefinedField):
1633 * bindings/objc/objc_runtime.mm:
1634 (ObjcField::valueFromInstance):
1635 (ObjcArray::valueAt):
1636 * bindings/objc/objc_utility.h:
1637 * bindings/objc/objc_utility.mm:
1638 (KJS::Bindings::convertObjcValueToValue):
1639 * bindings/runtime.h:
1641 2007-06-13 Simon Hausmann <hausmann@kde.org>
1645 * kjs/testkjs.pro: WebKitQt is now called QtWebKit.
1647 2007-06-12 Anders Carlsson <andersca@apple.com>
1651 * bindings/qt/qt_instance.cpp:
1652 (KJS::Bindings::QtInstance::invokeMethod):
1654 2007-06-12 Anders Carlsson <andersca@apple.com>
1658 Move the notion of field type to the JNI runtime since that's the only
1659 one that was actually using it.
1661 * bindings/c/c_runtime.h:
1662 (KJS::Bindings::CField::CField):
1663 * bindings/jni/jni_runtime.h:
1664 * bindings/objc/objc_runtime.h:
1665 * bindings/objc/objc_runtime.mm:
1666 * bindings/qt/qt_runtime.h:
1667 * bindings/runtime.h:
1668 * bindings/runtime_method.cpp:
1670 2007-06-12 Anders Carlsson <andersca@apple.com>
1674 * bindings/qt/qt_class.cpp:
1675 (KJS::Bindings::QtClass::methodsNamed):
1676 * bindings/qt/qt_instance.cpp:
1677 (KJS::Bindings::QtInstance::invokeMethod):
1679 2007-06-12 Anders Carlsson <andersca@apple.com>
1683 Get rid of the MethodList class and use a good ol' Vector instead.
1685 * bindings/c/c_class.cpp:
1686 (KJS::Bindings::CClass::methodsNamed):
1687 * bindings/c/c_instance.cpp:
1688 (KJS::Bindings::CInstance::invokeMethod):
1689 * bindings/jni/jni_class.cpp:
1690 (JavaClass::JavaClass):
1691 (JavaClass::~JavaClass):
1692 * bindings/jni/jni_instance.cpp:
1693 (JavaInstance::invokeMethod):
1694 * bindings/objc/objc_class.mm:
1695 (KJS::Bindings::ObjcClass::methodsNamed):
1696 * bindings/objc/objc_instance.mm:
1697 (ObjcInstance::invokeMethod):
1698 * bindings/objc/objc_runtime.mm:
1699 (ObjcFallbackObjectImp::callAsFunction):
1700 * bindings/runtime.cpp:
1701 * bindings/runtime.h:
1702 * bindings/runtime_method.cpp:
1703 (RuntimeMethod::lengthGetter):
1704 (RuntimeMethod::callAsFunction):
1705 * bindings/runtime_object.cpp:
1706 (RuntimeObjectImp::getOwnPropertySlot):
1708 2007-06-12 Anders Carlsson <andersca@apple.com>
1712 Make RuntimeMethod's method list a pointer so that the object size doesn't
1713 grow beyond 32 bytes when we later will replace MethodList with a Vector.
1715 * bindings/runtime_method.cpp:
1716 (RuntimeMethod::RuntimeMethod):
1717 (RuntimeMethod::lengthGetter):
1718 (RuntimeMethod::callAsFunction):
1719 * bindings/runtime_method.h:
1721 2007-06-12 Anders Carlsson <andersca@apple.com>
1725 Get rid of the Parameter class.
1727 * bindings/jni/jni_instance.cpp:
1728 (JavaInstance::invokeMethod):
1729 * bindings/jni/jni_runtime.cpp:
1730 (JavaMethod::signature):
1731 * bindings/jni/jni_runtime.h:
1732 (KJS::Bindings::JavaParameter::JavaParameter):
1733 (KJS::Bindings::JavaParameter::~JavaParameter):
1734 (KJS::Bindings::JavaParameter::type):
1735 (KJS::Bindings::JavaMethod::parameterAt):
1736 (KJS::Bindings::JavaMethod::numParameters):
1737 * bindings/runtime.h:
1739 2007-06-12 Anders Carlsson <andersca@apple.com>
1743 * bindings/qt/qt_class.h:
1745 2007-06-12 Mark Rowe <mrowe@apple.com>
1749 * bindings/objc/objc_runtime.h:
1751 2007-06-12 Anders Carlsson <andersca@apple.com>
1755 Get rid of Constructor and its only subclass JavaConstructor.
1757 * bindings/c/c_class.h:
1758 * bindings/jni/jni_class.cpp:
1759 (JavaClass::JavaClass):
1760 (JavaClass::~JavaClass):
1761 * bindings/jni/jni_class.h:
1762 * bindings/jni/jni_runtime.cpp:
1763 * bindings/jni/jni_runtime.h:
1764 * bindings/objc/objc_class.h:
1765 * bindings/runtime.h:
1767 2007-06-12 Anders Carlsson <andersca@apple.com>
1771 Use RetainPtr throughout the bindings code.
1773 * bindings/objc/objc_class.h:
1774 * bindings/objc/objc_class.mm:
1775 (KJS::Bindings::ObjcClass::ObjcClass):
1776 (KJS::Bindings::ObjcClass::methodsNamed):
1777 (KJS::Bindings::ObjcClass::fieldNamed):
1778 * bindings/objc/objc_instance.h:
1779 (KJS::Bindings::ObjcInstance::getObject):
1780 * bindings/objc/objc_instance.mm:
1781 (ObjcInstance::ObjcInstance):
1782 (ObjcInstance::~ObjcInstance):
1783 (ObjcInstance::implementsCall):
1784 (ObjcInstance::invokeMethod):
1785 (ObjcInstance::invokeDefaultMethod):
1786 (ObjcInstance::defaultValue):
1787 * bindings/objc/objc_runtime.h:
1788 (KJS::Bindings::ObjcMethod::setJavaScriptName):
1789 (KJS::Bindings::ObjcMethod::javaScriptName):
1790 (KJS::Bindings::ObjcArray::getObjcArray):
1791 * bindings/objc/objc_runtime.mm:
1793 (ObjcArray::ObjcArray):
1794 (ObjcArray::setValueAt):
1795 (ObjcArray::valueAt):
1796 (ObjcArray::getLength):
1799 2007-06-12 Anders Carlsson <andersca@apple.com>
1803 Have JSCell inherit from Noncopyable.
1805 * bindings/objc/objc_runtime.h:
1806 * bindings/runtime_object.h:
1809 2007-06-12 Anders Carlsson <andersca@apple.com>
1811 Reviewed by Darin and Maciej.
1813 More cleanup. Use our Noncopyable WTF class, add a root object member
1816 * bindings/c/c_class.h:
1817 * bindings/jni/jni_class.h:
1818 * bindings/jni/jni_instance.h:
1819 * bindings/jni/jni_runtime.cpp:
1820 (JavaArray::JavaArray):
1821 * bindings/jni/jni_runtime.h:
1822 * bindings/objc/objc_class.h:
1823 * bindings/objc/objc_runtime.h:
1824 * bindings/objc/objc_runtime.mm:
1825 (ObjcArray::ObjcArray):
1826 * bindings/objc/objc_utility.mm:
1827 (KJS::Bindings::convertObjcValueToValue):
1828 * bindings/runtime.cpp:
1829 (KJS::Bindings::Array::Array):
1830 (KJS::Bindings::Array::~Array):
1831 * bindings/runtime.h:
1832 * bindings/runtime_object.h:
1833 * bindings/runtime_root.h:
1835 2007-06-08 Zack Rusin <zrusin@trolltech.com>
1839 * bindings/qt/qt_instance.cpp:
1840 (KJS::Bindings::QtInstance::QtInstance):
1841 * bindings/qt/qt_instance.h:
1843 2007-06-07 Anders Carlsson <andersca@apple.com>
1847 Get rid of Instance::setRootObject and pass the root object to the instance constructor instead.
1849 * bindings/c/c_instance.cpp:
1850 (KJS::Bindings::CInstance::CInstance):
1851 * bindings/c/c_instance.h:
1852 * bindings/jni/jni_instance.cpp:
1853 (JavaInstance::JavaInstance):
1854 * bindings/jni/jni_instance.h:
1855 * bindings/jni/jni_jsobject.cpp:
1856 (JavaJSObject::convertJObjectToValue):
1857 * bindings/objc/objc_instance.h:
1858 * bindings/objc/objc_instance.mm:
1859 (ObjcInstance::ObjcInstance):
1860 * bindings/runtime.cpp:
1861 (KJS::Bindings::Instance::Instance):
1862 (KJS::Bindings::Instance::createBindingForLanguageInstance):
1863 * bindings/runtime.h:
1865 2007-06-07 Anders Carlsson <andersca@apple.com>
1869 Don't use a JavaInstance to store the field when all we want to do is to keep the field
1870 from being garbage collected. Instead, use a JObjectWrapper.
1872 * bindings/jni/jni_instance.h:
1873 * bindings/jni/jni_runtime.cpp:
1874 (JavaField::JavaField):
1875 (JavaField::dispatchValueFromInstance):
1876 (JavaField::dispatchSetValueToInstance):
1877 * bindings/jni/jni_runtime.h:
1878 (KJS::Bindings::JavaField::JavaField):
1879 (KJS::Bindings::JavaField::operator=):
1881 2007-05-30 Alp Toker <alp.toker@collabora.co.uk>
1885 Enable logging in the Gdk port.
1886 http://bugs.webkit.org/show_bug.cgi?id=13936
1888 * wtf/Assertions.cpp:
1889 * wtf/Assertions.h: Add WTFLogVerbose which also logs
1890 the file, line number and function.
1892 2007-05-30 Mark Rowe <mrowe@apple.com>
1894 Mac build fix. Update #include.
1896 * API/JSCallbackFunction.h:
1898 2007-05-30 Luciano Montanaro <mikelima@cirulla.net>
1902 - cross-port Harri Porten's commits 636099 and 636108 from KJS:
1903 "publish a class anyway public already" and "class is being used from
1904 outside for quite some time" in preparation for further syncronizations
1907 * kjs/date_object.cpp:
1908 * kjs/date_object.h:
1911 (KJS::InternalFunctionImp::classInfo):
1912 (KJS::InternalFunctionImp::functionName):
1913 * kjs/function_object.h:
1916 (KJS::getStaticPropertySlot):
1917 (KJS::getStaticFunctionSlot):
1918 (KJS::getStaticValueSlot):
1919 * kjs/object_object.h:
1921 2007-05-29 Sam Weinig <sam@webkit.org>
1923 Reviewed by Adam Roben.
1925 Cleanup function and fix to match comparison API.
1927 * kjs/string_object.cpp:
1928 (KJS::substituteBackreferences):
1929 (KJS::localeCompare):
1931 2007-05-28 Geoffrey Garen <ggaren@apple.com>
1933 Slight clarification to an exception message.
1935 * API/JSCallbackObject.cpp:
1936 (KJS::JSCallbackObject::put):
1938 2007-05-27 Holger Freyther <zecke@selfish.org>
1940 Reviewed by Mark Rowe.
1942 * wtf/Platform.h: Move Gdk up to allow building WebKit/Gdk on Darwin
1944 2007-05-27 Darin Adler <darin@apple.com>
1946 - fix a couple ifdefs that said WIN instead of WIN_OS
1948 * kjs/collector.cpp:
1949 (KJS::allocateBlock): WIN -> WIN_OS
1950 (KJS::freeBlock): Ditto.
1952 2007-05-26 Sam Weinig <sam@webkit.org>
1956 Patch for http://bugs.webkit.org/show_bug.cgi?id=13854
1957 Port of commit 667785 from kjs
1959 - special case calling String.localeCompare() with no parameters to return 0.
1961 * kjs/string_object.cpp:
1962 (KJS::StringProtoFunc::callAsFunction):
1964 2007-05-25 Kimmo Kinnunen <kimmok@iki.fi>
1968 - Fix for http://bugs.webkit.org/show_bug.cgi?id=13456
1969 REGRESSION: setTimeout "arguments" object gets shadowed by a local variable
1971 - Add a explicit check for arguments. Previously check was done with getDirect,
1972 but since the arguments is created on-demand in ActivationImp, it doesn't
1973 show up in the test. 'arguments' should always be in the VarDeclNode's
1977 (VarDeclNode::evaluate): Additional check if the var decl identifier is 'arguments'
1979 2007-05-25 George Staikos <staikos@kde.org>
1983 - Use COMPILER(GCC), not PLATFORM(GCC) - as Platform.h defines
1987 2007-05-25 Kimmo Kinnunen <kimmok@iki.fi>
1991 - http://bugs.webkit.org/show_bug.cgi?id=13623 (Decompilation of function
1992 doesn't compile with "++(x,y)")
1993 - Create the error node based on the actual node, not the node inside
1995 - Fix applies to postfix, prefix and typeof operators
1996 - Produces run-time ReferenceError like other non-lvalue assignments etc.
1998 * kjs/grammar.y: Create {Prefix,Postfix}ErrorNode based on the actual node,
1999 not the based on the node returned by "nodeInsideAllParens()". Same for
2002 2007-05-25 Simon Hausmann <hausmann@kde.org>
2006 Fix crash in Qt JavaScript bindings when the arguments used on the Qt side are not
2007 registered with QMetaType.
2009 * bindings/qt/qt_instance.cpp:
2010 (KJS::Bindings::QtInstance::invokeMethod):
2011 * bindings/qt/qt_runtime.cpp:
2013 2007-05-24 Luciano Montanaro <mikelima@cirulla.net>
2017 Patch for http://bugs.webkit.org/show_bug.cgi?id=13855
2018 Port patch 666176 to JavaScriptCore
2020 - Renamed JSValue::downcast() to JSValue::asCell() which makes the
2021 function meaning cleaner. It's modeled after Harri Porten change in
2024 * kjs/collector.cpp:
2025 (KJS::Collector::protect):
2026 (KJS::Collector::unprotect):
2027 (KJS::Collector::collectOnMainThreadOnly):
2029 (KJS::JSValue::isObject):
2030 * kjs/string_object.cpp:
2031 (KJS::StringProtoFunc::callAsFunction):
2033 (KJS::JSValue::asCell):
2034 (KJS::JSValue::isNumber):
2035 (KJS::JSValue::isString):
2036 (KJS::JSValue::isObject):
2037 (KJS::JSValue::getNumber):
2038 (KJS::JSValue::getString):
2039 (KJS::JSValue::getObject):
2040 (KJS::JSValue::getUInt32):
2041 (KJS::JSValue::mark):
2042 (KJS::JSValue::marked):
2043 (KJS::JSValue::type):
2044 (KJS::JSValue::toPrimitive):
2045 (KJS::JSValue::toBoolean):
2046 (KJS::JSValue::toNumber):
2047 (KJS::JSValue::toString):
2048 (KJS::JSValue::toObject):
2050 2007-05-18 Holger Hans Peter Freyther <zecke@selfish.org>
2052 Reviewed by Mark Rowe.
2054 * kjs/testkjs.pro: Make the Gdk port link to icu
2056 2007-05-15 Geoffrey Garen <ggaren@apple.com>
2058 Reviewed by Adele Peterson.
2060 It helps if you swap the right variable.
2065 2007-05-15 Lars Knoll <lars@trolltech.com>
2069 Extend the QObject JavaScript bindings to work for slots with
2072 * bindings/qt/qt_instance.cpp:
2073 (KJS::Bindings::QtInstance::invokeMethod):
2075 2007-05-14 Kimmo Kinnunen <kimmok@iki.fi>
2079 - Fixes http://bugs.webkit.org/show_bug.cgi?id=13622 (Decompiler
2080 omits trailing comma in array literal)
2082 * kjs/nodes2string.cpp:
2083 (ArrayNode::streamTo): print extra ',' in case there was elision
2084 commas (check opt member var) and array elements present
2085 in the array expression
2087 2007-05-14 Geoffrey Garen <ggaren@apple.com>
2089 Reviewed by Oliver Hunt.
2091 Added HashMap::swap and HashSet::swap. WebCore now uses HashSet::swap.
2092 I figured while I was in the neighborhood I might as well add HashMap::swap,
2102 2007-05-11 Kimmo Kinnunen <kimmok@iki.fi>
2106 - Fix for bug http://bugs.webkit.org/show_bug.cgi?id=13620
2107 Bogus decompilation of "for (var j = 1 in [])"
2108 - ForInNode toString()'ed to syntax error if there was var decl
2110 - ForNode toStringed()'ed lost 'var ' if it was present
2112 * kjs/nodes2string.cpp:
2113 (VarDeclListNode::streamTo): Print "var " here
2114 (VarStatementNode::streamTo): Don't print "var " here
2115 (ForNode::streamTo): Remove TODO comment, VarDeclListNode will
2117 (ForInNode::streamTo): ForIn initializer is printed by VarDeclNode
2119 2007-05-11 Kimmo Kinnunen <kimmok@iki.fi>
2123 - Fixes http://bugs.webkit.org/show_bug.cgi?id=10878
2124 (Incorrect decompilation for "4..x")
2125 - Group numbers in dotted expressions in toString() output, so we
2126 avoid the 4.x constructs when the original input is 4..x.
2127 4..x means the same as 4. .x or (4).x or Number(4).x
2129 * kjs/nodes2string.cpp:
2130 (KJS::SourceStream::):
2131 Add boolean flag to indicate that if next item is a number, it should be grouped.
2132 Add new formatting enum which turns on the boolean flag.
2133 (KJS::SourceStream::SourceStream): Added. Initialize the flag.
2134 (SourceStream::operator<<): Added. New overloaded operator with double value as parameter.
2135 (NumberNode::streamTo): Use the double operator
2136 (ArrayNode::streamTo):
2137 (DotAccessorNode::streamTo):
2138 (FunctionCallDotNode::streamTo):
2139 (FunctionCallParenDotNode::streamTo):
2140 (PostfixDotNode::streamTo):
2141 (DeleteDotNode::streamTo):
2142 (PrefixDotNode::streamTo):
2143 (AssignDotNode::streamTo): Use the new formatting enum to turn on the grouping flag.
2145 2007-05-10 Lars Knoll <lars@trolltech.com>
2149 Fix our last three test failures in the JavaScript
2152 * wtf/unicode/qt4/UnicodeQt4.h:
2153 (WTF::Unicode::toLower):
2154 (WTF::Unicode::toUpper):
2156 2007-05-08 Geoffrey Garen <ggaren@apple.com>
2158 Reviewed by Darin Adler.
2160 Fixed #includes of JSStringRefCF.h and use of CF datatypes. I think I
2161 misunderstood this issue before.
2163 * API/JavaScriptCore.h: #include JSStringRefCF.h. Platforms that don't
2164 want this behavior can just #include individual headers, instead of the
2165 umbrella framework header. But we definitely want Mac OS X clients to
2166 get the #include of JSStringRefCF.h "for free."
2167 * API/minidom.c: Don't #include JSStringRefCF.h. (Don't need to #include
2168 JavaScriptCore.h, either.)
2169 * API/testapi.c: Don't #include JSStringRefCF.h. Do use CF datatypes
2170 regardless of whether __APPLE__ is defined. Platforms that don't support
2171 CF just shouldn't compile this file.
2174 2007-05-09 Eric Seidel <eric@webkit.org>
2178 http://bugs.webkit.org/show_bug.cgi?id=6985
2179 Cyclic __proto__ values cause WebKit to hang
2182 (KJS::JSObject::put): do a cycle check before setting __proto__
2184 2007-05-08 Kimmo Kinnunen <kimmok@iki.fi>
2186 Reviewed by darin. Landed by eseidel.
2188 - http://bugs.webkit.org/show_bug.cgi?id=10880 (Do..while loop gains
2189 a semicolon each time it is toStringed)
2190 Grammar in Ecma-66262, 12.6: "do Statement while ( Expression );"
2191 EmptyStatement was created after every do..while(expr) which
2192 had semicolon at the end.
2194 * kjs/grammar.y: Require semicolon at the end of do..while
2196 2007-05-08 Geoffrey Garen <ggaren@apple.com>
2198 Build fix -- this time for sure.
2200 APICast.h, being private, ends up in a different folder than JSValueRef.h,
2201 so we can't include one from the other using "". Instead, just forward
2202 declare the relevant data types.
2206 2007-05-08 Geoffrey Garen <ggaren@apple.com>
2208 Build fix: export APICast.h for WebCore and WebKit.
2210 * JavaScriptCore.xcodeproj/project.pbxproj:
2212 2007-05-04 Darin Adler <darin@apple.com>
2216 - fix http://bugs.webkit.org/show_bug.cgi?id=12821
2217 <rdar://problem/5007921> Number.toExponential doesn't work for negative numbers
2219 * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
2220 Added a call to fabs before calling log10.
2222 2007-05-03 Holger Freyther <freyther@kde.org>
2224 Reviewed by Zack, landed by Simon.
2225 This is bugzilla bug 13499.
2227 * JavaScriptCore.pri: Place Qt into the qt-port scope
2228 * bindings/testbindings.pro: Place Qt into the qt-port scope
2229 * kjs/testkjs.pro: Place Qt into the qt-port scope
2230 * pcre/pcre.pri: Place Qt into the qt-port scope
2232 2007-05-02 David Harrison <harrison@apple.com>
2236 <rdar://problem/5174862> Crash resulting from DeprecatedString::insert()
2238 Added insertion support for more than one value.
2242 Added support for inserting multiple values.
2245 New. Insert at the start of vectors. Convenient for vectors used as strings.
2247 2007-05-01 Jungshik Shin <jungshik.shin@gmail.com>
2251 - get rid of non-ASCII lteral characters : suppress compiler warnings
2252 http://bugs.webkit.org/show_bug.cgi?id=13551
2255 * pcre/pcre_compile.c:
2257 2007-04-28 Jungshik Shin <jungshik.shin@gmail.com>
2259 Reviewed by Sam Weinig.
2261 - Replace copyright sign in Latin-1 (0xA9) with '(C)'
2262 http://bugs.webkit.org/show_bug.cgi?id=13531
2264 * bindings/npruntime.h:
2266 2007-04-28 Darin Adler <darin@apple.com>
2270 - fix <rdar://problem/5154144> Hamachi test fails: assertion failure in ListHashSet
2272 Test: fast/forms/add-remove-form-elements-stress-test.html
2274 * wtf/ListHashSet.h:
2275 (WTF::ListHashSetNodeAllocator::ListHashSetNodeAllocator): Initialize
2276 m_isDoneWithInitialFreeList to false.
2277 (WTF::ListHashSetNodeAllocator::allocate): Added assertions based on a debug-only
2278 m_isAllocated flag that make sure we don't allocate a block that's already allocated.
2279 These assertions helped pinpoint the bug. Set m_isDoneWithInitialFreeList when we
2280 allocate the last block of the initial free list. Once we're done with the initial
2281 free list, turn off the rule that says that the next node in the pool after the last
2282 node in the free list is also free. This rule works because any free nodes are added
2283 to the head of the free list, so a node that hasn't been allocated even once is always
2284 at the tail of the free list and all the nodes after it also haven't been allocated
2285 even once. But it doesn't work any longer once the entire pool has been used at least
2286 once, because there's nothing special about the last node on the free list any more.
2287 (WTF::ListHashSetNodeAllocator::deallocate): Set the node's m_isAllocated to false.
2288 (WTF::ListHashSetNodeAllocator::pastPool): Added. Used above.
2289 (WTF::ListHashSetNodeAllocator::inPool): Changed to use the pastPool function.
2290 (WTF::ListHashSetNode::ListHashSetNode): Initialize m_isAllocated to true.
2291 (WTF::ListHashSetNode::operator new): Removed variable name for unused size
2293 (WTF::ListHashSetNode::destroy): Changed to call the destructor rather than
2294 delete -- this gets rid of the need to define an operator delete.
2296 2007-04-27 Christopher Brichford <chrisb@adobe.com>
2298 Reviewed by Timothy Hatcher.
2300 Fix for: Bug 13211: Move JavaScriptCore mac project files for apollo port
2301 http://bugs.webkit.org/show_bug.cgi?id=13211
2303 * JavaScriptCore.apolloproj/mac/JavaScriptCore.Debug.xcconfig: Added.
2304 * JavaScriptCore.apolloproj/mac/JavaScriptCore.Release.xcconfig: Added.
2305 * JavaScriptCore.apolloproj/mac/JavaScriptCore.xcconfig: Added.
2306 * JavaScriptCore.apolloproj/mac/JavaScriptCore.xcodeproj/project.pbxproj: Added.
2307 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Debug.xcconfig: Removed.
2308 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Release.xcconfig: Removed.
2309 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcconfig: Removed.
2310 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: Removed.
2312 2007-04-27 Holger Freyther <freyther@kde.org>
2316 Remove unmaintained CMake build system.
2318 * CMakeLists.txt: Removed.
2319 * pcre/CMakeLists.txt: Removed.
2321 2007-04-27 Mark Rowe <mrowe@apple.com>
2325 * JavaScriptCore.xcodeproj/project.pbxproj: Improve dependencies in Xcode project
2326 by marking dftables as a dependency of Generate Derived Sources rather than of
2327 JavaScriptCore itself.
2329 2007-04-26 Geoffrey Garen <ggaren@apple.com>
2331 Build fix -- added #includes that we used to get implicitly through
2339 2007-04-26 Geoffrey Garen <ggaren@apple.com>
2341 Reviewed by Maciej Stachowiak, Adam Roben.
2344 <rdar://problem/4885130> Remove #include of JSStringRefCF.h from JSStringRef.h
2345 <rdar://problem/4885123> JavaScriptCore is not cross-platform -- JSStringRef.h references CF datatypes
2347 * API/JSStringRef.h: Removed #include -- no clients need it anymore.
2349 2007-04-25 David Kilzer <ddkilzer@apple.com>
2353 Add assertions for debug builds.
2356 (KJS::JSLock::lock): Assert the return value of pthread_mutex_lock() in debug builds.
2357 (KJS::JSLock::unlock): Assert the return value of pthread_mutex_unlock() in debug builds.
2359 2007-04-25 Maciej Stachowiak <mjs@apple.com>
2363 - fix build problems
2365 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable warning that
2366 gives often downright incorrect results based on guessing what will happen in 64-bit.
2368 2007-04-25 Darin Adler <darin@apple.com>
2372 - tweak the allocator for a small speedup -- Shark showed this was a win, but I can't
2373 measure an improvement right now, but it's also clear these changes do no harm
2375 * wtf/FastMalloc.cpp:
2376 (WTF::LgFloor): Use ALWAYS_INLINE here; in testing I did a while back this was necessary
2377 to get this single-instruction function to be inlined.
2378 (WTF::SizeClass): Use ALWAYS_INLINE here too for the same reason. Also change the special
2379 case for a size of 0 to work without a branch for a bit of extra speed.
2380 (WTF::ByteSizeForClass): Use ALWAYS_INLINE here too for the same reason.
2382 2007-04-24 Maciej Stachowiak <mjs@apple.com>
2386 - use custom calling convention for everything in nodes.cpp on intel gcc for 1.5% speed boost
2388 Nearly all functions in nodes.cpp were marked up to use the
2389 regparm(3) calling convention under GCC for x86, since this is
2390 faster and they are all guaranteed to be called only internally to
2393 The only exception is destructors, since delete doesn't know how to use a custom calling convention.
2396 (dotExprDoesNotAllowCallsString):
2399 (KJS::StatementNode::):
2401 (KJS::BooleanNode::):
2402 (KJS::NumberNode::):
2403 (KJS::StringNode::):
2404 (KJS::RegExpNode::):
2406 (KJS::ResolveNode::):
2408 (KJS::ElementNode::):
2410 (KJS::PropertyNameNode::):
2411 (KJS::PropertyNode::):
2412 (KJS::PropertyListNode::):
2413 (KJS::ObjectLiteralNode::):
2414 (KJS::BracketAccessorNode::):
2415 (KJS::DotAccessorNode::):
2416 (KJS::ArgumentListNode::):
2417 (KJS::ArgumentsNode::):
2418 (KJS::NewExprNode::):
2419 (KJS::FunctionCallValueNode::):
2420 (KJS::FunctionCallResolveNode::):
2421 (KJS::FunctionCallBracketNode::):
2422 (KJS::FunctionCallParenBracketNode::):
2423 (KJS::FunctionCallDotNode::):
2424 (KJS::FunctionCallParenDotNode::):
2425 (KJS::PostfixResolveNode::):
2426 (KJS::PostfixBracketNode::):
2427 (KJS::PostfixDotNode::):
2428 (KJS::PostfixErrorNode::):
2429 (KJS::DeleteResolveNode::):
2430 (KJS::DeleteBracketNode::):
2431 (KJS::DeleteDotNode::):
2432 (KJS::DeleteValueNode::):
2434 (KJS::TypeOfResolveNode::):
2435 (KJS::TypeOfValueNode::):
2436 (KJS::PrefixResolveNode::):
2437 (KJS::PrefixBracketNode::):
2438 (KJS::PrefixDotNode::):
2439 (KJS::PrefixErrorNode::):
2440 (KJS::UnaryPlusNode::):
2441 (KJS::NegateNode::):
2442 (KJS::BitwiseNotNode::):
2443 (KJS::LogicalNotNode::):
2447 (KJS::RelationalNode::):
2449 (KJS::BitOperNode::):
2450 (KJS::BinaryLogicalNode::):
2451 (KJS::ConditionalNode::):
2452 (KJS::AssignResolveNode::):
2453 (KJS::AssignBracketNode::):
2454 (KJS::AssignDotNode::):
2455 (KJS::AssignErrorNode::):
2457 (KJS::AssignExprNode::):
2458 (KJS::VarDeclListNode::):
2459 (KJS::VarStatementNode::):
2460 (KJS::EmptyStatementNode::):
2461 (KJS::ExprStatementNode::):
2463 (KJS::DoWhileNode::):
2466 (KJS::ContinueNode::):
2468 (KJS::ReturnNode::):
2473 (KJS::ParameterNode::):
2475 (KJS::FunctionBodyNode::):
2476 (KJS::FuncExprNode::):
2477 (KJS::FuncDeclNode::):
2478 (KJS::SourceElementsNode::):
2479 (KJS::CaseClauseNode::):
2480 (KJS::ClauseListNode::):
2481 (KJS::SwitchNode::):
2483 2007-04-24 Oliver Hunt <oliver@apple.com>
2485 GTK Build fix, ::findEntry->KJS::findEntry
2488 (KJS::Lookup::findEntry):
2489 (KJS::Lookup::find):
2491 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2495 - compile most of JavaScriptCore as one file for 4% JS iBench speed improvement
2497 * JavaScriptCore.xcodeproj/project.pbxproj: Add AllInOneFile.cpp, and remove files it includes
2499 * kjs/AllInOneFile.cpp: Added.
2500 * kjs/dtoa.cpp: Renamed CONST to CONST_ to avoid conflict.
2502 (Bigint::nrv_alloc):
2503 * kjs/lookup.cpp: Use "namspace KJS { ... }" instead of "using namespace KJS;"
2505 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2507 Build fix, not reviewed.
2509 * kjs/collector.h: Fix struct/class mismatch.
2511 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2515 - raise ALLOCATIONS_PER_COLLECTION to 4000, for 3.7% iBench speed improvement
2517 Now that the cell size is smaller and the block size is bigger, we can fit 4000 objects in
2518 the two spare cells the collector is willing to keep around, so collect a bit less often.
2520 * kjs/collector.cpp:
2522 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2524 Reviewed by Darin and Geoff.
2526 - move mark and collectOnMainThreadOnly bits into separate bitmaps
2528 This saves 4 bytes per cell, allowing shrink of cell size to 32,
2529 which leads to a .8% speed improvement on iBench.
2531 This is only feasible because of all the previous changes on the branch.
2533 * kjs/collector.cpp:
2534 (KJS::allocateBlock): Adjust for some renames of constants.
2535 (KJS::Collector::markStackObjectsConservatively): Now that cells are 32 bytes (64
2536 bytes on 64-bit) the cell alignment check can be made much more strict, and also
2537 obsoletes the need for a % sizeof(CollectorCell) check. Also, we can mask off the low
2538 bits of the pointer to have a potential block pointer to look for.
2539 (KJS::Collector::collectOnMainThreadOnly): Use bitmap.
2540 (KJS::Collector::markMainThreadOnlyObjects): Use bitmap.
2541 (KJS::Collector::collect): When sweeping, use bitmaps directly to find mark bits.
2543 (KJS::): Move needed constants and type declarations here.
2544 (KJS::CollectorBitmap::get): Bit twiddling to get a bitmap value.
2545 (KJS::CollectorBitmap::set): Bit twiddling to set a bitmap bit to true.
2546 (KJS::CollectorBitmap::clear): Bit twiddling to set a bitmap bit to false.
2547 (KJS::CollectorBitmap::clearAll): Clear whole bitmap at one go.
2548 (KJS::Collector::cellBlock): New operation, compute the block pointer for
2549 a cell by masking off low bits.
2550 (KJS::Collector::cellOffset): New operation, compute the cell offset for a
2551 cell by masking off high bits and dividing (actually a shift).
2552 (KJS::Collector::isCellMarked): Check mark bit in bitmap
2553 (KJS::Collector::markCell): Set mark bit in bitmap.
2555 (KJS::JSCell::JSCell): No more bits.
2556 (KJS::JSCell::marked): Let collector handle it.
2557 (KJS::JSCell::mark): Let collector handle it.
2559 2007-04-23 Anders Carlsson <andersca@apple.com>
2563 * kjs/regexp_object.h:
2564 RegExpObjectImpPrivate is a struct, not a class.
2566 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2570 - shrink FunctionImp / DeclaredFunctionImp by 4 bytes, by moving parameter list to function body
2572 I reconciled this with a similar change in KDE kjs by Maks Orlovich <maksim@kde.org>.
2575 (KJS::FunctionImp::callAsFunction):
2576 (KJS::FunctionImp::passInParameters):
2577 (KJS::FunctionImp::lengthGetter):
2578 (KJS::FunctionImp::getParameterName):
2580 * kjs/function_object.cpp:
2581 (FunctionProtoFunc::callAsFunction):
2582 (FunctionObjectImp::construct):
2584 (FunctionBodyNode::addParam):
2585 (FunctionBodyNode::paramString):
2586 (FuncDeclNode::addParams):
2587 (FuncDeclNode::processFuncDecl):
2588 (FuncExprNode::addParams):
2589 (FuncExprNode::evaluate):
2591 (KJS::Parameter::Parameter):
2592 (KJS::FunctionBodyNode::numParams):
2593 (KJS::FunctionBodyNode::paramName):
2594 (KJS::FunctionBodyNode::parameters):
2595 (KJS::FuncExprNode::FuncExprNode):
2596 (KJS::FuncDeclNode::FuncDeclNode):
2597 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable 64-bit warnings because
2598 they handle size_t badly.
2600 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2604 - shrink RegexpObjectImp by 4 bytes
2606 Somewhat inexplicably, this seems to be a .33% speedup on JS iBench.
2608 * kjs/regexp_object.cpp:
2609 (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate):
2610 (RegExpObjectImp::RegExpObjectImp):
2611 (RegExpObjectImp::performMatch):
2612 (RegExpObjectImp::arrayOfMatches):
2613 (RegExpObjectImp::getBackref):
2614 (RegExpObjectImp::getLastMatch):
2615 (RegExpObjectImp::getLastParen):
2616 (RegExpObjectImp::getLeftContext):
2617 (RegExpObjectImp::getRightContext):
2618 (RegExpObjectImp::getValueProperty):
2619 (RegExpObjectImp::putValueProperty):
2620 * kjs/regexp_object.h:
2622 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2626 - change to 1-bit bitfields instead of 8-bit, this turns out to lead to a .51% speedup on JS iBench
2628 The 1-bit bitfields are actually faster than just plain bools, at least on Intel (go figure).
2630 * kjs/property_map.h:
2632 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2636 - shrink ArrayInstance objects by 4 bytes
2637 http://bugs.webkit.org/show_bug.cgi?id=13386
2639 I did this by storing the capacity before the beginning of the storage array. It turns out
2640 it is rarely needed and is by definition 0 when the storage array is null.
2642 * kjs/array_instance.h:
2643 (KJS::ArrayInstance::capacity): Get it from the secret stash
2644 * kjs/array_object.cpp:
2645 (allocateStorage): New function to encapsulate allocating the storage with extra space ahead
2647 (reallocateStorage): ditto for realloc
2648 (ArrayInstance::ArrayInstance):
2649 (ArrayInstance::~ArrayInstance):
2650 (ArrayInstance::resizeStorage):
2652 2007-04-23 Darin Adler <darin@apple.com>
2656 - fix <rdar://problem/4840688> REGRESSION (r10588, r10621): JavaScript won't parse
2657 modifications of non-references (breaks 300themovie.warnerbros.com, fedex.com)
2659 Despite the ECMAScript specification's claim that you can treat these as syntax
2660 errors, doing so creates some website incompatibilities. So this patch turns them back
2661 into evaluation errors instead.
2663 Test: fast/js/modify-non-references.html
2665 * kjs/grammar.y: Change makeAssignNode, makePrefixNode, and makePostfixNode so that they
2666 never fail to parse. Update rules that use them. Fix a little bit of indenting. Use
2667 new PostfixErrorNode, PrefixErrorNode, and AssignErrorNode classes.
2669 * kjs/nodes.h: Added an overload of throwError that takes a char* argument.
2670 Replaced setExceptionDetailsIfNeeded and debugExceptionIfNeeded with handleException,
2671 which does both. Added PostfixErrorNode, PrefixErrorNode, and AssignErrorNode classes.
2673 * kjs/nodes.cpp: Changed exception macros to use handleException; simpler and smaller
2674 code size than the two functions that we used before.
2675 (Node::throwError): Added the overload mentioned above.
2676 (Node::handleException): Added. Contains the code from both setExceptionDetailsIfNeeded
2677 and debugExceptionIfNeeded.
2678 (PostfixErrorNode::evaluate): Added. Throws an exception.
2679 (PrefixErrorNode::evaluate): Ditto.
2680 (AssignErrorNode::evaluate): Ditto.
2681 (ThrowNode::execute): Call handleException instead of debugExceptionIfNeeded; this
2682 effectively adds a call to setExceptionDetailsIfNeeded, which may help with getting
2683 the correct file and line number for these exceptions.
2685 * kjs/nodes2string.cpp:
2686 (PostfixErrorNode::streamTo): Added.
2687 (PrefixErrorNode::streamTo): Added.
2688 (AssignErrorNode::streamTo): Added.
2690 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2694 - fix test failures / crashes on PPC
2696 * kjs/property_map.h: Make the bool fields explicitly 8-bit bitfields, since bool is a full
2697 word there otherwise :-(
2699 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2703 - fix more test case failures
2705 * bindings/runtime_array.cpp:
2706 (RuntimeArray::RuntimeArray): inherit from JSObject instead of ArrayInstance; it turns
2707 out that this class only needs the prototype and classInfo from ArrayInstance, not the
2708 actual class itself, and it was too big otherwise.
2709 (RuntimeArray::getOwnPropertySlot):
2710 * bindings/runtime_array.h:
2712 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2716 - fix some test failures
2718 * bindings/runtime_method.cpp:
2719 (RuntimeMethod::RuntimeMethod): inherit from InternalFunctionImp instead of FunctionImpl,
2720 otherwise this is too big
2721 (RuntimeMethod::getOwnPropertySlot):
2722 * bindings/runtime_method.h:
2724 2007-04-22 Maciej Stachowiak <mjs@apple.com>
2728 - discard the arguments List for an ActivationImp when the corresponding Context is destroyed (1.7% speedup)
2729 http://bugs.webkit.org/show_bug.cgi?id=13385
2731 Based an idea by Christopher E. Hyde <C.Hyde@parableuk.force9.co.uk>. His patch to do
2732 this also had many other List changes and I found this much simpler subset of the changes
2733 was actually a hair faster.
2735 This optimization is valid because the arguments list is only kept around to
2736 lazily make the arguments object. If it's not made by the time the function
2737 exits, it never will be, since any function that captures the continuation will
2738 have its own local arguments variable in scope.
2740 Besides the 1.7% speed improvement, it shrinks List by 4 bytes
2741 (which in turn shrinks ActivationImp by 4 bytes).
2744 (KJS::Context::~Context): Clear the activation's arguments list.
2746 (KJS::ActivationImp::ActivationImp): Adjusted for list changes.
2747 (KJS::ActivationImp::mark): No need to mark, lists are always protected (this doesn't
2748 cause a ref-cycle for reasons stated above).
2749 (KJS::ActivationImp::createArgumentsObject): Clear arguments list.
2752 (KJS::List::List): No more needsMarking boolean
2753 (KJS::List::operator=): ditto
2755 (KJS::List::List): ditto
2756 (KJS::List::reset): ditto
2757 (KJS::List::deref): ditto
2759 2007-04-22 Maciej Stachowiak <mjs@apple.com>
2763 - shrink PropertyMap by 8 bytes and therefore shrink CELL_SIZE to 40 (for 32-bit;
2764 similar shrinkage for 64-bit)
2765 http://bugs.webkit.org/show_bug.cgi?id=13384
2767 Inspired by similar changes by Christopher E. Hyde <C.Hyde@parableuk.force9.co.uk>
2768 done in the kjs-tweaks branch of KDE's kjs. However, this version is somewhat
2769 cleaner style-wise and avoids some of the negative speed impact (at least on gcc/x86)
2772 This is nearly a wash performance-wise, maybe a slight slowdown, but worth doing
2773 to eventually reach cell size 32.
2775 * kjs/collector.cpp:
2777 * kjs/property_map.cpp:
2778 (KJS::PropertyMap::~PropertyMap):
2779 (KJS::PropertyMap::clear):
2780 (KJS::PropertyMap::get):
2781 (KJS::PropertyMap::getLocation):
2782 (KJS::PropertyMap::put):
2783 (KJS::PropertyMap::insert):
2784 (KJS::PropertyMap::expand):
2785 (KJS::PropertyMap::rehash):
2786 (KJS::PropertyMap::remove):
2787 (KJS::PropertyMap::mark):
2788 (KJS::PropertyMap::containsGettersOrSetters):
2789 (KJS::PropertyMap::getEnumerablePropertyNames):
2790 (KJS::PropertyMap::getSparseArrayPropertyNames):
2791 (KJS::PropertyMap::save):
2792 (KJS::PropertyMap::checkConsistency):
2793 * kjs/property_map.h:
2794 (KJS::PropertyMap::hasGetterSetterProperties):
2795 (KJS::PropertyMap::setHasGetterSetterProperties):
2796 (KJS::PropertyMap::):
2797 (KJS::PropertyMap::PropertyMap):
2799 2007-04-22 Maciej Stachowiak <mjs@apple.com>
2803 - change blocks to 64k in size, and use various platform-specific calls to allocate at 64k-aligned addresses
2804 http://bugs.webkit.org/show_bug.cgi?id=13383
2806 * kjs/collector.cpp:
2807 (KJS::allocateBlock): New function to allocate 64k of 64k-aligned memory
2808 (KJS::freeBlock): Corresponding free
2809 (KJS::Collector::allocate):
2810 (KJS::Collector::collect):
2812 2007-04-22 Maciej Stachowiak <mjs@apple.com>
2814 Reviewed by Darin and Geoff.
2816 - remove the concept of oversize objects, now that there aren't any (for now
2817 only enforced with an assert).
2818 http://bugs.webkit.org/show_bug.cgi?id=13382
2820 This change is a .66% speedup on JS iBench for 32-bit platforms, probably much more
2821 for 64-bit since it finally gives a reasonable cell size, but I did not test that.
2823 * kjs/collector.cpp:
2824 (KJS::): Use different cell size for 32-bit and 64-bit, now that there is no
2825 oversize allocation.
2826 (KJS::Collector::allocate): Remove oversize allocator.
2827 (KJS::Collector::markStackObjectsConservatively): Don't check oversize objects.
2828 (KJS::Collector::markMainThreadOnlyObjects): Ditto.
2829 (KJS::Collector::collect): Ditto.
2831 2007-04-21 Mitz Pettel <mitz@webkit.org>
2835 - fix http://bugs.webkit.org/show_bug.cgi?id=13428
2836 REGRESSION (r20973-r20976): Failing ecma/Array/15.4.4.5-3.js
2838 - fix http://bugs.webkit.org/show_bug.cgi?id=13429
2839 REGRESSION (r20973-r20976): Crashing in fast/dom/plugin-attributes-enumeration.html
2841 * kjs/array_object.cpp:
2842 (ArrayInstance::sort): Free the old storage, not the new one.
2844 2007-04-20 Maciej Stachowiak <mjs@apple.com>
2846 Not reviewed, build fix.
2848 - fix build problem with last change - -O3 complains more about uninitialized variables
2850 * pcre/pcre_compile.c:
2854 2007-04-20 Maciej Stachowiak <mjs@apple.com>
2858 - <rdar://problem/5149915> use mergesort when possible, since it leads to fewer compares (2% JS iBench speedup)
2860 * kjs/array_object.cpp:
2861 (ArrayInstance::sort): Use mergesort(3) on platforms that have it, since it tends
2862 to do fewer compares than qsort; but avoid it very on large arrays since it uses extra
2863 memory. Also added comments identifying possibly even better sorting algorithms
2864 for sort by string value and sort by compare function.
2867 2007-04-20 Maciej Stachowiak <mjs@apple.com>
2871 - bump optimization flags up to -O3 for 1% JS iBench speed improvement
2873 * Configurations/Base.xcconfig:
2875 2007-04-20 Mark Rowe <mrowe@apple.com>
2879 Fix bogus optimisation in the generic pthread code path.
2881 * kjs/collector.cpp:
2882 (KJS::currentThreadStackBase):
2884 2007-04-20 Mark Rowe <mrowe@apple.com>
2888 Improve FreeBSD compatibility, as suggested by Alexander Botero-Lowry.
2890 * kjs/collector.cpp:
2891 (KJS::currentThreadStackBase): FreeBSD requires that pthread_attr_t's are
2892 initialized via pthread_attr_init before being used in any context.
2894 2007-04-19 Mark Rowe <mrowe@apple.com>
2898 Fix http://bugs.webkit.org/show_bug.cgi?id=13401
2899 Bug 13401: Reproducible crash calling myArray.sort(compareFn) from within
2900 a sort comparison function
2902 * kjs/array_object.cpp:
2903 (ArrayInstance::sort): Save/restore the static variables around calls to qsort
2904 to ensure nested calls to ArrayInstance::sort behave correctly.
2906 2007-04-12 Deneb Meketa <dmeketa@adobe.com>
2908 Reviewed by Darin Adler.
2910 http://bugs.webkit.org/show_bug.cgi?id=13029
2911 rdar://problem/4994849
2912 Bug 13029: Permit NPAPI plug-ins to see HTTP response headers.
2913 This doesn't actually change JavaScriptCore, but that's where npapi.h is.
2916 Add headers member to NPStream struct. Also increase NP_VERSION_MINOR to 18.
2917 Increasing to >= 17 allows plug-ins to safely detect whether to look for
2918 NPStream::headers. Increasing from 17 to 18 reflects presence of NPObject
2919 enumeration, which was added in a prior patch, and which has been agreed to
2920 constitute version 18 by the plugin-futures list. Also add other missing
2921 bits of npapi.h to catch up from 14 to 18. This includes features that are
2922 not implemented in WebKit, but those are safely stubbed.
2924 2007-04-10 Geoffrey Garen <ggaren@apple.com>
2926 Reviewed by Mark Rowe.
2928 Fixed last check-in to print in release builds, too.
2930 * kjs/collector.cpp:
2931 (KJS::getPlatformThreadRegisters):
2933 2007-04-10 Geoffrey Garen <ggaren@apple.com>
2935 Reviewed by John Sullivan, Darin Adler.
2937 Fixed <rdar://problem/5121899> JavaScript garbage collection leads to
2938 later crash under Rosetta (should abort or leak instead?)
2940 Log an error message and crash if the kernel reports failure during GC.
2941 We decided to do this instead of just leaking because we don't want people
2942 to get the mistaken impression that running in Rosetta is a supported
2945 The CRASH macro will also hook into CrashReporter, which will tell us if
2946 many (any?) users run into this issue.
2948 * kjs/collector.cpp:
2949 (KJS::getPlatformThreadRegisters):
2951 2007-04-06 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
2955 Coverity fix. Coverity says:
2956 "Event var_deref_model: Variable "sourceRanges" tracked as NULL was passed to a
2957 function that dereferences it"
2959 * kjs/string_object.cpp:
2962 2007-04-06 Geoffrey Garen <ggaren@apple.com>
2964 Rubber stamped by Adele Peterson.
2966 * kjs/ExecState.h: Removed obsolete forward/friend declaration of
2969 2007-04-05 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
2973 Coverity fix. Coverity says:
2974 "Event check_after_deref: Pointer "dateString" dereferenced before NULL check"
2976 * kjs/date_object.cpp:
2979 2007-04-05 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
2983 Coverity fix. Coverity says:
2984 "Event check_after_deref: Pointer "re" dereferenced before NULL check"
2986 * pcre/pcre_study.c:
2989 2007-04-05 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
2993 Coverity fixes. Coverity says:
2994 "Event leaked_storage: Returned without freeing storage "buffer""
2996 "Event leaked_storage: Returned without freeing storage "script""
3000 (createStringWithContentsOfFile):
3002 2007-04-05 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
3006 Coverity fix: in single-threaded case currentThreadIsMainThread is always true
3007 so the code in if (!currentThreadIsMainThread) cannot possibly be reached
3008 and Coverity complains about dead code.
3010 * kjs/collector.cpp:
3011 (KJS::Collector::collect):
3013 === Safari-5522.6 ===
3015 2007-04-03 Kevin McCullough <kmccullough@apple.com>
3019 - Testing a post-commit hook.
3021 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
3023 2007-04-03 Anders Carlsson <andersca@apple.com>
3027 <rdar://problem/5107534>
3028 http://bugs.webkit.org/show_bug.cgi?id=13265
3029 REGRESSION: Crash in KJS::Bindings::convertValueToNPVariant
3031 * bindings/NP_jsobject.cpp:
3032 (_NPN_InvokeDefault):
3033 Return false if the object isn't a function. Set the return value to undefined by default
3036 2007-03-30 Anders Carlsson <andersca@apple.com>
3040 * bindings/NP_jsobject.cpp:
3043 2007-03-30 Anders Carlsson <andersca@apple.com>
3047 Implement _NPN_Enumerate support.
3049 * JavaScriptCore.exp:
3050 * bindings/NP_jsobject.cpp:
3052 * bindings/c/c_instance.cpp:
3053 (KJS::Bindings::CInstance::getPropertyNames):
3054 * bindings/c/c_instance.h:
3056 * bindings/npruntime.h:
3057 * bindings/npruntime_impl.h:
3058 * bindings/runtime.h:
3059 (KJS::Bindings::Instance::getPropertyNames):
3060 * bindings/runtime_object.cpp:
3061 (RuntimeObjectImp::getPropertyNames):
3062 * bindings/runtime_object.h:
3063 (KJS::RuntimeObjectImp::getInternalInstance):
3065 2007-03-28 Jeff Walden <jwalden+code@mit.edu>
3069 http://bugs.webkit.org/show_bug.cgi?id=12963
3070 Fix some inconsistencies in the Mozilla JS Array extras implementations
3071 with respect to the Mozilla implementation:
3073 - holes in arrays should be skipped, not treated as undefined,
3075 - an element with value undefined is not a hole
3076 - Array.prototype.forEach should return undefined
3078 * kjs/array_object.cpp:
3079 (ArrayInstance::getOwnPropertySlot):
3080 (ArrayProtoFunc::callAsFunction):
3082 2007-03-27 Anders Carlsson <acarlsson@apple.com>
3086 * bindings/NP_jsobject.cpp:
3087 (_NPN_InvokeDefault):
3088 Call JSObject:call for native JavaScript objects.
3090 2007-03-26 David Carson <dacarson@gmail.com>
3092 Reviewed by Darin, landed by Anders.
3094 Fix for: REGRESSION (r19559): Java applet crash
3095 http://bugs.webkit.org/show_bug.cgi?id=13142
3096 <rdar://problem/5080340>
3098 The previous fix http://bugs.webkit.org/show_bug.cgi?id=12636
3099 introduced new JNIType to enum in jni_utility.h This is a
3100 problem on the Mac as it seems that the JNIType enum is also
3101 used in the JVM, it is used to specify the return type in
3103 Corrected the fix by moving type to the end, and changing
3104 jni_objc.mm to convert the new type to an old compatible
3107 * bindings/jni/jni_objc.mm:
3108 (KJS::Bindings::dispatchJNICall):
3109 * bindings/jni/jni_utility.h:
3111 2007-03-26 Christopher Brichford <chrisb@adobe.com>
3113 Reviewed/landed by Adam.
3115 Bug 13198: Move build settings from project file to xcconfig file for apollo
3117 http://bugs.webkit.org/show_bug.cgi?id=13198
3119 - Moving build settings from xcode project file to xcconfig files.
3121 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Debug.xcconfig:
3122 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Release.xcconfig:
3123 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcconfig:
3124 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
3126 2007-03-26 Brady Eidson <beidson@apple.com>
3128 Rubberstamped by Anders and Maciej aand Geoff (oh my!)
3130 Since CFTypeRef is really void*, a RetainPtr couldn't be used.
3131 RefType was "void", which doesn't actually exist as a type.
3132 Since RefType only existed for operator*(), and since that operator
3133 doesn't make any sense for RetainPtr, I removed them!
3135 * kjs/nodes.cpp: Touch this to force a rebuild and (hopefully) help the
3136 compiler with dependencies
3137 * wtf/RetainPtr.h: Nuke RefType and operator*()
3139 2007-03-26 Geoffrey Garen <ggaren@apple.com>
3141 Touched a file to (hopefully) help the compiler with RetainPtr dependencies.
3146 2007-03-24 Brady Eidson <beidson@apple.com>
3150 Whoops, RetainPtr should be in the WTF namespace
3154 2007-03-24 Brady Eidson <beidson@apple.com>
3158 <rdar://problem/5086210> - Move RetainPtr to WTF
3160 * wtf/RetainPtr.h: Added
3161 * JavaScriptCore.xcodeproj/project.pbxproj: Add it to the project file
3162 * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto
3165 2007-03-23 Christopher Brichford <chrisb@adobe.com>
3167 Reviewed/landed by Adam.
3169 Bug 13175: Make apollo mac project files for JavaScriptCore actually
3171 http://bugs.webkit.org/show_bug.cgi?id=13175
3173 - Changing apollo mac project files for JavaScriptCore such that they actually build
3174 JavaScriptCore source code.
3176 * JavaScriptCore.apolloproj/ForwardingSources/grammar.cpp: Added.
3177 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcconfig:
3178 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
3180 2007-03-24 Mark Rowe <mrowe@apple.com>
3182 Rubber-stamped by Darin.
3184 * Configurations/JavaScriptCore.xcconfig: Remove unnecessary INFOPLIST_PREPROCESS.
3186 2007-03-22 Christopher Brichford <chrisb@adobe.com>
3188 Reviewed/landed by Adam.
3190 Bug 13164: Initial version of mac JavaScriptCore project files for
3192 http://bugs.webkit.org/show_bug.cgi?id=13164
3194 - Adding mac project files for apollo port of JavaScriptCore. Currently project
3195 just builds dftables.
3197 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Debug.xcconfig: Added.
3198 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Release.xcconfig: Added.
3199 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcconfig: Added.
3200 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: Added.
3202 2007-03-21 Timothy Hatcher <timothy@apple.com>
3206 <rdar://problem/5076599> JavaScriptCore has a weak export (vtable for KJS::JSCell)
3208 * JavaScriptCore.exp: Remove __ZTVN3KJS6JSCellE.
3210 2007-03-21 Adele Peterson <adele@apple.com>
3214 * API/JSStringRef.cpp: (JSStringIsEqual): Added JSLock.
3216 2007-03-21 Zack Rusin <zrusin@trolltech.com>
3218 Fix the compile when USE(MULTIPLE_THREADS) isn't
3222 (KJS::JSLock::currentThreadIsHoldingLock):
3224 2007-03-20 Maciej Stachowiak <mjs@apple.com>
3226 Reviewed by Geoff and Adam.
3228 - make USE(MULTIPLE_THREADS) support more portable
3229 http://bugs.webkit.org/show_bug.cgi?id=13069
3231 - fixed a threadsafety bug discovered by testing this
3233 - enhanced threadsafety assertions in collector
3235 * API/JSCallbackObject.cpp:
3236 (KJS::JSCallbackObject::~JSCallbackObject): This destructor can't
3237 DropAllLocks around the finalize callback, because it gets called
3238 from garbage collection and we can't let other threads collect!
3240 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3242 (KJS::JSLock::currentThreadIsHoldingLock): Added new function
3243 to allow stronger assertions than just that the lock is held
3244 by some thread (you can now assert that the current thread is
3245 holding it, given the new JSLock design).
3247 * kjs/collector.cpp: Refactored for portability plus added some
3248 stronger assertions.
3249 (KJS::Collector::allocate):
3250 (KJS::currentThreadStackBase):
3251 (KJS::Collector::registerAsMainThread):
3252 (KJS::onMainThread):
3253 (KJS::PlatformThread::PlatformThread):
3254 (KJS::getCurrentPlatformThread):
3255 (KJS::Collector::Thread::Thread):
3256 (KJS::destroyRegisteredThread):
3257 (KJS::Collector::registerThread):
3258 (KJS::Collector::markCurrentThreadConservatively):
3259 (KJS::suspendThread):
3260 (KJS::resumeThread):
3261 (KJS::getPlatformThreadRegisters):
3262 (KJS::otherThreadStackPointer):
3263 (KJS::otherThreadStackBase):
3264 (KJS::Collector::markOtherThreadConservatively):
3265 (KJS::Collector::markStackObjectsConservatively):
3266 (KJS::Collector::protect):
3267 (KJS::Collector::unprotect):
3268 (KJS::Collector::collectOnMainThreadOnly):
3269 (KJS::Collector::markMainThreadOnlyObjects):
3270 (KJS::Collector::collect):
3272 * wtf/FastMalloc.cpp:
3273 (WTF::fastMallocSetIsMultiThreaded):
3274 * wtf/FastMallocInternal.h:
3277 2007-03-19 Darin Adler <darin@apple.com>
3279 * kjs/value.h: Roll ~JSValue change out. It was causing problems. I'll do it right later.
3281 2007-03-19 Geoffrey Garen <ggaren@apple.com>
3283 Reviewed by John Sullivan.
3285 Fixed <rdar://problem/5073380> REGRESSION: Crash occurs at WTF::fastFree()
3286 when reloading liveconnect page (applet)
3288 Best to use free when you use malloc, especially when malloc and delete
3289 use completely different libraries.
3291 * bindings/jni/jni_runtime.cpp:
3292 (JavaMethod::~JavaMethod):
3294 2007-03-19 Andrew Wellington <proton@wiretapped.net>
3298 Really set Xcode editor to use 4 space indentation (http://webkit.org/coding/coding-style.html)
3300 * JavaScriptCore.xcodeproj/project.pbxproj:
3302 2007-03-19 Darin Adler <darin@apple.com>
3306 - Changed list size threshold to 5 based on testing.
3308 I was testing the i-Bench JavaScript with the list statistics
3309 dumping on, and discovered that there were many 5-element lists.
3310 The fast case for lists was for 4 elements and fewer. By changing
3311 the threshold to 5 elements we get a measurable speedup. I believe
3312 this will help real web pages too, not just the benchmark.
3314 * kjs/list.cpp: Change constant from 4 to 5.
3316 2007-03-19 Darin Adler <darin@apple.com>
3318 * kjs/value.h: Oops, fix build.
3320 2007-03-19 Darin Adler <darin@apple.com>
3324 - remove ~JSValue; tiny low-risk performance boost
3326 * kjs/value.h: Remove unneeded empty virtual destructor from JSValue.
3327 The only class derived from JSValue is JSCell and it already has a
3328 virtual destructor. Declaring an empty constructor in JSValue had one
3329 good effect: it marked the destructor private, making it a compile
3330 time error to try to destroy a JSValue; but that's not a likely
3331 mistake for someone to make. It had two bad effects: (1) it caused gcc,
3332 at least, to generate code to fix up the virtual table pointer to
3333 point to the JSValue version of the virtual table inside the destructor
3334 of all classes derived from JSValue directly or indirectly; (2) it
3335 caused JSValue to be a polymorphic class so required a virtual table for
3336 it. It's cleaner to not have either of those.
3338 2007-03-18 Maciej Stachowiak <mjs@apple.com>
3342 - avoid static construction (and global variable access) in a smarter, more portable way,
3343 to later enable MUTLI_THREAD mode to work on other platforms and compilers.
3345 * kjs/CommonIdentifiers.cpp: Added. New class to hold all the shared identifiers.
3346 (KJS::CommonIdentifiers::CommonIdentifiers):
3347 (KJS::CommonIdentifiers::shared):
3348 * kjs/CommonIdentifiers.h: Added.
3351 (KJS::ExecState::propertyNames): Hand the CommonIdentifiers instance here for easy access.
3352 (KJS::ExecState::ExecState):
3354 * API/JSObjectRef.cpp:
3355 (JSObjectMakeConstructor):
3357 * JavaScriptCore.exp:
3358 * JavaScriptCore.pri:
3359 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3360 * JavaScriptCore.xcodeproj/project.pbxproj:
3361 * JavaScriptCoreSources.bkl:
3362 * bindings/runtime_array.cpp:
3363 (RuntimeArray::getOwnPropertySlot):
3364 (RuntimeArray::put):
3365 * bindings/runtime_method.cpp:
3366 (RuntimeMethod::getOwnPropertySlot):
3367 * kjs/array_object.cpp:
3368 (ArrayInstance::getOwnPropertySlot):
3369 (ArrayInstance::put):
3370 (ArrayInstance::deleteProperty):
3371 (ArrayProtoFunc::ArrayProtoFunc):
3372 (ArrayProtoFunc::callAsFunction):
3373 (ArrayObjectImp::ArrayObjectImp):
3374 * kjs/bool_object.cpp:
3375 (BooleanPrototype::BooleanPrototype):
3376 (BooleanProtoFunc::BooleanProtoFunc):
3377 (BooleanProtoFunc::callAsFunction):
3378 (BooleanObjectImp::BooleanObjectImp):
3380 (KJS::Completion::Completion):
3381 * kjs/date_object.cpp:
3382 (KJS::DateProtoFunc::DateProtoFunc):
3383 (KJS::DateObjectImp::DateObjectImp):
3384 (KJS::DateObjectFuncImp::DateObjectFuncImp):
3385 * kjs/error_object.cpp:
3386 (ErrorPrototype::ErrorPrototype):
3387 (ErrorProtoFunc::ErrorProtoFunc):
3388 (ErrorProtoFunc::callAsFunction):
3389 (ErrorObjectImp::ErrorObjectImp):
3390 (ErrorObjectImp::construct):
3391 (NativeErrorPrototype::NativeErrorPrototype):
3392 (NativeErrorImp::NativeErrorImp):
3393 (NativeErrorImp::construct):
3394 (NativeErrorImp::callAsFunction):
3396 (KJS::FunctionImp::getOwnPropertySlot):
3397 (KJS::FunctionImp::put):
3398 (KJS::FunctionImp::deleteProperty):
3399 (KJS::FunctionImp::getParameterName):
3400 (KJS::DeclaredFunctionImp::construct):
3401 (KJS::IndexToNameMap::unMap):
3402 (KJS::Arguments::Arguments):
3403 (KJS::ActivationImp::getOwnPropertySlot):
3404 (KJS::ActivationImp::deleteProperty):
3405 (KJS::GlobalFuncImp::GlobalFuncImp):
3406 * kjs/function_object.cpp:
3407 (FunctionPrototype::FunctionPrototype):
3408 (FunctionProtoFunc::FunctionProtoFunc):
3409 (FunctionProtoFunc::callAsFunction):
3410 (FunctionObjectImp::FunctionObjectImp):
3411 (FunctionObjectImp::construct):
3413 * kjs/identifier.cpp:
3415 * kjs/interpreter.cpp:
3416 (KJS::Interpreter::init):
3417 (KJS::Interpreter::initGlobalObject):
3418 * kjs/interpreter.h:
3420 * kjs/math_object.cpp:
3421 (MathFuncImp::MathFuncImp):
3423 (ArrayNode::evaluate):
3424 (FuncDeclNode::processFuncDecl):
3425 (FuncExprNode::evaluate):
3426 * kjs/number_object.cpp:
3427 (NumberPrototype::NumberPrototype):
3428 (NumberProtoFunc::NumberProtoFunc):
3429 (NumberObjectImp::NumberObjectImp):
3431 (KJS::JSObject::put):
3432 (KJS::JSObject::defaultValue):
3433 (KJS::JSObject::hasInstance):
3435 (KJS::JSObject::getOwnPropertySlot):
3436 * kjs/object_object.cpp:
3437 (ObjectPrototype::ObjectPrototype):
3438 (ObjectProtoFunc::ObjectProtoFunc):
3439 (ObjectObjectImp::ObjectObjectImp):
3440 * kjs/regexp_object.cpp:
3441 (RegExpPrototype::RegExpPrototype):
3442 (RegExpProtoFunc::RegExpProtoFunc):
3443 (RegExpObjectImp::RegExpObjectImp):
3444 * kjs/string_object.cpp:
3445 (KJS::StringInstance::getOwnPropertySlot):
3446 (KJS::StringInstance::put):
3447 (KJS::StringInstance::deleteProperty):
3448 (KJS::StringPrototype::StringPrototype):
3449 (KJS::StringProtoFunc::StringProtoFunc):
3450 (KJS::StringProtoFunc::callAsFunction):
3451 (KJS::StringObjectImp::StringObjectImp):
3452 (KJS::StringObjectFuncImp::StringObjectFuncImp):
3454 (TestFunctionImp::TestFunctionImp):
3456 2007-03-18 Andrew Wellington <proton@wiretapped.net>
3458 Reviewed by Mark Rowe
3460 Set Xcode editor to use 4 space indentation (http://webkit.org/coding/coding-style.html)
3462 * JavaScriptCore.xcodeproj/project.pbxproj:
3464 2007-03-19 Mark Rowe <mrowe@apple.com>
3466 Rubber-stamped by Brady.
3468 Update references to bugzilla.opendarwin.org with bugs.webkit.org.
3470 * bindings/c/c_utility.cpp:
3471 (KJS::Bindings::convertUTF8ToUTF16):
3473 (KJS::FunctionImp::callAsFunction):
3475 * kjs/keywords.table:
3477 (KJS::Lexer::shift):
3479 2007-03-18 Geoffrey Garen <ggaren@apple.com>
3481 Reviewed by Oliver Hunt.
3483 Exposed some extra toUInt32 functionality, as part of the fix for
3484 REGRESSION: Incomplete document.all implementation breaks abtelectronics.com
3485 (Style Change Through JavaScript Blanks Content)
3487 * JavaScriptCore.exp:
3489 (KJS::Identifier::toUInt32):
3491 2007-03-18 Geoffrey Garen <ggaren@apple.com>
3493 Removed duplicate export name.
3495 * JavaScriptCore.exp:
3497 2007-03-15 Geoffrey Garen <ggaren@apple.com>
3499 Reviewed by Maciej Stachowiak.
3501 Fixed <rdar://problem/5064964> Repro ASSERT failure in JS Bindings when
3502 closing window @ lowtrades.bptrade.com
3504 Unfortunately, the bindings depend on UString and Identifier as string
3505 representations. So, they need to acquire the JSLock when doing something
3506 that will ref/deref their strings.
3508 Layout tests, the original site, and Java, Flash, and Quicktime on the
3509 web work. No leaks reported. No automated test for this because testing
3510 the Java bindings, like math, is hard.
3512 * bindings/runtime.h: Made Noncopyable, just to be sure.
3514 * bindings/c/c_class.cpp:
3515 (KJS::Bindings::CClass::~CClass): Acquire the JSLock and explicitly clear the keys
3516 in our hashtable, since they're UString::Reps, and ref/deref aren't thread-safe.
3517 (KJS::Bindings::CClass::methodsNamed): Also acquire the JSLock when adding
3518 keys to the table, since the table ref's them.
3519 (KJS::Bindings::CClass::fieldNamed): ditto.
3521 * bindings/c/c_utility.cpp: Removed dead function.
3522 (KJS::Bindings::convertValueToNPVariant): Acquire the JSLock because doing
3523 it recursively is pretty cheap, and it's just too confusing to tell whether
3524 all our callers do it for us.
3525 (KJS::Bindings::convertNPVariantToValue): ditto
3526 * bindings/c/c_utility.h:
3528 * bindings/jni/jni_class.cpp: Same deal as c_class.cpp.
3529 (JavaClass::JavaClass):
3530 (JavaClass::~JavaClass):
3532 * bindings/jni/jni_instance.cpp: Same deal as c_utility.cpp.
3533 (JavaInstance::stringValue):
3534 * bindings/jni/jni_jsobject.cpp:
3535 (JavaJSObject::convertValueToJObject):
3537 * bindings/jni/jni_runtime.cpp:
3538 (JavaMethod::~JavaMethod): Moved from header, for clarity.
3539 (appendClassName): Made this static, so the set of callers is known, and
3540 we can assert that we hold the JSLock. Also changed it to take a UString
3541 reference, which makes the calling code simpler.
3542 (JavaMethod::signature): Store the ASCII value we care about instead of
3543 a UString, since UString is so much more hassle. Hold the JSLock while
3544 building up the temporary UString.
3546 * bindings/jni/jni_runtime.h: Nixed dead code in JavaMethod.
3547 (KJS::Bindings::JavaString::JavaString): Hold a UString::Rep instead of
3548 a UString, so we can acquire the JSLock and explicitly release it.
3549 (KJS::Bindings::JavaString::_commonInit):
3550 (KJS::Bindings::JavaString::~JavaString):
3551 (KJS::Bindings::JavaString::UTF8String):
3552 (KJS::Bindings::JavaString::uchars):
3553 (KJS::Bindings::JavaString::length):
3554 (KJS::Bindings::JavaString::ustring):
3556 * bindings/jni/jni_utility.cpp:
3557 (KJS::Bindings::convertArrayInstanceToJavaArray): Made this static, so
3558 the set of callers is known, and we can assert that we hold the JSLock.
3559 (KJS::Bindings::convertValueToJValue): Acquire the JSLock because doing
3560 it recursively is pretty cheap, and it's just too confusing to tell whether
3561 all our callers do it for us.
3563 * bindings/objc/objc_runtime.h: Nixed some dead code.
3564 * bindings/objc/objc_utility.mm:
3565 (KJS::Bindings::convertNSStringToString): Same drill as above.
3567 2007-03-18 Alexey Proskuryakov <ap@webkit.org>
3571 http://bugs.webkit.org/show_bug.cgi?id=13105
3572 REGRESSION: an exception raised when calculating base value of a dot expression is not returned
3574 Test: fast/js/dot-node-base-exception.html
3577 (FunctionCallDotNode::evaluate): Added the necessary KJS_CHECKEXCEPTIONVALUE.
3579 2007-03-18 Steve Falkenburg <sfalken@apple.com>
3583 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
3585 2007-03-17 Timothy Hatcher <timothy@apple.com>
3587 Reviewed by Mark Rowe.
3589 Made Version.xcconfig smarter when building for different configurations.
3590 Now uses the 522+ OpenSource version for Debug and Release, while using the
3591 full 522.4 version for Production builds. The system prefix is also computed
3592 based on the current system, so 4522.4 on Tiger and 5522.4 on Leopard.
3594 * Configurations/JavaScriptCore.xcconfig:
3595 * Configurations/Version.xcconfig:
3597 2007-03-15 Maciej Stachowiak <mjs@apple.com>
3603 * wtf/TCSystemAlloc.cpp:
3605 2007-03-15 Maciej Stachowiak <mjs@apple.com>
3607 Reviewed by Geoff and Steve.
3609 - fix some portability issues with TCMalloc.
3611 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
3613 * wtf/FastMalloc.cpp:
3615 (WTF::InitSizeClasses):
3616 (WTF::TCMalloc_PageHeap::Split):
3617 (WTF::TCMalloc_PageHeap::RegisterSizeClass):
3618 (WTF::TCMalloc_Central_FreeList::length):
3619 (WTF::TCMalloc_ThreadCache::InitTSD):
3620 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
3622 * wtf/TCSystemAlloc.cpp:
3624 (TCMalloc_SystemAlloc):
3626 2007-03-15 Timothy Hatcher <timothy@apple.com>
3630 * Factored out most of our common build settings into .xcconfig files. Anything that was common in
3631 each build configuration was factored out into the shared .xcconfig file.
3632 * Adds a Version.xcconfig file to define the current framework version, to be used in other places.
3633 * Use the new $(BUNDLE_VERSION) (defined in Version.xcconfig) in the preprocessed Info.plist.
3634 * Use the versions defined in Version.xcconfig to set $(DYLIB_CURRENT_VERSION).
3636 * Configurations/Base.xcconfig: Added.
3637 * Configurations/DebugRelease.xcconfig: Added.
3638 * Configurations/JavaScriptCore.xcconfig: Added.
3639 * Configurations/Version.xcconfig: Added.
3641 * JavaScriptCore.xcodeproj/project.pbxproj:
3643 2007-03-16 Shrikant Gangoda <shrikant.gangoda@celunite.com>
3647 * kjs/DateMath.cpp: gettimeofday comes from <sys/time.h> on Linux.
3649 2007-03-14 Kevin McCullough <kmccullough@apple.com>
3653 - Fixed one more build breakage
3655 * kjs/date_object.cpp:
3656 (KJS::formatLocaleDate):
3658 2007-03-14 Kevin McCullough <kmccullough@apple.com>
3662 - Fixed a build breakage.
3665 * kjs/date_object.cpp:
3666 (KJS::formatLocaleDate):
3667 (KJS::DateObjectImp::construct):
3669 2007-03-14 Kevin McCullough <kmccullough@apple.com>
3673 - rdar://problem/5045720
3674 - DST changes in US affect JavaScript date calculations (12975)
3675 This fix was to ensure we properly test for the new changes to DST in the US.
3676 Also this fixes when we apply DST, now we correctly map most past years to current
3677 DST rules. We still have a small issue with years before 1900 or after 2100.
3678 rdar://problem/5055038
3680 * kjs/DateMath.cpp: Fix DST to match spec better.
3681 (KJS::getCurrentUTCTime):
3682 (KJS::mimimumYearForDST):
3683 (KJS::maximumYearForDST):
3684 (KJS::equivalentYearForDST):
3685 (KJS::getDSTOffset):
3686 * kjs/DateMath.h: Consolodated common funtionality.
3687 * kjs/date_object.cpp: Consolodated common functionality.
3688 (KJS::formatLocaleDate):
3689 (KJS::DateObjectImp::construct):
3690 * tests/mozilla/ecma/jsref.js: Added functions for finding the correct days when DST starts and ends.
3691 * tests/mozilla/ecma/shell.js: Added back in the old DST functions for ease of merging with mozilla if needed.
3692 * tests/mozilla/ecma_2/jsref.js: Added functions for finding the correct days when DST starts and ends.
3693 * tests/mozilla/ecma_3/Date/shell.js: Added functions for finding the correct days when DST starts and ends.
3694 * tests/mozilla/expected.html: Updated to show all date tests passing.
3696 === Safari-5522.4 ===
3698 2007-03-13 Kevin McCullough <kmccullough@apple.com>
3702 - Adding expected failures until the are truly fixed.
3703 - rdar://problem/5060302
3705 * tests/mozilla/expected.html:
3707 2007-03-12 Kevin McCullough <kmccullough@apple.com>
3711 - Actually update tests for new DST rules.
3713 * tests/mozilla/ecma/Date/15.9.3.1-1.js:
3714 * tests/mozilla/ecma/Date/15.9.3.1-2.js:
3715 * tests/mozilla/ecma/Date/15.9.3.1-3.js:
3716 * tests/mozilla/ecma/Date/15.9.3.1-4.js:
3717 * tests/mozilla/ecma/Date/15.9.3.1-5.js:
3718 * tests/mozilla/ecma/Date/15.9.3.2-1.js:
3719 * tests/mozilla/ecma/Date/15.9.3.2-2.js:
3720 * tests/mozilla/ecma/Date/15.9.3.2-3.js:
3721 * tests/mozilla/ecma/Date/15.9.3.2-4.js:
3722 * tests/mozilla/ecma/Date/15.9.3.2-5.js:
3723 * tests/mozilla/ecma/Date/15.9.3.8-1.js:
3724 * tests/mozilla/ecma/Date/15.9.3.8-2.js:
3725 * tests/mozilla/ecma/Date/15.9.3.8-3.js:
3726 * tests/mozilla/ecma/Date/15.9.3.8-4.js:
3727 * tests/mozilla/ecma/Date/15.9.3.8-5.js:
3728 * tests/mozilla/ecma/Date/15.9.5.10-1.js:
3729 * tests/mozilla/ecma/Date/15.9.5.10-10.js:
3730 * tests/mozilla/ecma/Date/15.9.5.10-11.js:
3731 * tests/mozilla/ecma/Date/15.9.5.10-12.js:
3732 * tests/mozilla/ecma/Date/15.9.5.10-13.js:
3733 * tests/mozilla/ecma/Date/15.9.5.10-2.js:
3734 * tests/mozilla/ecma/Date/15.9.5.10-3.js:
3735 * tests/mozilla/ecma/Date/15.9.5.10-4.js:
3736 * tests/mozilla/ecma/Date/15.9.5.10-5.js:
3737 * tests/mozilla/ecma/Date/15.9.5.10-6.js:
3738 * tests/mozilla/ecma/Date/15.9.5.10-7.js:
3739 * tests/mozilla/ecma/Date/15.9.5.10-8.js:
3740 * tests/mozilla/ecma/Date/15.9.5.10-9.js:
3741 * tests/mozilla/ecma/jsref.js:
3742 * tests/mozilla/ecma_2/jsref.js:
3743 * tests/mozilla/ecma_3/Date/shell.js:
3745 2007-03-12 Kevin McCullough <kmccullough@apple.com>
3749 - Update tests for new DST rules.
3751 * tests/mozilla/ecma/shell.js:
3753 2007-03-11 Geoffrey Garen <ggaren@apple.com>
3755 Reviewed by Oliver Hunt.
3757 Fixed <rdar://problem/4681051> Installer crashes in KJS::Collector::
3758 markOtherThreadConservatively(KJS::Collector::Thread*) trying to install
3759 iLife 06 using Rosetta on an Intel Machine
3761 The problem was that our thread-specific data destructor would modify the
3762 list of active JavaScript threads without holding the JSLock, corrupting
3763 the list. Corruption was especially likely if one JavaScript thread exited
3764 while another was starting up.
3766 * JavaScriptCore.exp:
3767 * kjs/JSLock.cpp: Don't conflate locking the JSLock with registering a
3768 thread, since the thread-specific data destructor needs to lock
3769 without registering a thread. Instead, treat thread registration as a
3770 part of the convenience of the JSLock object, and whittle down JSLock::lock()
3771 to just the bits that actually do the locking.
3772 (KJS::JSLock::lock):
3773 (KJS::JSLock::registerThread):
3774 * kjs/JSLock.h: Updated comments to mention the new behavior above, and
3775 other recent changes.
3776 (KJS::JSLock::JSLock):
3777 * kjs/collector.cpp:
3778 (KJS::destroyRegisteredThread): Lock here.
3779 (KJS::Collector::registerThread): To match, assert that we're locked here.
3781 2007-03-10 Geoffrey Garen <ggaren@apple.com>
3783 Reviewed by Darin Adler.
3785 Fixed <rdar://problem/4587763> PAC file: lock inversion between QT and
3786 JSCore causes a hang @ www.panoramas.dk
3788 With a PAC file, run-webkit-tests --threaded passes, the reported site
3789 works, and all the Quicktime/JavaScript and Flash/JavaScript examples
3790 I found through Google work, too.
3792 Any time JavaScript causes arbitrary non-JavaScript code to execute, it
3793 risks deadlock, because that code may block, trying to acquire a lock
3794 owned by a thread that is waiting to execute JavaScript. In this case,
3795 the thread was a networking thread that was waiting to interpret a PAC file.
3797 Because non-JavaScript code may execute in response to, well, anything,
3798 a perfect solution to this problem is impossible. I've implemented an
3799 optimistic solution, instead: JavaScript will drop its lock whenever it
3800 makes a direct call to non-JavaScript code through a bridging/plug-in API,
3801 but will blissfully ignore the indirect ways it may cause non-JavaScript
3802 code to run (resizing a window, for example).
3804 Unfortunately, this solution introduces significant locking overhead in
3805 the bridging APIs. I don't see a way around that.
3807 This patch includes some distinct bug fixes I saw along the way:
3809 * bindings/objc/objc_instance.mm: Fixed a bug where a nested begin() call
3810 would leak its autorelease pool, because it would NULL out _pool without
3813 * bindings/runtime_object.cpp:
3814 (RuntimeObjectImp::methodGetter): Don't copy an Identifier to ASCII only
3815 to turn around and make an Identifier from the ASCII. In an earlier
3816 version of this patch, the copy caused an assertion failure. Now it's
3817 just unnecessary work.
3818 (RuntimeObjectImp::getOwnPropertySlot): ditto
3820 * bindings/objc/objc_instance.h: Removed overrides of setVAlueOfField and
3821 getValueOfField, because they did exactly what the base class versions did.
3822 Removed overrides of Noncopyable declarations for the same reason.
3824 * bindings/runtime.h: Inherit from Noncopyable instead of rolling our own.
3825 * bindings/c/c_instance.h: ditto
3827 And the actual patch:
3829 * API/JSCallbackConstructor.cpp: Drop all locks when calling out to C.
3830 (KJS::JSCallbackConstructor::construct):
3831 * API/JSCallbackFunction.cpp: ditto
3832 (KJS::JSCallbackFunction::callAsFunction):
3833 * API/JSCallbackObject.cpp: ditto
3834 (KJS::JSCallbackObject::init):
3835 (KJS::JSCallbackObject::~JSCallbackObject):
3836 (KJS::JSCallbackObject::getOwnPropertySlot):
3837 (KJS::JSCallbackObject::put):
3838 (KJS::JSCallbackObject::deleteProperty):
3839 (KJS::JSCallbackObject::construct):
3840 (KJS::JSCallbackObject::hasInstance):
3841 (KJS::JSCallbackObject::callAsFunction):
3842 (KJS::JSCallbackObject::getPropertyNames):
3843 (KJS::JSCallbackObject::toNumber):
3844 (KJS::JSCallbackObject::toString):
3845 (KJS::JSCallbackObject::staticValueGetter):
3846 (KJS::JSCallbackObject::callbackGetter):
3848 * bindings/c/c_instance.cpp: Drop all locks when calling out to C.
3849 (KJS::Bindings::CInstance::invokeMethod):
3850 (KJS::Bindings::CInstance::invokeDefaultMethod):
3851 * bindings/c/c_runtime.cpp: Drop all locks when calling out to C.
3852 (KJS::Bindings::CField::valueFromInstance):
3853 (KJS::Bindings::CField::setValueToInstance):
3854 * bindings/jni/jni_objc.mm:
3855 (KJS::Bindings::dispatchJNICall): Drop all locks when calling out to Java.
3857 * bindings/objc/objc_instance.mm: The changes here are to accomodate the
3858 fact that C++ unwinding of DropAllLocks goes crazy when you put it inside
3859 a @try block. I moved all JavaScript stuff outside of the @try blocks, and
3860 then prefixed the whole blocks with DropAllLocks objects. This required some
3861 supporting changes in other functions, which now acquire the JSLock for
3862 themselves, intead of relying on their callers to do so.
3863 (ObjcInstance::end):
3864 (ObjcInstance::invokeMethod):
3865 (ObjcInstance::invokeDefaultMethod):
3866 (ObjcInstance::setValueOfUndefinedField):
3867 (ObjcInstance::getValueOfUndefinedField):
3868 * bindings/objc/objc_runtime.mm: Same as above, except I didn't want to
3869 change throwError to acquire the JSLock for itself.
3870 (ObjcField::valueFromInstance):
3871 (ObjcField::setValueToInstance):
3872 * bindings/objc/objc_utility.mm: Supporting changes mentioned above.
3873 (KJS::Bindings::convertValueToObjcValue):
3874 (KJS::Bindings::convertObjcValueToValue):
3877 (1) Fixed DropAllLocks to behave as advertised, and drop the JSLock only
3878 if the current thread actually acquired it in the first place. This is
3879 important because WebKit needs to ensure that the JSLock has been
3880 dropped before it makes a plug-in call, even though it doesn't know if
3881 the current thread actually acquired the JSLock. (We don't want WebKit
3882 to accidentally drop a lock belonging to *another thread*.)
3883 (2) Used the new per-thread code written for (1) to make recursive calls
3884 to JSLock very cheap. JSLock now knows to call pthread_mutext_lock/
3885 pthread_mutext_unlock only at nesting level 0.
3886 (KJS::createDidLockJSMutex):
3887 (KJS::JSLock::lock):
3888 (KJS::JSLock::unlock):
3889 (KJS::DropAllLocks::DropAllLocks):
3890 (KJS::DropAllLocks::~DropAllLocks):
3891 (KJS::JSLock::lockCount):
3892 * kjs/JSLock.h: Don't duplicate Noncopyable.
3893 (KJS::JSLock::~JSLock):
3895 * wtf/Assertions.h: Blind attempt at helping the Windows build.
3897 2007-03-08 MorganL <morganl.webkit@yahoo.com>
3901 http://bugs.webkit.org/show_bug.cgi?id=13018
3902 Bug 13018: allow embedders to override the definition of CRASH.
3904 * wtf/Assertions.h: make it possible to override CRASH.
3906 2007-03-07 Anrong Hu <huanr@yahoo.com>
3910 Fix http://bugs.webkit.org/show_bug.cgi?id=12535
3911 Bug 12535: Stack-optimizing compilers can trick GC into freeing in-use objects
3914 (KJS::StringImp::toObject): Copy val onto the stack so it is not subject to garbage collection.
3916 2007-03-07 Geoffrey Garen <ggaren@apple.com>
3918 Build fix for non-multiple-thread folks.
3920 Use a shared global in the non-multiple-thread case.
3922 * wtf/FastMalloc.cpp:
3924 (WTF::fastMallocForbid):
3925 (WTF::fastMallocAllow):
3927 2007-03-07 Geoffrey Garen <ggaren@apple.com>
3929 Reviewed by Darin Adler.
3931 Fixed ASSERT failure I just introduced.
3933 Made the fastMalloc isForbidden flag per thread. (Oops!) We expect that
3934 other threads will malloc while we're marking -- we just want to prevent
3935 our own marking from malloc'ing.
3937 * wtf/FastMalloc.cpp:
3938 (WTF::initializeIsForbiddenKey):
3940 (WTF::fastMallocForbid):
3941 (WTF::fastMallocAllow):
3948 2007-03-07 Shrikant Gangoda <shrikant.gangoda@celunite.com>
3952 http://bugs.webkit.org/show_bug.cgi?id=12997
3954 Wrap pthread-specific assertion in #if USE(MULTIPLE_THREADS).
3956 * kjs/collector.cpp:
3957 (KJS::Collector::markMainThreadOnlyObjects):
3959 2007-03-06 Geoffrey Garen <ggaren@apple.com>
3961 Reviewed by Maciej Stachowiak.
3963 Fixed <rdar://problem/4576242> | http://bugs.webkit.org/show_bug.cgi?id=12586
3964 PAC file: malloc deadlock sometimes causes a hang @ www.apple.com/pro/profiles/ (12586)
3966 This is a modified version of r14752 on the branch.
3968 These changes just add debugging functionality. They ASSERT that we don't
3969 malloc during the mark phase of a garbage collection, which can cause a
3972 * kjs/collector.cpp:
3973 (KJS::Collector::collect):
3974 * wtf/FastMalloc.cpp:
3975 (WTF::fastMallocForbid):
3976 (WTF::fastMallocAllow):
3984 2007-03-06 Geoffrey Garen <ggaren@apple.com>
3986 Reviewed by Maciej Stachowiak.
3988 Fixed all known crashers exposed by run-webkit-tests --threaded. This covers:
3990 <rdar://problem/4565394> | http://bugs.webkit.org/show_bug.cgi?id=12585
3991 PAC file: after closing a window that contains macworld.com, new window
3992 crashes (KJS::PropertyMap::mark()) (12585)
3993 <rdar://problem/4571215> | http://bugs.webkit.org/show_bug.cgi?id=9211
3994 PAC file: Crash occurs when clicking on the navigation tabs at http://www.businessweek.com/ (9211)
3995 <rdar://problem/4557926>
3996 PAC file: Crash occurs when attempting to view image in slideshow mode
3997 at http://d.smugmug.com/gallery/581716 ( KJS::IfNode::execute (KJS::
3998 ExecState*) + 312) if you use a PAC file
4000 (1) Added some missing JSLocks, along with related ASSERTs.
4002 (2) Fully implemented support for objects that can only be garbage collected
4003 on the main thread. So far, only WebCore uses this. We can add it to API
4004 later if we learn that it's needed.
4006 The implementation uses a "main thread only" flag inside each object. When
4007 collecting on a secondary thread, the Collector does an extra pass through
4008 the heap to mark all flagged objects before sweeping. This solution makes
4009 the common case -- flag lots of objects, but never collect on a secondary
4010 thread -- very fast, even though the uncommon case of garbage collecting
4011 on a secondary thread isn't as fast as it could be. I left some notes
4012 about how to speed it up, if we ever care.
4014 For posterity, here are some things I learned about GC while investigating:
4016 * Each collect must either mark or delete every heap object. "Zombie"
4017 objects, which are neither marked nor deleted, raise these issues:
4019 * On the next pass, the conservative marking algorithm might mark a
4020 zombie, causing it to mark freed objects.
4022 * The client might try to use a zombie, which would seem live because
4023 its finalizer had not yet run.
4025 * A collect on the main thread is free to delete any object. Presumably,
4026 objects allocated on secondary threads have thread-safe finalizers.
4028 * A collect on a secondary thread must not delete thread-unsafe objects.
4030 * The mark function must be thread-safe.
4032 Line by line comments:
4034 * API/JSObjectRef.h: Added comment specifying that the finalize callback
4035 may run on any thread.
4037 * JavaScriptCore.exp: Nothing to see here.
4039 * bindings/npruntime.cpp:
4040 (_NPN_GetStringIdentifier): Added JSLock.
4042 * bindings/objc/objc_instance.h:
4043 * bindings/objc/objc_instance.mm:
4044 (ObjcInstance::~ObjcInstance): Use an autorelease pool. The other callers
4045 to CFRelease needed one, too, but they were dead code, so I removed them
4046 instead. (This fixes a leak seen while running run-webkit-tests --threaded,
4047 although I don't think it's specifically a threading issue.)
4049 * kjs/collector.cpp:
4050 (KJS::Collector::collectOnMainThreadOnly): New function. Tells the collector
4051 to collect a value only if it's collecting on the main thread.
4052 (KJS::Collector::markMainThreadOnlyObjects): New function. Scans the heap
4053 for "main thread only" objects and marks them.
4055 * kjs/date_object.cpp:
4056 (KJS::DateObjectImp::DateObjectImp): To make the new ASSERTs happy, allocate
4057 our globals on the heap, avoiding a seemingly unsafe destructor call at
4059 * kjs/function_object.cpp:
4060 (FunctionPrototype::FunctionPrototype): ditto
4062 * kjs/interpreter.cpp:
4063 (KJS::Interpreter::mark): Removed boolean parameter, which was an incomplete
4064 and arguably hackish way to implement markMainThreadOnlyObjects() inside WebCore.
4065 * kjs/interpreter.h:
4067 * kjs/identifier.cpp:
4068 (KJS::identifierTable): Added some ASSERTs to check for thread safety
4071 * kjs/list.cpp: Added some ASSERTs to check for thread safety problems.
4072 (KJS::allocateListImp):
4073 (KJS::List::release):
4074 (KJS::List::append):
4075 (KJS::List::empty): Make the new ASSERTs happy.
4078 (KJS::JSObject::JSObject): "m_destructorIsThreadSafe" => "m_collectOnMainThreadOnly".
4079 I removed the constructor parameter because m_collectOnMainThreadOnly,
4080 like m_marked, is a Collector bit, so only the Collector should set or get it.
4082 * kjs/object_object.cpp:
4083 (ObjectPrototype::ObjectPrototype): Make the ASSERTs happy.
4084 * kjs/regexp_object.cpp:
4085 (RegExpPrototype::RegExpPrototype): ditto
4087 * kjs/ustring.cpp: Added some ASSERTs to check for thread safety problems.
4088 (KJS::UCharReference::ref):
4089 (KJS::UString::Rep::createCopying):
4090 (KJS::UString::Rep::create):
4091 (KJS::UString::Rep::destroy):
4092 (KJS::UString::null): Make the new ASSERTs happy.
4094 (KJS::UString::Rep::ref): Added some ASSERTs to check for thread safety problems.
4095 (KJS::UString::Rep::deref):
4098 (KJS::JSCell::JSCell):
4100 2007-03-06 Geoffrey Garen <ggaren@apple.com>
4102 Reviewed by Maciej Stachowiak.
4104 2% speedup on super accurate JS iBench.
4106 (KJS::Collector::collect): Removed anti-optimization to call
4107 pthread_is_threaded_np() before calling pthread_main_np(). Almost all
4108 apps have more than one thread, so the extra call is actually worse.
4109 Interestingly, even the single-threaded testkjs shows a speed gain
4110 from removing the pthread_is_threaded_np() short-circuit. Not sure why.
4112 2007-03-04 Don Gibson <dgibson77@gmail.com>
4114 Reviewed by Nikolas Zimmermann.
4116 - fix http://bugs.webkit.org/show_bug.cgi?id=12950
4117 Assertions.cpp should not #define macros that are already defined
4119 * wtf/Assertions.cpp: Don't #define WINVER and _WIN32_WINNT if they
4120 are already defined.