| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 89c1bbd commit 327838d
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,7 @@ | |||
| 36 | 36 | ||
| 37 | 37 | # Reset this number to 0 on major V8 upgrades. | |
| 38 | 38 | # Increment by one for each non-official patch applied to deps/v8. | |
| 39 | - 'v8_embedder_string': '-node.82', | ||
| 39 | + 'v8_embedder_string': '-node.83', | ||
| 40 | 40 | ||
| 41 | 41 | ##### V8 defaults for Node.js ##### | |
| 42 | 42 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1877,6 +1877,11 @@ Local<String> Shell::Stringify(Isolate* isolate, Local<Value> value) { | |||
| 1877 | 1877 | ||
| 1878 | 1878 | Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { | |
| 1879 | 1879 | Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate); | |
| 1880 | + global_template->Set(Symbol::GetToStringTag(isolate), | ||
| 1881 | + String::NewFromUtf8Literal(isolate, "global")); | ||
| 1882 | + global_template->Set(isolate, "version", | ||
| 1883 | + FunctionTemplate::New(isolate, Version)); | ||
| 1884 | + | ||
| 1880 | 1885 | global_template->Set(isolate, "print", FunctionTemplate::New(isolate, Print)); | |
| 1881 | 1886 | global_template->Set(isolate, "printErr", | |
| 1882 | 1887 | FunctionTemplate::New(isolate, PrintErr)); | |
@@ -1895,8 +1900,77 @@ Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { | |||
| 1895 | 1900 | if (!options.omit_quit) { | |
| 1896 | 1901 | global_template->Set(isolate, "quit", FunctionTemplate::New(isolate, Quit)); | |
| 1897 | 1902 | } | |
| 1903 | + global_template->Set(isolate, "testRunner", | ||
| 1904 | + Shell::CreateTestRunnerTemplate(isolate)); | ||
| 1905 | + global_template->Set(isolate, "Realm", Shell::CreateRealmTemplate(isolate)); | ||
| 1906 | + global_template->Set(isolate, "performance", | ||
| 1907 | + Shell::CreatePerformanceTemplate(isolate)); | ||
| 1908 | + global_template->Set(isolate, "Worker", Shell::CreateWorkerTemplate(isolate)); | ||
| 1909 | + global_template->Set(isolate, "os", Shell::CreateOSTemplate(isolate)); | ||
| 1910 | + global_template->Set(isolate, "d8", Shell::CreateD8Template(isolate)); | ||
| 1911 | + | ||
| 1912 | + if (i::FLAG_expose_async_hooks) { | ||
| 1913 | + global_template->Set(isolate, "async_hooks", | ||
| 1914 | + Shell::CreateAsyncHookTemplate(isolate)); | ||
| 1915 | + } | ||
| 1916 | + | ||
| 1917 | + return global_template; | ||
| 1918 | + } | ||
| 1919 | + | ||
| 1920 | + Local<ObjectTemplate> Shell::CreateOSTemplate(Isolate* isolate) { | ||
| 1921 | + Local<ObjectTemplate> os_template = ObjectTemplate::New(isolate); | ||
| 1922 | + AddOSMethods(isolate, os_template); | ||
| 1923 | + return os_template; | ||
| 1924 | + } | ||
| 1925 | + | ||
| 1926 | + Local<FunctionTemplate> Shell::CreateWorkerTemplate(Isolate* isolate) { | ||
| 1927 | + Local<FunctionTemplate> worker_fun_template = | ||
| 1928 | + FunctionTemplate::New(isolate, WorkerNew); | ||
| 1929 | + Local<Signature> worker_signature = | ||
| 1930 | + Signature::New(isolate, worker_fun_template); | ||
| 1931 | + worker_fun_template->SetClassName( | ||
| 1932 | + String::NewFromUtf8Literal(isolate, "Worker")); | ||
| 1933 | + worker_fun_template->ReadOnlyPrototype(); | ||
| 1934 | + worker_fun_template->PrototypeTemplate()->Set( | ||
| 1935 | + isolate, "terminate", | ||
| 1936 | + FunctionTemplate::New(isolate, WorkerTerminate, Local<Value>(), | ||
| 1937 | + worker_signature)); | ||
| 1938 | + worker_fun_template->PrototypeTemplate()->Set( | ||
| 1939 | + isolate, "postMessage", | ||
| 1940 | + FunctionTemplate::New(isolate, WorkerPostMessage, Local<Value>(), | ||
| 1941 | + worker_signature)); | ||
| 1942 | + worker_fun_template->PrototypeTemplate()->Set( | ||
| 1943 | + isolate, "getMessage", | ||
| 1944 | + FunctionTemplate::New(isolate, WorkerGetMessage, Local<Value>(), | ||
| 1945 | + worker_signature)); | ||
| 1946 | + worker_fun_template->InstanceTemplate()->SetInternalFieldCount(1); | ||
| 1947 | + return worker_fun_template; | ||
| 1948 | + } | ||
| 1949 | + | ||
| 1950 | + Local<ObjectTemplate> Shell::CreateAsyncHookTemplate(Isolate* isolate) { | ||
| 1951 | + Local<ObjectTemplate> async_hooks_templ = ObjectTemplate::New(isolate); | ||
| 1952 | + async_hooks_templ->Set(isolate, "createHook", | ||
| 1953 | + FunctionTemplate::New(isolate, AsyncHooksCreateHook)); | ||
| 1954 | + async_hooks_templ->Set( | ||
| 1955 | + isolate, "executionAsyncId", | ||
| 1956 | + FunctionTemplate::New(isolate, AsyncHooksExecutionAsyncId)); | ||
| 1957 | + async_hooks_templ->Set( | ||
| 1958 | + isolate, "triggerAsyncId", | ||
| 1959 | + FunctionTemplate::New(isolate, AsyncHooksTriggerAsyncId)); | ||
| 1960 | + return async_hooks_templ; | ||
| 1961 | + } | ||
| 1962 | + | ||
| 1963 | + Local<ObjectTemplate> Shell::CreatePromiseHookTemplate(Isolate* isolate) { | ||
| 1964 | + Local<ObjectTemplate> promise_hooks_templ = ObjectTemplate::New(isolate); | ||
| 1965 | + promise_hooks_templ->Set( | ||
| 1966 | + isolate, "setHooks", | ||
| 1967 | + FunctionTemplate::New(isolate, SetPromiseHooks, Local<Value>(), | ||
| 1968 | + Local<Signature>(), 4)); | ||
| 1969 | + return promise_hooks_templ; | ||
| 1970 | + } | ||
| 1971 | + | ||
| 1972 | + Local<ObjectTemplate> Shell::CreateTestRunnerTemplate(Isolate* isolate) { | ||
| 1898 | 1973 | Local<ObjectTemplate> test_template = ObjectTemplate::New(isolate); | |
| 1899 | - global_template->Set(isolate, "testRunner", test_template); | ||
| 1900 | 1974 | test_template->Set(isolate, "notifyDone", | |
| 1901 | 1975 | FunctionTemplate::New(isolate, NotifyDone)); | |
| 1902 | 1976 | test_template->Set(isolate, "waitUntilDone", | |
@@ -1905,13 +1979,20 @@ Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { | |||
| 1905 | 1979 | // installed on the global object can be hidden with the --omit-quit flag | |
| 1906 | 1980 | // (e.g. on asan bots). | |
| 1907 | 1981 | test_template->Set(isolate, "quit", FunctionTemplate::New(isolate, Quit)); | |
| 1982 | + return test_template; | ||
| 1983 | + } | ||
| 1908 | 1984 | ||
| 1909 | - global_template->Set(isolate, "version", | ||
| 1910 | - FunctionTemplate::New(isolate, Version)); | ||
| 1911 | - global_template->Set(Symbol::GetToStringTag(isolate), | ||
| 1912 | - String::NewFromUtf8Literal(isolate, "global")); | ||
| 1985 | + Local<ObjectTemplate> Shell::CreatePerformanceTemplate(Isolate* isolate) { | ||
| 1986 | + Local<ObjectTemplate> performance_template = ObjectTemplate::New(isolate); | ||
| 1987 | + performance_template->Set(isolate, "now", | ||
| 1988 | + FunctionTemplate::New(isolate, PerformanceNow)); | ||
| 1989 | + performance_template->Set( | ||
| 1990 | + isolate, "measureMemory", | ||
| 1991 | + FunctionTemplate::New(isolate, PerformanceMeasureMemory)); | ||
| 1992 | + return performance_template; | ||
| 1993 | + } | ||
| 1913 | 1994 | ||
| 1914 | - // Bind the Realm object. | ||
| 1995 | + Local<ObjectTemplate> Shell::CreateRealmTemplate(Isolate* isolate) { | ||
| 1915 | 1996 | Local<ObjectTemplate> realm_template = ObjectTemplate::New(isolate); | |
| 1916 | 1997 | realm_template->Set(isolate, "current", | |
| 1917 | 1998 | FunctionTemplate::New(isolate, RealmCurrent)); | |
@@ -1936,64 +2017,13 @@ Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { | |||
| 1936 | 2017 | FunctionTemplate::New(isolate, RealmEval)); | |
| 1937 | 2018 | realm_template->SetAccessor(String::NewFromUtf8Literal(isolate, "shared"), | |
| 1938 | 2019 | RealmSharedGet, RealmSharedSet); | |
| 1939 | - global_template->Set(isolate, "Realm", realm_template); | ||
| 1940 | - | ||
| 1941 | - Local<ObjectTemplate> performance_template = ObjectTemplate::New(isolate); | ||
| 1942 | - performance_template->Set(isolate, "now", | ||
| 1943 | - FunctionTemplate::New(isolate, PerformanceNow)); | ||
| 1944 | - performance_template->Set( | ||
| 1945 | - isolate, "measureMemory", | ||
| 1946 | - FunctionTemplate::New(isolate, PerformanceMeasureMemory)); | ||
| 1947 | - global_template->Set(isolate, "performance", performance_template); | ||
| 1948 | - | ||
| 1949 | - Local<FunctionTemplate> worker_fun_template = | ||
| 1950 | - FunctionTemplate::New(isolate, WorkerNew); | ||
| 1951 | - Local<Signature> worker_signature = | ||
| 1952 | - Signature::New(isolate, worker_fun_template); | ||
| 1953 | - worker_fun_template->SetClassName( | ||
| 1954 | - String::NewFromUtf8Literal(isolate, "Worker")); | ||
| 1955 | - worker_fun_template->ReadOnlyPrototype(); | ||
| 1956 | - worker_fun_template->PrototypeTemplate()->Set( | ||
| 1957 | - isolate, "terminate", | ||
| 1958 | - FunctionTemplate::New(isolate, WorkerTerminate, Local<Value>(), | ||
| 1959 | - worker_signature)); | ||
| 1960 | - worker_fun_template->PrototypeTemplate()->Set( | ||
| 1961 | - isolate, "postMessage", | ||
| 1962 | - FunctionTemplate::New(isolate, WorkerPostMessage, Local<Value>(), | ||
| 1963 | - worker_signature)); | ||
| 1964 | - worker_fun_template->PrototypeTemplate()->Set( | ||
| 1965 | - isolate, "getMessage", | ||
| 1966 | - FunctionTemplate::New(isolate, WorkerGetMessage, Local<Value>(), | ||
| 1967 | - worker_signature)); | ||
| 1968 | - worker_fun_template->InstanceTemplate()->SetInternalFieldCount(1); | ||
| 1969 | - global_template->Set(isolate, "Worker", worker_fun_template); | ||
| 1970 | - | ||
| 1971 | - Local<ObjectTemplate> os_templ = ObjectTemplate::New(isolate); | ||
| 1972 | - AddOSMethods(isolate, os_templ); | ||
| 1973 | - global_template->Set(isolate, "os", os_templ); | ||
| 1974 | - | ||
| 1975 | - if (i::FLAG_expose_async_hooks) { | ||
| 1976 | - Local<ObjectTemplate> async_hooks_templ = ObjectTemplate::New(isolate); | ||
| 1977 | - async_hooks_templ->Set( | ||
| 1978 | - isolate, "createHook", | ||
| 1979 | - FunctionTemplate::New(isolate, AsyncHooksCreateHook)); | ||
| 1980 | - async_hooks_templ->Set( | ||
| 1981 | - isolate, "executionAsyncId", | ||
| 1982 | - FunctionTemplate::New(isolate, AsyncHooksExecutionAsyncId)); | ||
| 1983 | - async_hooks_templ->Set( | ||
| 1984 | - isolate, "triggerAsyncId", | ||
| 1985 | - FunctionTemplate::New(isolate, AsyncHooksTriggerAsyncId)); | ||
| 1986 | - global_template->Set(isolate, "async_hooks", async_hooks_templ); | ||
| 1987 | - } | ||
| 1988 | - { | ||
| 1989 | - Local<ObjectTemplate> promise_template = ObjectTemplate::New(isolate); | ||
| 1990 | - promise_template->Set( | ||
| 1991 | - isolate, "setHooks", | ||
| 1992 | - FunctionTemplate::New(isolate, SetPromiseHooks, Local<Value>(), | ||
| 1993 | - Local<Signature>(), 4)); | ||
| 1994 | - global_template->Set(isolate, "promise", promise_template); | ||
| 1995 | - } | ||
| 1996 | - return global_template; | ||
| 2020 | + return realm_template; | ||
| 2021 | + } | ||
| 2022 | + Local<ObjectTemplate> Shell::CreateD8Template(Isolate* isolate) { | ||
| 2023 | + Local<ObjectTemplate> d8_template = ObjectTemplate::New(isolate); | ||
| 2024 | + d8_template->Set(isolate, "promise", | ||
| 2025 | + Shell::CreatePromiseHookTemplate(isolate)); | ||
| 2026 | + return d8_template; | ||
| 1997 | 2027 | } | |
| 1998 | 2028 | ||
| 1999 | 2029 | static void PrintMessageCallback(Local<Message> message, Local<Value> error) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -492,7 +492,17 @@ class Shell : public i::AllStatic { | |||
| 492 | 492 | static Local<String> Stringify(Isolate* isolate, Local<Value> value); | |
| 493 | 493 | static void RunShell(Isolate* isolate); | |
| 494 | 494 | static bool SetOptions(int argc, char* argv[]); | |
| 495 | + | ||
| 495 | 496 | static Local<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate); | |
| 497 | + static Local<ObjectTemplate> CreateOSTemplate(Isolate* isolate); | ||
| 498 | + static Local<FunctionTemplate> CreateWorkerTemplate(Isolate* isolate); | ||
| 499 | + static Local<ObjectTemplate> CreateAsyncHookTemplate(Isolate* isolate); | ||
| 500 | + static Local<ObjectTemplate> CreatePromiseHookTemplate(Isolate* isolate); | ||
| 501 | + static Local<ObjectTemplate> CreateTestRunnerTemplate(Isolate* isolate); | ||
| 502 | + static Local<ObjectTemplate> CreatePerformanceTemplate(Isolate* isolate); | ||
| 503 | + static Local<ObjectTemplate> CreateRealmTemplate(Isolate* isolate); | ||
| 504 | + static Local<ObjectTemplate> CreateD8Template(Isolate* isolate); | ||
| 505 | + | ||
| 496 | 506 | static MaybeLocal<Context> CreateRealm( | |
| 497 | 507 | const v8::FunctionCallbackInfo<v8::Value>& args, int index, | |
| 498 | 508 | v8::MaybeLocal<Value> global_object); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments