v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
processed-feedback.h
Go to the documentation of this file.
1// Copyright 2019 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_COMPILER_PROCESSED_FEEDBACK_H_
6#define V8_COMPILER_PROCESSED_FEEDBACK_H_
7
9
10namespace v8 {
11namespace internal {
12namespace compiler {
13
14class BinaryOperationFeedback;
15class TypeOfOpFeedback;
16class CallFeedback;
17class CompareOperationFeedback;
18class ElementAccessFeedback;
19class ForInFeedback;
20class GlobalAccessFeedback;
21class InstanceOfFeedback;
22class LiteralFeedback;
23class MegaDOMPropertyAccessFeedback;
24class NamedAccessFeedback;
25class RegExpLiteralFeedback;
26class TemplateObjectFeedback;
27
72
74 public:
76};
77
79 public:
83 explicit GlobalAccessFeedback(FeedbackSlotKind slot_kind); // Megamorphic
84
85 bool IsMegamorphic() const;
86
87 bool IsPropertyCell() const;
89
90 bool IsScriptContextSlot() const;
92 int slot_index() const;
93 bool immutable() const;
94
95 OptionalObjectRef GetConstantHint(JSHeapBroker* broker) const;
96
97 private:
98 OptionalObjectRef const cell_or_context_;
100};
101
124
126 public:
129
131
132 // A transition group is a target and a possibly empty set of sources that can
133 // transition to the target. It is represented as a non-empty vector with the
134 // target at index 0.
137
139
140 void AddGroup(TransitionGroup&& group);
141
142 // Refine {this} by trying to restrict it to the maps in {inferred_maps}. A
143 // transition group's target is kept iff it is in {inferred_maps} or if more
144 // than one of its sources is in {inferred_maps}. Here's an (unrealistic)
145 // example showing all the possible situations:
146 //
147 // inferred_maps = [a0, a2, c1, c2, d1, e0, e1]
148 //
149 // Groups before: Groups after:
150 // [a0, a1, a2] [a0, a2]
151 // [b0]
152 // [c0, c1, c2, c3] [c0, c1, c2]
153 // [d0, d1] [d1]
154 // [e0, e1] [e0, e1]
155 //
157 JSHeapBroker* broker, ZoneVector<MapRef> const& inferred_maps) const;
159 JSHeapBroker* broker, ZoneRefSet<Map> const& inferred_maps,
160 bool always_keep_group_target = true) const;
162
163 private:
166};
167
185
196
198 public:
207
208 OptionalHeapObjectRef target() const { return target_; }
209 float frequency() const { return frequency_; }
212
213 private:
214 OptionalHeapObjectRef const target_;
215 float const frequency_;
218};
219
220template <class T, ProcessedFeedback::Kind K>
240
242 : public SingleValueFeedback<OptionalJSObjectRef,
243 ProcessedFeedback::kInstanceOf> {
245};
246
248 : public SingleValueFeedback<TypeOfFeedback::Result,
249 ProcessedFeedback::kTypeOf> {
251};
252
254 : public SingleValueFeedback<AllocationSiteRef,
255 ProcessedFeedback::kLiteral> {
257};
258
260 : public SingleValueFeedback<RegExpBoilerplateDescriptionRef,
261 ProcessedFeedback::kRegExpLiteral> {
263};
264
266 : public SingleValueFeedback<JSArrayRef,
267 ProcessedFeedback::kTemplateObject> {
269};
270
272 : public SingleValueFeedback<BinaryOperationHint,
273 ProcessedFeedback::kBinaryOperation> {
275};
276
278 : public SingleValueFeedback<CompareOperationHint,
279 ProcessedFeedback::kCompareOperation> {
281};
282
284 : public SingleValueFeedback<ForInHint, ProcessedFeedback::kForIn> {
286};
287
288} // namespace compiler
289} // namespace internal
290} // namespace v8
291
292#endif // V8_COMPILER_PROCESSED_FEEDBACK_H_
OptionalHeapObjectRef target() const
CallFeedback(OptionalHeapObjectRef target, float frequency, SpeculationMode mode, CallFeedbackContent call_feedback_content, FeedbackSlotKind slot_kind)
CallFeedbackContent call_feedback_content() const
OptionalHeapObjectRef const target_
ElementAccessFeedback(Zone *zone, KeyedAccessMode const &keyed_mode, FeedbackSlotKind slot_kind)
bool HasOnlyStringMaps(JSHeapBroker *broker) const
ZoneVector< TransitionGroup > const & transition_groups() const
ElementAccessFeedback const & Refine(JSHeapBroker *broker, ZoneVector< MapRef > const &inferred_maps) const
OptionalObjectRef GetConstantHint(JSHeapBroker *broker) const
GlobalAccessFeedback(PropertyCellRef cell, FeedbackSlotKind slot_kind)
InsufficientFeedback(FeedbackSlotKind slot_kind)
KeyedAccessMode(AccessMode access_mode, KeyedAccessLoadMode load_mode)
KeyedAccessStoreMode store_mode() const
static KeyedAccessMode FromNexus(FeedbackNexus const &nexus)
union v8::internal::compiler::KeyedAccessMode::LoadStoreMode load_store_mode_
KeyedAccessLoadMode load_mode() const
MegaDOMPropertyAccessFeedback(FunctionTemplateInfoRef info_ref, FeedbackSlotKind slot_kind)
NamedAccessFeedback(NameRef name, ZoneVector< MapRef > const &maps, FeedbackSlotKind slot_kind, bool has_deprecated_map_without_migration_target=false)
ZoneVector< MapRef > const & maps() const
ElementAccessFeedback const & AsElementAccess() const
ForInFeedback const & AsForIn() const
GlobalAccessFeedback const & AsGlobalAccess() const
InstanceOfFeedback const & AsInstanceOf() const
TypeOfOpFeedback const & AsTypeOf() const
RegExpLiteralFeedback const & AsRegExpLiteral() const
TemplateObjectFeedback const & AsTemplateObject() const
MegaDOMPropertyAccessFeedback const & AsMegaDOMPropertyAccess() const
BinaryOperationFeedback const & AsBinaryOperation() const
NamedAccessFeedback const & AsNamedAccess() const
ProcessedFeedback(Kind kind, FeedbackSlotKind slot_kind)
LiteralFeedback const & AsLiteral() const
CompareOperationFeedback const & AsCompareOperation() const
SingleValueFeedback(T value, FeedbackSlotKind slot_kind)
JSHeapBroker * broker
static const uint32_t K[64]
Definition sha-256.cc:36
#define DCHECK(condition)
Definition logging.h:482