/
ChangeLog
11450 lines (8468 loc) · 435 KB
/
ChangeLog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
54
55
56
57
58
59
60
61
62
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
101
102
103
104
105
106
107
108
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
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
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
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
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
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
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
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
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
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
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
994
995
996
997
998
999
1000
2017-08-09 Don Olmstead <don.olmstead@sony.com>
[WTF] Move TextStream into WTF
https://bugs.webkit.org/show_bug.cgi?id=175211
Reviewed by Myles C. Maxfield.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/text/TextStream.cpp: Renamed from Source/WebCore/platform/text/TextStream.cpp.
(WTF::TextStream::writeIndent):
* wtf/text/TextStream.h: Renamed from Source/WebCore/platform/text/TextStream.h.
(WTF::TextStream::FormatNumberRespectingIntegers::FormatNumberRespectingIntegers):
2017-08-08 Filip Pizlo <fpizlo@apple.com>
Baseline JIT should do caging
https://bugs.webkit.org/show_bug.cgi?id=175037
Reviewed by Mark Lam.
* wtf/Gigacage.h:
(Gigacage::disableDisablingPrimitiveGigacageIfShouldBeEnabled):
(Gigacage::isDisablingPrimitiveGigacageDisabled):
(Gigacage::isPrimitiveGigacagePermanentlyEnabled):
(Gigacage::canPrimitiveGigacageBeDisabled):
(Gigacage::basePtr):
2017-08-08 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r220368.
This change caused WK1 tests to exit early with crashes.
Reverted changeset:
"Baseline JIT should do caging"
https://bugs.webkit.org/show_bug.cgi?id=175037
http://trac.webkit.org/changeset/220368
2017-08-08 Michael Catanzaro <mcatanzaro@igalia.com>
[CMake] Properly test if compiler supports compiler flags
https://bugs.webkit.org/show_bug.cgi?id=174490
Reviewed by Konstantin Tokarev.
* wtf/Compiler.h:
2017-08-07 Filip Pizlo <fpizlo@apple.com>
Baseline JIT should do caging
https://bugs.webkit.org/show_bug.cgi?id=175037
Reviewed by Mark Lam.
* wtf/Gigacage.h:
(Gigacage::disableDisablingPrimitiveGigacageIfShouldBeEnabled):
(Gigacage::isDisablingPrimitiveGigacageDisabled):
(Gigacage::isPrimitiveGigacagePermanentlyEnabled):
(Gigacage::canPrimitiveGigacageBeDisabled):
2017-08-07 Filip Pizlo <fpizlo@apple.com>
Unreviewed, try to fix Windows build.
* wtf/Gigacage.cpp:
* wtf/Gigacage.h:
2017-08-06 Filip Pizlo <fpizlo@apple.com>
Primitive auxiliaries and JSValue auxiliaries should have separate gigacages
https://bugs.webkit.org/show_bug.cgi?id=174919
Reviewed by Keith Miller.
This mirrors the changes from bmalloc/Gigacage.h.
Also it teaches CagedPtr how to reason about multiple gigacages.
* wtf/CagedPtr.h:
(WTF::CagedPtr::get const):
(WTF::CagedPtr::operator[] const):
* wtf/Gigacage.cpp:
(Gigacage::tryMalloc):
(Gigacage::tryAllocateVirtualPages):
(Gigacage::freeVirtualPages):
(Gigacage::tryAlignedMalloc):
(Gigacage::alignedFree):
(Gigacage::free):
* wtf/Gigacage.h:
(Gigacage::disablePrimitiveGigacage):
(Gigacage::addPrimitiveDisableCallback):
(Gigacage::removePrimitiveDisableCallback):
(Gigacage::name):
(Gigacage::basePtr):
(Gigacage::caged):
(Gigacage::isCaged):
(Gigacage::tryAlignedMalloc):
(Gigacage::alignedFree):
(Gigacage::free):
(Gigacage::disableGigacage): Deleted.
(Gigacage::addDisableCallback): Deleted.
(Gigacage::removeDisableCallback): Deleted.
2017-08-07 Brian Burg <bburg@apple.com>
Remove CANVAS_PATH compilation guard
https://bugs.webkit.org/show_bug.cgi?id=175207
Reviewed by Sam Weinig.
* wtf/FeatureDefines.h:
2017-08-05 Filip Pizlo <fpizlo@apple.com>
REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372
https://bugs.webkit.org/show_bug.cgi?id=175083
Reviewed by Oliver Hunt.
Adds a classic ReadWriteLock class. I wrote my own because I can never remember if the pthread one is
guaranted to bias in favor of writers or not.
* WTF.xcodeproj/project.pbxproj:
* wtf/Condition.h:
(WTF::ConditionBase::construct):
(WTF::Condition::Condition):
* wtf/Lock.h:
(WTF::LockBase::construct):
(WTF::Lock::Lock):
* wtf/ReadWriteLock.cpp: Added.
(WTF::ReadWriteLockBase::construct):
(WTF::ReadWriteLockBase::readLock):
(WTF::ReadWriteLockBase::readUnlock):
(WTF::ReadWriteLockBase::writeLock):
(WTF::ReadWriteLockBase::writeUnlock):
* wtf/ReadWriteLock.h: Added.
(WTF::ReadWriteLockBase::ReadLock::tryLock):
(WTF::ReadWriteLockBase::ReadLock::lock):
(WTF::ReadWriteLockBase::ReadLock::unlock):
(WTF::ReadWriteLockBase::WriteLock::tryLock):
(WTF::ReadWriteLockBase::WriteLock::lock):
(WTF::ReadWriteLockBase::WriteLock::unlock):
(WTF::ReadWriteLockBase::read):
(WTF::ReadWriteLockBase::write):
(WTF::ReadWriteLock::ReadWriteLock):
2017-08-04 Matt Lewis <jlewis3@apple.com>
Unreviewed, rolling out r220271.
Rolling out due to Layout Test failing on iOS Simulator.
Reverted changeset:
"Remove STREAMS_API compilation guard"
https://bugs.webkit.org/show_bug.cgi?id=175165
http://trac.webkit.org/changeset/220271
2017-08-04 Youenn Fablet <youenn@apple.com>
Remove STREAMS_API compilation guard
https://bugs.webkit.org/show_bug.cgi?id=175165
Reviewed by Darin Adler.
* wtf/FeatureDefines.h:
2017-08-03 Brian Burg <bburg@apple.com>
Remove ENABLE(WEB_SOCKET) guards
https://bugs.webkit.org/show_bug.cgi?id=167044
Reviewed by Joseph Pecoraro.
* wtf/FeatureDefines.h:
2017-08-03 Youenn Fablet <youenn@apple.com>
Remove FETCH_API compilation guard
https://bugs.webkit.org/show_bug.cgi?id=175154
Reviewed by Chris Dumez.
* wtf/FeatureDefines.h:
2017-08-03 Brady Eidson <beidson@apple.com>
Add SW IDLs and stub out basic functionality.
https://bugs.webkit.org/show_bug.cgi?id=175115
Reviewed by Chris Dumez.
* wtf/FeatureDefines.h:
2017-08-03 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, build fix for Windows port
https://bugs.webkit.org/show_bug.cgi?id=175013
* wtf/Threading.h:
2017-08-03 Yusuke Suzuki <utatane.tea@gmail.com>
Merge ThreadHolder to WTF::Thread itself
https://bugs.webkit.org/show_bug.cgi?id=175013
Reviewed by Mark Lam.
Currently, we store ThreadHolder* to the TLS, and ThreadHolder* holds Ref<Thread>.
When we get Thread& from the current thread TLS, we need to dereference the ThreadHolder*.
However, ideally, we can store Thread* directly to the current thread TLS.
While the ThreadHolder design is beautiful, it's worth optimizing by storing Thread* directly
since Thread::current() is so frequently executed.
This patch merges ThreadHolder to Thread. And we now store Thread* directly in the TLS.
When storing it to TLS, we call leakRef() to keep Thread ref count incremented by the TLS.
And when destroying the TLS, we call `deref()` to ensure that Thread* is dereferenced from
the TLS.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/ThreadHolder.cpp: Removed.
* wtf/ThreadHolder.h: Removed.
* wtf/ThreadHolderPthreads.cpp: Removed.
* wtf/ThreadHolderWin.cpp: Removed.
* wtf/Threading.cpp:
(WTF::Thread::entryPoint):
(WTF::initializeThreading):
* wtf/Threading.h:
(WTF::Thread::currentMayBeNull):
(WTF::Thread::current):
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::waitForCompletion):
(WTF::Thread::initializeCurrentTLS):
(WTF::Thread::initializeTLSKey):
(WTF::Thread::initializeTLS):
(WTF::Thread::destructTLS):
(WTF::Thread::createCurrentThread): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::initializeCurrentTLS):
(WTF::threadMapMutex):
(WTF::Thread::initializeTLSKey):
(WTF::Thread::currentDying):
(WTF::Thread::get):
(WTF::Thread::initializeTLS):
(WTF::Thread::destructTLS):
(WTF::waitForThreadCompletion):
(WTF::Thread::createCurrentThread): Deleted.
2017-08-03 Yusuke Suzuki <utatane.tea@gmail.com>
[Linux][WTF] Use one global semaphore to notify thread suspend and resume completion
https://bugs.webkit.org/show_bug.cgi?id=175124
Reviewed by Carlos Garcia Campos.
POSIX sem_t is used to notify thread suspend and resume completion in Linux ports
since sem_post is async-signal-safe function. Since we guard suspend() and resume()
with one global lock, this semaphore is also guarded by this lock. So we do not need
to have semaphore per WTF::Thread.
This patch introduces one global Semaphore. And drop per thread semaphore.
* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::~Thread):
(WTF::Semaphore::Semaphore):
(WTF::Semaphore::~Semaphore):
(WTF::Semaphore::wait):
(WTF::Semaphore::post):
(WTF::Thread::signalHandlerSuspendResume):
(WTF::Thread::initializePlatformThreading):
(WTF::Thread::suspend):
(WTF::Thread::resume):
(WTF::Thread::Thread): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::Thread): Deleted.
2017-08-03 Yusuke Suzuki <utatane.tea@gmail.com>
[Linux][WTF] Reduce sizeof(WTF::Thread) by using a pointer to PlatformRegisters
https://bugs.webkit.org/show_bug.cgi?id=175119
Reviewed by Carlos Garcia Campos.
sizeof(PlatformRegisters) is so large. In my Linux box, it is 256. It enlarges the sizeof(WTF::Thread).
However, it is not necessary to hold it in WTF::Thread member. Thread's ucontext data and its stack is
effective while suspending the thread. So, we can just use the pointer to the PlatformRegister instead
of copying it to the member of the WTF::Thread.
* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::signalHandlerSuspendResume):
(WTF::Thread::getRegisters):
2017-08-02 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, build fix for Windows port
https://bugs.webkit.org/show_bug.cgi?id=174716
This ugliness will be fixed in https://bugs.webkit.org/show_bug.cgi?id=175013.
* wtf/ThreadHolder.h:
* wtf/Threading.h:
2017-08-02 Yusuke Suzuki <utatane.tea@gmail.com>
Merge WTFThreadData to Thread::current
https://bugs.webkit.org/show_bug.cgi?id=174716
Reviewed by Mark Lam.
We placed thread specific data in WTFThreadData previously. But now, we have a new good place
to put thread specific data: WTF::Thread. Before this patch, WTFThreadData and WTF::Thread
sometimes have the completely same fields (m_stack etc.) due to initialization order limitations.
This patch merges WTFThreadData to WTF::Thread. We apply WTFThreadData's initialization style
to WTF::Thread. So, WTF::Thread's holder now uses fast TLS for darwin environment. Thus,
Thread::current() access is now accelerated. And WTF::Thread::current() can be accessed even
before calling WTF::initializeThreading.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/LockAlgorithm.h:
* wtf/LockAlgorithmInlines.h:
* wtf/MainThread.h:
* wtf/ParkingLot.cpp:
* wtf/StackStats.cpp:
(WTF::StackStats::PerThreadStats::PerThreadStats):
(WTF::StackStats::CheckPoint::CheckPoint):
(WTF::StackStats::CheckPoint::~CheckPoint):
(WTF::StackStats::probe):
(WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
* wtf/ThreadHolder.cpp:
(WTF::ThreadHolder::initializeCurrent):
* wtf/ThreadHolder.h:
(WTF::ThreadHolder::ThreadHolder):
(WTF::ThreadHolder::currentMayBeNull):
(WTF::ThreadHolder::current):
* wtf/ThreadHolderPthreads.cpp:
(WTF::ThreadHolder::initializeKey):
(WTF::ThreadHolder::initialize):
(WTF::ThreadHolder::destruct):
(WTF::ThreadHolder::initializeOnce): Deleted.
(WTF::ThreadHolder::current): Deleted.
* wtf/ThreadHolderWin.cpp:
(WTF::ThreadHolder::initializeKey):
(WTF::ThreadHolder::currentDying):
(WTF::ThreadHolder::initialize):
(WTF::ThreadHolder::initializeOnce): Deleted.
(WTF::ThreadHolder::current): Deleted.
* wtf/Threading.cpp:
(WTF::Thread::initializeInThread):
(WTF::Thread::entryPoint):
(WTF::Thread::create):
(WTF::Thread::didExit):
(WTF::initializeThreading):
(WTF::Thread::currentMayBeNull): Deleted.
* wtf/Threading.h:
(WTF::Thread::current):
(WTF::Thread::atomicStringTable):
(WTF::Thread::setCurrentAtomicStringTable):
(WTF::Thread::stackStats):
(WTF::Thread::savedStackPointerAtVMEntry):
(WTF::Thread::setSavedStackPointerAtVMEntry):
(WTF::Thread::savedLastStackTop):
(WTF::Thread::setSavedLastStackTop):
* wtf/ThreadingPrimitives.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::createCurrentThread):
(WTF::Thread::current): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::createCurrentThread):
(WTF::Thread::current): Deleted.
* wtf/WTFThreadData.cpp: Removed.
* wtf/WTFThreadData.h: Removed.
* wtf/text/AtomicString.cpp:
* wtf/text/AtomicStringImpl.cpp:
(WTF::stringTable):
* wtf/text/AtomicStringTable.cpp:
(WTF::AtomicStringTable::create):
* wtf/text/AtomicStringTable.h:
2017-08-02 Joseph Pecoraro <pecoraro@apple.com>
NeverDestroyed related leaks seen on bots
https://bugs.webkit.org/show_bug.cgi?id=175113
Reviewed by Yusuke Suzuki.
* wtf/NeverDestroyed.h:
(WTF::NeverDestroyed::NeverDestroyed):
Previously the result of makeNeverDestroyed was not always moving into
the `static NeverDestroyed` static local variable. In some cases it would
re-invoke the constructor, creating a new NeverDestroyed object. In the
case of a Vector it was causing leaks.
Adding a move constructor convinces the compiler to move the result
of makeNeverDestroyed into the NeverDestroyed static. It doesn't actually
invoke the move constructor here, which I believe means it is deciding
to perform optional copy elision optimization.
'http://en.cppreference.com/w/cpp/language/copy_elision
2017-08-02 Filip Pizlo <fpizlo@apple.com>
All C++ accesses to JSObject::m_butterfly should do caging
https://bugs.webkit.org/show_bug.cgi?id=175039
Reviewed by Keith Miller.
Adds a smart pointer class that does various kinds of caging for you.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/CagedPtr.h: Added.
(WTF::CagedPtr::CagedPtr):
(WTF::CagedPtr::get const):
(WTF::CagedPtr::getMayBeNull const):
(WTF::CagedPtr::operator== const):
(WTF::CagedPtr::operator!= const):
(WTF::CagedPtr::operator bool const):
(WTF::CagedPtr::operator* const):
(WTF::CagedPtr::operator-> const):
2017-08-02 Filip Pizlo <fpizlo@apple.com>
We should be OK with the gigacage being disabled on gmalloc
https://bugs.webkit.org/show_bug.cgi?id=175082
Reviewed by Michael Saboff.
* wtf/Gigacage.h:
(Gigacage::shouldBeEnabled):
2017-08-01 Filip Pizlo <fpizlo@apple.com>
Bmalloc and GC should put auxiliaries (butterflies, typed array backing stores) in a gigacage (separate multi-GB VM region)
https://bugs.webkit.org/show_bug.cgi?id=174727
Reviewed by Mark Lam.
For the Gigacage project to have minimal impact, we need to have some abstraction that allows code to
avoid having to guard itself with #if's. This adds a Gigacage abstraction that overlays the Gigacage
namespace from bmalloc, which always lets you call things like Gigacage::caged and Gigacage::tryMalloc.
Because of how many places need to possibly allocate in a gigacage, or possibly perform caged accesses,
it's better to hide the question of whether or not it's enabled inside this API.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/FastMalloc.cpp:
* wtf/Gigacage.cpp: Added.
(Gigacage::tryMalloc):
(Gigacage::tryAllocateVirtualPages):
(Gigacage::freeVirtualPages):
(Gigacage::tryAlignedMalloc):
(Gigacage::alignedFree):
(Gigacage::free):
* wtf/Gigacage.h: Added.
(Gigacage::ensureGigacage):
(Gigacage::disableGigacage):
(Gigacage::addDisableCallback):
(Gigacage::removeDisableCallback):
(Gigacage::caged):
(Gigacage::isCaged):
(Gigacage::tryAlignedMalloc):
(Gigacage::alignedFree):
(Gigacage::free):
2017-07-31 Matt Lewis <jlewis3@apple.com>
Unreviewed, rolling out r220060.
This broke our internal builds. Contact reviewer of patch for
more information.
Reverted changeset:
"Merge WTFThreadData to Thread::current"
https://bugs.webkit.org/show_bug.cgi?id=174716
http://trac.webkit.org/changeset/220060
2017-07-31 Yusuke Suzuki <utatane.tea@gmail.com>
Merge WTFThreadData to Thread::current
https://bugs.webkit.org/show_bug.cgi?id=174716
Reviewed by Sam Weinig.
We placed thread specific data in WTFThreadData previously. But now, we have a new good place
to put thread specific data: WTF::Thread. Before this patch, WTFThreadData and WTF::Thread
sometimes have the completely same fields (m_stack etc.) due to initialization order limitations.
This patch merges WTFThreadData to WTF::Thread. We apply WTFThreadData's initialization style
to WTF::Thread. So, WTF::Thread's holder now uses fast TLS for darwin environment. Thus,
Thread::current() access is now accelerated. And WTF::Thread::current() can be accessed even
before calling WTF::initializeThreading.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/LockAlgorithm.h:
* wtf/LockAlgorithmInlines.h:
* wtf/MainThread.h:
* wtf/ParkingLot.cpp:
* wtf/StackStats.cpp:
(WTF::StackStats::PerThreadStats::PerThreadStats):
(WTF::StackStats::CheckPoint::CheckPoint):
(WTF::StackStats::CheckPoint::~CheckPoint):
(WTF::StackStats::probe):
(WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
* wtf/ThreadHolder.cpp:
(WTF::ThreadHolder::initializeCurrent):
* wtf/ThreadHolder.h:
(WTF::ThreadHolder::ThreadHolder):
(WTF::ThreadHolder::currentMayBeNull):
(WTF::ThreadHolder::current):
* wtf/ThreadHolderPthreads.cpp:
(WTF::ThreadHolder::initialize):
(WTF::ThreadHolder::destruct):
(WTF::ThreadHolder::current): Deleted.
* wtf/ThreadHolderWin.cpp:
(WTF::ThreadHolder::currentDying):
(WTF::ThreadHolder::initialize):
(WTF::ThreadHolder::current): Deleted.
* wtf/Threading.cpp:
(WTF::Thread::initializeInThread):
(WTF::Thread::entryPoint):
(WTF::Thread::didExit):
(WTF::initializeThreading):
(WTF::Thread::currentMayBeNull): Deleted.
* wtf/Threading.h:
(WTF::Thread::atomicStringTable):
(WTF::Thread::setCurrentAtomicStringTable):
(WTF::Thread::stackStats):
(WTF::Thread::savedStackPointerAtVMEntry):
(WTF::Thread::setSavedStackPointerAtVMEntry):
(WTF::Thread::savedLastStackTop):
(WTF::Thread::setSavedLastStackTop):
(WTF::Thread::current):
* wtf/ThreadingPrimitives.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::createCurrentThread):
(WTF::Thread::current): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::createCurrentThread):
(WTF::Thread::current): Deleted.
* wtf/WTFThreadData.cpp: Removed.
* wtf/WTFThreadData.h: Removed.
* wtf/text/AtomicString.cpp:
* wtf/text/AtomicStringImpl.cpp:
(WTF::stringTable):
* wtf/text/AtomicStringTable.cpp:
(WTF::AtomicStringTable::create):
* wtf/text/AtomicStringTable.h:
2017-07-31 Xabier Rodriguez Calvar <calvaris@igalia.com>
Created a bool pretty printer at WTF for debugging purposes
https://bugs.webkit.org/show_bug.cgi?id=174893
Reviewed by Darin Adler.
* wtf/PrintStream.cpp:
(WTF::printInternal): The overload taking bool uses boolForPrinting
* wtf/PrintStream.h:
(WTF::boolForPrinting): Converts a bool in "true" or "false".
2017-07-30 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Introduce Private Symbols
https://bugs.webkit.org/show_bug.cgi?id=174935
Reviewed by Darin Adler.
Upcoming proposal of class fields[1] requires private fields.
The simple way to implement it is adding a property with a private symbol.
Currently, we have private symbols for internal properties. They are usual
Symbols managed by the hash table. So basically private symbols are statically
created in BuiltinNames. However this new proposal encourages users to create
such private symbols more and more.
So, this patch introduces notion of "Private" into WTF SymbolImpl. This patch
adds PrivateSymbolImpl. This is SymbolImpl with "Private" flag. We do not need
to look up the symbol from the hash table to check whether the given symbol
is a private one.
[1]: https://github.com/tc39/proposal-class-fields
* wtf/text/StringImpl.h:
* wtf/text/SymbolImpl.cpp:
(WTF::PrivateSymbolImpl::create):
(WTF::PrivateSymbolImpl::createNullSymbol):
* wtf/text/SymbolImpl.h:
(WTF::SymbolImpl::isPrivate):
(WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl):
(WTF::SymbolImpl::SymbolImpl):
(WTF::PrivateSymbolImpl::PrivateSymbolImpl):
2017-07-30 Brady Eidson <beidson@apple.com>
Add URLSchemeHandler API tests that verify the lack of URLSchemeTask object leaks.
https://bugs.webkit.org/show_bug.cgi?id=174958
Reviewed by Darin Adler.
This patch adds a new template class "InstanceCounted<T>".
For each specialization, "InstanceCounted" will keep track of the total number of
instances in existence.
This makes explicate leak checking in API tests possible.
Since this adds some runtime and storage overhead the code that actually does anything
is only compiled in debug builds.
* WTF.xcodeproj/project.pbxproj:
* wtf/InstanceCounted.h: Added.
(WTF::InstanceCounted::InstanceCounted):
(WTF::InstanceCounted::instanceCount):
(WTF::InstanceCounted::~InstanceCounted):
2017-07-27 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Drop Thread initialization wait in some platforms by introducing StackBounds::newThreadStackBounds(PlatformThreadHandle&)
https://bugs.webkit.org/show_bug.cgi?id=174303
Reviewed by Mark Lam.
Currently, the caller thread of Thread::create() need to wait for completion of the initialization of the target thread.
This is because we need to initialize Thread::m_stack in the target thread. Before this patch, a target thread's
StackBounds can only be retrieved by the target thread itself. However, this potentially causes context-switching between
the caller and the target threads and hurts efficiency of creating threads.
Fortunately, in some platforms (including major platforms except for Windows), we can get StackBounds of a target
thread from a caller thread. This allows us to avoid waiting for completion of thread initialization.
In this patch, we introduce HAVE_STACK_BOUNDS_FOR_NEW_THREAD and StackBounds::newThreadStackBounds. When creating
a new thread, we will use StackBounds::newThreadStackBounds to get StackBounds if possible. As a result, we
do not need to wait for completion of thread initialization to ensure m_stack field of Thread is initialized.
While some documents claim that it is possible on Windows to get the StackBounds of another thread[1], the method relies on
undocumented Windows NT APIs (NtQueryInformationThread, NtReadVirtualMemory etc.). So in this patch, we just
use the conservative approach simply waiting for completion of thread initialization.
[1]: https://stackoverflow.com/questions/3918375/how-to-get-thread-stack-information-on-windows
* wtf/Platform.h:
* wtf/StackBounds.cpp:
(WTF::StackBounds::newThreadStackBounds):
(WTF::StackBounds::currentThreadStackBoundsInternal):
(WTF::StackBounds::initialize): Deleted.
* wtf/StackBounds.h:
(WTF::StackBounds::currentThreadStackBounds):
(WTF::StackBounds::StackBounds):
* wtf/Threading.cpp:
(WTF::Thread::NewThreadContext::NewThreadContext):
(WTF::Thread::entryPoint):
(WTF::Thread::create):
(WTF::Thread::initialize): Deleted.
* wtf/Threading.h:
* wtf/ThreadingPrimitives.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
(WTF::wtfThreadEntryPoint):
(WTF::Thread::establishHandle):
(WTF::Thread::initializeCurrentThreadInternal):
(WTF::Thread::current):
* wtf/ThreadingWin.cpp:
(WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
(WTF::Thread::initializeCurrentThreadInternal):
(WTF::Thread::current):
* wtf/win/MainThreadWin.cpp:
(WTF::initializeMainThreadPlatform):
2017-07-27 JF Bastien <jfbastien@apple.com>
Update lock benchmarks
https://bugs.webkit.org/show_bug.cgi?id=174907
Reviewed by Filip Pizlo.
* benchmarks/ConditionSpeedTest.cpp:
(main):
* benchmarks/LockFairnessTest.cpp:
* benchmarks/LockSpeedTest.cpp:
* benchmarks/ToyLocks.h:
2017-07-26 Brian Burg <bburg@apple.com>
Remove WEB_TIMING feature flag
https://bugs.webkit.org/show_bug.cgi?id=174795
Reviewed by Alex Christensen.
* wtf/FeatureDefines.h:
2017-07-26 Claudio Saavedra <csaavedra@igalia.com>
[WPE] Enable KeyboardEvent key and code attributes
https://bugs.webkit.org/show_bug.cgi?id=174822
Reviewed by Žan Doberšek.
There is no reason for this to be disabled from what I see.
* wtf/FeatureDefines.h: Enable KeyboardEvent key and code attributes.
2017-07-23 Filip Pizlo <fpizlo@apple.com>
B3 should do LICM
https://bugs.webkit.org/show_bug.cgi?id=174750
Reviewed by Keith Miller and Saam Barati.
Moved DFG::NaturalLoops to WTF. The new templatized NaturalLoops<> uses the same Graph abstraction as
Dominators<>. This allows us to add a B3::NaturalLoops for free.
Also made small tweaks to RangeSet, which the LICM uses.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Dominators.h:
* wtf/NaturalLoops.h: Added.
(WTF::NaturalLoop::NaturalLoop):
(WTF::NaturalLoop::graph):
(WTF::NaturalLoop::header):
(WTF::NaturalLoop::size):
(WTF::NaturalLoop::at):
(WTF::NaturalLoop::operator[]):
(WTF::NaturalLoop::contains):
(WTF::NaturalLoop::index):
(WTF::NaturalLoop::isOuterMostLoop):
(WTF::NaturalLoop::dump):
(WTF::NaturalLoop::addBlock):
(WTF::NaturalLoops::NaturalLoops):
(WTF::NaturalLoops::graph):
(WTF::NaturalLoops::numLoops):
(WTF::NaturalLoops::loop):
(WTF::NaturalLoops::headerOf):
(WTF::NaturalLoops::innerMostLoopOf):
(WTF::NaturalLoops::innerMostOuterLoop):
(WTF::NaturalLoops::belongsTo):
(WTF::NaturalLoops::loopDepth):
(WTF::NaturalLoops::loopsOf):
(WTF::NaturalLoops::dump):
* wtf/RangeSet.h:
(WTF::RangeSet::begin):
(WTF::RangeSet::end):
(WTF::RangeSet::addAll):
2017-07-23 Michael Catanzaro <mcatanzaro@igalia.com>
Implement FALLTHROUGH attribute for C with GCC
https://bugs.webkit.org/show_bug.cgi?id=174555
Reviewed by Darin Adler.
My previous attempt to silence the JSC -Wimplicit-fallthrough warnings failed because they
are coming from a C file, and our FALLTHROUGH macro is only implemented for C++. So
implement it for C as well, using C attribute syntax.
Note this is only possible to do for GCC, because Clang only supports this attribute using
the [[C++ attribute syntax]].
* wtf/Compiler.h:
2017-07-14 Filip Pizlo <fpizlo@apple.com>
It should be easy to decide how WebKit yields
https://bugs.webkit.org/show_bug.cgi?id=174298
Reviewed by Saam Barati.
Created a Thread::yield() abstraction for sched_yield(), and made WTF use it everywhere that it
had previously used std::this_thread::yield().
To make it less annoying to experiment with changes to the lock algorithm in the future, this also
moves the meat of the algorithm into LockAlgorithmInlines.h. Only two files include that header.
Since LockAlgorithm.h no longer includes ParkingLot.h, a bunch of files in WK now need to include
timing headers (Seconds, MonotonicTime, etc) manually.
* WTF.xcodeproj/project.pbxproj:
* benchmarks/ToyLocks.h:
* wtf/CMakeLists.txt:
* wtf/Lock.cpp:
* wtf/LockAlgorithm.h:
(WTF::LockAlgorithm::lockSlow): Deleted.
(WTF::LockAlgorithm::unlockSlow): Deleted.
* wtf/LockAlgorithmInlines.h: Added.
(WTF::hasParkedBit>::lockSlow):
(WTF::hasParkedBit>::unlockSlow):
* wtf/MainThread.cpp:
* wtf/RunLoopTimer.h:
* wtf/Threading.cpp:
* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::yield):
* wtf/ThreadingWin.cpp:
(WTF::Thread::yield):
* wtf/WordLock.cpp:
(WTF::WordLockBase::lockSlow):
(WTF::WordLockBase::unlockSlow):
2017-07-22 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Extend ThreadGroup::add results from bool to ThreadGroupAddResult
https://bugs.webkit.org/show_bug.cgi?id=174705
Reviewed by Mark Lam.
After starting using ThreadGroup to bookkeep active threads for Signals,
we would like to know tristate of ThreadGroup::add result, NewlyAdded, AlreadyAdded, NotAdded.
This patch extends the result of ThreadGroup::add from bool to ThreadGroupAddResult tristate.
Note that NotAdded is returned if the target thread is dying.
* wtf/ThreadGroup.cpp:
(WTF::ThreadGroup::add):
(WTF::ThreadGroup::addCurrentThread):
* wtf/ThreadGroup.h:
* wtf/Threading.cpp:
(WTF::Thread::addToThreadGroup):
* wtf/Threading.h:
* wtf/threads/Signals.cpp:
(WTF::registerThreadForMachExceptionHandling):
2017-07-21 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r219732.
https://bugs.webkit.org/show_bug.cgi?id=174748
static is not threadsafe in WebKit tree (Requested by
yusukesuzuki on #webkit).
Reverted changeset:
"[WTF] Drop initializeDate"
https://bugs.webkit.org/show_bug.cgi?id=174714
http://trac.webkit.org/changeset/219732
2017-07-21 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Drop initializeDate
https://bugs.webkit.org/show_bug.cgi?id=174714
Reviewed by Darin Adler.
minYear static variable will be initialized in an exclusive manner, which is ensured by C++ "static" semantics.
Thus, we do not need to call initializeDate() explicitly.
* wtf/DateMath.cpp:
(WTF::equivalentYearForDST):
(WTF::initializeDates): Deleted.
* wtf/Threading.cpp:
(WTF::initializeThreading):
2017-07-21 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Introduce static symbols
https://bugs.webkit.org/show_bug.cgi?id=158863
Reviewed by Darin Adler.
We add a new class StaticSymbolImpl. StaticSymbolImpl can offer
the way to create static SymbolImpl. It can be shared between
multiple VMs and multiple threads.
* wtf/text/SymbolImpl.h:
(WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl):
(WTF::SymbolImpl::StaticSymbolImpl::operator SymbolImpl&):
For StaticSymbolImpl's hashForSymbol, we use usual string hash value.
Since all the SymbolImpls are unique, basically, any value is OK here.
Non-confilicting to the other SymbolImpls is ideal.
2017-07-21 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Newly added AtomicStringImpl should use BufferInternal static string if StringImpl is static
https://bugs.webkit.org/show_bug.cgi?id=174501
Reviewed by Darin Adler.
When creating AtomicStringImpl from static StringImpl, we can just use createWithoutCopying
to create a BufferInternal AtomicStringImpl which m_data{8,16} is static string's one.
* wtf/text/AtomicStringImpl.cpp:
(WTF::CStringTranslator::hash):
(WTF::CStringTranslator::equal):
(WTF::CStringTranslator::translate):
(WTF::AtomicStringImpl::add):
(WTF::HashTranslatorCharBuffer::HashTranslatorCharBuffer):
(WTF::UCharBufferTranslator::hash):
(WTF::UCharBufferTranslator::equal):
(WTF::UCharBufferTranslator::translate):
(WTF::LCharBufferTranslator::hash):
(WTF::LCharBufferTranslator::equal):
(WTF::LCharBufferTranslator::translate):
(WTF::BufferFromStaticDataTranslator::hash):
(WTF::BufferFromStaticDataTranslator::equal):
(WTF::BufferFromStaticDataTranslator::translate):
(WTF::AtomicStringImpl::addLiteral):
(WTF::addSymbol):
(WTF::addStatic):
(WTF::AtomicStringImpl::addSlowCase):
(WTF::AtomicStringImpl::lookUp):
(WTF::CharBufferFromLiteralDataTranslator::hash): Deleted.
(WTF::CharBufferFromLiteralDataTranslator::equal): Deleted.
(WTF::CharBufferFromLiteralDataTranslator::translate): Deleted.
(WTF::addSubstring): Deleted.
* wtf/text/StringImpl.h:
2017-07-21 Konstantin Tokarev <annulen@yandex.ru>
[cmake] Unreviewed, add definitions necessary to use ICU shipped with macOS
macOS system ICU libraries are built with U_DISABLE_RENAMING=1 and
U_SHOW_CPLUSPLUS_API=0. After r219155 we have to pass this definitons
explicitly, because ICU headers in the tree are not modified anymore.
* wtf/PlatformMac.cmake: Rely on ICU_LIBRARIES instead of passing ICU
library name explicitly in WTF_LIBRARIES.
2017-07-20 Chris Dumez <cdumez@apple.com>
Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable
https://bugs.webkit.org/show_bug.cgi?id=174660
Reviewed by Geoffrey Garen.
Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable.
This essentially replaces a branch to figure out if the new size is less or greater than the
current size by an assertion.
* wtf/IndexSparseSet.h:
(WTF::OverflowHandler>::IndexSparseSet):
(WTF::OverflowHandler>::clear):
* wtf/Insertion.h:
(WTF::executeInsertions):
* wtf/RangeSet.h:
(WTF::RangeSet::compact):
* wtf/Vector.h:
(WTF::removeRepeatedElements):
* wtf/persistence/Coders.h:
2017-07-20 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Use ThreadGroup to bookkeep active threads for Mach exception
https://bugs.webkit.org/show_bug.cgi?id=174678
Reviewed by Mark Lam.
We can use ThreadGroup to bookkeep active threads for Mach exceptions.
When the thread dies, it is automatically removed from the thread groups.
So we do not need to call unregisterThreadForMachExceptionHandling.
* wtf/ThreadGroup.cpp:
(WTF::ThreadGroup::~ThreadGroup):
(WTF::ThreadGroup::add):
* wtf/ThreadGroup.h:
* wtf/ThreadHolder.cpp:
(WTF::ThreadHolder::~ThreadHolder):
* wtf/Threading.cpp:
(WTF::Thread::addToThreadGroup):
(WTF::Thread::removeFromThreadGroup):
* wtf/Threading.h:
* wtf/threads/Signals.cpp:
(WTF::setExceptionPorts):
(WTF::activeThreads):
(WTF::registerThreadForMachExceptionHandling):
(WTF::installSignalHandler):
(WTF::unregisterThreadForMachExceptionHandling): Deleted.
* wtf/threads/Signals.h:
2017-07-19 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Remove unnecessary indirection of WTF::Thread entry point
https://bugs.webkit.org/show_bug.cgi?id=174291
Reviewed by Mark Lam.
Now wtfThreadEntryPoint is almost the same. Only the difference is function signature due to platform APIs.
We remove ThreadFunctionInvocation indirection in ThreadingPthread.cpp and ThreadingWin.cpp.
Also, ThreadFunctionInvocation keeps a RefPtr to the Thread object. This was previously needed to keep the
Thread object alive until the thread itself could install the ThreadHolder into its thread local storage.
The ThreadHolder has a Ref that keeps the Thread object alive for the lifetime of the thread. Since
Thread::create() now waits for the thread to be initialized before returning and Thread::create() hold a Ref
to the Thread object, we are guaranteed that the Thread object will be alive long enough for it to be installed
in the thread's ThreadHolder, and we no longer need ThreadFunctionInvocation.
And we also simplify ThreadHolder::initialize a bit. Now Thread::create waits for the completion of Thread
initialization. So, after establishing thread handle, we can call ThreadHolder::initialize before completing
Thread initialization.
Also we drop errno.h ifdefs in ThreadingWin.cpp. This is introduced to support WinCE. But now WinCE port is removed.
* WTF.xcodeproj/project.pbxproj:
* wtf/ThreadFunctionInvocation.h: Removed.
* wtf/ThreadHolder.h:
* wtf/ThreadHolderWin.cpp:
(WTF::ThreadHolder::initialize):
* wtf/Threading.cpp: