Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
dart::FrequencyCollator Class Reference
Inheritance diagram for dart::FrequencyCollator:
dart::ValueObject

Public Member Functions

 FrequencyCollator ()
 
void CountCharacter (intptr_t character)
 
intptr_t Frequency (intptr_t in_character)
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Detailed Description

Definition at line 245 of file regexp.cc.

Constructor & Destructor Documentation

◆ FrequencyCollator()

dart::FrequencyCollator::FrequencyCollator ( )
inline

Definition at line 247 of file regexp.cc.

247 : total_samples_(0) {
248 for (intptr_t i = 0; i < RegExpMacroAssembler::kTableSize; i++) {
249 frequencies_[i] = CharacterFrequency(i);
250 }
251 }
static constexpr intptr_t kTableSize

Member Function Documentation

◆ CountCharacter()

void dart::FrequencyCollator::CountCharacter ( intptr_t  character)
inline

Definition at line 253 of file regexp.cc.

253 {
254 intptr_t index = (character & RegExpMacroAssembler::kTableMask);
255 frequencies_[index].Increment();
256 total_samples_++;
257 }
static constexpr intptr_t kTableMask

◆ Frequency()

intptr_t dart::FrequencyCollator::Frequency ( intptr_t  in_character)
inline

Definition at line 261 of file regexp.cc.

261 {
262 ASSERT((in_character & RegExpMacroAssembler::kTableMask) == in_character);
263 if (total_samples_ < 1) return 1; // Division by zero.
264 intptr_t freq_in_per128 =
265 (frequencies_[in_character].counter() * 128) / total_samples_;
266 return freq_in_per128;
267 }
#define ASSERT(E)

The documentation for this class was generated from the following file: