ChangeLog 811 KB
Newer Older
1
2
3
4
5
6
2007-03-16  Shrikant Gangoda  <shrikant.gangoda@celunite.com>

        Gdk build fix.

        * kjs/DateMath.cpp:  gettimeofday comes from <sys/time.h> on Linux.

kmccullo's avatar
kmccullo committed
7
8
9
10
11
12
13
14
15
2007-03-14  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by .

        - Fixed one more build breakage

        * kjs/date_object.cpp:
        (KJS::formatLocaleDate):

kmccullo's avatar
kmccullo committed
16
17
18
19
20
21
22
23
24
25
26
2007-03-14  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by .

        - Fixed a build breakage.

        * kjs/DateMath.cpp:
        * kjs/date_object.cpp:
        (KJS::formatLocaleDate):
        (KJS::DateObjectImp::construct):

kmccullo's avatar
kmccullo committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
2007-03-14  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by Geoff.

        - rdar://problem/5045720
        - DST changes in US affect JavaScript date calculations (12975)
        This fix was to ensure we properly test for the new changes to DST in the US.
        Also this fixes when we apply DST, now we correctly map most past years to current
        DST rules.  We still have a small issue with years before 1900 or after 2100.
        rdar://problem/5055038

        * kjs/DateMath.cpp: Fix DST to match spec better.
        (KJS::getCurrentUTCTime):
        (KJS::mimimumYearForDST):
        (KJS::maximumYearForDST):
        (KJS::equivalentYearForDST):
        (KJS::getDSTOffset):
        * kjs/DateMath.h: Consolodated common funtionality.
        * kjs/date_object.cpp: Consolodated common functionality.
        (KJS::formatLocaleDate):
        (KJS::DateObjectImp::construct):
        * tests/mozilla/ecma/jsref.js: Added functions for finding the correct days when DST starts and ends.
        * tests/mozilla/ecma/shell.js: Added back in the old DST functions for ease of merging with mozilla if needed.
        * tests/mozilla/ecma_2/jsref.js: Added functions for finding the correct days when DST starts and ends.
        * tests/mozilla/ecma_3/Date/shell.js: Added functions for finding the correct days when DST starts and ends.
        * tests/mozilla/expected.html: Updated to show all date tests passing.

kmccullo's avatar
kmccullo committed
54
55
56
57
58
59
60
61
62
2007-03-13  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by .

        - Adding expected failures until the are truly fixed. 
        - rdar://problem/5060302

        * tests/mozilla/expected.html:

kmccullo's avatar
kmccullo committed
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
2007-03-12  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by .

        - Actually update tests for new DST rules.

        * tests/mozilla/ecma/Date/15.9.3.1-1.js:
        * tests/mozilla/ecma/Date/15.9.3.1-2.js:
        * tests/mozilla/ecma/Date/15.9.3.1-3.js:
        * tests/mozilla/ecma/Date/15.9.3.1-4.js:
        * tests/mozilla/ecma/Date/15.9.3.1-5.js:
        * tests/mozilla/ecma/Date/15.9.3.2-1.js:
        * tests/mozilla/ecma/Date/15.9.3.2-2.js:
        * tests/mozilla/ecma/Date/15.9.3.2-3.js:
        * tests/mozilla/ecma/Date/15.9.3.2-4.js:
        * tests/mozilla/ecma/Date/15.9.3.2-5.js:
        * tests/mozilla/ecma/Date/15.9.3.8-1.js:
        * tests/mozilla/ecma/Date/15.9.3.8-2.js:
        * tests/mozilla/ecma/Date/15.9.3.8-3.js:
        * tests/mozilla/ecma/Date/15.9.3.8-4.js:
        * tests/mozilla/ecma/Date/15.9.3.8-5.js:
        * tests/mozilla/ecma/Date/15.9.5.10-1.js:
        * tests/mozilla/ecma/Date/15.9.5.10-10.js:
        * tests/mozilla/ecma/Date/15.9.5.10-11.js:
        * tests/mozilla/ecma/Date/15.9.5.10-12.js:
        * tests/mozilla/ecma/Date/15.9.5.10-13.js:
        * tests/mozilla/ecma/Date/15.9.5.10-2.js:
        * tests/mozilla/ecma/Date/15.9.5.10-3.js:
        * tests/mozilla/ecma/Date/15.9.5.10-4.js:
        * tests/mozilla/ecma/Date/15.9.5.10-5.js:
        * tests/mozilla/ecma/Date/15.9.5.10-6.js:
        * tests/mozilla/ecma/Date/15.9.5.10-7.js:
        * tests/mozilla/ecma/Date/15.9.5.10-8.js:
        * tests/mozilla/ecma/Date/15.9.5.10-9.js:
        * tests/mozilla/ecma/jsref.js:
        * tests/mozilla/ecma_2/jsref.js:
        * tests/mozilla/ecma_3/Date/shell.js:

kmccullo's avatar
kmccullo committed
101
102
103
104
105
106
107
108
2007-03-12  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by .

        - Update tests for new DST rules.

        * tests/mozilla/ecma/shell.js:

ggaren's avatar
ggaren committed
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
2007-03-11  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Oliver Hunt.
        
        Fixed <rdar://problem/4681051> Installer crashes in KJS::Collector::
        markOtherThreadConservatively(KJS::Collector::Thread*) trying to install 
        iLife 06 using Rosetta on an Intel Machine
        
        The problem was that our thread-specific data destructor would modify the
        list of active JavaScript threads without holding the JSLock, corrupting
        the list. Corruption was especially likely if one JavaScript thread exited 
        while another was starting up.

        * JavaScriptCore.exp:
        * kjs/JSLock.cpp: Don't conflate locking the JSLock with registering a
        thread, since the thread-specific data destructor needs to lock
        without registering a thread. Instead, treat thread registration as a
        part of the convenience of the JSLock object, and whittle down JSLock::lock()
        to just the bits that actually do the locking.
        (KJS::JSLock::lock):
        (KJS::JSLock::registerThread):
        * kjs/JSLock.h: Updated comments to mention the new behavior above, and
        other recent changes.
        (KJS::JSLock::JSLock):
        * kjs/collector.cpp:
        (KJS::destroyRegisteredThread): Lock here.
        (KJS::Collector::registerThread): To match, assert that we're locked here.

ggaren's avatar
ggaren committed
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
2007-03-10  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Darin Adler.

        Fixed <rdar://problem/4587763> PAC file: lock inversion between QT and 
        JSCore causes a hang @ www.panoramas.dk
        
        With a PAC file, run-webkit-tests --threaded passes, the reported site
        works, and all the Quicktime/JavaScript and Flash/JavaScript examples
        I found through Google work, too.
        
        Any time JavaScript causes arbitrary non-JavaScript code to execute, it 
        risks deadlock, because that code may block, trying to acquire a lock 
        owned by a thread that is waiting to execute JavaScript. In this case,
        the thread was a networking thread that was waiting to interpret a PAC file.
        
        Because non-JavaScript code may execute in response to, well, anything,
        a perfect solution to this problem is impossible. I've implemented an
        optimistic solution, instead: JavaScript will drop its lock whenever it
        makes a direct call to non-JavaScript code through a bridging/plug-in API,
        but will blissfully ignore the indirect ways it may cause non-JavaScript 
        code to run (resizing a window, for example). 
        
        Unfortunately, this solution introduces significant locking overhead in 
        the bridging APIs. I don't see a way around that.

        This patch includes some distinct bug fixes I saw along the way:
        
        * bindings/objc/objc_instance.mm: Fixed a bug where a nested begin() call
        would leak its autorelease pool, because it would NULL out _pool without
        draining it.

        * bindings/runtime_object.cpp:
        (RuntimeObjectImp::methodGetter): Don't copy an Identifier to ASCII only
        to turn around and make an Identifier from the ASCII. In an earlier 
        version of this patch, the copy caused an assertion failure. Now it's 
        just unnecessary work.
        (RuntimeObjectImp::getOwnPropertySlot): ditto

        * bindings/objc/objc_instance.h: Removed overrides of setVAlueOfField and
        getValueOfField, because they did exactly what the base class versions did.
        Removed overrides of Noncopyable declarations for the same reason.

        * bindings/runtime.h: Inherit from Noncopyable instead of rolling our own.
        * bindings/c/c_instance.h: ditto

        And the actual patch:
        
        * API/JSCallbackConstructor.cpp: Drop all locks when calling out to C.
        (KJS::JSCallbackConstructor::construct):
        * API/JSCallbackFunction.cpp: ditto
        (KJS::JSCallbackFunction::callAsFunction):
        * API/JSCallbackObject.cpp: ditto
        (KJS::JSCallbackObject::init):
        (KJS::JSCallbackObject::~JSCallbackObject):
        (KJS::JSCallbackObject::getOwnPropertySlot):
        (KJS::JSCallbackObject::put):
        (KJS::JSCallbackObject::deleteProperty):
        (KJS::JSCallbackObject::construct):
        (KJS::JSCallbackObject::hasInstance):
        (KJS::JSCallbackObject::callAsFunction):
        (KJS::JSCallbackObject::getPropertyNames):
        (KJS::JSCallbackObject::toNumber):
        (KJS::JSCallbackObject::toString):
        (KJS::JSCallbackObject::staticValueGetter):
        (KJS::JSCallbackObject::callbackGetter):
        
        * bindings/c/c_instance.cpp: Drop all locks when calling out to C.
        (KJS::Bindings::CInstance::invokeMethod):
        (KJS::Bindings::CInstance::invokeDefaultMethod):
        * bindings/c/c_runtime.cpp: Drop all locks when calling out to C.
        (KJS::Bindings::CField::valueFromInstance):
        (KJS::Bindings::CField::setValueToInstance):
        * bindings/jni/jni_objc.mm:
        (KJS::Bindings::dispatchJNICall): Drop all locks when calling out to Java.

        * bindings/objc/objc_instance.mm: The changes here are to accomodate the
        fact that C++ unwinding of DropAllLocks goes crazy when you put it inside
        a @try block. I moved all JavaScript stuff outside of the @try blocks, and 
        then prefixed the whole blocks with DropAllLocks objects. This required some
        supporting changes in other functions, which now acquire the JSLock for
        themselves, intead of relying on their callers to do so.
        (ObjcInstance::end):
        (ObjcInstance::invokeMethod):
        (ObjcInstance::invokeDefaultMethod):
        (ObjcInstance::setValueOfUndefinedField):
        (ObjcInstance::getValueOfUndefinedField):
        * bindings/objc/objc_runtime.mm: Same as above, except I didn't want to
        change throwError to acquire the JSLock for itself.
        (ObjcField::valueFromInstance):
        (ObjcField::setValueToInstance):
        * bindings/objc/objc_utility.mm: Supporting changes mentioned above.
        (KJS::Bindings::convertValueToObjcValue):
        (KJS::Bindings::convertObjcValueToValue):

        * kjs/JSLock.cpp: 
        (1) Fixed DropAllLocks to behave as advertised, and drop the JSLock only 
        if the current thread actually acquired it in the first place. This is 
        important because WebKit needs to ensure that the JSLock has been 
        dropped before it makes a plug-in call, even though it doesn't know if 
        the current thread actually acquired the JSLock. (We don't want WebKit
        to accidentally drop a lock belonging to *another thread*.)
        (2) Used the new per-thread code written for (1) to make recursive calls
        to JSLock very cheap. JSLock now knows to call pthread_mutext_lock/ 
        pthread_mutext_unlock only at nesting level 0.
        (KJS::createDidLockJSMutex):
        (KJS::JSLock::lock):
        (KJS::JSLock::unlock):
        (KJS::DropAllLocks::DropAllLocks):
        (KJS::DropAllLocks::~DropAllLocks):
        (KJS::JSLock::lockCount):
        * kjs/JSLock.h: Don't duplicate Noncopyable.
        (KJS::JSLock::~JSLock):

        * wtf/Assertions.h: Blind attempt at helping the Windows build.

253
254
255
256
257
258
259
260
261
2007-03-08  MorganL  <morganl.webkit@yahoo.com>

        Reviewed by Darin.

        http://bugs.webkit.org/show_bug.cgi?id=13018
        Bug 13018: allow embedders to override the definition of CRASH.

        * wtf/Assertions.h: make it possible to override CRASH.

bdash's avatar
bdash committed
262
263
264
265
266
267
268
269
270
271
2007-03-07  Anrong Hu  <huanr@yahoo.com>

        Reviewed by Maciej.

        Fix http://bugs.webkit.org/show_bug.cgi?id=12535
        Bug 12535: Stack-optimizing compilers can trick GC into freeing in-use objects

        * kjs/internal.cpp:
        (KJS::StringImp::toObject): Copy val onto the stack so it is not subject to garbage collection.

272
273
274
275
276
277
278
279
280
281
282
2007-03-07  Geoffrey Garen  <ggaren@apple.com>

        Build fix for non-multiple-thread folks.
        
        Use a shared global in the non-multiple-thread case.

        * wtf/FastMalloc.cpp:
        (WTF::isForbidden):
        (WTF::fastMallocForbid):
        (WTF::fastMallocAllow):

ggaren's avatar
ggaren committed
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
2007-03-07  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Darin Adler.
        
        Fixed ASSERT failure I just introduced.
        
        Made the fastMalloc isForbidden flag per thread. (Oops!) We expect that
        other threads will malloc while we're marking -- we just want to prevent
        our own marking from malloc'ing.

        * wtf/FastMalloc.cpp:
        (WTF::initializeIsForbiddenKey):
        (WTF::isForbidden):
        (WTF::fastMallocForbid):
        (WTF::fastMallocAllow):
        (WTF::fastMalloc):
        (WTF::fastCalloc):
        (WTF::fastFree):
        (WTF::fastRealloc):
        (WTF::do_malloc):

304
305
306
307
308
309
310
311
312
313
314
2007-03-07  Shrikant Gangoda  <shrikant.gangoda@celunite.com>

        Reviewed by Maciej.

        http://bugs.webkit.org/show_bug.cgi?id=12997

        Wrap pthread-specific assertion in #if USE(MULTIPLE_THREADS).

        * kjs/collector.cpp:
        (KJS::Collector::markMainThreadOnlyObjects):

ggaren's avatar
ggaren committed
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
2007-03-06  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Maciej Stachowiak.
        
        Fixed <rdar://problem/4576242> | http://bugs.webkit.org/show_bug.cgi?id=12586
        PAC file: malloc deadlock sometimes causes a hang @ www.apple.com/pro/profiles/ (12586)
        
        This is a modified version of r14752 on the branch.
        
        These changes just add debugging functionality. They ASSERT that we don't 
        malloc during the mark phase of a garbage collection, which can cause a
        deadlock.

        * kjs/collector.cpp:
        (KJS::Collector::collect):
        * wtf/FastMalloc.cpp:
        (WTF::fastMallocForbid):
        (WTF::fastMallocAllow):
        (WTF::fastMalloc):
        (WTF::fastCalloc):
        (WTF::fastFree):
        (WTF::fastRealloc):
        (WTF::do_malloc):
        * wtf/FastMalloc.h:

ggaren's avatar
ggaren committed
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
2007-03-06  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Maciej Stachowiak.
        
        Fixed all known crashers exposed by run-webkit-tests --threaded. This covers:

        <rdar://problem/4565394> | http://bugs.webkit.org/show_bug.cgi?id=12585 
            PAC file: after closing a window that contains macworld.com, new window 
            crashes (KJS::PropertyMap::mark()) (12585)
        <rdar://problem/4571215> | http://bugs.webkit.org/show_bug.cgi?id=9211
            PAC file: Crash occurs when clicking on the navigation tabs at http://www.businessweek.com/ (9211)
        <rdar://problem/4557926> 
            PAC file: Crash occurs when attempting to view image in slideshow mode 
            at http://d.smugmug.com/gallery/581716 ( KJS::IfNode::execute (KJS::
            ExecState*) + 312) if you use a PAC file

        (1) Added some missing JSLocks, along with related ASSERTs.
        
        (2) Fully implemented support for objects that can only be garbage collected
        on the main thread. So far, only WebCore uses this. We can add it to API
        later if we learn that it's needed. 
        
        The implementation uses a "main thread only" flag inside each object. When 
        collecting on a secondary thread, the Collector does an extra pass through 
        the heap to mark all flagged objects before sweeping. This solution makes
        the common case -- flag lots of objects, but never collect on a secondary 
        thread -- very fast, even though the uncommon case of garbage collecting
        on a secondary thread isn't as fast as it could be. I left some notes 
        about how to speed it up, if we ever care.
        
        For posterity, here are some things I learned about GC while investigating:
        
        * Each collect must either mark or delete every heap object. "Zombie" 
        objects, which are neither marked nor deleted, raise these issues:

            * On the next pass, the conservative marking algorithm might mark a 
            zombie, causing it to mark freed objects.

            * The client might try to use a zombie, which would seem live because 
            its finalizer had not yet run.

        * A collect on the main thread is free to delete any object. Presumably, 
        objects allocated on secondary threads have thread-safe finalizers.

        * A collect on a secondary thread must not delete thread-unsafe objects.

        * The mark function must be thread-safe.
        
        Line by line comments:

        * API/JSObjectRef.h: Added comment specifying that the finalize callback 
        may run on any thread.

        * JavaScriptCore.exp: Nothing to see here.

        * bindings/npruntime.cpp:
        (_NPN_GetStringIdentifier): Added JSLock.

        * bindings/objc/objc_instance.h:
        * bindings/objc/objc_instance.mm:
        (ObjcInstance::~ObjcInstance): Use an autorelease pool. The other callers 
        to CFRelease needed one, too, but they were dead code, so I removed them 
        instead. (This fixes a leak seen while running run-webkit-tests --threaded,
        although I don't think it's specifically a threading issue.) 
        
        * kjs/collector.cpp:
        (KJS::Collector::collectOnMainThreadOnly): New function. Tells the collector
        to collect a value only if it's collecting on the main thread.
        (KJS::Collector::markMainThreadOnlyObjects): New function. Scans the heap
        for "main thread only" objects and marks them.

        * kjs/date_object.cpp: 
        (KJS::DateObjectImp::DateObjectImp): To make the new ASSERTs happy, allocate 
        our globals on the heap, avoiding a seemingly unsafe destructor call at 
        program exit time.
        * kjs/function_object.cpp:
        (FunctionPrototype::FunctionPrototype): ditto

        * kjs/interpreter.cpp:
        (KJS::Interpreter::mark): Removed boolean parameter, which was an incomplete
        and arguably hackish way to implement markMainThreadOnlyObjects() inside WebCore.
        * kjs/interpreter.h:

        * kjs/identifier.cpp:
        (KJS::identifierTable): Added some ASSERTs to check for thread safety 
        problems.

        * kjs/list.cpp: Added some ASSERTs to check for thread safety problems.
        (KJS::allocateListImp):
        (KJS::List::release):
        (KJS::List::append):
        (KJS::List::empty): Make the new ASSERTs happy.

        * kjs/object.h:
        (KJS::JSObject::JSObject): "m_destructorIsThreadSafe" => "m_collectOnMainThreadOnly".
        I removed the constructor parameter because m_collectOnMainThreadOnly,
        like m_marked, is a Collector bit, so only the Collector should set or get it.

        * kjs/object_object.cpp:
        (ObjectPrototype::ObjectPrototype): Make the ASSERTs happy.
        * kjs/regexp_object.cpp:
        (RegExpPrototype::RegExpPrototype): ditto

        * kjs/ustring.cpp: Added some ASSERTs to check for thread safety problems.
        (KJS::UCharReference::ref): 
        (KJS::UString::Rep::createCopying):
        (KJS::UString::Rep::create):
        (KJS::UString::Rep::destroy):
        (KJS::UString::null): Make the new ASSERTs happy.
        * kjs/ustring.h:
        (KJS::UString::Rep::ref): Added some ASSERTs to check for thread safety problems.
        (KJS::UString::Rep::deref):

        * kjs/value.h:
        (KJS::JSCell::JSCell):

ggaren's avatar
ggaren committed
456
457
458
459
460
461
462
463
464
465
466
467
2007-03-06  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Maciej Stachowiak.
        
        2% speedup on super accurate JS iBench.

        (KJS::Collector::collect): Removed anti-optimization to call
        pthread_is_threaded_np() before calling pthread_main_np(). Almost all 
        apps have more than one thread, so the extra call is actually worse.
        Interestingly, even the single-threaded testkjs shows a speed gain
        from removing the pthread_is_threaded_np() short-circuit. Not sure why.

ddkilzer's avatar
ddkilzer committed
468
469
470
471
472
473
474
475
476
477
2007-03-04  Don Gibson  <dgibson77@gmail.com>

        Reviewed by Nikolas Zimmermann.

        - fix http://bugs.webkit.org/show_bug.cgi?id=12950
          Assertions.cpp should not #define macros that are already defined

        * wtf/Assertions.cpp: Don't #define WINVER and _WIN32_WINNT if they
        are already defined.

478
479
480
481
482
483
484
485
486
2007-03-02  Steve Falkenburg  <sfalken@apple.com>

        Reviewed by Anders.
        
        Add unsigned int hash traits (matches existing unsigned long version)

        * wtf/HashTraits.h:
        (WTF::):

aroben's avatar
aroben committed
487
488
489
490
491
492
493
494
495
496
497
498
499
500
2007-03-02  Adam Roben  <aroben@apple.com>

        Reviewed by Kevin M.

        Try to fix the Qt build.

        * kjs/DateMath.cpp:
        (KJS::msToGregorianDateTime): Removed unnecessary "struct" keyword.
        * kjs/DateMath.h: Moved forward declarations to the top of the file
        before they are used.
        * kjs/date_object.cpp:
        (KJS::formatLocaleDate): Changed to take a const GregorianDateTime&
        since GregorianDateTime is Noncopyable.

darin's avatar
darin committed
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
2007-03-02  Darin Adler  <darin@apple.com>

        Reviewed by Kevin McCullough.

        - fix http://bugs.webkit.org/show_bug.cgi?id=12867
          REGRESSION: BenchJS test 7 (dates) is 220% slower than in Safari 2.0.4

        * kjs/DateMath.h: Marked GregorianDateTime as noncopyable, since it has a non-trivial
        destructor and not the correspoding copy constructor or assignment operator.
        Changed the GregorianDateTime constructor to use member initialization syntax.
        Fixed the destructor to use the array delete operator, since timeZone is an array.

        * kjs/DateMath.cpp:
        (KJS::daysInYear): Changed to call isLeapYear so the rule is not repeated twice.
        (KJS::getUTCOffset): Added caching on PLATFORM(DARWIN), since we can rely on the
        notify_check function and "com.apple.system.timezone" to let us know when the
        offset has changed.

ggaren's avatar
ggaren committed
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
2007-02-27  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Darin Adler.
        
        Follow-up to fixing http://bugs.webkit.org/show_bug.cgi?id=12659 | <rdar://problem/4954306>
        JS objects not collected after closing window @ ebay.com/maps.google.com
        
        Changed Interpreter cache of global constructors and prototypes from
        ProtectedPtrs to bare, marked pointers. ProtectedPtrs are inefficient,
        and they increase the risk of reference cycles. Also, Darin said something
        about ProtectedPtrs giving him warts.
        
        Also changed data members to precise types from generic JSObject*'s.
        
        Layout tests and JS tests pass.

        * kjs/SavedBuiltins.h:
        * kjs/interpreter.cpp:
        (KJS::Interpreter::init):
        (KJS::Interpreter::~Interpreter):
        (KJS::Interpreter::initGlobalObject): Moved Identifier::init() call to
        constructor, for clarity.
        (KJS::Interpreter::mark):
        * kjs/interpreter.h:

