Add counter to track number compiled functiond with one-shot bytecodes.
Typically compiler does not have to compile one-shot code but, there are some cases where user can capture IIFEs and execute it multiple times. Adding counter to track number of such closures compiled with one-shot bytecodes. Bug: v8:8072 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng Change-Id: I752a12cff6ee9bb751323f4d58897cdd41c6890c Reviewed-on: https://chromium-review.googlesource.com/c/1237679 Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#56862}
This commit is contained in:
parent
3b98c90e64
commit
c2021a857a
@ -7361,6 +7361,7 @@ class V8_EXPORT Isolate {
|
||||
kDateToLocaleTimeString = 68,
|
||||
kAttemptOverrideReadOnlyOnPrototypeSloppy = 69,
|
||||
kAttemptOverrideReadOnlyOnPrototypeStrict = 70,
|
||||
kOptimizedFunctionWithOneShotBytecode = 71,
|
||||
|
||||
// If you add new values here, you'll also need to update Chromium's:
|
||||
// web_feature.mojom, UseCounterCallback.cpp, and enums.xml. V8 changes to
|
||||
|
@ -903,9 +903,20 @@ void BytecodeGraphBuilder::VisitBytecodes() {
|
||||
AdvanceToOsrEntryAndPeelLoops(&iterator, &source_position_iterator);
|
||||
}
|
||||
|
||||
bool has_one_shot_bytecode = false;
|
||||
for (; !iterator.done(); iterator.Advance()) {
|
||||
if (interpreter::Bytecodes::IsOneShotBytecode(
|
||||
iterator.current_bytecode())) {
|
||||
has_one_shot_bytecode = true;
|
||||
}
|
||||
VisitSingleBytecode(&source_position_iterator);
|
||||
}
|
||||
|
||||
if (has_one_shot_bytecode) {
|
||||
isolate()->CountUsage(
|
||||
v8::Isolate::UseCounterFeature::kOptimizedFunctionWithOneShotBytecode);
|
||||
}
|
||||
|
||||
set_bytecode_analysis(nullptr);
|
||||
set_bytecode_iterator(nullptr);
|
||||
DCHECK(exception_handlers_.empty());
|
||||
|
@ -687,6 +687,15 @@ class V8_EXPORT_PRIVATE Bytecodes final : public AllStatic {
|
||||
bytecode == Bytecode::kInvokeIntrinsic;
|
||||
}
|
||||
|
||||
// Returns true if the bytecode is an one-shot bytecode. One-shot bytecodes
|
||||
// don`t collect feedback and are intended for code that runs only once and
|
||||
// shouldn`t be optimized.
|
||||
static constexpr bool IsOneShotBytecode(Bytecode bytecode) {
|
||||
return bytecode == Bytecode::kCallNoFeedback ||
|
||||
bytecode == Bytecode::kLdaNamedPropertyNoFeedback ||
|
||||
bytecode == Bytecode::kStaNamedPropertyNoFeedback;
|
||||
}
|
||||
|
||||
// Returns true if the bytecode is a scaling prefix bytecode.
|
||||
static constexpr bool IsPrefixScalingBytecode(Bytecode bytecode) {
|
||||
return bytecode == Bytecode::kExtraWide || bytecode == Bytecode::kWide ||
|
||||
|
Loading…
Reference in New Issue
Block a user