OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1821 /** | 1821 /** |
1822 * Applications can register a callback function which is called | 1822 * Applications can register a callback function which is called |
1823 * before and after a major garbage collection. Allocations are not | 1823 * before and after a major garbage collection. Allocations are not |
1824 * allowed in the callback function, you therefore cannot manipulate | 1824 * allowed in the callback function, you therefore cannot manipulate |
1825 * objects (set or delete properties for example) since it is possible | 1825 * objects (set or delete properties for example) since it is possible |
1826 * such operations will result in the allocation of objects. | 1826 * such operations will result in the allocation of objects. |
1827 */ | 1827 */ |
1828 typedef void (*GCCallback)(); | 1828 typedef void (*GCCallback)(); |
1829 | 1829 |
1830 | 1830 |
1831 // --- E x t e r n a l S y m b o l C a l l b a c k --- | |
1832 | |
1833 /** | |
1834 * Callback used to allocate certain V8 symbols as external strings. | |
1835 * | |
1836 * The data passed to the callback is utf8 encoded. | |
1837 * | |
1838 * Allocations are not allowed in the callback function, you therefore | |
1839 * cannot manipulate objects (set or delete properties for example) | |
1840 * since it is possible such operations will result in the allocation | |
1841 * of objects. | |
1842 */ | |
1843 typedef String::ExternalStringResource* (*ExternalSymbolCallback)( | |
1844 const char* utf8, | |
1845 size_t length); | |
1846 | |
1847 | |
1848 // --- C o n t e x t G e n e r a t o r --- | 1831 // --- C o n t e x t G e n e r a t o r --- |
1849 | 1832 |
1850 /** | 1833 /** |
1851 * Applications must provide a callback function which is called to generate | 1834 * Applications must provide a callback function which is called to generate |
1852 * a context if a context was not deserialized from the snapshot. | 1835 * a context if a context was not deserialized from the snapshot. |
1853 */ | 1836 */ |
1854 typedef Persistent<Context> (*ContextGenerator)(); | 1837 typedef Persistent<Context> (*ContextGenerator)(); |
1855 | 1838 |
1856 | 1839 |
1857 /** | 1840 /** |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1938 /** | 1921 /** |
1939 * Enables the host application to receive a notification after a | 1922 * Enables the host application to receive a notification after a |
1940 * major garbage collection. Allocations are not allowed in the | 1923 * major garbage collection. Allocations are not allowed in the |
1941 * callback function, you therefore cannot manipulate objects (set | 1924 * callback function, you therefore cannot manipulate objects (set |
1942 * or delete properties for example) since it is possible such | 1925 * or delete properties for example) since it is possible such |
1943 * operations will result in the allocation of objects. | 1926 * operations will result in the allocation of objects. |
1944 */ | 1927 */ |
1945 static void SetGlobalGCEpilogueCallback(GCCallback); | 1928 static void SetGlobalGCEpilogueCallback(GCCallback); |
1946 | 1929 |
1947 /** | 1930 /** |
1948 * Applications can register a callback that will be used when | |
1949 * allocating most of the V8 symbols. The callback must return an | |
1950 * external string resource that represents the symbols. | |
1951 * | |
1952 * Most often when performing a property lookup the key will be a | |
1953 * symbol. Allocating symbols as external strings can reduce the | |
1954 * amount of string conversions needed when using interceptors and | |
1955 * accessors. | |
1956 * | |
1957 * \note This is an experimental feature and it might be removed. | |
1958 */ | |
1959 static void SetExternalSymbolCallback(ExternalSymbolCallback); | |
1960 | |
1961 /** | |
1962 * Allows the host application to group objects together. If one | 1931 * Allows the host application to group objects together. If one |
1963 * object in the group is alive, all objects in the group are alive. | 1932 * object in the group is alive, all objects in the group are alive. |
1964 * After each garbage collection, object groups are removed. It is | 1933 * After each garbage collection, object groups are removed. It is |
1965 * intended to be used in the before-garbage-collection callback | 1934 * intended to be used in the before-garbage-collection callback |
1966 * function, for instance to simulate DOM tree connections among JS | 1935 * function, for instance to simulate DOM tree connections among JS |
1967 * wrapper objects. | 1936 * wrapper objects. |
1968 */ | 1937 */ |
1969 static void AddObjectGroup(Persistent<Value>* objects, size_t length); | 1938 static void AddObjectGroup(Persistent<Value>* objects, size_t length); |
1970 | 1939 |
1971 /** | 1940 /** |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2483 | 2452 |
2484 } // namespace v8 | 2453 } // namespace v8 |
2485 | 2454 |
2486 | 2455 |
2487 #undef EXPORT | 2456 #undef EXPORT |
2488 #undef EXPORT_INLINE | 2457 #undef EXPORT_INLINE |
2489 #undef TYPE_CHECK | 2458 #undef TYPE_CHECK |
2490 | 2459 |
2491 | 2460 |
2492 #endif // V8_H_ | 2461 #endif // V8_H_ |
OLD | NEW |