From b28f9445aae85dbf86033300cfcb55e404529a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 28 Apr 2021 18:28:46 +0200 Subject: refactor(core): simplify module loading code (#10385) General cleanup of module loading code, tried to reduce indentation in various methods on "JsRuntime" to improve readability. Added "JsRuntime::handle_scope" helper function, which returns a "v8::HandleScope". This was done to reduce a code pattern that happens all over the "deno_core". Additionally if event loop hangs during loading of dynamic modules a list of currently pending dynamic imports is printed. --- bench_util/src/js_runtime.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'bench_util/src/js_runtime.rs') diff --git a/bench_util/src/js_runtime.rs b/bench_util/src/js_runtime.rs index d5509d624..0752e2097 100644 --- a/bench_util/src/js_runtime.rs +++ b/bench_util/src/js_runtime.rs @@ -31,8 +31,7 @@ pub fn bench_js_sync( setup: impl FnOnce(&mut JsRuntime), ) { let mut runtime = create_js_runtime(setup); - let context = runtime.global_context(); - let scope = &mut v8::HandleScope::with_context(runtime.v8_isolate(), context); + let scope = &mut runtime.handle_scope(); // Increase JS iterations if profiling for nicer flamegraphs let inner_iters = 1000 * if is_profiling() { 10000 } else { 1 }; -- cgit v1.2.3