Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Namespaces | Macros
token_position.h File Reference
#include "platform/utils.h"
#include "vm/allocation.h"

Go to the source code of this file.

Classes

class  dart::TokenPosition
 

Namespaces

namespace  dart
 

Macros

#define SENTINEL_TOKEN_DESCRIPTORS(V)
 
#define DECLARE_VALUES(name, value)
 
#define CHECK_VALUES(name, value)
 

Macro Definition Documentation

◆ CHECK_VALUES

#define CHECK_VALUES (   name,
  value 
)
Value:
static_assert(k##name##Pos < 0, "Non-negative sentinel descriptor"); \
static_assert( \
k##name##Pos == kNoSourcePos || k##name##Pos <= kBoxPos, \
"Box sentinel descriptor is not greatest classifying sentinel value"); \
static_assert(kLastPos <= k##name##Pos, \
"Last sentinel descriptor is not least sentinel valu"); \
SENTINEL_TOKEN_DESCRIPTORS(CHECK_VALUES);
const char * name
Definition fuchsia.cc:50
#define CHECK_VALUES(name, value)

Definition at line 142 of file token_position.h.

167 {
168 ASSERT(IsReal());
169 return TokenPosition(value_ + 1);
170 }
171
172 // Return the source position for real token positions.
173 inline intptr_t Pos() const {
174 ASSERT(IsReal());
175 return value_;
176 }
177
178 // Is |this| a classifying sentinel source position?
179 // Classifying positions are used by the profiler to group instructions whose
180 // cost isn't naturally attributable to a source location.
181 inline bool IsClassifying() const {
182 return (value_ >= kBox.value()) && (value_ <= kLast.value());
183 }
184
185 // Is |this| the no source position sentinel?
186 inline bool IsNoSource() const { return value_ == kNoSourcePos; }
187
188 // Is |this| a synthetic source position?
189 // Synthetic source positions are used by the profiler to attribute ticks to a
190 // pieces of source, but ignored by the debugger as potential breakpoints.
191 inline bool IsSynthetic() const { return value_ < kLastPos; }
192
193 // Is |this| a real source position?
194 inline bool IsReal() const { return value_ >= kMinSourcePos; }
195
196 // Is |this| a debug pause source position?
197 inline bool IsDebugPause() const { return IsReal(); }
198
199 // Creates a synthetic source position from a non-negative value.
200 static TokenPosition Synthetic(intptr_t value) {
201 ASSERT(value >= 0 && value <= kMaxSourcePos);
202 return TokenPosition((kLastPos - 1) - value);
203 }
204
205 // Encode the token position for storage in the coverage array.
206 intptr_t EncodeCoveragePosition(bool is_branch_coverage);
207
208 // Decode a token position that was stored in the coverage array.
209 static TokenPosition DecodeCoveragePosition(intptr_t encoded_position,
210 bool* is_branch_coverage);
211
212 const char* ToCString() const;
213
214 private:
215 explicit TokenPosition(intptr_t value) : value_(value) {}
216
217 // The raw value of this TokenPosition.
218 intptr_t value() const { return value_; }
219
220 int32_t value_;
221
223};
224
225} // namespace dart
226
227#endif // RUNTIME_VM_TOKEN_POSITION_H_
#define ASSERT(E)
uint8_t value
#define DISALLOW_ALLOCATION()
Definition globals.h:604

◆ DECLARE_VALUES

#define DECLARE_VALUES (   name,
  value 
)
Value:
static constexpr int32_t k##name##Pos = value; \
static const TokenPosition k##name;

Definition at line 136 of file token_position.h.

◆ SENTINEL_TOKEN_DESCRIPTORS

#define SENTINEL_TOKEN_DESCRIPTORS (   V)
Value:
V(NoSource, -1) \
V(Box, -2) \
V(ParallelMove, -3) \
V(TempMove, -4) \
V(Constant, -5) \
V(MoveArgument, -6) \
V(ControlFlow, -7) \
V(Context, -8) \
V(MethodExtractor, -9) \
V(DeferredSlowPath, -10) \
V(DeferredDeoptInfo, -11) \
V(DartCodePrologue, -12) \
V(DartCodeEpilogue, -13) \
V(Last, -14)
#define V(name)
Definition raw_object.h:124

Definition at line 43 of file token_position.h.