1 2007-08-07 Darin Adler <darin@apple.com>
5 - fix <rdar://problem/5383104> REGRESSION: XHR.responseText is null instead of empty string
6 in http/tests/xmlhttprequest/zero-length-response.html
8 The new code to handle out of memory conditions was turning a "" into a null string.
10 * kjs/ustring.h: Removed UCharReference, which has long been obsolete and unused.
11 Removed copyForWriting, which was only used for the upper/lowercasing code and for
14 (KJS::allocChars): Removed special case that made this fail (return 0) when passed 0.
15 Instead assert that we're not passed 0. Also added an overflow check for two reasons:
16 1) for sizes that aren't checked this prevents us from allocating a buffer that's too
17 small, and 2) for sizes where we overflowed in the expandedSize function and returned
18 overflowIndicator, it guarantees we fail.
19 (KJS::reallocChars): Ditto.
20 (KJS::UString::expandedSize): Return a large number, overflowIndicator, rather than 0
21 for cases where we overflow.
22 (KJS::UString::spliceSubstringsWithSeparators): Added a special case for empty string so
23 we don't call allocChars with a length of 0.
24 (KJS::UString::operator=): Added special characters for both 0 and empty string so we
25 match the behavior of the constructor. This avoids calling allocChars with a length of 0
26 and making a null string rather than an empty string in that case, and also matches the
27 pattern used in the rest of the functions.
28 (KJS::UString::operator[]): Made the return value const so code that tries to use the
29 operator to modify the string will fail.
31 * kjs/string_object.cpp: (KJS::StringProtoFunc::callAsFunction): Rewrote uppercasing and
32 lowercasing functions so they don't need copyForWriting any more -- it wasn't really doing
33 any good for optimization purposes. Instead use a Vector and releaseBuffer.
35 * wtf/unicode/icu/UnicodeIcu.h: Eliminate one of the versions of toLower/toUpper -- we now
36 only need the version where both a source and destination buffer is passed in, not the one
38 * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
40 2007-08-06 Sam Weinig <sam@webkit.org>
44 Fix for http://bugs.webkit.org/show_bug.cgi?id=14891
45 Decompilation of try block immediately following "else" fails
47 Test: fast/js/toString-try-else.html
49 * kjs/nodes2string.cpp:
50 (TryNode::streamTo): Add newline before "try".
52 2007-08-07 Mark Rowe <mrowe@apple.com>
56 <rdar://problem/5388774> REGRESSION: Hang occurs after clicking "Attach a file " link in a new .Mac message
58 Attempting to acquire the JSLock inside CollectorHeap::forceLock can lead to a deadlock if the thread currently
59 holding the lock is waiting on the thread that is forking. It is not considered safe to use system frameworks
60 after a fork without first execing[*] so it is not particularly important to ensure that the collector and
61 fastMalloc allocators are unlocked in the child process. If the child process wishes to use JavaScriptCore it
62 should exec after forking like it would to use any other system framework.
63 [*]: <http://lists.apple.com/archives/Cocoa-dev/2005/Jan/msg00676.html>
65 * kjs/CollectorHeapIntrospector.cpp: Remove forceLock and forceUnlock implementations.
66 * kjs/CollectorHeapIntrospector.h: Stub out forceLock and forceUnlock methods.
67 * wtf/FastMalloc.cpp: Ditto.
69 2007-08-06 Darin Adler <darin@apple.com>
71 Rubber stamped by Geoff.
73 * kjs/ustring.h: Added an assertion which would have helped us find the
74 previous bug more easily.
76 2007-08-06 Darin Adler <darin@apple.com>
80 - fix <rdar://problem/5387589> 9A514: Quartz Composer crash on launch in KJS::jsString
83 (JSEvaluateScript): Turn NULL for sourceURL into UString::null(), just as JSObjectMakeFunction already does.
84 (JSCheckScriptSyntax): Ditto.
86 2007-08-06 Matt Lilek <pewtermoose@gmail.com>
88 Not reviewed, build fix.
90 * kjs/string_object.cpp:
91 (KJS::StringProtoFunc::callAsFunction):
93 2007-08-04 Darin Adler <darin@apple.com>
97 - fix <rdar://problem/5371862> crash in Dashcode due to Quartz Composer JavaScript garbage collector reentrancy
99 * API/JSBase.cpp: (JSGarbageCollect): Don't call collector() if isBusy() returns true.
101 * kjs/collector.h: Added isBusy(), removed the unused return value from collect()
102 * kjs/collector.cpp: Added an "operation in progress" flag to the allocator.
103 (KJS::Collector::allocate): Call abort() if an operation is already in progress. Set the new flag instead
104 of using the debug-only GCLock.
105 (KJS::Collector::collect): Ditto.
106 (KJS::Collector::isBusy): Added.
108 2007-08-04 Maciej Stachowiak <mjs@apple.com>
110 Reviewed by Darin and Adam.
112 <rdar://problem/5368990> REGRESSION: newsgator.com sign-on 6x slower than Safari 3 beta due to GC changes (14808)
114 * kjs/string_object.cpp:
115 (KJS::replace): if the string didn't change (very common in some cases) reuse the original string value.
116 (KJS::StringProtoFunc::callAsFunction): Pass in the StringImp* when replacing, not just the UString.
117 * kjs/string_object.h:
118 (KJS::StringInstance::internalValue): covariant override to return StringImp for convenience
120 2007-08-04 Mark Rowe <mrowe@apple.com>
122 Reviewed by Oliver Hunt.
124 <rdar://problem/5385145> r24843 introduces a crash on calling fork() (14878)
125 http://bugs.webkit.org/show_bug.cgi?id=14878
127 Provide no-op functions for all members of the malloc_zone_t and malloc_introspection_t structures that we
128 register to avoid crashes in system code that assumes they will be non-null.
130 * kjs/CollectorHeapIntrospector.cpp:
131 (KJS::CollectorHeapIntrospector::CollectorHeapIntrospector):
132 (KJS::CollectorHeapIntrospector::forceLock): Grab the lock.
133 (KJS::CollectorHeapIntrospector::forceUnlock): Release the lock.
134 * kjs/CollectorHeapIntrospector.h:
135 (KJS::CollectorHeapIntrospector::goodSize):
136 (KJS::CollectorHeapIntrospector::check):
137 (KJS::CollectorHeapIntrospector::print):
138 (KJS::CollectorHeapIntrospector::log):
139 (KJS::CollectorHeapIntrospector::statistics):
140 (KJS::CollectorHeapIntrospector::size):
141 (KJS::CollectorHeapIntrospector::zoneMalloc):
142 (KJS::CollectorHeapIntrospector::zoneCalloc):
143 (KJS::CollectorHeapIntrospector::zoneFree):
144 * wtf/FastMalloc.cpp:
145 (WTF::FastMallocZone::goodSize):
146 (WTF::FastMallocZone::check):
147 (WTF::FastMallocZone::print):
148 (WTF::FastMallocZone::log):
149 (WTF::FastMallocZone::forceLock): Grab the TCMalloc locks.
150 (WTF::FastMallocZone::forceUnlock): Release the TCMalloc locks.
151 (WTF::FastMallocZone::FastMallocZone):
153 2007-08-04 Mark Rowe <mrowe@apple.com>
155 Rubber-stamped by Anders.
157 * pcre/pcre_compile.c: Remove non-ASCII character from a comment.
159 2007-08-02 Mark Rowe <mrowe@apple.com>
161 Reviewed by Geoff Garen.
163 <rdar://problem/4212199> 'leaks' reports false leaks in WebKit (because the WTF allocator uses mmap?)
165 Implement malloc zone introspection routines to allow leaks, heap, and friends to request information
166 about specific memory regions that were allocated by FastMalloc or the JavaScriptCore collector.
168 This requires tool-side support before the regions will be displayed. The addition of that support is
169 tracked by <rdar://problems/5353057&5353060>.
171 * JavaScriptCore.exp: Export the two variables that are used by leaks to introspect the allocators.
172 * JavaScriptCore.xcodeproj/project.pbxproj:
173 * kjs/AllInOneFile.cpp:
174 * kjs/CollectorHeapIntrospector.cpp: Added.
176 (KJS::CollectorHeapIntrospector::init):
177 (KJS::CollectorHeapIntrospector::CollectorHeapIntrospector): Create and register our zone with the system.
178 (KJS::CollectorHeapIntrospector::enumerate): Iterate over the CollectorBlocks that are in use and report them to the caller as being used.
179 * kjs/CollectorHeapIntrospector.h: Added.
180 (KJS::CollectorHeapIntrospector::size): Return zero to indicate the specified pointer does not belong to this zone.
182 (KJS::Collector::registerThread): Register the CollectorHeapIntrospector with the system when the first thread is registered with the collector.
183 * wtf/FastMalloc.cpp:
184 (WTF::TCMalloc_PageHeap::GetDescriptorEnsureSafe):
185 (WTF::TCMalloc_ThreadCache_FreeList::enumerateFreeObjects): Enumerate the objects on the free list.
186 (WTF::TCMalloc_ThreadCache::enumerateFreeObjects): Ditto.
187 (WTF::TCMalloc_Central_FreeList::enumerateFreeObjects): Ditto.
188 (WTF::TCMalloc_ThreadCache::InitModule): Register the FastMallocZone with the system when initializing TCMalloc.
189 (WTF::FreeObjectFinder::FreeObjectFinder):
190 (WTF::FreeObjectFinder::visit): Add an object to the free list.
191 (WTF::FreeObjectFinder::isFreeObject):
192 (WTF::FreeObjectFinder::freeObjectCount):
193 (WTF::FreeObjectFinder::findFreeObjects): Find the free objects within a thread cache or free list.
194 (WTF::PageMapFreeObjectFinder::PageMapFreeObjectFinder): Find the free objects within a TC_PageMap.
195 (WTF::PageMapFreeObjectFinder::visit): Called once per allocated span. Record whether the span or any subobjects are free.
196 (WTF::PageMapMemoryUsageRecorder::PageMapMemoryUsageRecorder):
197 (WTF::PageMapMemoryUsageRecorder::visit): Called once per allocated span. Report the range of memory as being allocated, and the span or
198 its subobjects as being used if they do not appear on the free list.
199 (WTF::FastMallocZone::enumerate): Map the key remote TCMalloc data structures into our address space. We then locate all free memory ranges
200 before reporting the other ranges as being in use.
201 (WTF::FastMallocZone::size): Determine whether the given pointer originates from within our allocation zone. If so,
202 we return its allocation size.
203 (WTF::FastMallocZone::zoneMalloc):
204 (WTF::FastMallocZone::zoneCalloc):
205 (WTF::FastMallocZone::zoneFree):
206 (WTF::FastMallocZone::zoneRealloc):
208 (WTF::FastMallocZone::FastMallocZone): Create and register our zone with the system.
209 (WTF::FastMallocZone::init):
210 * wtf/MallocZoneSupport.h: Added.
211 (WTF::RemoteMemoryReader::RemoteMemoryReader): A helper class to ease the process of mapping memory in a different process into
212 our local address space
213 (WTF::RemoteMemoryReader::operator()):
215 (TCMalloc_PageMap2::visit): Walk over the heap and visit each allocated span.
216 (TCMalloc_PageMap3::visit): Ditto.
218 2007-08-02 Mark Rowe <mrowe@apple.com>
223 (KJS::UString::expandedSize): Use std::numeric_limits<size_t>::max() rather than the non-portable SIZE_T_MAX.
225 2007-08-02 Mark Rowe <mrowe@apple.com>
229 <rdar://problem/5352887> "Out of memory" error during repeated JS string concatenation leaks hundreds of MBs of RAM
231 A call to fastRealloc was failing which lead to UString::expandCapacity leaking the buffer it was trying to reallocate.
232 It also resulted in the underlying UString::rep having both a null baseString and buf field, which meant that attempting
233 to access the contents of the string after the failed memory reallocation would crash.
235 A third issue is that expandedSize size was calculating the new length in a way that led to an integer overflow occurring.
236 Attempting to allocate a string more than 190,000,000 characters long would fail a the integer overflow would lead to a
237 memory allocation of around 3.6GB being attempted rather than the expected 390MB. Sizes that would lead to an overflow
238 are now returned as zero and callers are updated to treat this as though the memory allocation has failed.
240 * kjs/array_object.cpp:
241 (ArrayProtoFunc::callAsFunction): Check whether the append failed and raise an "Out of memory" exception if it did.
243 (KJS::allocChars): Wrapper around fastMalloc that takes a length in characters. It will return 0 when asked to allocate a zero-length buffer.
244 (KJS::reallocChars): Wrapper around fastRealloc that takes a length in characters. It will return 0 when asked to allocate a zero-length buffer.
245 (KJS::UString::expandedSize): Split the size calculation in two and guard against overflow during each step.
246 (KJS::UString::expandCapacity): Don't leak r->buf if reallocation fails. Instead free the memory and use the null representation.
247 (KJS::UString::expandPreCapacity): If fastMalloc fails then use the null representation rather than crashing in memcpy.
248 (KJS::UString::UString): If calls to expandCapacity, expandPreCapacity or fastMalloc fail then use the null representation rather than crashing in memcpy.
249 (KJS::UString::append): Ditto.
250 (KJS::UString::operator=): Ditto.
251 * kjs/ustring.h: Change return type of expandedSize from int to size_t.
253 2007-08-01 Darin Adler <darin@apple.com>
255 Reviewed by Kevin McCullough.
257 - fix <rdar://problem/5375186> pointers to pieces of class definition passed to JSClassCreate should all be const
259 * API/JSObjectRef.h: Added const.
261 * API/JSClassRef.cpp:
262 (OpaqueJSClass::OpaqueJSClass): Added const.
263 (OpaqueJSClass::create): Added const.
264 * API/JSObjectRef.cpp:
265 (JSClassCreate): Added const.
267 2007-08-01 Steve Falkenburg <sfalken@apple.com>
269 Build mod: Fix sln to match configs in vcproj.
273 * JavaScriptCore.vcproj/JavaScriptCore.make:
274 * JavaScriptCore.vcproj/JavaScriptCore.sln:
276 2007-07-30 Simon Hausmann <hausmann@kde.org>
278 Done with and reviewed by Lars.
280 Removed the __BUILDING_QT ifdef in JSStringRef.h and changed UChar for the Qt build to use wchar_t on Windows.
283 * wtf/unicode/qt4/UnicodeQt4.h:
285 2007-07-27 Simon Hausmann <hausmann@kde.org>
287 Done with and reviewed by Lars and Zack.
289 Always define JSChar to be unsigned short for the Qt builds, to ensure compatibility with UChar.
293 2007-07-27 Simon Hausmann <hausmann@kde.org>
295 Done with and reviewed by Lars and Zack.
297 Fix compilation with Qt on Windows with MingW: Implemented currentThreadStackBase() for this platform.
300 (KJS::currentThreadStackBase):
302 2007-07-27 Simon Hausmann <hausmann@kde.org>
304 Done with and reviewed by Lars and Zack.
306 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.
309 (KJS::getDSTOffsetSimple):
311 2007-07-27 Simon Hausmann <hausmann@kde.org>
313 Done with and reviewed by Lars and Zack.
315 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.
317 * JavaScriptCore.pri:
319 2007-07-27 Simon Hausmann <hausmann@kde.org>
321 Done with and reviewed by Lars and Zack.
323 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.
325 * kjs/interpreter.cpp:
326 (KJS::getCurrentTime):
331 2007-07-27 Simon Hausmann <hausmann@kde.org>
333 Done with and reviewed by Lars and Zack.
335 Replace the use of snprintf with QByteArray to compile under msvc 2005 express.
337 * bindings/qt/qt_instance.cpp:
338 (KJS::Bindings::QtInstance::stringValue):
340 2007-07-27 Simon Hausmann <hausmann@kde.org>
342 Done with and reviewed by Lars and Zack.
344 Don't use pthread.h unless thread support is enabled.
347 (KJS::Collector::registerAsMainThread):
350 2007-07-27 Simon Hausmann <hausmann@kde.org>
352 Done with and reviewed by Lars and Zack.
354 Removed TCSystemMalloc from the Qt build, it's not necessary it seems.
356 * JavaScriptCore.pri:
358 2007-07-27 Simon Hausmann <hausmann@kde.org>
360 Done with and reviewed by Lars and Zack.
362 Added os-win32 to the include search path for the Qt windows build in order to provide the fake stdint.h header file.
364 * JavaScriptCore.pri:
366 2007-07-25 Maciej Stachowiak <mjs@apple.com>
370 - follow-up to previous change
373 (KJS::UString::operator=): Make sure to reset the length when
374 replacing the buffer contents for a single-owned string.
376 2007-07-25 Maciej Stachowiak <mjs@apple.com>
380 - JavaScriptCore part of fix for <rdar://problem/5300291> Optimize GC to reclaim big, temporary objects (like XMLHttpRequest.responseXML) quickly
382 Also, as a side effect of optimizations included in this patch:
383 - 7% speedup on JavaScript iBench
384 - 4% speedup on "Celtic Kane" JS benchmark
386 The basic idea is explained in a big comment in collector.cpp. When unusually
387 large objecs are allocated, we push the next GC closer on the assumption that
388 most objects are short-lived.
390 I also did the following two optimizations in the course of tuning
391 this not to be a performance regression:
393 1) Change UString::Rep to hold a self-pointer as the baseString in
394 the unshared case, instead of a null pointer; this removes a
395 number of null checks in hot code because many places already
396 wanted to use the rep itself or the baseString as appropriate.
398 2) Avoid creating duplicate StringImpls when creating a
399 StringInstance (the object wrapper for a JS string) or calling
400 their methods. Since a temporary wrapper object is made every time
401 a string method is called, this resulted in two useless extra
402 StringImpls being allocated for no reason whenever a String method
403 was invoked on a string value. Now we bypass those.
407 (KJS::Collector::recordExtraCost): Basics of the extra cost mechanism.
408 (KJS::Collector::allocate): ditto
409 (KJS::Collector::collect): ditto
411 (KJS::Collector::reportExtraMemoryCost): ditto
412 * kjs/array_object.cpp:
413 (ArrayInstance::ArrayInstance): record extra cost
415 (KJS::StringImp::toObject): don't create a whole new StringImpl just
416 to be the internal value of a StringInstance! StringImpls are immutable
417 so there's no point tot his.
419 (KJS::StringImp::StringImp): report extra cost
420 * kjs/string_object.cpp:
421 (KJS::StringInstance::StringInstance): new version that takes a StringImp
422 (KJS::StringProtoFunc::callAsFunction): don't create a whole new StringImpl
423 just to convert self to string! we already have one in the internal value
424 * kjs/string_object.h: report extra cost
425 * kjs/ustring.cpp: All changes to handle baseString being self instead of null in the
428 (KJS::UString::Rep::create):
429 (KJS::UString::Rep::destroy):
430 (KJS::UString::usedCapacity):
431 (KJS::UString::usedPreCapacity):
432 (KJS::UString::expandCapacity):
433 (KJS::UString::expandPreCapacity):
434 (KJS::UString::UString):
435 (KJS::UString::append):
436 (KJS::UString::operator=):
437 (KJS::UString::copyForWriting):
439 (KJS::UString::Rep::baseIsSelf): new method, now that baseString is
440 self instead of null in the unshared case we can't just null check.
441 (KJS::UString::Rep::data): adjusted as mentioned above
442 (KJS::UString::cost): new method to compute the cost for a UString, for
446 (KJS::jsString): style fixups.
447 (KJS::jsOwnedString): new method, use this for strings allocated from UStrings
448 held by the parse tree. Tracking their cost as part of string cost is pointless,
449 because garbage collecting them will not actually free the relevant string buffer.
450 * kjs/value.h: prototyped jsOwnedString.
452 (StringNode::evaluate): use jsOwnedString as appropriate
453 (RegExpNode::evaluate): ditto
454 (PropertyNameNode::evaluate): ditto
455 (ForInNode::execute): ditto
457 * JavaScriptCore.exp: Exported some new symbols.
459 2007-07-23 Anders Carlsson <andersca@apple.com>
463 <rdar://problem/5121461> REGRESSION: Unable to load JigZone puzzle
465 * bindings/jni/jni_jsobject.cpp:
466 (JavaJSObject::createNative):
468 Call RootObject::gcProtect on the global object, thereby putting it in the
469 "protect count" set which is used for checking if a native handle is valid.
471 2007-07-23 Darin Adler <darin@apple.com>
473 * pcre/pcre_compile.c: Roll back a tiny accidental change in the unused !JAVASCRIPT
474 side of an #ifdef. This has no effect when using PCRE in JAVASCRIPT mode as we do,
475 but seems worth rolling back.
477 2007-07-23 Maciej Stachowiak <mjs@apple.com>
481 - fix remaining problems with Window shadowing
484 (VarDeclNode::evaluate): Tweak the special case a little.
486 2007-07-23 Maciej Stachowiak <mjs@apple.com>
490 - fix Window shadowing regressions caused by the previous commit.
493 (VarDeclNode::evaluate): Handle the case of global scope specially.
495 2007-07-22 Maciej Stachowiak <mjs@apple.com>
499 -fixed <rdar://problem/5353293> REGRESSION (r24287): 1% i-Bench JS slowdown from JavaScript compatibility fix (14719)
500 http://bugs.webkit.org/show_bug.cgi?id=14719
502 My fix for this actually resulted in JS iBench being 1% faster than before the regression
503 and the Celtic Kane benchmark being 5% faster than before the regression.
506 (VarDeclNode::handleSlowCase): factored out the slow code path to be out of line.
507 (VarDeclNode::evaluate): I did a couple of things:
508 (1) Don't check if the variable is already declared by looking for the property in
509 the variable object, that code path was dead code.
510 (2) Special-case the common case where the top of the scope and the variable object
511 are the same; in that case the variable must always be in the variable object.
512 (3) Don't return a jsString() of the variable name, nothing uses the return value
513 from this node types evaluate method.
516 2007-07-22 Darin Adler <darin@apple.com>
518 Reviewed by Kevin Decker.
520 - fix <rdar://problem/5126394> REGRESSION: Crash after clicking back button in test application (13250)
521 http://bugs.webkit.org/show_bug.cgi?id=13250
523 * bindings/objc/objc_utility.mm: (KJS::Bindings::convertObjcValueToValue):
524 If the object returns 0 for _imp, convert that to "undefined", since callers
525 can't cope with a JSValue of 0.
527 2007-07-19 Geoffrey Garen <ggaren@apple.com>
529 Reviewed by Darin Adler.
531 Fixed http://bugs.webkit.org/show_bug.cgi?id=10880 | <rdar://problem/5335694>
532 REGRESSION: JavaScript menu doesn't appear on pricepoint.com (14595)
534 Though the ECMA spec says auto-semicolon insertion should not occur
535 without a newline or '}', Firefox treats do-while specially, and the
536 library used by pricepoint.com requires that special treatment.
538 * JavaScriptCore.xcodeproj/project.pbxproj:
541 2007-07-19 Darin Adler <darin@apple.com>
545 - fix <rdar://problem/5345440> PCRE computes wrong length for expressions with quantifiers
546 on named recursion or subexpressions
548 It's challenging to implement proper preflighting for compiling these advanced features.
549 But we don't want them in the JavaScript engine anyway.
551 Turned off the following features of PCRE (some of these are simply parsed and not implemented):
553 \C \E \G \L \N \P \Q \U \X \Z
556 (?#) (?<=) (?<!) (?>)
565 Because of \v, the js1_2/regexp/special_characters.js test now passes.
567 To be conservative, I left some features that JavaScript doesn't want, such as
568 \012 and \x{2013}, in place. We can revisit these later; they're not directly-enough
569 related to avoiding the incorrect preflighting.
571 I also didn't try to remove unused opcodes and remove code from the execution engine.
572 That could save code size and speed things up a bit, but it would require more changes.
575 * kjs/regexp.cpp: (KJS::RegExp::RegExp): Remove the sanitizePattern workaround for
576 lack of \u support, since the PCRE code now has \u support.
578 * pcre/pcre-config.h: Set JAVASCRIPT to 1.
579 * pcre/pcre_internal.h: Added ESC_v.
581 * pcre/pcre_compile.c: Added a different escape table for when JAVASCRIPT is set that
582 omits all the escapes we don't want interpreted and includes '\v'.
583 (check_escape): Put !JAVASCRIPT around the code for '\l', '\L', '\N', '\u', and '\U',
584 and added code to handle '\u2013' inside JAVASCRIPT.
585 (compile_branch): Put !JAVASCRIPT if around all the code implementing the features we
587 (pcre_compile2): Ditto.
589 * tests/mozilla/expected.html: Updated since js1_2/regexp/special_characters.js now
592 2007-07-18 Darin Adler <darin@apple.com>
594 Reviewed by Oliver Hunt.
596 - fix <rdar://problem/5345432> PCRE computes length wrong for expressions such as "[**]"
598 Test: fast/js/regexp-charclass-crash.html
600 * pcre/pcre_compile.c: (pcre_compile2): Fix the preflight code that calls
601 check_posix_syntax to match the actual regular expression compilation code;
602 before it was missing the check of the first character.
604 2007-07-19 Holger Hans Peter Freyther <zecke@selfish.org>
608 Define __BUILDING_GDK when building for Gdk to fix building testkjs on OSX.
610 * JavaScriptCore.pri:
612 2007-07-18 Simon Hausmann <hausmann@kde.org>
614 * Fix the Qt build, call dftables from the right directory.
616 Reviewed by Adam Treat.
620 2007-07-18 Simon Hausmann <hausmann@kde.org>
624 Don't call gcc directly when building the dftables tool but use a separate .pro file for the Qt build.
626 * pcre/dftables.pro: Added.
629 2007-07-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
631 Reviewed by Darin, Maciej, and Adam.
633 Fixes <http://bugs.webkit.org/show_bug.cgi?id=9697>,
634 the failure of ecma/GlobalObject/15.1.2.2-2.js,
635 the failure of ecma/LexicalConventions/7.7.3-1.js,
636 and most of the failures of tests in ecma/TypeConversion/9.3.1-3.js.
638 Bug 9697: parseInt results may be inaccurate for numbers greater than 2^53
640 This patch also fixes similar issues in the lexer and UString::toDouble().
643 (KJS::parseIntOverflow):
649 (KJS::UString::toDouble):
650 * tests/mozilla/expected.html:
652 2007-07-16 Sam Weinig <sam@webkit.org>
656 Turn off -Wshorten-64-to-32 warning for 64-bit builds.
658 * Configurations/Base.xcconfig:
660 2007-07-14 Brady Eidson <beidson@apple.com>
662 Reviewed by Sam Weinig
664 Initial check-in for <rdar://problem/3154486> - Supporting FTP directory listings in the browser
666 * wtf/Platform.h: Add ENABLE_FTPDIR feature to handle building on platforms that don't have the
667 proper network-layer support
669 2007-07-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
673 Fixes http://bugs.webkit.org/show_bug.cgi?id=13517,
674 http://bugs.webkit.org/show_bug.cgi?id=14237, and
675 the failure of test js1_5/Scope/regress-185485.js
677 Bug 13517: DOM Exception 8 in finance.aol.com sub-page
678 Bug 14237: Javascript "var" statement interprets initialization in the topmost function scope
681 (VarDeclNode::evaluate):
682 * tests/mozilla/expected.html:
684 2007-07-12 Alexey Proskuryakov <ap@webkit.org>
688 http://bugs.webkit.org/show_bug.cgi?id=14596
689 Fix JSC compilation with KJS_VERBOSE.
692 (KJS::FunctionImp::passInParameters):
694 2007-07-11 George Staikos <staikos@kde.org>
698 * ForwardingHeaders: Added.
699 * ForwardingHeaders/JavaScriptCore: Added.
700 * ForwardingHeaders/JavaScriptCore/APICast.h: Added.
701 * ForwardingHeaders/JavaScriptCore/JSBase.h: Added.
702 * ForwardingHeaders/JavaScriptCore/JSContextRef.h: Added.
703 * ForwardingHeaders/JavaScriptCore/JSLock.h: Added.
704 * ForwardingHeaders/JavaScriptCore/JSObjectRef.h: Added.
705 * ForwardingHeaders/JavaScriptCore/JSStringRef.h: Added.
706 * ForwardingHeaders/JavaScriptCore/JSStringRefCF.h: Added.
707 * ForwardingHeaders/JavaScriptCore/JSValueRef.h: Added.
708 * ForwardingHeaders/JavaScriptCore/JavaScriptCore.h: Added.
710 2007-07-11 Holger Hans Peter Freyther <zecke@selfish.org>
714 As of http://bugs.webkit.org/show_bug.cgi?id=14527 move the
715 WebCore/ForwardingHeader/JavaScriptCore to JavaScriptCore
717 * ForwardingHeaders: Added.
718 * ForwardingHeaders/JavaScriptCore: Copied from WebCore/ForwardingHeaders/JavaScriptCore.
720 2007-07-11 Nikolas Zimmermann <zimmermann@kde.org>
724 Forwardport the hash table fix from CodeGeneratorJS.pm to create_hash_table.
725 Reran run-jsc-tests, couldn't find any regressions. Suggested by Darin.
727 * kjs/create_hash_table:
729 2007-07-09 Maciej Stachowiak <mjs@apple.com>
733 - 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
735 * JavaScriptCore.exp: Added needed export.
737 2007-07-06 Maciej Stachowiak <mjs@apple.com>
741 - <rdar://problem/5311093> JavaScriptCore fails to build with strict-aliasing warnings
743 * Configurations/Base.xcconfig: Re-enable -Wstrict-aliasing
744 * bindings/jni/jni_utility.cpp:
745 (KJS::Bindings::getJNIEnv): Type-pun via a union instead of a pointer cast.
747 (WTF::): Instead of doing type-punned assignments via pointer cast, do one of three things:
748 (1) assign directly w/o cast if storage type matches real type; (2) assign using cast
749 via union if type does not need reffing; (3) copy with memcpy and ref/deref manually if type
750 needs reffing. This is ok peref-wise because memcpy of a constant length gets optomized.
751 HashTraits are now expected to make ref()/deref() take the storage type, not the true type.
753 (WTF::): Same basic idea.
755 (WTF::): Added Assigner template for use by HashMap/HashSet. Change RefCounter to call ref()
756 and deref() via storage type, avoiding the need to
758 (WTF::RefCounter::ref): ditto
759 (WTF::RefCounter::deref): ditto
761 (WTF::): Change ref() and deref() for RefPtr HashTraits to take the storage type; cast
762 via union to pointer type.
763 * wtf/FastMalloc.cpp:
764 (WTF::TCMalloc_PageHeap::init): Changed from constructor to init function so this can go in a union.
765 (WTF::): redefine pageheap macro in terms of getPageHeap().
766 (WTF::getPageHeap): new inline function, helper for pageheap macro. This hides the cast in a union.
767 (WTF::TCMalloc_ThreadCache::InitModule): Call init() instead of using placement new to initialize page
770 (TCMalloc_PageMap1::init): Changed from constructor to init function.
771 (TCMalloc_PageMap2::init): ditto
772 (TCMalloc_PageMap3::init): ditto
775 2007-07-06 George Staikos <staikos@kde.org>
779 Switch USE(ICONDATABASE) to ENABLE(ICONDATABASE)
783 2007-07-03 Sam Weinig <sam@webkit.org>
787 Eleventh round of fixes for implicit 64-32 bit conversion errors.
788 <rdar://problem/5292262>
790 - Fixes a real bug where where we were setting long long and unsigned long long
791 values to a long field.
793 * bindings/objc/objc_utility.mm:
794 (KJS::Bindings::convertValueToObjcValue):
796 2007-07-03 Sam Weinig <sam@webkit.org>
798 Reviewed by Brady Eidson.
800 Tenth round of fixes for implicit 64-32 bit conversion errors.
801 <rdar://problem/5292262>
803 - Add explicit casts.
808 2007-07-02 Sam Weinig <sam@webkit.org>
810 Reviewed by Kevin McCullough.
812 Fourth round of fixes for implicit 64-32 bit conversion errors.
813 <rdar://problem/5292262>
815 Add custom piDouble and piFloat constants to use instead of M_PI.
817 * kjs/math_object.cpp:
818 (MathObjectImp::getValueProperty):
822 2007-06-29 Sam Weinig <sam@webkit.org>
826 Second pass at fixing implicit 64-32 bit conversion errors.
827 <rdar://problem/5292262>
829 - Add a toFloat() method to JSValue for float conversion.
831 * JavaScriptCore.exp:
833 (KJS::JSValue::toFloat):
836 2007-06-27 Kevin McCullough <kmccullough@apple.com>
840 - <rdar://problem/5271937> REGRESSION: Apparent WebKit JavaScript memory smasher when submitting comment to iWeb site (crashes in kjs_pcre_compile2)
841 - Correctly evaluate the return value of _pcre_ucp_findchar.
843 * pcre/pcre_compile.c:
848 2007-06-27 Sam Weinig <sam@webkit.org>
852 First pass at fixing implicit 64-32 bit conversion errors.
853 <rdar://problem/5292262>
855 - Add 'f' suffix where necessary.
858 (StopWatch::getElapsedMS):
860 2007-06-26 Geoffrey Garen <ggaren@apple.com>
862 Reviewed by Maciej Stachowiak.
864 Fixed <rdar://problem/5296627> JSGarbageCollect headerdoc suggests that
865 using JavaScriptCore requires leaking memory
867 * API/JSBase.h: Changed documentation to explain that you can pass NULL
870 2007-06-26 Adam Treat <adam@staikos.net>
872 Reviewed by Adam Roben.
874 Make the SQLite icon database optional.
878 2007-06-15 George Staikos <staikos@kde.org>
880 More missing files for Qt.
882 * JavaScriptCore.pri:
885 2007-06-15 George Staikos <staikos@kde.org>
887 Another Qt build fix.
889 * JavaScriptCore.pri:
892 2007-06-15 George Staikos <staikos@kde.org>
896 * JavaScriptCore.pri:
898 2007-06-20 Mark Rowe <mrowe@apple.com>
902 Fix http://bugs.webkit.org/show_bug.cgi?id=14244
903 Bug 14244: Data corruption when using a replace() callback function with data containing "$"
905 * kjs/string_object.cpp:
906 (KJS::replace): When 'replacement' is a function, do not replace $n placeholders in its return value.
907 This matches the behaviour described in ECMA 262 3rd Ed section 15.5.4.1, and as implemented in Firefox.
909 2007-06-14 Anders Carlsson <andersca@apple.com>
913 * bindings/runtime_object.cpp:
914 (RuntimeObjectImp::canPut):
916 2007-06-14 Anders Carlsson <andersca@apple.com>
920 <rdar://problem/5103077>
921 Crash at _NPN_ReleaseObject when quitting page at http://eshop.macsales.com/shop/ModBook
923 <rdar://problem/5183692>
924 http://bugs.webkit.org/show_bug.cgi?id=13547
925 REGRESSION: Crash in _NPN_ReleaseObject when closing Safari on nba.com (13547)
927 <rdar://problem/5261499>
928 CrashTracer: [USER] 75 crashes in Safari at com.apple.JavaScriptCore: KJS::Bindings::CInstance::~CInstance + 40
930 Have the root object track all live instances of RuntimeObjectImp. When invalidating
931 the root object, also invalidate all live runtime objects by zeroing out their instance ivar.
932 This prevents instances from outliving their plug-ins which lead to crashes.
934 * bindings/c/c_utility.cpp:
935 (KJS::Bindings::convertValueToNPVariant):
936 * bindings/jni/jni_jsobject.cpp:
937 (JavaJSObject::convertValueToJObject):
938 * bindings/jni/jni_utility.cpp:
939 (KJS::Bindings::convertValueToJValue):
940 * bindings/objc/objc_runtime.mm:
941 (ObjcFallbackObjectImp::callAsFunction):
942 * bindings/runtime_array.cpp:
943 (RuntimeArray::RuntimeArray):
944 * bindings/runtime_array.h:
945 (KJS::RuntimeArray::getConcreteArray):
946 * bindings/runtime_method.cpp:
947 (RuntimeMethod::callAsFunction):
948 * bindings/runtime_method.h:
949 * bindings/runtime_object.cpp:
950 (RuntimeObjectImp::RuntimeObjectImp):
951 (RuntimeObjectImp::~RuntimeObjectImp):
952 (RuntimeObjectImp::invalidate):
953 (RuntimeObjectImp::fallbackObjectGetter):
954 (RuntimeObjectImp::fieldGetter):
955 (RuntimeObjectImp::methodGetter):
956 (RuntimeObjectImp::getOwnPropertySlot):
957 (RuntimeObjectImp::put):
958 (RuntimeObjectImp::canPut):
959 (RuntimeObjectImp::defaultValue):
960 (RuntimeObjectImp::implementsCall):
961 (RuntimeObjectImp::callAsFunction):
962 (RuntimeObjectImp::getPropertyNames):
963 (RuntimeObjectImp::throwInvalidAccessError):
964 * bindings/runtime_object.h:
965 * bindings/runtime_root.cpp:
966 (KJS::Bindings::RootObject::invalidate):
967 (KJS::Bindings::RootObject::addRuntimeObject):
968 (KJS::Bindings::RootObject::removeRuntimeObject):
969 * bindings/runtime_root.h:
971 2007-06-14 Anders Carlsson <andersca@apple.com>
975 <rdar://problem/5244948>
976 Safari keeps on complaining about slow script playing NBC TV video (14133)
978 http://bugs.webkit.org/show_bug.cgi?id=14133
979 Runaway JavaScript timer fires when spinning around in Google Maps street view
981 Make sure to start and stop the timeout checker around calls to JS.
983 * bindings/NP_jsobject.cpp:
984 (_NPN_InvokeDefault):
987 * bindings/jni/jni_jsobject.cpp:
988 (JavaJSObject::call):
989 (JavaJSObject::eval):
991 2007-06-13 Darin Adler <darin@apple.com>
993 Reviewed by Mark Rowe.
995 - fix http://bugs.webkit.org/show_bug.cgi?id=14132
996 array sort with > 10000 elements sets elements > 10000 undefined
998 Test: fast/js/sort-large-array.html
1000 * kjs/array_instance.h: Replaced pushUndefinedObjectsToEnd with
1001 compactForSorting, and removed ExecState parameters.
1003 * kjs/array_object.cpp:
1004 (ArrayInstance::sort): Changed to call compactForSorting.
1005 (ArrayInstance::compactForSorting): Do the get and delete of the
1006 properties directly on the property map instead of using public
1007 calls from JSObject. The public calls would just read the undefined
1008 values from the compacted sort results array!
1010 2007-06-13 George Staikos <staikos@kde.org>
1014 Fix Mac OS X build after last checkin.
1018 2007-06-14 Lars Knoll <lars@trolltech.com>
1022 Disable FastMalloc for the Qt build and make sure we
1023 don't reimplement the global new/delete operators
1024 when using the system malloc.
1026 * wtf/FastMalloc.cpp:
1030 2007-06-13 Anders Carlsson <andersca@apple.com>
1034 Make sure that bindings instances get correct root objects.
1036 * JavaScriptCore.exp:
1037 * bindings/NP_jsobject.cpp:
1038 (listFromVariantArgs):
1039 (_NPN_InvokeDefault):
1042 * bindings/c/c_instance.cpp:
1043 (KJS::Bindings::CInstance::invokeMethod):
1044 (KJS::Bindings::CInstance::invokeDefaultMethod):
1045 * bindings/c/c_runtime.cpp:
1046 (KJS::Bindings::CField::valueFromInstance):
1047 * bindings/c/c_utility.cpp:
1048 (KJS::Bindings::convertNPVariantToValue):
1049 * bindings/c/c_utility.h:
1050 * bindings/objc/objc_instance.mm:
1051 (ObjcInstance::invokeMethod):
1052 (ObjcInstance::invokeDefaultMethod):
1053 (ObjcInstance::getValueOfUndefinedField):
1054 * bindings/objc/objc_runtime.mm:
1055 (ObjcField::valueFromInstance):
1056 (ObjcArray::valueAt):
1057 * bindings/objc/objc_utility.h:
1058 * bindings/objc/objc_utility.mm:
1059 (KJS::Bindings::convertObjcValueToValue):
1060 * bindings/runtime.h:
1062 2007-06-13 Simon Hausmann <hausmann@kde.org>
1066 * kjs/testkjs.pro: WebKitQt is now called QtWebKit.
1068 2007-06-12 Anders Carlsson <andersca@apple.com>
1072 * bindings/qt/qt_instance.cpp:
1073 (KJS::Bindings::QtInstance::invokeMethod):
1075 2007-06-12 Anders Carlsson <andersca@apple.com>
1079 Move the notion of field type to the JNI runtime since that's the only
1080 one that was actually using it.
1082 * bindings/c/c_runtime.h:
1083 (KJS::Bindings::CField::CField):
1084 * bindings/jni/jni_runtime.h:
1085 * bindings/objc/objc_runtime.h:
1086 * bindings/objc/objc_runtime.mm:
1087 * bindings/qt/qt_runtime.h:
1088 * bindings/runtime.h:
1089 * bindings/runtime_method.cpp:
1091 2007-06-12 Anders Carlsson <andersca@apple.com>
1095 * bindings/qt/qt_class.cpp:
1096 (KJS::Bindings::QtClass::methodsNamed):
1097 * bindings/qt/qt_instance.cpp:
1098 (KJS::Bindings::QtInstance::invokeMethod):
1100 2007-06-12 Anders Carlsson <andersca@apple.com>
1104 Get rid of the MethodList class and use a good ol' Vector instead.
1106 * bindings/c/c_class.cpp:
1107 (KJS::Bindings::CClass::methodsNamed):
1108 * bindings/c/c_instance.cpp:
1109 (KJS::Bindings::CInstance::invokeMethod):
1110 * bindings/jni/jni_class.cpp:
1111 (JavaClass::JavaClass):
1112 (JavaClass::~JavaClass):
1113 * bindings/jni/jni_instance.cpp:
1114 (JavaInstance::invokeMethod):
1115 * bindings/objc/objc_class.mm:
1116 (KJS::Bindings::ObjcClass::methodsNamed):
1117 * bindings/objc/objc_instance.mm:
1118 (ObjcInstance::invokeMethod):
1119 * bindings/objc/objc_runtime.mm:
1120 (ObjcFallbackObjectImp::callAsFunction):
1121 * bindings/runtime.cpp:
1122 * bindings/runtime.h:
1123 * bindings/runtime_method.cpp:
1124 (RuntimeMethod::lengthGetter):
1125 (RuntimeMethod::callAsFunction):
1126 * bindings/runtime_object.cpp:
1127 (RuntimeObjectImp::getOwnPropertySlot):
1129 2007-06-12 Anders Carlsson <andersca@apple.com>
1133 Make RuntimeMethod's method list a pointer so that the object size doesn't
1134 grow beyond 32 bytes when we later will replace MethodList with a Vector.
1136 * bindings/runtime_method.cpp:
1137 (RuntimeMethod::RuntimeMethod):
1138 (RuntimeMethod::lengthGetter):
1139 (RuntimeMethod::callAsFunction):
1140 * bindings/runtime_method.h:
1142 2007-06-12 Anders Carlsson <andersca@apple.com>
1146 Get rid of the Parameter class.
1148 * bindings/jni/jni_instance.cpp:
1149 (JavaInstance::invokeMethod):
1150 * bindings/jni/jni_runtime.cpp:
1151 (JavaMethod::signature):
1152 * bindings/jni/jni_runtime.h:
1153 (KJS::Bindings::JavaParameter::JavaParameter):
1154 (KJS::Bindings::JavaParameter::~JavaParameter):
1155 (KJS::Bindings::JavaParameter::type):
1156 (KJS::Bindings::JavaMethod::parameterAt):
1157 (KJS::Bindings::JavaMethod::numParameters):
1158 * bindings/runtime.h:
1160 2007-06-12 Anders Carlsson <andersca@apple.com>
1164 * bindings/qt/qt_class.h:
1166 2007-06-12 Mark Rowe <mrowe@apple.com>
1170 * bindings/objc/objc_runtime.h:
1172 2007-06-12 Anders Carlsson <andersca@apple.com>
1176 Get rid of Constructor and its only subclass JavaConstructor.
1178 * bindings/c/c_class.h:
1179 * bindings/jni/jni_class.cpp:
1180 (JavaClass::JavaClass):
1181 (JavaClass::~JavaClass):
1182 * bindings/jni/jni_class.h:
1183 * bindings/jni/jni_runtime.cpp:
1184 * bindings/jni/jni_runtime.h:
1185 * bindings/objc/objc_class.h:
1186 * bindings/runtime.h:
1188 2007-06-12 Anders Carlsson <andersca@apple.com>
1192 Use RetainPtr throughout the bindings code.
1194 * bindings/objc/objc_class.h:
1195 * bindings/objc/objc_class.mm:
1196 (KJS::Bindings::ObjcClass::ObjcClass):
1197 (KJS::Bindings::ObjcClass::methodsNamed):
1198 (KJS::Bindings::ObjcClass::fieldNamed):
1199 * bindings/objc/objc_instance.h:
1200 (KJS::Bindings::ObjcInstance::getObject):
1201 * bindings/objc/objc_instance.mm:
1202 (ObjcInstance::ObjcInstance):
1203 (ObjcInstance::~ObjcInstance):
1204 (ObjcInstance::implementsCall):
1205 (ObjcInstance::invokeMethod):
1206 (ObjcInstance::invokeDefaultMethod):
1207 (ObjcInstance::defaultValue):
1208 * bindings/objc/objc_runtime.h:
1209 (KJS::Bindings::ObjcMethod::setJavaScriptName):
1210 (KJS::Bindings::ObjcMethod::javaScriptName):
1211 (KJS::Bindings::ObjcArray::getObjcArray):
1212 * bindings/objc/objc_runtime.mm:
1214 (ObjcArray::ObjcArray):
1215 (ObjcArray::setValueAt):
1216 (ObjcArray::valueAt):
1217 (ObjcArray::getLength):
1220 2007-06-12 Anders Carlsson <andersca@apple.com>
1224 Have JSCell inherit from Noncopyable.
1226 * bindings/objc/objc_runtime.h:
1227 * bindings/runtime_object.h:
1230 2007-06-12 Anders Carlsson <andersca@apple.com>
1232 Reviewed by Darin and Maciej.
1234 More cleanup. Use our Noncopyable WTF class, add a root object member
1237 * bindings/c/c_class.h:
1238 * bindings/jni/jni_class.h:
1239 * bindings/jni/jni_instance.h:
1240 * bindings/jni/jni_runtime.cpp:
1241 (JavaArray::JavaArray):
1242 * bindings/jni/jni_runtime.h:
1243 * bindings/objc/objc_class.h:
1244 * bindings/objc/objc_runtime.h:
1245 * bindings/objc/objc_runtime.mm:
1246 (ObjcArray::ObjcArray):
1247 * bindings/objc/objc_utility.mm:
1248 (KJS::Bindings::convertObjcValueToValue):
1249 * bindings/runtime.cpp:
1250 (KJS::Bindings::Array::Array):
1251 (KJS::Bindings::Array::~Array):
1252 * bindings/runtime.h:
1253 * bindings/runtime_object.h:
1254 * bindings/runtime_root.h:
1256 2007-06-08 Zack Rusin <zrusin@trolltech.com>
1260 * bindings/qt/qt_instance.cpp:
1261 (KJS::Bindings::QtInstance::QtInstance):
1262 * bindings/qt/qt_instance.h:
1264 2007-06-07 Anders Carlsson <andersca@apple.com>
1268 Get rid of Instance::setRootObject and pass the root object to the instance constructor instead.
1270 * bindings/c/c_instance.cpp:
1271 (KJS::Bindings::CInstance::CInstance):
1272 * bindings/c/c_instance.h:
1273 * bindings/jni/jni_instance.cpp:
1274 (JavaInstance::JavaInstance):
1275 * bindings/jni/jni_instance.h:
1276 * bindings/jni/jni_jsobject.cpp:
1277 (JavaJSObject::convertJObjectToValue):
1278 * bindings/objc/objc_instance.h:
1279 * bindings/objc/objc_instance.mm:
1280 (ObjcInstance::ObjcInstance):
1281 * bindings/runtime.cpp:
1282 (KJS::Bindings::Instance::Instance):
1283 (KJS::Bindings::Instance::createBindingForLanguageInstance):
1284 * bindings/runtime.h:
1286 2007-06-07 Anders Carlsson <andersca@apple.com>
1290 Don't use a JavaInstance to store the field when all we want to do is to keep the field
1291 from being garbage collected. Instead, use a JObjectWrapper.
1293 * bindings/jni/jni_instance.h:
1294 * bindings/jni/jni_runtime.cpp:
1295 (JavaField::JavaField):
1296 (JavaField::dispatchValueFromInstance):
1297 (JavaField::dispatchSetValueToInstance):
1298 * bindings/jni/jni_runtime.h:
1299 (KJS::Bindings::JavaField::JavaField):
1300 (KJS::Bindings::JavaField::operator=):
1302 2007-05-30 Alp Toker <alp.toker@collabora.co.uk>
1306 Enable logging in the Gdk port.
1307 http://bugs.webkit.org/show_bug.cgi?id=13936
1309 * wtf/Assertions.cpp:
1310 * wtf/Assertions.h: Add WTFLogVerbose which also logs
1311 the file, line number and function.
1313 2007-05-30 Mark Rowe <mrowe@apple.com>
1315 Mac build fix. Update #include.
1317 * API/JSCallbackFunction.h:
1319 2007-05-30 Luciano Montanaro <mikelima@cirulla.net>
1323 - cross-port Harri Porten's commits 636099 and 636108 from KJS:
1324 "publish a class anyway public already" and "class is being used from
1325 outside for quite some time" in preparation for further syncronizations
1328 * kjs/date_object.cpp:
1329 * kjs/date_object.h:
1332 (KJS::InternalFunctionImp::classInfo):
1333 (KJS::InternalFunctionImp::functionName):
1334 * kjs/function_object.h:
1337 (KJS::getStaticPropertySlot):
1338 (KJS::getStaticFunctionSlot):
1339 (KJS::getStaticValueSlot):
1340 * kjs/object_object.h:
1342 2007-05-29 Sam Weinig <sam@webkit.org>
1344 Reviewed by Adam Roben.
1346 Cleanup function and fix to match comparison API.
1348 * kjs/string_object.cpp:
1349 (KJS::substituteBackreferences):
1350 (KJS::localeCompare):
1352 2007-05-28 Geoffrey Garen <ggaren@apple.com>
1354 Slight clarification to an exception message.
1356 * API/JSCallbackObject.cpp:
1357 (KJS::JSCallbackObject::put):
1359 2007-05-27 Holger Freyther <zecke@selfish.org>
1361 Reviewed by Mark Rowe.
1363 * wtf/Platform.h: Move Gdk up to allow building WebKit/Gdk on Darwin
1365 2007-05-27 Darin Adler <darin@apple.com>
1367 - fix a couple ifdefs that said WIN instead of WIN_OS
1369 * kjs/collector.cpp:
1370 (KJS::allocateBlock): WIN -> WIN_OS
1371 (KJS::freeBlock): Ditto.
1373 2007-05-26 Sam Weinig <sam@webkit.org>
1377 Patch for http://bugs.webkit.org/show_bug.cgi?id=13854
1378 Port of commit 667785 from kjs
1380 - special case calling String.localeCompare() with no parameters to return 0.
1382 * kjs/string_object.cpp:
1383 (KJS::StringProtoFunc::callAsFunction):
1385 2007-05-25 Kimmo Kinnunen <kimmok@iki.fi>
1389 - Fix for http://bugs.webkit.org/show_bug.cgi?id=13456
1390 REGRESSION: setTimeout "arguments" object gets shadowed by a local variable
1392 - Add a explicit check for arguments. Previously check was done with getDirect,
1393 but since the arguments is created on-demand in ActivationImp, it doesn't
1394 show up in the test. 'arguments' should always be in the VarDeclNode's
1398 (VarDeclNode::evaluate): Additional check if the var decl identifier is 'arguments'
1400 2007-05-25 George Staikos <staikos@kde.org>
1404 - Use COMPILER(GCC), not PLATFORM(GCC) - as Platform.h defines
1408 2007-05-25 Kimmo Kinnunen <kimmok@iki.fi>
1412 - http://bugs.webkit.org/show_bug.cgi?id=13623 (Decompilation of function
1413 doesn't compile with "++(x,y)")
1414 - Create the error node based on the actual node, not the node inside
1416 - Fix applies to postfix, prefix and typeof operators
1417 - Produces run-time ReferenceError like other non-lvalue assignments etc.
1419 * kjs/grammar.y: Create {Prefix,Postfix}ErrorNode based on the actual node,
1420 not the based on the node returned by "nodeInsideAllParens()". Same for
1423 2007-05-25 Simon Hausmann <hausmann@kde.org>
1427 Fix crash in Qt JavaScript bindings when the arguments used on the Qt side are not
1428 registered with QMetaType.
1430 * bindings/qt/qt_instance.cpp:
1431 (KJS::Bindings::QtInstance::invokeMethod):
1432 * bindings/qt/qt_runtime.cpp:
1434 2007-05-24 Luciano Montanaro <mikelima@cirulla.net>
1438 Patch for http://bugs.webkit.org/show_bug.cgi?id=13855
1439 Port patch 666176 to JavaScriptCore
1441 - Renamed JSValue::downcast() to JSValue::asCell() which makes the
1442 function meaning cleaner. It's modeled after Harri Porten change in
1445 * kjs/collector.cpp:
1446 (KJS::Collector::protect):
1447 (KJS::Collector::unprotect):
1448 (KJS::Collector::collectOnMainThreadOnly):
1450 (KJS::JSValue::isObject):
1451 * kjs/string_object.cpp:
1452 (KJS::StringProtoFunc::callAsFunction):
1454 (KJS::JSValue::asCell):
1455 (KJS::JSValue::isNumber):
1456 (KJS::JSValue::isString):
1457 (KJS::JSValue::isObject):
1458 (KJS::JSValue::getNumber):
1459 (KJS::JSValue::getString):
1460 (KJS::JSValue::getObject):
1461 (KJS::JSValue::getUInt32):
1462 (KJS::JSValue::mark):
1463 (KJS::JSValue::marked):
1464 (KJS::JSValue::type):
1465 (KJS::JSValue::toPrimitive):
1466 (KJS::JSValue::toBoolean):
1467 (KJS::JSValue::toNumber):
1468 (KJS::JSValue::toString):
1469 (KJS::JSValue::toObject):
1471 2007-05-18 Holger Hans Peter Freyther <zecke@selfish.org>
1473 Reviewed by Mark Rowe.
1475 * kjs/testkjs.pro: Make the Gdk port link to icu
1477 2007-05-15 Geoffrey Garen <ggaren@apple.com>
1479 Reviewed by Adele Peterson.
1481 It helps if you swap the right variable.
1486 2007-05-15 Lars Knoll <lars@trolltech.com>
1490 Extend the QObject JavaScript bindings to work for slots with
1493 * bindings/qt/qt_instance.cpp:
1494 (KJS::Bindings::QtInstance::invokeMethod):
1496 2007-05-14 Kimmo Kinnunen <kimmok@iki.fi>
1500 - Fixes http://bugs.webkit.org/show_bug.cgi?id=13622 (Decompiler
1501 omits trailing comma in array literal)
1503 * kjs/nodes2string.cpp:
1504 (ArrayNode::streamTo): print extra ',' in case there was elision
1505 commas (check opt member var) and array elements present
1506 in the array expression
1508 2007-05-14 Geoffrey Garen <ggaren@apple.com>
1510 Reviewed by Oliver Hunt.
1512 Added HashMap::swap and HashSet::swap. WebCore now uses HashSet::swap.
1513 I figured while I was in the neighborhood I might as well add HashMap::swap,
1523 2007-05-11 Kimmo Kinnunen <kimmok@iki.fi>
1527 - Fix for bug http://bugs.webkit.org/show_bug.cgi?id=13620
1528 Bogus decompilation of "for (var j = 1 in [])"
1529 - ForInNode toString()'ed to syntax error if there was var decl
1531 - ForNode toStringed()'ed lost 'var ' if it was present
1533 * kjs/nodes2string.cpp:
1534 (VarDeclListNode::streamTo): Print "var " here
1535 (VarStatementNode::streamTo): Don't print "var " here
1536 (ForNode::streamTo): Remove TODO comment, VarDeclListNode will
1538 (ForInNode::streamTo): ForIn initializer is printed by VarDeclNode
1540 2007-05-11 Kimmo Kinnunen <kimmok@iki.fi>
1544 - Fixes http://bugs.webkit.org/show_bug.cgi?id=10878
1545 (Incorrect decompilation for "4..x")
1546 - Group numbers in dotted expressions in toString() output, so we
1547 avoid the 4.x constructs when the original input is 4..x.
1548 4..x means the same as 4. .x or (4).x or Number(4).x
1550 * kjs/nodes2string.cpp:
1551 (KJS::SourceStream::):
1552 Add boolean flag to indicate that if next item is a number, it should be grouped.
1553 Add new formatting enum which turns on the boolean flag.
1554 (KJS::SourceStream::SourceStream): Added. Initialize the flag.
1555 (SourceStream::operator<<): Added. New overloaded operator with double value as parameter.
1556 (NumberNode::streamTo): Use the double operator
1557 (ArrayNode::streamTo):
1558 (DotAccessorNode::streamTo):
1559 (FunctionCallDotNode::streamTo):
1560 (FunctionCallParenDotNode::streamTo):
1561 (PostfixDotNode::streamTo):
1562 (DeleteDotNode::streamTo):
1563 (PrefixDotNode::streamTo):
1564 (AssignDotNode::streamTo): Use the new formatting enum to turn on the grouping flag.
1566 2007-05-10 Lars Knoll <lars@trolltech.com>
1570 Fix our last three test failures in the JavaScript
1573 * wtf/unicode/qt4/UnicodeQt4.h:
1574 (WTF::Unicode::toLower):
1575 (WTF::Unicode::toUpper):
1577 2007-05-08 Geoffrey Garen <ggaren@apple.com>
1579 Reviewed by Darin Adler.
1581 Fixed #includes of JSStringRefCF.h and use of CF datatypes. I think I
1582 misunderstood this issue before.
1584 * API/JavaScriptCore.h: #include JSStringRefCF.h. Platforms that don't
1585 want this behavior can just #include individual headers, instead of the
1586 umbrella framework header. But we definitely want Mac OS X clients to
1587 get the #include of JSStringRefCF.h "for free."
1588 * API/minidom.c: Don't #include JSStringRefCF.h. (Don't need to #include
1589 JavaScriptCore.h, either.)
1590 * API/testapi.c: Don't #include JSStringRefCF.h. Do use CF datatypes
1591 regardless of whether __APPLE__ is defined. Platforms that don't support
1592 CF just shouldn't compile this file.
1595 2007-05-09 Eric Seidel <eric@webkit.org>
1599 http://bugs.webkit.org/show_bug.cgi?id=6985
1600 Cyclic __proto__ values cause WebKit to hang
1603 (KJS::JSObject::put): do a cycle check before setting __proto__
1605 2007-05-08 Kimmo Kinnunen <kimmok@iki.fi>
1607 Reviewed by darin. Landed by eseidel.
1609 - http://bugs.webkit.org/show_bug.cgi?id=10880 (Do..while loop gains
1610 a semicolon each time it is toStringed)
1611 Grammar in Ecma-66262, 12.6: "do Statement while ( Expression );"
1612 EmptyStatement was created after every do..while(expr) which
1613 had semicolon at the end.
1615 * kjs/grammar.y: Require semicolon at the end of do..while
1617 2007-05-08 Geoffrey Garen <ggaren@apple.com>
1619 Build fix -- this time for sure.
1621 APICast.h, being private, ends up in a different folder than JSValueRef.h,
1622 so we can't include one from the other using "". Instead, just forward
1623 declare the relevant data types.
1627 2007-05-08 Geoffrey Garen <ggaren@apple.com>
1629 Build fix: export APICast.h for WebCore and WebKit.
1631 * JavaScriptCore.xcodeproj/project.pbxproj:
1633 2007-05-04 Darin Adler <darin@apple.com>
1637 - fix http://bugs.webkit.org/show_bug.cgi?id=12821
1638 <rdar://problem/5007921> Number.toExponential doesn't work for negative numbers
1640 * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
1641 Added a call to fabs before calling log10.
1643 2007-05-03 Holger Freyther <freyther@kde.org>
1645 Reviewed by Zack, landed by Simon.
1646 This is bugzilla bug 13499.
1648 * JavaScriptCore.pri: Place Qt into the qt-port scope
1649 * bindings/testbindings.pro: Place Qt into the qt-port scope
1650 * kjs/testkjs.pro: Place Qt into the qt-port scope
1651 * pcre/pcre.pri: Place Qt into the qt-port scope
1653 2007-05-02 David Harrison <harrison@apple.com>
1657 <rdar://problem/5174862> Crash resulting from DeprecatedString::insert()
1659 Added insertion support for more than one value.
1663 Added support for inserting multiple values.
1666 New. Insert at the start of vectors. Convenient for vectors used as strings.
1668 2007-05-01 Jungshik Shin <jungshik.shin@gmail.com>
1672 - get rid of non-ASCII lteral characters : suppress compiler warnings
1673 http://bugs.webkit.org/show_bug.cgi?id=13551
1676 * pcre/pcre_compile.c:
1678 2007-04-28 Jungshik Shin <jungshik.shin@gmail.com>
1680 Reviewed by Sam Weinig.
1682 - Replace copyright sign in Latin-1 (0xA9) with '(C)'
1683 http://bugs.webkit.org/show_bug.cgi?id=13531
1685 * bindings/npruntime.h:
1687 2007-04-28 Darin Adler <darin@apple.com>
1691 - fix <rdar://problem/5154144> Hamachi test fails: assertion failure in ListHashSet
1693 Test: fast/forms/add-remove-form-elements-stress-test.html
1695 * wtf/ListHashSet.h:
1696 (WTF::ListHashSetNodeAllocator::ListHashSetNodeAllocator): Initialize
1697 m_isDoneWithInitialFreeList to false.
1698 (WTF::ListHashSetNodeAllocator::allocate): Added assertions based on a debug-only
1699 m_isAllocated flag that make sure we don't allocate a block that's already allocated.
1700 These assertions helped pinpoint the bug. Set m_isDoneWithInitialFreeList when we
1701 allocate the last block of the initial free list. Once we're done with the initial
1702 free list, turn off the rule that says that the next node in the pool after the last
1703 node in the free list is also free. This rule works because any free nodes are added
1704 to the head of the free list, so a node that hasn't been allocated even once is always
1705 at the tail of the free list and all the nodes after it also haven't been allocated
1706 even once. But it doesn't work any longer once the entire pool has been used at least
1707 once, because there's nothing special about the last node on the free list any more.
1708 (WTF::ListHashSetNodeAllocator::deallocate): Set the node's m_isAllocated to false.
1709 (WTF::ListHashSetNodeAllocator::pastPool): Added. Used above.
1710 (WTF::ListHashSetNodeAllocator::inPool): Changed to use the pastPool function.
1711 (WTF::ListHashSetNode::ListHashSetNode): Initialize m_isAllocated to true.
1712 (WTF::ListHashSetNode::operator new): Removed variable name for unused size
1714 (WTF::ListHashSetNode::destroy): Changed to call the destructor rather than
1715 delete -- this gets rid of the need to define an operator delete.
1717 2007-04-27 Christopher Brichford <chrisb@adobe.com>
1719 Reviewed by Timothy Hatcher.
1721 Fix for: Bug 13211: Move JavaScriptCore mac project files for apollo port
1722 http://bugs.webkit.org/show_bug.cgi?id=13211
1724 * JavaScriptCore.apolloproj/mac/JavaScriptCore.Debug.xcconfig: Added.
1725 * JavaScriptCore.apolloproj/mac/JavaScriptCore.Release.xcconfig: Added.
1726 * JavaScriptCore.apolloproj/mac/JavaScriptCore.xcconfig: Added.
1727 * JavaScriptCore.apolloproj/mac/JavaScriptCore.xcodeproj/project.pbxproj: Added.
1728 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Debug.xcconfig: Removed.
1729 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Release.xcconfig: Removed.
1730 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcconfig: Removed.
1731 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: Removed.
1733 2007-04-27 Holger Freyther <freyther@kde.org>
1737 Remove unmaintained CMake build system.
1739 * CMakeLists.txt: Removed.
1740 * pcre/CMakeLists.txt: Removed.
1742 2007-04-27 Mark Rowe <mrowe@apple.com>
1746 * JavaScriptCore.xcodeproj/project.pbxproj: Improve dependencies in Xcode project
1747 by marking dftables as a dependency of Generate Derived Sources rather than of
1748 JavaScriptCore itself.
1750 2007-04-26 Geoffrey Garen <ggaren@apple.com>
1752 Build fix -- added #includes that we used to get implicitly through
1760 2007-04-26 Geoffrey Garen <ggaren@apple.com>
1762 Reviewed by Maciej Stachowiak, Adam Roben.
1765 <rdar://problem/4885130> Remove #include of JSStringRefCF.h from JSStringRef.h
1766 <rdar://problem/4885123> JavaScriptCore is not cross-platform -- JSStringRef.h references CF datatypes
1768 * API/JSStringRef.h: Removed #include -- no clients need it anymore.
1770 2007-04-25 David Kilzer <ddkilzer@apple.com>
1774 Add assertions for debug builds.
1777 (KJS::JSLock::lock): Assert the return value of pthread_mutex_lock() in debug builds.
1778 (KJS::JSLock::unlock): Assert the return value of pthread_mutex_unlock() in debug builds.
1780 2007-04-25 Maciej Stachowiak <mjs@apple.com>
1784 - fix build problems
1786 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable warning that
1787 gives often downright incorrect results based on guessing what will happen in 64-bit.
1789 2007-04-25 Darin Adler <darin@apple.com>
1793 - tweak the allocator for a small speedup -- Shark showed this was a win, but I can't
1794 measure an improvement right now, but it's also clear these changes do no harm
1796 * wtf/FastMalloc.cpp:
1797 (WTF::LgFloor): Use ALWAYS_INLINE here; in testing I did a while back this was necessary
1798 to get this single-instruction function to be inlined.
1799 (WTF::SizeClass): Use ALWAYS_INLINE here too for the same reason. Also change the special
1800 case for a size of 0 to work without a branch for a bit of extra speed.
1801 (WTF::ByteSizeForClass): Use ALWAYS_INLINE here too for the same reason.
1803 2007-04-24 Maciej Stachowiak <mjs@apple.com>
1807 - use custom calling convention for everything in nodes.cpp on intel gcc for 1.5% speed boost
1809 Nearly all functions in nodes.cpp were marked up to use the
1810 regparm(3) calling convention under GCC for x86, since this is
1811 faster and they are all guaranteed to be called only internally to
1814 The only exception is destructors, since delete doesn't know how to use a custom calling convention.
1817 (dotExprDoesNotAllowCallsString):
1820 (KJS::StatementNode::):
1822 (KJS::BooleanNode::):
1823 (KJS::NumberNode::):
1824 (KJS::StringNode::):
1825 (KJS::RegExpNode::):
1827 (KJS::ResolveNode::):
1829 (KJS::ElementNode::):
1831 (KJS::PropertyNameNode::):
1832 (KJS::PropertyNode::):
1833 (KJS::PropertyListNode::):
1834 (KJS::ObjectLiteralNode::):
1835 (KJS::BracketAccessorNode::):
1836 (KJS::DotAccessorNode::):
1837 (KJS::ArgumentListNode::):
1838 (KJS::ArgumentsNode::):
1839 (KJS::NewExprNode::):
1840 (KJS::FunctionCallValueNode::):
1841 (KJS::FunctionCallResolveNode::):
1842 (KJS::FunctionCallBracketNode::):
1843 (KJS::FunctionCallParenBracketNode::):
1844 (KJS::FunctionCallDotNode::):
1845 (KJS::FunctionCallParenDotNode::):
1846 (KJS::PostfixResolveNode::):
1847 (KJS::PostfixBracketNode::):
1848 (KJS::PostfixDotNode::):
1849 (KJS::PostfixErrorNode::):
1850 (KJS::DeleteResolveNode::):
1851 (KJS::DeleteBracketNode::):
1852 (KJS::DeleteDotNode::):
1853 (KJS::DeleteValueNode::):
1855 (KJS::TypeOfResolveNode::):
1856 (KJS::TypeOfValueNode::):
1857 (KJS::PrefixResolveNode::):
1858 (KJS::PrefixBracketNode::):
1859 (KJS::PrefixDotNode::):
1860 (KJS::PrefixErrorNode::):
1861 (KJS::UnaryPlusNode::):
1862 (KJS::NegateNode::):
1863 (KJS::BitwiseNotNode::):
1864 (KJS::LogicalNotNode::):
1868 (KJS::RelationalNode::):
1870 (KJS::BitOperNode::):
1871 (KJS::BinaryLogicalNode::):
1872 (KJS::ConditionalNode::):
1873 (KJS::AssignResolveNode::):
1874 (KJS::AssignBracketNode::):
1875 (KJS::AssignDotNode::):
1876 (KJS::AssignErrorNode::):
1878 (KJS::AssignExprNode::):
1879 (KJS::VarDeclListNode::):
1880 (KJS::VarStatementNode::):
1881 (KJS::EmptyStatementNode::):
1882 (KJS::ExprStatementNode::):
1884 (KJS::DoWhileNode::):
1887 (KJS::ContinueNode::):
1889 (KJS::ReturnNode::):
1894 (KJS::ParameterNode::):
1896 (KJS::FunctionBodyNode::):
1897 (KJS::FuncExprNode::):
1898 (KJS::FuncDeclNode::):
1899 (KJS::SourceElementsNode::):
1900 (KJS::CaseClauseNode::):
1901 (KJS::ClauseListNode::):
1902 (KJS::SwitchNode::):
1904 2007-04-24 Oliver Hunt <oliver@apple.com>
1906 GTK Build fix, ::findEntry->KJS::findEntry
1909 (KJS::Lookup::findEntry):
1910 (KJS::Lookup::find):
1912 2007-04-23 Maciej Stachowiak <mjs@apple.com>
1916 - compile most of JavaScriptCore as one file for 4% JS iBench speed improvement
1918 * JavaScriptCore.xcodeproj/project.pbxproj: Add AllInOneFile.cpp, and remove files it includes
1920 * kjs/AllInOneFile.cpp: Added.
1921 * kjs/dtoa.cpp: Renamed CONST to CONST_ to avoid conflict.
1923 (Bigint::nrv_alloc):
1924 * kjs/lookup.cpp: Use "namspace KJS { ... }" instead of "using namespace KJS;"
1926 2007-04-23 Maciej Stachowiak <mjs@apple.com>
1928 Build fix, not reviewed.
1930 * kjs/collector.h: Fix struct/class mismatch.
1932 2007-04-23 Maciej Stachowiak <mjs@apple.com>
1936 - raise ALLOCATIONS_PER_COLLECTION to 4000, for 3.7% iBench speed improvement
1938 Now that the cell size is smaller and the block size is bigger, we can fit 4000 objects in
1939 the two spare cells the collector is willing to keep around, so collect a bit less often.
1941 * kjs/collector.cpp:
1943 2007-04-23 Maciej Stachowiak <mjs@apple.com>
1945 Reviewed by Darin and Geoff.
1947 - move mark and collectOnMainThreadOnly bits into separate bitmaps
1949 This saves 4 bytes per cell, allowing shrink of cell size to 32,
1950 which leads to a .8% speed improvement on iBench.
1952 This is only feasible because of all the previous changes on the branch.
1954 * kjs/collector.cpp:
1955 (KJS::allocateBlock): Adjust for some renames of constants.
1956 (KJS::Collector::markStackObjectsConservatively): Now that cells are 32 bytes (64
1957 bytes on 64-bit) the cell alignment check can be made much more strict, and also
1958 obsoletes the need for a % sizeof(CollectorCell) check. Also, we can mask off the low
1959 bits of the pointer to have a potential block pointer to look for.
1960 (KJS::Collector::collectOnMainThreadOnly): Use bitmap.
1961 (KJS::Collector::markMainThreadOnlyObjects): Use bitmap.
1962 (KJS::Collector::collect): When sweeping, use bitmaps directly to find mark bits.
1964 (KJS::): Move needed constants and type declarations here.
1965 (KJS::CollectorBitmap::get): Bit twiddling to get a bitmap value.
1966 (KJS::CollectorBitmap::set): Bit twiddling to set a bitmap bit to true.
1967 (KJS::CollectorBitmap::clear): Bit twiddling to set a bitmap bit to false.
1968 (KJS::CollectorBitmap::clearAll): Clear whole bitmap at one go.
1969 (KJS::Collector::cellBlock): New operation, compute the block pointer for
1970 a cell by masking off low bits.
1971 (KJS::Collector::cellOffset): New operation, compute the cell offset for a
1972 cell by masking off high bits and dividing (actually a shift).
1973 (KJS::Collector::isCellMarked): Check mark bit in bitmap
1974 (KJS::Collector::markCell): Set mark bit in bitmap.
1976 (KJS::JSCell::JSCell): No more bits.
1977 (KJS::JSCell::marked): Let collector handle it.
1978 (KJS::JSCell::mark): Let collector handle it.
1980 2007-04-23 Anders Carlsson <andersca@apple.com>
1984 * kjs/regexp_object.h:
1985 RegExpObjectImpPrivate is a struct, not a class.
1987 2007-04-23 Maciej Stachowiak <mjs@apple.com>
1991 - shrink FunctionImp / DeclaredFunctionImp by 4 bytes, by moving parameter list to function body
1993 I reconciled this with a similar change in KDE kjs by Maks Orlovich <maksim@kde.org>.
1996 (KJS::FunctionImp::callAsFunction):
1997 (KJS::FunctionImp::passInParameters):
1998 (KJS::FunctionImp::lengthGetter):
1999 (KJS::FunctionImp::getParameterName):
2001 * kjs/function_object.cpp:
2002 (FunctionProtoFunc::callAsFunction):
2003 (FunctionObjectImp::construct):
2005 (FunctionBodyNode::addParam):
2006 (FunctionBodyNode::paramString):
2007 (FuncDeclNode::addParams):
2008 (FuncDeclNode::processFuncDecl):
2009 (FuncExprNode::addParams):
2010 (FuncExprNode::evaluate):
2012 (KJS::Parameter::Parameter):
2013 (KJS::FunctionBodyNode::numParams):
2014 (KJS::FunctionBodyNode::paramName):
2015 (KJS::FunctionBodyNode::parameters):
2016 (KJS::FuncExprNode::FuncExprNode):
2017 (KJS::FuncDeclNode::FuncDeclNode):
2018 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable 64-bit warnings because
2019 they handle size_t badly.
2021 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2025 - shrink RegexpObjectImp by 4 bytes
2027 Somewhat inexplicably, this seems to be a .33% speedup on JS iBench.
2029 * kjs/regexp_object.cpp:
2030 (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate):
2031 (RegExpObjectImp::RegExpObjectImp):
2032 (RegExpObjectImp::performMatch):
2033 (RegExpObjectImp::arrayOfMatches):
2034 (RegExpObjectImp::getBackref):
2035 (RegExpObjectImp::getLastMatch):
2036 (RegExpObjectImp::getLastParen):
2037 (RegExpObjectImp::getLeftContext):
2038 (RegExpObjectImp::getRightContext):
2039 (RegExpObjectImp::getValueProperty):
2040 (RegExpObjectImp::putValueProperty):
2041 * kjs/regexp_object.h:
2043 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2047 - change to 1-bit bitfields instead of 8-bit, this turns out to lead to a .51% speedup on JS iBench
2049 The 1-bit bitfields are actually faster than just plain bools, at least on Intel (go figure).
2051 * kjs/property_map.h:
2053 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2057 - shrink ArrayInstance objects by 4 bytes
2058 http://bugs.webkit.org/show_bug.cgi?id=13386
2060 I did this by storing the capacity before the beginning of the storage array. It turns out
2061 it is rarely needed and is by definition 0 when the storage array is null.
2063 * kjs/array_instance.h:
2064 (KJS::ArrayInstance::capacity): Get it from the secret stash
2065 * kjs/array_object.cpp:
2066 (allocateStorage): New function to encapsulate allocating the storage with extra space ahead
2068 (reallocateStorage): ditto for realloc
2069 (ArrayInstance::ArrayInstance):
2070 (ArrayInstance::~ArrayInstance):
2071 (ArrayInstance::resizeStorage):
2073 2007-04-23 Darin Adler <darin@apple.com>
2077 - fix <rdar://problem/4840688> REGRESSION (r10588, r10621): JavaScript won't parse
2078 modifications of non-references (breaks 300themovie.warnerbros.com, fedex.com)
2080 Despite the ECMAScript specification's claim that you can treat these as syntax
2081 errors, doing so creates some website incompatibilities. So this patch turns them back
2082 into evaluation errors instead.
2084 Test: fast/js/modify-non-references.html
2086 * kjs/grammar.y: Change makeAssignNode, makePrefixNode, and makePostfixNode so that they
2087 never fail to parse. Update rules that use them. Fix a little bit of indenting. Use
2088 new PostfixErrorNode, PrefixErrorNode, and AssignErrorNode classes.
2090 * kjs/nodes.h: Added an overload of throwError that takes a char* argument.
2091 Replaced setExceptionDetailsIfNeeded and debugExceptionIfNeeded with handleException,
2092 which does both. Added PostfixErrorNode, PrefixErrorNode, and AssignErrorNode classes.
2094 * kjs/nodes.cpp: Changed exception macros to use handleException; simpler and smaller
2095 code size than the two functions that we used before.
2096 (Node::throwError): Added the overload mentioned above.
2097 (Node::handleException): Added. Contains the code from both setExceptionDetailsIfNeeded
2098 and debugExceptionIfNeeded.
2099 (PostfixErrorNode::evaluate): Added. Throws an exception.
2100 (PrefixErrorNode::evaluate): Ditto.
2101 (AssignErrorNode::evaluate): Ditto.
2102 (ThrowNode::execute): Call handleException instead of debugExceptionIfNeeded; this
2103 effectively adds a call to setExceptionDetailsIfNeeded, which may help with getting
2104 the correct file and line number for these exceptions.
2106 * kjs/nodes2string.cpp:
2107 (PostfixErrorNode::streamTo): Added.
2108 (PrefixErrorNode::streamTo): Added.
2109 (AssignErrorNode::streamTo): Added.
2111 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2115 - fix test failures / crashes on PPC
2117 * kjs/property_map.h: Make the bool fields explicitly 8-bit bitfields, since bool is a full
2118 word there otherwise :-(
2120 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2124 - fix more test case failures
2126 * bindings/runtime_array.cpp:
2127 (RuntimeArray::RuntimeArray): inherit from JSObject instead of ArrayInstance; it turns
2128 out that this class only needs the prototype and classInfo from ArrayInstance, not the
2129 actual class itself, and it was too big otherwise.
2130 (RuntimeArray::getOwnPropertySlot):
2131 * bindings/runtime_array.h:
2133 2007-04-23 Maciej Stachowiak <mjs@apple.com>
2137 - fix some test failures
2139 * bindings/runtime_method.cpp:
2140 (RuntimeMethod::RuntimeMethod): inherit from InternalFunctionImp instead of FunctionImpl,
2141 otherwise this is too big
2142 (RuntimeMethod::getOwnPropertySlot):
2143 * bindings/runtime_method.h:
2145 2007-04-22 Maciej Stachowiak <mjs@apple.com>
2149 - discard the arguments List for an ActivationImp when the corresponding Context is destroyed (1.7% speedup)
2150 http://bugs.webkit.org/show_bug.cgi?id=13385
2152 Based an idea by Christopher E. Hyde <C.Hyde@parableuk.force9.co.uk>. His patch to do
2153 this also had many other List changes and I found this much simpler subset of the changes
2154 was actually a hair faster.
2156 This optimization is valid because the arguments list is only kept around to
2157 lazily make the arguments object. If it's not made by the time the function
2158 exits, it never will be, since any function that captures the continuation will
2159 have its own local arguments variable in scope.
2161 Besides the 1.7% speed improvement, it shrinks List by 4 bytes
2162 (which in turn shrinks ActivationImp by 4 bytes).
2165 (KJS::Context::~Context): Clear the activation's arguments list.
2167 (KJS::ActivationImp::ActivationImp): Adjusted for list changes.
2168 (KJS::ActivationImp::mark): No need to mark, lists are always protected (this doesn't
2169 cause a ref-cycle for reasons stated above).
2170 (KJS::ActivationImp::createArgumentsObject): Clear arguments list.
2173 (KJS::List::List): No more needsMarking boolean
2174 (KJS::List::operator=): ditto
2176 (KJS::List::List): ditto
2177 (KJS::List::reset): ditto
2178 (KJS::List::deref): ditto
2180 2007-04-22 Maciej Stachowiak <mjs@apple.com>
2184 - shrink PropertyMap by 8 bytes and therefore shrink CELL_SIZE to 40 (for 32-bit;
2185 similar shrinkage for 64-bit)
2186 http://bugs.webkit.org/show_bug.cgi?id=13384
2188 Inspired by similar changes by Christopher E. Hyde <C.Hyde@parableuk.force9.co.uk>
2189 done in the kjs-tweaks branch of KDE's kjs. However, this version is somewhat
2190 cleaner style-wise and avoids some of the negative speed impact (at least on gcc/x86)
2193 This is nearly a wash performance-wise, maybe a slight slowdown, but worth doing
2194 to eventually reach cell size 32.
2196 * kjs/collector.cpp:
2198 * kjs/property_map.cpp:
2199 (KJS::PropertyMap::~PropertyMap):
2200 (KJS::PropertyMap::clear):
2201 (KJS::PropertyMap::get):
2202 (KJS::PropertyMap::getLocation):
2203 (KJS::PropertyMap::put):
2204 (KJS::PropertyMap::insert):
2205 (KJS::PropertyMap::expand):
2206 (KJS::PropertyMap::rehash):
2207 (KJS::PropertyMap::remove):
2208 (KJS::PropertyMap::mark):
2209 (KJS::PropertyMap::containsGettersOrSetters):
2210 (KJS::PropertyMap::getEnumerablePropertyNames):
2211 (KJS::PropertyMap::getSparseArrayPropertyNames):
2212 (KJS::PropertyMap::save):
2213 (KJS::PropertyMap::checkConsistency):
2214 * kjs/property_map.h:
2215 (KJS::PropertyMap::hasGetterSetterProperties):
2216 (KJS::PropertyMap::setHasGetterSetterProperties):
2217 (KJS::PropertyMap::):
2218 (KJS::PropertyMap::PropertyMap):
2220 2007-04-22 Maciej Stachowiak <mjs@apple.com>
2224 - change blocks to 64k in size, and use various platform-specific calls to allocate at 64k-aligned addresses
2225 http://bugs.webkit.org/show_bug.cgi?id=13383
2227 * kjs/collector.cpp:
2228 (KJS::allocateBlock): New function to allocate 64k of 64k-aligned memory
2229 (KJS::freeBlock): Corresponding free
2230 (KJS::Collector::allocate):
2231 (KJS::Collector::collect):
2233 2007-04-22 Maciej Stachowiak <mjs@apple.com>
2235 Reviewed by Darin and Geoff.
2237 - remove the concept of oversize objects, now that there aren't any (for now
2238 only enforced with an assert).
2239 http://bugs.webkit.org/show_bug.cgi?id=13382
2241 This change is a .66% speedup on JS iBench for 32-bit platforms, probably much more
2242 for 64-bit since it finally gives a reasonable cell size, but I did not test that.
2244 * kjs/collector.cpp:
2245 (KJS::): Use different cell size for 32-bit and 64-bit, now that there is no
2246 oversize allocation.
2247 (KJS::Collector::allocate): Remove oversize allocator.
2248 (KJS::Collector::markStackObjectsConservatively): Don't check oversize objects.
2249 (KJS::Collector::markMainThreadOnlyObjects): Ditto.
2250 (KJS::Collector::collect): Ditto.
2252 2007-04-21 Mitz Pettel <mitz@webkit.org>
2256 - fix http://bugs.webkit.org/show_bug.cgi?id=13428
2257 REGRESSION (r20973-r20976): Failing ecma/Array/15.4.4.5-3.js
2259 - fix http://bugs.webkit.org/show_bug.cgi?id=13429
2260 REGRESSION (r20973-r20976): Crashing in fast/dom/plugin-attributes-enumeration.html
2262 * kjs/array_object.cpp:
2263 (ArrayInstance::sort): Free the old storage, not the new one.
2265 2007-04-20 Maciej Stachowiak <mjs@apple.com>
2267 Not reviewed, build fix.
2269 - fix build problem with last change - -O3 complains more about uninitialized variables
2271 * pcre/pcre_compile.c:
2275 2007-04-20 Maciej Stachowiak <mjs@apple.com>
2279 - <rdar://problem/5149915> use mergesort when possible, since it leads to fewer compares (2% JS iBench speedup)
2281 * kjs/array_object.cpp:
2282 (ArrayInstance::sort): Use mergesort(3) on platforms that have it, since it tends
2283 to do fewer compares than qsort; but avoid it very on large arrays since it uses extra
2284 memory. Also added comments identifying possibly even better sorting algorithms
2285 for sort by string value and sort by compare function.
2288 2007-04-20 Maciej Stachowiak <mjs@apple.com>
2292 - bump optimization flags up to -O3 for 1% JS iBench speed improvement
2294 * Configurations/Base.xcconfig:
2296 2007-04-20 Mark Rowe <mrowe@apple.com>
2300 Fix bogus optimisation in the generic pthread code path.
2302 * kjs/collector.cpp:
2303 (KJS::currentThreadStackBase):
2305 2007-04-20 Mark Rowe <mrowe@apple.com>
2309 Improve FreeBSD compatibility, as suggested by Alexander Botero-Lowry.
2311 * kjs/collector.cpp:
2312 (KJS::currentThreadStackBase): FreeBSD requires that pthread_attr_t's are
2313 initialized via pthread_attr_init before being used in any context.
2315 2007-04-19 Mark Rowe <mrowe@apple.com>
2319 Fix http://bugs.webkit.org/show_bug.cgi?id=13401
2320 Bug 13401: Reproducible crash calling myArray.sort(compareFn) from within
2321 a sort comparison function
2323 * kjs/array_object.cpp:
2324 (ArrayInstance::sort): Save/restore the static variables around calls to qsort
2325 to ensure nested calls to ArrayInstance::sort behave correctly.
2327 2007-04-12 Deneb Meketa <dmeketa@adobe.com>
2329 Reviewed by Darin Adler.
2331 http://bugs.webkit.org/show_bug.cgi?id=13029
2332 rdar://problem/4994849
2333 Bug 13029: Permit NPAPI plug-ins to see HTTP response headers.
2334 This doesn't actually change JavaScriptCore, but that's where npapi.h is.
2337 Add headers member to NPStream struct. Also increase NP_VERSION_MINOR to 18.
2338 Increasing to >= 17 allows plug-ins to safely detect whether to look for
2339 NPStream::headers. Increasing from 17 to 18 reflects presence of NPObject
2340 enumeration, which was added in a prior patch, and which has been agreed to
2341 constitute version 18 by the plugin-futures list. Also add other missing
2342 bits of npapi.h to catch up from 14 to 18. This includes features that are
2343 not implemented in WebKit, but those are safely stubbed.
2345 2007-04-10 Geoffrey Garen <ggaren@apple.com>
2347 Reviewed by Mark Rowe.
2349 Fixed last check-in to print in release builds, too.
2351 * kjs/collector.cpp:
2352 (KJS::getPlatformThreadRegisters):
2354 2007-04-10 Geoffrey Garen <ggaren@apple.com>
2356 Reviewed by John Sullivan, Darin Adler.
2358 Fixed <rdar://problem/5121899> JavaScript garbage collection leads to
2359 later crash under Rosetta (should abort or leak instead?)
2361 Log an error message and crash if the kernel reports failure during GC.
2362 We decided to do this instead of just leaking because we don't want people
2363 to get the mistaken impression that running in Rosetta is a supported
2366 The CRASH macro will also hook into CrashReporter, which will tell us if
2367 many (any?) users run into this issue.
2369 * kjs/collector.cpp:
2370 (KJS::getPlatformThreadRegisters):
2372 2007-04-06 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
2376 Coverity fix. Coverity says:
2377 "Event var_deref_model: Variable "sourceRanges" tracked as NULL was passed to a
2378 function that dereferences it"
2380 * kjs/string_object.cpp:
2383 2007-04-06 Geoffrey Garen <ggaren@apple.com>
2385 Rubber stamped by Adele Peterson.
2387 * kjs/ExecState.h: Removed obsolete forward/friend declaration of
2390 2007-04-05 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
2394 Coverity fix. Coverity says:
2395 "Event check_after_deref: Pointer "dateString" dereferenced before NULL check"
2397 * kjs/date_object.cpp:
2400 2007-04-05 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
2404 Coverity fix. Coverity says:
2405 "Event check_after_deref: Pointer "re" dereferenced before NULL check"
2407 * pcre/pcre_study.c:
2410 2007-04-05 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
2414 Coverity fixes. Coverity says:
2415 "Event leaked_storage: Returned without freeing storage "buffer""
2417 "Event leaked_storage: Returned without freeing storage "script""
2421 (createStringWithContentsOfFile):
2423 2007-04-05 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
2427 Coverity fix: in single-threaded case currentThreadIsMainThread is always true
2428 so the code in if (!currentThreadIsMainThread) cannot possibly be reached
2429 and Coverity complains about dead code.
2431 * kjs/collector.cpp:
2432 (KJS::Collector::collect):
2434 === Safari-5522.6 ===
2436 2007-04-03 Kevin McCullough <kmccullough@apple.com>
2440 - Testing a post-commit hook.
2442 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
2444 2007-04-03 Anders Carlsson <andersca@apple.com>
2448 <rdar://problem/5107534>
2449 http://bugs.webkit.org/show_bug.cgi?id=13265
2450 REGRESSION: Crash in KJS::Bindings::convertValueToNPVariant
2452 * bindings/NP_jsobject.cpp:
2453 (_NPN_InvokeDefault):
2454 Return false if the object isn't a function. Set the return value to undefined by default
2457 2007-03-30 Anders Carlsson <andersca@apple.com>
2461 * bindings/NP_jsobject.cpp:
2464 2007-03-30 Anders Carlsson <andersca@apple.com>
2468 Implement _NPN_Enumerate support.
2470 * JavaScriptCore.exp:
2471 * bindings/NP_jsobject.cpp:
2473 * bindings/c/c_instance.cpp:
2474 (KJS::Bindings::CInstance::getPropertyNames):
2475 * bindings/c/c_instance.h:
2477 * bindings/npruntime.h:
2478 * bindings/npruntime_impl.h:
2479 * bindings/runtime.h:
2480 (KJS::Bindings::Instance::getPropertyNames):
2481 * bindings/runtime_object.cpp:
2482 (RuntimeObjectImp::getPropertyNames):
2483 * bindings/runtime_object.h:
2484 (KJS::RuntimeObjectImp::getInternalInstance):
2486 2007-03-28 Jeff Walden <jwalden+code@mit.edu>
2490 http://bugs.webkit.org/show_bug.cgi?id=12963
2491 Fix some inconsistencies in the Mozilla JS Array extras implementations
2492 with respect to the Mozilla implementation:
2494 - holes in arrays should be skipped, not treated as undefined,
2496 - an element with value undefined is not a hole
2497 - Array.prototype.forEach should return undefined
2499 * kjs/array_object.cpp:
2500 (ArrayInstance::getOwnPropertySlot):
2501 (ArrayProtoFunc::callAsFunction):
2503 2007-03-27 Anders Carlsson <acarlsson@apple.com>
2507 * bindings/NP_jsobject.cpp:
2508 (_NPN_InvokeDefault):
2509 Call JSObject:call for native JavaScript objects.
2511 2007-03-26 David Carson <dacarson@gmail.com>
2513 Reviewed by Darin, landed by Anders.
2515 Fix for: REGRESSION (r19559): Java applet crash
2516 http://bugs.webkit.org/show_bug.cgi?id=13142
2517 <rdar://problem/5080340>
2519 The previous fix http://bugs.webkit.org/show_bug.cgi?id=12636
2520 introduced new JNIType to enum in jni_utility.h This is a
2521 problem on the Mac as it seems that the JNIType enum is also
2522 used in the JVM, it is used to specify the return type in
2524 Corrected the fix by moving type to the end, and changing
2525 jni_objc.mm to convert the new type to an old compatible
2528 * bindings/jni/jni_objc.mm:
2529 (KJS::Bindings::dispatchJNICall):
2530 * bindings/jni/jni_utility.h:
2532 2007-03-26 Christopher Brichford <chrisb@adobe.com>
2534 Reviewed/landed by Adam.
2536 Bug 13198: Move build settings from project file to xcconfig file for apollo
2538 http://bugs.webkit.org/show_bug.cgi?id=13198
2540 - Moving build settings from xcode project file to xcconfig files.
2542 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Debug.xcconfig:
2543 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Release.xcconfig:
2544 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcconfig:
2545 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
2547 2007-03-26 Brady Eidson <beidson@apple.com>
2549 Rubberstamped by Anders and Maciej aand Geoff (oh my!)
2551 Since CFTypeRef is really void*, a RetainPtr couldn't be used.
2552 RefType was "void", which doesn't actually exist as a type.
2553 Since RefType only existed for operator*(), and since that operator
2554 doesn't make any sense for RetainPtr, I removed them!
2556 * kjs/nodes.cpp: Touch this to force a rebuild and (hopefully) help the
2557 compiler with dependencies
2558 * wtf/RetainPtr.h: Nuke RefType and operator*()
2560 2007-03-26 Geoffrey Garen <ggaren@apple.com>
2562 Touched a file to (hopefully) help the compiler with RetainPtr dependencies.
2567 2007-03-24 Brady Eidson <beidson@apple.com>
2571 Whoops, RetainPtr should be in the WTF namespace
2575 2007-03-24 Brady Eidson <beidson@apple.com>
2579 <rdar://problem/5086210> - Move RetainPtr to WTF
2581 * wtf/RetainPtr.h: Added
2582 * JavaScriptCore.xcodeproj/project.pbxproj: Add it to the project file
2583 * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto
2586 2007-03-23 Christopher Brichford <chrisb@adobe.com>
2588 Reviewed/landed by Adam.
2590 Bug 13175: Make apollo mac project files for JavaScriptCore actually
2592 http://bugs.webkit.org/show_bug.cgi?id=13175
2594 - Changing apollo mac project files for JavaScriptCore such that they actually build
2595 JavaScriptCore source code.
2597 * JavaScriptCore.apolloproj/ForwardingSources/grammar.cpp: Added.
2598 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcconfig:
2599 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
2601 2007-03-24 Mark Rowe <mrowe@apple.com>
2603 Rubber-stamped by Darin.
2605 * Configurations/JavaScriptCore.xcconfig: Remove unnecessary INFOPLIST_PREPROCESS.
2607 2007-03-22 Christopher Brichford <chrisb@adobe.com>
2609 Reviewed/landed by Adam.
2611 Bug 13164: Initial version of mac JavaScriptCore project files for
2613 http://bugs.webkit.org/show_bug.cgi?id=13164
2615 - Adding mac project files for apollo port of JavaScriptCore. Currently project
2616 just builds dftables.
2618 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Debug.xcconfig: Added.
2619 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Release.xcconfig: Added.
2620 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcconfig: Added.
2621 * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: Added.
2623 2007-03-21 Timothy Hatcher <timothy@apple.com>
2627 <rdar://problem/5076599> JavaScriptCore has a weak export (vtable for KJS::JSCell)
2629 * JavaScriptCore.exp: Remove __ZTVN3KJS6JSCellE.
2631 2007-03-21 Adele Peterson <adele@apple.com>
2635 * API/JSStringRef.cpp: (JSStringIsEqual): Added JSLock.
2637 2007-03-21 Zack Rusin <zrusin@trolltech.com>
2639 Fix the compile when USE(MULTIPLE_THREADS) isn't
2643 (KJS::JSLock::currentThreadIsHoldingLock):
2645 2007-03-20 Maciej Stachowiak <mjs@apple.com>
2647 Reviewed by Geoff and Adam.
2649 - make USE(MULTIPLE_THREADS) support more portable
2650 http://bugs.webkit.org/show_bug.cgi?id=13069
2652 - fixed a threadsafety bug discovered by testing this
2654 - enhanced threadsafety assertions in collector
2656 * API/JSCallbackObject.cpp:
2657 (KJS::JSCallbackObject::~JSCallbackObject): This destructor can't
2658 DropAllLocks around the finalize callback, because it gets called
2659 from garbage collection and we can't let other threads collect!
2661 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2663 (KJS::JSLock::currentThreadIsHoldingLock): Added new function
2664 to allow stronger assertions than just that the lock is held
2665 by some thread (you can now assert that the current thread is
2666 holding it, given the new JSLock design).
2668 * kjs/collector.cpp: Refactored for portability plus added some
2669 stronger assertions.
2670 (KJS::Collector::allocate):
2671 (KJS::currentThreadStackBase):
2672 (KJS::Collector::registerAsMainThread):
2673 (KJS::onMainThread):
2674 (KJS::PlatformThread::PlatformThread):
2675 (KJS::getCurrentPlatformThread):
2676 (KJS::Collector::Thread::Thread):
2677 (KJS::destroyRegisteredThread):
2678 (KJS::Collector::registerThread):
2679 (KJS::Collector::markCurrentThreadConservatively):
2680 (KJS::suspendThread):
2681 (KJS::resumeThread):
2682 (KJS::getPlatformThreadRegisters):
2683 (KJS::otherThreadStackPointer):
2684 (KJS::otherThreadStackBase):
2685 (KJS::Collector::markOtherThreadConservatively):
2686 (KJS::Collector::markStackObjectsConservatively):
2687 (KJS::Collector::protect):
2688 (KJS::Collector::unprotect):
2689 (KJS::Collector::collectOnMainThreadOnly):
2690 (KJS::Collector::markMainThreadOnlyObjects):
2691 (KJS::Collector::collect):
2693 * wtf/FastMalloc.cpp:
2694 (WTF::fastMallocSetIsMultiThreaded):
2695 * wtf/FastMallocInternal.h:
2698 2007-03-19 Darin Adler <darin@apple.com>
2700 * kjs/value.h: Roll ~JSValue change out. It was causing problems. I'll do it right later.
2702 2007-03-19 Geoffrey Garen <ggaren@apple.com>
2704 Reviewed by John Sullivan.
2706 Fixed <rdar://problem/5073380> REGRESSION: Crash occurs at WTF::fastFree()
2707 when reloading liveconnect page (applet)
2709 Best to use free when you use malloc, especially when malloc and delete
2710 use completely different libraries.
2712 * bindings/jni/jni_runtime.cpp:
2713 (JavaMethod::~JavaMethod):
2715 2007-03-19 Andrew Wellington <proton@wiretapped.net>
2719 Really set Xcode editor to use 4 space indentation (http://webkit.org/coding/coding-style.html)
2721 * JavaScriptCore.xcodeproj/project.pbxproj:
2723 2007-03-19 Darin Adler <darin@apple.com>
2727 - Changed list size threshold to 5 based on testing.
2729 I was testing the i-Bench JavaScript with the list statistics
2730 dumping on, and discovered that there were many 5-element lists.
2731 The fast case for lists was for 4 elements and fewer. By changing
2732 the threshold to 5 elements we get a measurable speedup. I believe
2733 this will help real web pages too, not just the benchmark.
2735 * kjs/list.cpp: Change constant from 4 to 5.
2737 2007-03-19 Darin Adler <darin@apple.com>
2739 * kjs/value.h: Oops, fix build.
2741 2007-03-19 Darin Adler <darin@apple.com>
2745 - remove ~JSValue; tiny low-risk performance boost
2747 * kjs/value.h: Remove unneeded empty virtual destructor from JSValue.
2748 The only class derived from JSValue is JSCell and it already has a
2749 virtual destructor. Declaring an empty constructor in JSValue had one
2750 good effect: it marked the destructor private, making it a compile
2751 time error to try to destroy a JSValue; but that's not a likely
2752 mistake for someone to make. It had two bad effects: (1) it caused gcc,
2753 at least, to generate code to fix up the virtual table pointer to
2754 point to the JSValue version of the virtual table inside the destructor
2755 of all classes derived from JSValue directly or indirectly; (2) it
2756 caused JSValue to be a polymorphic class so required a virtual table for
2757 it. It's cleaner to not have either of those.
2759 2007-03-18 Maciej Stachowiak <mjs@apple.com>
2763 - avoid static construction (and global variable access) in a smarter, more portable way,
2764 to later enable MUTLI_THREAD mode to work on other platforms and compilers.
2766 * kjs/CommonIdentifiers.cpp: Added. New class to hold all the shared identifiers.
2767 (KJS::CommonIdentifiers::CommonIdentifiers):
2768 (KJS::CommonIdentifiers::shared):
2769 * kjs/CommonIdentifiers.h: Added.
2772 (KJS::ExecState::propertyNames): Hand the CommonIdentifiers instance here for easy access.
2773 (KJS::ExecState::ExecState):
2775 * API/JSObjectRef.cpp:
2776 (JSObjectMakeConstructor):
2778 * JavaScriptCore.exp:
2779 * JavaScriptCore.pri:
2780 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2781 * JavaScriptCore.xcodeproj/project.pbxproj:
2782 * JavaScriptCoreSources.bkl:
2783 * bindings/runtime_array.cpp:
2784 (RuntimeArray::getOwnPropertySlot):
2785 (RuntimeArray::put):
2786 * bindings/runtime_method.cpp:
2787 (RuntimeMethod::getOwnPropertySlot):
2788 * kjs/array_object.cpp:
2789 (ArrayInstance::getOwnPropertySlot):
2790 (ArrayInstance::put):
2791 (ArrayInstance::deleteProperty):
2792 (ArrayProtoFunc::ArrayProtoFunc):
2793 (ArrayProtoFunc::callAsFunction):
2794 (ArrayObjectImp::ArrayObjectImp):
2795 * kjs/bool_object.cpp:
2796 (BooleanPrototype::BooleanPrototype):
2797 (BooleanProtoFunc::BooleanProtoFunc):
2798 (BooleanProtoFunc::callAsFunction):
2799 (BooleanObjectImp::BooleanObjectImp):
2801 (KJS::Completion::Completion):
2802 * kjs/date_object.cpp:
2803 (KJS::DateProtoFunc::DateProtoFunc):
2804 (KJS::DateObjectImp::DateObjectImp):
2805 (KJS::DateObjectFuncImp::DateObjectFuncImp):
2806 * kjs/error_object.cpp:
2807 (ErrorPrototype::ErrorPrototype):
2808 (ErrorProtoFunc::ErrorProtoFunc):
2809 (ErrorProtoFunc::callAsFunction):
2810 (ErrorObjectImp::ErrorObjectImp):
2811 (ErrorObjectImp::construct):
2812 (NativeErrorPrototype::NativeErrorPrototype):
2813 (NativeErrorImp::NativeErrorImp):
2814 (NativeErrorImp::construct):
2815 (NativeErrorImp::callAsFunction):
2817 (KJS::FunctionImp::getOwnPropertySlot):
2818 (KJS::FunctionImp::put):
2819 (KJS::FunctionImp::deleteProperty):
2820 (KJS::FunctionImp::getParameterName):
2821 (KJS::DeclaredFunctionImp::construct):
2822 (KJS::IndexToNameMap::unMap):
2823 (KJS::Arguments::Arguments):
2824 (KJS::ActivationImp::getOwnPropertySlot):
2825 (KJS::ActivationImp::deleteProperty):
2826 (KJS::GlobalFuncImp::GlobalFuncImp):
2827 * kjs/function_object.cpp:
2828 (FunctionPrototype::FunctionPrototype):
2829 (FunctionProtoFunc::FunctionProtoFunc):
2830 (FunctionProtoFunc::callAsFunction):
2831 (FunctionObjectImp::FunctionObjectImp):
2832 (FunctionObjectImp::construct):
2834 * kjs/identifier.cpp:
2836 * kjs/interpreter.cpp:
2837 (KJS::Interpreter::init):
2838 (KJS::Interpreter::initGlobalObject):
2839 * kjs/interpreter.h:
2841 * kjs/math_object.cpp:
2842 (MathFuncImp::MathFuncImp):
2844 (ArrayNode::evaluate):
2845 (FuncDeclNode::processFuncDecl):
2846 (FuncExprNode::evaluate):
2847 * kjs/number_object.cpp:
2848 (NumberPrototype::NumberPrototype):
2849 (NumberProtoFunc::NumberProtoFunc):
2850 (NumberObjectImp::NumberObjectImp):
2852 (KJS::JSObject::put):
2853 (KJS::JSObject::defaultValue):
2854 (KJS::JSObject::hasInstance):
2856 (KJS::JSObject::getOwnPropertySlot):
2857 * kjs/object_object.cpp:
2858 (ObjectPrototype::ObjectPrototype):
2859 (ObjectProtoFunc::ObjectProtoFunc):
2860 (ObjectObjectImp::ObjectObjectImp):
2861 * kjs/regexp_object.cpp:
2862 (RegExpPrototype::RegExpPrototype):
2863 (RegExpProtoFunc::RegExpProtoFunc):
2864 (RegExpObjectImp::RegExpObjectImp):
2865 * kjs/string_object.cpp:
2866 (KJS::StringInstance::getOwnPropertySlot):
2867 (KJS::StringInstance::put):
2868 (KJS::StringInstance::deleteProperty):
2869 (KJS::StringPrototype::StringPrototype):
2870 (KJS::StringProtoFunc::StringProtoFunc):
2871 (KJS::StringProtoFunc::callAsFunction):
2872 (KJS::StringObjectImp::StringObjectImp):
2873 (KJS::StringObjectFuncImp::StringObjectFuncImp):
2875 (TestFunctionImp::TestFunctionImp):
2877 2007-03-18 Andrew Wellington <proton@wiretapped.net>
2879 Reviewed by Mark Rowe
2881 Set Xcode editor to use 4 space indentation (http://webkit.org/coding/coding-style.html)
2883 * JavaScriptCore.xcodeproj/project.pbxproj:
2885 2007-03-19 Mark Rowe <mrowe@apple.com>
2887 Rubber-stamped by Brady.
2889 Update references to bugzilla.opendarwin.org with bugs.webkit.org.
2891 * bindings/c/c_utility.cpp:
2892 (KJS::Bindings::convertUTF8ToUTF16):
2894 (KJS::FunctionImp::callAsFunction):
2896 * kjs/keywords.table:
2898 (KJS::Lexer::shift):
2900 2007-03-18 Geoffrey Garen <ggaren@apple.com>
2902 Reviewed by Oliver Hunt.
2904 Exposed some extra toUInt32 functionality, as part of the fix for
2905 REGRESSION: Incomplete document.all implementation breaks abtelectronics.com
2906 (Style Change Through JavaScript Blanks Content)
2908 * JavaScriptCore.exp:
2910 (KJS::Identifier::toUInt32):
2912 2007-03-18 Geoffrey Garen <ggaren@apple.com>
2914 Removed duplicate export name.
2916 * JavaScriptCore.exp:
2918 2007-03-15 Geoffrey Garen <ggaren@apple.com>
2920 Reviewed by Maciej Stachowiak.
2922 Fixed <rdar://problem/5064964> Repro ASSERT failure in JS Bindings when
2923 closing window @ lowtrades.bptrade.com
2925 Unfortunately, the bindings depend on UString and Identifier as string
2926 representations. So, they need to acquire the JSLock when doing something
2927 that will ref/deref their strings.
2929 Layout tests, the original site, and Java, Flash, and Quicktime on the
2930 web work. No leaks reported. No automated test for this because testing
2931 the Java bindings, like math, is hard.
2933 * bindings/runtime.h: Made Noncopyable, just to be sure.
2935 * bindings/c/c_class.cpp:
2936 (KJS::Bindings::CClass::~CClass): Acquire the JSLock and explicitly clear the keys
2937 in our hashtable, since they're UString::Reps, and ref/deref aren't thread-safe.
2938 (KJS::Bindings::CClass::methodsNamed): Also acquire the JSLock when adding
2939 keys to the table, since the table ref's them.
2940 (KJS::Bindings::CClass::fieldNamed): ditto.
2942 * bindings/c/c_utility.cpp: Removed dead function.
2943 (KJS::Bindings::convertValueToNPVariant): Acquire the JSLock because doing
2944 it recursively is pretty cheap, and it's just too confusing to tell whether
2945 all our callers do it for us.
2946 (KJS::Bindings::convertNPVariantToValue): ditto
2947 * bindings/c/c_utility.h:
2949 * bindings/jni/jni_class.cpp: Same deal as c_class.cpp.
2950 (JavaClass::JavaClass):
2951 (JavaClass::~JavaClass):
2953 * bindings/jni/jni_instance.cpp: Same deal as c_utility.cpp.
2954 (JavaInstance::stringValue):
2955 * bindings/jni/jni_jsobject.cpp:
2956 (JavaJSObject::convertValueToJObject):
2958 * bindings/jni/jni_runtime.cpp:
2959 (JavaMethod::~JavaMethod): Moved from header, for clarity.
2960 (appendClassName): Made this static, so the set of callers is known, and
2961 we can assert that we hold the JSLock. Also changed it to take a UString
2962 reference, which makes the calling code simpler.
2963 (JavaMethod::signature): Store the ASCII value we care about instead of
2964 a UString, since UString is so much more hassle. Hold the JSLock while
2965 building up the temporary UString.
2967 * bindings/jni/jni_runtime.h: Nixed dead code in JavaMethod.
2968 (KJS::Bindings::JavaString::JavaString): Hold a UString::Rep instead of
2969 a UString, so we can acquire the JSLock and explicitly release it.
2970 (KJS::Bindings::JavaString::_commonInit):
2971 (KJS::Bindings::JavaString::~JavaString):
2972 (KJS::Bindings::JavaString::UTF8String):
2973 (KJS::Bindings::JavaString::uchars):
2974 (KJS::Bindings::JavaString::length):
2975 (KJS::Bindings::JavaString::ustring):
2977 * bindings/jni/jni_utility.cpp:
2978 (KJS::Bindings::convertArrayInstanceToJavaArray): Made this static, so
2979 the set of callers is known, and we can assert that we hold the JSLock.
2980 (KJS::Bindings::convertValueToJValue): Acquire the JSLock because doing
2981 it recursively is pretty cheap, and it's just too confusing to tell whether
2982 all our callers do it for us.
2984 * bindings/objc/objc_runtime.h: Nixed some dead code.
2985 * bindings/objc/objc_utility.mm:
2986 (KJS::Bindings::convertNSStringToString): Same drill as above.
2988 2007-03-18 Alexey Proskuryakov <ap@webkit.org>
2992 http://bugs.webkit.org/show_bug.cgi?id=13105
2993 REGRESSION: an exception raised when calculating base value of a dot expression is not returned
2995 Test: fast/js/dot-node-base-exception.html
2998 (FunctionCallDotNode::evaluate): Added the necessary KJS_CHECKEXCEPTIONVALUE.
3000 2007-03-18 Steve Falkenburg <sfalken@apple.com>
3004 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
3006 2007-03-17 Timothy Hatcher <timothy@apple.com>
3008 Reviewed by Mark Rowe.
3010 Made Version.xcconfig smarter when building for different configurations.
3011 Now uses the 522+ OpenSource version for Debug and Release, while using the
3012 full 522.4 version for Production builds. The system prefix is also computed
3013 based on the current system, so 4522.4 on Tiger and 5522.4 on Leopard.
3015 * Configurations/JavaScriptCore.xcconfig:
3016 * Configurations/Version.xcconfig:
3018 2007-03-15 Maciej Stachowiak <mjs@apple.com>
3024 * wtf/TCSystemAlloc.cpp:
3026 2007-03-15 Maciej Stachowiak <mjs@apple.com>
3028 Reviewed by Geoff and Steve.
3030 - fix some portability issues with TCMalloc.
3032 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
3034 * wtf/FastMalloc.cpp:
3036 (WTF::InitSizeClasses):
3037 (WTF::TCMalloc_PageHeap::Split):
3038 (WTF::TCMalloc_PageHeap::RegisterSizeClass):
3039 (WTF::TCMalloc_Central_FreeList::length):
3040 (WTF::TCMalloc_ThreadCache::InitTSD):
3041 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
3043 * wtf/TCSystemAlloc.cpp:
3045 (TCMalloc_SystemAlloc):
3047 2007-03-15 Timothy Hatcher <timothy@apple.com>
3051 * Factored out most of our common build settings into .xcconfig files. Anything that was common in
3052 each build configuration was factored out into the shared .xcconfig file.
3053 * Adds a Version.xcconfig file to define the current framework version, to be used in other places.
3054 * Use the new $(BUNDLE_VERSION) (defined in Version.xcconfig) in the preprocessed Info.plist.
3055 * Use the versions defined in Version.xcconfig to set $(DYLIB_CURRENT_VERSION).
3057 * Configurations/Base.xcconfig: Added.
3058 * Configurations/DebugRelease.xcconfig: Added.
3059 * Configurations/JavaScriptCore.xcconfig: Added.
3060 * Configurations/Version.xcconfig: Added.
3062 * JavaScriptCore.xcodeproj/project.pbxproj:
3064 2007-03-16 Shrikant Gangoda <shrikant.gangoda@celunite.com>
3068 * kjs/DateMath.cpp: gettimeofday comes from <sys/time.h> on Linux.
3070 2007-03-14 Kevin McCullough <kmccullough@apple.com>
3074 - Fixed one more build breakage
3076 * kjs/date_object.cpp:
3077 (KJS::formatLocaleDate):
3079 2007-03-14 Kevin McCullough <kmccullough@apple.com>
3083 - Fixed a build breakage.
3086 * kjs/date_object.cpp:
3087 (KJS::formatLocaleDate):
3088 (KJS::DateObjectImp::construct):
3090 2007-03-14 Kevin McCullough <kmccullough@apple.com>
3094 - rdar://problem/5045720
3095 - DST changes in US affect JavaScript date calculations (12975)
3096 This fix was to ensure we properly test for the new changes to DST in the US.
3097 Also this fixes when we apply DST, now we correctly map most past years to current
3098 DST rules. We still have a small issue with years before 1900 or after 2100.
3099 rdar://problem/5055038
3101 * kjs/DateMath.cpp: Fix DST to match spec better.
3102 (KJS::getCurrentUTCTime):
3103 (KJS::mimimumYearForDST):
3104 (KJS::maximumYearForDST):
3105 (KJS::equivalentYearForDST):
3106 (KJS::getDSTOffset):
3107 * kjs/DateMath.h: Consolodated common funtionality.
3108 * kjs/date_object.cpp: Consolodated common functionality.
3109 (KJS::formatLocaleDate):
3110 (KJS::DateObjectImp::construct):
3111 * tests/mozilla/ecma/jsref.js: Added functions for finding the correct days when DST starts and ends.
3112 * tests/mozilla/ecma/shell.js: Added back in the old DST functions for ease of merging with mozilla if needed.
3113 * tests/mozilla/ecma_2/jsref.js: Added functions for finding the correct days when DST starts and ends.
3114 * tests/mozilla/ecma_3/Date/shell.js: Added functions for finding the correct days when DST starts and ends.
3115 * tests/mozilla/expected.html: Updated to show all date tests passing.
3117 === Safari-5522.4 ===
3119 2007-03-13 Kevin McCullough <kmccullough@apple.com>
3123 - Adding expected failures until the are truly fixed.
3124 - rdar://problem/5060302
3126 * tests/mozilla/expected.html:
3128 2007-03-12 Kevin McCullough <kmccullough@apple.com>
3132 - Actually update tests for new DST rules.
3134 * tests/mozilla/ecma/Date/15.9.3.1-1.js:
3135 * tests/mozilla/ecma/Date/15.9.3.1-2.js:
3136 * tests/mozilla/ecma/Date/15.9.3.1-3.js:
3137 * tests/mozilla/ecma/Date/15.9.3.1-4.js:
3138 * tests/mozilla/ecma/Date/15.9.3.1-5.js:
3139 * tests/mozilla/ecma/Date/15.9.3.2-1.js:
3140 * tests/mozilla/ecma/Date/15.9.3.2-2.js:
3141 * tests/mozilla/ecma/Date/15.9.3.2-3.js:
3142 * tests/mozilla/ecma/Date/15.9.3.2-4.js:
3143 * tests/mozilla/ecma/Date/15.9.3.2-5.js:
3144 * tests/mozilla/ecma/Date/15.9.3.8-1.js:
3145 * tests/mozilla/ecma/Date/15.9.3.8-2.js:
3146 * tests/mozilla/ecma/Date/15.9.3.8-3.js:
3147 * tests/mozilla/ecma/Date/15.9.3.8-4.js:
3148 * tests/mozilla/ecma/Date/15.9.3.8-5.js:
3149 * tests/mozilla/ecma/Date/15.9.5.10-1.js:
3150 * tests/mozilla/ecma/Date/15.9.5.10-10.js:
3151 * tests/mozilla/ecma/Date/15.9.5.10-11.js:
3152 * tests/mozilla/ecma/Date/15.9.5.10-12.js:
3153 * tests/mozilla/ecma/Date/15.9.5.10-13.js:
3154 * tests/mozilla/ecma/Date/15.9.5.10-2.js:
3155 * tests/mozilla/ecma/Date/15.9.5.10-3.js:
3156 * tests/mozilla/ecma/Date/15.9.5.10-4.js:
3157 * tests/mozilla/ecma/Date/15.9.5.10-5.js:
3158 * tests/mozilla/ecma/Date/15.9.5.10-6.js:
3159 * tests/mozilla/ecma/Date/15.9.5.10-7.js:
3160 * tests/mozilla/ecma/Date/15.9.5.10-8.js:
3161 * tests/mozilla/ecma/Date/15.9.5.10-9.js:
3162 * tests/mozilla/ecma/jsref.js:
3163 * tests/mozilla/ecma_2/jsref.js:
3164 * tests/mozilla/ecma_3/Date/shell.js:
3166 2007-03-12 Kevin McCullough <kmccullough@apple.com>
3170 - Update tests for new DST rules.
3172 * tests/mozilla/ecma/shell.js:
3174 2007-03-11 Geoffrey Garen <ggaren@apple.com>
3176 Reviewed by Oliver Hunt.
3178 Fixed <rdar://problem/4681051> Installer crashes in KJS::Collector::
3179 markOtherThreadConservatively(KJS::Collector::Thread*) trying to install
3180 iLife 06 using Rosetta on an Intel Machine
3182 The problem was that our thread-specific data destructor would modify the
3183 list of active JavaScript threads without holding the JSLock, corrupting
3184 the list. Corruption was especially likely if one JavaScript thread exited
3185 while another was starting up.
3187 * JavaScriptCore.exp:
3188 * kjs/JSLock.cpp: Don't conflate locking the JSLock with registering a
3189 thread, since the thread-specific data destructor needs to lock
3190 without registering a thread. Instead, treat thread registration as a
3191 part of the convenience of the JSLock object, and whittle down JSLock::lock()
3192 to just the bits that actually do the locking.
3193 (KJS::JSLock::lock):
3194 (KJS::JSLock::registerThread):
3195 * kjs/JSLock.h: Updated comments to mention the new behavior above, and
3196 other recent changes.
3197 (KJS::JSLock::JSLock):
3198 * kjs/collector.cpp:
3199 (KJS::destroyRegisteredThread): Lock here.
3200 (KJS::Collector::registerThread): To match, assert that we're locked here.
3202 2007-03-10 Geoffrey Garen <ggaren@apple.com>
3204 Reviewed by Darin Adler.
3206 Fixed <rdar://problem/4587763> PAC file: lock inversion between QT and
3207 JSCore causes a hang @ www.panoramas.dk
3209 With a PAC file, run-webkit-tests --threaded passes, the reported site
3210 works, and all the Quicktime/JavaScript and Flash/JavaScript examples
3211 I found through Google work, too.
3213 Any time JavaScript causes arbitrary non-JavaScript code to execute, it
3214 risks deadlock, because that code may block, trying to acquire a lock
3215 owned by a thread that is waiting to execute JavaScript. In this case,
3216 the thread was a networking thread that was waiting to interpret a PAC file.
3218 Because non-JavaScript code may execute in response to, well, anything,
3219 a perfect solution to this problem is impossible. I've implemented an
3220 optimistic solution, instead: JavaScript will drop its lock whenever it
3221 makes a direct call to non-JavaScript code through a bridging/plug-in API,
3222 but will blissfully ignore the indirect ways it may cause non-JavaScript
3223 code to run (resizing a window, for example).
3225 Unfortunately, this solution introduces significant locking overhead in
3226 the bridging APIs. I don't see a way around that.
3228 This patch includes some distinct bug fixes I saw along the way:
3230 * bindings/objc/objc_instance.mm: Fixed a bug where a nested begin() call
3231 would leak its autorelease pool, because it would NULL out _pool without
3234 * bindings/runtime_object.cpp:
3235 (RuntimeObjectImp::methodGetter): Don't copy an Identifier to ASCII only
3236 to turn around and make an Identifier from the ASCII. In an earlier
3237 version of this patch, the copy caused an assertion failure. Now it's
3238 just unnecessary work.
3239 (RuntimeObjectImp::getOwnPropertySlot): ditto
3241 * bindings/objc/objc_instance.h: Removed overrides of setVAlueOfField and
3242 getValueOfField, because they did exactly what the base class versions did.
3243 Removed overrides of Noncopyable declarations for the same reason.
3245 * bindings/runtime.h: Inherit from Noncopyable instead of rolling our own.
3246 * bindings/c/c_instance.h: ditto
3248 And the actual patch:
3250 * API/JSCallbackConstructor.cpp: Drop all locks when calling out to C.
3251 (KJS::JSCallbackConstructor::construct):
3252 * API/JSCallbackFunction.cpp: ditto
3253 (KJS::JSCallbackFunction::callAsFunction):
3254 * API/JSCallbackObject.cpp: ditto
3255 (KJS::JSCallbackObject::init):
3256 (KJS::JSCallbackObject::~JSCallbackObject):
3257 (KJS::JSCallbackObject::getOwnPropertySlot):
3258 (KJS::JSCallbackObject::put):
3259 (KJS::JSCallbackObject::deleteProperty):
3260 (KJS::JSCallbackObject::construct):
3261 (KJS::JSCallbackObject::hasInstance):
3262 (KJS::JSCallbackObject::callAsFunction):
3263 (KJS::JSCallbackObject::getPropertyNames):
3264 (KJS::JSCallbackObject::toNumber):
3265 (KJS::JSCallbackObject::toString):
3266 (KJS::JSCallbackObject::staticValueGetter):
3267 (KJS::JSCallbackObject::callbackGetter):
3269 * bindings/c/c_instance.cpp: Drop all locks when calling out to C.
3270 (KJS::Bindings::CInstance::invokeMethod):
3271 (KJS::Bindings::CInstance::invokeDefaultMethod):
3272 * bindings/c/c_runtime.cpp: Drop all locks when calling out to C.
3273 (KJS::Bindings::CField::valueFromInstance):
3274 (KJS::Bindings::CField::setValueToInstance):
3275 * bindings/jni/jni_objc.mm:
3276 (KJS::Bindings::dispatchJNICall): Drop all locks when calling out to Java.
3278 * bindings/objc/objc_instance.mm: The changes here are to accomodate the
3279 fact that C++ unwinding of DropAllLocks goes crazy when you put it inside
3280 a @try block. I moved all JavaScript stuff outside of the @try blocks, and
3281 then prefixed the whole blocks with DropAllLocks objects. This required some
3282 supporting changes in other functions, which now acquire the JSLock for
3283 themselves, intead of relying on their callers to do so.
3284 (ObjcInstance::end):
3285 (ObjcInstance::invokeMethod):
3286 (ObjcInstance::invokeDefaultMethod):
3287 (ObjcInstance::setValueOfUndefinedField):
3288 (ObjcInstance::getValueOfUndefinedField):
3289 * bindings/objc/objc_runtime.mm: Same as above, except I didn't want to
3290 change throwError to acquire the JSLock for itself.
3291 (ObjcField::valueFromInstance):
3292 (ObjcField::setValueToInstance):
3293 * bindings/objc/objc_utility.mm: Supporting changes mentioned above.
3294 (KJS::Bindings::convertValueToObjcValue):
3295 (KJS::Bindings::convertObjcValueToValue):
3298 (1) Fixed DropAllLocks to behave as advertised, and drop the JSLock only
3299 if the current thread actually acquired it in the first place. This is
3300 important because WebKit needs to ensure that the JSLock has been
3301 dropped before it makes a plug-in call, even though it doesn't know if
3302 the current thread actually acquired the JSLock. (We don't want WebKit
3303 to accidentally drop a lock belonging to *another thread*.)
3304 (2) Used the new per-thread code written for (1) to make recursive calls
3305 to JSLock very cheap. JSLock now knows to call pthread_mutext_lock/
3306 pthread_mutext_unlock only at nesting level 0.
3307 (KJS::createDidLockJSMutex):
3308 (KJS::JSLock::lock):
3309 (KJS::JSLock::unlock):
3310 (KJS::DropAllLocks::DropAllLocks):
3311 (KJS::DropAllLocks::~DropAllLocks):
3312 (KJS::JSLock::lockCount):
3313 * kjs/JSLock.h: Don't duplicate Noncopyable.
3314 (KJS::JSLock::~JSLock):
3316 * wtf/Assertions.h: Blind attempt at helping the Windows build.
3318 2007-03-08 MorganL <morganl.webkit@yahoo.com>
3322 http://bugs.webkit.org/show_bug.cgi?id=13018
3323 Bug 13018: allow embedders to override the definition of CRASH.
3325 * wtf/Assertions.h: make it possible to override CRASH.
3327 2007-03-07 Anrong Hu <huanr@yahoo.com>
3331 Fix http://bugs.webkit.org/show_bug.cgi?id=12535
3332 Bug 12535: Stack-optimizing compilers can trick GC into freeing in-use objects
3335 (KJS::StringImp::toObject): Copy val onto the stack so it is not subject to garbage collection.
3337 2007-03-07 Geoffrey Garen <ggaren@apple.com>
3339 Build fix for non-multiple-thread folks.
3341 Use a shared global in the non-multiple-thread case.
3343 * wtf/FastMalloc.cpp:
3345 (WTF::fastMallocForbid):
3346 (WTF::fastMallocAllow):
3348 2007-03-07 Geoffrey Garen <ggaren@apple.com>
3350 Reviewed by Darin Adler.
3352 Fixed ASSERT failure I just introduced.
3354 Made the fastMalloc isForbidden flag per thread. (Oops!) We expect that
3355 other threads will malloc while we're marking -- we just want to prevent
3356 our own marking from malloc'ing.
3358 * wtf/FastMalloc.cpp:
3359 (WTF::initializeIsForbiddenKey):
3361 (WTF::fastMallocForbid):
3362 (WTF::fastMallocAllow):
3369 2007-03-07 Shrikant Gangoda <shrikant.gangoda@celunite.com>
3373 http://bugs.webkit.org/show_bug.cgi?id=12997
3375 Wrap pthread-specific assertion in #if USE(MULTIPLE_THREADS).
3377 * kjs/collector.cpp:
3378 (KJS::Collector::markMainThreadOnlyObjects):
3380 2007-03-06 Geoffrey Garen <ggaren@apple.com>
3382 Reviewed by Maciej Stachowiak.
3384 Fixed <rdar://problem/4576242> | http://bugs.webkit.org/show_bug.cgi?id=12586
3385 PAC file: malloc deadlock sometimes causes a hang @ www.apple.com/pro/profiles/ (12586)
3387 This is a modified version of r14752 on the branch.
3389 These changes just add debugging functionality. They ASSERT that we don't
3390 malloc during the mark phase of a garbage collection, which can cause a
3393 * kjs/collector.cpp:
3394 (KJS::Collector::collect):
3395 * wtf/FastMalloc.cpp:
3396 (WTF::fastMallocForbid):
3397 (WTF::fastMallocAllow):
3405 2007-03-06 Geoffrey Garen <ggaren@apple.com>
3407 Reviewed by Maciej Stachowiak.
3409 Fixed all known crashers exposed by run-webkit-tests --threaded. This covers:
3411 <rdar://problem/4565394> | http://bugs.webkit.org/show_bug.cgi?id=12585
3412 PAC file: after closing a window that contains macworld.com, new window
3413 crashes (KJS::PropertyMap::mark()) (12585)
3414 <rdar://problem/4571215> | http://bugs.webkit.org/show_bug.cgi?id=9211
3415 PAC file: Crash occurs when clicking on the navigation tabs at http://www.businessweek.com/ (9211)
3416 <rdar://problem/4557926>
3417 PAC file: Crash occurs when attempting to view image in slideshow mode
3418 at http://d.smugmug.com/gallery/581716 ( KJS::IfNode::execute (KJS::
3419 ExecState*) + 312) if you use a PAC file
3421 (1) Added some missing JSLocks, along with related ASSERTs.
3423 (2) Fully implemented support for objects that can only be garbage collected
3424 on the main thread. So far, only WebCore uses this. We can add it to API
3425 later if we learn that it's needed.
3427 The implementation uses a "main thread only" flag inside each object. When
3428 collecting on a secondary thread, the Collector does an extra pass through
3429 the heap to mark all flagged objects before sweeping. This solution makes
3430 the common case -- flag lots of objects, but never collect on a secondary
3431 thread -- very fast, even though the uncommon case of garbage collecting
3432 on a secondary thread isn't as fast as it could be. I left some notes
3433 about how to speed it up, if we ever care.
3435 For posterity, here are some things I learned about GC while investigating:
3437 * Each collect must either mark or delete every heap object. "Zombie"
3438 objects, which are neither marked nor deleted, raise these issues:
3440 * On the next pass, the conservative marking algorithm might mark a
3441 zombie, causing it to mark freed objects.
3443 * The client might try to use a zombie, which would seem live because
3444 its finalizer had not yet run.
3446 * A collect on the main thread is free to delete any object. Presumably,
3447 objects allocated on secondary threads have thread-safe finalizers.
3449 * A collect on a secondary thread must not delete thread-unsafe objects.
3451 * The mark function must be thread-safe.
3453 Line by line comments:
3455 * API/JSObjectRef.h: Added comment specifying that the finalize callback
3456 may run on any thread.
3458 * JavaScriptCore.exp: Nothing to see here.
3460 * bindings/npruntime.cpp:
3461 (_NPN_GetStringIdentifier): Added JSLock.
3463 * bindings/objc/objc_instance.h:
3464 * bindings/objc/objc_instance.mm:
3465 (ObjcInstance::~ObjcInstance): Use an autorelease pool. The other callers
3466 to CFRelease needed one, too, but they were dead code, so I removed them
3467 instead. (This fixes a leak seen while running run-webkit-tests --threaded,
3468 although I don't think it's specifically a threading issue.)
3470 * kjs/collector.cpp:
3471 (KJS::Collector::collectOnMainThreadOnly): New function. Tells the collector
3472 to collect a value only if it's collecting on the main thread.
3473 (KJS::Collector::markMainThreadOnlyObjects): New function. Scans the heap
3474 for "main thread only" objects and marks them.
3476 * kjs/date_object.cpp:
3477 (KJS::DateObjectImp::DateObjectImp): To make the new ASSERTs happy, allocate
3478 our globals on the heap, avoiding a seemingly unsafe destructor call at
3480 * kjs/function_object.cpp:
3481 (FunctionPrototype::FunctionPrototype): ditto
3483 * kjs/interpreter.cpp:
3484 (KJS::Interpreter::mark): Removed boolean parameter, which was an incomplete
3485 and arguably hackish way to implement markMainThreadOnlyObjects() inside WebCore.
3486 * kjs/interpreter.h:
3488 * kjs/identifier.cpp:
3489 (KJS::identifierTable): Added some ASSERTs to check for thread safety
3492 * kjs/list.cpp: Added some ASSERTs to check for thread safety problems.
3493 (KJS::allocateListImp):
3494 (KJS::List::release):
3495 (KJS::List::append):
3496 (KJS::List::empty): Make the new ASSERTs happy.
3499 (KJS::JSObject::JSObject): "m_destructorIsThreadSafe" => "m_collectOnMainThreadOnly".
3500 I removed the constructor parameter because m_collectOnMainThreadOnly,
3501 like m_marked, is a Collector bit, so only the Collector should set or get it.
3503 * kjs/object_object.cpp:
3504 (ObjectPrototype::ObjectPrototype): Make the ASSERTs happy.
3505 * kjs/regexp_object.cpp: