summaryrefslogtreecommitdiff
path: root/deps/v8/src/objects/feedback-vector.tq
blob: 3305d47552ca427066881c1f42e73d48e395abce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// 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.

type TieringState extends uint16 constexpr 'TieringState';

bitfield struct FeedbackVectorFlags extends uint16 {
  tiering_state: TieringState: 3 bit;
  // Set for non-executed functions with --log-function-events in order to
  // log first-executions of code objects with minimal overhead.
  log_next_execution: bool: 1 bit;
  // Whether the maybe_optimized_code field contains a code object. 'maybe',
  // because they flag may lag behind the actual state of the world (it will be
  // updated in time).
  maybe_has_maglev_code: bool: 1 bit;
  maybe_has_turbofan_code: bool: 1 bit;
  // Just one bit, since only {kNone,kInProgress} are relevant for OSR.
  osr_tiering_state: TieringState: 1 bit;
  all_your_bits_are_belong_to_jgruber: uint32: 9 bit;
}

bitfield struct OsrState extends uint8 {
  // The layout is chosen s.t. osr_urgency and maybe_has_optimized_osr_code can
  // be loaded with a single load (i.e. no masking required).
  osr_urgency: uint32: 3 bit;
  maybe_has_optimized_osr_code: bool: 1 bit;
  // In order to have fast OSR checks in Ignition and Sparkplug, these bits
  // should remain 0. That way, the OSR check can be implemented as a single
  // comparison.
  dont_use_these_bits_unless_beneficial: uint32: 4 bit;
}

@generateBodyDescriptor
extern class FeedbackVector extends HeapObject {
  const length: int32;
  invocation_count: int32;
  // TODO(jgruber): We don't need 32 bits to count profiler_ticks (something
  // like 4 bits seems sufficient).
  profiler_ticks: int32;
  // TODO(jgruber): These bits are available and could be merged with
  // profiler_ticks.
  placeholder0: uint8;
  osr_state: OsrState;
  flags: FeedbackVectorFlags;
  shared_function_info: SharedFunctionInfo;
  closure_feedback_cell_array: ClosureFeedbackCellArray;
  @if(V8_EXTERNAL_CODE_SPACE) maybe_optimized_code: Weak<CodeDataContainer>;
  @ifnot(V8_EXTERNAL_CODE_SPACE) maybe_optimized_code: Weak<Code>;
  @cppRelaxedLoad raw_feedback_slots[length]: MaybeObject;
}

extern class FeedbackMetadata extends HeapObject;