Bug 1667915 - Separate marker category from marker options - r=gregtatum

The `category.WithOptions(...)` syntax was a bit strange and difficult to explain.

Now the category and options are separate parameters. Default options can be specified with `MarkerOptions{}` or just `{}`.

As a special case, defaulted-NoPayload functions don't need `<>`, and defaulted-NoPayload functions and macros don't even need `{}` for default options, e.g.:
`profiler_add_marker("name", OTHER); PROFILER_MARKER_UNTYPED("name", OTHER);`

Differential Revision: https://phabricator.services.mozilla.com/D91680
This commit is contained in:
Gerald Squelart
2020-10-01 01:44:47 +00:00
parent 300de37f87
commit 4eb5bd3574
26 changed files with 380 additions and 360 deletions

View File

@@ -2863,10 +2863,9 @@ nsresult ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest) {
// mDataType of the request might remain set to DataType::Unknown.
MOZ_ASSERT(aRequest->IsTextSource() || aRequest->IsUnknownDataType());
LOG(("ScriptLoadRequest (%p): Evaluate Module", aRequest));
AUTO_PROFILER_MARKER_TEXT(
"ModuleEvaluation",
JS.WithOptions(MarkerInnerWindowIdFromDocShell(docShell)),
profilerLabelString);
AUTO_PROFILER_MARKER_TEXT("ModuleEvaluation", JS,
MarkerInnerWindowIdFromDocShell(docShell),
profilerLabelString);
// currentScript is set to null for modules.
AutoCurrentScriptUpdater scriptUpdater(this, nullptr);
@@ -2939,20 +2938,18 @@ nsresult ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest) {
} else {
LOG(("ScriptLoadRequest (%p): Decode Bytecode and Execute",
aRequest));
AUTO_PROFILER_MARKER_TEXT(
"BytecodeDecodeMainThread",
JS.WithOptions(MarkerInnerWindowIdFromDocShell(docShell)),
profilerLabelString);
AUTO_PROFILER_MARKER_TEXT("BytecodeDecodeMainThread", JS,
MarkerInnerWindowIdFromDocShell(docShell),
profilerLabelString);
rv = exec.Decode(options, aRequest->mScriptBytecode,
aRequest->mBytecodeOffset);
}
if (rv == NS_OK) {
AUTO_PROFILER_MARKER_TEXT(
"ScriptExecution",
JS.WithOptions(MarkerInnerWindowIdFromDocShell(docShell)),
profilerLabelString);
AUTO_PROFILER_MARKER_TEXT("ScriptExecution", JS,
MarkerInnerWindowIdFromDocShell(docShell),
profilerLabelString);
rv = ExecuteCompiledScript(cx, aRequest, exec, classicScript);
}
@@ -2986,8 +2983,8 @@ nsresult ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest) {
LOG(("ScriptLoadRequest (%p): Compile And Exec", aRequest));
if (aRequest->IsBinASTSource()) {
AUTO_PROFILER_MARKER_TEXT(
"BinASTDecodeMainThread",
JS.WithOptions(MarkerInnerWindowIdFromDocShell(docShell)),
"BinASTDecodeMainThread", JS,
MarkerInnerWindowIdFromDocShell(docShell),
profilerLabelString);
rv = exec.DecodeBinAST(options,
@@ -2999,8 +2996,8 @@ nsresult ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest) {
rv = GetScriptSource(cx, aRequest, &maybeSource);
if (NS_SUCCEEDED(rv)) {
AUTO_PROFILER_MARKER_TEXT(
"ScriptCompileMainThread",
JS.WithOptions(MarkerInnerWindowIdFromDocShell(docShell)),
"ScriptCompileMainThread", JS,
MarkerInnerWindowIdFromDocShell(docShell),
profilerLabelString);
rv = maybeSource.constructed<SourceText<char16_t>>()
@@ -3017,8 +3014,8 @@ nsresult ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest) {
if (rv == NS_OK) {
script = exec.GetScript();
AUTO_PROFILER_MARKER_TEXT(
"ScriptExecution",
JS.WithOptions(MarkerInnerWindowIdFromDocShell(docShell)),
"ScriptExecution", JS,
MarkerInnerWindowIdFromDocShell(docShell),
profilerLabelString);
rv = ExecuteCompiledScript(cx, aRequest, exec, classicScript);
}