ggaren's avatar
ggaren committed
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
2007-02-27  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Maciej Stachowiak.
        
        Fixed http://bugs.webkit.org/show_bug.cgi?id=12659 | <rdar://problem/4954306>
        JS objects not collected after closing window @ ebay.com/maps.google.com

        Don't GC in the Interpreter destructor. For that to work, the Interpreter
        would have to NULL out all of its ProtectedPtrs before calling collect(). But 
        we've decided that we don't want things to work that way, anyway. We want the
        client to be in charge of manual GC so that it can optimize cases when
        it will be destroying many interpreters at once
        (e.g., http://bugs.webkit.org/show_bug.cgi?id=12900).
        
        Also removed Interpreter::collect() because it was redundant with 
        Collector::collect().

        * JavaScriptCore.exp:
        * kjs/interpreter.cpp:
        (KJS::Interpreter::~Interpreter):
        * kjs/testkjs.cpp:
        (TestFunctionImp::callAsFunction):

kjk's avatar
kjk committed
567
568
569
570
571
572
573
574
2007-02-26  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>

        Reviewed by Adam Roben.

        Rename *_SUPPORT defines to ENABLE_*.

        * jscore.bkl:

mjs's avatar
mjs committed
575
576
577
578
579
580
581
582
583
2007-02-26  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Lars.
        
        - <rdar://problem/5021698> Disable experimental SVG features (12883)

        * wtf/Platform.h: Add ENABLE() macro similar to HAVE() and USE(), to
        allow nicer handling of optional WebKit features.

staikos's avatar
staikos committed
584
585
586
587
588
589
590
591
592
593
2007-02-22  George Staikos  <staikos@kde.org>

        Reviewed by Lars.

        Add return values

        * wtf/unicode/qt4/UnicodeQt4.h:
        (WTF::Unicode::toLower):
        (WTF::Unicode::toUpper):

weinig's avatar
weinig committed
594
595
596
597
598
599
600
601
602
603
604
2007-02-22  Oscar Cwajbaum  <public@oscarc.net>

        Reviewed by Maciej.

        Fix ARM-specific alignment problem in FastMalloc
        http://bugs.webkit.org/show_bug.cgi?id=12841

        * wtf/FastMalloc.cpp:
        Modify how pageheap_memory is declared to ensure proper alignment
        on architectures such as ARM

605
606
607
608
609
610
611
612
613
614
615
2007-02-20  Zack Rusin  <zrusin@trolltech.com>

        Reviewed by Lars

        Make sure that non-void methods always return something.

        * wtf/unicode/qt4/UnicodeQt4.h:
        (WTF::Unicode::toLower):
        (WTF::Unicode::toUpper):
        (WTF::Unicode::foldCase):

616
617
618
619
620
621
622
623
624
625
626
627
2007-02-18  Kevin Ollivier  <kevino@theolliviers.com>

        Reviewed by Adam Roben.

        Fix cases where MSVC-specific code was identified as Win32 platform
        code. (as it should be compiled for e.g. wx port when using MSVC too)
        
        * wtf/Assertions.h: 
        * wtf/MathExtras.h:
        * wtf/StringExtras.h:
        changed PLATFORM(WIN) sections to COMPILER(MSVC) as necessary

kjk's avatar
kjk committed
628
629
630
631
632
633
634
635
636
637
2007-02-17  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>

        Reviewed by Adam Roben.

        Fix crashes on ARM due to different struct packing. Based on a patch
        by Mike Emmel.
        * kjs/ustring.cpp: compile-time assert to make sure sizeof(UChar) == 2
        * kjs/ustring.h: pack UChar struct to ensure that sizeof(UChar) == 2
        * wtf/Assertions.h: add COMPILE_ASSERT macro for compile-time assertions

staikos's avatar
staikos committed
638
639
640
641
642
643
644
645
646
2007-02-16  George Staikos  <staikos@kde.org>

        Reviewed by Maciej.

        Fix uninitialized variable

        * bindings/testbindings.cpp:
        (myAllocate):

andersca's avatar
andersca committed
647
648
649
650
651
652
653
654
655
656
657
658
659
2007-02-16  Anders Carlsson  <acarlsson@apple.com>

        Reviewed by Mitz.

        http://bugs.webkit.org/show_bug.cgi?id=12788
        REGRESSION: Going back one page in history has a noticeable delay
        
        Um...if all elements in two vectors are equal, then I guess we could say that
        the two vectors are equal too.
        
        * wtf/Vector.h:
        (WTF::):

andersca's avatar
andersca committed
660
661
662
663
664
665
666
667
668
669
670
671
672
673
2007-02-14  Anders Carlsson  <acarlsson@apple.com>

        Reviewed by Darin.

        Add new canCompareWithMemcmp vector trait and use it to determine whether
        operator== can use memcmp.
        
        * wtf/Vector.h:
        (WTF::):
        (WTF::VectorTypeOperations::compare):
        (WTF::operator==):
        * wtf/VectorTraits.h:
        (WTF::):

beidson's avatar
beidson committed
674
675
676
677
678
679
680
681
682
2007-02-13  Brady Eidson  <beidson@apple.com>

        Reviewed by Darin
        
        Tweaked vector a bit

        * wtf/Vector.h:
        (WTF::operator==):

darin's avatar
darin committed
683
684
685
686
687
688
689
690
691
692
693
694
2007-02-13  Dex Deacon  <occupant4@gmail.com>

        Reviewed by Darin.

        - fix for http://bugs.webkit.org/show_bug.cgi?id=12750
          Vector operator== was not defined correctly. It returned void,
          did not accept const Vectors, and used an int instead of size_t. 

        * wtf/Vector.h: fixed comparison operators
        (WTF::operator==):
        (WTF::operator!=):

ddkilzer's avatar
ddkilzer committed
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
2007-02-10  David Carson  <dacarson@gmail.com>

        Reviewed by Maciej.

        - fix for http://bugs.webkit.org/show_bug.cgi?id=12636
        Corrected the generation of method signatures when the parameter
        is an Array. 
        Added support for converting a Javascript array to a Java array.

        * bindings/jni/jni_utility.h: added new type for array, array_type
        * bindings/jni/jni_runtime.cpp: add support for new array type
        (JavaField::valueFromInstance):
        (JavaField::setValueToInstance):
        (JavaMethod::JavaMethod):
        (JavaMethod::signature):
        * bindings/jni/jni_utility.cpp: add support for new array type
        (KJS::Bindings::callJNIMethod):
        (KJS::Bindings::callJNIStaticMethod):
        (KJS::Bindings::callJNIMethodIDA):
        (KJS::Bindings::JNITypeFromClassName):
        (KJS::Bindings::signatureFromPrimitiveType):
        (KJS::Bindings::JNITypeFromPrimitiveType):
        (KJS::Bindings::getJNIField):
        (KJS::Bindings::convertArrayInstanceToJavaArray): new method
        converts the Javascript array to the requested Java array.
        (KJS::Bindings::convertValueToJValue):

andersca's avatar
andersca committed
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
2007-02-08  Anders Carlsson  <acarlsson@apple.com>

        Reviewed by Geoff.

        <rdar://problem/4930614>
        Safari complains about "Slow Script" if GMail is left open and machine is busy
        
        <rdar://problem/4649516>
        Turn off slow script dialog or crank up time that makes it come up
        
        <rdar://problem/4963589>
        Slow script warning is displayed after closing of PROMPT or PRINT dialog
        
        Re-do the way script timeouts are handled. No longer use a unix timer that sends signals. Instead, add a 
        tick count and increment it in loop bodies. If the tick count reaches a threshold, do a timeout check. If the total time executing
        is higher than the timeout value, (possibly) interrupt the script. The timeout checker also adjusts the threshold dynamically
        to prevent doing the timeout check too often.
         
        * JavaScriptCore.exp:
        Remove pause and resume calls.
        
        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
        Add winmm.lib.

        * kjs/interpreter.cpp:
        (KJS::Interpreter::init):
        (KJS::Interpreter::~Interpreter):
        (KJS::Interpreter::startTimeoutCheck):
        (KJS::Interpreter::stopTimeoutCheck):
        (KJS::Interpreter::resetTimeoutCheck):
        (KJS::getCurrentTime):
        (KJS::Interpreter::checkTimeout):
        * kjs/interpreter.h:
        (KJS::Interpreter::timedOut):
        * kjs/nodes.cpp:
        (DoWhileNode::execute):
        (WhileNode::execute):
        (ForNode::execute):

761
762
763
764
2007-02-07  Darin Adler  <darin@apple.com>

        * JavaScriptCore.vcproj/JavaScriptCore.sln: Reenable testkjs.

darin's avatar
darin committed
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
2007-02-07  Darin Adler  <darin@apple.com>

        Reviewed by Geoff.

        - another build fix; this time for sure

        * pcre/pcre_exec.c: (match):
        The compiler caught an incorrect use of the othercase variable across
        a call to RMATCH in character repeat processing. Local variables can
        change in the crazy NO_RECURSE mode that we use, so we instead need
        the value in othercase to be in one of the special stack frame variables.
        Added a new stack frame variable for this purpose named repeat_othercase.
        Also noted a similar error in the non-UTF-16 side of the #ifdef, but
        didn't try to fix that one. Also removed a SUPPORT_UCP #ifdef from the
        PCRE_UTF16 side; that code doesn't work without the Unicde properties
        table, and we don't try to use it that way.

782
783
784
785
786
787
2007-02-06  Steve Falkenburg  <sfalken@apple.com>

        Disable testkjs in sln until we figure out mysterious compiler warning.

        * JavaScriptCore.vcproj/JavaScriptCore.sln:

788
789
790
791
792
793
794
2007-02-06  Steve Falkenburg  <sfalken@apple.com>

        Build fix by ggaren

        * pcre/pcre_exec.c:
        (match):

darin's avatar
darin committed
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
2007-02-06  Darin Adler  <darin@apple.com>

        Reviewed by Geoff.

        - fix <rdar://problem/4979089> PCRE should avoid setjmp/longjmp even when compiler
          is not GCC

        Added a new code path that's slower and way uglier but doesn't rely on GCC's
        computed gotos.

        * pcre/pcre_exec.c: Added a numeric parameter to the RMATCH function. It must be
        different at every RMATCH call site. Changed the non-GCC NO_RECURSE version of
        the macro to use a label incorporating the number. Changed the RRETURN macro to
        use a goto instead of longjmp.
        (match): Added a different number at each callsite, using a perl script for the
        first-time task. Going forward it should be easy to maintain by hand. Added a
        switch statement at the bottom of the function. We'll get compile time errors
        if we have anything in the switch statement that's never used in an RMATCH,
        but errors in the other direction are silent except at runtime.

darin's avatar
darin committed
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
2007-02-06  Darin Adler  <darin@apple.com>

        Reviewed by John.

        - fix <rdar://problem/4687840> 9A241: JavaScript RegExp 25-30x slower than on 10.4.7

        I used Shark to figure out what to do. The test case is now 15% faster than with
        stock Safari. Some other regular expression cases might still be a few % slower
        than before, but the >10x slowdown is now completely gone.

        1) Fix slowness caused by setjmp/longjmp by using computed goto instead.

        Use GCC extensions - locally declared labels, labels as values, and computed goto -
        instead of using setjmp/longjmp to implemement non-recursive version of the regular
        expression system. We could probably make this even faster if we reduced the use
        of malloc a bit too.

        2) Fix slowness caused by allocating heapframe objects by allocating the first
           16 of them from the stack.

        3) Speed up use of malloc and free in PCRE by making it use fastMalloc and fastFree.

        4) Speed up the test case by adding a special case to a UString function.

        5) Made a small improvement to the innermost hottest loop of match by hoisting
           the conversion from int to pcre_uchar out of the loop.

        * JavaScriptCore.xcodeproj/project.pbxproj: Compile FastMallocPCRE.cpp, and don't
        compile pcre_globals.c.

        * wtf/FastMallocPCRE.cpp: Added. A copy of pcre_globals.c that uses FastMalloc.h.
        This is better than code that sets the PCRE allocation globals because by doing it
        this way there's guaranteed to be no problem with order of initialization.

        * kjs/ustring.cpp: (KJS::UString::spliceSubstringsWithSeparators): Add a fast
        special case when this is called for only one subrange and no seaprators. This
        was happening a lot in the test case and it seems quite reasonable to optimize this.

        * pcre/pcre_exec.c: Create a copy of the RMATCH and RRETURN macros that use goto
        instead of setjmp/longjmp. Change code that calls pcre_stack_malloc to first use
        storage on the stack inside the match function.
        (match): Move initialization of utf8 up a couple lines to avoid "possibly used
        uninitialized" warning. Use a local variable so we compare with pcre_uchar instead
        of with int inside the inner "find a character" loop.

