Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[browser] disable enablePerfMeasure by default #86237

Merged
merged 3 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/mono/wasm/runtime/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export function passEmscriptenInternals(internals: EmscriptenInternals): void {
runtimeHelpers.ExitStatus = internals.ExitStatus;
}

// NOTE: this is called AFTER the config is loaded
export function setRuntimeGlobals(globalObjects: GlobalObjects) {
if (_runtimeModuleLoaded) {
throw new Error("Runtime module already loaded");
Expand All @@ -44,8 +45,6 @@ export function setRuntimeGlobals(globalObjects: GlobalObjects) {
exportedRuntimeAPI = globalObjects.api;

Object.assign(runtimeHelpers, {
mono_wasm_bindings_is_ready: false,
javaScriptExports: {} as any,
allAssetsInMemory: createPromiseController<void>(),
dotnetReady: createPromiseController<any>(),
memorySnapshotSkippedOrDone: createPromiseController<void>(),
Expand Down
1 change: 1 addition & 0 deletions src/mono/wasm/runtime/loader/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function deep_merge_module(target: DotnetModuleInternal, source: DotnetMo
return Object.assign(target, providedConfig);
}

// NOTE: this is called before setRuntimeGlobals
export function normalizeConfig() {
// normalize
const config = loaderHelpers.config;
Expand Down
15 changes: 15 additions & 0 deletions src/mono/wasm/runtime/loader/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ export let exportedRuntimeAPI: RuntimeAPI = null as any;
export let INTERNAL: any;
export let _loaderModuleLoaded = false; // please keep it in place also as rollup guard

export const globalObjectsRoot: GlobalObjects = {
mono: {},
binding: {},
internal: {},
module: {},
loaderHelpers: {},
runtimeHelpers: {},
api: {}
} as any;

setLoaderGlobals(globalObjectsRoot);

export function setLoaderGlobals(
globalObjects: GlobalObjects,
) {
Expand All @@ -39,7 +51,10 @@ export function setLoaderGlobals(
config: { environmentVariables: {} }
});
Object.assign(runtimeHelpers, {
mono_wasm_bindings_is_ready: false,
javaScriptExports: {} as any,
config: globalObjects.module.config,
enablePerfMeasure: true,
diagnosticTracing: false,
});
Object.assign(loaderHelpers, {
Expand Down
15 changes: 2 additions & 13 deletions src/mono/wasm/runtime/loader/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.

import type { MonoConfig, DotnetHostBuilder, DotnetModuleConfig, RuntimeAPI, WebAssemblyStartOptions } from "../types";
import type { MonoConfigInternal, GlobalObjects, EmscriptenModuleInternal, RuntimeModuleExportsInternal, NativeModuleExportsInternal, } from "../types/internal";
import type { MonoConfigInternal, EmscriptenModuleInternal, RuntimeModuleExportsInternal, NativeModuleExportsInternal, } from "../types/internal";

import { ENVIRONMENT_IS_NODE, ENVIRONMENT_IS_WEB, exportedRuntimeAPI, setLoaderGlobals } from "./globals";
import { ENVIRONMENT_IS_NODE, ENVIRONMENT_IS_WEB, exportedRuntimeAPI, globalObjectsRoot } from "./globals";
import { deep_merge_config, deep_merge_module, mono_wasm_load_config } from "./config";
import { mono_exit } from "./exit";
import { setup_proxy_console } from "./logging";
Expand All @@ -15,17 +15,6 @@ import { init_globalization } from "./icu";
import { setupPreloadChannelToMainThread } from "./worker";


export const globalObjectsRoot: GlobalObjects = {
mono: {},
binding: {},
internal: {},
module: {},
loaderHelpers: {},
runtimeHelpers: {},
api: {}
} as any;

setLoaderGlobals(globalObjectsRoot);
const module = globalObjectsRoot.module;
const monoConfig = module.config as MonoConfigInternal;

Expand Down