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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
|
2008-03-27 Darin Adler <darin@apple.com>
Reviewed by Mark Rowe.
<rdar://problem/5826236> Regular expressions with large nested repetition counts can have their
compiled length calculated incorrectly.
* pcre/pcre_compile.cpp:
(multiplyWithOverflowCheck):
(calculateCompiledPatternLength): Check for overflow when dealing with nested repetition counts
and bail with an error rather than returning incorrect results.
2008-02-29 Mark Rowe <mrowe@apple.com>
Merge r30475 to Safari-3-1-branch.
2008-02-22 Oliver Hunt <oliver@apple.com>
Reviewed by Alexey P.
<rdar://problem/5759327> REGRESSION: while(NaN) acts like while(true)
Fix yet another case where we incorrectly relied on implicit double
to bool coercion.
* kjs/nodes.cpp:
(KJS::PostDecLocalVarNode::evaluateToBoolean):
2008-02-22 Mark Rowe <mrowe@apple.com>
Merge r30492 to Safari-3-1-branch.
2008-02-22 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Partial fix for <rdar://problem/5744037> Gmail out of memory (17455)
I'm removing KJS_MEM_LIMIT for the following reasons:
- We have a few reports of KJS_MEM_LIMIT breaking important web
applications, like GMail and Google Reader. (For example, if you
simply open 12 GMail tabs, tab #12 will hit the limit.)
- Firefox has no discernable JS object count limit, so any limit, even
a large one, is a potential compatibility problem.
- KJS_MEM_LIMIT does not protect against malicious memory allocation,
since there are many ways to maliciously allocate memory without
increasing the JS object count.
- KJS_MEM_LIMIT is already mostly broken, since it only aborts the
script that breaches the limit, not any subsequent scripts.
- We've never gotten bug reports about websites that would have
benefited from an unbroken KJS_MEM_LIMIT. The initial check-in of
KJS_MEM_LIMIT (KJS revision 80061) doesn't mention a website that
needed it.
- Any website that brings you anywhere close to crashing due to the
number of live JS objects will almost certainly put up the "slow
script" dialog at least 20 times beforehand.
* kjs/collector.cpp:
(KJS::Collector::collect):
* kjs/collector.h:
* kjs/nodes.cpp:
(KJS::TryNode::execute):
2008-02-17 Mark Rowe <mrowe@apple.com>
Unreviewed. Really make JavaScriptCore's FEATURE_DEFINES match WebCore's.
* Configurations/JavaScriptCore.xcconfig:
2008-02-15 Mark Rowe <mrowe@apple.com>
Merge r30276 to Safari-3-1-branch.
2008-02-15 Adam Roben <aroben@apple.com>
Make JavaScriptCore's FEATURE_DEFINES match WebCore's
Reviewed by Mark.
* Configurations/JavaScriptCore.xcconfig:
2008-02-15 Mark Rowe <mrowe@apple.com>
Merge r30239 to Safari-3-1-branch.
2008-02-14 Stephanie Lewis <slewis@apple.com>
Reviewed by Geoff.
Update order files.
* JavaScriptCore.order:
2008-02-15 Mark Rowe <mrowe@apple.com>
Merge r30235 to Safari-3-1-branch.
2008-02-14 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed <rdar://problem/5737835> nee http://bugs.webkit.org/show_bug.cgi?id=17329
Crash in JSGlobalObject::popActivation when inserting hyperlink in Wordpress (17329)
Don't reset the "activations" stack in JSGlobalObject::reset, since we
might be executing a script during the call to reset, and the script
needs to safely run to completion.
Instead, initialize the "activations" stack when the global object is
created, and subsequently rely on pushing and popping during normal
execution to maintain the stack's state.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::init):
(KJS::JSGlobalObject::reset):
2008-02-15 Mark Rowe <mrowe@apple.com>
Merge r30191 to Safari-3-1-branch.
2008-02-13 Oliver Hunt <oliver@apple.com>
Reviewed by Alexey P.
<rdar://problem/5737003> REGRESSION (r27747): can't browse pictures on fastcupid.com
When converting numeric values to booleans we need to account for NaN
* kjs/nodes.cpp:
(KJS::MultNode::evaluateToBoolean):
(KJS::ModNode::evaluateToBoolean):
2008-02-15 Mark Rowe <mrowe@apple.com>
Merge r30177 to Safari-3-1-branch.
2008-02-08 Samuel Weinig <sam@webkit.org>
Reviewed by Brady Eidson.
<rdar://problem/5659216> REGRESSION: PLT 0.3% slower due to r28868 (caching ClassNodeList and NamedNodeList)
- Tweak the statements in isASCIISpace to account for the statistical distribution of
usage in the PLT.
.4% speedup on my machine. Stephanie's machine shows this as .3% speedup.
* wtf/ASCIICType.h:
(WTF::isASCIISpace):
2008-02-15 Mark Rowe <mrowe@apple.com>
Merge r30158 to Safari-3-1-branch.
2008-02-11 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
Fixes for:
<rdar://problem/5735497> Match Firefox's cross-domain model more accurately by return the built-in version of functions even if they have been overridden
<rdar://problem/5735443> Crash when setting the Window objects prototype to a custom Object and then calling a method on it
- Expose the native Object.prototype.toString implementation so that it can be used for cross-domain
toString calling.
* JavaScriptCore.exp:
* kjs/object_object.cpp:
* kjs/object_object.h:
2008-02-15 Mark Rowe <mrowe@apple.com>
Merge r30105 to Safari-3-1-branch.
2008-02-08 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
<rdar://problem/5731773> REGRESSION (r28973): Extraneous parentheses in function.toString()
https://bugs.webkit.org/show_bug.cgi?id=17214
Make a subclass of CommaNode to provide the correct precedence for each expression in
a variable declaration list.
* kjs/grammar.y:
* kjs/nodes.h:
(KJS::VarDeclCommaNode::):
2008-02-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Added an ASSERT to catch refCount underflow, since it caused a leak in
my last check-in.
* wtf/RefCounted.h:
(WTF::RefCounted::deref):
2008-02-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
slower due to r28884 (global variable symbol table optimization)
Tweaked RefCounted::deref() to be a little more efficient.
1% - 1.5% speedup on my machine. .7% speedup on Stephanie's machine.
* wtf/RefCounted.h:
(WTF::RefCounted::deref): Don't modify m_refCount if we're just going
to delete the object anyway. Also, use a simple == test, which might be
faster than <= on some hardware.
2008-02-06 Darin Adler <darin@apple.com>
Reviewed by Sam.
- fix http://bugs.webkit.org/show_bug.cgi?id=17094
Array.prototype functions create length properties with DontEnum/DontDelete
Test results match Gecko with very few obscure exceptions that seem to be
bugs in Gecko.
Test: fast/js/array-functions-non-arrays.html
* kjs/array_object.cpp:
(KJS::arrayProtoFuncConcat): Removed DontEnum and DontDelete from the call
to set length.
(KJS::arrayProtoFuncPop): Ditto. Also added missing call to deleteProperty,
which is not needed for real arrays, but is needed for non-arrays.
(KJS::arrayProtoFuncPush): Ditto.
(KJS::arrayProtoFuncShift): Ditto.
(KJS::arrayProtoFuncSlice): Ditto.
(KJS::arrayProtoFuncSort): Removed incorrect call to set length when
the array has no elements.
(KJS::arrayProtoFuncSplice): Removed DontEnum and DontDelete from the call
to set length.
(KJS::arrayProtoFuncUnShift): Ditto. Also added a check for 0 arguments to
make behavior match the specification in that case.
* kjs/nodes.cpp:
(KJS::ArrayNode::evaluate): Removed DontEnum and DontDelete from the call
to set length.
2008-02-06 Darin Adler <darin@apple.com>
Reviewed by Sam.
- replace calls to put to set up properties with calls to putDirect, to
prepare for a future change where put won't take attributes any more,
and for a slight performance boost
* API/JSObjectRef.cpp:
(JSObjectMakeConstructor): Use putDirect instead of put.
* kjs/CommonIdentifiers.h: Removed lastIndex.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset): Use putDirect instead of put.
* kjs/array_object.cpp:
(KJS::arrayProtoFuncConcat): Took out extra call to get length (unused).
(KJS::ArrayObjectImp::ArrayObjectImp): Use putDirect instead of put.
* kjs/error_object.cpp:
(KJS::ErrorPrototype::ErrorPrototype): Use putDirect instead of put.
* kjs/function.cpp:
(KJS::Arguments::Arguments): Use putDirect instead of put.
(KJS::PrototypeFunction::PrototypeFunction): Use putDirect instead of put.
* kjs/function_object.cpp:
(KJS::FunctionObjectImp::construct): Use putDirect instead of put.
* kjs/nodes.cpp:
(KJS::FuncDeclNode::makeFunction): Use putDirect instead of put.
(KJS::FuncExprNode::evaluate): Use putDirect instead of put.
* kjs/regexp_object.cpp:
(KJS::regExpProtoFuncCompile): Use setLastIndex instead of put(lastIndex).
(KJS::RegExpImp::match): Get and set lastIndex by using m_lastIndex instead of
calling get and put.
* kjs/regexp_object.h:
(KJS::RegExpImp::setLastIndex): Added.
* kjs/string_object.cpp:
(KJS::stringProtoFuncMatch): Use setLastIndex instead of put(lastIndex).
2008-02-05 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
Fix for http://bugs.webkit.org/show_bug.cgi?id=8080
NodeList (and other DOM lists) items are not enumeratable using for..in
* JavaScriptCore.exp:
2008-02-05 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
Update versioning to support the mysterious future.
* Configurations/Version.xcconfig: Add SYSTEM_VERSION_PREFIX_1060.
2008-02-04 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver Hunt.
Fixes Bug 16889: REGRESSION (r29425): Canvas-based graphing calculator fails to run
Bug 17015: REGRESSION (r29414-29428): www.fox.com "shows" menu fails to render
Bug 17164: REGRESSION: JavaScript pop-up menu appears at wrong location when hovering image at http://news.chinatimes.com/
<http://bugs.webkit.org/show_bug.cgi?id=16889>
<rdar://problem/5696255>
<http://bugs.webkit.org/show_bug.cgi?id=17015>
<http://bugs.webkit.org/show_bug.cgi?id=17164>
<rdar://problem/5720947>
The ActivationImp tear-off (r29425) introduced a problem with ReadModify
nodes that first resolve a slot, call valueForReadModifyNode(), and then
store a value in the previously resolved slot. Since valueForReadModifyNode()
may cause a tear-off, the slot needs to be resolved again, but this was
not happening with the existing code.
* kjs/nodes.cpp:
(KJS::ReadModifyLocalVarNode::evaluate):
(KJS::ReadModifyResolveNode::evaluate):
2008-02-04 Cameron McCormack <cam@mcc.id.au>
Reviewed by Geoff Garen.
Remove some unneccesary UNUSED_PARAMs. Clarify ownership rule of return value of JSObjectCopyPropertyNames.
* API/JSNode.c:
(JSNode_appendChild):
(JSNode_removeChild):
(JSNode_replaceChild):
(JSNode_getNodeType):
(JSNode_getFirstChild):
* API/JSNodeList.c:
(JSNodeList_length):
* API/JSObjectRef.h:
2008-02-04 Rodney Dawes <dobey@wayofthemonkey.com>
Reviewed by Alp Toker and Mark Rowe.
Fix http://bugs.webkit.org/show_bug.cgi?id=17175.
Bug 17175: Use of C++ compiler flags in CFLAGS
* GNUmakefile.am: Use global_cxxflags as well as global_cflags in CXXFLAGS.
2008-02-04 Alp Toker <alp@atoker.com>
Rubber-stamped by Mark Rowe.
Remove all trailing whitespace in the GTK+ port and related
components.
* GNUmakefile.am:
2008-02-02 Darin Adler <darin@apple.com>
Reviewed by Geoff Garen.
PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
slower due to r28884 (global variable symbol table optimization)
Geoff's theory is that the slowdown was due to copying hash tables when
putting things into the back/forward cache. If that's true, then this
should fix the problem.
(According to Geoff's measurements, in a PLT that exaggerates the
importance of symbol table saving during cached page creation, this
patch is a ~3X speedup in cached page creation, and a 9% speedup overall.)
* JavaScriptCore.exp: Updated.
* kjs/JSVariableObject.cpp:
(KJS::JSVariableObject::saveLocalStorage): Updated for changes to SavedProperty,
which has been revised to avoid initializing each SavedProperty twice when building
the array. Store the property names too, so we don't have to store the symbol table
separately. Do this by iterating the symbol table instead of the local storage vector.
(KJS::JSVariableObject::restoreLocalStorage): Ditto. Restore the symbol table as
well as the local storage vector.
* kjs/JSVariableObject.h: Removed save/restoreSymbolTable and do that work inside
save/restoreLocalStorage instead. Made restoreLocalStorage a non-const member function
that takes a const reference to a SavedProperties object.
* kjs/LocalStorage.h: Changed attributes to be unsigned instead of int to match
other declarations of attributes elsewhere.
* kjs/property_map.cpp:
(KJS::SavedProperties::SavedProperties): Updated for data member name change.
(KJS::PropertyMap::save): Updated for data member name change and to use the new
inline init function instead of setting the fields directly. This allows us to
skip initializing the SavedProperty objects when first allocating the array, and
just do it when we're actually setting up the individual elements.
(KJS::PropertyMap::restore): Updated for SavedProperty changes.
* kjs/property_map.h: Changed SavedProperty from a struct to a class. Set it up so
it does not get initialized at construction time to avoid initializing twice when
creating an array of SavedProperty. Removed the m_ prefixes from the members of
the SavedProperties struct. Generally we use m_ for class members and not struct.
2008-02-02 Tony Chang <idealisms@gmail.com>
Reviewed by darin. Landed by eseidel.
Add #define guards for WIN32_LEAN_AND_MEAN and _CRT_RAND_S.
* kjs/config.h:
* wtf/FastMalloc.cpp:
* wtf/TCSpinLock.h:
2008-01-28 Sam Weinig <sam@webkit.org>
Rubber-stamped by Darin Adler.
- Fix whitespace in nodes.h/cpp and nodes2string.cpp.
(NOTE: Specific changed functions elided for space and clarity)
* kjs/nodes.cpp:
* kjs/nodes.h:
* kjs/nodes2string.cpp:
2008-01-27 Sam Weinig <sam@webkit.org>
Reviewed by Oliver Hunt.
Patch for http://bugs.webkit.org/show_bug.cgi?id=17025
nodes.h/cpp has been rolling around in the mud - lets hose it down
- Rename member variables to use the m_ prefix.
(NOTE: Specific changed functions elided for space and clarity)
* kjs/grammar.y:
* kjs/nodes.cpp:
* kjs/nodes.h:
* kjs/nodes2string.cpp:
2008-01-27 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- fix <rdar://problem/5657450> REGRESSION: const is broken
Test: fast/js/const.html
SunSpider said this was 0.3% slower. And I saw some Shark samples in
JSGlobalObject::put -- not a lot but a few. We may be able to regain the
speed, but for now we will take that small hit for correctness sake.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::put): Pass the checkReadOnly flag in to symbolTablePut
instead of passing attributes.
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTablePut): Removed the code to set attributes
here, since we only set attributes when creating a property. Added the code
to check read-only here, since we need that to implement const!
* kjs/function.cpp:
(KJS::ActivationImp::put): Pass the checkReadOnly flag in to symbolTablePut
instead of passing attributes.
* kjs/nodes.cpp:
(KJS::isConstant): Added.
(KJS::PostIncResolveNode::optimizeVariableAccess): Create a PostIncConstNode
if optimizing for a local variable and the variable is constant.
(KJS::PostDecResolveNode::optimizeVariableAccess): Ditto. But PostDecConstNode.
(KJS::PreIncResolveNode::optimizeVariableAccess): Ditto. But PreIncConstNode.
(KJS::PreDecResolveNode::optimizeVariableAccess): Ditto. But PreDecConstNode.
(KJS::PreIncConstNode::evaluate): Return the value + 1.
(KJS::PreDecConstNode::evaluate): Return the value - 1.
(KJS::PostIncConstNode::evaluate): Return the value converted to a number.
(KJS::PostDecConstNode::evaluate): Ditto.
(KJS::ReadModifyResolveNode::optimizeVariableAccess): Create a ReadModifyConstNode
if optimizing for a local variable and the variable is constant.
(KJS::AssignResolveNode::optimizeVariableAccess): Ditto. But AssignConstNode.
(KJS::ScopeNode::optimizeVariableAccess): Pass the local storage to the
node optimizeVariableAccess functions, since that's where we need to look to
figure out if a variable is constant.
(KJS::FunctionBodyNode::processDeclarations): Moved the call to
optimizeVariableAccess until after localStorage is set up.
(KJS::ProgramNode::processDeclarations): Ditto.
* kjs/nodes.h: Fixed the IsConstant and HasInitializer values. They are used
as flag masks, so a value of 0 will not work for IsConstant. Changed the
first parameter to optimizeVariableAccess to be a const reference to a symbol
table and added a const reference to local storage. Added classes for const
versions of local variable access: PostIncConstNode, PostDecConstNode,
PreIncConstNode, PreDecConstNode, ReadModifyConstNode, and AssignConstNode.
* kjs/object.cpp:
(KJS::JSObject::put): Tweaked comments a bit, and changed the checkReadOnly
expression to match the form used at the two other call sites.
2008-01-27 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- fix http://bugs.webkit.org/show_bug.cgi?id=16498
''.constructor.toString() gives [function]
Test: fast/js/function-names.html
* kjs/array_object.cpp:
(KJS::ArrayObjectImp::ArrayObjectImp): Use the class name as the constructor's function name.
* kjs/bool_object.cpp:
(KJS::BooleanObjectImp::BooleanObjectImp): Ditto.
* kjs/date_object.cpp:
(KJS::DateObjectImp::DateObjectImp): Ditto.
* kjs/error_object.cpp:
(KJS::ErrorPrototype::ErrorPrototype): Make the error object be an Error.
(KJS::ErrorObjectImp::ErrorObjectImp): Use the class name as the constructor's function name.
(KJS::NativeErrorPrototype::NativeErrorPrototype): Take const UString&.
(KJS::NativeErrorImp::NativeErrorImp): Use the prototype's name as the constructor's function
name.
* kjs/error_object.h: Change ErrorPrototype to inherit from ErrorInstance. Change the
NativeErrorImp constructor to take a NativeErrorPrototype pointer for its prototype.
* kjs/function.h: Removed unneeded constructor for internal functions without names.
We want to avoid those!
* kjs/function_object.cpp:
(KJS::functionProtoFuncToString): Removed code that writes out just [function] for functions
that have no names. There's no reason to do that.
(KJS::FunctionObjectImp::FunctionObjectImp): Use the class name as the constructor's
function name.
* kjs/internal.cpp: Removed the unused constructor.
* kjs/number_object.cpp:
(KJS::fractionalPartToString): Marked static for internal linkage.
(KJS::exponentialPartToString): Ditto.
(KJS::numberProtoFuncToPrecision): Removed an unneeded else.
(KJS::NumberObjectImp::NumberObjectImp): Use the class name as the constructor's
function name.
(KJS::NumberObjectImp::getValueProperty): Tweaked formatting.
* kjs/object_object.cpp:
(KJS::ObjectObjectImp::ObjectObjectImp): Use "Object" for the function name.
* kjs/regexp_object.cpp:
(KJS::RegExpObjectImp::RegExpObjectImp): Use "RegExp" for the function name.
* kjs/string_object.cpp:
(KJS::StringObjectImp::StringObjectImp): Use the class name as the constructor's
function name.
2008-01-26 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- fix http://bugs.webkit.org/show_bug.cgi?id=17027
Incorrect Function.toString behaviour with read/modify/write operators performed on negative numbers
Test: fast/js/function-toString-parentheses.html
The problem here was that a NumberNode with a negative number in it had the wrong
precedence. It's not a primary expression, it's a unary operator with a primary
expression after it.
Once the precedence of NumberNode was fixed, the cases from bug 17020 were also
fixed without trying to treat bracket nodes like dot nodes. That wasn't needed.
The reason we handle numbers before dot nodes specially is that the dot is a
legal character in a number. The same is not true of a bracket. Eventually we
could get smarter, and only add the parentheses when there is actual ambiguity.
There is none if the string form of the number already has a dot in it, or if
it's a number with a alphabetic name like infinity or NAN.
* kjs/nodes.h: Renamed back from ObjectAccess to DotExpr.
(KJS::NumberNode::precedence): Return PrecUnary for negative numbers, since
they serialize as a unary operator, not a primary expression.
* kjs/nodes2string.cpp:
(KJS::SourceStream::operator<<): Clear m_numberNeedsParens if this adds
parens; one set is enough.
(KJS::bracketNodeStreamTo): Remove unneeded special flag here. Normal
operator precedence suffices.
(KJS::NewExprNode::streamTo): Ditto.
2008-01-26 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej and Darin.
Fix for http://bugs.webkit.org/show_bug.cgi?id=17020
Function.toString does not parenthesise numbers for the bracket accessor
It turns out that logic was there for all of the dot accessor nodes to make numbers be
parenthesised properly, so it was a trivial extension to extend that to the bracket nodes.
I renamed the enum type to reflect the fact that it is now used for both dot and bracket
accessors.
* kjs/nodes2string.cpp:
(KJS::bracketNodeStreamTo):
(KJS::BracketAccessorNode::streamTo):
2008-01-26 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Fix Bug 17018: Incorrect code generated from Function.toString for get/setters in object literals
Don't quote getter and setter names during output, as that is simply wrong.
* kjs/nodes2string.cpp:
(KJS::PropertyNode::streamTo):
2008-01-26 Darin Adler <darin@apple.com>
Reviewed by Eric Seidel.
- http://bugs.webkit.org/show_bug.cgi?id=16860
a bit of cleanup after the Activation optimization
* JavaScriptCore.exp: Export the GlobalExecState constructor instead of
the global flavor of the ExecState constructor. It'd probably be cleaner
to not export either one, but JSGlobalObject inlines the code that
constructs the ExecState. If we changed that, we could remove this export.
* JavaScriptCore.xcodeproj/project.pbxproj: Re-sorted a few things and
put the new source files into the kjs group rather than at the top level.
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState): Marked inline and updated for data member
name changes. This is now only for use for the derived classes. Also removed
code that sets the unused m_savedExec data member for the global case. That
data member is only used for the other two types.
(KJS::ExecState::~ExecState): Marked inline and removed all the code.
The derived class destructors now inclde the appropriate code.
(KJS::ExecState::lexicalGlobalObject): Removed unneeded special case for
an empty scope chain. The bottom function already returns 0 for that case,
so the general case code handles it fine. Also changed to use data members
directly rather than calling functions.
(KJS::GlobalExecState::GlobalExecState): Added. Calls through to the base
class constructor.
(KJS::GlobalExecState::~GlobalExecState): Added.
(KJS::InterpreterExecState::InterpreterExecState): Added. Moved code to
manipulate activeExecStates here since we don't want to have to check for the
special case of globalExec.
(KJS::InterpreterExecState::~InterpreterExecState): Added.
(KJS::EvalExecState::EvalExecState): Added.
(KJS::EvalExecState::~EvalExecState): Added.
(KJS::FunctionExecState::FunctionExecState): Added.
(KJS::FunctionExecState::~FunctionExecState): Added.
* kjs/ExecState.h: Tweaked the header, includes, and declarations a bit.
Made ExecState inherit from Noncopyable. Reformatted some comments and
made them a bit more brief. Rearranged declarations a little bit and removed
unused savedExec function. Changed seenLabels function to return a reference
rather than a pointer. Made constructors and destructor protected, and also
did the same with all data members. Renamed m_thisVal to m_thisValue and
ls to m_labelStack. Added three new derived classes for each of the
types of ExecState. The primary goal here was to remove a branch from the
code in the destructor, but it's also clearer than overloading the arguments
to the ExecState constructor.
* kjs/JSGlobalObject.cpp:
(KJS::getCurrentTime): Fixed formatting.
(KJS::JSGlobalObject::pushActivation): Removed parentheses that don't make
the expression clearer -- other similar sites didn't have these parentheses,
even the one a couple lines earlier that sets stackEntry.
(KJS::JSGlobalObject::tearOffActivation): Got rid of unneeded static_cast
(I think I mentioned this during patch review) and used an early exit so that
the entire contents of the function aren't nested inside an if statement.
Also removed the check of codeType, instead checking Activation for 0.
For now, I kept the codeType check, but inside an assertion.
* kjs/JSGlobalObject.h: Changed type of globalExec to GlobalExecState.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction): Changed type to FunctionExecState.
(KJS::GlobalFuncImp::callAsFunction): Changed type to EvalExecState.
* kjs/interpreter.cpp:
(KJS::Interpreter::evaluate): Changed type to GlobalExecState.
* kjs/nodes.cpp:
(KJS::ContinueNode::execute): Changed code since seenLabels() returns a
reference now instead of a pointer.
(KJS::BreakNode::execute): Ditto.
(KJS::LabelNode::execute): Ditto.
2008-01-26 Sam Weinig <sam@webkit.org>
Reviewed by Mark Rowe.
Cleanup node2string a little.
- Remove some unnecessary branching.
- Factor out bracket and dot streaming into static inline functions.
* kjs/nodes.h:
* kjs/nodes2string.cpp:
(KJS::bracketNodeStreamTo):
(KJS::dotNodeStreamTo):
(KJS::FunctionCallBracketNode::streamTo):
(KJS::FunctionCallDotNode::streamTo):
(KJS::PostIncBracketNode::streamTo):
(KJS::PostDecBracketNode::streamTo):
(KJS::PostIncDotNode::streamTo):
(KJS::PostDecDotNode::streamTo):
(KJS::DeleteBracketNode::streamTo):
(KJS::DeleteDotNode::streamTo):
(KJS::PreIncBracketNode::streamTo):
(KJS::PreDecBracketNode::streamTo):
(KJS::PreIncDotNode::streamTo):
(KJS::PreDecDotNode::streamTo):
(KJS::ReadModifyBracketNode::streamTo):
(KJS::AssignBracketNode::streamTo):
(KJS::ReadModifyDotNode::streamTo):
(KJS::AssignDotNode::streamTo):
(KJS::WhileNode::streamTo):
2008-01-26 Mark Rowe <mrowe@apple.com>
Reviewed by Darin Adler.
Fix http://bugs.webkit.org/show_bug.cgi?id=17001
Bug 17001: Build error with Gtk port on Mac OS X
If both XP_MACOSX and XP_UNIX are defined then X11.h and Carbon.h will both be included.
These provide conflicting definitions for a type named 'Cursor'. As XP_UNIX is set by
the build system when targeting X11, it doesn't make sense for XP_MACOSX to also be set
in this instance.
* bindings/npapi.h: Don't define XP_MACOSX if XP_UNIX is defined.
2008-01-26 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- fix http://bugs.webkit.org/show_bug.cgi?id=17013
JSC can't round trip certain for-loops
Test: fast/js/toString-for-var-decl.html
* kjs/nodes.h: Added PlaceholderTrueNode so we can put nodes into
for loops without injecting the word "true" into them (nice, but not
the bug fix). Fixed ForNode constructor so expr1WasVarDecl is set
only when there is an expression, since it's common for the actual
variable declaration to be moved by the parser.
* kjs/nodes2string.cpp:
(KJS::PlaceholderTrueNode::streamTo): Added. Empty.
2008-01-25 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Fix for bug 17012: REGRESSION: JSC can't round trip an object literal
Add logic to ensure that object literals and function expressions get
parentheses when necessary.
* kjs/nodes.h:
* kjs/nodes2string.cpp:
(KJS::SourceStream::operator<<):
2008-01-24 Steve Falkenburg <sfalken@apple.com>
Build fix.
* JavaScriptCore.vcproj/JavaScriptCore.sln:
2008-01-24 Steve Falkenburg <sfalken@apple.com>
Build fix.
* JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Simon.
Fix QDateTime to JS Date conversion.
Several conversion errors (some UTC related, some month
offset related) and the conversion distance for Date
to DateTime conversion weights were fixed (it should never
be better to convert a JS Number into a Date rather than
an int).
* bindings/qt/qt_runtime.cpp:
(KJS::Bindings::convertValueToQVariant):
(KJS::Bindings::convertQVariantToValue):
2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Simon.
Add support for calling QObjects.
Add support for invokeDefaultMethod (via a call to
a specific slot), and also allow using it as a
constructor, like QtScript.
* bindings/qt/qt_class.cpp:
(KJS::Bindings::QtClass::fallbackObject):
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtRuntimeObjectImp::construct):
(KJS::Bindings::QtInstance::QtInstance):
(KJS::Bindings::QtInstance::~QtInstance):
(KJS::Bindings::QtInstance::implementsCall):
(KJS::Bindings::QtInstance::invokeDefaultMethod):
* bindings/qt/qt_instance.h:
* bindings/qt/qt_runtime.cpp:
(KJS::Bindings::findMethodIndex):
(KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
(KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
* bindings/qt/qt_runtime.h:
2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Simon.
Code style cleanups.
Add spaces before/after braces in inline function.
* bindings/qt/qt_instance.h:
2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Simon.
Code style cleanups.
Remove spaces and unneeded declared parameter names.
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Simon.
Clear stale RuntimeObjectImps.
Since other objects can have refs to the QtInstance,
we can't rely on the QtInstance being deleted when the
RuntimeObjectImp is invalidate or deleted. This
could result in a stale JSObject being returned for
a valid Instance.
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
(KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
(KJS::Bindings::QtRuntimeObjectImp::invalidate):
(KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
(KJS::Bindings::QtInstance::getRuntimeObject):
* bindings/runtime.cpp:
(KJS::Bindings::Instance::createRuntimeObject):
* bindings/runtime.h:
2008-01-23 Alp Toker <alp@atoker.com>
Rubber-stamped by Mark Rowe.
Remove whitespace after -I in automake include lists.
* GNUmakefile.am:
2008-01-23 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Lars Knoll <lars@trolltech.com>.
Reworked the JavaScriptCore Qt bindings:
* Add initial support for string and variant arrays, as well
as sub QObjects in the JS bindings.
* Don't expose fields marked as not scriptable by moc.
* Add support for dynamic properties and accessing named
QObject children of an object (like QtScript and older
IE DOM style JS).
* Add support for custom toString methods.
* Fine tune some bindings to be closer to QtScript.
Make void functions return undefined, and empty/
null QStrings return a zero length string.
* Create framework for allowing more direct method calls.
Since RuntimeMethod doesn't allow us to add additional
methods/properties to a function, add these classes.
Start prototyping object.signal.connect(...).
* Add signal support to the Qt bindings.
Allow connecting to signals (object.signal.connect(slot)),
disconnecting, and emitting signals. Currently chooses
the first signal that matches the name, so this will need
improvement.
* Add property names, and resolve signals closer to use.
Enumerating properties now returns some of the Qt properties
and signals. Slots and methods aren't quite present. Also,
resolve signal connections etc. closer to the time of use, so
we can do more dynamic resolution based on argument type etc.
Still picks the first one with the same name, at the moment.
* Make signature comparison code consistent.
Use the same code for checking meta signatures in
the method and fallback getters, and avoid a
QByteArray construction when we can.
* Fix minor memory leak, and handle pointers better.
Delete the private object in the dtors, and use RefPtrs
for holding Instances etc.
* Handle method lookup better.
Allow invocation time method lookup based on the arguments,
which is closer to QtScript behaviour. Also, cache the
method lists and delete them in the QtClass dtor (stops
a memory leak).
* Improve JS to Qt data type conversions.
Add some support for Date & RegExp JS objects,
and provide some metrics on the quality of the
conversion.
* A couple of fixes for autotest failures.
Better support for converting lists, read/write only
QMetaProperty support, modified slot search order...)
* bindings/qt/qt_class.cpp:
(KJS::Bindings::QtClass::QtClass):
(KJS::Bindings::QtClass::~QtClass):
(KJS::Bindings::QtClass::name):
(KJS::Bindings::QtClass::fallbackObject):
(KJS::Bindings::QtClass::methodsNamed):
(KJS::Bindings::QtClass::fieldNamed):
* bindings/qt/qt_class.h:
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtInstance::QtInstance):
(KJS::Bindings::QtInstance::~QtInstance):
(KJS::Bindings::QtInstance::getRuntimeObject):
(KJS::Bindings::QtInstance::getClass):
(KJS::Bindings::QtInstance::implementsCall):
(KJS::Bindings::QtInstance::getPropertyNames):
(KJS::Bindings::QtInstance::invokeMethod):
(KJS::Bindings::QtInstance::invokeDefaultMethod):
(KJS::Bindings::QtInstance::stringValue):
(KJS::Bindings::QtInstance::booleanValue):
(KJS::Bindings::QtInstance::valueOf):
(KJS::Bindings::QtField::name):
(KJS::Bindings::QtField::valueFromInstance):
(KJS::Bindings::QtField::setValueToInstance):
* bindings/qt/qt_instance.h:
(KJS::Bindings::QtInstance::getBindingLanguage):
(KJS::Bindings::QtInstance::getObject):
* bindings/qt/qt_runtime.cpp:
(KJS::Bindings::QWKNoDebug::QWKNoDebug):
(KJS::Bindings::QWKNoDebug::~QWKNoDebug):
(KJS::Bindings::QWKNoDebug::operator<<):
(KJS::Bindings::):
(KJS::Bindings::valueRealType):
(KJS::Bindings::convertValueToQVariant):
(KJS::Bindings::convertQVariantToValue):
(KJS::Bindings::QtRuntimeMethod::QtRuntimeMethod):
(KJS::Bindings::QtRuntimeMethod::~QtRuntimeMethod):
(KJS::Bindings::QtRuntimeMethod::codeType):
(KJS::Bindings::QtRuntimeMethod::execute):
(KJS::Bindings::QtRuntimeMethodData::~QtRuntimeMethodData):
(KJS::Bindings::QtRuntimeMetaMethodData::~QtRuntimeMetaMethodData):
(KJS::Bindings::QtRuntimeConnectionMethodData::~QtRuntimeConnectionMethodData):
(KJS::Bindings::QtMethodMatchType::):
(KJS::Bindings::QtMethodMatchType::QtMethodMatchType):
(KJS::Bindings::QtMethodMatchType::kind):
(KJS::Bindings::QtMethodMatchType::isValid):
(KJS::Bindings::QtMethodMatchType::isVariant):
(KJS::Bindings::QtMethodMatchType::isMetaType):
(KJS::Bindings::QtMethodMatchType::isUnresolved):
(KJS::Bindings::QtMethodMatchType::isMetaEnum):
(KJS::Bindings::QtMethodMatchType::enumeratorIndex):
(KJS::Bindings::QtMethodMatchType::variant):
(KJS::Bindings::QtMethodMatchType::metaType):
(KJS::Bindings::QtMethodMatchType::metaEnum):
(KJS::Bindings::QtMethodMatchType::unresolved):
(KJS::Bindings::QtMethodMatchType::typeId):
(KJS::Bindings::QtMethodMatchType::name):
(KJS::Bindings::QtMethodMatchData::QtMethodMatchData):
(KJS::Bindings::QtMethodMatchData::isValid):
(KJS::Bindings::QtMethodMatchData::firstUnresolvedIndex):
(KJS::Bindings::indexOfMetaEnum):
(KJS::Bindings::findMethodIndex):
(KJS::Bindings::findSignalIndex):
(KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
(KJS::Bindings::QtRuntimeMetaMethod::mark):
(KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
(KJS::Bindings::QtRuntimeMetaMethod::getOwnPropertySlot):
(KJS::Bindings::QtRuntimeMetaMethod::lengthGetter):
(KJS::Bindings::QtRuntimeMetaMethod::connectGetter):
(KJS::Bindings::QtRuntimeMetaMethod::disconnectGetter):
(KJS::Bindings::QtRuntimeConnectionMethod::QtRuntimeConnectionMethod):
(KJS::Bindings::QtRuntimeConnectionMethod::callAsFunction):
(KJS::Bindings::QtRuntimeConnectionMethod::getOwnPropertySlot):
(KJS::Bindings::QtRuntimeConnectionMethod::lengthGetter):
(KJS::Bindings::QtConnectionObject::QtConnectionObject):
(KJS::Bindings::QtConnectionObject::~QtConnectionObject):
(KJS::Bindings::QtConnectionObject::metaObject):
(KJS::Bindings::QtConnectionObject::qt_metacast):
(KJS::Bindings::QtConnectionObject::qt_metacall):
(KJS::Bindings::QtConnectionObject::execute):
(KJS::Bindings::QtConnectionObject::match):
(KJS::Bindings::::QtArray):
(KJS::Bindings::::~QtArray):
(KJS::Bindings::::rootObject):
(KJS::Bindings::::setValueAt):
(KJS::Bindings::::valueAt):
* bindings/qt/qt_runtime.h:
(KJS::Bindings::QtField::):
(KJS::Bindings::QtField::QtField):
(KJS::Bindings::QtField::fieldType):
(KJS::Bindings::QtMethod::QtMethod):
(KJS::Bindings::QtMethod::name):
(KJS::Bindings::QtMethod::numParameters):
(KJS::Bindings::QtArray::getLength):
(KJS::Bindings::QtRuntimeMethod::d_func):
(KJS::Bindings::QtRuntimeMetaMethod::d_func):
(KJS::Bindings::QtRuntimeConnectionMethod::d_func):
(KJS::Bindings::):
* bindings/runtime.cpp:
(KJS::Bindings::Instance::createBindingForLanguageInstance):
(KJS::Bindings::Instance::createRuntimeObject):
(KJS::Bindings::Instance::reallyCreateRuntimeObject):
* bindings/runtime.h:
2008-01-22 Anders Carlsson <andersca@apple.com>
Reviewed by Darin and Adam.
<rdar://problem/5688975>
div element on microsoft site has wrong left offset.
Return true even if NPN_GetProperty returns null or undefined. This matches Firefox
(and is what the Silverlight plug-in expects).
* bindings/NP_jsobject.cpp:
(_NPN_GetProperty):
2008-01-21 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed http://bugs.webkit.org/show_bug.cgi?id=16909
REGRESSION: Amazon.com crash (ActivationImp)
(and a bunch of other crashes)
Plus, a .7% SunSpider speedup to boot.
Replaced the buggy currentExec and savedExec mechanisms with an
explicit ExecState stack.
* kjs/collector.cpp:
(KJS::Collector::collect): Explicitly mark the ExecState stack.
(KJS::Collector::reportOutOfMemoryToAllExecStates): Slight change in
behavior: We no longer throw an exception in any global ExecStates,
since global ExecStates are more like pseudo-ExecStates, and aren't
used for script execution. (It's unclear what would happen if you left
an exception waiting around in a global ExecState, but it probably
wouldn't be good.)
2008-01-21 Jan Michael Alonzo <jmalonzo@unpluggable.com>
Reviewed by Alp Toker.
http://bugs.webkit.org/show_bug.cgi?id=16955
Get errors when cross-compile webkit-gtk
* GNUmakefile.am: removed ICU_CFLAGS
2008-01-18 Kevin McCullough <kmccullough@apple.com>
- Build fix.
* kjs/ustring.h:
2008-01-18 Kevin McCullough <kmccullough@apple.com>
- Build fix.
* kjs/ustring.cpp:
* kjs/ustring.h:
(KJS::UString::cost):
2008-01-18 Kevin McCullough <kmccullough@apple.com>
Reviewed by Geoff.
- Correctly report cost of appended strings to trigger GC.
* kjs/ustring.cpp:
(KJS::):
(KJS::UString::Rep::create):
(KJS::UString::UString): Don't create unnecssary objects.
(KJS::UString::cost): Report cost if necessary but also keep track of
reported cost.
* kjs/ustring.h:
2008-01-18 Simon Hausmann <hausmann@webkit.org>
Reviewed by Holger.
Fix return type conversions from Qt slots to JS values.
This also fixes fast/dom/open-and-close-by-DOM.html, which called
layoutTestController.windowCount().
When constructing the QVariant that holds the return type we cannot
use the QVarian(Type) constuctor as that will create a null variant.
We have to use the QVariant(Type, void *) constructor instead, just
like in QMetaObject::read() for example.
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtInstance::getRuntimeObject):
2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
Reviewed by Simon Hausmann <hausmann@webkit.org>.
Fix compilation on Win64(2): Implemented currentThreadStackBase on X86-64 on Windows
* kjs/collector.cpp:
(KJS::Collector::heapAllocate):
2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
Reviewed by Simon Hausmann <hausmann@webkit.org>.
Fix compilation on Win64(1): Define WTF_PLATFORM_X86_64 correctly on Win64.
* wtf/Platform.h:
2008-01-17 Antti Koivisto <antti@apple.com>
Fix Windows build.
* kjs/regexp_object.cpp:
(KJS::regExpProtoFuncToString):
2008-01-16 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
Fix for http://bugs.webkit.org/show_bug.cgi?id=16901
Convert remaining JS function objects to use the new PrototypeFunction class
- Moves Boolean, Function, RegExp, Number, Object and Global functions to their
own static function implementations so that they can be used with the
PrototypeFunction class. SunSpider says this is 1.003x as fast.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset):
* kjs/array_object.h:
* kjs/bool_object.cpp:
(KJS::BooleanInstance::BooleanInstance):
(KJS::BooleanPrototype::BooleanPrototype):
(KJS::booleanProtoFuncToString):
(KJS::booleanProtoFuncValueOf):
(KJS::BooleanObjectImp::BooleanObjectImp):
(KJS::BooleanObjectImp::implementsConstruct):
(KJS::BooleanObjectImp::construct):
(KJS::BooleanObjectImp::callAsFunction):
* kjs/bool_object.h:
(KJS::BooleanInstance::classInfo):
* kjs/error_object.cpp:
(KJS::ErrorPrototype::ErrorPrototype):
(KJS::errorProtoFuncToString):
* kjs/error_object.h:
* kjs/function.cpp:
(KJS::globalFuncEval):
(KJS::globalFuncParseInt):
(KJS::globalFuncParseFloat):
(KJS::globalFuncIsNaN):
(KJS::globalFuncIsFinite):
(KJS::globalFuncDecodeURI):
(KJS::globalFuncDecodeURIComponent):
(KJS::globalFuncEncodeURI):
(KJS::globalFuncEncodeURIComponent):
(KJS::globalFuncEscape):
(KJS::globalFuncUnEscape):
(KJS::globalFuncKJSPrint):
(KJS::PrototypeFunction::PrototypeFunction):
* kjs/function.h:
* kjs/function_object.cpp:
(KJS::FunctionPrototype::FunctionPrototype):
(KJS::functionProtoFuncToString):
(KJS::functionProtoFuncApply):
(KJS::functionProtoFuncCall):
* kjs/function_object.h:
* kjs/number_object.cpp:
(KJS::NumberPrototype::NumberPrototype):
(KJS::numberProtoFuncToString):
(KJS::numberProtoFuncToLocaleString):
(KJS::numberProtoFuncValueOf):
(KJS::numberProtoFuncToFixed):
(KJS::numberProtoFuncToExponential):
(KJS::numberProtoFuncToPrecision):
* kjs/number_object.h:
(KJS::NumberInstance::classInfo):
(KJS::NumberObjectImp::classInfo):
(KJS::NumberObjectImp::):
* kjs/object_object.cpp:
(KJS::ObjectPrototype::ObjectPrototype):
(KJS::objectProtoFuncValueOf):
(KJS::objectProtoFuncHasOwnProperty):
(KJS::objectProtoFuncIsPrototypeOf):
(KJS::objectProtoFuncDefineGetter):
(KJS::objectProtoFuncDefineSetter):
(KJS::objectProtoFuncLookupGetter):
(KJS::objectProtoFuncLookupSetter):
(KJS::objectProtoFuncPropertyIsEnumerable):
(KJS::objectProtoFuncToLocaleString):
(KJS::objectProtoFuncToString):
* kjs/object_object.h:
* kjs/regexp_object.cpp:
(KJS::RegExpPrototype::RegExpPrototype):
(KJS::regExpProtoFuncTest):
(KJS::regExpProtoFuncExec):
(KJS::regExpProtoFuncCompile):
(KJS::regExpProtoFuncToString):
* kjs/regexp_object.h:
2008-01-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej & Darin.
Fixes Bug 16868: Gmail crash
and Bug 16871: Crash when loading apple.com/startpage
<http://bugs.webkit.org/show_bug.cgi?id=16868>
<rdar://problem/5686108>
<http://bugs.webkit.org/show_bug.cgi?id=16871>
<rdar://problem/5686670>
Adds ActivationImp tear-off for cross-window eval() and fixes an
existing garbage collection issue exposed by the ActivationImp tear-off
patch (r29425) that can occur when an ExecState's m_callingExec is
different than its m_savedExec.
* kjs/ExecState.cpp:
(KJS::ExecState::mark):
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction):
2008-01-16 Sam Weinig <sam@webkit.org>
Reviewed by Oliver.
Clean up MathObjectImp, it needed a little scrubbing.
* kjs/math_object.cpp:
(KJS::MathObjectImp::MathObjectImp):
(KJS::MathObjectImp::getOwnPropertySlot):
(KJS::MathObjectImp::getValueProperty):
(KJS::mathProtoFuncACos):
(KJS::mathProtoFuncASin):
(KJS::mathProtoFuncATan):
(KJS::mathProtoFuncATan2):
(KJS::mathProtoFuncCos):
(KJS::mathProtoFuncExp):
(KJS::mathProtoFuncLog):
(KJS::mathProtoFuncSin):
(KJS::mathProtoFuncSqrt):
(KJS::mathProtoFuncTan):
* kjs/math_object.h:
(KJS::MathObjectImp::classInfo):
(KJS::MathObjectImp::):
2008-01-16 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
Rename Lexer variable bol to atLineStart.
* kjs/lexer.cpp:
(KJS::Lexer::Lexer):
(KJS::Lexer::setCode):
(KJS::Lexer::nextLine):
(KJS::Lexer::lex):
* kjs/lexer.h:
2008-01-16 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen and Anders Carlsson.
Remove uses of KJS_PURE_ECMA as we don't ever build with it defined,
and we have many features that are not included in the ECMA spec.
* kjs/lexer.cpp:
(KJS::Lexer::Lexer):
(KJS::Lexer::setCode):
(KJS::Lexer::nextLine):
(KJS::Lexer::lex):
* kjs/lexer.h:
* kjs/string_object.cpp:
* kjs/string_object.h:
2008-01-15 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
Fix <rdar://problem/5595552> r27608 introduced a 20% increase in JS binary size, 4% increase in WebCore binary size
- This changes the way JS functions that use Lookup tables are handled. Instead of using
one class per function, which allowed specialization of the virtual callAsFunction
method, we now use one class, PrototypeFunction, which takes a pointer to a static
function to use as the implementation. This significantly decreases the binary size
of JavaScriptCore (about 145k on an Intel only build) while still keeping some of the
speedup r27608 garnered (SunSpider says this is 1.005x as slow, which should leave some
wiggle room from the original 1% speedup) and keeps the functions implementations in separate
functions to help with optimizations.
* JavaScriptCore.exp:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/array_object.cpp:
(KJS::arrayProtoFuncToString):
(KJS::arrayProtoFuncToLocaleString):
(KJS::arrayProtoFuncJoin):
(KJS::arrayProtoFuncConcat):
(KJS::arrayProtoFuncPop):
(KJS::arrayProtoFuncPush):
(KJS::arrayProtoFuncReverse):
(KJS::arrayProtoFuncShift):
(KJS::arrayProtoFuncSlice):
(KJS::arrayProtoFuncSort):
(KJS::arrayProtoFuncSplice):
(KJS::arrayProtoFuncUnShift):
(KJS::arrayProtoFuncFilter):
(KJS::arrayProtoFuncMap):
(KJS::arrayProtoFuncEvery):
(KJS::arrayProtoFuncForEach):
(KJS::arrayProtoFuncSome):
(KJS::arrayProtoFuncIndexOf):
(KJS::arrayProtoFuncLastIndexOf):
* kjs/array_object.h:
* kjs/date_object.cpp:
(KJS::DatePrototype::getOwnPropertySlot):
(KJS::dateProtoFuncToString):
(KJS::dateProtoFuncToUTCString):
(KJS::dateProtoFuncToDateString):
(KJS::dateProtoFuncToTimeString):
(KJS::dateProtoFuncToLocaleString):
(KJS::dateProtoFuncToLocaleDateString):
(KJS::dateProtoFuncToLocaleTimeString):
(KJS::dateProtoFuncValueOf):
(KJS::dateProtoFuncGetTime):
(KJS::dateProtoFuncGetFullYear):
(KJS::dateProtoFuncGetUTCFullYear):
(KJS::dateProtoFuncToGMTString):
(KJS::dateProtoFuncGetMonth):
(KJS::dateProtoFuncGetUTCMonth):
(KJS::dateProtoFuncGetDate):
(KJS::dateProtoFuncGetUTCDate):
(KJS::dateProtoFuncGetDay):
(KJS::dateProtoFuncGetUTCDay):
(KJS::dateProtoFuncGetHours):
(KJS::dateProtoFuncGetUTCHours):
(KJS::dateProtoFuncGetMinutes):
(KJS::dateProtoFuncGetUTCMinutes):
(KJS::dateProtoFuncGetSeconds):
(KJS::dateProtoFuncGetUTCSeconds):
(KJS::dateProtoFuncGetMilliSeconds):
(KJS::dateProtoFuncGetUTCMilliseconds):
(KJS::dateProtoFuncGetTimezoneOffset):
(KJS::dateProtoFuncSetTime):
(KJS::dateProtoFuncSetMilliSeconds):
(KJS::dateProtoFuncSetUTCMilliseconds):
(KJS::dateProtoFuncSetSeconds):
(KJS::dateProtoFuncSetUTCSeconds):
(KJS::dateProtoFuncSetMinutes):
(KJS::dateProtoFuncSetUTCMinutes):
(KJS::dateProtoFuncSetHours):
(KJS::dateProtoFuncSetUTCHours):
(KJS::dateProtoFuncSetDate):
(KJS::dateProtoFuncSetUTCDate):
(KJS::dateProtoFuncSetMonth):
(KJS::dateProtoFuncSetUTCMonth):
(KJS::dateProtoFuncSetFullYear):
(KJS::dateProtoFuncSetUTCFullYear):
(KJS::dateProtoFuncSetYear):
(KJS::dateProtoFuncGetYear):
* kjs/date_object.h:
* kjs/function.cpp:
(KJS::PrototypeFunction::PrototypeFunction):
(KJS::PrototypeFunction::callAsFunction):
* kjs/function.h:
* kjs/lookup.h:
(KJS::HashEntry::):
(KJS::staticFunctionGetter):
* kjs/math_object.cpp:
(KJS::mathProtoFuncAbs):
(KJS::mathProtoFuncACos):
(KJS::mathProtoFuncASin):
(KJS::mathProtoFuncATan):
(KJS::mathProtoFuncATan2):
(KJS::mathProtoFuncCeil):
(KJS::mathProtoFuncCos):
(KJS::mathProtoFuncExp):
(KJS::mathProtoFuncFloor):
(KJS::mathProtoFuncLog):
(KJS::mathProtoFuncMax):
(KJS::mathProtoFuncMin):
(KJS::mathProtoFuncPow):
(KJS::mathProtoFuncRandom):
(KJS::mathProtoFuncRound):
(KJS::mathProtoFuncSin):
(KJS::mathProtoFuncSqrt):
(KJS::mathProtoFuncTan):
* kjs/math_object.h:
* kjs/string_object.cpp:
(KJS::stringProtoFuncToString):
(KJS::stringProtoFuncValueOf):
(KJS::stringProtoFuncCharAt):
(KJS::stringProtoFuncCharCodeAt):
(KJS::stringProtoFuncConcat):
(KJS::stringProtoFuncIndexOf):
(KJS::stringProtoFuncLastIndexOf):
(KJS::stringProtoFuncMatch):
(KJS::stringProtoFuncSearch):
(KJS::stringProtoFuncReplace):
(KJS::stringProtoFuncSlice):
(KJS::stringProtoFuncSplit):
(KJS::stringProtoFuncSubstr):
(KJS::stringProtoFuncSubstring):
(KJS::stringProtoFuncToLowerCase):
(KJS::stringProtoFuncToUpperCase):
(KJS::stringProtoFuncToLocaleLowerCase):
(KJS::stringProtoFuncToLocaleUpperCase):
(KJS::stringProtoFuncLocaleCompare):
(KJS::stringProtoFuncBig):
(KJS::stringProtoFuncSmall):
(KJS::stringProtoFuncBlink):
(KJS::stringProtoFuncBold):
(KJS::stringProtoFuncFixed):
(KJS::stringProtoFuncItalics):
(KJS::stringProtoFuncStrike):
(KJS::stringProtoFuncSub):
(KJS::stringProtoFuncSup):
(KJS::stringProtoFuncFontcolor):
(KJS::stringProtoFuncFontsize):
(KJS::stringProtoFuncAnchor):
(KJS::stringProtoFuncLink):
* kjs/string_object.h:
2008-01-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Adam Roben.
Some tweaks to our headerdoc, suggested by David Gatwood on the docs
team.
* API/JSBase.h:
* API/JSObjectRef.h:
* API/JSStringRef.h:
* API/JSValueRef.h:
2008-01-15 Alp Toker <alp@atoker.com>
Rubber-stamped by Anders.
Make the HTTP backend configurable in the GTK+ port. curl is currently
the only option.
* wtf/Platform.h: Don't hard-code WTF_USE_CURL for GTK
2008-01-15 Sam Weinig <sam@webkit.org>
Reviewed by Beth Dakin.
Remove unneeded variable.
* kjs/string_object.cpp:
(KJS::StringProtoFuncSubstr::callAsFunction):
2008-01-14 Steve Falkenburg <sfalken@apple.com>
Use shared vsprops for most vcproj properties.
Reviewed by Darin.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add missing Debug_Internal config.
* JavaScriptCore.vcproj/WTF/WTF.vcproj: Add missing Debug_Internal config.
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
2008-01-14 Adam Roben <aroben@apple.com>
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
some headers that were missing from the vcproj so their contents will
be included in Find in Files.
2008-01-14 Adam Roben <aroben@apple.com>
Fix Bug 16871: Crash when loading apple.com/startpage
<http://bugs.webkit.org/show_bug.cgi?id=16871>
<rdar://problem/5686670>
Patch written by Darin, reviewed by me.
* kjs/ExecState.cpp:
(KJS::ExecState::mark): Call ActivationImp::markChildren if our
m_activation is on the stack. This is what ScopeChain::mark also does,
but apparently in some cases it's possible for an ExecState's
ActivationImp to not be in any ScopeChain.
2008-01-14 Kevin McCullough <kmccullough@apple.com>
Reviewed by Oliver.
-<rdar://problem/5622667> REGRESSION (Leopard-ToT): Endless loading loop
trying to view techreport.com comments
- We need to set values in the map, because if they are already in the
map they will not be reset when we use add().
* kjs/array_instance.cpp:
(KJS::ArrayInstance::put):
2008-01-14 Darin Adler <darin@apple.com>
Reviewed by Adam.
- re-speed-up the page load test (my StringImpl change slowed it down)
* wtf/RefCounted.h:
(WTF::RefCounted::RefCounted): Allow derived classes to start with a reference
count other than 0. Eventually everyone will want to start with a 1. This is a
staged change. For now, there's a default of 0, and you can specify 1. Later,
there will be no default and everyone will have to specify. And then later, there
will be a default of 1. Eventually, we can take away even the option of starting
with 0!
* wtf/Vector.h:
(WTF::Vector::Vector): Sped up creation of non-empty vectors by removing the
overhead of first constructing something empty and then calling resize.
(WTF::Vector::clear): Sped up the common case of calling clear on an empty
vector by adding a check for that case.
(WTF::Vector::releaseBuffer): Marked this function inline and removed a branch
in the case of vectors with no inline capacity (normal vectors) by leaving out
the code to copy the inline buffer in that case.
2008-01-14 Alexey Proskuryakov <ap@webkit.org>
Reviewed by David Kilzer.
http://bugs.webkit.org/show_bug.cgi?id=16787
array.splice() with 1 element not working
Test: fast/js/array-splice.html
* kjs/array_object.cpp:
(KJS::ArrayProtoFuncSplice::callAsFunction): Implement this Mozilla extension, and fix
some other edge cases.
2008-01-13 Steve Falkenburg <sfalken@apple.com>
Share common files across projects.
Unify vsprops files
Debug: common.vsprops, debug.vsprops
Debug_Internal: common.vsprops, debug.vsprops, debug_internal.vsprops
Release: common.vsprops, release.vsprops
Shared properties can go into common.vsprops, shared debug settings can go into debug.vsprops.
debug_internal.vsprops will be mostly empty except for file path prefix modifiers.
Reviewed by Adam Roben.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.vcproj/debug.vsprops: Removed.
* JavaScriptCore.vcproj/debug_internal.vsprops: Removed.
* JavaScriptCore.vcproj/release.vsprops: Removed.
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
2008-01-13 Marius Bugge Monsen <mbm@trolltech.com>
Contributions and review by Adriaan de Groot,
Simon Hausmann, Eric Seidel, and Darin Adler.
- http://bugs.webkit.org/show_bug.cgi?id=16590
Compilation fixes for Solaris.
* kjs/DateMath.h:
(KJS::GregorianDateTime::GregorianDateTime): Use the WIN_OS code path
for SOLARIS too, presumably because Solaris also lacks the tm_gtoff and tm_zone
fields.
(KJS::GregorianDateTime::operator tm): Ditto.
* kjs/collector.cpp:
(KJS::currentThreadStackBase): Use thr_stksegment on Solaris.
* wtf/MathExtras.h:
(isfinite): Implement for Solaris.
(isinf): Ditto.
(signbit): Ditto. But this one is wrong, so I added a FIXME.
* wtf/Platform.h: Define PLATFORM(SOLARIS) when "sun" or "__sun" is defined.
2008-01-13 Michael Goddard <michael.goddard@trolltech.com>
Reviewed by Anders Carlsson.
Add binding language type to Instance.
Allows runtime determination of the type of an
Instance, to allow safe casting. Doesn't actually
add any safe casting yet, though.
Add a helper function to get an Instance from a JSObject*.
Given an object and the expected binding language, see if
the JSObject actually wraps an Instance of the given type
and return it. Otherwise return 0.
Move RuntimeObjectImp creations into Instance.
Make the ctor protected, and Instance a friend class, so
that all creation of RuntimeObjectImps goes through
one place.
Remove copy ctor/assignment operator for QtInstance.
Instance itself is Noncopyable, so QtInstance doesn't
need to have these.
Add caching for QtInstance and associated RuntimeObjectImps.
Push any dealings with QtLanguage bindings into QtInstance,
and cache them there, rather than in the Instance layer. Add
a QtRuntimeObjectImp to help with caching.
* JavaScriptCore.exp:
* bindings/c/c_instance.h:
* bindings/jni/jni_instance.h:
* bindings/objc/objc_instance.h:
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
(KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
(KJS::Bindings::QtRuntimeObjectImp::invalidate):
(KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
(KJS::Bindings::QtInstance::QtInstance):
(KJS::Bindings::QtInstance::~QtInstance):
(KJS::Bindings::QtInstance::getQtInstance):
(KJS::Bindings::QtInstance::getRuntimeObject):
* bindings/qt/qt_instance.h:
(KJS::Bindings::QtInstance::getBindingLanguage):
* bindings/runtime.cpp:
(KJS::Bindings::Instance::createBindingForLanguageInstance):
(KJS::Bindings::Instance::createRuntimeObject):
(KJS::Bindings::Instance::getInstance):
* bindings/runtime.h:
* bindings/runtime_object.h:
(KJS::RuntimeObjectImp::getInternalInstance):
2008-01-12 Alp Toker <alp@atoker.com>
Reviewed by Mark Rowe.
Hide non-public symbols in GTK+/autotools release builds.
* GNUmakefile.am:
2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Mark Rowe.
Fix http://bugs.webkit.org/show_bug.cgi?id=16852
Fixes leaking of ActivationStackNode objects.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::deleteActivationStack):
(KJS::JSGlobalObject::~JSGlobalObject):
(KJS::JSGlobalObject::init):
(KJS::JSGlobalObject::reset):
* kjs/JSGlobalObject.h:
2008-01-12 Darin Adler <darin@apple.com>
- try to fix Qt Windows build
* pcre/dftables: Remove reliance on the list form of Perl pipes.
2008-01-12 Darin Adler <darin@apple.com>
- try to fix Qt build
* kjs/function.cpp: Added include of scope_chain_mark.h.
* kjs/scope_chain_mark.h: Added multiple-include guards.
2008-01-12 Mark Rowe <mrowe@apple.com>
Another Windows build fix.
* kjs/Activation.h:
2008-01-12 Mark Rowe <mrowe@apple.com>
Attempted Windows build fix. Use struct consistently when forward-declaring
ActivationStackNode and StackActivation.
* kjs/Activation.h:
* kjs/JSGlobalObject.h:
2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Fixes a problem with the ActivationImp tear-off patch (r29425) where
some of the calls to JSGlobalObject::tearOffActivation() were using
the wrong test to determine whether it should leave a relic behind.
* kjs/function.cpp:
(KJS::FunctionImp::argumentsGetter):
(KJS::ActivationImp::getOwnPropertySlot):
2008-01-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed <rdar://problem/5665251> REGRESSION (r28880-r28886): Global
variable access (16644)
This bug was caused by var declarations shadowing built-in properties of
the global object.
To match Firefox, we've decided that var declarations will never shadow
built-in properties of the global object or its prototypes. We used to
behave more like IE, which allows shadowing, but walking that line got
us into trouble with websites that sent us down the Firefox codepath.
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTableGet): New code to support calling
hasProperty before the variable object is fully initialized (so you
can call it during initialization).
* kjs/nodes.cpp:.
(KJS::ProgramNode::initializeSymbolTable): Always do a full hasProperty
check when looking for duplicates, not getDirect, since it only checks
the property map, and not hasOwnProperty, since it doesn't check
prototypes.
(KJS::EvalNode::processDeclarations): ditto
* kjs/property_slot.h:
(KJS::PropertySlot::ungettableGetter): Best function name evar.
2008-01-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Optimized ActivationImp allocation, so that activation records are now
first allocated on an explicitly managed stack and only heap allocated
when necessary. Roughly a 5% improvement on SunSpider, and a larger
improvement on benchmarks that use more function calls.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/Activation.h: Added.
(KJS::ActivationImp::ActivationData::ActivationData):
(KJS::ActivationImp::ActivationImp):
(KJS::ActivationImp::classInfo):
(KJS::ActivationImp::isActivationObject):
(KJS::ActivationImp::isOnStack):
(KJS::ActivationImp::d):
(KJS::StackActivation::StackActivation):
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
(KJS::ExecState::~ExecState):
* kjs/ExecState.h:
(KJS::ExecState::replaceScopeChainTop):
(KJS::ExecState::setActivationObject):
(KJS::ExecState::setLocalStorage):
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset):
(KJS::JSGlobalObject::pushActivation):
(KJS::JSGlobalObject::checkActivationCount):
(KJS::JSGlobalObject::popActivationHelper):
(KJS::JSGlobalObject::popActivation):
(KJS::JSGlobalObject::tearOffActivation):
* kjs/JSGlobalObject.h:
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
(KJS::JSVariableObject::JSVariableObject):
* kjs/function.cpp:
(KJS::FunctionImp::argumentsGetter):
(KJS::ActivationImp::ActivationImp):
(KJS::ActivationImp::~ActivationImp):
(KJS::ActivationImp::init):
(KJS::ActivationImp::getOwnPropertySlot):
(KJS::ActivationImp::markHelper):
(KJS::ActivationImp::mark):
(KJS::ActivationImp::ActivationData::ActivationData):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/function.h:
* kjs/nodes.cpp:
(KJS::PostIncResolveNode::evaluate):
(KJS::PostDecResolveNode::evaluate):
(KJS::PreIncResolveNode::evaluate):
(KJS::PreDecResolveNode::evaluate):
(KJS::ReadModifyResolveNode::evaluate):
(KJS::AssignResolveNode::evaluate):
(KJS::WithNode::execute):
(KJS::TryNode::execute):
(KJS::FunctionBodyNode::processDeclarations):
(KJS::FuncExprNode::evaluate):
* kjs/object.h:
* kjs/scope_chain.h:
(KJS::ScopeChain::replace):
* kjs/scope_chain_mark.h: Added.
(KJS::ScopeChain::mark):
2008-01-11 Simon Hausmann <hausmann@webkit.org>
Reviewed by Mark Rowe.
Fix the (clean) qmake build. For generating chartables.c we don't
depend on a separate input source file anymore, the dftables perl
script is enough. So use that instead as value for the .input
variable, to ensure that qmake also generates a rule to call dftables.
* pcre/pcre.pri:
2008-01-10 Geoffrey Garen <ggaren@apple.com>
Reviewed by John Sullivan.
Fixed some world leak reports:
* <rdar://problem/5669436> PLT complains about world leak of 1 JavaScript
Interpreter after running cvs-base suite
* <rdar://problem/5669423> PLT complains about world leak if browser
window is open when PLT starts
* kjs/collector.h: Added the ability to distinguish between global
objects and GC-protected global objects, since we only consider the
latter to be world leaks.
* kjs/collector.cpp:
2008-01-11 Mark Rowe <mrowe@apple.com>
Silence qmake warning about ctgen lacking input.
Rubber-stamped by Alp Toker.
* pcre/pcre.pri:
2008-01-10 David Kilzer <ddkilzer@apple.com>
dftables should be rewritten as a script
<http://bugs.webkit.org/show_bug.cgi?id=16818>
<rdar://problem/5681463>
Reviewed by Darin.
Rewrote the dftables utility in Perl. Attempted to switch all
build systems to call the script directly instead of building
a binary first. Only the Xcode build was able to be tested.
* DerivedSources.make: Added pcre directory to VPATH and changed
to invoke dftables directly.
* GNUmakefile.am: Removed build information and changed to invoke
dftables directly.
* JavaScriptCore.vcproj/JavaScriptCore.sln: Removed reference to
dftables project.
* JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
* JavaScriptCore.vcproj/dftables: Removed.
* JavaScriptCore.vcproj/dftables/dftables.vcproj: Removed.
* JavaScriptCore.xcodeproj/project.pbxproj: Removed dftables target.
* jscore.bkl: Removed dftables executable definition.
* pcre/dftables: Copied from JavaScriptCore/pcre/dftables.cpp.
* pcre/dftables.cpp: Removed.
* pcre/dftables.pro: Removed.
* pcre/pcre.pri: Removed references to dftables.cpp and changed to
invoke dftables directly.
2008-01-10 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
- fix http://bugs.webkit.org/show_bug.cgi?id=16782
<rdar://problem/5675331> REGRESSION(r29266): Reproducible crash in fast/replaced/image-map.html
The crash resulted from a native object (DumpRenderTree's
EventSender) causing its wrapper to be invalidated (by clicking a
link that replaced the document in the window) and consequently
deallocated. The fix is to use RefPtrs to protect the native object
from deletion by self-invalidation.
* bindings/runtime_method.cpp:
(RuntimeMethod::callAsFunction):
* bindings/runtime_object.cpp:
(RuntimeObjectImp::fallbackObjectGetter):
(RuntimeObjectImp::fieldGetter):
(RuntimeObjectImp::methodGetter):
(RuntimeObjectImp::put):
(RuntimeObjectImp::defaultValue):
(RuntimeObjectImp::callAsFunction):
2008-01-07 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej Stachowiak.
Turn testIsInteger assertions into compile-time asserts and move them into HashTraits.h
where possible.
* kjs/testkjs.cpp:
* wtf/HashTraits.h:
2008-01-07 Nikolas Zimmermann <zimmermann@kde.org>
Reviewed by Mark.
Enable SVG_FONTS by default.
* Configurations/JavaScriptCore.xcconfig:
2008-01-07 Darin Adler <darin@apple.com>
Rubber stamped by David Kilzer.
- get rid of empty fpconst.cpp
* GNUmakefile.am: Remove fpconst.cpp.
* JavaScriptCore.pri: Ditto.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
* JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
* JavaScriptCoreSources.bkl: Ditto.
* kjs/fpconst.cpp: Removed.
2008-01-07 Darin Adler <darin@apple.com>
Reviewed by David Kilzer.
- fix alignment problem with NaN and Inf globals
* kjs/fpconst.cpp: Move the contents of this file from here back to
value.cpp. The reason this was in a separate file is that the DARWIN
version of this used a declaration of the globals with a different
type to avoid creating "init routines". That's no longer necessary for
DARWIN and was never necessary for the non-DARWIN code path.
To make this patch easy to merge, I didn't actually delete this file
yet. We'll do that in a separate changeset.
* kjs/value.cpp: If C99's NAN and INFINITY are present, then use them,
othrewise use the union trick from fpconst.cpp. I think it would be
better to eliminate KJS::NaN and KJS::Inf and just use NAN and INFINITY
directly or std::numeric_limits<double>::quiet_nan() and
std::numeric_limits<double>::infinity(). But when I tried that, it
slowed down SunSpider. Someone else could do that cleanup if they
could do it without slowing down the engine.
2008-01-07 Adam Roben <aroben@apple.com>
Windows build fix
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
JavaScript.h to the project.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
Copy JavaScript.h to WEBKITOUTPUTDIR.
2008-01-07 Timothy Hatcher <timothy@apple.com>
Reviewed by Darin.
Fix Mac build.
* API/JSNode.c:
* API/JSNode.h:
* API/JSNodeList.c:
* API/JSNodeList.h:
* API/JavaScript.h:
* API/JavaScriptCore.h:
* API/minidom.c:
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-01-07 Alp Toker <alp@atoker.com>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=16029
JavaScriptCore.h is not suitable for platforms other than Mac OS X
Introduce a new JavaScriptCore/JavaScript.h public API header. This
should be used by all new portable code using the JavaScriptCore API.
JavaScriptCore/JavaScriptCore.h will remain for compatibility with
existing applications that depend on it including JSStringRefCF.h
which isn't portable.
Also add minidom to the GTK+/autotools build since we can now support
it on all platforms.
* API/JSNode.h:
* API/JSNodeList.h:
* API/JavaScript.h: Added.
* API/JavaScriptCore.h:
* ForwardingHeaders/JavaScriptCore/JavaScript.h: Added.
* GNUmakefile.am:
* JavaScriptCore.xcodeproj/project.pbxproj:
2008-01-06 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Abstract all DateObject.set* functions in preparation for fixing:
http://bugs.webkit.org/show_bug.cgi?id=16753
SunSpider had random changes here and there but was overall a wash.
* kjs/date_object.cpp:
(KJS::fillStructuresUsingTimeArgs):
(KJS::setNewValueFromTimeArgs):
(KJS::setNewValueFromDateArgs):
(KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
(KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
(KJS::DateProtoFuncSetSeconds::callAsFunction):
(KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
(KJS::DateProtoFuncSetMinutes::callAsFunction):
(KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
(KJS::DateProtoFuncSetHours::callAsFunction):
(KJS::DateProtoFuncSetUTCHours::callAsFunction):
(KJS::DateProtoFuncSetDate::callAsFunction):
(KJS::DateProtoFuncSetUTCDate::callAsFunction):
(KJS::DateProtoFuncSetMonth::callAsFunction):
(KJS::DateProtoFuncSetUTCMonth::callAsFunction):
(KJS::DateProtoFuncSetFullYear::callAsFunction):
(KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
2008-01-06 Nikolas Zimmermann <zimmermann@kde.org>
Reviewed by Dan.
Add new helper function isArabicChar - SVG Fonts support needs it.
* wtf/unicode/icu/UnicodeIcu.h:
(WTF::Unicode::isArabicChar):
* wtf/unicode/qt4/UnicodeQt4.h:
(WTF::Unicode::isArabicChar):
2008-01-06 Alp Toker <alp@atoker.com>
Reviewed by Mark Rowe.
Use $(EXEEXT) to account for the .exe extension in the GTK+ Windows
build. (This is already done correctly in DerivedSources.make.) Issue
noticed by Mikkel when building in Cygwin.
Add a missing slash. This was a hack from the qmake build system that
isn't necessary with autotools.
* GNUmakefile.am:
2008-01-05 Darin Adler <darin@apple.com>
* API/JSRetainPtr.h: One more file that needed the change below.
2008-01-05 Darin Adler <darin@apple.com>
* wtf/OwnPtr.h: OwnPtr needs the same fix as RefPtr below.
2008-01-05 Adam Roben <aroben@apple.com>
Build fix.
Reviewed by Maciej.
* wtf/RetainPtr.h: Use PtrType instead of T* because of the
RemovePointer magic.
2008-01-05 Darin Adler <darin@apple.com>
Rubber stamped by Maciej Stachowiak.
- cut down own PIC branches by using a pointer-to-member-data instead of a
pointer-to-member-function in WTF smart pointers
* wtf/OwnArrayPtr.h:
* wtf/OwnPtr.h:
* wtf/PassRefPtr.h:
* wtf/RefPtr.h:
* wtf/RetainPtr.h:
Use a pointer to the m_ptr member instead of the get member.
The GCC compiler generates better code for this idiom.
2008-01-05 Henry Mason <hmason@mac.com>
Reviewed by Maciej Stachowiak.
http://bugs.webkit.org/show_bug.cgi?id=16738
Bug 16738: Collector block offset could be stored as an cell offset instead of a byte offset
Gives a 0.4% SunSpider boost and prettier code.
* kjs/collector.cpp: Switched to cell offsets from byte offsets
(KJS::Collector::heapAllocate):
(KJS::Collector::sweep):
2008-01-04 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej Stachowiak.
Have the two malloc zones print useful diagnostics if their free method are unexpectedly invoked.
Due to <rdar://problem/5671357> this can happen if an application attempts to free a pointer that
was not allocated by any registered malloc zone on the system.
* kjs/CollectorHeapIntrospector.h:
* wtf/FastMalloc.cpp:
2008-01-04 Alp Toker <alp@atoker.com>
GTK+ autotools build fix. Terminate empty rules.
* GNUmakefile.am:
2008-01-03 Simon Hausmann <hausmann@webkit.org>
Reviewed by Mark Rowe.
Fix compilation with gcc 4.3: limits.h is needed for INT_MAX.
* pcre/pcre_exec.cpp:
2008-01-03 Darin Adler <darin@apple.com>
* tests/mozilla/expected.html: The fix for bug 16696 also fixed a test
case, ecma_3/RegExp/perlstress-002.js, so updated results to expect
that test to succeed.
2008-01-02 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=16696
JSCRE fails fails to match Acid3 regexp
Test: fast/regex/early-acid3-86.html
The problem was with the cutoff point between backreferences and octal
escape sequences. We need to determine the cutoff point by counting the
total number of capturing brackets, which requires an extra pass through
the expression when compiling it.
* pcre/pcre_compile.cpp:
(CompileData::CompileData): Added numCapturingBrackets. Removed some
unused fields.
(compileBranch): Use numCapturingBrackets when calling checkEscape.
(calculateCompiledPatternLength): Use numCapturingBrackets when calling
checkEscape, and also store the bracket count at the end of the compile.
(jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
count the number of brackets and then a second time to calculate the length.
2008-01-02 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=16696
JSCRE fails fails to match Acid3 regexp
Test: fast/regex/early-acid3-86.html
The problem was with the cutoff point between backreferences and octal
escape sequences. We need to determine the cutoff point by counting the
total number of capturing brackets, which requires an extra pass through
the expression when compiling it.
* pcre/pcre_compile.cpp:
(CompileData::CompileData): Added numCapturingBrackets. Removed some
unused fields.
(compileBranch): Use numCapturingBrackets when calling checkEscape.
(calculateCompiledPatternLength): Use numCapturingBrackets when calling
checkEscape, and also store the bracket count at the end of the compile.
(jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
count the number of brackets and then a second time to calculate the length.
2008-01-02 David Kilzer <ddkilzer@webkit.org>
Reviewed and landed by Darin.
* kjs/nodes.cpp:
(KJS::DoWhileNode::execute): Added a missing return.
2008-01-02 Darin Adler <darin@apple.com>
- try to fix Qt build
* wtf/unicode/qt4/UnicodeQt4.h:
(WTF::Unicode::foldCase): Add some missing const.
2008-01-02 Alice Liu <alice.liu@apple.com>
Reviewed by Sam Weinig.
need to export ASCIICType.h for use in DRT
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* wtf/ASCIICType.h:
(WTF::isASCIIUpper):
2008-01-02 Sam Weinig <sam@webkit.org>
Reviewed by Beth Dakin.
Cleanup error_object.h/cpp.
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset):
* kjs/error_object.cpp:
(KJS::):
(KJS::ErrorInstance::ErrorInstance):
(KJS::ErrorPrototype::ErrorPrototype):
(KJS::ErrorProtoFuncToString::ErrorProtoFuncToString):
(KJS::ErrorProtoFuncToString::callAsFunction):
(KJS::ErrorObjectImp::ErrorObjectImp):
(KJS::ErrorObjectImp::implementsConstruct):
(KJS::ErrorObjectImp::construct):
(KJS::ErrorObjectImp::callAsFunction):
(KJS::NativeErrorPrototype::NativeErrorPrototype):
(KJS::NativeErrorImp::NativeErrorImp):
(KJS::NativeErrorImp::implementsConstruct):
(KJS::NativeErrorImp::construct):
(KJS::NativeErrorImp::callAsFunction):
(KJS::NativeErrorImp::mark):
* kjs/error_object.h:
(KJS::ErrorInstance::classInfo):
(KJS::NativeErrorImp::classInfo):
2008-01-02 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Alp Toker.
* GNUmakefile.am: Add missing dependency on grammar.y.
2008-01-01 Darin Adler <darin@apple.com>
Reviewed by Eric.
- fix for http://bugs.webkit.org/show_bug.cgi?id=16695
JSC allows non-identifier codepoints in identifiers (affects Acid3)
Test: fast/js/kde/parse.html
* kjs/lexer.cpp:
(KJS::Lexer::lex): Added additional states to distinguish Unicode escapes at the
start of identifiers from ones inside identifiers. Rejected characters that don't pass
the isIdentStart and isIdentPart tests.
(KJS::Lexer::convertUnicode): Removed incorrect FIXME comment.
* kjs/lexer.h: Added new states to distinguish \u escapes at the start of identifiers
from \u escapes inside identifiers.
2008-01-01 Darin Adler <darin@apple.com>
- rolled scope chain optimization out; it was breaking the world
2008-01-01 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- http://bugs.webkit.org/show_bug.cgi?id=16685
eliminate List::empty() to cut down on PIC branches
Also included one other speed-up -- remove the call to reserveCapacity from
FunctionBodyNode::processDeclarations in all but the most unusual cases.
Together these make SunSpider 1.016x as fast.
* JavaScriptCore.exp: Updated.
* kjs/ExecState.cpp:
(KJS::globalEmptyList): Added. Called only when creating global ExecState
instances.
(KJS::ExecState::ExecState): Broke constructor up into three separate functions,
for the three separate node types. Also went through each of the three and
streamlined as much as possible, removing dead code. This prevents us from having
to access the global in the function body version of the constructor.
* kjs/ExecState.h: Added emptyList(). Replaced the constructor with a set of
three that are specific to the different node types that can create new execution
state objects.
* kjs/array_object.cpp:
(KJS::ArrayProtoFuncToLocaleString::callAsFunction): Use exec->emptyList() instead
of List::empty().
(KJS::ArrayProtoFuncConcat::callAsFunction): Ditto.
(KJS::ArrayProtoFuncSlice::callAsFunction): Ditto.
(KJS::ArrayProtoFuncSplice::callAsFunction): Ditto.
(KJS::ArrayProtoFuncFilter::callAsFunction): Ditto.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction): Updated to call new ExecState constructor.
(KJS::GlobalFuncImp::callAsFunction): Ditto (for eval).
* kjs/function_object.cpp:
(FunctionObjectImp::construct): Use exec->emptyList() instead of List::empty().
* kjs/list.cpp: Removed List::empty.
* kjs/list.h: Ditto.
* kjs/nodes.cpp:
(KJS::ElementNode::evaluate): Use exec->emptyList() instead of List::empty().
(KJS::ArrayNode::evaluate): Ditto.
(KJS::ObjectLiteralNode::evaluate): Ditto.
(KJS::PropertyListNode::evaluate): Ditto.
(KJS::FunctionBodyNode::processDeclarations): Another speed-up. Check the capacity
before calling reserveCapacity, because it doesn't get inlined the local storage
vector is almost always big enough -- saving the function call overhead is a big
deal.
(KJS::FuncDeclNode::makeFunction): Use exec->emptyList() instead of List::empty().
(KJS::FuncExprNode::evaluate): Ditto.
* kjs/object.cpp:
(KJS::tryGetAndCallProperty): Ditto.
* kjs/property_slot.cpp:
(KJS::PropertySlot::functionGetter): Ditto.
* kjs/string_object.cpp:
(KJS::StringProtoFuncSplit::callAsFunction): Ditto.
2008-01-01 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=16648
REGRESSION (r28165): Yuku.com navigation prints "jsRegExpExecute failed with result -2"
<rdar://problem/5646486> REGRESSION (r28165): Layout test fast/regex/test1 fails intermittently
Fixes 34 failing test cases in the fast/regex/test1.html test.
Restored the stack which prevents infinite loops for brackets that match the empty
string; it had been removed as an optimization.
Unfortunately, restoring this stack causes the regular expression test in SunSpider
to be 1.095x as slow and the overall test to be 1.004x as slow. Maybe we can find
a correct optimization to restore the speed!
It's possible the original change was on the right track but just off by one.
* pcre/pcre_exec.cpp: Add back eptrblock, but name it BracketChainNode.
(MatchStack::pushNewFrame): Add back the logic needed here.
(startNewGroup): Ditto.
(match): Ditto.
2008-01-01 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- http://bugs.webkit.org/show_bug.cgi?id=16683
speed up function calls by making ScopeChain::push cheaper
This gives a 1.019x speedup on SunSpider.
After doing this, I realized this probably will be obsolete when the optimization
to avoid creating an activation object is done. When we do that one we should check
if rolling this out will speed things up, since this does add overhead at the time
you copy the scope chain.
* kjs/object.h: Removed the ScopeChain::release function. It was
marked inline, and called in exactly one place, so moved it there.
No idea why it was in this header file!
* kjs/scope_chain.cpp: Removed the overload of the ScopeChain::push
function that takes another ScopeChain. It was unused. I think we used
it over in WebCore at one point, but not any more.
* kjs/scope_chain.h: Changed ScopeChainNode into a struct rather than
a class, got rid of its constructor so we can have one that's uninitialized,
and moved the refCount into a derived struct, ScopeChainHeapNode. Made _node
mutable so it can be changed in the moveToHeap function. Changed the copy
constructor and assignment operator to call moveToHeap, since the top node
can't be shared when it's embedded in another ScopeChain object. Updated
functions as needed to handle the case where the first object isn't on the
heap or to add casts for cases where it's guaranteed to be. Changed the push
function to always put the new node into the ScopeChain object; it will get
put onto the heap when needed later.
2008-01-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed slight logic error in reserveCapacity, where we would reallocate
the storage buffer unnecessarily.
* wtf/Vector.h:
(WTF::::reserveCapacity): No need to grow the buffer if newCapacity is
equal to capacity().
2008-01-01 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- http://bugs.webkit.org/show_bug.cgi?id=16684
eliminate debugger overhead from function body execution
Speeds SunSpider up 1.003x. That's a small amount, but measurable.
* JavaScriptCore.exp: Updated.
* kjs/Parser.h:
(KJS::Parser::parse): Create the node with a static member function named create() instead
of using new explicitly.
* kjs/grammar.y: Changed calls to new FunctionBodyNode to use FunctionBodyNode::create().
* kjs/nodes.cpp:
(KJS::ProgramNode::create): Added. Calls new.
(KJS::EvalNode::create): Ditto.
(KJS::FunctionBodyNode::create): Ditto, but creates FunctionBodyNodeWithDebuggerHooks
when a debugger is present.
(KJS::FunctionBodyNode::execute): Removed debugger hooks.
(KJS::FunctionBodyNodeWithDebuggerHooks::FunctionBodyNodeWithDebuggerHooks): Added.
(KJS::FunctionBodyNodeWithDebuggerHooks::execute): Calls the debugger, then the code,
then the debugger again.
* kjs/nodes.h: Added create functions, made the constructors private and protected.
2007-12-30 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
More small cleanup to array_object.cpp
* kjs/array_object.cpp:
(KJS::ArrayProtoFuncToString::callAsFunction):
(KJS::ArrayProtoFuncToLocaleString::callAsFunction):
(KJS::ArrayProtoFuncJoin::callAsFunction):
(KJS::ArrayProtoFuncConcat::callAsFunction):
(KJS::ArrayProtoFuncReverse::callAsFunction):
(KJS::ArrayProtoFuncShift::callAsFunction):
(KJS::ArrayProtoFuncSlice::callAsFunction):
(KJS::ArrayProtoFuncSort::callAsFunction):
(KJS::ArrayProtoFuncSplice::callAsFunction):
(KJS::ArrayProtoFuncUnShift::callAsFunction):
(KJS::ArrayProtoFuncFilter::callAsFunction):
(KJS::ArrayProtoFuncMap::callAsFunction):
(KJS::ArrayProtoFuncEvery::callAsFunction):
2007-12-30 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Apply wkstyle to array_object.cpp
* kjs/array_object.cpp:
(KJS::ArrayPrototype::ArrayPrototype):
(KJS::ArrayPrototype::getOwnPropertySlot):
(KJS::ArrayProtoFuncConcat::callAsFunction):
(KJS::ArrayProtoFuncPop::callAsFunction):
(KJS::ArrayProtoFuncReverse::callAsFunction):
(KJS::ArrayProtoFuncShift::callAsFunction):
(KJS::ArrayProtoFuncSlice::callAsFunction):
(KJS::ArrayProtoFuncSort::callAsFunction):
(KJS::ArrayProtoFuncSplice::callAsFunction):
(KJS::ArrayProtoFuncUnShift::callAsFunction):
(KJS::ArrayProtoFuncFilter::callAsFunction):
(KJS::ArrayProtoFuncMap::callAsFunction):
(KJS::ArrayProtoFuncEvery::callAsFunction):
(KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
(KJS::ArrayObjectImp::ArrayObjectImp):
(KJS::ArrayObjectImp::implementsConstruct):
(KJS::ArrayObjectImp::construct):
(KJS::ArrayObjectImp::callAsFunction):
2007-12-30 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Remove maxInt/minInt, replacing with std:max/min<int>()
* kjs/array_object.cpp:
(KJS::ArrayProtoFuncSplice::callAsFunction):
* kjs/operations.cpp:
* kjs/operations.h:
2007-12-30 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Update Number.toString to properly throw exceptions.
Cleanup code in Number.toString implementation.
* kjs/number_object.cpp:
(KJS::numberToString):
* kjs/object.cpp:
(KJS::Error::create): Remove bogus debug lines.
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
ASSERT when debugging via Drosera due to missed var lookup optimization.
http://bugs.webkit.org/show_bug.cgi?id=16634
No test case possible.
* kjs/nodes.cpp:
(KJS::BreakpointCheckStatement::optimizeVariableAccess):
* kjs/nodes.h:
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
Fix (-0).toFixed() and re-factor a little
Fix (-0).toExponential() and printing of trailing 0s in toExponential
Fix toPrecision(nan) handling
http://bugs.webkit.org/show_bug.cgi?id=16640
* kjs/number_object.cpp:
(KJS::numberToFixed):
(KJS::fractionalPartToString):
(KJS::numberToExponential):
(KJS::numberToPrecision):
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
More changes to make number code readable
* kjs/number_object.cpp:
(KJS::integer_part_noexp):
(KJS::numberToFixed):
(KJS::numberToExponential):
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
More small cleanups to toPrecision
* kjs/number_object.cpp:
(KJS::numberToPrecision):
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
More small attempts to make number code readable
* kjs/number_object.cpp:
(KJS::exponentialPartToString):
(KJS::numberToExponential):
(KJS::numberToPrecision):
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Break out callAsFunction implementations into static functions
* kjs/number_object.cpp:
(KJS::numberToString):
(KJS::numberToFixed):
(KJS::numberToExponential):
(KJS::numberToPrecision):
(KJS::NumberProtoFunc::callAsFunction):
2007-12-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Apply wkstyle/astyle and fix placement of *
* kjs/number_object.cpp:
(KJS::):
(KJS::NumberInstance::NumberInstance):
(KJS::NumberPrototype::NumberPrototype):
(KJS::NumberProtoFunc::NumberProtoFunc):
(KJS::integer_part_noexp):
(KJS::intPow10):
(KJS::NumberProtoFunc::callAsFunction):
(KJS::NumberObjectImp::NumberObjectImp):
(KJS::NumberObjectImp::getOwnPropertySlot):
(KJS::NumberObjectImp::getValueProperty):
(KJS::NumberObjectImp::implementsConstruct):
(KJS::NumberObjectImp::construct):
(KJS::NumberObjectImp::callAsFunction):
* kjs/object.cpp:
(KJS::JSObject::put):
2007-12-27 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
ASSERT in JavaScriptCore while viewing WICD test case
http://bugs.webkit.org/show_bug.cgi?id=16626
* kjs/nodes.cpp:
(KJS::ForInNode::execute): move KJS_CHECK_EXCEPTION to proper place
2007-12-26 Jan Michael Alonzo <jmalonzo@unpluggable.com>
Reviewed by Alp Toker.
http://bugs.webkit.org/show_bug.cgi?id=16390
Use autotools or GNU make as the build system for the GTK port
* GNUmakefile.am: Added.
2007-12-25 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- Remove unnecessary redundant check from property setting
http://bugs.webkit.org/show_bug.cgi?id=16602
1.3% speedup on SunSpider.
* kjs/object.cpp:
(KJS::JSObject::put): Don't do canPut check when not needed; let
the PropertyMap handle it.
(KJS::JSObject::canPut): Don't check the static property
table. lookupPut does that already.
2007-12-24 Alp Toker <alp@atoker.com>
Fix builds that don't use AllInOneFile.cpp following breakage
introduced in r28973.
* kjs/grammar.y:
2007-12-24 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
- Optimize variable declarations
http://bugs.webkit.org/show_bug.cgi?id=16585
3.5% speedup on SunSpider.
var statements now result in either assignments or empty statements.
This allows a couple of optimization opportunities:
- No need to branch at runtime to check if there is an initializer
- EmptyStatementNodes can be removed entirely (also done in this patch)
- Assignment expressions get properly optimized for local variables
This patch also includes some code cleanup:
- Most of the old VarStatement/VarDecl logic is now only used for const declarations,
thus it is renamed appropriately
- AssignExprNode is gone
* JavaScriptCore.exp:
* kjs/NodeInfo.h:
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::SourceElements::append):
(KJS::ConstDeclNode::ConstDeclNode):
(KJS::ConstDeclNode::optimizeVariableAccess):
(KJS::ConstDeclNode::handleSlowCase):
(KJS::ConstDeclNode::evaluateSingle):
(KJS::ConstDeclNode::evaluate):
(KJS::ConstStatementNode::optimizeVariableAccess):
(KJS::ConstStatementNode::execute):
(KJS::VarStatementNode::optimizeVariableAccess):
(KJS::VarStatementNode::execute):
(KJS::ForInNode::ForInNode):
(KJS::ForInNode::optimizeVariableAccess):
(KJS::ForInNode::execute):
(KJS::FunctionBodyNode::initializeSymbolTable):
(KJS::ProgramNode::initializeSymbolTable):
(KJS::FunctionBodyNode::processDeclarations):
(KJS::ProgramNode::processDeclarations):
(KJS::EvalNode::processDeclarations):
* kjs/nodes.h:
(KJS::DeclarationStacks::):
(KJS::StatementNode::):
(KJS::ConstDeclNode::):
(KJS::ConstStatementNode::):
(KJS::EmptyStatementNode::):
(KJS::VarStatementNode::):
(KJS::ForNode::):
* kjs/nodes2string.cpp:
(KJS::ConstDeclNode::streamTo):
(KJS::ConstStatementNode::streamTo):
(KJS::ScopeNode::streamTo):
(KJS::VarStatementNode::streamTo):
(KJS::ForNode::streamTo):
(KJS::ForInNode::streamTo):
2007-12-21 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
* JavaScriptCore.exp: Remove unused symbol to prevent a weak external symbol
being generated in JavaScriptCore.framework.
2007-12-21 Darin Adler <darin@apple.com>
Requested by Maciej.
* kjs/nodes.h: Use the new NEVER_INLINE here and eliminate the old
KJS_NO_INLINE. We don't want to have two, and we figured it was better
to keep the one that's in WTF.
2007-12-21 Darin Adler <darin@apple.com>
Reviewed by Eric.
- http://bugs.webkit.org/show_bug.cgi?id=16561
remove debugger overhead from non-debugged JavaScript execution
1.022x as fast on SunSpider.
* JavaScriptCore.exp: Updated.
* kjs/NodeInfo.h: Renamed SourceElementsStub to SourceElements,
since that more accurately describes the role of this object, which
is a reference-counted wrapper for a Vector.
* kjs/Parser.cpp:
(KJS::Parser::didFinishParsing): Changed parameter type to SourceElements,
and use plain assignment instead of set.
* kjs/Parser.h: Changed parameter type of didFinishParsing to a
SourceElements. Also changed m_sourceElements; we now use a RefPtr instead
of an OwnPtr as well.
* kjs/grammar.y: Got rid of all the calls to release() on SourceElements.
That's now handed inside the constructors for various node types, since we now
use vector swapping instead.
* kjs/nodes.cpp:
(KJS::Node::rethrowException): Added NEVER_INLINE, because this was getting inlined
and we want exception handling out of the normal code flow.
(KJS::SourceElements::append): Moved here from the header. This now handles
creating a BreakpointCheckStatement for each statement in the debugger case.
That way we can get breakpoint handling without having it in every execute function.
(KJS::BreakpointCheckStatement::BreakpointCheckStatement): Added.
(KJS::BreakpointCheckStatement::execute): Added. Contains the code that was formerly
in the StatementNode::hitStatement function and the KJS_BREAKPOINT macro.
(KJS::BreakpointCheckStatement::streamTo): Added.
(KJS::ArgumentListNode::evaluateList): Use KJS_CHECKEXCEPTIONVOID since the return
type is void.
(KJS::VarStatementNode::execute): Removed KJS_BREAKPOINT.
(KJS::BlockNode::BlockNode): Changed parameter type to SourceElements.
Changed code to use release since the class now contains a vector rather than
a vector point.
(KJS::BlockNode::optimizeVariableAccess): Updated since member is now a vector
rather than a vector pointer.
(KJS::BlockNode::execute): Ditto.
(KJS::ExprStatementNode::execute): Removed KJS_BREAKPOINT.
(KJS::IfNode::execute): Ditto.
(KJS::IfElseNode::execute): Ditto.
(KJS::DoWhileNode::execute): Ditto.
(KJS::WhileNode::execute): Ditto.
(KJS::ContinueNode::execute): Ditto.
(KJS::BreakNode::execute): Ditto.
(KJS::ReturnNode::execute): Ditto.
(KJS::WithNode::execute): Ditto.
(KJS::CaseClauseNode::optimizeVariableAccess): Updated since member is now a vector
rather than a vector pointer.
(KJS::CaseClauseNode::executeStatements): Ditto.
(KJS::SwitchNode::execute): Removed KJS_BREAKPOINT.
(KJS::ThrowNode::execute): Ditto.
(KJS::TryNode::execute): Ditto.
(KJS::ScopeNode::ScopeNode): Changed parameter type to SourceElements.
(KJS::ProgramNode::ProgramNode): Ditto.
(KJS::EvalNode::EvalNode): Ditto.
(KJS::FunctionBodyNode::FunctionBodyNode): Ditto.
(KJS::ScopeNode::optimizeVariableAccess): Updated since member is now a vector
rather than a vector pointer.
* kjs/nodes.h: Removed hitStatement. Renamed SourceElements to StatementVector.
Renamed SourceElementsStub to SourceElements and made it derive from
ParserRefCounted rather than from Node, hold a vector rather than a pointer to
a vector, and changed the release function to swap with another vector rather
than the pointer idiom. Updated BlockNode and CaseClauseNode to hold actual
vectors instead of pointers to vectors. Added BreakpointCheckStatement.
* kjs/nodes2string.cpp:
(KJS::statementListStreamTo): Changed to work on a vector instead of a pointer
to a vector.
(KJS::BlockNode::streamTo): Ditto.
(KJS::CaseClauseNode::streamTo): Ditto.
* wtf/AlwaysInline.h: Added NEVER_INLINE.
* wtf/PassRefPtr.h: Tweaked formatting. Added clear() function that matches the
ones in OwnPtr and auto_ptr.
* wtf/RefPtr.h: Ditto.
2007-12-21 Darin Adler <darin@apple.com>
- fix broken regression tests
The broken tests were fast/js/do-while-expression-value.html and
fast/js/while-expression-value.html.
* kjs/nodes.cpp: Check in the correct version of this file. I had accidentally landed
an old version of my patch for bug 16471.
(KJS::statementListExecute): The logic here was backwards. Have to set the value
even for non-normal execution results.
2007-12-20 Alexey Proskuryakov <ap@webkit.org>
Windows build fix
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Copy npruntime_internal.h
to WebKitBuild.
2007-12-20 Eric Seidel <eric@webkit.org>
Reviewed by mjs.
Split IfNode into IfNode and IfElseNode for speedup.
http://bugs.webkit.org/show_bug.cgi?id=16470
SunSpider claims this is 1.003x as fast as before.
(This required running with --runs 15 to get consistent enough results to tell!)
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::IfNode::optimizeVariableAccess):
(KJS::IfNode::execute):
(KJS::IfNode::getDeclarations):
(KJS::IfElseNode::optimizeVariableAccess):
(KJS::IfElseNode::execute):
(KJS::IfElseNode::getDeclarations):
* kjs/nodes.h:
(KJS::IfNode::):
(KJS::IfElseNode::):
* kjs/nodes2string.cpp:
(KJS::IfNode::streamTo):
(KJS::IfElseNode::streamTo):
2007-12-20 Darin Adler <darin@apple.com>
Reviewed by Sam.
* wtf/OwnPtr.h:
(WTF::operator==): Added.
(WTF::operator!=): Added.
2007-12-20 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
AST optimization: Avoid NULL-checking ForNode's child nodes.
0.6% speedup on SunSpider.
This is a proof of concept patch that demonstrates how to optimize
grammar productions with optional components, like
for (optional; optional; optional) {
...
}
The parser emits NULL for an optional component that is not present.
Instead of checking for a NULL child at execution time, a node that
expects an optional component to be present more often than not checks
for a NULL child at construction time, and substitutes a viable
alternative node in its place.
(We'd like the parser to start emitting NULL a lot more once we teach
it to emit NULL for certain no-op productions like EmptyStatement and
VariableStatement, so, as a foundation, it's important for nodes with
NULL optional components to be fast.)
* kjs/Parser.cpp:
(KJS::Parser::didFinishParsing): Check for NULL SourceElements. Also,
moved didFinishParsing into the .cpp file because adding a branch while
it was in the header file caused a substantial and inexplicable
performance regression. (Did I mention that GCC is crazy?)
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::BlockNode::BlockNode): Check for NULL SourceElements.
(KJS::ForNode::optimizeVariableAccess): No need to check for NULL here.
(KJS::ForNode::execute): No need to check for NULL here.
* kjs/nodes.h:
(KJS::ForNode::): Check for NULL SourceElements. Substitute a TrueNode
because it's semantically harmless, and it evaluates to boolean in an
efficient manner.
2007-12-20 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Slight logic reordering in JSImmediate::from(double)
This gives a 0.6% improvement in SunSpider.
* kjs/JSImmediate.h:
(KJS::JSImmediate::from):
2007-12-20 Eric Seidel <eric@webkit.org>
Reviewed by mjs.
Fix major Array regression introduced by 28899.
SunSpider claims this is at least 1.37x as fast as pre-regression. :)
* kjs/array_instance.cpp: make Arrays fast again!
2007-12-20 Eric Seidel <eric@webkit.org>
Reviewed by Geoff, then re-rubber-stamped by Geoff after final search/replace and testing.
Small reworking of Date code for 4% speedup on Date tests (0.2% overall)
http://bugs.webkit.org/show_bug.cgi?id=16537
Make msToYear human-readable
Make msToDayInMonth slightly more readable and avoid recalculating msToYear
Remove use of isInLeapYear to avoid calling msToYear
Remove dayInYear call by changing msToDayInMonth to dayInMonthFromDayInYear
Remove more duplicate calls to dayInYear and getUTCOffset for further speedup
* kjs/DateMath.cpp:
(KJS::daysFrom1970ToYear):
(KJS::msToYear):
(KJS::monthFromDayInYear):
(KJS::checkMonth):
(KJS::dayInMonthFromDayInYear):
(KJS::dateToDayInYear):
(KJS::getDSTOffsetSimple):
(KJS::getDSTOffset):
(KJS::gregorianDateTimeToMS):
(KJS::msToGregorianDateTime):
2007-12-20 Rodney Dawes <dobey@wayofthemonkey.com>
Reviewed by Darin Adler.
Proxy includes of npruntime.h or npapi.h through npruntime_internal.h
Include stdio.h in npapi.h for the use of FILE with XP_UNIX defined
This is for building with X11, as some type and enum names conflict
with #define names in X11 headers.
http://bugs.webkit.org/show_bug.cgi?id=15669
* JavaScriptCore.xcodeproj/project.pbxproj:
* bindings/NP_jsobject.h:
* bindings/npapi.h:
* bindings/npruntime.cpp:
* bindings/npruntime_impl.h:
* bindings/npruntime_priv.h:
* bindings/npruntime_internal.h:
* bindings/testbindings.cpp:
* bindings/c/c_class.h:
* bindings/c/c_runtime.h:
* bindings/c/c_utility.h:
2007-12-20 Darin Adler <darin@apple.com>
- re-fix http://bugs.webkit.org/show_bug.cgi?id=16471
Completions need to be smaller (or not exist at all)
Same patch as last time with the test failures problem fixed.
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction): Make sure to check the completion
type from newExec to see if the execute raised an exception.
2007-12-20 Darin Adler <darin@apple.com>
- roll out that last change -- it was causing test failures;
I'll check it back in after fixing them
2007-12-20 Darin Adler <darin@apple.com>
Reviewed by Eric.
- http://bugs.webkit.org/show_bug.cgi?id=16471
Completions need to be smaller (or not exist at all)
SuSpider shows 2.4% speedup.
Stop using completions in the execution engine.
Instead, the completion type and label target are both
stored in the ExecState.
* API/JSContextRef.cpp: Removed unneeded include of "completion.h".
* bindings/runtime_method.cpp: Removed unused execute function.
* bindings/runtime_method.h: Ditto.
* kjs/ExecState.h: Added completionType, breakOrContinueTarget,
setCompletionType, setNormalCompletion, setBreakCompletion,
setContinueCompletion, setReturnValueCompletion, setThrowCompletion,
setInterruptedCompletion, m_completionType, and m_breakOrContinueTarget.
* kjs/completion.h: Removed constructor and getter for target
for break and continue from Completion. This class is now only
used for the public API to Interpreter and such.
* kjs/date_object.h: Removed unused execute function.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction): Removed some unneeded
exception processing. Updated to call the new execute function
and to get the completion type from the ExecState. Merged in
the execute function, which repeated some of the same logic and
was called only from here.
(KJS::GlobalFuncImp::callAsFunction): More of the same for eval.
* kjs/function.h: Removed execute.
* kjs/interpreter.cpp:
(KJS::Interpreter::evaluate): Added code to convert the result of
execut into a Completion.
* kjs/nodes.cpp:
(KJS::Node::setErrorCompletion): Renamed from createErrorCompletion.
Now sets the completion type in the ExecState.
(KJS::Node::rethrowException): Now sets the completion type in the
ExecState.
(KJS::StatementNode::hitStatement): Now sets the completion type in
the ExecState.
(KJS::VarStatementNode::execute): Updated to put completion type in
the ExecState instead of a Completion object.
(KJS::statementListExecute): Ditto. Also changed the for loop to use
indices instead of iterators.
(KJS::BlockNode::execute): Updated return type.
(KJS::EmptyStatementNode::execute): Updated to put completion type in
the ExecState instead of a Completion object.
(KJS::ExprStatementNode::execute): Ditto.
(KJS::IfNode::execute): Ditto.
(KJS::DoWhileNode::execute): Ditto. Also streamlined the logic a little
to make the normal case a little faster and moved the end outside the
loop so that "break" can do a break.
(KJS::WhileNode::execute): Ditto.
(KJS::ForNode::execute): Ditto.
(KJS::ForInNode::execute): Ditto.
(KJS::ContinueNode::execute): Updated to put completion type in
the ExecState instead of a Completion object.
(KJS::BreakNode::execute): Ditto.
(KJS::ReturnNode::execute): Ditto.
(KJS::WithNode::execute): Ditto.
(KJS::CaseClauseNode::executeStatements): Ditto. Also renamed to have
execute in its name to reflect the fact that it's a member of the same
family of functions.
(KJS::CaseBlockNode::executeBlock): Ditto.
(KJS::SwitchNode::execute): Ditto.
(KJS::LabelNode::execute): Ditto.
(KJS::ThrowNode::execute): Ditto.
(KJS::TryNode::execute): Ditto.
(KJS::ProgramNode::execute): Ditto.
(KJS::EvalNode::execute): Ditto.
(KJS::FunctionBodyNode::execute): Ditto.
(KJS::FuncDeclNode::execute): Ditto.
* kjs/nodes.h: Renamed setErrorCompletion to createErrorCompletion, made
hitStatement protected, changed return value of execute to a JSValue,
renamed evalStatements to executeStatements, and evalBlock to executeBlock.
* kjs/number_object.h: Removed unused execute function.
2007-12-20 Geoffrey Garen <ggaren@apple.com>
Added Radar number.
* kjs/nodes.cpp:
(KJS::ProgramNode::processDeclarations):
2007-12-20 Geoffrey Garen <ggaren@apple.com>
Linux build fix: config.h has to come first.
* kjs/error_object.cpp:
2007-12-19 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Optimized global access to global variables, using a symbol table.
SunSpider reports a 1.5% overall speedup, a 6.2% speedup on 3d-morph,
and a whopping 33.1% speedup on bitops-bitwise-and.
* API/JSCallbackObjectFunctions.h: Replaced calls to JSObject:: with
calls to Base::, since JSObject is not always our base class. This
was always a bug, but the bug is even more apparent after some of my
changes.
(KJS::::staticFunctionGetter): Replaced use of getDirect with call to
getOwnPropertySlot. Global declarations are no longer stored in the
property map, so a call to getDirect is insufficient for finding
override properties.
* API/testapi.c:
* API/testapi.js: Added test for the getDirect change mentioned above.
* kjs/ExecState.cpp:
* kjs/ExecState.h: Dialed back the optimization to store a direct
pointer to the localStorage buffer. One ExecState can grow the global
object's localStorage without another ExecState's knowledge, so
ExecState can't store a direct pointer to the localStorage buffer
unless/until we invent a way to update all the relevant ExecStates.
* kjs/JSGlobalObject.cpp: Inserted the symbol table into get and put
operations.
(KJS::JSGlobalObject::reset): Reset the symbol table and local storage,
too. Also, clear the property map here, removing the need for a
separate call.
* kjs/JSVariableObject.cpp:
* kjs/JSVariableObject.h: Added support for saving localStorage and the
symbol table to the back/forward cache, and restoring them.
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction): Renamed progNode to evalNode
because it's an EvalNode, not a ProgramNode.
* kjs/lookup.h:
(KJS::cacheGlobalObject): Replaced put with faster putDirect, since
that's how the rest of lookup.h works. putDirect is safe here because
cacheGlobalObject is only used for objects whose names are not valid
identifiers.
* kjs/nodes.cpp: The good stuff!
(KJS::EvalNode::processDeclarations): Replaced hasProperty with
the new hasOwnProperty, which is slightly faster.
* kjs/object.h: Nixed clearProperties because clear() does this job now.
* kjs/property_map.cpp:
* kjs/property_map.h: More back/forward cache support.
* wtf/Vector.h:
(WTF::::grow): Added fast non-branching grow function. I used it in
an earlier version of this patch, even though it's not used anymore.
2007-12-09 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver Hunt.
Build fix for non-Mac platforms. Move NodeInfo into its own header so that the YYTYPE
declaration in grammar.h is able to declare members of that type.
* kjs/NodeInfo.h: Added.
(KJS::createNodeInfo):
(KJS::mergeDeclarationLists):
(KJS::appendToVarDeclarationList):
* kjs/grammar.y:
* kjs/lexer.cpp:
2007-12-19 Oliver Hunt <oliver@apple.com>
Make appendToVarDeclarationList static
RS=Weinig.
* kjs/grammar.y:
2007-12-18 Oliver Hunt <oliver@apple.com>
Remove dead code due to removal of post-parse declaration discovery.
RS=Geoff.
Due to the removal of the declaration discovery pass after parsing we
no longer need any of the logic used for that discovery.
* kjs/nodes.cpp:
(KJS::Node::Node):
(KJS::VarDeclNode::VarDeclNode):
(KJS::BlockNode::BlockNode):
(KJS::ForInNode::ForInNode):
(KJS::CaseBlockNode::CaseBlockNode):
* kjs/nodes.h:
(KJS::VarStatementNode::):
(KJS::IfNode::):
(KJS::DoWhileNode::):
(KJS::WhileNode::):
(KJS::WithNode::):
(KJS::LabelNode::):
(KJS::TryNode::):
(KJS::FuncDeclNode::):
(KJS::CaseClauseNode::):
(KJS::ClauseListNode::):
(KJS::SwitchNode::):
2007-12-18 Oliver Hunt <oliver@apple.com>
Replace post-parse pass to find declarations with logic in the parser itself
Reviewed by Geoff.
Instead of finding declarations in a pass following the initial parsing of
a program, we incorporate the logic directly into the parser. This lays
the groundwork for further optimisations (such as improving performance in
declaration expressions -- var x = y; -- to match that of standard assignment)
in addition to providing a 0.4% performance improvement in SunSpider.
* JavaScriptCore.exp:
* kjs/Parser.cpp:
(KJS::Parser::parse):
* kjs/Parser.h:
(KJS::Parser::didFinishParsing):
(KJS::Parser::parse):
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::ParserTracked::ParserTracked):
(KJS::ParserTracked::~ParserTracked):
(KJS::ParserTracked::ref):
(KJS::ParserTracked::deref):
(KJS::ParserTracked::refcount):
(KJS::ParserTracked::clearNewTrackedObjects):
(KJS::Node::Node):
(KJS::ScopeNode::ScopeNode):
(KJS::ProgramNode::ProgramNode):
(KJS::EvalNode::EvalNode):
(KJS::FunctionBodyNode::FunctionBodyNode):
(KJS::FunctionBodyNode::initializeSymbolTable):
(KJS::FunctionBodyNode::processDeclarations):
* kjs/nodes.h:
(KJS::ParserTracked::):
(KJS::Node::):
(KJS::ScopeNode::):
2007-12-18 Xan Lopez <xan@gnome.org>
Reviewed by Geoff.
Fix http://bugs.webkit.org/show_bug.cgi?id=14521
Bug 14521: JavaScriptCore fails to build on Linux/PPC gcc 4.1.2
* wtf/TCSpinLock.h:
(TCMalloc_SpinLock::Unlock):
Use less strict memory operand constraint on inline asm generation.
PLATFORM(DARWIN) left unpatched due to Apple's GCC bug.
Patch by David Kilzer <ddkilzer@webkit.org>
2007-12-18 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Maciej Stachowiak.
Remove outdated and non-functioning project files for the Apollo port.
* JavaScriptCore.apolloproj: Removed.
2007-12-18 Darin Adler <darin@apple.com>
- fix Windows build
* pcre/pcre_exec.cpp:
(jsRegExpExecute): Change back from false/true to 0/1 -- I probably should not have
deleted MATCH_MATCH and MATCH_NOMATCH, but I'm going to leave them out.
2007-12-18 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=16458
REGRESSION (r28164): regular expressions can now hang due to lack of a match limit
<rdar://problem/5636067>
Test: fast/regex/slow.html
Slows down SunSpider a bit (about 1.01x); filed a bug to follow up on that:
http://bugs.webkit.org/show_bug.cgi?id=16503
* pcre/pcre.h: Changed name of error code to not specifically mention "recursion".
* pcre/pcre_exec.cpp:
(match): Replaced the depth limit, MATCH_RECURSION_LIMIT, with a total match looping
limit, matchLimit. Also eliminated the constants for MATCH_MATCH and MATCH_NOMATCH,
since they are just true and false (1 and 0).
(jsRegExpExecute): More of the MATCH_MATCH change.
2007-12-17 Darin Adler <darin@apple.com>
- speculative build fix for non-gcc platforms
* pcre/pcre_exec.cpp: (match): Remove unused cases from return switch.
2007-12-16 Mark Rowe <mrowe@apple.com>
Speculative build fix for non-Mac platforms.
* pcre/pcre_compile.cpp: Include string.h for memset, memmove, etc.
2007-12-16 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=16438
- removed some more unused code
- changed quite a few more names to WebKit-style
- moved more things out of pcre_internal.h
- changed some indentation to WebKit-style
- improved design of the functions for reading and writing
2-byte values from the opcode stream (in pcre_internal.h)
* pcre/dftables.cpp:
(main): Added the kjs prefix a normal way in lieu of using macros.
* pcre/pcre_compile.cpp: Moved some definitions here from pcre_internal.h.
(errorText): Name changes, fewer typedefs.
(checkEscape): Ditto. Changed uppercase conversion to use toASCIIUpper.
(isCountedRepeat): Name change.
(readRepeatCounts): Name change.
(firstSignificantOpcode): Got rid of the use of OP_lengths, which is
very lightly used here. Hard-coded the length of OP_BRANUMBER.
(firstSignificantOpcodeSkippingAssertions): Ditto. Also changed to
use the advanceToEndOfBracket function.
(getOthercaseRange): Name changes.
(encodeUTF8): Ditto.
(compileBranch): Name changes. Removed unused after_manual_callout and
the code to handle it. Removed code to handle OP_ONCE since we never
emit this opcode. Changed to use advanceToEndOfBracket in more places.
(compileBracket): Name changes.
(branchIsAnchored): Removed code to handle OP_ONCE since we never emit
this opcode.
(bracketIsAnchored): Name changes.
(branchNeedsLineStart): More fo the same.
(bracketNeedsLineStart): Ditto.
(branchFindFirstAssertedCharacter): Removed OP_ONCE code.
(bracketFindFirstAssertedCharacter): More of the same.
(calculateCompiledPatternLengthAndFlags): Ditto.
(returnError): Name changes.
(jsRegExpCompile): Ditto.
* pcre/pcre_exec.cpp: Moved some definitions here from pcre_internal.h.
(matchRef): Updated names.
Improved macros to use the do { } while(0) idiom so they expand to single
statements rather than to blocks or multiple statements. And refeactored
the recursive match macros.
(MatchStack::pushNewFrame): Name changes.
(getUTF8CharAndIncrementLength): Name changes.
(match): Name changes. Removed the ONCE opcode.
(jsRegExpExecute): Name changes.
* pcre/pcre_internal.h: Removed quite a few unneeded includes. Rewrote
quite a few comments. Removed the macros that add kjs prefixes to the
functions with external linkage; instead renamed the functions. Removed
the unneeded typedefs pcre_uint16, pcre_uint32, and uschar. Removed the
dead and not-all-working code for LINK_SIZE values other than 2, although
we aim to keep the abstraction working. Removed the OP_LENGTHS macro.
(put2ByteValue): Replaces put2ByteOpcodeValueAtOffset.
(get2ByteValue): Replaces get2ByteOpcodeValueAtOffset.
(put2ByteValueAndAdvance): Replaces put2ByteOpcodeValueAtOffsetAndAdvance.
(putLinkValueAllowZero): Replaces putOpcodeValueAtOffset; doesn't do the
addition, since a comma is really no better than a plus sign. Added an
assertion to catch out of range values and changed the parameter type to
int rather than unsigned.
(getLinkValueAllowZero): Replaces getOpcodeValueAtOffset.
(putLinkValue): New function that most former callers of the
putOpcodeValueAtOffset function can use; asserts the value that is
being stored is non-zero and then calls putLinkValueAllowZero.
(getLinkValue): Ditto.
(putLinkValueAndAdvance): Replaces putOpcodeValueAtOffsetAndAdvance. No
caller was using an offset, which makes sense given the advancing behavior.
(putLinkValueAllowZeroAndAdvance): Ditto.
(isBracketOpcode): Added. For use in an assertion.
(advanceToEndOfBracket): Renamed from moveOpcodePtrPastAnyAlternateBranches,
and removed comments about how it's not well designed. This function takes
a pointer to the beginning of a bracket and advances to the end of the
bracket.
* pcre/pcre_tables.cpp: Updated names.
* pcre/pcre_ucp_searchfuncs.cpp:
(kjs_pcre_ucp_othercase): Ditto.
* pcre/pcre_xclass.cpp:
(getUTF8CharAndAdvancePointer): Ditto.
(kjs_pcre_xclass): Ditto.
* pcre/ucpinternal.h: Ditto.
* wtf/ASCIICType.h:
(WTF::isASCIIAlpha): Added an int overload, like the one we already have for
isASCIIDigit.
(WTF::isASCIIAlphanumeric): Ditto.
(WTF::isASCIIHexDigit): Ditto.
(WTF::isASCIILower): Ditto.
(WTF::isASCIISpace): Ditto.
(WTF::toASCIILower): Ditto.
(WTF::toASCIIUpper): Ditto.
2007-12-16 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=16459
REGRESSION: assertion failure with regexp with \B in a case-ignoring character range
<rdar://problem/5646361>
The problem was that \B was not handled properly in character classes.
Test: fast/js/regexp-overflow.html
* pcre/pcre_compile.cpp:
(check_escape): Added handling of ESC_b and ESC_B in character classes here.
Allows us to get rid of the handling of \b in character classes from all the
call sites that handle it separately and to handle \B properly as well.
(compileBranch): Remove the ESC_b handling, since it's not needed any more.
(calculateCompiledPatternLengthAndFlags): Ditto.
2007-12-16 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej Stachowiak.
Fix http://bugs.webkit.org/show_bug.cgi?id=16448
Bug 16448: [GTK] Celtic Kane JavaScript performance on Array test is slow relative to Mac
* kjs/array_instance.cpp:
(KJS::compareByStringPairForQSort):
(KJS::ArrayInstance::sort): Convert JSValue's to strings once up front and then sort the
results. This avoids calling toString twice per comparison, but requires a temporary buffer
so we only use this approach in cases where the array being sorted is not too large.
2007-12-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler and Maciej Stachowiak.
More refactoring to support global variable optimization.
Changed SymbolTable to use RefPtr<UString::Rep> as its key instead of
UString::Rep*. With globals, the symbol table can outlast the
declaration node for any given symbol, so the symbol table needs to ref
its symbol names.
In support, specialized HashMaps with RefPtr keys to allow lookup
via raw pointer, avoiding refcount churn.
SunSpider reports a .6% speedup (prolly just noise).
* JavaScriptCore.vcproj/WTF/WTF.vcproj: Added new file: wtf/RefPtrHashMap.h
* JavaScriptCore.xcodeproj/project.pbxproj: ditto
* kjs/JSVariableObject.cpp:
(KJS::JSVariableObject::getPropertyNames): Symbol table keys are RefPtrs now.
* kjs/SymbolTable.h: Modified key traits to match RefPtr. Added a
static Rep* for null, which helps compute the deletedValue() trait.
* wtf/HashMap.h: #include the RefPtr specialization so everyone can use it.
* wtf/RefPtrHashMap.h: Copied from wtf/HashMap.h. Added overloaded versions
of find(), contains(), get(), set(), add(), remove(), and take() that take
raw pointers as keys.
2007-12-16 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=16162
Problems with float parsing on Linux (locale-dependent parsing was used).
* kjs/dtoa.cpp: Removed USE_LOCALE to reduce future confusion.
* kjs/lexer.cpp: (KJS::Lexer::lex): Parse with kjs_strtod, not the system one.
2007-12-14 Alp Toker <alp@atoker.com>
Reviewed by Mark Rowe.
Enable the AllInOneFile.cpp optimization for the GTK+ port.
* JavaScriptCore.pri:
2007-12-14 Mark Rowe <mrowe@apple.com>
Unreviewed. Remove commented out fprintf's that were for debugging purposes only.
* wtf/FastMalloc.cpp:
(WTF::TCMalloc_PageHeap::IncrementalScavenge):
2007-12-14 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej Stachowiak.
Don't use the MADV_DONTNEED code path for now as it has no effect on Mac OS X and is
currently untested on other platforms.
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemRelease): Return after releasing memory rather than potentially falling
through into another mechanism if multiple are supported.
2007-12-14 Alp Toker <alp@atoker.com>
Build fix for GTK+/Qt and ports that don't use AllInOneFile.cpp.
Include UnusedParam.h.
* wtf/TCSystemAlloc.cpp:
2007-12-14 Oliver Hunt <oliver@apple.com>
Reviewed by Stephanie.
Fix build on windows
* wtf/FastMalloc.cpp:
(WTF::TCMalloc_PageHeap::IncrementalScavenge):
2007-12-14 Dan Bernstein <mitz@apple.com>
- try again to fix the Windows build
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemRelease):
2007-12-14 Dan Bernstein <mitz@apple.com>
- try to fix the Windows build
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemRelease):
2007-12-14 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej and Oliver.
Add final changes to make TCMalloc release memory to the system.
This results in a 0.4% regression against ToT, but this is offset
against the gains made by the original TCMalloc r38 merge - in fact
we retain around 0.3-0.4% progression overall.
* wtf/FastMalloc.cpp:
(WTF::InitSizeClasses):
(WTF::TCMalloc_PageHeap::IncrementalScavenge):
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemRelease):
2007-12-14 Darin Adler <darin@apple.com>
Reviewed by Sam.
- removed unnecessary includes of "Vector.h"
* wtf/HashMap.h:
(WTF::copyKeysToVector): Make the type of the vector be a template parameter.
This allows copying keys into a vector of a base class or one with an inline capacity.
(WTF::copyValuesToVector): Ditto.
* wtf/HashSet.h:
(WTF::copyToVector): Ditto.
2007-12-14 Anders Carlsson <andersca@apple.com>
Reviewed by Darin and Geoff.
<rdar://problem/5619295>
REGRESSION: 303-304: Embedded YouTube video fails to render- JS errors (16150) (Flash 9)
Get rid of unnecessary and incorrect security checks for plug-ins accessing JavaScript objects.
The way this used to work was that each NPObject that wrapped a JSObject would have a root object
corresponding to the frame object (used for managing the lifecycle) and an origin root object (used for
doing security checks).
This would prevent a plug-in from accessing a frame's window object if it's security origin was different
(some parts of the window, such as the location object, can be accessed from frames with different security
origins, and those checks are being done in WebCore).
Also, if a plug-in were to access a window object of a frame that later went away, it could lead to that
Window JSObject being garbage collected and the NPObject pointing to freed memory.
How this works now is that there is no origin root object anymore, and all NPObject wrappers that are created
for a plug-in will have the root object of the containing frame of that plug-in.
* bindings/NP_jsobject.cpp:
(jsDeallocate):
Don't free the origin root object.
(_NPN_CreateScriptObject):
Remove the origin root object parameter.
(_NPN_InvokeDefault):
(_NPN_Invoke):
(_NPN_Evaluate):
(_NPN_GetProperty):
(_NPN_SetProperty):
(_NPN_RemoveProperty):
(_NPN_HasProperty):
(_NPN_HasMethod):
(_NPN_Enumerate):
Get rid of all security checks.
* bindings/NP_jsobject.h:
Remove originRootObject from the JavaScriptObject struct.
* bindings/c/c_utility.cpp:
(KJS::Bindings::convertValueToNPVariant):
Always use the root object from the ExecState.
2007-12-13 Steve Falkenburg <sfalken@apple.com>
Move source file generation into its own vcproj to fix build dependencies.
Reviewed by Adam.
* JavaScriptCore.vcproj/JavaScriptCore.sln:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: Added.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: Added.
* JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
2007-12-13 Alp Toker <alp@atoker.com>
http://bugs.webkit.org/show_bug.cgi?id=16406
[Gtk] JavaScriptCore needs -lpthread
Build fix for Debian and any other platforms that don't implicitly
link to pthread.
Link to pthread on non-Windows platforms until this dependency is
removed from JSC.
2007-12-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Build fix: Note some variables that are used only for ASSERTs.
* API/testapi.c:
(Base_finalize):
(globalObject_initialize):
(testInitializeFinalize):
2007-12-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed: All JS tests crash on Windows.
NDEBUG wasn't defined when compiling testkjs in release builds, so the
HashTable definition in HashTable.h included an extra data member.
The solution was to add NDEBUG to the release testkjs configuration on
Windows and Mac.
For giggles, I also added other missing #defines to testkjs on Windows.
* Configurations/Base.xcconfig:
* Configurations/JavaScriptCore.xcconfig:
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/testkjs.cpp:
(main):
2007-12-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Removed bogus ASSERT.
ASSERT should only be used when we know that a code path will not be
taken. This code path is taken often during the jsFunFuzz test.
* pcre/pcre_exec.cpp:
(jsRegExpExecute):
2007-12-11 Darin Adler <darin@apple.com>
* wtf/unicode/qt4/UnicodeQt4.h: Try to fix Qt build by adding U16_IS_SINGLE.
2007-12-10 Darin Adler <darin@apple.com>
Reviewed by Sam Weinig.
- fix http://bugs.webkit.org/show_bug.cgi?id=16379
REGRESSION(r28525): Failures in http/tests/xmlhttprequest/response-encoding.html and
fast/dom/xmlhttprequest-html-response-encoding.html
and <rdar://problem/5640230> REGRESSION (306A4-ToT): Access violation in PCRE function
find_firstassertedchar
Test: fast/js/regexp-find-first-asserted.html
* pcre/pcre_compile.cpp:
(compileBracket): Take out unnecessary initialization of out parameters.
(branchFindFirstAssertedCharacter): Added. Broke out the half of the function that handles
a branch.
(bracketFindFirstAssertedCharacter): Renamed from find_firstassertedchar. Also removed the
options parameter -- the caller can handle the options.
(jsRegExpCompile): Changed call site to call the appropriate bracket or branch version of
the find_firstassertedchar function. Also put the REQ_IGNORE_CASE code here instead of
passing in the options.
2007-12-10 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Split this:
FunctionBodyNode
^
|
ProgramNode
into this:
ScopeNode
^ ^ ^
| | |
FunctionBodyNode ProgramNode EvalNode
in preparation for specializing each class more while optimizing global
variable access.
Also removed some cruft from the FunctionBodyNode interface to simplify
things.
SunSpider says this patch is a .8% speedup, which seems reasonable,
since it eliminates a few branches and adds KJS_FAST_CALL in a few
places.
Layout tests and JS tests pass. Also, this baby builds on Windows! (Qt
mileage may vary...)
2007-12-10 Geoffrey Garen <ggaren@apple.com>
RS by Mark Rowe.
Mac build fix: added some exported symbols, now that Parser::parse is
defined in the header.
* JavaScriptCore.exp:
2007-12-10 Sam Weinig <sam@webkit.org>
Build fix.
Template methods need to be in the header.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* kjs/Parser.cpp:
* kjs/Parser.h:
(KJS::Parser::parse):
2007-12-10 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Merged different implementations of Parser::parse into a single,
templatized implementation, in preparation for adding yet another
implementation for "eval" code.
JS and layout tests pass.
2007-12-10 Timothy Hatcher <timothy@apple.com>
Reviewed by Mark Rowe
<rdar://problem/5639463> Bundle versions on Tiger should be 4523.x not 523.x
* Configurations/Version.xcconfig: Some Tiger versions of Xcode don't set MAC_OS_X_VERSION_MAJOR,
so assume Tiger and use a 4 for the SYSTEM_VERSION_PREFIX.
2007-12-10 Mark Rowe <mrowe@apple.com>
Tiger build fix.
* kjs/grammar.y: Use @1 and @0 in place of @$ where Tiger's bison chokes.
2007-12-10 Darin Adler <darin@apple.com>
Reviewed by Mark Rowe.
- fix http://bugs.webkit.org/show_bug.cgi?id=16375
REGRESSION: Safari crashes on quit
Probably a debug-only issue.
* kjs/Parser.cpp:
(KJS::parser): Create the parser and never destroy it by using a pointer instead
of a global object.
2007-12-09 Darin Adler <darin@apple.com>
Reviewed by Sam Weinig.
- fix http://bugs.webkit.org/show_bug.cgi?id=16369
REGRESSION (r28525): regular expression tests failing due to bad firstByte optimization
* pcre/pcre_compile.cpp: Changed some names to use interCaps intead of under_scores.
(branchIsAnchored): Broke is_anchored into two separate functions; this one works on a
branch and the other on an anchor. The old function would only work on a bracket.
Also removed unneeded parameters; the anchored check does not require the bracket
map or the options any more because we have a reduced set of features.
(bracketIsAnchored): Ditto.
(branchNeedsLineStart): Broke canApplyFirstCharOptimization into two functions and gave
both a better name. This is the function that was returning the wrong value. The failure
was beacuse the old function would only work on a bracket.
(bracketNeedsLineStart): Ditto.
(jsRegExpCompile): Changed to call the appropriate branch or bracket flavor of the
functions based on whether we compiled an outer bracket. Also removed inaccurate comments
and unneeded parameters.
- other small changes
* pcre/pcre.h: Renumbered error codes, in a logical order. First, normal failure, then
the recursion limit, then running out of memory, and finally an unexpected internal error.
* pcre/pcre_exec.cpp: Fixed indentation.
(jsRegExpExecute): Corrected an inaccurate comment.
2007-12-09 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=16370
REGRESSION (r28540): source URL and line number no longer set for outer function/programs
Test: fast/js/exception-linenums-in-html-1.html
Test: fast/js/exception-linenums-in-html-2.html
Test: fast/js/exception-linenums.html
By the time the ProgramNode was constructed, the source URL was empty.
* kjs/Parser.cpp:
(KJS::Parser::parseProgram): Added code to set and clear m_sourceURL, which is now
handled here instead of in the lexer; it needs to still be set when we create the
program node. Call setLoc to set the first and last line number.
(KJS::Parser::parseFunctionBody): Ditto, but for the body.
(KJS::Parser::parse): Removed the sourceURL argument.
* kjs/Parser.h: Added sourceURL(), m_sourceURL, and m_lastLine. Added a lastLine
parameter to didFinishParsing, since the bison grammar knows the last line number
and we otherwise do not know it. Removed the sourceURL parameter from parse, since
that's now handled at a higher level.
* kjs/grammar.y: Pass the last line number to didFinishParsing.
* kjs/lexer.cpp:
(KJS::Lexer::setCode): Removed the sourceURL argument and the code to set m_sourceURL.
(KJS::Lexer::clear): Ditto.
* kjs/lexer.h: More of the same.
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::FunctionBodyNode): Get the source URL from the parser rather
than from the lexer. Removed unneeded call to setLoc, since the line numbers already
both default to -1.
2007-12-08 Oliver Hunt <oliver@apple.com>
Reviewed by Sam W.
Split the ENABLE_SVG_EXPERIMENTAL_FEATURES flag into separate flags.
Fixes <rdar://problem/5620249> Must disable SVG animation
<rdar://problem/5612772> Disable SVG filters on Mac to match Windows behavior
Minor config changes.
* Configurations/JavaScriptCore.xcconfig:
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-12-07 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
- Rename isSafeScript to allowsAccessFrom.
* bindings/NP_jsobject.cpp:
(_isSafeScript):
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::allowsAccessFrom): Reverse caller/argument of allowsAccessFrom to match
the new call.
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Refactored variable access optimization: Removed the assumption that
the FunctionBodyNode holds the symbol table.
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/nodes.cpp:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/interpreter.cpp:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/grammar.y:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/function_object.cpp:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed crash seen running layout tests.
Reverted a change I made earlier today. Added a comment to try to
discourage myself from making this mistake a third time.
* kjs/function.cpp:
(KJS::ActivationImp::mark):
* kjs/function.h:
(KJS::ActivationImp::ActivationImpData::ActivationImpData):
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Refactored parsing of global code: Removed the assumption that
ProgramNode inherits from FunctionBodyNode from the parser.
* kjs/Parser.cpp:
(KJS::Parser::parseProgram):
(KJS::Parser::parseFunctionBody):
(KJS::Parser::parse):
* kjs/Parser.h:
(KJS::Parser::didFinishParsing):
* kjs/function.cpp:
* kjs/grammar.y:
* kjs/nodes.h:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added JSVariableObject.cpp to the .pri file.
* JavaScriptCore.pri:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/function.cpp:
2007-12-07 Steve Falkenburg <sfalken@apple.com>
Re-named our B&I flag from BUILDBOT to PRODUCTION.
Reviewed by Sam Weinig.
* JavaScriptCore.vcproj/JavaScriptCore.make:
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: removed stray name qualification.
* kjs/function.h:
(KJS::ActivationImp::ActivationImp):
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Build fix: moved functions with qualified names outside of class
declaration.
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTableGet):
(KJS::JSVariableObject::symbolTablePut):
2007-12-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Next step in refactoring JSGlobalObject: Added JSVariableObject class,
and factored symbol-table-related code into it. (JSGlobalObject doesn't
use the symbol table code yet, though.)
Layout and JS tests, and testapi, pass. SunSpider reports no regression.
2007-12-07 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=16185
jsRegExpCompile should not add implicit non-capturing bracket
While this does not make SunSpider faster, it will make many regular
expressions a bit faster.
* pcre/pcre_compile.cpp: Moved CompileData struct in here from the
header since it's private to this file.
(compile_branch): Updated for function name change.
(compile_bracket): Renamed from compile_regex, since, for one thing,
this does not compile an entire regular expression.
(calculateCompiledPatternLengthAndFlags): Removed unused item_count
local variable. Renamed CompileData to cd instead of compile_block
to be consistent with other functions. Added code to set the
needOuterBracket flag if there's at least one "|" at the outer level.
(jsRegExpCompile): Renamed CompileData to cd instead of compile_block
to be consistent with other functions. Removed unneeded "size" field
from the compiled regular expression. If no outer bracket is needed,
then use compile_branch to compile the regular expression.
* pcre/pcre_internal.h: Removed the CompileData struct, which is now
private to pcre_compile.cpp. Removed the size member from JSRegExp.
2007-12-06 Kevin Ollivier <kevino@theolliviers.com>
MSVC7 build fix due to a compiler bug with placement new and/or
templates and casting.
Reviewed by Darin Adler.
* wtf/Vector.h:
(WTF::::append):
2007-12-06 Darin Adler <darin@apple.com>
Reviewed by Eric Seidel.
- fix http://bugs.webkit.org/show_bug.cgi?id=16321
new RegExp("[\u0097]{4,6}", "gmy") crashes in DEBUG builds
<rdar://problem/5632992>
Test: fast/js/regexp-oveflow.html
* pcre/pcre_compile.cpp:
(calculateCompiledPatternLengthAndFlags): In the case where a single character
character class is optimized to not use a character class at all, the preflight
code was not setting the lastitemlength variable.
2007-12-05 Mark Rowe <mrowe@apple.com>
Qt Windows build fix. Include the time-related headers in the correct place.
* kjs/JSGlobalObject.cpp:
* kjs/interpreter.cpp:
2007-12-05 Darin Adler <darin@apple.com>
Not reviewed; just undoing a previous commit.
- remove earlier incorrect fix for http://bugs.webkit.org/show_bug.cgi?id=16220
<rdar://problem/5625221> Crash opening www.news.com (CNet)
The real bug was the backwards ?: in the compile function, which Geoff just
fixed. Rolling out the incorrect earlier fix.
* pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags): Take out
the unneeded preflight change. The regression test proves this is still working
fine, so the bug remains fixed.
2007-12-01 Mark Rowe <mrowe@apple.com>
Build fix. Include headers before trying to use the things that they declare.
* kjs/JSImmediate.cpp:
* kjs/nodes.cpp:
* kjs/object.cpp:
* kjs/object_object.cpp:
* kjs/regexp_object.cpp:
* kjs/string_object.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added some #includes.
* kjs/JSImmediate.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added some #includes.
* kjs/JSGlobalObject.cpp:
* kjs/JSImmediate.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: Fixed #include spelling.
* kjs/debugger.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added #include.
* kjs/debugger.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added a forward declaration.
* kjs/debugger.h:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added an #include.
* kjs/error_object.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Build fix: added an #include.
* kjs/bool_object.cpp:
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Third step in refactoring JSGlobalObject: Moved data members and
functions accessing data members from Interpreter to JSGlobalObject.
Changed Interpreter member functions to static functions.
This resolves a bug in global object bootstrapping, where the global
ExecState could be used when uninitialized.
This is a big change, but it's mostly code motion and renaming.
Layout and JS tests, and testjsglue and testapi, pass. SunSpider reports
a .7% regression, but Shark sees no difference related to this patch,
and SunSpider reported a .7% speedup from an earlier step in this
refactoring, so I think it's fair to call that a wash.
2007-12-05 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler. (Or vice versa.)
Fixed ASSERT during run-javascriptcore-tests. (Darin just added the
ASSERT, but the bug wasn't new.)
* pcre/pcre_compile.cpp:
(compile_branch): The ?: operator here was backwards, causing us to
execute the loop too many times, adding stray KET opcodes to the
compiled regular expression.
2007-12-05 Kevin McCullough <kmccullough@apple.com>
Reviewed by Geoff.
- Wait until local variable data is fully constructed before notifying the debugger of entering
or leaving a call frame.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::execute):
2007-12-05 Mark Rowe <mrowe@apple.com>
Reviewed by Oliver.
Build fix for GCC 4.2. Cast via a union to avoid strict-aliasing issues.
* wtf/FastMalloc.cpp:
(WTF::):
(WTF::getPageHeap):
2007-12-05 Mark Rowe <mrowe@apple.com>
Reviewed by Darin.
Fix testkjs in 64-bit.
When built for 64-bit the TCMalloc spin lock uses pthread mutexes rather than a custom spin lock
implemented in assembly. If we fail to initialize the pthread mutex, attempts to lock or unlock
it will fail and trigger a call to abort.
* wtf/FastMalloc.cpp: Initialize the spin lock so that we can later lock and unlock it.
* wtf/TCSpinLock.h: Add an Init method to the optimised spin lock.
2007-12-04 Oliver Hunt <oliver@apple.com>
Reviewed by NOBODY (Build fix).
Fix gtk build.
* wtf/TCSystemAlloc.cpp:
2007-12-03 Oliver Hunt <oliver@apple.com>
Reviewed by Mark Rowe and Geoff Garen.
Merge TCMalloc r38
It also result in a performance progression between 0.5% and
0.9% depending on the test, however most if not all of this
gain will be consumed by the overhead involved in the later
change to release memory to the system.
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* wtf/FastMalloc.cpp:
(WTF::KernelSupportsTLS):
(WTF::CheckIfKernelSupportsTLS):
(WTF::):
(WTF::ClassIndex):
(WTF::SLL_Next):
(WTF::SLL_SetNext):
(WTF::SLL_Push):
(WTF::SLL_Pop):
(WTF::SLL_PopRange):
(WTF::SLL_PushRange):
(WTF::SLL_Size):
(WTF::SizeClass):
(WTF::ByteSizeForClass):
(WTF::NumMoveSize):
(WTF::InitSizeClasses):
(WTF::AllocationSize):
(WTF::TCMalloc_PageHeap::GetSizeClassIfCached):
(WTF::TCMalloc_PageHeap::CacheSizeClass):
(WTF::TCMalloc_PageHeap::init):
(WTF::TCMalloc_PageHeap::New):
(WTF::TCMalloc_PageHeap::AllocLarge):
(WTF::TCMalloc_PageHeap::Carve):
(WTF::TCMalloc_PageHeap::Delete):
(WTF::TCMalloc_PageHeap::IncrementalScavenge):
(WTF::PagesToMB):
(WTF::TCMalloc_PageHeap::Dump):
(WTF::TCMalloc_PageHeap::GrowHeap):
(WTF::TCMalloc_PageHeap::Check):
(WTF::ReleaseFreeList):
(WTF::TCMalloc_PageHeap::ReleaseFreePages):
(WTF::TCMalloc_ThreadCache_FreeList::Push):
(WTF::TCMalloc_ThreadCache_FreeList::PushRange):
(WTF::TCMalloc_ThreadCache_FreeList::PopRange):
(WTF::TCMalloc_ThreadCache_FreeList::Pop):
(WTF::TCMalloc_Central_FreeList::length):
(WTF::TCMalloc_Central_FreeList::tc_length):
(WTF::TCMalloc_Central_FreeList::Init):
(WTF::TCMalloc_Central_FreeList::ReleaseListToSpans):
(WTF::TCMalloc_Central_FreeList::EvictRandomSizeClass):
(WTF::TCMalloc_Central_FreeList::MakeCacheSpace):
(WTF::TCMalloc_Central_FreeList::ShrinkCache):
(WTF::TCMalloc_Central_FreeList::InsertRange):
(WTF::TCMalloc_Central_FreeList::RemoveRange):
(WTF::TCMalloc_Central_FreeList::FetchFromSpansSafe):
(WTF::TCMalloc_Central_FreeList::Populate):
(WTF::TCMalloc_ThreadCache::Init):
(WTF::TCMalloc_ThreadCache::Cleanup):
(WTF::TCMalloc_ThreadCache::Allocate):
(WTF::TCMalloc_ThreadCache::Deallocate):
(WTF::TCMalloc_ThreadCache::FetchFromCentralCache):
(WTF::TCMalloc_ThreadCache::ReleaseToCentralCache):
(WTF::TCMalloc_ThreadCache::Scavenge):
(WTF::TCMalloc_ThreadCache::PickNextSample):
(WTF::TCMalloc_ThreadCache::NewHeap):
(WTF::TCMalloc_ThreadCache::GetThreadHeap):
(WTF::TCMalloc_ThreadCache::GetCache):
(WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
(WTF::TCMalloc_ThreadCache::InitTSD):
(WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
(WTF::TCMallocStats::ExtractStats):
(WTF::TCMallocStats::DumpStats):
(WTF::TCMallocStats::DumpStackTraces):
(WTF::TCMallocStats::TCMallocImplementation::MarkThreadIdle):
(WTF::TCMallocStats::TCMallocImplementation::ReleaseFreeMemory):
(WTF::TCMallocStats::TCMallocGuard::TCMallocGuard):
(WTF::TCMallocStats::TCMallocGuard::~TCMallocGuard):
(WTF::TCMallocStats::DoSampledAllocation):
(WTF::TCMallocStats::CheckCachedSizeClass):
(WTF::TCMallocStats::CheckedMallocResult):
(WTF::TCMallocStats::SpanToMallocResult):
(WTF::TCMallocStats::do_malloc):
(WTF::TCMallocStats::do_free):
(WTF::TCMallocStats::do_memalign):
(WTF::TCMallocStats::do_malloc_stats):
(WTF::TCMallocStats::do_mallopt):
(WTF::TCMallocStats::do_mallinfo):
(WTF::TCMallocStats::realloc):
(WTF::TCMallocStats::cpp_alloc):
(WTF::TCMallocStats::operator new):
(WTF::TCMallocStats::):
(WTF::TCMallocStats::operator new[]):
(WTF::TCMallocStats::malloc_stats):
(WTF::TCMallocStats::mallopt):
(WTF::TCMallocStats::mallinfo):
* wtf/TCPackedCache.h: Added.
(PackedCache::PackedCache):
(PackedCache::Put):
(PackedCache::Has):
(PackedCache::GetOrDefault):
(PackedCache::Clear):
(PackedCache::EntryToValue):
(PackedCache::EntryToUpper):
(PackedCache::KeyToUpper):
(PackedCache::UpperToPartialKey):
(PackedCache::Hash):
(PackedCache::KeyMatch):
* wtf/TCPageMap.h:
(TCMalloc_PageMap2::PreallocateMoreMemory):
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemRelease):
* wtf/TCSystemAlloc.h:
2007-12-04 Anders Carlsson <andersca@apple.com>
Reviewed by Sam.
Make isSafeScript const.
* kjs/JSGlobalObject.h:
(KJS::JSGlobalObject::isSafeScript):
2007-12-04 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix first part of http://bugs.webkit.org/show_bug.cgi?id=16220
<rdar://problem/5625221> Crash opening www.news.com (CNet)
Test: fast/js/regexp-overflow.html
* pcre/pcre_compile.cpp:
(calculateCompiledPatternLengthAndFlags): Add room for the additional BRA/KET that
was generated in the compile code but not taken into account here.
2007-12-03 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=15618
<rdar://problem/5619353> REGRESSION: Stack overflow/crash in KJS::equal (15618)
Test: fast/js/recursion-limit-equal.html
* kjs/operations.cpp: (KJS::equal): Check the exception from toPrimitive.
2007-12-03 Dan Bernstein <mitz@apple.com>
- fix a copy-and-paste-o
* bindings/npruntime.cpp:
(_NPN_GetIntIdentifier):
2007-12-03 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
- fix an ASSERT when getIntIdentifier is called with 0 or -1
* bindings/npruntime.cpp:
(_NPN_GetIntIdentifier): We cannot use the hashmap for 0 and -1 since
they are the empty value and the deleted value. Instead, keep the
identifiers for those two integers in a static array.
2007-12-02 Darin Adler <darin@apple.com>
Reviewed by Mitz.
- fix http://bugs.webkit.org/show_bug.cgi?id=15848
<rdar://problem/5619330> REGRESSION: Assertion failure viewing comments page on digg.com
Test: fast/js/sparse-array.html
* kjs/array_instance.cpp:
(KJS::ArrayInstance::inlineGetOwnPropertySlot): Check sparse array cutoff before looking
in hash map. Can't avoid the branch because we can't look for 0 in the hash.
(KJS::ArrayInstance::deleteProperty): Ditto.
2007-12-02 Geoffrey Garen <ggaren@apple.com>
Build fix: added an #include.
* kjs/collector.cpp:
2007-12-02 Geoffrey Garen <ggaren@apple.com>
Reviewed by Eric Seidel.
Second step in refactoring JSGlobalObject: moved virtual functions from
Interpreter to JSGlobalObject.
Layout and JS tests pass. SunSpider reports a .7% speedup -- don't
believe his lies.
2007-12-01 Alp Toker <alp@atoker.com>
Reviewed by Adam Roben.
http://bugs.webkit.org/show_bug.cgi?id=16228
kJSClassDefinitionEmpty is not exported with JS_EXPORT
Add JS_EXPORT to kJSClassDefinitionEmpty.
Make the gcc compiler check take precedence over the WIN32||_WIN32
check to ensure that symbols are exported on Windows when using gcc.
Add a TODO referencing the bug about JS_EXPORT in the Win build
(http://bugs.webkit.org/show_bug.cgi?id=16227)
Don't define JS_EXPORT as 'extern' when the compiler is unknown since
it would result in the incorrect expansion:
extern extern const JSClassDefinition kJSClassDefinitionEmpty;
(This was something we inherited from CFBase.h that doesn't make sense
for JSBase.h)
* API/JSBase.h:
* API/JSObjectRef.h:
2007-11-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth Dakin.
Reversed the ownership relationship between Interpreter and JSGlobalObject.
Now, the JSGlobalObject owns the Interpreter, and top-level objects
that need the two to persist just protect the JSGlobalObject from GC.
Global object bootstrapping looks a little odd right now, but it will
make much more sense soon, after further rounds of refactoring.
* bindings/runtime_root.h: Made this class inherit from RefCounted,
to avoid code duplication.
* kjs/collector.cpp:
(KJS::Collector::collect): No need to give special GC treatment to
Interpreters, since we mark their global objects, which mark them.
* kjs/interpreter.cpp:
(KJS::Interpreter::mark): No need to mark our global object, since it
marks us.
* kjs/interpreter.h: Don't inherit from RefCounted -- JSGlobalObject
owns us directly.
* kjs/testkjs.cpp: Modified to follow the new rules.
(createGlobalObject):
(runWithScripts):
2007-11-30 Brent Fulgham <bfulgham@gmail.com>
Reviewed by Eric.
* ChangeLog:
* pcre/pcre_compile.cpp:
(compile_branch):
2007-11-30 Eric Seidel <eric@webkit.org>
No review, build fix only.
Fix uninitialized var warnings in release build.
* JavaScriptCore.xcodeproj/project.pbxproj:
* pcre/pcre_compile.cpp:
(compile_regex):
2007-11-30 Darin Adler <darin@apple.com>
Reviewed by Adam Roben.
- fix http://bugs.webkit.org/show_bug.cgi?id=16207
JavaScript regular expressions should match UTF-16 code units rather than characters
SunSpider says this is 5.5% faster on the regexp test, 0.4% faste overall.
Test: fast/js/regexp-non-bmp.html
Renamed ANY_CHAR to NOT_NEWLINE to more-accurately reflect its meaning.
* pcre/pcre_compile.cpp:
(compile_branch): Removed calls to the UTF-16 character accessor functions, replacing
them with simple pointer dereferences in some cases, and no code at all in others.
(calculateCompiledPatternLengthAndFlags): Ditto.
* pcre/pcre_exec.cpp:
(match): Fixed indentation of some case labels (including all the BEGIN_OPCODE).
Removed calls to the UTF-16 character accessor functions, replacing them with simple
pointer dereferences in some cases, and no code at all in others. Also removed some
explicit UTF-16 support code in a few cases. Removed the unneeded "UTF-8" code path
in the ANY_CHAR repeat code, and in another case, eliminated the code to check against
end_subject in because it is already done outside the loop.
(jsRegExpExecute):
* pcre/pcre_internal.h: Removed all the UTF-16 helper functions.
2007-11-30 Eric Seidel <eric@webkit.org>
Reviewed by darin.
PCRE crashes under GuardMalloc
http://bugs.webkit.org/show_bug.cgi?id=16127
check against patternEnd to make sure we don't walk off the end of the string
* pcre/pcre_compile.cpp:
(compile_branch):
(calculateCompiledPatternLengthAndFlags):
2007-11-30 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Fix layout test regressions caused by r28186
http://bugs.webkit.org/show_bug.cgi?id=16195
change first_byte and req_byte back to shorts instead of chars
(I think PCRE stuffs information in the high bits)
* pcre/pcre_internal.h:
2007-11-29 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej and Darin.
Make the JS collector work with multiple threads
Under heavy contention it was possible the GC to suspend other
threads inside the pthread spinlock, which could lead to the GC
thread blocking on the pthread spinlock itself.
We now determine and store each thread's stack base when it is
registered, thus removing the need for any calls to pthread_get_stackaddr_np
that needed the pthread spinlock.
* kjs/collector.cpp:
(KJS::Collector::Thread::Thread):
(KJS::Collector::registerThread):
(KJS::Collector::markOtherThreadConservatively):
2007-11-29 Adam Roben <aroben@apple.com>
Windows build fix
Removed some unreachable code (ironically, the code was some
ASSERT_NOT_REACHED()s).
* pcre/pcre_compile.cpp:
(compile_branch):
* pcre/pcre_exec.cpp:
(match):
2007-11-29 Eric Seidel <eric@webkit.org>
Reviewed by Mark Rowe.
Fix for --guard crash of fast/js/regexp-charclass-crash introduced by r28151.
* pcre/pcre_compile.cpp:
(is_anchored):
2007-11-28 Mark Rowe <mrowe@apple.com>
Gtk build fix. Rubber-stamped by Eric.
* pcre/pcre_exec.cpp:
(match): Add braces around the body of the case statement to prevent
wanings about jumps across the initialization of a variable.
2007-11-29 Eric Seidel <eric@webkit.org>
Reviewed by Mark Rowe.
Attempt to fix non-mac builds after PCRE cleanup.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCoreSources.bkl:
* pcre/pcre.pri:
2007-11-28 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Centralize code for subjectPtr adjustments using inlines, only ever check for a single
trailing surrogate (as UTF16 only allows one), possibly fix PCRE bugs involving char
classes and garbled UTF16 strings.
* pcre/pcre_exec.cpp:
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
(getPreviousChar):
(movePtrToPreviousChar):
(movePtrToNextChar):
(movePtrToStartOfCurrentChar):
2007-11-28 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
change getChar* functions to return result and push 'c' into local scopes for clarity
* pcre/pcre_compile.cpp:
(compile_branch):
(calculateCompiledPatternLengthAndFlags):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
(getChar):
(getCharAndAdvance):
(getCharAndLength):
(getCharAndAdvanceIfSurrogate):
2007-11-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Comment cleanup
* pcre/pcre_exec.cpp:
(match):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Further cleanups to calculateCompiledPatternLengthAndFlags
* pcre/pcre_compile.cpp:
(calculateCompiledPatternLengthAndFlags):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Give consistent naming to the RegExp options/compile flags
* pcre/pcre_compile.cpp:
(compile_branch):
(is_anchored):
(find_firstassertedchar):
(printCompiledRegExp):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Pull first_byte and req_byte optimizations out into separate static funtions, SunSpider reported this as a win.
* pcre/pcre_exec.cpp:
(tryFirstByteOptimization):
(tryRequiredByteOptimization):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
give PCRE_MULTILINE a better name: OptionMatchAcrossMultipleLines
* pcre/pcre_compile.cpp:
(compile_branch):
(is_anchored):
(printCompiledRegExp):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
Deprecate jsRegExpExecute's offset-vector fallback code
* pcre/pcre_exec.cpp:
(jsRegExpExecute):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Make cur_is_word and prev_is_word locals, and change OP_ANY to OP_ANY_CHAR for clarity
* pcre/pcre_compile.cpp:
(find_fixedlength):
(compile_branch):
(canApplyFirstCharOptimization):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Mitz & Maciej.
Change _NC operators to use _IGNORING_CASE for clarity
* pcre/pcre_compile.cpp:
(find_fixedlength):
(compile_branch):
(find_firstassertedchar):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Mitz.
Remove branch from return
* pcre/pcre_compile.cpp:
(compile_branch):
* pcre/pcre_exec.cpp:
(match):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Add repeatInformationFromInstructionOffset inline
* pcre/pcre_exec.cpp:
(repeatInformationFromInstructionOffset):
(match):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Remove no longer used error code JSRegExpErrorMatchLimit
* kjs/regexp.cpp:
(KJS::RegExp::match):
* pcre/pcre.h:
* pcre/pcre_internal.h:
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Make i locally scoped for better code clarity
* pcre/pcre_exec.cpp:
(match):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Give subjectPtr and instructionPtr sane names, reduce size of MatchFrame for a 0.2% speedup.
* pcre/pcre_compile.cpp:
(compile_branch):
(calculateCompiledPatternLengthAndFlags):
* pcre/pcre_exec.cpp:
(match_ref):
(MatchStack::pushNewFrame):
(getUTF8CharAndIncrementLength):
(match):
* pcre/pcre_internal.h:
(getChar):
(getCharAndAdvance):
(getCharAndLength):
(getCharAndAdvanceIfSurrogate):
* pcre/pcre_xclass.cpp:
(getUTF8CharAndAdvancePointer):
2007-11-26 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Small speedup (0.7%) by simplifying canUseStackBufferForNextFrame() check
* pcre/pcre_exec.cpp:
(MatchStack::MatchStack):
(MatchStack::popCurrentFrame):
2007-11-25 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Lower MATCH_LIMIT_RECURSION to more sane levels to prevent hangs on run-javascriptcore-tests
* pcre/pcre_internal.h:
2007-11-25 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Remove match_is_group variable for another 5% speedup
* pcre/pcre_compile.cpp:
* pcre/pcre_exec.cpp:
(startNewGroup):
(match):
2007-11-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Abstract frame variables into locals and args
* pcre/pcre_compile.cpp:
(compile_branch):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
2007-11-28 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Section off MatchData arguments into args struct
* pcre/pcre_exec.cpp:
(MatchStack::pushNewFrame):
(match):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Remove redundant eptrblock struct
* pcre/pcre_exec.cpp:
(MatchStack::pushNewFrame):
(match):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Remove redundant match_call_count and move recursion check out of super-hot code path
SunSpider says this is at least an 8% speedup for regexp.
* pcre/pcre_exec.cpp:
(MatchStack::MatchStack):
(MatchStack::pushNewFrame):
(MatchStack::popCurrentFrame):
(MatchStack::popAllFrames):
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Get rid of GETCHAR* macros, replacing them with better named inlines
* pcre/pcre_compile.cpp:
(compile_branch):
(calculateCompiledPatternLengthAndFlags):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
(getCharAndAdvance):
(getCharAndLength):
(getCharAndAdvanceIfSurrogate):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Further cleanup GET/PUT inlines
* pcre/pcre_internal.h:
(putOpcodeValueAtOffset):
(getOpcodeValueAtOffset):
(putOpcodeValueAtOffsetAndAdvance):
(put2ByteOpcodeValueAtOffset):
(get2ByteOpcodeValueAtOffset):
(put2ByteOpcodeValueAtOffsetAndAdvance):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Give GET, PUT better names, and add (poor) moveOpcodePtrPastAnyAlternateBranches
* pcre/pcre_compile.cpp:
(firstSignificantOpCodeSkippingAssertions):
(find_fixedlength):
(complete_callout):
(compile_branch):
(compile_regex):
(is_anchored):
(canApplyFirstCharOptimization):
(find_firstassertedchar):
* pcre/pcre_exec.cpp:
(match):
* pcre/pcre_internal.h:
(putOpcodeValueAtOffset):
(getOpcodeValueAtOffset):
(putOpcodeValueAtOffsetAndAdvance):
(put2ByteOpcodeValueAtOffset):
(get2ByteOpcodeValueAtOffset):
(moveOpcodePtrPastAnyAlternateBranches):
* pcre/pcre_ucp_searchfuncs.cpp:
(_pcre_ucp_othercase):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Add inlines for toLowerCase, isWordChar, isSpaceChar for further regexp speedup
* pcre/pcre_compile.cpp:
(compile_branch):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
(toLowerCase):
(flipCase):
(classBitmapForChar):
(charTypeForChar):
(isWordChar):
(isSpaceChar):
(CompileData::CompileData):
* pcre/pcre_xclass.cpp:
(_pcre_xclass):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
cleanup _pcre_ucp_othercase
* pcre/pcre_ucp_searchfuncs.cpp:
(_pcre_ucp_othercase):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Use better variable names for case ignoring options
* pcre/pcre_compile.cpp:
(compile_branch):
(find_firstassertedchar):
(printCompiledRegExp):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(match_ref):
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
split first_significant_code into two simpler functions
* pcre/pcre_compile.cpp:
(firstSignificantOpCode):
(firstSignificantOpCodeSkippingAssertions):
(is_anchored):
(canApplyFirstCharOptimization):
(find_firstassertedchar):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
clean up is_counted_repeat
* pcre/pcre_compile.cpp:
(is_counted_repeat):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
clean up check_escape
* pcre/pcre_compile.cpp:
(check_escape):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Reformat find_fixedlength
* pcre/pcre_compile.cpp:
(find_fixedlength):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
reformat is_anchored
* pcre/pcre_compile.cpp:
(is_anchored):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Remove unused function could_be_empty_branch
* pcre/pcre_compile.cpp:
(first_significant_code):
(find_fixedlength):
(compile_branch):
(canApplyFirstCharOptimization):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Pass around MatchData objects by reference
* pcre/pcre_exec.cpp:
(pchars):
(match_ref):
(match):
(jsRegExpExecute):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
give PCRE_STARTLINE a better name and rename match_data to MatchData
* pcre/pcre_compile.cpp:
(compile_branch):
(canApplyFirstCharOptimization):
(find_firstassertedchar):
(printCompiledRegExp):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(pchars):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Clean up find_firstassertedchar
* pcre/pcre_compile.cpp:
(get_othercase_range):
(find_firstassertedchar):
(calculateCompiledPatternLengthAndFlags):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Tim Hatcher.
Pass around CompileData& instead of CompileData*
* pcre/pcre_compile.cpp:
(compile_branch):
(jsRegExpCompile):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Clean up compile_branch, move _pcre_ord2utf8, and rename CompileData
* JavaScriptCore.xcodeproj/project.pbxproj:
* pcre/pcre_compile.cpp:
(_pcre_ord2utf8):
(calculateCompiledPatternLengthAndFlags):
(jsRegExpCompile):
* pcre/pcre_internal.h:
* pcre/pcre_ord2utf8.cpp: Removed.
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
removing more macros
* pcre/pcre_compile.cpp:
(could_be_empty_branch):
(compile_branch):
(calculateCompiledPatternLengthAndFlags):
* pcre/pcre_exec.cpp:
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
* pcre/pcre_xclass.cpp:
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
clean up formating in compile_branch
* pcre/pcre_compile.cpp:
(compile_branch):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Fix spacing for read_repeat_counts
* pcre/pcre_compile.cpp:
(read_repeat_counts):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Get rid of PCRE custom char types
* pcre/pcre_compile.cpp:
(check_escape):
(complete_callout):
(compile_branch):
(compile_regex):
(calculateCompiledPatternLengthAndFlags):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(match_ref):
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
reformat get_othercase_range
* pcre/pcre_compile.cpp:
(get_othercase_range):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Remove register keyword and more cleanup
* pcre/pcre_compile.cpp:
(find_fixedlength):
(compile_branch):
(is_anchored):
(is_startline):
(find_firstassertedchar):
(calculateCompiledPatternLengthAndFlags):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(MatchStack::canUseStackBufferForNextFrame):
(MatchStack::allocateNextFrame):
(MatchStack::pushNewFrame):
(MatchStack::frameIsStackAllocated):
(MatchStack::popCurrentFrame):
(MatchStack::unrollAnyHeapAllocatedFrames):
(getUTF8CharAndIncrementLength):
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
(PUT2INC):
(isLeadingSurrogate):
(isTrailingSurrogate):
(decodeSurrogatePair):
(getChar):
* pcre/pcre_ord2utf8.cpp:
(_pcre_ord2utf8):
* pcre/pcre_xclass.cpp:
(getUTF8CharAndAdvancePointer):
(_pcre_xclass):
2007-11-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Clean up jsRegExpExecute
* pcre/pcre_compile.cpp:
(returnError):
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(jsRegExpExecute):
* pcre/pcre_internal.h:
2007-11-29 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
Merging updated system alloc and spinlock code from r38 of TCMalloc.
This is needed as a precursor to the merge of TCMalloc proper.
* wtf/FastMalloc.cpp:
(WTF::TCMalloc_PageHeap::GrowHeap):
* wtf/TCSpinLock.h:
(TCMalloc_SpinLock::TCMalloc_SpinLock):
(TCMalloc_SpinLock::):
(TCMalloc_SpinLock::Lock):
(TCMalloc_SpinLock::Unlock):
(TCMalloc_SpinLock::IsHeld):
* wtf/TCSystemAlloc.cpp:
(TrySbrk):
(TryMmap):
(TryVirtualAlloc):
(TryDevMem):
(TCMalloc_SystemAlloc):
* wtf/TCSystemAlloc.h:
2007-11-28 Brady Eidson <beidson@apple.com>
Reviewed by Geoff
Add copyKeysToVector utility, mirroring copyValuesToVector
Also change the copyValuesToVector implementation to be a little more attractive
* wtf/HashMap.h:
(WTF::copyKeysToVector):
(WTF::copyValuesToVector):
2007-11-27 Alp Toker <alp@atoker.com>
Reviewed by Mark Rowe.
Add a list of public JavaScriptCore headers for installation.
This follows the convention used for the Qt and GTK+ header lists.
* headers.pri: Added.
2007-11-27 Alp Toker <alp@atoker.com>
Prospective MSVC build fix.
Roll back dllexport/dllimport support for now.
* API/JSBase.h:
2007-11-27 Alp Toker <alp@atoker.com>
Reviewed by Maciej.
http://bugs.webkit.org/show_bug.cgi?id=15569
[gtk] GTK JavaScriptCore needs to export symbols for JSC API and WTF
Introduce JS_EXPORT to mark symbols to be exported as public API.
Export all public symbols in the JavaScriptCore C API.
This matches conventions for exporting symbols set by the CF and CG
frameworks.
* API/JSBase.h:
* API/JSContextRef.h:
* API/JSObjectRef.h:
* API/JSStringRef.h:
* API/JSStringRefBSTR.h:
* API/JSStringRefCF.h:
* API/JSValueRef.h:
2007-11-27 Anders Carlsson <andersca@apple.com>
Reviewed by Adam.
Make PropertyNameArray and ScopeChain COMEnumVariant friendly.
* kjs/PropertyNameArray.cpp:
(KJS::PropertyNameArray::swap):
Implement PropertyNameArray::swap.
* kjs/PropertyNameArray.h:
Add ValueType typedef. Replace PropertyNameArrayIterator with
PropertyNameArray::const_iterator.
* kjs/nodes.cpp:
(KJS::ForInNode::execute):
* kjs/scope_chain.cpp:
(KJS::ScopeChain::print):
Update for changes to PropertyNameArray.
* kjs/scope_chain.h:
Add const_iterator and ValueType typedef.
2007-11-27 Anders Carlsson <andersca@apple.com>
Reviewed by Darin.
Add a ValueType typedef.
* wtf/Vector.h:
2007-11-26 Darin Adler <darin@apple.com>
Reviewed by Mitz.
- fix http://bugs.webkit.org/show_bug.cgi?id=16096
REGRESSION (r26653-r26699): Plaxo.com addressbook does not load in webkit nightlies
Test: fast/js/regexp-overflow.html
* pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags):
Removed a stray "ptr++" that I added by accident when merging the
changes between PCRE 6.4 and 6.5.
2007-11-26 Geoffrey Garen <ggaren@apple.com>
Reviewed by Kevin McCullough.
Fixed <rdar://problem/5597937> REGRESSION (r27126): Drosera does not
show variables (can't enumerate ActivationImp properties)
Implemented a custom ActivationImp::getPropertyNames, since
ActivationImp now uses a custom property storage mechanism for local
variables.
* kjs/function.cpp:
(KJS::ActivationImp::getPropertyNames):
* kjs/function.h:
2007-11-26 Alp Toker <alp@atoker.com>
GTK+/Qt/Wx build fix for breakage introduced in r28039.
* ForwardingHeaders/JavaScriptCore/JSRetainPtr.h: Added.
2007-11-24 Laszlo Gombos <laszlo.gombos@gmail.com>
Reviewed by Maciej Stachowiak.
Fix minor compiler warning (GCC 4.1.3)
* pcre/pcre_internal.h:
* pcre/pcre_ucp_searchfuncs.cpp:
(_pcre_ucp_othercase):
2007-11-25 Mark Rowe <mrowe@apple.com>
Reviewed by Dan Bernstein.
Fix http://bugs.webkit.org/show_bug.cgi?id=16129
Bug 16129: REGRESSION (r27761-r27811): malloc error while visiting http://mysit.es (crashes release build)
* pcre/pcre_compile.cpp: Change errorcode to be passed by reference so that any error code is propagated
to our caller like they expect.
2007-11-23 Kevin Ollivier <kevino@theolliviers.com>
MSVC7 build fix. (rand_s doesn't exist there)
Reviewed by Adam Roben.
* kjs/config.h:
* wtf/MathExtras.h:
2007-11-23 Kevin Ollivier <kevino@theolliviers.com>
wx build fix. Move WX_PYTHON logic into project build settings,
add WebKitLibraries dirs on Win, and explicitly include JSCore
headers in testkjs rather than getting them from a template.
(Include dir order of JSCore/WTF and ICU headers is important due
to wtf/unicode/utf8.h.)
* jscore.bkl:
2007-11-23 Simon Hausmann <hausmann@webkit.org>
Reviewed by George Staikos <staikos@kde.org>.
Fix make (dist)clean on Windows.
OBJECTS_DIR_WTR does not exist anymore, use GENERATED_SOURCES_DIR.
* JavaScriptCore.pri:
* pcre/pcre.pri:
2007-11-22 Simon Hausmann <hausmann@kde.org>
Reviewed by George.
Make the directory of where to put the generated sources configurable through the GENERATED_SOURCE_DIR variable
* JavaScriptCore.pri:
* pcre/pcre.pri:
2007-11-22 Simon Hausmann <hausmann@kde.org>
Reviewed by George.
Centralize the setup for all the extra compilers in a addExtraCompiler function.
This allows adding a "generated_files" target that builds all generated files using "make generated_files".
For the build inside Qt we do not generate actual rules for the extra compilers but instead
do the variable substitution of compiler.output manually and add the generated sources to SOURCES.
* JavaScriptCore.pri:
* pcre/pcre.pri:
2007-11-20 Mark Rowe <mrowe@apple.com>
Reviewed by Tim Hatcher.
<rdar://problem/5602936> Need to resolve new GCC 4.2 warnings
Fix all warnings emitted by GCC 4.2 when building JavaScriptCore. This allows builds with
-Werror to succeed. At present they will crash when executed due to code that is not safe
under strict aliasing (<rdar://problem/5536806>).
* Configurations/Base.xcconfig: Remove the -Wno-long-double flag.
* kjs/date_object.cpp:
(KJS::formatTime): Test whether the stack-allocated string is empty rather than at a non-null address.
* kjs/dtoa.cpp:
(Bigint::): Tweak formatting to silence warnings.
* pcre/pcre_exec.cpp:
(match): Tweak formatting to silence warnings
* wtf/Assertions.cpp: Add printf format attribute to functions that warrant it.
* wtf/Assertions.h: Ditto.
2007-11-19 Kevin Ollivier <kevino@theolliviers.com>
wx port build fix (wx headers include ctype functions).
* kjs/config.h:
2007-11-19 Kevin Ollivier <kevino@theolliviers.com>
Remove outdated and unused Windows port files.
Reviewed by Adam Roben.
* Makefile.vc: Removed.
* README-Win32.txt: Removed.
2007-11-18 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
* tests/mozilla/jsDriver.pl: exit non-0 when user aborts test run
2007-11-17 Mark Rowe <mrowe@apple.com>
Reviewed by Darin Adler.
Fix: <rdar://problem/5607032> REGRESSION: testapi exits with assertion failure in debug build
<rdar://problem/5440659> JSGlobalContextCreate throws away globalObjectClass's prototype
http://bugs.webkit.org/show_bug.cgi?id=16033
Split Interpreter's initialization into two distinct steps: the creation of the global prototypes
and constructors, and storing them on the global object. This allows JSClassRef's passed to
JSGlobalContextCreate to be instantiated with the correct prototype.
* API/JSCallbackObject.cpp: Assert at compile-time that the custom global object will fit in a collector cell.
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(KJS::::JSCallbackObject):
(KJS::::init):
* API/JSContextRef.cpp:
(JSGlobalContextCreate): Construct and set the interpreter's global object separately. When globalObjectClass
is passed we need to set the interpreter's global object before doing the JSCallbackObject's initialization to
prevent any JSObjectInitializeCallback's being invoked before a global object is set.
* API/testapi.c:
(globalObject_initialize): Test the object passed in is correct and that it has the expected global properties.
(globalObject_get):
(globalObject_set):
(main):
* API/testapi.js: Test that any static properties exposed by the global object's custom class are found.
* JavaScriptCore.exp:
* bindings/testbindings.cpp:
(main): Update for changes in Interpreter method signatures.
* bindings/testbindings.mm:
(main): Ditto.
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
(KJS::ExecState::mark):
(KJS::ExecState::setGlobalObject):
* kjs/ExecState.h: Rename scope to m_scopeChain.
* kjs/interpreter.cpp:
(KJS::Interpreter::Interpreter):
(KJS::Interpreter::init):
(KJS::Interpreter::globalObject):
(KJS::Interpreter::setGlobalObject):
(KJS::Interpreter::resetGlobalObjectProperties):
(KJS::Interpreter::createObjectsForGlobalObjectProperties):
(KJS::Interpreter::setGlobalObjectProperties): Switch to using putDirect to ensure that the global object's put method
cannot interfere with setting of the global properties. This prevents a user-written JSClassRef from attempting to
call back into JavaScript from the initialization of the global object's members.
* kjs/interpreter.h:
* kjs/testkjs.cpp:
(setupInterpreter): Update for changes in Interpreter method signatures.
2007-11-17 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
Prevent testapi from reporting false leaks. Clear out local variables pointing at
JSObjectRefs to allow their values to be collected.
* API/testapi.c:
(main):
2007-11-17 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
Prevent testapi from crashing if testapi.js can not be found by nil-checking the result of createStringWithContentsOfFile.
* API/testapi.c:
(main):
2007-11-17 Alp Toker <alp@atoker.com>
Reviewed by Eric.
http://bugs.webkit.org/show_bug.cgi?id=16032
JS minidom is not portable
Use a plain UTF-8 string instead of a CFString.
Print to stdout, not stderr like CFShow() would have done, since that
behaviour seems unintentional.
* API/minidom.c:
(main):
2007-11-17 Steve Falkenburg <sfalken@apple.com>
Windows build fix.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-11-16 Mark Rowe <mrowe@apple.com>
Windows build fix.
* kjs/lexer.cpp:
(KJS::Lexer::record8):
2007-11-16 Mark Rowe <mrowe@apple.com>
Reviewed by Eric.
Replace strings, identifier, buffer8 and buffer16 members of Lexer with vectors.
SunSpider claims this is a 0.7% speedup.
* kjs/lexer.cpp:
(KJS::Lexer::Lexer):
(KJS::Lexer::lex):
(KJS::Lexer::record8):
(KJS::Lexer::record16):
(KJS::Lexer::scanRegExp):
(KJS::Lexer::clear):
(KJS::Lexer::makeIdentifier):
(KJS::Lexer::makeUString):
* kjs/lexer.h:
* kjs/ustring.cpp:
(KJS::UString::UString): Add a convenience constructor that takes a const Vector<UChar>&.
* kjs/ustring.h:
2007-11-16 Adam Roben <aroben@apple.com>
Windows build fix
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Add a new include path
and ignore the int -> bool conversion warning.
2007-11-16 Alexey Proskuryakov <ap@webkit.org>
Fix Windows debug build.
Rubber-stamped by Eric
* pcre/pcre_exec.cpp: (match): Removed ASSERT_NOT_REACHED assertions that were making MSVC
complain about unreachable code.
2007-11-15 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/Parser.cpp:
2007-11-15 Mark Rowe <mrowe@apple.com>
Mac build and header search path sanity fix.
Reviewed by Sam Weinig and Tim Hatcher.
Move base setting for HEADER_SEARCH_PATHS into Base.xcconfig, and extend
it in JavaScriptCore.xcconfig. This removes the need to override it on a
per-target basis inside the .xcodeproj file.
* Configurations/Base.xcconfig:
* Configurations/JavaScriptCore.xcconfig:
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-11-15 Mark Rowe <mrowe@apple.com>
Qt build fix.
* kjs/Parser.h:
2007-11-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Eric Seidel.
Another round of grammar / parsing cleanup.
1. Created distinct parser calls for parsing function bodies vs
programs. This will help later with optimizing global variable access.
2. Turned Parser into a singleton. Cleaned up Lexer's singleton
interface.
3. Modified Lexer to free a little more memory when done lexing. (Added
FIXMEs for similar issues that I didn't fix.)
4. Changed Lexer::makeIdentifier and Lexer::makeUString to start
respecting the arguments passed to them. (No behavior change, but this
problem could have caused serious problems for an unsuspecting user of
these functions.)
5. Removed KJS_DEBUG_MEM because it was bit-rotted.
6. Removed Parser::prettyPrint because the same work was simpler to do
at the call site.
7. Some renames:
"Parser::accept" => "Parser::didFinishParsing"
"Parser::sid" => "Parser::m_sourceID"
"Lexer::doneParsing" => "Lexer::clear"
"sid" => "sourceId"
"lineno" => "lineNo"
* JavaScriptCore.exp:
* kjs/Parser.cpp:
(KJS::Parser::Parser):
(KJS::Parser::parseProgram):
(KJS::Parser::parseFunctionBody):
(KJS::Parser::parse):
(KJS::Parser::didFinishParsing):
(KJS::parser):
* kjs/Parser.h:
(KJS::Parser::sourceId):
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction):
* kjs/function_object.cpp:
(FunctionObjectImp::construct):
* kjs/grammar.y:
* kjs/interpreter.cpp:
(KJS::Interpreter::checkSyntax):
(KJS::Interpreter::evaluate):
* kjs/interpreter.h:
* kjs/lexer.cpp:
(kjsyylex):
(KJS::lexer):
(KJS::Lexer::Lexer):
(KJS::Lexer::~Lexer):
(KJS::Lexer::scanRegExp):
(KJS::Lexer::doneParsing):
(KJS::Lexer::makeIdentifier):
(KJS::Lexer::makeUString):
* kjs/lexer.h:
(KJS::Lexer::pattern):
(KJS::Lexer::flags):
(KJS::Lexer::sawError):
* kjs/nodes.cpp:
(KJS::Node::Node):
(KJS::FunctionBodyNode::FunctionBodyNode):
* kjs/nodes.h:
* kjs/testkjs.cpp:
(prettyPrintScript):
(kjsmain):
* kjs/ustring.cpp:
* kjs/ustring.h:
2007-11-15 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
<rdar://problem/5601548> REGRESSION: All SourceElements and their children leak after a syntax error
Add a stub node to maintain the Vector of SourceElements until assignment.
* kjs/grammar.y:
* kjs/nodes.h:
(KJS::SourceElementsStub::SourceElementsStub):
(KJS::SourceElementsStub::append):
(KJS::SourceElementsStub::release):
(KJS::SourceElementsStub::):
(KJS::SourceElementsStub::precedence):
2007-11-15 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Abstract most of RMATCH into MatchStack functions.
SunSpider claims this, combined with the last 2 patches was a 1% speedup, 10% for dna-regexp.
* pcre/pcre_exec.cpp:
(MatchStack::canUseStackBufferForNextFrame):
(MatchStack::allocateNextFrame):
(MatchStack::pushNewFrame):
(MatchStack::frameIsStackAllocated):
(MatchStack::popCurrentFrame):
(MatchStack::unrollAnyHeapAllocatedFrames):
(match):
2007-11-15 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Remove RETURN_ERROR, add MatchStack
* pcre/pcre_exec.cpp:
(MatchStack::MatchStack):
(MatchStack::unrollAnyHeapAllocatedFrames):
(matchError):
(match):
2007-11-15 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Clean up match function to match WebKit style
* JavaScriptCore.xcodeproj/project.pbxproj:
* pcre/pcre_exec.cpp:
(match):
2007-11-15 Steve Falkenburg <sfalken@apple.com>
Windows build fix.
* JavaScriptCore.vcproj/JavaScriptCore.make:
2007-11-14 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=15982
Improve JSString UTF-8 decoding
* API/JSStringRef.cpp:
(JSStringCreateWithUTF8CString): Use strict decoding, return 0 on error.
* wtf/unicode/UTF8.cpp:
(WTF::Unicode::convertUTF16ToUTF8):
(WTF::Unicode::convertUTF8ToUTF16):
* wtf/unicode/UTF8.h:
Made these function names start with a lower case letter.
* kjs/ustring.cpp: (KJS::UString::UTF8String): Updated for the above renaming.
* bindings/c/c_utility.cpp:
(KJS::Bindings::convertUTF8ToUTF16WithLatin1Fallback): Renamed to highlight the difference
from convertUTF8ToUTF16 in wtf/unicode.
(KJS::Bindings::convertNPStringToUTF16): Updated for the above renaming.
(KJS::Bindings::identifierFromNPIdentifier): Ditto.
* bindings/c/c_utility.h: Made convertUTF8ToUTF16WithLatin1Fallback() a file static.
2007-11-14 Sam Weinig <sam@webkit.org>
Rubber-stamped by Anders.
Fix the Xcode project file after it was messed up in r27402.
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-11-14 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
More PCRE style cleanup.
* pcre/pcre_compile.cpp:
(compile_regex):
2007-11-14 Adam Roben <aroben@apple.com>
Clean up the bison conflict checking script
Reviewed by Geoff.
* DerivedSources.make:
2007-11-14 Eric Seidel <eric@webkit.org>
Reviewed by Geoff.
Another round of PCRE cleanups: inlines
SunSpider claims that this, combined with my previous PCRE cleanup were a 0.7% speedup, go figure.
* pcre/pcre_compile.cpp:
(jsRegExpCompile):
* pcre/pcre_exec.cpp:
(match):
(jsRegExpExecute):
* pcre/pcre_internal.h:
(PUT):
(GET):
(PUT2):
(GET2):
(isNewline):
2007-11-14 Eric Seidel <eric@webkit.org>
Reviewed by Sam.
Give PCRE a (small) bath.
Fix some formating and break things off into separate functions
http://bugs.webkit.org/show_bug.cgi?id=15993
* pcre/pcre_compile.cpp:
(calculateCompiledPatternLengthAndFlags):
(printCompiledRegExp):
(returnError):
(jsRegExpCompile):
* pcre/pcre_internal.h:
(compile_data::compile_data):
2007-11-14 Geoffrey Garen <ggaren@apple.com>
Reviewed by Eric Seidel.
Cleaned up the JavaScript grammar a bit.
1. Changed BlockNode to always hold a child vector (which may be empty),
eliminating a few NULL-check branches in the common execution case.
2. Changed the Block production to correctly report its starting and
ending line numbers to the debugger. (It used to report its ending line
as its starting line.) Also, removed duplicate line-reporting code
inside the BlockNode constructor.
3. Moved curly braces up from FunctionBody production into parent
productions. (I had to move the line number reporting code, too, since
it depends on the location of the curly braces.) This matches the ECMA
spec more closely, and makes some future changes I plan easier.
4. Fixed statementList* convenience functions to deal appropriately with
empty Vectors.
SunSpider reports a small and statistically insignificant speedup.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::statementListPushFIFO):
(KJS::statementListGetDeclarations):
(KJS::statementListInitializeDeclarationStack):
(KJS::statementListInitializeVariableAccessStack):
(KJS::BlockNode::BlockNode):
(KJS::BlockNode::optimizeVariableAccess):
(KJS::BlockNode::getDeclarations):
(KJS::BlockNode::execute):
(KJS::FunctionBodyNode::initializeDeclarationStacks):
(KJS::FunctionBodyNode::optimizeVariableAccess):
2007-11-13 Anders Carlsson <andersca@apple.com>
Add RefCounted.h (And remove Shared.h)
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
2007-11-13 Geoffrey Garen <ggaren@apple.com>
Build fix.
* kjs/regexp.h:
2007-11-13 Geoffrey Garen <ggaren@apple.com>
Reviewed by Anders Carlsson.
Renamed Shared to RefCounted.
* API/JSClassRef.h:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/interpreter.h:
* kjs/regexp.h:
* wtf/RefCounted.h: Copied from JavaScriptCore/wtf/Shared.h.
(WTF::RefCounted::RefCounted):
* wtf/Shared.h: Removed.
2007-11-13 Adam Roben <aroben@apple.com>
Build fix
Reviewed by Geoff.
* kjs/regexp.h: Added a missing #include.
2007-11-13 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Moved Shared.h into wtf so it could be used in more places. Deployed
Shared in places where JSCore previously had hand-rolled ref-counting
classes.
* API/JSClassRef.cpp:
(OpaqueJSClass::OpaqueJSClass):
* API/JSClassRef.h:
* API/JSObjectRef.cpp:
(JSClassRetain):
(JSClassRelease):
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/interpreter.cpp:
(KJS::Interpreter::init):
* kjs/interpreter.h:
* kjs/regexp.cpp:
(KJS::RegExp::RegExp):
* kjs/regexp.h:
* wtf/Shared.h: Copied from WebCore/platform/Shared.h.
2007-11-13 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Add an ASSERT to getTruncatedInt32 to enforce proper usage.
Best part about this patch? It doesn't break the web!
* kjs/JSImmediate.h:
(KJS::JSImmediate::getTruncatedInt32):
(KJS::JSImmediate::toDouble):
(KJS::JSImmediate::getUInt32):
2007-11-13 Alexey Proskuryakov <ap@webkit.org>
Windows build fix.
* bindings/c/c_utility.cpp:
(KJS::Bindings::convertUTF8ToUTF16):
* kjs/ustring.cpp:
(KJS::UString::UTF8String):
* wtf/unicode/UTF8.cpp:
(WTF::Unicode::ConvertUTF8ToUTF16):
2007-11-13 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=11231
RegExp bug when handling newline characters
and a number of other differences between PCRE behvior
and JavaScript regular expressions:
+ single-digit sequences like \4 should be treated as octal
character constants, unless there is a sufficient number
of brackets for them to be treated as backreferences
+ \8 turns into the character "8", not a binary zero character
followed by "8" (same for 9)
+ only the first 3 digits should be considered part of an
octal character constant (the old behavior was to decode
an arbitrarily long sequence and then mask with 0xFF)
+ if \x is followed by anything other than two valid hex digits,
then it should simply be treated a the letter "x"; that includes
not supporting the \x{41} syntax
+ if \u is followed by anything less than four valid hex digits,
then it should simply be treated a the letter "u"
+ an extra "+" should be a syntax error, rather than being treated
as the "possessive quantifier"
+ if a "]" character appears immediately after a "[" character that
starts a character class, then that's an empty character class,
rather than being the start of a character class that includes a
"]" character
+ a "$" should not match a terminating newline; we could have gotten
PCRE to handle this the way we wanted by passing an appropriate option
Test: fast/js/regexp-no-extensions.html
* pcre/pcre_compile.cpp:
(check_escape): Check backreferences against bracount to catch both
overflows and things that should be treated as octal. Rewrite octal
loop to not go on indefinitely. Rewrite both hex loops to match and
remove \x{} support.
(compile_branch): Restructure loops so that we don't special-case a "]"
at the beginning of a character class. Remove code that treated "+" as
the possessive quantifier.
(jsRegExpCompile): Change the "]" handling here too.
* pcre/pcre_exec.cpp: (match): Changed CIRC to match the DOLL implementation.
Changed DOLL to remove handling of "terminating newline", a Perl concept
which we don't need.
* tests/mozilla/expected.html: Two tests are fixed now:
ecma_3/RegExp/regress-100199.js and ecma_3/RegExp/regress-188206.js.
One test fails now: ecma_3/RegExp/perlstress-002.js -- our success before
was due to a bug (we treated all 1-character numeric escapes as backreferences).
The date tests also now both expect success -- whatever was making them fail
before was probably due to the time being close to a DST shift; maybe we need
to get rid of those tests.
2007-11-13 Darin Adler <darin@apple.com>
* kjs/JSImmediate.h: (KJS::JSImmediate::getTruncatedInt32):
Remove too-strong assert that was firing constantly and preventing even basic
web browsing from working in a debug build. This function is used in many
cases where the immediate value is not a number; the assertion could perhaps
be added back later with a bit of reorganization.
2007-11-13 Alp Toker <alp@atoker.com>
Build fix for breakage to non-Mac builds introduced in r27746.
* kjs/ustring.cpp:
2007-11-13 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Clean up evaluateToBoolean functions to use inlines instead of copy/paste code
* kjs/JSImmediate.h:
* kjs/nodes.cpp:
(KJS::GreaterNode::inlineEvaluateToBoolean):
(KJS::GreaterNode::evaluate):
(KJS::LessEqNode::inlineEvaluateToBoolean):
(KJS::LessEqNode::evaluate):
(KJS::GreaterEqNode::inlineEvaluateToBoolean):
(KJS::GreaterEqNode::evaluate):
(KJS::InNode::evaluateToBoolean):
(KJS::EqualNode::inlineEvaluateToBoolean):
(KJS::EqualNode::evaluate):
(KJS::NotEqualNode::inlineEvaluateToBoolean):
(KJS::NotEqualNode::evaluate):
(KJS::StrictEqualNode::inlineEvaluateToBoolean):
(KJS::StrictEqualNode::evaluate):
(KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
(KJS::NotStrictEqualNode::evaluate):
* kjs/nodes.h:
2007-11-12 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15958
base64 spends 1.1% of total time checking for special Infinity case
Use a fast character test instead of calling strncmp.
1.1% speedup on string-base64. SunSpider reports a .4% speedup overall;
Sharks reports only .1%. Who are you going to believe? Huh?
* kjs/ustring.cpp:
(KJS::UString::toDouble):
2007-11-12 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
Add evaluateToInt32 and evaluateUInt32 methods and deploy them.
Fix a few missing evaluateToBoolean methods
Deploy all evaluateTo* functions to more nodes to avoid slowdowns
http://bugs.webkit.org/show_bug.cgi?id=15950
SunSpider claims this is at least a 1.4% speedup.
* kjs/JSImmediate.h:
(KJS::JSImmediate::getTruncatedInt32):
(KJS::JSImmediate::toDouble):
(KJS::JSImmediate::getUInt32):
* kjs/nodes.cpp:
(KJS::ExpressionNode::evaluateToNumber):
(KJS::ExpressionNode::evaluateToInt32):
(KJS::ExpressionNode::evaluateToUInt32):
(KJS::NumberNode::evaluateToInt32):
(KJS::NumberNode::evaluateToUInt32):
(KJS::ImmediateNumberNode::evaluateToInt32):
(KJS::ImmediateNumberNode::evaluateToUInt32):
(KJS::ResolveNode::evaluate):
(KJS::ResolveNode::evaluateToNumber):
(KJS::ResolveNode::evaluateToBoolean):
(KJS::ResolveNode::evaluateToInt32):
(KJS::ResolveNode::evaluateToUInt32):
(KJS::LocalVarAccessNode::evaluateToInt32):
(KJS::LocalVarAccessNode::evaluateToUInt32):
(KJS::BracketAccessorNode::evaluateToNumber):
(KJS::BracketAccessorNode::evaluateToBoolean):
(KJS::BracketAccessorNode::evaluateToInt32):
(KJS::BracketAccessorNode::evaluateToUInt32):
(KJS::DotAccessorNode::inlineEvaluate):
(KJS::DotAccessorNode::evaluate):
(KJS::DotAccessorNode::evaluateToNumber):
(KJS::DotAccessorNode::evaluateToBoolean):
(KJS::DotAccessorNode::evaluateToInt32):
(KJS::DotAccessorNode::evaluateToUInt32):
(KJS::NewExprNode::inlineEvaluate):
(KJS::NewExprNode::evaluate):
(KJS::NewExprNode::evaluateToNumber):
(KJS::NewExprNode::evaluateToBoolean):
(KJS::NewExprNode::evaluateToInt32):
(KJS::NewExprNode::evaluateToUInt32):
(KJS::FunctionCallResolveNode::inlineEvaluate):
(KJS::FunctionCallResolveNode::evaluate):
(KJS::FunctionCallResolveNode::evaluateToNumber):
(KJS::FunctionCallResolveNode::evaluateToBoolean):
(KJS::FunctionCallResolveNode::evaluateToInt32):
(KJS::FunctionCallResolveNode::evaluateToUInt32):
(KJS::LocalVarFunctionCallNode::evaluate):
(KJS::LocalVarFunctionCallNode::evaluateToNumber):
(KJS::LocalVarFunctionCallNode::evaluateToBoolean):
(KJS::LocalVarFunctionCallNode::evaluateToInt32):
(KJS::LocalVarFunctionCallNode::evaluateToUInt32):
(KJS::FunctionCallDotNode::evaluate):
(KJS::FunctionCallDotNode::evaluateToNumber):
(KJS::FunctionCallDotNode::evaluateToBoolean):
(KJS::FunctionCallDotNode::evaluateToInt32):
(KJS::FunctionCallDotNode::evaluateToUInt32):
(KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
(KJS::PostDecLocalVarNode::evaluateToNumber):
(KJS::PostDecLocalVarNode::evaluateToBoolean):
(KJS::PostDecLocalVarNode::evaluateToInt32):
(KJS::PostDecLocalVarNode::evaluateToUInt32):
(KJS::typeStringForValue):
(KJS::UnaryPlusNode::evaluate):
(KJS::UnaryPlusNode::evaluateToBoolean):
(KJS::UnaryPlusNode::evaluateToNumber):
(KJS::UnaryPlusNode::evaluateToInt32):
(KJS::BitwiseNotNode::inlineEvaluateToInt32):
(KJS::BitwiseNotNode::evaluate):
(KJS::BitwiseNotNode::evaluateToNumber):
(KJS::BitwiseNotNode::evaluateToBoolean):
(KJS::BitwiseNotNode::evaluateToInt32):
(KJS::MultNode::evaluateToBoolean):
(KJS::MultNode::evaluateToInt32):
(KJS::MultNode::evaluateToUInt32):
(KJS::DivNode::evaluateToInt32):
(KJS::DivNode::evaluateToUInt32):
(KJS::ModNode::evaluateToBoolean):
(KJS::ModNode::evaluateToInt32):
(KJS::ModNode::evaluateToUInt32):
(KJS::AddNode::evaluateToNumber):
(KJS::AddNode::evaluateToInt32):
(KJS::AddNode::evaluateToUInt32):
(KJS::AddNumbersNode::evaluateToInt32):
(KJS::AddNumbersNode::evaluateToUInt32):
(KJS::SubNode::evaluateToInt32):
(KJS::SubNode::evaluateToUInt32):
(KJS::LeftShiftNode::inlineEvaluateToInt32):
(KJS::LeftShiftNode::evaluate):
(KJS::LeftShiftNode::evaluateToNumber):
(KJS::LeftShiftNode::evaluateToInt32):
(KJS::RightShiftNode::inlineEvaluateToInt32):
(KJS::RightShiftNode::evaluate):
(KJS::RightShiftNode::evaluateToNumber):
(KJS::RightShiftNode::evaluateToInt32):
(KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
(KJS::UnsignedRightShiftNode::evaluate):
(KJS::UnsignedRightShiftNode::evaluateToNumber):
(KJS::UnsignedRightShiftNode::evaluateToInt32):
(KJS::LessNode::inlineEvaluateToBoolean):
(KJS::LessNode::evaluate):
(KJS::LessNode::evaluateToBoolean):
(KJS::LessNumbersNode::inlineEvaluateToBoolean):
(KJS::LessNumbersNode::evaluate):
(KJS::LessNumbersNode::evaluateToBoolean):
(KJS::LessStringsNode::inlineEvaluateToBoolean):
(KJS::LessStringsNode::evaluate):
(KJS::BitAndNode::evaluate):
(KJS::BitAndNode::inlineEvaluateToInt32):
(KJS::BitAndNode::evaluateToNumber):
(KJS::BitAndNode::evaluateToBoolean):
(KJS::BitAndNode::evaluateToInt32):
(KJS::BitXOrNode::inlineEvaluateToInt32):
(KJS::BitXOrNode::evaluate):
(KJS::BitXOrNode::evaluateToNumber):
(KJS::BitXOrNode::evaluateToBoolean):
(KJS::BitXOrNode::evaluateToInt32):
(KJS::BitOrNode::inlineEvaluateToInt32):
(KJS::BitOrNode::evaluate):
(KJS::BitOrNode::evaluateToNumber):
(KJS::BitOrNode::evaluateToBoolean):
(KJS::BitOrNode::evaluateToInt32):
(KJS::ConditionalNode::evaluateToNumber):
(KJS::ConditionalNode::evaluateToInt32):
(KJS::ConditionalNode::evaluateToUInt32):
(KJS::valueForReadModifyAssignment):
(KJS::AssignExprNode::evaluate):
(KJS::AssignExprNode::evaluateToBoolean):
(KJS::AssignExprNode::evaluateToNumber):
(KJS::AssignExprNode::evaluateToInt32):
(KJS::VarDeclNode::handleSlowCase):
* kjs/nodes.h:
(KJS::FunctionCallResolveNode::precedence):
(KJS::AddNode::precedence):
(KJS::AddNode::):
(KJS::LessNumbersNode::):
(KJS::LessStringsNode::):
* kjs/value.cpp:
(KJS::JSValue::toInt32SlowCase):
(KJS::JSValue::toUInt32SlowCase):
* kjs/value.h:
(KJS::JSValue::asCell):
(KJS::JSValue::toInt32):
(KJS::JSValue::toUInt32):
2007-11-12 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=15953
Add UTF-8 encoding/decoding to WTF
* kjs/ustring.h: Moved UTF8SequenceLength() and decodeUTF8Sequence() to wtf/unicode.
* kjs/ustring.cpp: (KJS::UString::UTF8String): Changed this function to take a strict/lenient
parameter. Callers are not interested in getting decoding results in strict mode, so
this allows for bailing out as soon as an error is seen.
* kjs/function.cpp:
(KJS::encode): Updated for new UString::UTF8String() signature.
* API/JSStringRef.cpp:
(JSStringCreateWithCharacters): Disambiguate UChar.
(JSStringCreateWithUTF8CString): Actually use UTF-8 when creating the string!
* bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16): Use ConvertUTF8ToUTF16().
* wtf/unicode/UTF8.cpp: Added.
(WTF::Unicode::inlineUTF8SequenceLengthNonASCII):
(WTF::Unicode::inlineUTF8SequenceLength):
(WTF::Unicode::UTF8SequenceLength):
(WTF::Unicode::decodeUTF8Sequence):
(WTF::Unicode::):
(WTF::Unicode::ConvertUTF16ToUTF8):
(WTF::Unicode::isLegalUTF8):
(WTF::Unicode::ConvertUTF8ToUTF16):
* wtf/unicode/UTF8.h: Added.
(WTF::Unicode::):
Some code moved from ustring.h, some adapted from unicode.org sources.
* JavaScriptCore.exp:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
Added UTF8.{h,cpp}
2007-11-12 Josh Aas <joshmoz@gmail.com>
Reviewed by Darin.
- http://bugs.webkit.org/show_bug.cgi?id=15946
add NPPValue NPPVpluginDrawingModel (Mozilla bug 403418 compat)
* bindings/npapi.h:
2007-11-12 Darin Adler <darin@apple.com>
Reviewed by Sam.
- http://bugs.webkit.org/show_bug.cgi?id=15951
REGRESSION: assertion failure in regexp match() when running JS tests
Test: fast/js/regexp-many-brackets.html
* pcre/pcre_exec.cpp: (match): Added back accidentally-removed case for
the BRANUMBER opcode.
2007-11-12 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix use of prefix and config.h, got rid of a few unneeded things in
the PCRE code; no behavior changes
* API/JSBase.cpp: Added include of config.h.
* API/JSCallbackConstructor.cpp: Ditto.
* API/JSCallbackFunction.cpp: Ditto.
* API/JSCallbackObject.cpp: Ditto.
* API/JSClassRef.cpp: Ditto.
* API/JSContextRef.cpp: Ditto.
* API/JSObjectRef.cpp: Ditto.
* API/JSStringRef.cpp: Ditto.
* API/JSValueRef.cpp: Ditto.
* JavaScriptCorePrefix.h: Removed obsolete <ctype.h> workaround.
Moved new/delete macros after includes, as they are in WebCore's prefix.
Removed "config.h".
* pcre/dftables.cpp: (main): Changed back to not use a separate maketables
function. This is needed for PCRE, but not helpful for our use. Also changed
the tables to all be 128 entries long instead of 256, since only the first
128 are ever used.
* pcre/pcre_compile.cpp: Added include of config.h. Eliminated digitab,
which was only being used to check hex digits. Changed all uses of TRUE and
FALSE to use the C++ true and false instead.
(check_escape): Just the TRUE/FALSE thing.
(is_counted_repeat): Ditto.
(could_be_empty_branch): Ditto.
(get_othercase_range): Ditto.
(compile_branch): Ditto.
(compile_regex): Ditto.
(is_anchored): Ditto.
(is_startline): Ditto.
(find_firstassertedchar): Ditto.
(jsRegExpCompile): Ditto.
* pcre/pcre_exec.cpp: Added include of config.h. Changed all uses of TRUE and
FALSE to use the C++ true and false instead.
(match_ref): Just the TRUE/FALSE thing.
(match): Ditto. Removed some unneeded braces.
(jsRegExpExecute): Just the TRUE/FALSE thing.
* pcre/pcre_internal.h: Moved the constants needed by dftables.cpp to the top
of the file instead of the bottom, so they can be used. Also changed the table
sizes to 128 instead of 256. Removed macro definitions of FALSE and TRUE.
Set array sizes for all the const arrays. Changed _pcre_utf8_table1_size to
be a macro instead of a extern int.
* pcre/pcre_maketables.cpp: Removed. It's all in dftables.cpp now.
* pcre/pcre_tables.cpp: Made table sizes explicit.
* pcre/pcre_xclass.cpp: Just the TRUE/FALSE thing.
2007-11-12 Adam Roben <aroben@apple.com>
Build fix
* wtf/FastMalloc.h: Add missing using statement.
2007-11-11 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Add special fastZeroedMalloc function to replace a
number of fastCalloc calls where one argument was 1.
This results in a 0.4% progression in SunSpider, more
than making up for the earlier regression caused by
additional overflow checks.
* JavaScriptCore.exp:
* kjs/array_instance.cpp:
* kjs/property_map.cpp:
* wtf/FastMalloc.cpp:
* wtf/FastMalloc.h:
* wtf/HashTable.h:
2007-11-11 Adam Roben <aroben@apple.com>
Fix <rdar://5578982> ASSERT in HashTable::checkTableConsistencyExceptSize beneath WebNotificationCenter
The bug was due to a mismatch between HashMap::remove and
HashTable::checkTableConsistency. HashMap::remove can delete the value
stored in the HashTable (by derefing it), which is not normally
allowed by HashTable. It's OK in this case because the value is about
to be removed from the table, but HashTable wasn't aware of this.
HashMap::remove now performs the consistency check itself before
derefing the value.
Darin noticed that the same bug would occur in HashSet, so I've fixed
it there as well.
Reviewed by Darin.
* wtf/HashMap.h:
(WTF::HashMap::remove): Perform the HashTable consistency check
manually before calling deref.
* wtf/HashSet.h:
(WTF::HashSet::remove): Ditto.
* wtf/HashTable.h: Made checkTableConsistency public so that HashMap
and HashSet can call it.
(WTF::HashTable::removeAndInvalidateWithoutEntryConsistencyCheck):
Added.
(WTF::HashTable::removeAndInvalidate): Added.
(WTF::HashTable::remove):
(WTF::HashTable::removeWithoutEntryConsistencyCheck): Added.
2007-11-11 Mark Rowe <mrowe@apple.com>
Build fix. Use the correct filename case.
* kjs/nodes.h:
2007-11-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15902
15% of string-validate-input.js is spent compiling the same regular expression
Store a compiled representation of the regular expression in the AST.
Only a .2% SunSpider speedup overall, but a 10.6% speedup on
string-validate-input.js.
* kjs/nodes.cpp:
(KJS::RegExpNode::evaluate):
* kjs/nodes.h:
(KJS::RegExpNode::):
* kjs/nodes2string.cpp:
(KJS::RegExpNode::streamTo):
* kjs/regexp.cpp:
(KJS::RegExp::flags):
* kjs/regexp.h:
(KJS::RegExp::pattern):
* kjs/regexp_object.cpp:
(KJS::RegExpObjectImp::construct):
(KJS::RegExpObjectImp::createRegExpImp):
* kjs/regexp_object.h:
2007-11-11 Oliver Hunt <oliver@apple.com>
Reviewed by Eric.
Partial fix for <rdar://problem/5585334> numfuzz: integer overflows opening malformed SVG file in WebCore::ImageBuffer::create
Unfortunately this is a very slight regression, but is unavoidable.
* wtf/FastMalloc.cpp:
2007-11-10 Eric Seidel <eric@webkit.org>
Reviewed by darin.
Add simple type inferencing to the parser, and create custom
AddNode and LessNode subclasses based on inferred types.
http://bugs.webkit.org/show_bug.cgi?id=15884
SunSpider claims this is at least a 0.5% speedup.
* JavaScriptCore.exp:
* kjs/grammar.y:
* kjs/internal.cpp:
(KJS::NumberImp::getPrimitiveNumber):
(KJS::GetterSetterImp::getPrimitiveNumber):
* kjs/internal.h:
* kjs/lexer.cpp:
(KJS::Lexer::lex):
* kjs/nodes.cpp:
(KJS::Node::Node):
(KJS::StringNode::evaluate):
(KJS::StringNode::evaluateToNumber):
(KJS::StringNode::evaluateToBoolean):
(KJS::RegExpNode::evaluate):
(KJS::UnaryPlusNode::optimizeVariableAccess):
(KJS::AddNode::evaluate):
(KJS::AddNode::evaluateToNumber):
(KJS::AddNumbersNode::inlineEvaluateToNumber):
(KJS::AddNumbersNode::evaluate):
(KJS::AddNumbersNode::evaluateToNumber):
(KJS::AddStringsNode::evaluate):
(KJS::AddStringLeftNode::evaluate):
(KJS::AddStringRightNode::evaluate):
(KJS::lessThan):
(KJS::lessThanEq):
(KJS::LessNumbersNode::evaluate):
(KJS::LessStringsNode::evaluate):
* kjs/nodes.h:
(KJS::ExpressionNode::):
(KJS::RegExpNode::):
(KJS::RegExpNode::precedence):
(KJS::TypeOfResolveNode::):
(KJS::LocalVarTypeOfNode::):
(KJS::UnaryPlusNode::):
(KJS::UnaryPlusNode::precedence):
(KJS::AddNode::):
(KJS::AddNode::precedence):
(KJS::AddNumbersNode::):
(KJS::AddStringLeftNode::):
(KJS::AddStringRightNode::):
(KJS::AddStringsNode::):
(KJS::LessNode::):
(KJS::LessNode::precedence):
(KJS::LessNumbersNode::):
(KJS::LessStringsNode::):
* kjs/nodes2string.cpp:
(KJS::StringNode::streamTo):
* kjs/object.cpp:
* kjs/object.h:
* kjs/value.h:
(KJS::JSValue::getPrimitiveNumber):
2007-11-11 Darin Adler <darin@apple.com>
- try another way of fixing dftables builds -- refactor pcre_internal.h a bit
* pcre/pcre_internal.h: Make most of this header do nothing when DFTABLES is set.
Later we can break it into two files.
* JavaScriptCore.vcproj/dftables/dftables.vcproj: Take out now-unneeded include paths.
* pcre/dftables.cpp: Set DFTABLES. Use delete instead of free.
* pcre/dftables.pro: Take out now-unneeded include paths.
* pcre/pcre_maketables.cpp: Use new instead of malloc.
2007-11-11 Darin Adler <darin@apple.com>
* pcre/dftables.pro: Try fixing Qt builds (I looked at qt-win) by adding
another include path.
2007-11-11 Darin Adler <darin@apple.com>
* JavaScriptCore.xcodeproj/project.pbxproj: Try fixing Mac Tiger builds
by adding another include path.
2007-11-11 Darin Adler <darin@apple.com>
Reviewed by Sam.
- http://bugs.webkit.org/show_bug.cgi?id=15924
next round of changes to JSRegExp (formerly PCRE)
This is a combination of converting to C++, tweaking the API, and adding
some additional optimizations.
Future steps will involve getting rid of the use of UTF-8 completely
(we'll use UTF-16 exclusively instead), eliminating more source files,
and some more speed-ups.
SunSpider says the current round is an 0.9% speed-up overall, and a
5.3% speed-up for regexp.
* JavaScriptCore.exp: Updated for new entry points.
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/dftables/dftables.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* jscore.bkl:
Updated for new source file names and ForwardingHeaders.
* kjs/regexp.cpp:
(KJS::RegExp::RegExp): Changed to use the error message without calling
strdup on it and to pass the new types and options.
(KJS::RegExp::~RegExp): Removed the now-unneeded free of the error message.
(KJS::RegExp::match): Pass the new types and options.
* kjs/regexp.h: Update type of m_constructionError.
* pcre/AUTHORS: Update to reflect the status of the project -- we don't include
the Google parts, and this isn't the PCRE library, per se.
* pcre/COPYING: Ditto.
* pcre/dftables.cpp: Copied from JavaScriptCore/pcre/dftables.c.
(main): Removed unneeded ctype_digit.
* pcre/pcre.h: Convert to C++, tweak API a bit. Use UChar instead of JSRegExpChar.
* pcre/pcre_compile.cpp: Copied from JavaScriptCore/pcre/pcre_compile.c.
Moved a lot of private stuff used only within this file here from pcre_internal.h.
Renumbered the error codes.
(error_text): Use a single string with embedded nulls for the error text (I got
this idea from newer versions of PCRE).
(check_escape): Changed return type to be enum instead of int. Replaced ctype_digit
uses with isASCIIDigit.
(is_counted_repeat): Ditto.
(read_repeat_counts): Ditto.
(first_significant_code): Ditto.
(find_fixedlength): Ditto.
(could_be_empty_branch): Ditto.
(compile_branch): Ditto. Also removed some code that handles changing options.
JavaScript doesn't have any of the features that allow options to change.
(compile_regex): Updated for change to options parameter.
(is_anchored): Ditto.
(find_firstassertedchar): Ditto.
(jsRegExpCompile): Changed to take separate flags instead of an options int.
Also changed to call new/delete instead of pcre_malloc/free.
(jsRegExpFree): Ditto.
* pcre/pcre_exec.cpp: Copied from JavaScriptCore/pcre/pcre_exec.c.
Added a case that uses computed goto for the opcode loop, but did not turn it on.
Changed the RMATCH macro to handle returns more efficiently by putting the where
pointer in the new frame instead of the old one, allowing us to branch to the
return with a single statement. Switched to new/delete from pcre_malloc/free.
Changed many RRETURN callers to not set the return value since it's already
set correctly. Replaced the rrc variable with an is_match variable. Values other
than "match" and "no match" are now handled differently. This allows us to remove
the code to check for those cases in various rules.
(match): All the case statements use a macro BEGIN_OPCODE instead. And all the
continue statements, or break statements that break out of the outer case use
a macro NEXT_OPCODE instead. Replaced a few if statements with assertions.
(jsRegExpExecute): Use new/delete instead of pcre_malloc/free. Removed unused
start_match field from the match block.
* pcre/pcre_internal.h: Moved the last few configuration macros from pcre-config.h
in here. Removed various unused types. Converted from JSRegExpChar to UChar.
Eliminated pcre_malloc/free. Replaced the opcode enum with a macro that can be
used in multiple places. Unfortunately we lose the comments for each opcode; we
should find a place to put those back. Removed ctype_digit.
* pcre/pcre_maketables.cpp: Copied from JavaScriptCore/pcre/pcre_maketables.c.
(pcre_maketables): Got rid of the conditional code that allows this to be compiled
in -- it's only used for dftables now (and soon may be obsolete entirely).
Changed code for cbit_digit to not use isdigit, and took the "_" case out of the
loop. Removed ctype_digit.
* pcre/pcre_ord2utf8.cpp: Copied from JavaScriptCore/pcre/pcre_ord2utf8.c.
* pcre/pcre_tables.cpp: Copied from JavaScriptCore/pcre/pcre_tables.c.
Moved _pcre_OP_lengths out of here into pcre_exec.cpp.
* pcre/pcre_ucp_searchfuncs.cpp: Copied from JavaScriptCore/pcre/pcre_ucp_searchfuncs.c.
Updated for other file name changes.
* pcre/pcre_xclass.cpp: Copied from JavaScriptCore/pcre/pcre_xclass.c.
* pcre/ucpinternal.h: Updated header.
* pcre/ucptable.cpp: Copied from JavaScriptCore/pcre/ucptable.c.
* wtf/ASCIICType.h: (WTF::isASCIIDigit): Removed a branch by changing from && to
& for this operation. Also added an overload that takes an int because that's
useful for PCRE. Later we could optimize for int and overload other functions in
this file; stuck to this simple one for now.
* wtf/unicode/icu/UnicodeIcu.h: Removed unused isUpper.
* wtf/unicode/qt4/UnicodeQt4.h: Ditto.
* pcre/LICENCE: Removed.
* pcre/pcre-config.h: Removed.
* wtf/FastMallocPCRE.cpp: Removed.
* pcre/dftables.c: Renamed to cpp.
* pcre/pcre_compile.c: Ditto.
* pcre/pcre_exec.c: Ditto.
* pcre/pcre_maketables.c: Ditto.
* pcre/pcre_ord2utf8.c: Ditto.
* pcre/pcre_tables.c: Ditto.
* pcre/pcre_ucp_searchfuncs.c: Ditto.
* pcre/pcre_xclass.c: Ditto.
* pcre/ucptable.c: Ditto.
2007-11-11 Eric Seidel <eric@webkit.org>
Reviewed by Oliver.
Add KJS_CHECKEXCEPTIONBOOLEAN to match rest of nodes.cpp
* kjs/nodes.cpp:
(KJS::ExpressionNode::evaluateToBoolean):
(KJS::LessNode::evaluateToBoolean):
(KJS::GreaterNode::evaluateToBoolean):
(KJS::LessEqNode::evaluateToBoolean):
(KJS::GreaterEqNode::evaluateToBoolean):
(KJS::InstanceOfNode::evaluateToBoolean):
(KJS::InNode::evaluateToBoolean):
(KJS::EqualNode::evaluateToBoolean):
(KJS::NotEqualNode::evaluateToBoolean):
(KJS::StrictEqualNode::evaluateToBoolean):
(KJS::NotStrictEqualNode::evaluateToBoolean):
(KJS::LogicalAndNode::evaluateToBoolean):
(KJS::LogicalOrNode::evaluateToBoolean):
(KJS::ConditionalNode::evaluateToBoolean):
2007-11-10 Darin Adler <darin@apple.com>
Reviewed by Sam.
- fix http://bugs.webkit.org/show_bug.cgi?id=15927
REGRESSION(r27487): delete a.c followed by __defineGetter__("c", ...) incorrectly deletes another property
and <rdar://problem/5586384> REGRESSION (r27487): Can't switch out of Edit HTML Source mode on Leopard Wiki
Test: fast/js/delete-then-put.html
* kjs/property_map.cpp:
(KJS::PropertyMap::put): Added a missing "- 1"; code to find an empty slot was not working.
(KJS::PropertyMap::checkConsistency): Added a missing range check that would have caught this
problem before.
- roll out a last-minute change to my evaluateToBoolean patch that was incorrect.
* kjs/nodes.h: (KJS::ExprStatementNode::ExprStatementNode): Take out call to
optimizeForUnnecessaryResult, since the result is used in some cases.
2007-11-10 Adam Roben <aroben@apple.com>
Windows build fix
Roll out some changes that were (seemingly accidentally) checked in
with r27664.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-11-10 Darin Adler <darin@apple.com>
Reviewed by Sam.
- http://bugs.webkit.org/show_bug.cgi?id=15915
add an evaluation path for booleans like the one we have for numbers
Gives 1.1% on SunSpider.
* kjs/grammar.y: Create TrueNode and FalseNode instead of BooleanNode.
* kjs/nodes.h: Changed to use Noncopyable. Moved optimizeForUnnecessaryResult
down from Node to ExpressionNode. Changed some classes to not inherit from
ExpressionNode where not necessary, and removed unnneeded evaluate functions
as well as evaluate functions that need not be virtual. Call the
optimizeForUnnecessaryResult function on the start of a for loop too.
* kjs/nodes.cpp:
(KJS::ExpressionNode::evaluateToBoolean): Added.
(KJS::FalseNode::evaluate): Added.
(KJS::TrueNode::evaluate): Added.
(KJS::NumberNode::evaluateToBoolean): Added.
(KJS::StringNode::evaluateToBoolean): Added.
(KJS::LocalVarAccessNode::evaluateToBoolean): Added.
(KJS::BracketAccessorNode::evaluateToBoolean): Added.
(KJS::LogicalNotNode::evaluate): Changed to call evaluateToBoolean.
(KJS::LogicalNotNode::evaluateToBoolean): Added.
(KJS::lessThan): Changed to return bool.
(KJS::lessThanEq): Ditto.
(KJS::LessNode::evaluate): Changed since lessThan returns bool.
(KJS::LessNode::evaluateToBoolean): Added.
(KJS::GreaterNode::evaluate): Changed since lessThanEq returns bool.
(KJS::GreaterNode::evaluateToBoolean): Added.
(KJS::LessEqNode::evaluate): Changed since lessThanEq returns bool.
(KJS::LessEqNode::evaluateToBoolean): Added.
(KJS::GreaterEqNode::evaluate): Changed since lessThan returns bool.
(KJS::GreaterEqNode::evaluateToBoolean): Added.
(KJS::InstanceOfNode::evaluateToBoolean): Added.
(KJS::InNode::evaluateToBoolean): Added.
(KJS::EqualNode::evaluateToBoolean): Added.
(KJS::NotEqualNode::evaluateToBoolean): Added.
(KJS::StrictEqualNode::evaluateToBoolean): Added.
(KJS::NotStrictEqualNode::evaluateToBoolean): Added.
(KJS::ConditionalNode::evaluate): Changed to call evaluateToBoolean.
(KJS::IfNode::execute): Ditto.
(KJS::DoWhileNode::execute): Ditto.
(KJS::WhileNode::execute): Ditto.
(KJS::ForNode::execute): Ditto.
* kjs/nodes2string.cpp:
(KJS::FalseNode::streamTo): Added.
(KJS::TrueNode::streamTo): Added.
2007-11-09 Adam Roben <aroben@apple.com>
Windows build fix
Reviewed by Darin.
* kjs/value.h:
(KJS::jsNumber): Add some explicit casts.
2007-11-08 Darin Adler <darin@apple.com>
- fix build
* kjs/grammar.y:
* kjs/nodes.h:
* kjs/property_map.cpp:
2007-11-08 Darin Adler <darin@apple.com>
- roll out accidentally-checked in changes
* kjs/nodes.cpp: Back to previous version.
* kjs/nodes.h: Ditto.
* kjs/grammar.y: Ditto.
2007-11-08 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15912
fasta spends a lot of time in qsort
* kjs/property_map.cpp:
(KJS::PropertyMap::getEnumerablePropertyNames):
Use insertion sort instead of qsort for small sets of property names.
We can probably do some even-better speedups of for/in, but this nets
0.6% overall and 6.7% on fasta.
2007-11-08 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15906
getting characters by indexing into a string is very slow
This fixes one source of the slowness -- the conversion to an unused
Identifier as we call the get function from the slot -- but doesn't
fix others, such as the fact that we have to allocate a new UString::Rep
for every single character.
Speeds up string-base64 30%, and at least 0.5% overall.
But does slow down access-fannkuch quite a bit. Might be worth
revisiting in the future to see what we can do about that (although
I did look at a profile for a while).
* kjs/property_slot.h: Add a new marker for "numeric" property slots;
slots where we don't need to pass the identifier to the get function.
(KJS::PropertySlot::getValue): Added code to call the numeric get function.
(KJS::PropertySlot::setCustomNumeric): Added.
* kjs/string_object.cpp:
(KJS::StringInstance::indexGetter): Changed to use substr() instead
of constructing a wholly new UString each time.
(KJS::stringInstanceNumericPropertyGetter): Added. Like indexGetter, but
takes advantage of setCustomNumeric to avoid creating an Identifier.
(KJS::StringInstance::getOwnPropertySlot): Changed to use setCustomNumeric.
2007-11-08 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- http://bugs.webkit.org/show_bug.cgi?id=15904
more speed-ups possible by tightening up int version of JSImmediate
1% improvement of SunSpider
* kjs/JSImmediate.h: Eliminate the now-unneeded FPBitValues struct template.
(KJS::JSImmediate::from): Overload for most numeric types; many types can
do fewer branches and checks.
(KJS::JSImmediate::getUInt32): Removed unneeded check for undefined.
(KJS::JSImmediate::getTruncatedInt32): Ditto.
(KJS::JSImmediate::getTruncatedUInt32): Ditto. There's no difference any more
between getUInt32 and getTruncatedUInt32, so that's worth a rename and merge later.
* kjs/grammar.y: Update since fromDouble is now just from.
* kjs/nodes.h: Ditto.
* kjs/value.h: (KJS::jsNumber): Overload for most numeric types.
2007-11-08 Kevin Ollivier <kevino@theolliviers.com>
Bakefiles for building JavaScriptCore, needed by wx port.
Reviewed by Mark Rowe.
* JavaScriptCoreSources.bkl: Added.
* jscore.bkl: Added.
2007-11-08 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1.
The implementation of JSImmediate::areBothImmediateNumbers relies on
(JSImmediate::getTag(immediate1) & JSImmediate::getTag(immediate2)) having
a unique result when both immediate values are numbers.
The regression was due to UndefinedType & NumberType returning NumberType (3 & 1).
By swapping the value of NumberType and UndefinedType this ceases to be a problem.
* kjs/JSType.h:
(KJS::):
2007-11-08 Darin Adler <darin@apple.com>
- fix build
* kjs/nodes.h: Add missing parameter name.
2007-11-08 Eric Seidel <eric@webkit.org>
Reviewed by darin.
Add ExpressionNode subclass of Node, use it.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::ForInNode::ForInNode):
* kjs/nodes.h:
(KJS::ExpressionNode::):
(KJS::NullNode::):
(KJS::NullNode::precedence):
(KJS::BooleanNode::):
(KJS::BooleanNode::precedence):
(KJS::RegExpNode::):
(KJS::RegExpNode::precedence):
(KJS::ThisNode::):
(KJS::ThisNode::precedence):
(KJS::ResolveNode::):
(KJS::ElementNode::):
(KJS::ArrayNode::):
(KJS::PropertyNode::):
(KJS::PropertyNode::precedence):
(KJS::PropertyNode::name):
(KJS::PropertyListNode::):
(KJS::ObjectLiteralNode::):
(KJS::ObjectLiteralNode::precedence):
(KJS::BracketAccessorNode::):
(KJS::DotAccessorNode::):
(KJS::DotAccessorNode::precedence):
(KJS::ArgumentListNode::):
(KJS::ArgumentsNode::):
(KJS::NewExprNode::):
(KJS::NewExprNode::precedence):
(KJS::FunctionCallValueNode::):
(KJS::FunctionCallValueNode::precedence):
(KJS::FunctionCallResolveNode::):
(KJS::FunctionCallBracketNode::):
(KJS::FunctionCallBracketNode::precedence):
(KJS::FunctionCallDotNode::):
(KJS::FunctionCallDotNode::precedence):
(KJS::PrePostResolveNode::):
(KJS::PostfixBracketNode::):
(KJS::PostfixBracketNode::precedence):
(KJS::PostIncBracketNode::):
(KJS::PostIncBracketNode::isIncrement):
(KJS::PostDecBracketNode::):
(KJS::PostDecBracketNode::isIncrement):
(KJS::PostfixDotNode::):
(KJS::PostfixDotNode::precedence):
(KJS::PostIncDotNode::):
(KJS::PostIncDotNode::isIncrement):
(KJS::PostDecDotNode::):
(KJS::PostDecDotNode::isIncrement):
(KJS::PostfixErrorNode::):
(KJS::PostfixErrorNode::precedence):
(KJS::DeleteResolveNode::):
(KJS::DeleteBracketNode::):
(KJS::DeleteBracketNode::precedence):
(KJS::DeleteDotNode::):
(KJS::DeleteDotNode::precedence):
(KJS::DeleteValueNode::):
(KJS::DeleteValueNode::precedence):
(KJS::VoidNode::):
(KJS::VoidNode::precedence):
(KJS::TypeOfResolveNode::):
(KJS::TypeOfValueNode::):
(KJS::PrefixBracketNode::):
(KJS::PrefixBracketNode::precedence):
(KJS::PreIncBracketNode::):
(KJS::PreIncBracketNode::isIncrement):
(KJS::PreDecBracketNode::):
(KJS::PreDecBracketNode::isIncrement):
(KJS::PrefixDotNode::):
(KJS::PrefixDotNode::precedence):
(KJS::PreIncDotNode::):
(KJS::PreIncDotNode::isIncrement):
(KJS::PreDecDotNode::):
(KJS::PreDecDotNode::isIncrement):
(KJS::PrefixErrorNode::):
(KJS::PrefixErrorNode::precedence):
(KJS::UnaryPlusNode::):
(KJS::UnaryPlusNode::precedence):
(KJS::NegateNode::):
(KJS::NegateNode::precedence):
(KJS::BitwiseNotNode::):
(KJS::BitwiseNotNode::precedence):
(KJS::LogicalNotNode::):
(KJS::LogicalNotNode::precedence):
(KJS::AddNode::):
(KJS::AddNode::precedence):
(KJS::LeftShiftNode::):
(KJS::LeftShiftNode::precedence):
(KJS::RightShiftNode::):
(KJS::RightShiftNode::precedence):
(KJS::UnsignedRightShiftNode::):
(KJS::UnsignedRightShiftNode::precedence):
(KJS::LessNode::):
(KJS::LessNode::precedence):
(KJS::GreaterNode::):
(KJS::GreaterNode::precedence):
(KJS::LessEqNode::):
(KJS::LessEqNode::precedence):
(KJS::GreaterEqNode::):
(KJS::GreaterEqNode::precedence):
(KJS::InstanceOfNode::):
(KJS::InstanceOfNode::precedence):
(KJS::InNode::):
(KJS::InNode::precedence):
(KJS::EqualNode::):
(KJS::EqualNode::precedence):
(KJS::NotEqualNode::):
(KJS::NotEqualNode::precedence):
(KJS::StrictEqualNode::):
(KJS::StrictEqualNode::precedence):
(KJS::NotStrictEqualNode::):
(KJS::NotStrictEqualNode::precedence):
(KJS::BitAndNode::):
(KJS::BitAndNode::precedence):
(KJS::BitOrNode::):
(KJS::BitOrNode::precedence):
(KJS::BitXOrNode::):
(KJS::BitXOrNode::precedence):
(KJS::LogicalAndNode::):
(KJS::LogicalAndNode::precedence):
(KJS::LogicalOrNode::):
(KJS::LogicalOrNode::precedence):
(KJS::ConditionalNode::):
(KJS::ConditionalNode::precedence):
(KJS::ReadModifyResolveNode::):
(KJS::ReadModifyResolveNode::precedence):
(KJS::AssignResolveNode::):
(KJS::AssignResolveNode::precedence):
(KJS::ReadModifyBracketNode::):
(KJS::ReadModifyBracketNode::precedence):
(KJS::AssignBracketNode::):
(KJS::AssignBracketNode::precedence):
(KJS::AssignDotNode::):
(KJS::AssignDotNode::precedence):
(KJS::ReadModifyDotNode::):
(KJS::ReadModifyDotNode::precedence):
(KJS::AssignErrorNode::):
(KJS::AssignErrorNode::precedence):
(KJS::CommaNode::):
(KJS::CommaNode::precedence):
(KJS::AssignExprNode::):
(KJS::AssignExprNode::precedence):
(KJS::ExprStatementNode::):
(KJS::IfNode::):
(KJS::DoWhileNode::):
(KJS::WhileNode::):
(KJS::ReturnNode::):
(KJS::WithNode::):
(KJS::ThrowNode::):
(KJS::ParameterNode::):
(KJS::CaseClauseNode::):
(KJS::CaseClauseNode::precedence):
(KJS::ClauseListNode::):
(KJS::SwitchNode::):
2007-11-08 Oliver Hunt <oliver@apple.com>
Reviewed by Sam.
Add a fast path for bitwise-and of two immediate numbers for a 0.7% improvement in SunSpider (4% bitop improvement).
This only improves bitwise-and performance, as the additional logic required
for similar code paths on or, xor, and shifting requires additional operations
and branches that negate (and in certain cases, regress) any advantage we might
otherwise receive.
This improves performance on all bitop tests, the cryptography tests, as well as
the string-base64 and string-unpack-code tests. No significant degradation on
any other tests.
* kjs/JSImmediate.h:
(KJS::JSImmediate::areBothImmediateNumbers):
(KJS::JSImmediate::andImmediateNumbers):
* kjs/nodes.cpp:
(KJS::BitAndNode::evaluate):
* kjs/value.h:
(KJS::jsNumberFromAnd):
2007-11-08 Adam Roben <aroben@apple.com>
Stop using KJS inside of MathExtras.h
Reviewed by Darin.
* wtf/MathExtras.h: Removed an unused header, and a now-unused
forward-declaration.
(wtf_atan2): Use std::numeric_limits intead of KJS.
2007-11-08 Sam Weinig <sam@webkit.org>
Windows build fix.
* kjs/date_object.cpp:
(KJS::DateProtoFuncToLocaleString::callAsFunction): Fix unused arg warning.
(KJS::DateProtoFuncToLocaleDateString::callAsFunction): ditto
(KJS::DateProtoFuncToLocaleTimeString::callAsFunction): ditto
2007-11-08 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/lookup.h: Add missing include.
2007-11-08 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
Convert JavaScript internal function objects to use one class per
function. This avoids a switch statement inside what used to be
the shared function classes and will allow Shark to better analyze
the code.
To make this switch, the value property of the HashEntry was changed
to a union of an intptr_t (which is used to continue handle valueGetters)
and function pointer which points to a static constructor for the
individual new function objects.
SunSpider claims this is a 1.0% speedup.
* kjs/array_object.cpp:
(KJS::ArrayPrototype::getOwnPropertySlot):
(KJS::getProperty):
(KJS::ArrayProtoFuncToString::callAsFunction):
(KJS::ArrayProtoFuncToLocaleString::callAsFunction):
(KJS::ArrayProtoFuncJoin::callAsFunction):
(KJS::ArrayProtoFuncConcat::callAsFunction):
(KJS::ArrayProtoFuncPop::callAsFunction):
(KJS::ArrayProtoFuncPush::callAsFunction):
(KJS::ArrayProtoFuncReverse::callAsFunction):
(KJS::ArrayProtoFuncShift::callAsFunction):
(KJS::ArrayProtoFuncSlice::callAsFunction):
(KJS::ArrayProtoFuncSort::callAsFunction):
(KJS::ArrayProtoFuncSplice::callAsFunction):
(KJS::ArrayProtoFuncUnShift::callAsFunction):
(KJS::ArrayProtoFuncFilter::callAsFunction):
(KJS::ArrayProtoFuncMap::callAsFunction):
(KJS::ArrayProtoFuncEvery::callAsFunction):
(KJS::ArrayProtoFuncForEach::callAsFunction):
(KJS::ArrayProtoFuncSome::callAsFunction):
(KJS::ArrayProtoFuncIndexOf::callAsFunction):
(KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
* kjs/array_object.h:
(KJS::ArrayPrototype::classInfo):
* kjs/create_hash_table:
* kjs/date_object.cpp:
(KJS::DatePrototype::getOwnPropertySlot):
(KJS::DateProtoFuncToString::callAsFunction):
(KJS::DateProtoFuncToUTCString::callAsFunction):
(KJS::DateProtoFuncToDateString::callAsFunction):
(KJS::DateProtoFuncToTimeString::callAsFunction):
(KJS::DateProtoFuncToLocaleString::callAsFunction):
(KJS::DateProtoFuncToLocaleDateString::callAsFunction):
(KJS::DateProtoFuncToLocaleTimeString::callAsFunction):
(KJS::DateProtoFuncValueOf::callAsFunction):
(KJS::DateProtoFuncGetTime::callAsFunction):
(KJS::DateProtoFuncGetFullYear::callAsFunction):
(KJS::DateProtoFuncGetUTCFullYear::callAsFunction):
(KJS::DateProtoFuncToGMTString::callAsFunction):
(KJS::DateProtoFuncGetMonth::callAsFunction):
(KJS::DateProtoFuncGetUTCMonth::callAsFunction):
(KJS::DateProtoFuncGetDate::callAsFunction):
(KJS::DateProtoFuncGetUTCDate::callAsFunction):
(KJS::DateProtoFuncGetDay::callAsFunction):
(KJS::DateProtoFuncGetUTCDay::callAsFunction):
(KJS::DateProtoFuncGetHours::callAsFunction):
(KJS::DateProtoFuncGetUTCHours::callAsFunction):
(KJS::DateProtoFuncGetMinutes::callAsFunction):
(KJS::DateProtoFuncGetUTCMinutes::callAsFunction):
(KJS::DateProtoFuncGetSeconds::callAsFunction):
(KJS::DateProtoFuncGetUTCSeconds::callAsFunction):
(KJS::DateProtoFuncGetMilliSeconds::callAsFunction):
(KJS::DateProtoFuncGetUTCMilliseconds::callAsFunction):
(KJS::DateProtoFuncGetTimezoneOffset::callAsFunction):
(KJS::DateProtoFuncSetTime::callAsFunction):
(KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
(KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
(KJS::DateProtoFuncSetSeconds::callAsFunction):
(KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
(KJS::DateProtoFuncSetMinutes::callAsFunction):
(KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
(KJS::DateProtoFuncSetHours::callAsFunction):
(KJS::DateProtoFuncSetUTCHours::callAsFunction):
(KJS::DateProtoFuncSetDate::callAsFunction):
(KJS::DateProtoFuncSetUTCDate::callAsFunction):
(KJS::DateProtoFuncSetMonth::callAsFunction):
(KJS::DateProtoFuncSetUTCMonth::callAsFunction):
(KJS::DateProtoFuncSetFullYear::callAsFunction):
(KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
(KJS::DateProtoFuncSetYear::callAsFunction):
(KJS::DateProtoFuncGetYear::callAsFunction):
* kjs/date_object.h:
* kjs/lookup.cpp:
(KJS::Lookup::find):
* kjs/lookup.h:
(KJS::HashEntry::):
(KJS::staticFunctionGetter):
(KJS::staticValueGetter):
(KJS::getStaticPropertySlot):
(KJS::getStaticFunctionSlot):
(KJS::lookupPut):
* kjs/math_object.cpp:
(KJS::MathObjectImp::getOwnPropertySlot):
(KJS::MathProtoFuncAbs::callAsFunction):
(KJS::MathProtoFuncACos::callAsFunction):
(KJS::MathProtoFuncASin::callAsFunction):
(KJS::MathProtoFuncATan::callAsFunction):
(KJS::MathProtoFuncATan2::callAsFunction):
(KJS::MathProtoFuncCeil::callAsFunction):
(KJS::MathProtoFuncCos::callAsFunction):
(KJS::MathProtoFuncExp::callAsFunction):
(KJS::MathProtoFuncFloor::callAsFunction):
(KJS::MathProtoFuncLog::callAsFunction):
(KJS::MathProtoFuncMax::callAsFunction):
(KJS::MathProtoFuncMin::callAsFunction):
(KJS::MathProtoFuncPow::callAsFunction):
(KJS::MathProtoFuncRandom::callAsFunction):
(KJS::MathProtoFuncRound::callAsFunction):
(KJS::MathProtoFuncSin::callAsFunction):
(KJS::MathProtoFuncSqrt::callAsFunction):
(KJS::MathProtoFuncTan::callAsFunction):
* kjs/math_object.h:
(KJS::MathObjectImp::classInfo):
(KJS::MathObjectImp::):
* kjs/string_object.cpp:
(KJS::StringPrototype::getOwnPropertySlot):
(KJS::StringProtoFuncToString::callAsFunction):
(KJS::StringProtoFuncValueOf::callAsFunction):
(KJS::StringProtoFuncCharAt::callAsFunction):
(KJS::StringProtoFuncCharCodeAt::callAsFunction):
(KJS::StringProtoFuncConcat::callAsFunction):
(KJS::StringProtoFuncIndexOf::callAsFunction):
(KJS::StringProtoFuncLastIndexOf::callAsFunction):
(KJS::StringProtoFuncMatch::callAsFunction):
(KJS::StringProtoFuncSearch::callAsFunction):
(KJS::StringProtoFuncReplace::callAsFunction):
(KJS::StringProtoFuncSlice::callAsFunction):
(KJS::StringProtoFuncSplit::callAsFunction):
(KJS::StringProtoFuncSubstr::callAsFunction):
(KJS::StringProtoFuncSubstring::callAsFunction):
(KJS::StringProtoFuncToLowerCase::callAsFunction):
(KJS::StringProtoFuncToUpperCase::callAsFunction):
(KJS::StringProtoFuncToLocaleLowerCase::callAsFunction):
(KJS::StringProtoFuncToLocaleUpperCase::callAsFunction):
(KJS::StringProtoFuncLocaleCompare::callAsFunction):
(KJS::StringProtoFuncBig::callAsFunction):
(KJS::StringProtoFuncSmall::callAsFunction):
(KJS::StringProtoFuncBlink::callAsFunction):
(KJS::StringProtoFuncBold::callAsFunction):
(KJS::StringProtoFuncFixed::callAsFunction):
(KJS::StringProtoFuncItalics::callAsFunction):
(KJS::StringProtoFuncStrike::callAsFunction):
(KJS::StringProtoFuncSub::callAsFunction):
(KJS::StringProtoFuncSup::callAsFunction):
(KJS::StringProtoFuncFontcolor::callAsFunction):
(KJS::StringProtoFuncFontsize::callAsFunction):
(KJS::StringProtoFuncAnchor::callAsFunction):
(KJS::StringProtoFuncLink::callAsFunction):
* kjs/string_object.h:
2007-11-08 Adam Roben <aroben@apple.com>
Windows build fix
Reviewed by Sam and Ada.
* wtf/MathExtras.h: Get rid of a circular #include dependency to fix
the build.
2007-11-08 Adam Roben <aroben@apple.com>
Fix a precedence warning on Windows
* kjs/JSImmediate.h:
(KJS::JSImmediate::toBoolean):
2007-11-08 Mark Rowe <mrowe@apple.com>
Build fix for JavaScriptGlue.
* wtf/MathExtras.h: Include stdlib.h for srand and RAND_MAX.
2007-11-08 Darin Adler <darin@apple.com>
- Windows build fix
* kjs/JSImmediate.h: Include MathExtras.h rather than math.h since this file uses "signbit".
2007-11-08 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Replace the use of floats for immediate values with the use of integers for a 4.5% improvement in SunSpider.
Unfortunately this change results in NaN, +Inf, -Inf, and -0 being heap allocated now, but
we should now have faster array access, faster immediate to double conversion, and the
potential to further improve bitwise operators in future.
This also removes the need for unions to avoid strict aliasing problems when extracting
a value from immediates.
* kjs/JSImmediate.h:
(KJS::):
(KJS::JSImmediate::trueImmediate):
(KJS::JSImmediate::falseImmediate):
(KJS::JSImmediate::undefinedImmediate):
(KJS::JSImmediate::nullImmediate):
(KJS::JSImmediate::toBoolean):
* kjs/value.h:
(KJS::jsNaN):
2007-11-07 Eric Seidel <eric@webkit.org>
Reviewed by Darin and Oliver.
Add evaluateToNumber parallel evaluation tree to speed up number operations.
Make ImmediateNumberNode a subclass of NumberNode.
Share evaluate logic between evaluate and evaluateToNumber using inline functions
There is still a lot of improvement to be made here.
SunSpider claims this is a 1.0% speedup overall (nbody 7.9%), base64 slowing 2.0%
Given the huge win that this prepares us for with simple type inferencing I see the small
regression in base64 being worth the substantial overall improvement.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::Node::evaluateToNumber):
(KJS::NumberNode::evaluate):
(KJS::NumberNode::evaluateToNumber):
(KJS::StringNode::evaluateToNumber):
(KJS::LocalVarAccessNode::inlineEvaluate):
(KJS::LocalVarAccessNode::evaluate):
(KJS::LocalVarAccessNode::evaluateToNumber):
(KJS::BracketAccessorNode::inlineEvaluate):
(KJS::BracketAccessorNode::evaluate):
(KJS::BracketAccessorNode::evaluateToNumber):
(KJS::NegateNode::evaluate):
(KJS::NegateNode::evaluateToNumber):
(KJS::MultNode::inlineEvaluateToNumber):
(KJS::MultNode::evaluate):
(KJS::MultNode::evaluateToNumber):
(KJS::DivNode::inlineEvaluateToNumber):
(KJS::DivNode::evaluate):
(KJS::DivNode::evaluateToNumber):
(KJS::ModNode::inlineEvaluateToNumber):
(KJS::ModNode::evaluate):
(KJS::ModNode::evaluateToNumber):
(KJS::throwOutOfMemoryErrorToNumber):
(KJS::addSlowCaseToNumber):
(KJS::add):
(KJS::addToNumber):
(KJS::AddNode::evaluateToNumber):
(KJS::SubNode::inlineEvaluateToNumber):
(KJS::SubNode::evaluate):
(KJS::SubNode::evaluateToNumber):
(KJS::valueForReadModifyAssignment):
(KJS::ReadModifyLocalVarNode::evaluate):
(KJS::ReadModifyResolveNode::evaluate):
(KJS::ReadModifyDotNode::evaluate):
(KJS::ReadModifyBracketNode::evaluate):
* kjs/nodes.h:
(KJS::Node::):
(KJS::NumberNode::):
(KJS::ImmediateNumberNode::):
(KJS::AddNode::precedence):
* kjs/nodes2string.cpp:
(KJS::NumberNode::streamTo):
2007-11-07 Mark Rowe <mrowe@apple.com>
Reviewed by Eric.
Fix up initialization after being mangled in r27572, and remove the
ternary expression as extraCost will always be zero for the numeric
heap.
* kjs/collector.cpp:
(KJS::Collector::heapAllocate):
2007-11-07 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/regexp_object.cpp:
2007-11-07 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth Dakin.
Eliminated a bogus (though compiled-out) branch in the collector.
* kjs/collector.cpp:
(KJS::Collector::heapAllocate):
2007-11-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed part of http://bugs.webkit.org/show_bug.cgi?id=15861
5.8% of string-validate-input.js is spent creating RegExpImps
Put RegExpImp properties into a static hashtable to avoid a slew of
PropertyMap churn when creating a RegExpImp.
Factored important bits of regular expression implementation out of
RegExpImp (the JS object) and into RegExp (the PCRE wrapper class),
making RegExp a ref-counted class. (This will help later.)
Removed PCRE_POSIX support because I didn't quite know how to test it
and keep it working with these changes.
1.1% SunSpider speedup. 5.8% speedup on string-validate-input.js.
* kjs/regexp.h: A few interface changes:
1. Renamed "subpatterns()" => "numSubpatterns()"
2. Made flag enumeration private and replaced it with public getters for
specific flags.
3. Made RegExp ref-counted so RegExps can be shared by RegExpImps.
4. Made RegExp take a string of flags instead of an int, eliminating
duplicated flag parsing code elsewhere.
* kjs/regexp_object.cpp:
(KJS::RegExpProtoFunc::callAsFunction): For RegExp.compile:
- Fixed a bug where compile(undefined) would throw an exception.
- Removed some now-redundant code.
- Used RegExp sharing to eliminate an allocation and a bunch of
PropertyMap thrash. (Not a big win since compile is a deprecated
function. I mainly did this to test the plubming.)
2007-11-07 Simon Hausmann <hausmann@kde.org>
Reviewed by nobody, Qt/Windows build fix.
JavaScriptCore.pri expects OBJECTS_DIR to be set, so set it in
testkjs.pro, too, where it's included from.
* kjs/testkjs.pro:
2007-11-07 Simon Hausmann <shausman@trolltech.com>
Reviewed by Lars.
Fix "nmake clean" for the Qt/Windows build by replacing tmp/ with a variable that ends with the correct type of slash/backslash depending on the choice of compiler/make tool.
* JavaScriptCore.pri:
* pcre/pcre.pri:
2007-11-07 Lars Knoll <lars@trolltech.com>
Reviewed by Simon.
fix umemcasecmp
Pretty embarrassing bug. Has the potential to fix quite a few test failures.
* wtf/unicode/qt4/UnicodeQt4.h:
(WTF::Unicode::umemcasecmp):
2007-11-06 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
- only collect when the heap is full, unless we have lots of extra cost garbage
1.1% SunSpider speedup.
This shouldn't hit memory use much since the extra space in those
blocks hangs around either way.
* kjs/collector.cpp:
(KJS::Collector::heapAllocate):
(KJS::Collector::collect): Fix logic error that reversed the sense of collect's
return value.
2007-11-06 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Avoid unnecessarily boxing the result from post inc/decrement for 0.3% gain in sunspider
We now convert the common 'for (...; ...; <var>++) ...' to the semantically identical
'for (...; ...; ++<var>) ...'.
* kjs/nodes.cpp:
(KJS::PostIncResolveNode::optimizeForUnnecessaryResult):
(KJS::PostIncLocalVarNode::evaluate):
(KJS::PostIncLocalVarNode::optimizeForUnnecessaryResult):
(KJS::PostDecResolveNode::optimizeForUnnecessaryResult):
(KJS::PostDecLocalVarNode::evaluate):
(KJS::PostDecLocalVarNode::optimizeForUnnecessaryResult):
* kjs/nodes.h:
(KJS::PrePostResolveNode::):
(KJS::PostIncResolveNode::):
(KJS::PostIncLocalVarNode::):
(KJS::PostDecResolveNode::):
(KJS::PostDecLocalVarNode::):
(KJS::PreIncResolveNode::):
(KJS::PreDecResolveNode::):
(KJS::ForNode::ForNode):
2007-11-06 Eric Seidel <eric@webkit.org>
Reviewed by darin.
This fixes a regressed layout test for string + object
SunSpider claims this was an overall 0.3% speedup, although some individual tests were slower.
* kjs/nodes.cpp:
(KJS::add): remove erroneous "fast path" for string + *
2007-11-06 Geoffrey Garen <ggaren@apple.com>
Reviewed by Eric Seidel.
Added toJSNumber, a fast path for converting a JSValue to a JS number,
and deployed it in postfix expressions. In the fast case this
eliminates a call to jsNumber.
0.4% speedup on SunSpider.
* ChangeLog:
* kjs/nodes.cpp:
(KJS::PostIncResolveNode::evaluate):
(KJS::PostIncLocalVarNode::evaluate):
(KJS::PostDecResolveNode::evaluate):
(KJS::PostDecLocalVarNode::evaluate):
(KJS::PostIncBracketNode::evaluate):
(KJS::PostDecBracketNode::evaluate):
(KJS::PostIncDotNode::evaluate):
(KJS::PostDecDotNode::evaluate):
(KJS::UnaryPlusNode::evaluate):
* kjs/value.h:
(KJS::JSValue::toJSNumber):
2007-11-06 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15846
REGRESSION (r27387): Memory corruption when running fast/js/kde/delete.html
There was a mistake in the algorithm used to find an empty slot in the property
map entries vector; when we were putting in a new property value and not overwriting
an existing deleted sentinel, we would enlarge the entries vector, but would not
overwrite the stale data that's in the new part. It was easy to pin this down by
turning on property map consistency checks -- I never would have landed with this
bug if I had run the regression tests once with consistency checks on!
* kjs/property_map.cpp: (KJS::PropertyMap::put): Changed logic for the case where
foundDeletedElement is false to always use the item at the end of the entries vector.
Also allowed me to merge with the logic for the "no deleted sentinels at all" case.
2007-11-06 Oliver Hunt <oliver@apple.com>
RS=Darin.
Fix previous patch to use a 3 bit shift, a 16 bit shift causes a regression in sunspider.
* kjs/nodes.cpp:
(KJS::add):
2007-11-06 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Replace boolean comparisons in AddNode with mask
comparisons for a 0.2% improvement in sunspider.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/nodes.cpp:
(KJS::add):
2007-11-06 Eric Seidel <eric@webkit.org>
Reviewed by darin.
SunSpider claims this is a 1.1% speedup.
* kjs/nodes.cpp:
(KJS::throwOutOfMemoryError): Added, non inline.
(KJS::addSlowCase): renamed from add(), non inline.
(KJS::add): add fast path for String + String, Number + Number and String + *
2007-11-06 Eric Seidel <eric@webkit.org>
Reviewed by mjs.
Avoid more UString creation.
SunSpider claims this is a 0.4% speedup.
* kjs/regexp_object.cpp:
(KJS::RegExpObjectImp::construct): use UString::find(UChar)
2007-11-05 Mark Rowe <mrowe@apple.com>
Mac build fix.
* kjs/array_object.cpp:
(KJS::ArrayProtoFunc::callAsFunction):
2007-11-05 Adam Roben <aroben@apple.com>
Windows build fix
* kjs/list.h:
2007-11-05 Mark Rowe <mrowe@apple.com>
Build fix. Add missing #include.
* kjs/operations.cpp:
2007-11-05 Eric Seidel <eric@webkit.org>
Reviewed by mjs.
Remove another call to toString(exec)
SunSpider claims this is a 0.5% speedup.
* kjs/operations.cpp:
(KJS::equal): remove another toString
2007-11-05 Eric Seidel <eric@webkit.org>
* kjs/operations.cpp:
(KJS::equal): correct broken change.
2007-11-05 Eric Seidel <eric@webkit.org>
Reviewed by mjs.
Remove one more call to toString(exec).
SunSpider claims this is a 0.7% speedup.
* kjs/operations.cpp:
(KJS::equal): remove a call to toString()
2007-11-05 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* pcre/pcre.pri:
2007-11-05 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/list.cpp:
2007-11-05 Geoffrey Garen <ggaren@apple.com>
Touched a file to test my new HTTP access.
* kjs/scope_chain.cpp:
2007-11-05 Alp Toker <alp@atoker.com>
Unreviewed build fix for qmake-based ports.
Someone with a better understanding of qmake still needs to sort out
the INCLUDEPATH/DEPENDPATH mess.
* JavaScriptCore.pri:
2007-11-05 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
http://bugs.webkit.org/show_bug.cgi?id=15835
Switched List implementation from a custom heap allocator to an inline
Vector, for a disappointing .5% SunSpider speedup.
Also renamed List::slice to List::getSlice because "get" is the
conventional prefix for functions returning a value through an out
parameter.
* kjs/array_object.cpp:
(KJS::ArrayProtoFunc::callAsFunction): Removed some redundant function
calls and memory accesses.
* kjs/bool_object.cpp:
(BooleanObjectImp::construct): Removed questionable use of iterator.
* kjs/list.cpp:
* kjs/list.h: New List class, implemented in terms of Vector. Two
interesting differences:
1. The inline capacity is 8, not 5. Many of the Lists constructed
during a SunSpider run are larger than 5; almost none are larger
than 8.
2. The growth factor is 4, not 2. Since we can guarantee that Lists
aren't long-lived, we can grow them more aggressively, to avoid
excessive copying.
* kjs/regexp_object.cpp:
(RegExpObjectImp::construct): Removed redundant function calls.
* kjs/string_object.cpp:
(KJS::StringObjectImp::construct): Removed questionable use of iterator.
* wtf/Vector.h:
(WTF::::uncheckedAppend): Added a fast, unchecked version of append.
2007-11-05 Mark Rowe <mrowe@apple.com>
Reviewed by Alp Toker.
Add DEPENDPATH to JavaScriptCore and pcre to help qmake with dependencies.
* JavaScriptCore.pri:
* pcre/pcre.pri:
2007-11-04 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15826
optimize opcode loop and case insensitive ASCII compares for a 30% speedup
SunSpider says it's 2.6% faster overall, 32.5% in the regular expression tests.
* pcre/pcre_internal.h: Added OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
* pcre/pcre_compile.c:
(find_fixedlength): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. Also
added OP_NOT since there was no reason it should not be in here.
(could_be_empty_branch): Ditto.
(compile_branch): Streamlined all the single-character cases; there was a bit of
duplicate code. Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC as needed.
But in particular, compile to those opcodes when the single character match is
ASCII.
(find_firstassertedchar): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
* pcre/pcre_exec.c: (match): Removed the "min", "minimize", and "op" fields from
the matchframe, after I discovered that none of them needed to be saved and restored
across recursive match calls. Also eliminated the ignored result field from the
matchframe, since I discovered that rrc ("recursive result code") was already the
exact same thing. Moved the handling of opcodes higher than OP_BRA into the default
statement of the switch instead of doing them before the switch. This removes a
branch from each iteration of the opcode interpreter, just as removal of "op"
removed at least one store from each iteration. Last, but not least, add the
OP_ASCII_CHAR and OP_ASCII_LETTER_NC functions. Neither can ever match a
surrogate pair and the letter case can be handled efficiently.
2007-11-04 Darin Adler <darin@apple.com>
* pcre/pcre_exec.c: (match): Try to fix the Windows build by removing unreachable code.
2007-11-03 Darin Adler <darin@apple.com>
- fix non-Mac builds; remove some more unused PCRE stuff
* pcre/pcre_compile.c:
(compile_branch): Removed branch chain and some unused ESC values.
(compile_regex): Ditto.
(jsRegExpCompile): Ditto.
* pcre/pcre_exec.c:
(match): Removed unused branch targets. Don't use macros any more.
(jsRegExpExecute): More of the same.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update for removed files.
* JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
* pcre/pcre.pri: Ditto.
* pcre/MERGING: Removed.
* pcre/pcre_fullinfo.c: Removed.
* pcre/pcre_get.c: Removed.
* pcre/pcre_internal.h:
* pcre/ucp.h: Removed.
2007-11-03 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15821
remove unused PCRE features for speed
A first step toward removing the PCRE features we don't use.
This gives a 0.8% speedup on SunSpider, and a 6.5% speedup on
the SunSpider regular expression test.
Replaced the public interface with one that doesn't use the
name PCRE. Removed code we don't need for JavaScript and various
configurations we don't use. This is in preparation for still
more changes in the future. We'll probably switch to C++ and
make some even more significant changes to the regexp engine
to get some additional speed.
There's probably additional unused stuff that I haven't
deleted yet.
This does mean that our PCRE is now a fork, but I think that's
not really a big deal.
* JavaScriptCore.exp: Remove the 5 old entry points and add
the 3 new entry points for WebCore's direct use of the regular
expression engine.
* kjs/config.h: Remove the USE(PCRE16) define. I decided to flip
its sense and now there's a USE(POSIX_REGEX) instead, which should
probably not be set by anyone. Maybe later we'll just get rid of it
altogether.
* kjs/regexp.h:
* kjs/regexp.cpp:
(KJS::RegExp::RegExp): Switch to new jsRegExp function names and
defines. Cut down on the number of functions used.
(KJS::RegExp::~RegExp): Ditto.
(KJS::RegExp::match): Ditto.
* pcre/dftables.c: (main): Get rid of ctype_letter and ctype_meta,
which are unused.
* pcre/pcre-config.h: Get rid of EBCIDIC, PCRE_DATA_SCOPE, const,
size_t, HAVE_STRERROR, HAVE_MEMMOVE, HAVE_BCOPY, NEWLINE,
POSIX_MALLOC_THRESHOLD, NO_RECURSE, SUPPORT_UCP, SUPPORT_UTF8,
and JAVASCRIPT. These are all no longer configurable in our copy
of the library.
* pcre/pcre.h: Remove the macro-based kjs prefix hack, the PCRE
version macros, PCRE_UTF16, the code to set up PCRE_DATA_SCOPE,
the include of <stdlib.h>, and most of the constants and
functions defined in this header. Changed the naming scheme to
use a JSRegExp prefix rather than a pcre prefix. In the future,
we'll probably change this to be a C++ header.
* pcre/pcre_compile.c: Removed all unused code branches,
including many whole functions and various byte codes.
Kept changes outside of removal to a minimum.
(check_escape):
(first_significant_code):
(find_fixedlength):
(find_recurse):
(could_be_empty_branch):
(compile_branch):
(compile_regex):
(is_anchored):
(is_startline):
(find_firstassertedchar):
(jsRegExpCompile): Renamed from pcre_compile2 and changed the
parameters around a bit.
(jsRegExpFree): Added.
* pcre/pcre_exec.c: Removed many unused opcodes and variables.
Also started tearing down the NO_RECURSE mechanism since it's
now the default. In some cases there were things in the explicit
frame that could be turned into plain old local variables and
other small like optimizations.
(pchars):
(match_ref):
(match): Changed parameters quite a bit since it's now not used
recursively.
(jsRegExpExecute): Renamed from pcre_exec.
* pcre/pcre_internal.h: Get rid of PCRE_DEFINITION, PCRE_SPTR,
PCRE_IMS, PCRE_ICHANGED, PCRE_NOPARTIAL, PCRE_STUDY_MAPPED,
PUBLIC_OPTIONS, PUBLIC_EXEC_OPTIONS, PUBLIC_DFA_EXEC_OPTIONS,
PUBLIC_STUDY_OPTIONS, MAGIC_NUMBER, 16 of the opcodes,
_pcre_utt, _pcre_utt_size, _pcre_try_flipped, _pcre_ucp_findprop,
and _pcre_valid_utf8. Also moved pcre_malloc and pcre_free here.
* pcre/pcre_maketables.c: Changed to only compile in dftables.
Also got rid of many of the tables that we don't use.
* pcre/pcre_tables.c: Removed the unused Unicode property tables.
* pcre/pcre_ucp_searchfuncs.c: Removed everything except for
_pcre_ucp_othercase.
* pcre/pcre_xclass.c: (_pcre_xclass): Removed uneeded support
for classes based on Unicode properties.
* wtf/FastMallocPCRE.cpp: Removed unused bits. It would be good
to eliminate this completely, but we need the regular expression
code to be C++ first.
* pcre/pcre_fullinfo.c:
* pcre/pcre_get.c:
* pcre/ucp.h:
Files that are no longer needed. I didn't remove them with this
check-in, because I didn't want to modify all the project files.
2007-11-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Sam.
- remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup
It turns out that doing this check costs more than it saves.
* kjs/JSImmediate.h:
(KJS::JSImmediate::fromDouble):
2007-11-03 Sam Weinig <sam@webkit.org>
Reviewed by Oliver.
Remove dummy variable from ClassInfo reducing the size of the struct by 1 word.
The variable had been kept around for binary compatibility, but since nothing
else is there is no point in continuing to keep it around.
* API/JSCallbackConstructor.cpp:
(KJS::):
* API/JSCallbackFunction.cpp:
(KJS::):
* API/JSCallbackObject.cpp:
(KJS::):
* bindings/objc/objc_runtime.mm:
* bindings/runtime_array.cpp:
* bindings/runtime_object.cpp:
* kjs/array_instance.cpp:
(KJS::):
* kjs/array_object.cpp:
(KJS::):
* kjs/bool_object.cpp:
* kjs/date_object.cpp:
(KJS::):
* kjs/error_object.cpp:
* kjs/function.cpp:
(KJS::):
* kjs/internal.cpp:
(KJS::):
* kjs/lookup.h:
* kjs/math_object.cpp:
* kjs/number_object.cpp:
* kjs/object.h:
* kjs/regexp_object.cpp:
* kjs/string_object.cpp:
(KJS::):
2007-11-03 Kevin McCullough <kmccullough@apple.com>
- Updated testkjs results to make the build bots green until we
can fix the tests that are failing. The new failures are in DST.
* tests/mozilla/expected.html:
2007-11-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Adam.
- don't print the var twice for ForInNodes with a var declaration
* kjs/nodes2string.cpp:
(KJS::ForInNode::streamTo):
2007-11-03 Darin Adler <darin@apple.com>
* pcre/pcre_compile.c: (check_escape): Windows build fix. Get rid of
C-incompatible declaration.
2007-11-03 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/nodes.cpp: Add missing include.
2007-11-03 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=15814
<rdar://problem/5536644> fast/js/kde/encode_decode_uri.html fails
These changes cause us to match the JavaScript specification and pass the
fast/js/kde/encode_decode_uri.html test.
* kjs/function.cpp: (KJS::encode): Call the UTF-8 string conversion in its
new strict mode, throwing an exception if there are malformed UTF-16 surrogate
pairs in the text.
* kjs/ustring.h: Added a strict version of the UTF-8 string conversion.
* kjs/ustring.cpp:
(KJS::decodeUTF8Sequence): Removed code to disallow U+FFFE and U+FFFF; while
those might be illegal in some sense, they aren't supposed to get any special
handling in the place where this function is currently used.
(KJS::UString::UTF8String): Added the strictness.
2007-11-03 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15812
some JavaScript tests (from the Mozilla test suite) are failing
Two or three fixes get 7 more of the Mozilla tests passing.
This gets us down from 61 failing tests to 54.
* kjs/interpreter.h: (KJS::Interpreter::builtinRegExp):
Made this inline and gave it a more specific type. Some day we should
probably do that for all of these -- might even get a bit of a speed
boost from it.
* kjs/interpreter.cpp: Removed Interpreter::builtinRegExp now that it's
inline in the header.
* kjs/regexp_object.h:
* kjs/regexp_object.cpp:
(KJS::RegExpProtoFunc::callAsFunction): Moved test and exec out of the
switch statement into the RegExpImp object, so they can be shared with
RegExpImp::callAsFunction.
(KJS::RegExpImp::match): Added. Common code used by both test and exec.
(KJS::RegExpImp::test): Added.
(KJS::RegExpImp::exec): Added.
(KJS::RegExpImp::implementsCall): Added.
(KJS::RegExpImp::callAsFunction): Added.
(KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate): Initialize
lastInput to null rather than empty string -- we take advantage of the
difference in RegExpImp::match.
(KJS::RegExpObjectImp::input): Added. No reason to go through hash tables
just to get at a field like this.
* pcre/pcre_compile.c: (check_escape): Changed the \u handling to match
the JavaScript specification. If there are not 4 hex digits after the \u,
then it's processed as if it wasn't an escape sequence at all.
* pcre/pcre_internal.h: Added IS_NEWLINE, with the appropriate definition
for JavaScript (4 specific Unicode values).
* pcre/pcre_exec.c:
(match): Changed all call sites to use IS_NEWLINE.
(pcre_exec): Ditto.
* tests/mozilla/expected.html: Updated to expect 7 more successful tests.
2007-11-03 David D. Kilzer <ddkilzer@webkit.org>
Sort files(...); sections of Xcode project files.
Rubber-stamped by Darin.
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-11-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::VarDeclNode::optimizeVariableAccess):
(KJS::VarDeclNode::getDeclarations):
(KJS::VarDeclNode::handleSlowCase):
(KJS::VarDeclNode::evaluateSingle):
(KJS::VarDeclNode::evaluate):
(KJS::VarStatementNode::execute):
* kjs/nodes.h:
(KJS::VarDeclNode::):
(KJS::VarStatementNode::):
* kjs/nodes2string.cpp:
(KJS::VarDeclNode::streamTo):
2007-11-03 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=15800
REGRESSION (r27303): RegExp leaks
* kjs/regexp_object.h:
(KJS::RegExpImp::setRegExp):
(KJS::RegExpImp::regExp):
(KJS::RegExpImp::classInfo):
* kjs/regexp_object.cpp:
(RegExpImp::RegExpImp):
(RegExpImp::~RegExpImp):
Renamed reg member variable to m_regExp, changed it to use OwnPtr.
2007-11-02 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::statementListPushFIFO):
(KJS::statementListGetDeclarations):
(KJS::statementListInitializeDeclarationStacks):
(KJS::statementListInitializeVariableAccessStack):
(KJS::statementListExecute):
(KJS::BlockNode::BlockNode):
(KJS::FunctionBodyNode::FunctionBodyNode):
(KJS::ProgramNode::ProgramNode):
* kjs/nodes.h:
(KJS::CaseClauseNode::):
2007-11-02 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15791
change property map data structure for less memory use, better speed
The property map now has an array of indices and a separate array of
property map entries. This slightly slows down lookup because of a second
memory acess, but makes property maps smaller and faster to iterate in
functions like mark().
SunSpider says this is 1.2% faster, although it makes the bitwise-end test
more than 10% slower. To fix that we'll need to optimize global variable lookup.
* kjs/property_map.cpp:
(KJS::PropertyMapEntry::PropertyMapEntry):
(KJS::PropertyMapHashTable::entries):
(KJS::PropertyMapHashTable::allocationSize):
(KJS::SavedProperties::SavedProperties):
(KJS::SavedProperties::~SavedProperties):
(KJS::PropertyMap::checkConsistency):
(KJS::PropertyMap::~PropertyMap):
(KJS::PropertyMap::clear):
(KJS::PropertyMap::get):
(KJS::PropertyMap::getLocation):
(KJS::PropertyMap::put):
(KJS::PropertyMap::insert):
(KJS::PropertyMap::createTable):
(KJS::PropertyMap::rehash):
(KJS::PropertyMap::remove):
(KJS::PropertyMap::mark):
(KJS::comparePropertyMapEntryIndices):
(KJS::PropertyMap::containsGettersOrSetters):
(KJS::PropertyMap::getEnumerablePropertyNames):
(KJS::PropertyMap::save):
(KJS::PropertyMap::restore):
* kjs/property_map.h:
2007-11-02 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15807
HashMap needs a take() function that combines get and remove
* wtf/HashMap.h: Added take function. Simplistic implementation for now,
but still does only one hash table lookup.
* kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
a find followed by a remove.
2007-11-02 David Carson <dacarson@gmail.com>
Reviewed by Darin.
Fix compiler warning "warning: suggest parentheses around && within ||"
http://bugs.webkit.org/show_bug.cgi?id=15764
* kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
2007-11-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
In preparation for making List a simple stack-allocated Vector:
Removed all instances of List copying and/or assignment, and made List
inherit from Noncopyable.
Functions that used to return a List by copy now take List& out
parameters.
Layout tests and JS tests pass.
* kjs/list.cpp:
(KJS::List::slice): Replaced copyTail with a more generic slice
alternative. (JavaScriptCore only calls slice(1), but WebCore calls
slice(2)).
2007-11-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
REGRESSION(r27344): Crash on load at finance.yahoo.com
Reverted a small portion of my last check-in. (The speedup and the List
removal are still there, though.)
ActivationImp needs to hold a pointer to its function, and mark that
pointer (rather than accessing its function through its ExecState, and
counting on the active scope to mark its function) because a closure
can cause an ActivationImp to outlive its ExecState along with any
active scope.
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
* kjs/function.cpp:
(KJS::FunctionImp::~FunctionImp):
(KJS::ActivationImp::ActivationImp):
* kjs/function.h:
(KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
Also made HashTable a little more crash-happy in debug builds, so
problems like this will show up earlier:
* wtf/HashTable.h:
(WTF::HashTable::~HashTable):
2007-11-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Adam Roben.
Addressed some of Darin's review comments.
Used perl -p, which is the shorthand while(<>) {}.
Made sure not to suppress bison's output.
Added line to removed bison_out.txt, since this script removes other
intermediate files, too.
* DerivedSources.make:
2007-11-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Removed List from ActivationImp, in preparation for making all lists
stack-allocated.
Tests pass.
1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
(KJS::ExecState::~ExecState):
* kjs/function.cpp:
(KJS::ActivationImp::ActivationImp):
(KJS::ActivationImp::createArgumentsObject):
* kjs/function.h:
(KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
2007-11-01 Adam Roben <aroben@apple.com>
Use jsNumberCell instead of jsNumber when converting double constants to JSValues
This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
It also gets rid of an MSVC warning that we previously had to silence.
Reviewed by Geoff.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
back on the "overflow in constant arithmetic" warning.
* kjs/number_object.cpp:
(NumberObjectImp::getValueProperty): Use jsNumberCell instead of
jsNumber.
2007-10-31 Adam Roben <aroben@apple.com>
Windows build fix
* kjs/ExecState.h:
2007-10-31 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- shave some cycles off of local storage access for a 1% SunSpider speedup
Keep the LocalStorage pointer in the ExecState, instead of getting
it from the ActivationImp all the time.
* kjs/ExecState.cpp:
(KJS::ExecState::updateLocalStorage):
* kjs/ExecState.h:
(KJS::ExecState::localStorage):
* kjs/nodes.cpp:
(KJS::LocalVarAccessNode::evaluate):
(KJS::LocalVarFunctionCallNode::evaluate):
(KJS::PostIncLocalVarNode::evaluate):
(KJS::PostDecLocalVarNode::evaluate):
(KJS::LocalVarTypeOfNode::evaluate):
(KJS::PreIncLocalVarNode::evaluate):
(KJS::PreDecLocalVarNode::evaluate):
(KJS::ReadModifyLocalVarNode::evaluate):
(KJS::AssignLocalVarNode::evaluate):
(KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
2007-10-31 Adam Roben <aroben@apple.com>
Fix a crash on launch due to a static initializer race
We now use fast inline assembler spinlocks which can be statically
initialized at compile time.
As a side benefit, this speeds up SunSpider by 0.4%.
Reviewed by Oliver.
* wtf/FastMalloc.cpp:
* wtf/TCSpinLock.h:
(TCMalloc_SpinLock::Lock):
(TCMalloc_SpinLock::Unlock):
(TCMalloc_SlowLock):
* wtf/TCSystemAlloc.cpp:
2007-10-31 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam.
- Corrected spelling.
* wtf/HashTraits.h:
2007-10-31 Mark Rowe <mrowe@apple.com>
Further Gtk build fixage.
* kjs/regexp_object.cpp:
2007-10-31 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/regexp.h:
2007-10-31 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=15749
RegExp/RegExpObjectImp cause needless UString creation
Speeds things up 0.4% according to SunSpider.
* kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
because this library doesn't use the real PCRE -- it uses its
own PCRE that works on UTF-16.
* kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
Use Noncopyable. Change the return value of match.
* kjs/regexp.cpp:
(KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
(KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
(KJS::RegExp::match): Change to return the position as an int and the
ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
* kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
require a result string.
* kjs/regexp_object.cpp:
(RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
(RegExpObjectImp::performMatch): Change so it doesn't return a string.
(RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
the main result with the backreferences; now it doesn't need to take
a result parameter.
(RegExpObjectImp::getBackref): Minor tweaks.
(RegExpObjectImp::getLastParen): Ditto.
(RegExpObjectImp::getLeftContext): Ditto.
(RegExpObjectImp::getRightContext): Ditto.
(RegExpObjectImp::getValueProperty): Change LastMatch case to call
getBackref(0) so we don't need a separate getLastMatch function.
* kjs/string_object.cpp:
(KJS::replace): Update to use new performMatch, including merging the
matched string section with the other substrings.
(KJS::StringProtoFunc::callAsFunction): Update functions to use the
new performMatch and match. Also change to use OwnArrayPtr.
2007-10-31 Oliver Hunt <oliver@apple.com>
* kjs/nodes.h: include OwnPtr.h
2007-10-31 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::statementListPushFIFO):
(KJS::statementListGetDeclarations):
(KJS::statementListInitializeDeclarationStacks):
(KJS::statementListInitializeVariableAccessStack):
(KJS::statementListExecute):
(KJS::BlockNode::optimizeVariableAccess):
(KJS::BlockNode::BlockNode):
(KJS::BlockNode::getDeclarations):
(KJS::BlockNode::execute):
(KJS::CaseClauseNode::optimizeVariableAccess):
(KJS::CaseClauseNode::getDeclarations):
(KJS::CaseClauseNode::evalStatements):
(KJS::FunctionBodyNode::initializeDeclarationStacks):
(KJS::FunctionBodyNode::optimizeVariableAccess):
* kjs/nodes.h:
* kjs/nodes2string.cpp:
(KJS::statementListStreamTo):
(KJS::BlockNode::streamTo):
(KJS::CaseClauseNode::streamTo):
2007-10-30 Mark Rowe <mrowe@apple.com>
* kjs/property_map.cpp: Added a missing using directive to fix the build
for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
2007-10-31 Maciej Stachowiak <mjs@apple.com>
* kjs/property_map.cpp: Include HashTable.h the right way to fix the build
for non-Mac ports.
2007-10-31 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=11001
WebKit doesn't support RegExp.compile method
Test: fast/js/regexp-compile.html
* kjs/regexp_object.cpp:
(RegExpPrototype::RegExpPrototype):
(RegExpProtoFunc::callAsFunction):
* kjs/regexp_object.h:
(KJS::RegExpProtoFunc::):
Added RegExp.compile.
* tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
2007-10-31 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
Integer divide sucks. Fortunately, a bunch of shifts and XORs
biased towards the high bits is sufficient to provide a good
double hash. Besides the SunSpider win, I used the dump statistics
mode for both to verify that collisions did not increase and that
the longest collision chain is not any longer.
* kjs/property_map.cpp:
(KJS::doubleHash):
(KJS::PropertyMap::get):
(KJS::PropertyMap::getLocation):
(KJS::PropertyMap::put):
(KJS::PropertyMap::insert):
(KJS::PropertyMap::remove):
(KJS::PropertyMap::checkConsistency):
* wtf/HashTable.h:
(WTF::doubleHash):
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
(WTF::::add):
2007-10-30 Adam Roben <aroben@apple.com>
* kjs/collector.h: Make HeapType public so it can be used for non-member
things like the HeapConstants struct template. Fixes the build on Windows.
2007-10-30 Adam Roben <aroben@apple.com>
Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
Speeds up SunSpider by 0.4%.
Reviewed by Steve and Maciej.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
a warning during LTCG in release builds about double -> float
conversion.
* wtf/AlwaysInline.h:
* wtf/FastMalloc.h:
2007-10-30 Adam Roben <aroben@apple.com>
Use GetCurrentThreadId instead of pthread_self in FastMalloc
Speeds up SunSpider by 0.3%.
Reviewed by Steve.
* wtf/FastMalloc.cpp:
(WTF::TCMalloc_ThreadCache::InitTSD):
(WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2007-10-30 Adam Roben <aroben@apple.com>
Switch to a Win32 critical section implementation of spinlocks
Speeds up SunSpider by 0.4%.
Reviewed by Steve.
* wtf/FastMalloc.cpp:
* wtf/TCSpinLock.h:
(TCMalloc_SpinLock::TCMalloc_SpinLock):
(TCMalloc_SpinLock::Init):
(TCMalloc_SpinLock::Finalize):
(TCMalloc_SpinLock::Lock):
(TCMalloc_SpinLock::Unlock):
* wtf/TCSystemAlloc.cpp:
2007-10-30 Adam Roben <aroben@apple.com>
Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
http://bugs.webkit.org/show_bug.cgi?id=15586
Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
Use Win32 TLS functions instead of __declspec(thread), which breaks
delay-loading.
Reviewed by Steve.
* wtf/FastMalloc.cpp:
(WTF::getThreadHeap):
(WTF::TCMalloc_ThreadCache::InitModule):
2007-10-30 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- allocate numbers in half-size cells, for an 0.5% SunSpider speedup
http://bugs.webkit.org/show_bug.cgi?id=15772
We do this by using a single mark bit per two number cells, and
tweaking marking.
Besides being an 0.5% win overall, this is a 7.1% win on morph.
* kjs/collector.cpp:
(KJS::):
(KJS::Collector::heapAllocate):
(KJS::Collector::markStackObjectsConservatively):
(KJS::Collector::sweep):
* kjs/collector.h:
(KJS::SmallCollectorCell::):
2007-10-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Adam Roben, Sam Weinig.
Made conflicts in grammar.y a persistent build failure.
* DerivedSources.make:
2007-10-30 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam and Geoff.
- Added a new cast so all the casts are in the same place.
* API/APICast.h:
(toGlobalRef):
2007-10-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
JS tests, including
ecma_2/Statements/dowhile-001.js
ecma_2/Statements/dowhile-002.js
ecma_2/Statements/dowhile-003.js
ecma_2/Statements/dowhile-004.js
ecma_2/Statements/dowhile-005.js
ecma_2/Statements/dowhile-006.js
ecma_2/Statements/dowhile-007.js
js1_2/statements/do_while.js
and layout tests, including
do-while-expression-value.html
do-while-semicolon.html
do-while-without-semicolon.html
pass.
* kjs/grammar.y: Use the explicit "error" production, as we do with other
automatic semicolon insertions, to disambiguate "do { } while();" from
"do { } while()" followed by ";" (the empty statement).
2007-10-29 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Debranching remaining assignment nodes, and miscellaneous cleanup
Split read-modify code paths out of AssignBracketNode and AssignDotNode
Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode
and ReadModifyResolveNode evaluate methods
Leads to a 1% gain in SunSpider.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::ReadModifyLocalVarNode::evaluate):
(KJS::ReadModifyResolveNode::evaluate):
(KJS::AssignDotNode::evaluate):
(KJS::ReadModifyDotNode::optimizeVariableAccess):
(KJS::ReadModifyDotNode::evaluate):
(KJS::AssignBracketNode::evaluate):
(KJS::ReadModifyBracketNode::optimizeVariableAccess):
(KJS::ReadModifyBracketNode::evaluate):
* kjs/nodes.h:
(KJS::AssignBracketNode::):
(KJS::AssignBracketNode::precedence):
(KJS::AssignDotNode::):
(KJS::AssignDotNode::precedence):
* kjs/nodes2string.cpp:
(KJS::ReadModifyBracketNode::streamTo):
(KJS::AssignBracketNode::streamTo):
(KJS::ReadModifyDotNode::streamTo):
(KJS::AssignDotNode::streamTo):
2007-10-29 Oliver Hunt <oliver@apple.com>
Debranching various Node::evaluate implementations
Reviewed by Maciej.
Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
Gains 1.6% on SunSpider
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::PostIncResolveNode::optimizeVariableAccess):
(KJS::PostIncResolveNode::evaluate):
(KJS::PostIncLocalVarNode::evaluate):
(KJS::PostDecResolveNode::optimizeVariableAccess):
(KJS::PostDecResolveNode::evaluate):
(KJS::PostDecLocalVarNode::evaluate):
(KJS::PostIncBracketNode::evaluate):
(KJS::PostDecBracketNode::evaluate):
(KJS::PostIncDotNode::evaluate):
(KJS::PostDecDotNode::evaluate):
(KJS::PreIncResolveNode::optimizeVariableAccess):
(KJS::PreIncLocalVarNode::evaluate):
(KJS::PreIncResolveNode::evaluate):
(KJS::PreDecResolveNode::optimizeVariableAccess):
(KJS::PreDecLocalVarNode::evaluate):
(KJS::PreDecResolveNode::evaluate):
(KJS::PreIncBracketNode::evaluate):
(KJS::PreDecBracketNode::evaluate):
(KJS::PreIncDotNode::evaluate):
(KJS::PreDecDotNode::evaluate):
(KJS::ReadModifyResolveNode::optimizeVariableAccess):
(KJS::AssignResolveNode::optimizeVariableAccess):
(KJS::AssignLocalVarNode::evaluate):
(KJS::AssignResolveNode::evaluate):
* kjs/nodes.h:
(KJS::PostDecResolveNode::):
(KJS::PostDecResolveNode::precedence):
(KJS::PostDecLocalVarNode::):
(KJS::PostfixBracketNode::):
(KJS::PostfixBracketNode::precedence):
(KJS::PostIncBracketNode::):
(KJS::PostIncBracketNode::isIncrement):
(KJS::PostDecBracketNode::):
(KJS::PostDecBracketNode::isIncrement):
(KJS::PostfixDotNode::):
(KJS::PostfixDotNode::precedence):
(KJS::PostIncDotNode::):
(KJS::PostIncDotNode::isIncrement):
(KJS::PostDecDotNode::):
(KJS::PreIncResolveNode::):
(KJS::PreDecResolveNode::):
(KJS::PreDecResolveNode::precedence):
(KJS::PreDecLocalVarNode::):
(KJS::PrefixBracketNode::):
(KJS::PrefixBracketNode::precedence):
(KJS::PreIncBracketNode::):
(KJS::PreIncBracketNode::isIncrement):
(KJS::PreDecBracketNode::):
(KJS::PreDecBracketNode::isIncrement):
(KJS::PrefixDotNode::):
(KJS::PrefixDotNode::precedence):
(KJS::PreIncDotNode::):
(KJS::PreIncDotNode::isIncrement):
(KJS::PreDecDotNode::):
(KJS::ReadModifyResolveNode::):
(KJS::ReadModifyLocalVarNode::):
(KJS::AssignResolveNode::):
(KJS::AssignResolveNode::precedence):
* kjs/nodes2string.cpp:
(KJS::PostIncResolveNode::streamTo):
(KJS::PostDecResolveNode::streamTo):
(KJS::PostfixBracketNode::streamTo):
(KJS::PostfixDotNode::streamTo):
(KJS::PreIncResolveNode::streamTo):
(KJS::PreDecResolveNode::streamTo):
(KJS::ReadModifyResolveNode::streamTo):
(KJS::AssignResolveNode::streamTo):
2007-10-29 Maciej Stachowiak <mjs@apple.com>
Not reviewed, build fix.
- Include Vector.h in a way that actually works.
* kjs/LocalStorage.h:
2007-10-29 Maciej Stachowiak <mjs@apple.com>
Not reviewed, build fix.
- Install LocalStorage.h as a private header.
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-10-29 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/LocalStorage.h: Added.
(KJS::LocalStorageEntry::LocalStorageEntry):
(WTF::):
* kjs/function.h:
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
2007-10-29 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Some small tweaks that I notice while reviewing Oliver's last patch.
Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
No change in SunSpider because SunSpider doesn't take the code path that
would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
* kjs/nodes.cpp:
(KJS::LocalVarPostfixNode::evaluate):
(KJS::TypeOfResolveNode::optimizeVariableAccess):
(KJS::LocalVarTypeOfNode::evaluate):
(KJS::PrefixResolveNode::optimizeVariableAccess):
(KJS::LocalVarPrefixNode::evaluate):
(KJS::AssignResolveNode::optimizeVariableAccess):
(KJS::LocalVarAssignNode::evaluate):
* kjs/nodes.h:
(KJS::LocalVarTypeOfNode::):
(KJS::PrefixResolveNode::):
(KJS::LocalVarPrefixNode::):
(KJS::AssignResolveNode::):
(KJS::LocalVarAssignNode::):
2007-10-29 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
SunSpider claims this was a 0.7% speedup.
* kjs/string_object.cpp:
(KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
2007-10-29 Maciej Stachowiak <mjs@apple.com>
Reviewed by Mark.
- re-enable asserts for access to empty or deleted keys
* wtf/HashTable.h:
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
(WTF::::add):
2007-10-29 Eric Seidel <eric@webkit.org>
Build fix only, no review.
* JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
2007-10-29 Mark Rowe <mrowe@apple.com>
Gtk build fix. Move struct declarations into nodes.h.
* kjs/grammar.y:
* kjs/nodes.h:
2007-10-29 Eric Seidel <eric@webkit.org>
Reviewed by darin.
Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
Make it a compile time error to use toString(ExecState) on a StringInstance
SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
* kjs/internal.h:
(KJS::StringImp::getLength):
* kjs/string_object.cpp:
(KJS::StringInstance::lengthGetter):
(KJS::StringInstance::inlineGetOwnPropertySlot):
(KJS::StringInstance::getOwnPropertySlot):
* kjs/string_object.h:
2007-10-28 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Add nodes to allow Assignment, TypeOf, and prefix operators to
make use of the new optimised local variable look up.
5% gain on sunspider
* kjs/nodes.cpp:
(KJS::TypeOfResolveNode::optimizeVariableAccess):
(KJS::LocalTypeOfAccessNode::evaluate):
(KJS::PrefixResolveNode::optimizeVariableAccess):
(KJS::PrefixLocalAccessNode::evaluate):
(KJS::AssignResolveNode::optimizeVariableAccess):
(KJS::AssignLocalAccessNode::evaluate):
* kjs/nodes.h:
(KJS::TypeOfResolveNode::):
(KJS::TypeOfResolveNode::precedence):
(KJS::LocalTypeOfAccessNode::):
(KJS::PrefixResolveNode::):
(KJS::PrefixResolveNode::precedence):
(KJS::PrefixLocalAccessNode::):
(KJS::AssignResolveNode::):
(KJS::AssignLocalAccessNode::):
2007-10-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
http://bugs.webkit.org/show_bug.cgi?id=15748
Not a significant speedup or slowdown on SunSpider.
* kjs/Parser.cpp:
(KJS::clearNewNodes):
* kjs/Parser.h:
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::BlockNode::BlockNode):
(KJS::CaseBlockNode::CaseBlockNode):
(KJS::FunctionBodyNode::FunctionBodyNode):
(KJS::SourceElementsNode::SourceElementsNode):
(KJS::ProgramNode::ProgramNode):
* kjs/nodes.h:
(KJS::ElementNode::):
(KJS::ArrayNode::):
(KJS::PropertyListNode::):
(KJS::ObjectLiteralNode::):
(KJS::ArgumentListNode::):
(KJS::ArgumentsNode::):
(KJS::VarDeclListNode::):
(KJS::VarStatementNode::):
(KJS::ForNode::):
(KJS::ParameterNode::):
(KJS::FuncExprNode::):
(KJS::FuncDeclNode::):
(KJS::SourceElementsNode::):
(KJS::CaseClauseNode::):
(KJS::ClauseListNode::):
2007-10-28 Mark Rowe <mrowe@apple.com>
Disable assertions in a manner that doesn't break the Qt Windows build.
* wtf/HashTable.h:
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
2007-10-28 Geoffrey Garen <ggaren@apple.com>
Temporarily disabling some ASSERTs I introduced in my last check-in
because of http://bugs.webkit.org/show_bug.cgi?id=15747
Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT
* wtf/HashTable.h:
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
(WTF::::add):
2007-10-28 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15746
#ifndef ASSERT_DISABLED is no good!
Replaced with #if !ASSERT_DISABLED.
* wtf/HashTable.h:
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
(WTF::::add):
2007-10-28 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode
to the AST transfom that replaces slow resolve nodes with fast local
variable alternatives.
2.5% speedup on SunSpider.
Also added some missing copyright notices.
* kjs/nodes.cpp:
(KJS::FunctionCallResolveNode::optimizeVariableAccess):
(KJS::FunctionCallResolveNode::evaluate):
(KJS::LocalVarFunctionCallNode::evaluate):
(KJS::PostfixResolveNode::optimizeVariableAccess):
(KJS::PostfixResolveNode::evaluate):
(KJS::LocalVarPostfixNode::evaluate):
(KJS::DeleteResolveNode::optimizeVariableAccess):
(KJS::DeleteResolveNode::evaluate):
(KJS::LocalVarDeleteNode::evaluate):
* kjs/nodes.h:
(KJS::FunctionCallResolveNode::):
(KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode):
(KJS::PostfixResolveNode::):
(KJS::LocalVarPostfixNode::LocalVarPostfixNode):
(KJS::DeleteResolveNode::):
(KJS::LocalVarDeleteNode::LocalVarDeleteNode):
2007-10-28 Eric Seidel <eric@webkit.org>
Reviewed by darin.
Inline UString::Rep::deref() for a 0.8% improvement in SunSpider
Add virtual keyword to a few virtual functions previously unmarked.
* kjs/internal.h:
(KJS::StringImp::type):
(KJS::NumberImp::type):
* kjs/ustring.h:
(KJS::UString::Rep::deref):
2007-10-28 Darin Adler <darin@apple.com>
- fix "broken everything" from the storage leak fix
* wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor.
* kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr.
2007-10-28 Darin Adler <darin@apple.com>
Reviewed by Adam.
- turn on unused parameter waring on Mac OS X because it's already on elsewhere
* Configurations/Base.xcconfig: Took out -wno-unused-parameter.
* API/JSNode.c:
* API/JSNodeList.c:
* API/minidom.c:
* API/testapi.c:
Fixed unused variables by using them or marked them with UNUSED_PARAM.
* kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc):
Removed parameter names to indicate they are unused.
2007-10-28 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix a storage leak where we ref the UString every time we replace
a ResolveNode with a LocalVarAccessNode
* kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
that takes PlacementNewAdopt.
* kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
with PlacementNewAdopt instead of the old value of ident.
* kjs/ustring.h: (KJS::UString::UString): Added a constructor that
takes PlacementNewAdopt.
2007-10-28 Darin Adler <darin@apple.com>
- Windows build fix; get rid of unused parameter
* kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it.
* kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it.
The assertions weren't all that helpful.
2007-10-28 Mark Rowe <mrowe@apple.com>
Gtk build fix. Add include of MathExtras.h.
* kjs/string_object.cpp:
2007-10-28 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej and Tim.
Replace uses of isNaN and isInf with isnan and isinf, and
remove isNaN and isInf.
* kjs/config.h: Remove unused HAVE_'s.
* kjs/date_object.cpp:
(KJS::DateInstance::getTime):
(KJS::DateInstance::getUTCTime):
(KJS::DateProtoFunc::callAsFunction):
(KJS::DateObjectImp::construct):
(KJS::DateObjectFuncImp::callAsFunction):
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction):
* kjs/math_object.cpp:
(MathFuncImp::callAsFunction):
* kjs/nodes2string.cpp:
(KJS::isParserRoundTripNumber):
* kjs/number_object.cpp:
(NumberProtoFunc::callAsFunction):
* kjs/operations.cpp:
* kjs/operations.h:
* kjs/string_object.cpp:
(KJS::StringProtoFunc::callAsFunction):
* kjs/ustring.cpp:
(KJS::UString::from):
* kjs/value.cpp:
(KJS::JSValue::toInteger):
(KJS::JSValue::toInt32SlowCase):
(KJS::JSValue::toUInt32SlowCase):
2007-10-28 Geoffrey Garen <ggaren@apple.com>
Build fix: use the new-fangled missingSymbolMarker().
* kjs/nodes.cpp:
(KJS::ResolveNode::optimizeVariableAccess):
* kjs/nodes.h:
(KJS::LocalVarAccessNode::LocalVarAccessNode):
2007-10-28 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak, Darin Adler.
Much supporting work done by Maciej Stachowiak, Maks Orlovich, and
Cameron Zwarich.
AST transfom to replace slow resolve nodes with fast local variable
alternatives that do direct memory access. Currently, only ResolveNode
provides a fast local variable alternative. 6 others are soon to come.
16.7% speedup on SunSpider.
Most of this patch is just scaffolding to support iterating all the
resolve nodes in the AST through optimizeResolveNodes(). In
optimizeResolveNodes(), most classes just push their child nodes onto
the processing stack, while ResolveNodes actually replace themselves in
the tree with more optimized alternatives, if possible.
Here are the interesting bits:
* kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations
in Node and ResolveNode. This tag allows you to use placement new to
swap out a base class Node in favor of a subclass copy that holds the
same data. (Without this tag, default initialization would NULL out
RefPtrs, change line numbers, etc.)
* kjs/nodes.cpp:
(KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT
that the fast path is impossible, to make sure we didn't leave anything
on the table.
(KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST
transformation happens.
(KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
optimization happens.
* kjs/function.h: Added symbolTable() accessor for, for the sake of
an ASSERT.
2007-10-28 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej.
Fix "AllInOneFile.o has a global initializer in it".
Some versions of gcc generate a global initializer for std::numeric_limits<size_t>::max().
We can avoid this by moving it inside an inline function.
* kjs/SymbolTable.h:
(KJS::missingSymbolMarker):
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot):
(KJS::ActivationImp::put):
2007-10-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Mark.
- Added assertions to protect against adding empty or deleted keys to a HashTable
* wtf/HashTable.h:
(WTF::HashTable::lookup):
(WTF::HashTable::lookupForWriting):
(WTF::HashTable::fullLookupForWriting):
(WTF::HashTable::add):
2007-10-28 Darin Adler <darin@apple.com>
- fix GTK build
* kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
Use isNaN and isInf instead of isnan and isinf.
2007-10-28 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15735
remove GroupNode to simplify AST and possibly get a modest speedup
This patch removes 4 node types: GroupNode, PropertyNameNode,
FunctionCallParenBracketNode, and FunctionCallParenDotNode.
To remove GroupNode, we add knowledge of precedence to the tree nodes,
and use that when serializing to determine where parentheses are needed.
This means we no longer have to represent parentheses in the tree.
The precedence values are named after productions in the grammar from the
JavaScript standard.
SunSpider says this is an 0.4% speedup.
* kjs/function.h:
* kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
serialization, so I moved it to the file that takes care of that.
* kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
indicate failure instead of a separate boolean. Got rid of PropertyNameNode
by merging the PropertyName rule into the Property rule (which was easier
than figuring out how to pass the Identifier from one node to another).
Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
and FunctionCallParenDotNode.
* kjs/nodes.h: Removed unused forward declarations and Operator values.
Added Precedence enum, and precedence function to all nodes. Removed
nodeInsideAllParens. Added streamBinaryOperator function for serialization.
Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
* kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
(KJS::PropertyListNode::evaluate): Changed code to get name directly instead
of converting it from an Identifier to a jsString then back to a UString
then into an Identifier again!
* kjs/nodes2string.cpp: Changed special-token implementation to use a separate
function for each of Endl, Indent, Unindent, and DotExpr instead of using a
single function with a switch. Added a precedence that you can stream in, to
cause the next node serialized to add parentheses based on that precedence value.
(KJS::operatorString): Moved to the top of the file.
(KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
workaround for snprintf, since StringExtras.h takes care of that.
(KJS::operator<<): Made the char and char* versions faster by using UString's
character append functions instead of constructing a UString. Added the logic
to the Node* version to add parentheses if needed.
(KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
(KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
(KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
the bracket.
(KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
(KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
(KJS::NewExprNode::streamTo): Use PrecMember for the expression.
(KJS::FunctionCallValueNode::streamTo): Use PrecCall.
(KJS::FunctionCallBracketNode::streamTo): Ditto.
(KJS::FunctionCallDotNode::streamTo): Ditto.
(KJS::PostfixBracketNode::streamTo): Ditto.
(KJS::PostfixDotNode::streamTo): Ditto.
(KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
(KJS::DeleteBracketNode::streamTo): Use PrecCall.
(KJS::DeleteDotNode::streamTo): Ditto.
(KJS::DeleteValueNode::streamTo): Use PrecUnary.
(KJS::VoidNode::streamTo): Ditto.
(KJS::TypeOfValueNode::streamTo): Ditto.
(KJS::PrefixBracketNode::streamTo): Use PrecCall.
(KJS::PrefixDotNode::streamTo): Ditto.
(KJS::PrefixErrorNode::streamTo): Use PrecUnary.
(KJS::UnaryPlusNode::streamTo): Ditto.
(KJS::NegateNode::streamTo): Ditto.
(KJS::BitwiseNotNode::streamTo): Ditto.
(KJS::LogicalNotNode::streamTo): Ditto.
(KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
(KJS::DivNode::streamTo): Ditto.
(KJS::ModNode::streamTo): Ditto.
(KJS::AddNode::streamTo): Ditto.
(KJS::SubNode::streamTo): Ditto.
(KJS::LeftShiftNode::streamTo): Ditto.
(KJS::RightShiftNode::streamTo): Ditto.
(KJS::UnsignedRightShiftNode::streamTo): Ditto.
(KJS::LessNode::streamTo): Ditto.
(KJS::GreaterNode::streamTo): Ditto.
(KJS::LessEqNode::streamTo): Ditto.
(KJS::GreaterEqNode::streamTo): Ditto.
(KJS::InstanceOfNode::streamTo): Ditto.
(KJS::InNode::streamTo): Ditto.
(KJS::EqualNode::streamTo): Ditto.
(KJS::NotEqualNode::streamTo): Ditto.
(KJS::StrictEqualNode::streamTo): Ditto.
(KJS::NotStrictEqualNode::streamTo): Ditto.
(KJS::BitAndNode::streamTo): Ditto.
(KJS::BitXOrNode::streamTo): Ditto.
(KJS::BitOrNode::streamTo): Ditto.
(KJS::LogicalAndNode::streamTo): Ditto.
(KJS::LogicalOrNode::streamTo): Ditto.
(KJS::ConditionalNode::streamTo): Ditto.
(KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
(KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
the bracket and PrecAssignment for the right side.
(KJS::AssignDotNode::streamTo): Ditto.
(KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
and PrecAssignment for the right side.
(KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
(KJS::AssignExprNode::streamTo): Use PrecAssignment.
2007-10-28 Kevin Ollivier <kevino@theolliviers.com>
Define wx port and set wx port USE options.
Reviewed by Adam Roben.
* wtf/Platform.h:
2007-10-28 Mark Rowe <mrowe@apple.com>
We don't include "config.h" in headers.
* bindings/jni/jni_instance.h:
* kjs/regexp.h:
* wtf/TCPageMap.h:
* wtf/TCSpinLock.h:
2007-10-28 Maciej Stachowiak <mjs@apple.com>
Rubber stamped by Mark.
- avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
* kjs/SymbolTable.h:
(KJS::SymbolTableIndexHashTraits::emptyValue):
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot):
(KJS::ActivationImp::put):
2007-10-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
- switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
* kjs/SymbolTable.h:
(KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
(KJS::IdentifierRepHash::equal): ditto
(KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
(KJS::SymbolTable): change to a typedef for a HashMap.
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
(KJS::ActivationImp::deleteProperty): ditto
(KJS::ActivationImp::put): ditto
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
you now have to store a UString::rep, not an identifier.
2007-10-27 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- numerous HashTable performance improvements
This does not quite add up to a measurable win on SunSpider, but it allows a
follow-on > 3% improvement and probably helps WebCore too.
I made the following improvements, among others:
- Made HashFunctions note whether it is ok to compare a real value with the equal() function
to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
- Specialized lookup so it doesn't have to do so many extra branches and build so many extra
std::pairs for cases that don't need them. There are now four versions, one for read-only access,
two for writing, and one folded directly into add() (these all were improvments).
- Made HashMap::get() use lookup() directly instead of find() to avoid having to build iterators.
- Made a special constructor for iterators that knows it points to
a valid filled cell and so skips updating itself.
- Reordered memory accesses in the various lookup functions for better code generation
- Made simple translators avoid passing a hash code around
- Other minor tweaks
* wtf/HashTable.h:
(WTF::):
(WTF::HashTableConstIterator::HashTableConstIterator):
(WTF::HashTableIterator::HashTableIterator):
(WTF::IdentityHashTranslator::translate):
(WTF::HashTable::end):
(WTF::HashTable::lookup):
(WTF::HashTable::lookupForWriting):
(WTF::HashTable::makeKnownGoodIterator):
(WTF::HashTable::makeKnownGoodConstIterator):
(WTF::::lookup):
(WTF::::lookupForWriting):
(WTF::::fullLookupForWriting):
(WTF::::add):
(WTF::::addPassingHashCode):
(WTF::::reinsert):
(WTF::::find):
(WTF::::contains):
* kjs/identifier.cpp:
(WTF::):
* wtf/HashFunctions.h:
(WTF::):
* wtf/HashMap.h:
(WTF::):
(WTF::::get):
* wtf/HashSet.h:
(WTF::):
(WTF::::add):
* wtf/ListHashSet.h:
(WTF::ListHashSetTranslator::translate):
2007-10-27 Darin Adler <darin@apple.com>
Reviewed by Eric.
- fix ASCIICType.h for some Windows compiles
* wtf/ASCIICType.h: Check the compiler, not the OS, since it's the
compiler/library that has the wchar_t that is just a typedef.
2007-10-27 Kevin McCullough <kmccullough@apple.com>
- BuildFix
- Forgot to change the build step when I changed the filename.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-10-27 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep::
computedHash()"
http://bugs.webkit.org/show_bug.cgi?id=15718
* kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a
hash value. Also changed O(n) strlen to O(1) check for empty string.
(KJS::Identifier::add):
* kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string.
(KJS::UString::UString):
(KJS::UString::operator=):
2007-10-27 Darin Adler <darin@apple.com>
Reviewed by Eric.
- fix pow on Windows
* wtf/MathExtras.h: (wtf_pow): Add a special case for MSVC, which has
a "pow" function that does not properly handle the case where arg1 is
NaN and arg2 is 0.
* kjs/math_object.cpp: (MathFuncImp::callAsFunction): Don't explicity
specify "::pow" -- just "pow" is fine.
2007-10-27 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15711
force JSImmediate to be inlined for roughly 1.2% SunSpider speedup
* kjs/JSImmediate.h: Put ALWAYS_INLINE on everything.
* kjs/object.h: Removed redundant includes.
* kjs/value.h: Ditto.
2007-10-27 Maciej Stachowiak <mjs@apple.com>
Reviewed by Mark.
- fixed "ASSERTION FAILED: _hash in KJS::UString::Rep::computedHash()"
http://bugs.webkit.org/show_bug.cgi?id=15718
* kjs/identifier.cpp:
(KJS::Identifier::addSlowCase): Ensure that empty Identifiers have a hash computed,
now that we count on all Identifiers already having one.
2007-10-27 Mark Rowe <mrowe@apple.com>
Silence a warning.
* kjs/SymbolTable.h:
2007-10-27 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/function.h:
2007-10-26 Kevin McCullough <kmccullough@apple.com>
Rubber stamp by Adam.
- Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
files contain are functions that operate on BSTRs.
* API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
* API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
* API/JSStringRefCOM.cpp: Removed.
* API/JSStringRefCOM.h: Removed.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-10-26 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam.
- Made JSStringCreateWithBSTR capable of handling null BSTRs.
* API/JSStringRefCOM.cpp:
(JSStringCreateWithBSTR):
2007-10-26 Sam Weinig <sam@webkit.org>
Windows build fix.
* kjs/SymbolTable.h: Add header gaurd.
* kjs/nodes.h: #include "SymbolTable.h"
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Suggested by Anders Carlsson.
Fixed tyop.
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot):
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Suggested by Darin Adler.
Use computedHash(), which is safer than just directly accessing _hash.
* kjs/lookup.cpp:
(KJS::Lookup::findEntry):
(KJS::Lookup::find):
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Build fix: svn add SymbolTable.h
* kjs/SymbolTable.h: Added.
(KJS::SymbolTable::set):
(KJS::SymbolTable::get):
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Build fix: export SymbolTable.h to WebCore.
* JavaScriptCore.xcodeproj/project.pbxproj:
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Comment tweak suggested by Maciej.
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot):
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
* kjs/property_map.cpp: Use a special no branch accessor to the UString's
hash value. Also, return immediately instead of branching to the end
of the loop if the value is not found.
(KJS::PropertyMap::get):
(KJS::PropertyMap::getLocation):
(KJS::PropertyMap::put):
(KJS::PropertyMap::insert):
(KJS::PropertyMap::remove):
(KJS::PropertyMap::checkConsistency):
* kjs/ustring.h:
(KJS::UString::Rep::computedHash): Special no branch accessor to the
UString's hash value. Used when the caller knows that the hash value
has already been computed. (For example, if the caller got the UString
from an Identifier.)
2007-10-26 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Switched ActivationImp to using a symbol table. For now, though, all
clients take the slow path.
Net .6% speedup on SunSpider.
Slowdowns:
- ActivationImp now mallocs in its constructor
- Local variable hits use an extra level of indirection to retrieve
data
- Local variable misses do two lookups
Speedups:
- Fast initialization of local variables upon function entry
* JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
* kjs/function.cpp:
(KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
data that won't fit in a JSCell.
(KJS::ActivationImp::argumentsGetter): Use slow symbol table path for
lookup.
(KJS::ActivationImp::getOwnPropertySlot): ditto
(KJS::ActivationImp::deleteProperty): ditto
(KJS::ActivationImp::put): ditto
(KJS::ActivationImp::createArgumentsObject): ditto
(KJS::ActivationImp::mark): Call JSObject::mark first so that one of
our properties doesn't try to recursively mark us. (This caused a crash
in earlier testing. Not sure why we haven't run into it before.)
* kjs/nodes.cpp: Functions now build a symbol table the first time
they're called.
(KJS::VarDeclNode::evaluate):
(KJS::FunctionBodyNode::FunctionBodyNode):
(KJS::FunctionBodyNode::initializeSymbolTable):
(KJS::FunctionBodyNode::processDeclarations):
(KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
(KJS::FunctionBodyNode::processDeclarationsForProgramCode):
* kjs/nodes.h:
(KJS::FunctionBodyNode::symbolTable):
* wtf/Forward.h: Added Vector.
2007-10-26 Kevin McCullough <kmccullough@apple.com>
- Corrected function name mistake in this changelog.
2007-10-26 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam and Steve.
- Added convenience methods for converting between BSTR and JSStringRefs
* API/JSStringRefCOM.cpp: Added.
(JSStringCreateWithBSTR):
(JSStringCopyBSTR):
* API/JSStringRefCOM.h: Added.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-10-26 Mark Rowe <mrowe@apple.com>
Windows build fix.
* kjs/collector.cpp:
(KJS::Collector::collect):
2007-10-26 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
* kjs/CollectorHeapIntrospector.cpp:
(KJS::CollectorHeapIntrospector::init):
(KJS::CollectorHeapIntrospector::enumerate):
* kjs/CollectorHeapIntrospector.h:
* kjs/collector.cpp:
(KJS::Collector::recordExtraCost):
(KJS::Collector::heapAllocate):
(KJS::Collector::allocate):
(KJS::Collector::allocateNumber):
(KJS::Collector::registerThread):
(KJS::Collector::markStackObjectsConservatively):
(KJS::Collector::markMainThreadOnlyObjects):
(KJS::Collector::sweep):
(KJS::Collector::collect):
* kjs/collector.h:
* kjs/internal.h:
(KJS::NumberImp::operator new):
Force numbers to be allocated in the secondary heap.
2007-10-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.
* kjs/value.h:
(KJS::JSValue::getUInt32):
(KJS::JSValue::getTruncatedInt32):
(KJS::JSValue::toNumber):
* wtf/PassRefPtr.h:
(WTF::PassRefPtr::~PassRefPtr):
* wtf/RefPtr.h:
(WTF::RefPtr::operator->):
2007-10-26 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/ExecState.h:
2007-10-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Mark.
- Merge Context class fully into ExecState, since they are always created and used together.
No measurable performance impact but this is a useful cleanup.
* JavaScriptCore.pri:
* kjs/ExecState.cpp:
(KJS::ExecState::ExecState):
(KJS::ExecState::~ExecState):
(KJS::ExecState::mark):
(KJS::ExecState::lexicalInterpreter):
* kjs/ExecState.h:
(KJS::ExecState::dynamicInterpreter):
(KJS::ExecState::setException):
(KJS::ExecState::clearException):
(KJS::ExecState::exception):
(KJS::ExecState::exceptionSlot):
(KJS::ExecState::hadException):
(KJS::ExecState::scopeChain):
(KJS::ExecState::callingExecState):
(KJS::ExecState::propertyNames):
* kjs/collector.cpp:
(KJS::Collector::reportOutOfMemoryToAllInterpreters):
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
(KJS::FunctionImp::argumentsGetter):
(KJS::FunctionImp::callerGetter):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/interpreter.cpp:
(KJS::Interpreter::Interpreter):
(KJS::Interpreter::init):
(KJS::Interpreter::evaluate):
(KJS::Interpreter::mark):
* kjs/interpreter.h:
(KJS::Interpreter::setCurrentExec):
(KJS::Interpreter::currentExec):
* kjs/nodes.cpp:
(KJS::currentSourceId):
(KJS::currentSourceURL):
(KJS::ThisNode::evaluate):
(KJS::ResolveNode::evaluate):
(KJS::FunctionCallResolveNode::evaluate):
(KJS::PostfixResolveNode::evaluate):
(KJS::DeleteResolveNode::evaluate):
(KJS::TypeOfResolveNode::evaluate):
(KJS::PrefixResolveNode::evaluate):
(KJS::AssignResolveNode::evaluate):
(KJS::VarDeclNode::evaluate):
(KJS::DoWhileNode::execute):
(KJS::WhileNode::execute):
(KJS::ForNode::execute):
(KJS::ForInNode::execute):
(KJS::ContinueNode::execute):
(KJS::BreakNode::execute):
(KJS::ReturnNode::execute):
(KJS::WithNode::execute):
(KJS::SwitchNode::execute):
(KJS::LabelNode::execute):
(KJS::TryNode::execute):
(KJS::FunctionBodyNode::processDeclarationsFunctionCode):
(KJS::FunctionBodyNode::processDeclarationsProgramCode):
(KJS::FunctionBodyNode::processDeclarations):
(KJS::FuncDeclNode::makeFunction):
(KJS::FuncExprNode::evaluate):
2007-10-26 Mark Rowe <mrowe@apple.com>
Windows build fix.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-10-26 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* JavaScriptCore.pri:
* kjs/ExecState.cpp:
2007-10-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- moved Context class into ExecState.{h,cpp} in preparation for merging
ExecState and Context classes.
* kjs/ExecState.h: Moved CodeType enum and Context class here in
preparation for merging ExecState and Context.
* kjs/ExecState.cpp: Moved Context class here from Context.cpp.
(KJS::Context::Context):
(KJS::Context::~Context):
(KJS::Context::mark):
* kjs/context.h: Removed.
* kjs/Context.cpp: Removed.
* kjs/function.h: Removed CodeType enum.
* kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
* kjs/internal.h: Removed LabelStack.
* JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
* kjs/collector.cpp: Fixed includes.
* kjs/function.cpp: ditto
* kjs/internal.cpp: ditto
* kjs/interpreter.cpp: ditto
* kjs/lookup.h: ditto
* kjs/nodes.cpp: ditto
2007-10-26 Mark Rowe <mrowe@apple.com>
Windows build fix.
* kjs/string_object.cpp:
(KJS::StringObjectFuncImp::callAsFunction):
2007-10-25 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15703
fix numeric functions -- improve correctness and speed
Gives about 1% gain on SunSpider.
* kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
(KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
with both immediate and number values.
(KJS::JSValue::toUInt32): Ditto.
* kjs/value.cpp:
(KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
differences. One is that it now correctly returns 0 for NaN, and another is that
there's no special case for 0 or infinity, since the general case already handles
those correctly.
(KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
check for NaN.
(KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
truncation done by the typecast already does the necessary truncation that
roundValue was doing.
(KJS::JSValue::toUInt32SlowCase): Ditto.
(KJS::JSValue::toUInt16): Removed.
* kjs/internal.h: Removed roundValue.
* kjs/internal.cpp: Ditto.
* kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
code to handle NaN in Array.slice; toInteger now never returns NaN as specified.
* kjs/date_object.cpp:
(KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
toNumber as specified.
(KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
with a call to toNumber and timeClip as specified.
(KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
where the default behavior of toInt32 (returning 0) was already correct. Replaced
call to roundValue with a call to toNumber as specified.
(KJS::DateObjectFuncImp::callAsFunction): Ditto.
* kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
cases for the pow function that the library already handles correctly.
* kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
The real toInteger now returns 0 for NaN. Took out unneeded special case in
ToFixed for undefined; was only needed because our toInteger was wrong. Same
thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.
* kjs/string_object.cpp:
(KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
cases for undefined that were only needed because toInteger was wrong. Same in
IndexOf, and was able to remove some special cases. In LastIndexOf, used
toIntegerPreserveNaN, but was able to remove some special cases there too.
Changed Substr implementation to preserve correct behavior with the change
to toInteger and match the specification. Also made sure we weren't converting
an out of range double to an int.
(KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
no reason to have toUInt16 as a second, less-optimized function that's only
called at this one call site.
* wtf/MathExtras.h: Added trunc function for Windows.
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Tweaked the inner hashtable lookup loop to remove a branch in the "not
found" case. .5% speedup on SunSpider.
* JavaScriptCore.xcodeproj/project.pbxproj:
* wtf/HashTable.h:
(WTF::::lookup):
2007-10-25 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider
* kjs/nodes.cpp:
(KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
adding any value over toNumber() here.
(KJS::valueForReadModifyAssignment): Ditto.
(KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
and branches.
(KJS::lessThanEq): Ditto.
* JavaScriptCore.exp: Export new functions as needed.
* kjs/value.h:
(KJS::JSValue::toPrimitive): Fixed formatting.
(KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
to number and tells you whether a toPrimitive() conversion with a Number hint
would have given a string.
* kjs/internal.cpp:
(KJS::StringImp::getPrimitiveNumber): Implemented.
(KJS::NumberImp::getPrimitiveNumber): ditto
(KJS::GetterSetterImp::getPrimitiveNumber): ditto
(KJS::StringImp::toPrimitive): Fixed formatting.
(KJS::NumberImp::toPrimitive): ditto
(KJS::GetterSetterImp::toPrimitive): ditto
* kjs/internal.h:
* kjs/object.cpp:
(KJS::JSObject::getPrimitiveNumber): Implemented.
* kjs/object.h:
2007-10-25 Sam Weinig <sam@webkit.org>
Reviewed by Adam Roben.
Remove JSStringRefCFHack from windows as it is no longer needed.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Rolled out my last patch. It turns out that I needed 2 words, not 1,
so it didn't help.
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15694
Shrink the size of an activation object by 1 word
This is in preparation for adding a symbol table to the activation
object.
The basic strategy here is to rely on the mutual exclusion between
the arguments object pointer and the function pointer (you only need
the latter in order to create the former), and store them in the same
place. The LazyArgumentsObject class encapsulates this strategy.
Also inlined the ArgumentsImp constructor, for good measure.
SunSpider reports no regression. Regression tests pass.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/Context.cpp:
(KJS::Context::~Context):
* kjs/function.cpp:
(KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject):
(KJS::ActivationImp::LazyArgumentsObject::mark):
(KJS::):
(KJS::ActivationImp::argumentsGetter):
(KJS::ActivationImp::mark):
* kjs/function.h:
(KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject):
(KJS::ActivationImp::LazyArgumentsObject::getOrCreate):
(KJS::ActivationImp::LazyArgumentsObject::resetArguments):
(KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject):
(KJS::ActivationImp::LazyArgumentsObject::argumentsObject):
(KJS::ActivationImp::LazyArgumentsObject::setFunction):
(KJS::ActivationImp::LazyArgumentsObject::function):
(KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject):
(KJS::ActivationImp::LazyArgumentsObject::):
(KJS::ActivationImp::ActivationImp::ActivationImp):
(KJS::ActivationImp::resetArguments):
2007-10-25 Adam Roben <aroben@apple.com>
Change JavaScriptCore.vcproj to use DerivedSources.make
We were trying to emulate the logic of make in
build-generated-files.sh, but we got it wrong. We now use a
build-generated-files very much like the one that WebCore uses to
invoke make.
We also now only have a Debug configuration of dftables which we build
even when doing a Release build of JavaScriptCore. dftables also no
longer has the "_debug" name suffix.
Changes mostly made by Darin, reviewed by me.
* DerivedSources.make: Add a variable to set the extension used for
the dftables executable.
* JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug
dftables in Release configurations.
* JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
- Updated include path to point to the new location of the derived
sources.
- Modified pre-build event to pass the right arguments to
build-generated-files.sh and not call dftables directly.
- Added the derived source files to the project.
- Removed grammarWrapper.cpp, which isn't needed now that we're
compiling grammar.cpp directly.
* JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
Slightly modified from the WebCore version.
* JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed.
* JavaScriptCore.vcproj/dftables/dftables.vcproj:
- Changed the output location to match Mac.
- Removed the Release configuration.
- Removed the _debug suffix.
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Eric Seidel.
Slightly elaborated the differences between declaration procesing in
Function Code and Program Code.
.3% speedup on SunSpider.
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::processDeclarationsFunctionCode):
(KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a
minimum set of attributes instead of recomputing all the time. Also,
ignore m_parameters, since programs don't have arguments.
2007-10-25 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
More preparation work before adding long-running mode to testkjs.
* kjs/testkjs.cpp:
(TestFunctionImp::callAsFunction):
(prettyPrintScript):
(runWithScripts):
(parseArguments):
(kjsmain):
(fillBufferWithContentsOfFile):
2007-10-25 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Bring testkjs code out of the dark ages in preparation for more
radical improvements (like long-running testing support!)
* kjs/testkjs.cpp:
(TestFunctionImp::callAsFunction):
(setupInterpreter):
(doIt):
(fillBufferWithContentsOfFile):
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Make a fast path for declaration processing inside Function Code.
Lifted declaration processing code up from individual declaration nodes
and into processDeclarations.
Broke out processDeclarations into two cases, depending on the type of
code. This eliminates 2 branches, and facilitates more radical
divergeance in the future.
2.5% SunSpider speedup.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/nodes.cpp:
(KJS::FunctionBodyNode::initializeDeclarationStacks):
(KJS::FunctionBodyNode::processDeclarationsFunctionCode):
(KJS::FunctionBodyNode::processDeclarationsProgramCode):
(KJS::FunctionBodyNode::execute):
(KJS::FuncDeclNode::makeFunction):
* kjs/nodes.h:
(KJS::):
2007-10-25 Maciej Stachowiak <mjs@apple.com>
Reviewed by Adam.
- add header includes needed on platforms that don't use AllInOneFile.cpp
* API/JSCallbackObject.cpp:
* kjs/Context.cpp:
* kjs/ExecState.cpp:
* kjs/array_instance.cpp:
* kjs/function_object.cpp:
* kjs/interpreter.cpp:
* kjs/nodes.cpp:
2007-10-25 Eric Seidel <eric@webkit.org>
Reviewed by Geoff.
* JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private
2007-10-25 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
Re-order declaration initialization to avoid calling hasProperty inside
VarDeclNode::processDeclaration
.7% speedup on SunSpider.
* kjs/function.h:
* kjs/function.cpp: Merged parameter processing into FunctionBodyNode's
other processing of declared symbols, so the order of execution could
change.
* kjs/nodes.cpp:
(KJS::VarDeclNode::getDeclarations): Added special case for the
"arguments" property name, explained in the comment.
(KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
in the case of function code, since we know the declared symbol
management will resolve conflicts between symbols. Yay!
(KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's
implementation of getDeclarations is non-trivial, we can't take a
short-cut here any longer -- we need to put the VarDecl node on the
stack so it gets processed normally.
(KJS::FunctionBodyNode::processDeclarations): Changed the order of
processing to enforce mutual exclusion rules.
* kjs/nodes.h:
(KJS::DeclarationStacks::DeclarationStacks): Structure includes an
ExecState now, for fast access to the "arguments" property name.
2007-10-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Add a JSGlobalObject class and remove the InterpreterMap
http://bugs.webkit.org/show_bug.cgi?id=15681
This required making JSCallbackObject a template class to allow for
JSGlobalObjects with JSCallbackObject functionality.
SunSpider claims this was a 0.5% speedup.
* API/JSCallbackObject.cpp:
(KJS::):
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp.
(KJS::::JSCallbackObject):
(KJS::::init):
(KJS::::~JSCallbackObject):
(KJS::::initializeIfNeeded):
(KJS::::className):
(KJS::::getOwnPropertySlot):
(KJS::::put):
(KJS::::deleteProperty):
(KJS::::implementsConstruct):
(KJS::::construct):
(KJS::::implementsHasInstance):
(KJS::::hasInstance):
(KJS::::implementsCall):
(KJS::::callAsFunction):
(KJS::::getPropertyNames):
(KJS::::toNumber):
(KJS::::toString):
(KJS::::setPrivate):
(KJS::::getPrivate):
(KJS::::inherits):
(KJS::::cachedValueGetter):
(KJS::::staticValueGetter):
(KJS::::staticFunctionGetter):
(KJS::::callbackGetter):
* API/JSClassRef.cpp:
(OpaqueJSClass::prototype):
* API/JSContextRef.cpp:
(JSGlobalContextCreate):
* API/JSObjectRef.cpp:
(JSObjectMake):
(JSObjectGetPrivate):
(JSObjectSetPrivate):
* API/JSValueRef.cpp:
(JSValueIsObjectOfClass):
* JavaScriptCore.exp:
* JavaScriptCore.xcodeproj/project.pbxproj:
* bindings/c/c_utility.cpp:
(KJS::Bindings::convertValueToNPVariant):
* bindings/jni/jni_jsobject.cpp:
* bindings/objc/objc_utility.mm:
(KJS::Bindings::convertValueToObjcValue):
* kjs/Context.cpp:
(KJS::Context::Context):
* kjs/ExecState.cpp:
(KJS::ExecState::lexicalInterpreter):
* kjs/JSGlobalObject.h: Added.
(KJS::JSGlobalObject::JSGlobalObject):
(KJS::JSGlobalObject::isGlobalObject):
(KJS::JSGlobalObject::interpreter):
(KJS::JSGlobalObject::setInterpreter):
* kjs/array_instance.cpp:
* kjs/context.h:
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/interpreter.cpp:
(KJS::Interpreter::Interpreter):
(KJS::Interpreter::init):
(KJS::Interpreter::~Interpreter):
(KJS::Interpreter::globalObject):
(KJS::Interpreter::initGlobalObject):
(KJS::Interpreter::evaluate):
* kjs/interpreter.h:
* kjs/lookup.h:
(KJS::cacheGlobalObject):
* kjs/object.h:
(KJS::JSObject::isGlobalObject):
* kjs/testkjs.cpp:
2007-10-24 Eric Seidel <eric@webkit.org>
Build fix for Gtk, no review.
* kjs/collector.cpp: #include "context.h"
2007-10-24 Eric Seidel <eric@webkit.org>
Reviewed by Maciej.
Stop checking isOutOfMemory after every allocation, instead let the collector
notify all ExecStates if we ever hit this rare condition.
SunSpider claims this was a 2.2% speedup.
* kjs/collector.cpp:
(KJS::Collector::collect):
(KJS::Collector::reportOutOfMemoryToAllInterpreters):
* kjs/collector.h:
* kjs/nodes.cpp:
(KJS::TryNode::execute):
2007-10-24 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/identifier.h: Remove extra qualification.
2007-10-24 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Disable ALWAYS_INLINE in debug builds, since it drives the debugger
crazy.
* wtf/AlwaysInline.h:
2007-10-24 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Inlined the fast path for creating an Identifier from an Identifier.
This is a .4% speedup on SunSpider overall, but as big as a 2.5%
speedup on certain individual tests. 65% of the Identifiers creating
by SunSpider are already Identifiers.
(The main reason I'm making this change is that it resolves a large
regression in a patch I haven't checked in yet.)
* JavaScriptCore.exp:
* kjs/identifier.cpp:
(KJS::Identifier::addSlowCase):
* kjs/identifier.h:
(KJS::Identifier::Identifier::add):
2007-10-24 Lars Knoll <lars@trolltech.com>
Reviewed by Simon.
some changes to the way JS values are converted to Qt values in the script bindings. Added support for converting JS arrays into QStringList's.
* bindings/qt/qt_instance.cpp:
(KJS::Bindings::QtInstance::invokeMethod):
* bindings/qt/qt_runtime.cpp:
(KJS::Bindings::convertValueToQVariant):
(KJS::Bindings::QtField::setValueToInstance):
2007-10-24 Oliver Hunt <oliver@apple.com>
Reviewed by Darin.
Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider
* kjs/nodes.cpp:
(KJS::lessThan):
(KJS::lessThanEq):
(KJS::LessNode::evaluate):
(KJS::GreaterNode::evaluate):
(KJS::LessEqNode::evaluate):
(KJS::GreaterEqNode::evaluate):
* kjs/operations.cpp:
* kjs/operations.h:
2007-10-24 Eric Seidel <eric@webkit.org>
Reviewed by darin.
* kjs/nodes.h:
(KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!)
2007-10-24 Darin Adler <darin@apple.com>
Reviewed by Eric.
* kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little
Identifier ref/deref for what SunSpider claims is a 0.4% speedup.
2007-10-24 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- separate out the code to create a hash table the first time from the code
to rehash
SunSpider claims this was a 0.7% speedup.
* kjs/property_map.cpp:
(KJS::PropertyMap::expand): Changed to call either createTable or rehash.
(KJS::PropertyMap::createTable): Added. For the case where we had no table.
(KJS::PropertyMap::rehash): Removed code needed only in the case where we
had no table.
* kjs/property_map.h: Added createTable.
2007-10-24 Eric Seidel <eric@webkit.org>
Reviewed by darin.
Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers
which can be represented by JSImmediate.
SunSpider claims this was a 0.6% speedup.
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::NumberNode::evaluate):
(KJS::ImmediateNumberNode::evaluate):
* kjs/nodes.h:
(KJS::Node::):
(KJS::ImmediateNumberNode::):
* kjs/nodes2string.cpp:
(ImmediateNumberNode::streamTo):
2007-10-24 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15657
change static hash tables to use powers of two for speed
Seems to give 0.7% SunSpider speedup.
* kjs/create_hash_table: Updated to generate new format.
* kjs/lookup.cpp:
(KJS::keysMatch): Took out unneeded typecast.
(KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert.
Replaced the modulus with a bit mask.
(KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed
their hash -- saves a branch.
(KJS::Lookup::find): Ditto.
* kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask.
2007-10-24 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup
* kjs/nodes.cpp:
(KJS::DoWhileNode::execute):
(KJS::WhileNode::execute):
(KJS::ForNode::execute):
(KJS::ForInNode::execute):
(KJS::SourceElementsNode::execute):
2007-10-23 Darin Adler <darin@apple.com>
Reviewed by Maciej.
* kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32):
Changed an && to an & for a 1% gain in SunSpider.
2007-10-23 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider.
* kjs/nodes.cpp:
(KJS::MultNode::evaluate):
(KJS::DivNode::evaluate):
(KJS::ModNode::evaluate):
(KJS::add):
(KJS::sub):
(KJS::AddNode::evaluate):
(KJS::SubNode::evaluate):
(KJS::valueForReadModifyAssignment):
* kjs/operations.cpp:
* kjs/operations.h:
2007-10-23 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Separating all of the simple (eg. non-read-modify-write) binary operators
into separate classes in preparation for further JS optimisations.
Happily this produces a 0.8% to 1.0% performance increase in SunSpider with
no further work.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::MultNode::evaluate):
(KJS::DivNode::evaluate):
(KJS::ModNode::evaluate):
(KJS::AddNode::evaluate):
(KJS::SubNode::evaluate):
(KJS::LeftShiftNode::evaluate):
(KJS::RightShiftNode::evaluate):
(KJS::UnsignedRightShiftNode::evaluate):
(KJS::LessNode::evaluate):
(KJS::GreaterNode::evaluate):
(KJS::LessEqNode::evaluate):
(KJS::GreaterEqNode::evaluate):
(KJS::InstanceOfNode::evaluate):
(KJS::InNode::evaluate):
(KJS::EqualNode::evaluate):
(KJS::NotEqualNode::evaluate):
(KJS::StrictEqualNode::evaluate):
(KJS::NotStrictEqualNode::evaluate):
(KJS::BitAndNode::evaluate):
(KJS::BitXOrNode::evaluate):
(KJS::BitOrNode::evaluate):
(KJS::LogicalAndNode::evaluate):
(KJS::LogicalOrNode::evaluate):
* kjs/nodes.h:
(KJS::MultNode::):
(KJS::DivNode::):
(KJS::ModNode::):
(KJS::AddNode::):
(KJS::SubNode::):
(KJS::LeftShiftNode::):
(KJS::RightShiftNode::):
(KJS::UnsignedRightShiftNode::):
(KJS::LessNode::):
(KJS::GreaterNode::):
(KJS::LessEqNode::):
(KJS::GreaterEqNode::):
(KJS::InstanceOfNode::):
(KJS::InNode::):
(KJS::EqualNode::):
(KJS::NotEqualNode::):
(KJS::StrictEqualNode::):
(KJS::NotStrictEqualNode::):
(KJS::BitAndNode::):
(KJS::BitOrNode::):
(KJS::BitXOrNode::):
(KJS::LogicalAndNode::):
(KJS::LogicalOrNode::):
* kjs/nodes2string.cpp:
(MultNode::streamTo):
(DivNode::streamTo):
(ModNode::streamTo):
(AddNode::streamTo):
(SubNode::streamTo):
(LeftShiftNode::streamTo):
(RightShiftNode::streamTo):
(UnsignedRightShiftNode::streamTo):
(LessNode::streamTo):
(GreaterNode::streamTo):
(LessEqNode::streamTo):
(GreaterEqNode::streamTo):
(InstanceOfNode::streamTo):
(InNode::streamTo):
(EqualNode::streamTo):
(NotEqualNode::streamTo):
(StrictEqualNode::streamTo):
(NotStrictEqualNode::streamTo):
(BitAndNode::streamTo):
(BitXOrNode::streamTo):
(BitOrNode::streamTo):
(LogicalAndNode::streamTo):
2007-10-23 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=15639
fix Math.abs(0), Math.ceil(-0), and Math.floor(-0)
Test: fast/js/math.html
* kjs/math_object.cpp: (MathFuncImp::callAsFunction):
Fix abs to look at the sign bit. Add a special case for values in the range
between -0 and -1 and a special case for ceil and for -0 for floor.
2007-10-23 Darin Adler <darin@apple.com>
Reviewed by Eric.
- streamline exception handling code for a >1% speed-up of SunSpider
* kjs/nodes.cpp: Changed macros to use functions for everything that's not
part of normal execution. We'll take function call overhead when propagating
an exception or out of memory.
(KJS::createOutOfMemoryCompletion): Added.
(KJS::substitute): Use append instead of the relatively inefficient + operator.
(KJS::Node::rethrowException): Added.
* kjs/nodes.h: Added rethrowException.
2007-10-22 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix http://bugs.webkit.org/show_bug.cgi?id=15636
some JavaScriptCore regression tests are failing due to numeric conversion
This should restore correctness and make speed better too, restoring some
of the optimization we lost in my last check-in.
* kjs/JSImmediate.h:
(KJS::JSImmediate::getTruncatedInt32): Added. Uses the range checking idiom
I used in my patch yesterday.
(KJS::JSImmediate::getTruncatedUInt32): Ditto.
* kjs/internal.h: Removed getInt32 and added getTruncatedInt/UInt32.
* kjs/internal.cpp:
(KJS::NumberImp::getUInt32): Changed to always use double, since I can't find
a way to write this more efficiently for float.
(KJS::NumberImp::getTruncatedInt32): Added.
(KJS::NumberImp::getTruncatedUInt32): Added.
* kjs/value.h: Removed getInt32 and added getTruncatedInt/UInt32.
(KJS::JSValue::getUInt32):
(KJS::JSValue::getTruncatedInt32): Added.
(KJS::JSValue::getTruncatedUInt32): Added.
(KJS::JSValue::toInt32): Changed getInt32 call to getTruncatedInt32.
(KJS::JSValue::toUInt32): Changed getUInt32 call to getTruncatedUInt32.
* kjs/value.cpp:
(KJS::JSCell::getTruncatedInt32): Added.
(KJS::JSCell::getTruncatedUInt32): Added.
(KJS::JSValue::toInteger): Changed getUInt32 call to getTruncatedInt32.
(KJS::JSValue::toInt32SlowCase): Removed extra getInt32 call I accidentally
had left in here.
(KJS::JSValue::toUInt32SlowCase): Ditto.
(KJS::JSValue::toUInt16): Changed getUInt32 call to getTruncatedUInt32.
* JavaScriptCore.exp: Updated.
2007-10-22 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix http://bugs.webkit.org/show_bug.cgi?id=15632
js1_5/Array/array-001.js test failing
One of the JavaScriptCore tests was failing; it failed because of
my change to NumberImp::getUInt32. The incorrect code I copied was
from JSImmediate::getUInt32, and was a pre-existing bug.
This patch fixes correctness, but will surely slow down SunSpider.
We may be able to code this tighter and get the speed back.
* kjs/JSImmediate.h:
(KJS::JSImmediate::getInt32): Renamed from toInt32 to more accurately
reflect the fact that this function only returns true if the value is
accurate (no fractional part, etc.). Changed code so that it returns
false when the value has a fraction.
(KJS::JSImmediate::getUInt32): Ditto.
* kjs/internal.cpp:
(KJS::NumberImp::getInt32): Changed code so that it returns false when
the value has a fraction. Restores the old behavior.
(KJS::NumberImp::getUInt32): Ditto.
* kjs/value.h:
(KJS::JSValue::getInt32): Updated for name change.
(KJS::JSValue::getUInt32): Ditto.
(KJS::JSValue::toInt32): Ditto.
(KJS::JSValue::toUInt32): Ditto.
2007-10-22 Darin Adler <darin@apple.com>
Reviewed by Brady.
- fix crash seen when running JavaScriptCore tests
* kjs/array_instance.cpp: (KJS::ArrayInstance::mark):
Copy and paste error: I accidentally had code here that was
making a copy of the HashMap -- that's illegal inside a mark
function and was unnecessary. The other callsite was modifying
the map as it iterated it, but this function is not.
2007-10-22 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- Avoid moving floats into integer registers in jsNumber() for 3% speedup on SunSpider
http://bugs.webkit.org/show_bug.cgi?id=15627
* kjs/JSImmediate.h:
(KJS::JSImmediate::fromDouble): Avoid moving floats to integer
registers since this is very slow.
2007-10-22 Darin Adler <darin@apple.com>
Reviewed by Eric Seidel.
- http://bugs.webkit.org/show_bug.cgi?id=15617
improve speed of integer conversions
Makes SunSpider 6% faster.
* kjs/JSImmediate.h: Added toInt32 and toUInt32, with separate versions for
32-bit and 64-bit.
* kjs/value.h:
(KJS::JSValue::getUInt32): Call JSImmediate::toUInt32.
* kjs/internal.h: Added getInt32.
* kjs/internal.cpp:
(KJS::NumberImp::getInt32): Added.
(KJS::NumberImp::getUInt32): Replaced with more-optimal implementation
stolen from JSValue.
* kjs/value.h:
(KJS::jsNumber): Marked ALWAYS_INLINE, because this wasn't getting
inlined.
(KJS::JSValue::getInt32): Added.
(KJS::JSValue::getUInt32): Changed to call the new JSImmediate::toUInt32
to avoid converting from float to double.
(KJS::JSValue::toInt32): Made inline, separated out the slow case.
(KJS::JSValue::toUInt32): Ditto.
* kjs/value.cpp:
(KJS::JSCell::getInt32): Added.
(KJS::JSValue::toInt32SlowCase): Renamed from toInt32. Changed to use the
new getInt32. Added a faster case for in-range numbers.
(KJS::JSValue::toUInt32SlowCase): Ditto.
(KJS::JSValue::toUInt16): Added a faster case for in-range numbers.
* JavaScriptCore.exp: Updated for changes.
2007-10-22 Adam Roben <aroben@apple.com>
Windows build fix
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn off
warning about implicit conversion to bool.
2007-10-22 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* kjs/array_instance.cpp:
2007-10-22 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15606
make cut-off for sparse vs. dense arrays smarter for speed with large arrays
Makes the morph test in SunSpider 26% faster, and the overall
benchmark 3% faster.
This also fixes some small problems we had with the distinction
between nonexistent and undefined values in arrays.
* kjs/array_instance.h: Tweaked formatting and naming.
* kjs/array_instance.cpp: Copied from kjs/array_object.cpp.
(KJS::storageSize): Added. Computes the size of the storage given a vector length.
(KJS::increasedVectorLength): Added. Implements the rule for resizing the vector.
(KJS::isDenseEnoughForVector): Added.
(KJS::ArrayInstance::ArrayInstance): Initialize the new fields.
(KJS::ArrayInstance::~ArrayInstance): Since m_storage is now never 0, delete it.
(KJS::ArrayInstance::getItem): Updated for name changes.
(KJS::ArrayInstance::lengthGetter): Ditto.
(KJS::ArrayInstance::inlineGetOwnPropertySlot): Added. Allows both versions of
getOwnPropertySlot to share more code.
(KJS::ArrayInstance::getOwnPropertySlot): Just refactored, no code change.
(KJS::ArrayInstance::put): Added logic for extending the vector as long as the
array is dense enough. Also keep m_numValuesInVector up to date.
(KJS::ArrayInstance::deleteProperty): Added code to keep m_numValuesInVector
up to date.
(KJS::ArrayInstance::getPropertyNames): Fixed bug where this would omit names
for array indices with undefined values.
(KJS::ArrayInstance::increaseVectorLength): Renamed from resizeStorage. Also
simplified to only handle getting larger.
(KJS::ArrayInstance::setLength): Added code to update m_numValuesInVector, to
zero out the unused part of the vector and to delete the map if it's no longer
needed.
(KJS::ArrayInstance::mark): Tweaked formatting.
(KJS::compareByStringForQSort): Ditto.
(KJS::ArrayInstance::sort): Ditto.
(KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
Ditto.
(KJS::compareWithCompareFunctionForQSort): Ditto.
(KJS::ArrayInstance::compactForSorting): Fixed bug where this would turn
undefined values into nonexistent values in some cases.
* kjs/array_object.h: Removed MAX_ARRAY_INDEX.
* kjs/array_object.cpp: Removed ArrayInstance. Moved to a separate file.
* JavaScriptCore.pri: Added array_instance.cpp.
* JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
* kjs/AllInOneFile.cpp: Ditto.
2007-10-22 Andrew Wellington <proton@wiretapped.net>
Reviewed by Mark Rowe.
Fix for local database support after r26879
Ensure that ENABLE_DATABASE and ENABLE_ICONDATABASE are correctly set
* Configurations/JavaScriptCore.xcconfig:
2007-10-22 Simon Hausmann <hausmann@kde.org>
Reviewed by Alp.
Build fix for the non-qmake builds.
* wtf/Platform.h: Default to enabling the database features unless
otherwise specified. (similar to ENABLE_ICONDATABASE)
2007-10-22 Holger Freyther <zecke@selfish.org>
Reviewed by Simon Hausmann <hausmann@kde.org>.
* Do not build testkjs as an application bundle. This is
needed for run-javascriptcore-tests on OSX.
* Also, based on r26633, allow to test the WebKit/Qt port on OSX.
* Set DYLD_LIBRARY_PATH if it was set in the environment. It must be set
as we do not have -rpath on OSX.
* kjs/testkjs.pro:
2007-10-21 Mark Rowe <mrowe@apple.com>
Reviewed by Alp.
http://bugs.webkit.org/show_bug.cgi?id=15575
Bug 15575: [GTK] Implement threading using GThread
* wtf/Platform.h: Do not enable pthreads for Gtk.
2007-10-21 Mark Rowe <mrowe@apple.com>
Reviewed by Mitz.
Fix http://bugs.webkit.org/show_bug.cgi?id=15603
Bug 15603: Regression(r26847): Crash when sorting an empty array from JavaScript
* kjs/array_object.cpp:
(KJS::freeStorage): Reinstate null-check that was removed in r26847.
2007-10-21 Darin Adler <darin@apple.com>
- fix Windows build
* kjs/array_instance.h: Removed unused ExecState parameter.
* kjs/array_object.cpp:
(KJS::ArrayInstance::put): Ditto.
(KJS::ArrayInstance::setLength): Ditto.
2007-10-21 Darin Adler <darin@apple.com>
* kjs/array_object.cpp: (KJS::ArrayInstance::put):
Add missing assignment that was causing regression test crash.
2007-10-21 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15585
speed up sparse arrays by using a custom map
Speeds up SunSpider by 10%.
* kjs/array_object.cpp:
(allocateStorage): Leave room for an additional pointer.
(reallocateStorage): Ditto.
(freeStorage): Ditto.
(ArrayInstance::~ArrayInstance): Delete the overflow map if present.
(ArrayInstance::getItem): Read values from the overflow map if present.
Removed the check of length, since it slows down the common case.
(ArrayInstance::getOwnPropertySlot): Ditto. Also removed the fallback
to the property map.
(ArrayInstance::put): Write values into the overflow map as needed.
Also create overflow map when needed.
(ArrayInstance::deleteProperty): Remove values from the overflow map
as appropriate.
(ArrayInstance::getPropertyNames): Add a name for each identifier in
the property map. This is extremely inefficient.
(ArrayInstance::setLength): Remove any values in the overflow map
that are past the new length, as we formerly did with the property map.
(ArrayInstance::mark): Mark any values in the overflow map.
(compareByStringForQSort): Removed unneeded undefined case, since
compactForSorting guarantees we will have no undefined values.
(compareWithCompareFunctionForQSort): Ditto.
(ArrayInstance::compactForSorting): Copy all the values out of the
overflow map and destroy it.
* kjs/property_map.h: Removed now-unused getSparseArrayPropertyNames.
* kjs/property_map.cpp: Ditto.
2007-10-20 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- http://bugs.webkit.org/show_bug.cgi?id=15579
stop churning identifier reference counts copying Completion objects
* kjs/completion.h: Replace the Identifier with an Identifier*.
* kjs/nodes.cpp:
(ForInNode::execute): Update for change to Completion constructor.
(ContinueNode::execute): Ditto.
(BreakNode::execute): Ditto.
2007-10-20 Mark Rowe <mrowe@apple.com>
Reviewed by Alp.
Gtk changes needed to enable HTML 5 client-side database storage.
* wtf/Platform.h: Have Gtk use pthreads for now.
2007-10-20 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15570
Store gathered declaration nodes in the function body node.
This means that you only have to gather the declaration nodes the first
time the function executes. Performance gain of 2.10% on SunSpider,
0.90% on command-line JS iBench.
* kjs/nodes.cpp: Split declaration stack initialization code off into
initializeDeclarationStacks().
(FunctionBodyNode::FunctionBodyNode):
(FunctionBodyNode::initializeDeclarationStacks):
(FunctionBodyNode::processDeclarations):
* kjs/nodes.h: Changed DeclarationStacks structure to hold references,
since the actual Vectors are now stored either on the stack or in the
function body node.
2007-10-19 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
http://bugs.webkit.org/show_bug.cgi?id=15559
Moved processDeclarations call into FunctionBodyNode::execute
To improve encapsulation, moved processDeclarations call into
FunctionBodyNode::execute. Also marked processDeclarations
ALWAYS_INLINE, since it has only 1 caller now. This is a .71% speedup
on command-line JS iBench.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/function.h:
* kjs/interpreter.cpp:
(KJS::Interpreter::evaluate):
* kjs/nodes.cpp:
(FunctionBodyNode::execute):
* kjs/nodes.h:
2007-10-19 Brady Eidson <beidson@apple.com>
Reviewed by Sam
Queue -> Deque! and small style tweaks
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
* wtf/Deque.h: Added.
(WTF::DequeNode::DequeNode):
(WTF::Deque::Deque):
(WTF::Deque::~Deque):
(WTF::Deque::size):
(WTF::Deque::isEmpty):
(WTF::Deque::append):
(WTF::Deque::prepend):
(WTF::Deque::first):
(WTF::Deque::last):
(WTF::Deque::removeFirst):
(WTF::Deque::clear):
* wtf/Queue.h: Removed.
2007-10-19 Brady Eidson <beidson@apple.com>
Reviewed by Oliver
Added a simple LinkedList based Queue to wtf
We can make a better, more sophisticated an efficient one later, but have
needed one for some time, now!
* JavaScriptCore.xcodeproj/project.pbxproj:
* wtf/Queue.h: Added.
(WTF::QueueNode::QueueNode):
(WTF::Queue::Queue):
(WTF::Queue::~Queue):
(WTF::Queue::size):
(WTF::Queue::isEmpty):
(WTF::Queue::append):
(WTF::Queue::prepend):
(WTF::Queue::first):
(WTF::Queue::last):
(WTF::Queue::removeFirst):
(WTF::Queue::clear):
2007-10-19 Nikolas Zimmermann <zimmermann@kde.org>
Reviewed by Anders.
Try to fix Qt/Win build slave, by including windows.h also on Qt/Win.
* kjs/testkjs.cpp: Change PLATFORM(WIN) to PLATFORM(WIN_OS)
2007-10-19 Simon Hausmann <hausmann@kde.org>
Reviewed by Lars.
Fix compilation on Windows when wchar_t is a typedef instead of a native type (triggered by -Zc:wchar_t-).
Don't provide the wchar_t overloads then as they conflict with the unsigned short ones.
* wtf/ASCIICType.h:
(WTF::isASCIIAlpha):
(WTF::isASCIIAlphanumeric):
(WTF::isASCIIDigit):
(WTF::isASCIIHexDigit):
(WTF::isASCIILower):
(WTF::isASCIISpace):
(WTF::toASCIILower):
(WTF::toASCIIUpper):
2007-10-19 Simon Hausmann <hausmann@kde.org>
Reviewed by Lars.
Another build fix for the windows/qt build: Apply the same fix as in revision 26686 also to kjs/config.h to disable the disallowctype feature.
* kjs/config.h:
2007-10-18 Maciej Stachowiak <mjs@apple.com>
Reviewed by Adam.
- use __declspec(thread) for fast thread-local storage on Windows
- 2.2% speedup on sunspider (on Windows)
- 7% speedup on the string section
- 6% speedup on JS iBench
- fixed <rdar://problem/5473084> PLT on Windows got 2.5% slower between r25406 and r25422
- fixed at least some of <rdar://5527965? i-Bench JS was 14% slower in 310A11 than 310A10
* wtf/FastMalloc.cpp:
(WTF::getThreadHeap):
(WTF::setThreadHeap):
(WTF::TCMalloc_ThreadCache::GetCache):
(WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
(WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2007-10-17 Darin Adler <darin@apple.com>
Reviewed by Mark Rowe.
- fix http://bugs.webkit.org/show_bug.cgi?id=15543
<rdar://problem/5545639> REGRESSION (r26697):
GoogleDocs: Can't create new documents or open existing ones
Test: fast/js/regexp-non-character.html
* pcre/pcre_compile.c: (check_escape): Take out the checks for valid characters
in the \u sequences -- not needed and actively harmful.
2007-10-17 Anders Carlsson <andersca@apple.com>
Reviewed by Oliver.
* wtf/Platform.h:
#define USE_PTHREADS on Mac.
2007-10-17 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Merged DeclaredFunctionImp into FunctionImp (the base class) because
the distinction between the two was unused.
Removed codeType() from FunctionImp because FunctionImp and its
subclasses all returned FunctionCode, so it was unused, practically
speaking.
Removed a different codeType() from GlobalFuncImp because it was unused.
(Perhaps it was vestigial from a time when GlobalFuncImp used to
inherit from FunctionImp.)
* bindings/runtime_method.cpp:
* bindings/runtime_method.h:
* kjs/function.cpp:
(KJS::):
(KJS::FunctionImp::FunctionImp):
(KJS::FunctionImp::callAsFunction):
(KJS::FunctionImp::construct):
(KJS::FunctionImp::execute):
(KJS::FunctionImp::processVarDecls):
* kjs/function.h:
(KJS::FunctionImp::implementsConstruct):
(KJS::FunctionImp::scope):
* kjs/function_object.cpp:
(FunctionProtoFunc::callAsFunction):
(FunctionObjectImp::construct):
* kjs/nodes.cpp:
(FuncDeclNode::processFuncDecl):
(FuncExprNode::evaluate):
2007-10-17 Adam Roben <aroben@apple.com>
Windows build fix part 2.
Fix was by Darin, reviewed by Anders and Adam.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add
FastMallocPCRE.cpp to the project, and let Visual Studio have its way
with the post-build step.
* pcre/pcre.h: Don't DLL export the entry points just because this
is Win32 -- this is an internal copy of PCRE and should be private.
* pcre/pcre_compile.c: Fix an uninitialized variable warning --
there's no real problem but it's better to quiet the compiler by
tweaking the code slightly than turn off the warning entirely.
2007-10-17 Adam Roben <aroben@apple.com>
Windows build fix.
Reviewed by Anders.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
some mismatched signed/unsigned comparison warnings.
* pcre/pcre_exec.c:
(match): #if-out some labels that don't seem to exist.
2007-10-17 Mark Rowe <mrowe@apple.com>
Gtk build fix.
* JavaScriptCore.pri: Add FastMallocPCRE.cpp.
* pcre/pcre_get. #if out two functions that depend on pcre_get_stringnumber, which
is currently unavailable for UTF-16.
2007-10-16 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- merged PCRE changes between 6.4 and 6.5
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
Removed pcre_config.c, pcre_globals.c, pcre_info.c, pcre_maketables.c,
pcre_printint.src, pcre_refcount.c, pcre_study.c, pcre_try_flipped.c,
pcre_ucp_findchar.c, pcre_version.c, and ucptable.c. Added pcre_ucp_searchfuncs.c.
* pcre/AUTHORS:
* pcre/LICENCE:
* pcre/MERGING:
* pcre/dftables.c:
* pcre/pcre-config.h:
* pcre/pcre.h:
* pcre/pcre.pri:
* pcre/pcre_compile.c:
* pcre/pcre_exec.c:
* pcre/pcre_fullinfo.c:
* pcre/pcre_get.c:
* pcre/pcre_internal.h:
* pcre/pcre_maketables.c:
* pcre/pcre_ord2utf8.c:
* pcre/pcre_tables.c:
* pcre/pcre_ucp_searchfuncs.c: Copied from pcre/pcre_ucp_findchar.c.
* pcre/pcre_xclass.c:
* pcre/ucp.h:
* pcre/ucpinternal.h:
* pcre/ucptable.c:
Updated with new versions from the PCRE 6.5 release, merged with changes.
* pcre/pcre_config.c: Removed.
* pcre/pcre_globals.c: Removed.
* pcre/pcre_info.c: Removed.
* pcre/pcre_printint.src: Removed.
* pcre/pcre_refcount.c: Removed.
* pcre/pcre_study.c: Removed.
* pcre/pcre_try_flipped.c: Removed.
* pcre/pcre_ucp_findchar.c: Removed.
* pcre/pcre_version.c: Removed.
2007-10-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Removed KJS_VERBOSE because it was getting in the way of readability,
and the messages didn't seem very helpful.
* kjs/function.cpp:
(KJS::FunctionImp::callAsFunction):
(KJS::FunctionImp::passInParameters):
* kjs/lookup.h:
(KJS::lookupPut):
* kjs/object.cpp:
(KJS::JSObject::put):
* kjs/value.h:
2007-10-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Removed the Parameter class because it was a redundant wrapper around
Identifier.
* kjs/function.cpp:
(KJS::FunctionImp::passInParameters):
(KJS::FunctionImp::getParameterName):
* kjs/nodes.cpp:
(FunctionBodyNode::addParam):
* kjs/nodes.h:
(KJS::FunctionBodyNode::):
2007-10-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Global replace of assert with ASSERT.
2007-10-16 Adam Roben <aroben@apple.com>
Make testkjs not delay-load WebKit
Soon, delay-loading WebKit will be impossible (because we will be
using __declspec(thread) for thread-local storage). This change
prepares testkjs for the future.
Reviewed by Sam.
* JavaScriptCore.vcproj/JavaScriptCore.sln: Removed WebKitInitializer,
added FindSafari.
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Don't link against
WebKitInitializer, don't delay-load WebKit.
* kjs/testkjs.cpp: Don't use WebKitInitializer.
2007-10-16 Adam Roben <aroben@apple.com>
Updated testkjs for the rename of WebKit_debug.dll to WebKit.dll for the Debug configuration
Reviewed by Kevin McCullough.
* JavaScriptCore.vcproj/debug.vsprops: Added WebKitDLLConfigSuffix.
* JavaScriptCore.vcproj/debug_internal.vsprops: Ditto.
* JavaScriptCore.vcproj/release.vsprops: Ditto.
* JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Use
WebKitDLLConfigSuffix when referring to WebKit.dll, and fixed a typo
in the name of icuuc36[_debug].dll.
2007-10-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Re-structured variable and function declaration code.
Command-line JS iBench shows no regression.
Here are the changes:
1. Function declarations are now processed at the same time as var
declarations -- namely, immediately upon entry to an execution context.
This does not match Firefox, which waits to process a function
declaration until the declaration's containing block executes, but it
does match IE and the ECMA spec. (10.1.3 states that var and function
declarations should be processed at the same time -- namely, "On
entering an execution context." 12.2 states that "A Block does not
define a new execution scope.")
2. Declaration processing proceeds iteratively now, rather than
recursively, storing the nodes is finds in stacks. This will later
facilitate an optimization to hold on to the gathered declaration nodes,
rather than re-fetching them in every function call.
[ http://bugs.webkit.org/show_bug.cgi?id=14868 ]
Modified these tests because they expected the incorrect Mozilla
behavior described above:
* tests/mozilla/ecma_3/Function/scope-001.js:
* tests/mozilla/js1_5/Scope/regress-184107.js:
2007-10-16 Darin Adler <darin@apple.com>
- try to fix the GTK build
* kjs/ustring.cpp: Include ASCIICType.h, not ASCIICtype.h.
2007-10-16 Darin Adler <darin@apple.com>
- try to fix the Windows build
* kjs/date_object.cpp: (KJS::parseDate): A couple instances of isspace were
in here. Not sure why it wasn't failing elsewhere. Changed to isASCIISpace.
2007-10-16 Darin Adler <darin@apple.com>
- try to fix the GTK build
* kjs/ustring.cpp: Include ASCIICType.h.
2007-10-16 Darin Adler <darin@apple.com>
Reviewed by Maciej and Geoff (and looked over by Eric).
- http://bugs.webkit.org/show_bug.cgi?id=15519
eliminate use of <ctype.h> for processing ASCII
* wtf/ASCIICType.h: Added.
* wtf/DisallowCType.h: Added.
* kjs/config.h: Include DisallowCType.h.
* kjs/date_object.cpp:
(KJS::skipSpacesAndComments):
(KJS::findMonth):
(KJS::parseDate):
* kjs/function.cpp:
(KJS::decode):
* kjs/ustring.cpp:
(KJS::UString::toDouble):
Use ASCIICType.h functions instead of ctype.h ones.
2007-10-14 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- fixes for "New JavaScript benchmark"
http://bugs.webkit.org/show_bug.cgi?id=15515
* kjs/testkjs.cpp:
(TestFunctionImp::callAsFunction): Implement "load" for compatibility
with SpiderMonkey.
(TestFunctionImp::): ditto
(doIt): ditto
(kjsmain): Drop useless --> from output.
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Removed unnecessary #include.
* API/JSObjectRef.cpp:
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Double-reverse build fix. My tree was out of date.
* kjs/nodes.cpp:
(NumberNode::evaluate):
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Build fix.
* kjs/nodes.cpp:
(NumberNode::evaluate):
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Removed surprising self-named "hack" that made nested functions
available as named properties of their containing functions, and placed
containing function objects in the scope chains of nested functions.
There were a few reasons to remove this "hack:"
1. It contradicted FF, IE, and the ECMA spec.
2. It incurred a performance penalty, since merely parsing a function
required parsing its body for nested functions (and so on).
3. SVN history contains no explanation for why it was added. It was just
legacy code in a large merge a long, long time ago.
[ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
* kjs/nodes.cpp:
(FuncDeclNode::processFuncDecl):
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Removed the concept of AnonymousCode. It was unused, and it doesn't
exist in the ECMA spec.
[ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
* kjs/Context.cpp:
(KJS::Context::Context):
* kjs/function.h:
(KJS::):
* kjs/nodes.cpp:
(ReturnNode::execute):
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
Made function parameters DontDelete. This matches FF and the vague
description in ECMA 10.1.3. It's also required in order to make
symbol table based lookup of function parameters valid. (If the
parameters aren't DontDelete, you can't guarantee that you'll find
them later in the symbol table.)
[ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
* kjs/function.cpp:
(KJS::FunctionImp::passInParameters):
2007-10-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Some Vector optimizations. These are especially important when using
Vector as a stack for implementing recursive algorithms iteratively.
[ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
1. Added shrink(), which is a version of resize() that you can call
to save a branch / improve code generation and inlining when you know
that the vector is not getting bigger.
2. Changed subclassing relationship in VectorBuffer to remove a call to
fastFree() in the destructor for the inlineCapacity != 0 template
specialization. This brings inline Vectors one step closer to true
stack-allocated arrays.
Also changed abort() to CRASH(), since the latter works better.
* wtf/Vector.h:
(WTF::VectorBufferBase::allocateBuffer):
(WTF::VectorBufferBase::deallocateBuffer):
(WTF::VectorBufferBase::VectorBufferBase):
(WTF::VectorBufferBase::~VectorBufferBase):
(WTF::):
(WTF::VectorBuffer::VectorBuffer):
(WTF::VectorBuffer::~VectorBuffer):
(WTF::VectorBuffer::deallocateBuffer):
(WTF::VectorBuffer::releaseBuffer):
(WTF::Vector::clear):
(WTF::Vector::removeLast):
(WTF::::operator):
(WTF::::fill):
(WTF::::shrink):
2007-10-12 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
Fixed http://bugs.webkit.org/show_bug.cgi?id=15490
Iteration statements sometimes incorrectly evaluate to the empty value
(KDE r670547).
[ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
This patch is a merge of KDE r670547, with substantial modification
for performance.
It fixes do-while statements to evaluate to a value. (They used
to evaluate to the empty value in all cases.)
It also fixes SourceElementsNode to maintain the value of abnormal
completions like "break" and "continue."
It also re-works the main execution loop in SourceElementsNode so that
it (1) makes a little more sense and (2) avoids unnecessary work. This
is a .28% speedup on command-line JS iBench.
* kjs/nodes.cpp:
(DoWhileNode::execute):
(SourceElementsNode::execute):
2007-10-15 Simon Hausmann <hausmann@kde.org>
Reviewed by Lars.
Fix compilation with gcc 4.3 by including 'limits' due to the use of std::numeric_limits.
* wtf/HashTraits.h:
2007-10-5 Kevin Ollivier <kevino@theolliviers.com>
Reviewed by Adam.
Add support for MSVC7, and fix cases where PLATFORM(WIN) should
be PLATFORM(WIN_OS) for other ports building on Windows.
* kjs/DateMath.cpp:
(KJS::getDSTOffsetSimple):
* kjs/JSImmediate.h:
* wtf/Assertions.cpp:
* wtf/Assertions.h:
* wtf/Platform.h:
* wtf/StringExtras.h:
(snprintf):
(vsnprintf):
2007-10-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Darin.
Adds NegateNode optimization from KJS. The relevant revision in KDE
is 666736.
* kjs/grammar.y:
* kjs/nodes.cpp:
(NumberNode::evaluate):
* kjs/nodes.h:
(KJS::Node::):
(KJS::NumberNode::):
* kjs/nodes2string.cpp:
(NumberNode::streamTo):
2007-10-14 Jason Foreman <jason@threeve.org>
Reviewed by Maciej.
Fix http://bugs.webkit.org/show_bug.cgi?id=15145
Ensure that if adjusting n to minimize the difference of n*intPow10(e-p+1) to x,
that the property n < intPow10(p) is maintained.
* kjs/number_object.cpp:
(NumberProtoFunc::callAsFunction):
== Rolled over to ChangeLog-2007-10-14 ==
|