860
861
862
863
864
865
866
867
868
869
2007-02-03  George Staikos  <staikos@kde.org>

        Reviewed by Alexey.

        -1 is not a valid point.  We can't handle anything > 0xffff anyway.
        Fixes crash on cases like eval("x");

        * wtf/unicode/qt4/UnicodeQt4.h:
        (WTF::Unicode::category):

darin's avatar
darin committed
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
2007-02-02  Darin Adler  <darin@apple.com>

        Reviewed by Anders.

        - fix copying and assigning a ListHashSet

        No test because the code path with bugs I am fixing is not used yet.

        * wtf/ListHashSet.h: Tweaked ListHashSetNodeAllocator a little bit for clarity.
        Changed m_allocator to be an OwnPtr instead of doing an explicit delete.
        Fixed bug in copy constructor where we'd have an uninitialized m_allocator.
        Fixed bug in assignment operator where it would swap only the hash table, and
        not the head, tail, and allocator pointers.

2007-02-02  Geoffrey Garen  <ggaren@apple.com>
ggaren's avatar
ggaren committed
885
886
887
888
889
890
891
892
893

        Reviewed by Maciej Stachowiak.
        
        Use WTFLog instead of fprintf for logging KJS::Node leaks.

        * kjs/nodes.cpp:
        (NodeCounter::~NodeCounter): Changed count to unsigned, updated
        to match style guidelines.

