v8/src/function-kind.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

195 lines
6.0 KiB
C
Raw Normal View History

// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_FUNCTION_KIND_H_
#define V8_FUNCTION_KIND_H_
#include "src/utils.h"
namespace v8 {
namespace internal {
enum FunctionKind : uint8_t {
// BEGIN constructable functions
kNormalFunction,
kModule,
// BEGIN class constructors
// BEGIN base constructors
kBaseConstructor,
// BEGIN default constructors
kDefaultBaseConstructor,
// END base constructors
// BEGIN derived cosntructors
kDefaultDerivedConstructor,
// END default constructors
kDerivedConstructor,
// END derived costructors
// END class cosntructors
// END constructable functions.
// BEGIN accessors
kGetterFunction,
kSetterFunction,
// END accessors
// BEGIN arrow functions
kArrowFunction,
// BEGIN async functions
kAsyncArrowFunction,
// END arrow functions
kAsyncFunction,
// BEGIN concise methods 1
kAsyncConciseMethod,
// BEGIN generators
kAsyncConciseGeneratorMethod,
// END concise methods 1
kAsyncGeneratorFunction,
// END async functions
kGeneratorFunction,
// BEGIN concise methods 2
kConciseGeneratorMethod,
// END generators
kConciseMethod,
kClassMembersInitializerFunction,
// END concise methods 2
kLastFunctionKind = kClassMembersInitializerFunction,
};
inline bool IsArrowFunction(FunctionKind kind) {
return IsInRange(kind, FunctionKind::kArrowFunction,
FunctionKind::kAsyncArrowFunction);
}
inline bool IsModule(FunctionKind kind) {
return kind == FunctionKind::kModule;
}
inline bool IsAsyncGeneratorFunction(FunctionKind kind) {
return IsInRange(kind, FunctionKind::kAsyncConciseGeneratorMethod,
FunctionKind::kAsyncGeneratorFunction);
}
inline bool IsGeneratorFunction(FunctionKind kind) {
return IsInRange(kind, FunctionKind::kAsyncConciseGeneratorMethod,
FunctionKind::kConciseGeneratorMethod);
}
inline bool IsAsyncFunction(FunctionKind kind) {
return IsInRange(kind, FunctionKind::kAsyncArrowFunction,
FunctionKind::kAsyncGeneratorFunction);
}
inline bool IsResumableFunction(FunctionKind kind) {
return IsGeneratorFunction(kind) || IsAsyncFunction(kind) || IsModule(kind);
}
inline bool IsConciseMethod(FunctionKind kind) {
return IsInRange(kind, FunctionKind::kAsyncConciseMethod,
FunctionKind::kAsyncConciseGeneratorMethod) ||
IsInRange(kind, FunctionKind::kConciseGeneratorMethod,
FunctionKind::kClassMembersInitializerFunction);
}
inline bool IsStrictFunctionWithoutPrototype(FunctionKind kind) {
return IsInRange(kind, FunctionKind::kGetterFunction,
FunctionKind::kAsyncArrowFunction) ||
IsInRange(kind, FunctionKind::kAsyncConciseMethod,
FunctionKind::kAsyncConciseGeneratorMethod) ||
IsInRange(kind, FunctionKind::kConciseGeneratorMethod,
FunctionKind::kClassMembersInitializerFunction);
}
inline bool IsGetterFunction(FunctionKind kind) {
return kind == FunctionKind::kGetterFunction;
}
inline bool IsSetterFunction(FunctionKind kind) {
return kind == FunctionKind::kSetterFunction;
}
inline bool IsAccessorFunction(FunctionKind kind) {
return IsInRange(kind, FunctionKind::kGetterFunction,
FunctionKind::kSetterFunction);
}
inline bool IsDefaultConstructor(FunctionKind kind) {
return IsInRange(kind, FunctionKind::kDefaultBaseConstructor,
FunctionKind::kDefaultDerivedConstructor);
}
inline bool IsBaseConstructor(FunctionKind kind) {
return IsInRange(kind, FunctionKind::kBaseConstructor,
FunctionKind::kDefaultBaseConstructor);
}
inline bool IsDerivedConstructor(FunctionKind kind) {
return IsInRange(kind, FunctionKind::kDefaultDerivedConstructor,
FunctionKind::kDerivedConstructor);
}
inline bool IsClassConstructor(FunctionKind kind) {
return IsInRange(kind, FunctionKind::kBaseConstructor,
FunctionKind::kDerivedConstructor);
}
inline bool IsClassMembersInitializerFunction(FunctionKind kind) {
return kind == FunctionKind::kClassMembersInitializerFunction;
}
inline bool IsConstructable(FunctionKind kind) {
return IsInRange(kind, FunctionKind::kNormalFunction,
FunctionKind::kDerivedConstructor);
}
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
inline const char* FunctionKind2String(FunctionKind kind) {
switch (kind) {
case FunctionKind::kNormalFunction:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "NormalFunction";
case FunctionKind::kArrowFunction:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "ArrowFunction";
case FunctionKind::kGeneratorFunction:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "GeneratorFunction";
case FunctionKind::kConciseMethod:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "ConciseMethod";
case FunctionKind::kDerivedConstructor:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "DerivedConstructor";
case FunctionKind::kBaseConstructor:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "BaseConstructor";
case FunctionKind::kGetterFunction:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "GetterFunction";
case FunctionKind::kSetterFunction:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "SetterFunction";
case FunctionKind::kAsyncFunction:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "AsyncFunction";
case FunctionKind::kModule:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "Module";
case FunctionKind::kClassMembersInitializerFunction:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "ClassMembersInitializerFunction";
case FunctionKind::kDefaultBaseConstructor:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "DefaultBaseConstructor";
case FunctionKind::kDefaultDerivedConstructor:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "DefaultDerivedConstructor";
case FunctionKind::kAsyncArrowFunction:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "AsyncArrowFunction";
case FunctionKind::kAsyncConciseMethod:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "AsyncConciseMethod";
case FunctionKind::kConciseGeneratorMethod:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "ConciseGeneratorMethod";
case FunctionKind::kAsyncConciseGeneratorMethod:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "AsyncConciseGeneratorMethod";
case FunctionKind::kAsyncGeneratorFunction:
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
return "AsyncGeneratorFunction";
}
UNREACHABLE();
}
[tracing] Improve tracing signals for compilation/optimization. This adds OBJECT/SNAPSHOT trace events for Script and SharedFunctionInfo objects, logging their creation with appropriate information to make sense of them. Based on that we introduces five flow events to model the optimized compilation via tracing in the "disabled-by-default-v8.compile" category: - "v8.optimizingCompile.start" logs the creation of the PipelineCompilationJob (for TurboFan JavaScript optimization) with the "function" argument referring to the trace event object created for the SharedFunctionInfo. - "v8.optimzingCompile.prepare" logs the preparation of the PipelineCompilationJob on the main thread, also carrying the "function" argument. This connects the flow event to the actual tracing duration event associated with the preparation phases. - "v8.optimizingCompile.execute" logs the (usually concurrent) optimization of the TurboFan graph (again with "function"). - "v8.optimizingCompile.finalize" logs the main thread phase which finalizes the optimized code and eventually installs it (in case of success). - "v8.optimizingCompile.end" signals the end of the PipelineCompilationJob, which carries the "compilationInfo", that contains the interesting bits of the OptimizedCompilationInfo, specifically whether the compile was successfull and which functions were inlined for example. This also adds two instant events "V8.AbortOptimization" and "V8.RetryOptimization" in "disabled-by-default-v8.compile" category that are emitted when TurboFan cannot optimize a certain function. In case of "V8.RetryOptimization", TurboFan might be able to optimize it later, whereas "V8.AbortOptimization" permanently disables the optimization of a given function. The JSON representation of this is ```js { "pid": 256639, "tid": 256639, "ts": 6935411377801, "tts": 159116, "ph": "I", "cat": "disabled-by-default-v8.compile", "name": "V8.AbortOptimization", "dur": 0, "tdur": 0, "args": { "reason": "Function is too big to be optimized", "function": { "id_ref": "0x600000001", "scope": "v8::internal::SharedFunctionInfo" } } }, ``` where the "function" refers to a previously emitted SNAPSHOT for the function in question. In the trace viewer it will show up as instant event under "v8.optimizingCompile.prepare" in case of the relevant example where optimization is disabled due to reaching the bytecode limit (as in the JSON above), i.e. it'll look something like this https://i.paste.pics/aafc2de9df10ea8f5acc1a761d80f07b.png for the example highlighted in the recent blog post https://ponyfoo.com/articles/javascript-performance-pitfalls-v8 that describes the optimization limit. The "v8.optimizingCompile.end" duration event will also carry this information as part of the "compilationInfo" object, but specifically for CI tools, etc. it might be a whole lot easier to just look for the "V8.AbortOptimization" instant event. Bug: v8:8598, v8:9039 Tbr: ulan@chromium.org Doc: bit.ly/v8-tracing-signals Change-Id: Ic87ac336004690c65b6b15ad73bc6fbd4b5f12c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511483 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#60448}
2019-03-25 14:14:25 +00:00
inline std::ostream& operator<<(std::ostream& os, FunctionKind kind) {
return os << FunctionKind2String(kind);
}
} // namespace internal
} // namespace v8
#endif // V8_FUNCTION_KIND_H_