mjs's avatar
mjs committed
894
895
896
897
898
899
900
2007-02-02  Maciej Stachowiak  <mjs@apple.com>

        - not reviewed, build fix

        * wtf/ListHashSet.h:
        (WTF::ListHashSetNodeAllocator::ListHashSetNodeAllocator): ummm, use union correctly

mjs's avatar
mjs committed
901
902
903
904
2007-02-01  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Darin.
        
mjs's avatar
mjs committed
905
        - use a custom allocator for ListHashSet, to fix ~1% perf regression using it for form control
mjs's avatar
mjs committed
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920

        * wtf/ListHashSet.h:
        (WTF::ListHashSetNodeAllocator::ListHashSetNodeAllocator):
        (WTF::ListHashSetNodeAllocator::allocate):
        (WTF::ListHashSetNodeAllocator::deallocate):
        (WTF::ListHashSetNode::operator new):
        (WTF::ListHashSetNode::operator delete):
        (WTF::ListHashSetNode::destroy):
        (WTF::ListHashSetTranslator::translate):
        (WTF::::ListHashSet):
        (WTF::::~ListHashSet):
        (WTF::::add):
        (WTF::::unlinkAndDelete):
        (WTF::::deleteAllNodes):

mjs's avatar
mjs committed
921
922
923
924
925
926
927
928
929
2007-01-31  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Adam.
        
        - fix sporadic crash

        * wtf/ListHashSet.h:
        (WTF::::remove): remove before deleting

mjs's avatar
mjs committed
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
2007-01-31  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Mark with help from Lars.
        
        - added new ListHashSet class, which combines a hashtable and a linked list to provide a set
        that keeps elements in inserted order
        
        This is to assist in fixing the following:
        <rdar://problem/4751164> REGRESSION: Safari places text on incorrect button when returning to a page via back [10541]
        http://bugs.webkit.org/show_bug.cgi?id=10541

        * JavaScriptCore.vcproj/WTF/WTF.vcproj:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * wtf/HashTable.h:
        (WTF::HashTable::find):
        (WTF::HashTable::contains):
        (WTF::::find):
        (WTF::::contains):
        * wtf/ListHashSet.h: Added.
        (WTF::ListHashSetNode::ListHashSetNode):
        (WTF::ListHashSetNodeHashFunctions::hash):
        (WTF::ListHashSetNodeHashFunctions::equal):
        (WTF::ListHashSetIterator::ListHashSetIterator):
        (WTF::ListHashSetIterator::get):
        (WTF::ListHashSetIterator::operator*):
        (WTF::ListHashSetIterator::operator->):
        (WTF::ListHashSetIterator::operator++):
        (WTF::ListHashSetIterator::operator--):
        (WTF::ListHashSetIterator::operator==):
        (WTF::ListHashSetIterator::operator!=):
        (WTF::ListHashSetIterator::operator const_iterator):
        (WTF::ListHashSetIterator::node):
        (WTF::ListHashSetConstIterator::ListHashSetConstIterator):
        (WTF::ListHashSetConstIterator::get):
        (WTF::ListHashSetConstIterator::operator*):
        (WTF::ListHashSetConstIterator::operator->):
        (WTF::ListHashSetConstIterator::operator++):
        (WTF::ListHashSetConstIterator::operator--):
        (WTF::ListHashSetConstIterator::operator==):
        (WTF::ListHashSetConstIterator::operator!=):
        (WTF::ListHashSetConstIterator::node):
        (WTF::ListHashSetTranslator::hash):
        (WTF::ListHashSetTranslator::equal):
        (WTF::ListHashSetTranslator::translate):
        (WTF::::ListHashSet):
        (WTF::::operator):
        (WTF::::~ListHashSet):
        (WTF::::size):
        (WTF::::capacity):
        (WTF::::isEmpty):
        (WTF::::begin):
        (WTF::::end):
        (WTF::::find):
        (WTF::::contains):
        (WTF::::add):
        (WTF::::remove):
        (WTF::::clear):
        (WTF::::unlinkAndDelete):
        (WTF::::appendNode):
        (WTF::::deleteAllNodes):
        (WTF::::makeIterator):
        (WTF::::makeConstIterator):
        (WTF::deleteAllValues):

994
995
996
997
998
999
2007-01-30  Darin Adler  <darin@apple.com>

        * kjs/DateMath.cpp: Fix license header to reflect LGPL as the first license
        mentioned. We still mention the option of using under MPL or GPL since some
        of this code came from the Mozilla project with those license terms.

1000
2007-01-30  Simon Hausmann  <hausmann@kde.org>