V8 Project
v8::internal::DispatchTable Class Reference

#include <jsregexp.h>

+ Inheritance diagram for v8::internal::DispatchTable:
+ Collaboration diagram for v8::internal::DispatchTable:

Classes

class  Config
 
class  Entry
 

Public Member Functions

 DispatchTable (Zone *zone)
 
void AddRange (CharacterRange range, int value, Zone *zone)
 
OutSetGet (uc16 value)
 
void Dump ()
 
template<typename Callback >
void ForEach (Callback *callback)
 
- Public Member Functions inherited from v8::internal::ZoneObject
 INLINE (void *operator new(size_t size, Zone *zone))
 
void operator delete (void *, size_t)
 
void operator delete (void *pointer, Zone *zone)
 

Private Member Functions

OutSetempty ()
 
ZoneSplayTree< Config > * tree ()
 

Private Attributes

OutSet empty_
 
ZoneSplayTree< Configtree_
 

Detailed Description

Definition at line 325 of file jsregexp.h.

Constructor & Destructor Documentation

◆ DispatchTable()

v8::internal::DispatchTable::DispatchTable ( Zone zone)
inlineexplicit

Definition at line 327 of file jsregexp.h.

327 : tree_(zone) { }
ZoneSplayTree< Config > tree_
Definition: jsregexp.h:378

Member Function Documentation

◆ AddRange()

void v8::internal::DispatchTable::AddRange ( CharacterRange  range,
int  value,
Zone zone 
)

Definition at line 5619 of file jsregexp.cc.

5620  {
5621  CharacterRange current = full_range;
5622  if (tree()->is_empty()) {
5623  // If this is the first range we just insert into the table.
5624  ZoneSplayTree<Config>::Locator loc;
5625  DCHECK_RESULT(tree()->Insert(current.from(), &loc));
5626  loc.set_value(Entry(current.from(), current.to(),
5627  empty()->Extend(value, zone)));
5628  return;
5629  }
5630  // First see if there is a range to the left of this one that
5631  // overlaps.
5632  ZoneSplayTree<Config>::Locator loc;
5633  if (tree()->FindGreatestLessThan(current.from(), &loc)) {
5634  Entry* entry = &loc.value();
5635  // If we've found a range that overlaps with this one, and it
5636  // starts strictly to the left of this one, we have to fix it
5637  // because the following code only handles ranges that start on
5638  // or after the start point of the range we're adding.
5639  if (entry->from() < current.from() && entry->to() >= current.from()) {
5640  // Snap the overlapping range in half around the start point of
5641  // the range we're adding.
5642  CharacterRange left(entry->from(), current.from() - 1);
5643  CharacterRange right(current.from(), entry->to());
5644  // The left part of the overlapping range doesn't overlap.
5645  // Truncate the whole entry to be just the left part.
5646  entry->set_to(left.to());
5647  // The right part is the one that overlaps. We add this part
5648  // to the map and let the next step deal with merging it with
5649  // the range we're adding.
5650  ZoneSplayTree<Config>::Locator loc;
5651  DCHECK_RESULT(tree()->Insert(right.from(), &loc));
5652  loc.set_value(Entry(right.from(),
5653  right.to(),
5654  entry->out_set()));
5655  }
5656  }
5657  while (current.is_valid()) {
5658  if (tree()->FindLeastGreaterThan(current.from(), &loc) &&
5659  (loc.value().from() <= current.to()) &&
5660  (loc.value().to() >= current.from())) {
5661  Entry* entry = &loc.value();
5662  // We have overlap. If there is space between the start point of
5663  // the range we're adding and where the overlapping range starts
5664  // then we have to add a range covering just that space.
5665  if (current.from() < entry->from()) {
5666  ZoneSplayTree<Config>::Locator ins;
5667  DCHECK_RESULT(tree()->Insert(current.from(), &ins));
5668  ins.set_value(Entry(current.from(),
5669  entry->from() - 1,
5670  empty()->Extend(value, zone)));
5671  current.set_from(entry->from());
5672  }
5673  DCHECK_EQ(current.from(), entry->from());
5674  // If the overlapping range extends beyond the one we want to add
5675  // we have to snap the right part off and add it separately.
5676  if (entry->to() > current.to()) {
5677  ZoneSplayTree<Config>::Locator ins;
5678  DCHECK_RESULT(tree()->Insert(current.to() + 1, &ins));
5679  ins.set_value(Entry(current.to() + 1,
5680  entry->to(),
5681  entry->out_set()));
5682  entry->set_to(current.to());
5683  }
5684  DCHECK(entry->to() <= current.to());
5685  // The overlapping range is now completely contained by the range
5686  // we're adding so we can just update it and move the start point
5687  // of the range we're adding just past it.
5688  entry->AddValue(value, zone);
5689  // Bail out if the last interval ended at 0xFFFF since otherwise
5690  // adding 1 will wrap around to 0.
5691  if (entry->to() == String::kMaxUtf16CodeUnit)
5692  break;
5693  DCHECK(entry->to() + 1 > current.from());
5694  current.set_from(entry->to() + 1);
5695  } else {
5696  // There is no overlap so we can just add the range
5697  ZoneSplayTree<Config>::Locator ins;
5698  DCHECK_RESULT(tree()->Insert(current.from(), &ins));
5699  ins.set_value(Entry(current.from(),
5700  current.to(),
5701  empty()->Extend(value, zone)));
5702  break;
5703  }
5704  }
5705 }
ZoneSplayTree< Config > * tree()
Definition: jsregexp.h:377
static const int kMaxUtf16CodeUnit
Definition: objects.h:8813
#define DCHECK_RESULT(expr)
Definition: logging.h:204
#define DCHECK(condition)
Definition: logging.h:205
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206

References v8::internal::DispatchTable::Entry::AddValue(), DCHECK, DCHECK_EQ, DCHECK_RESULT, empty(), v8::internal::DispatchTable::Entry::from(), v8::internal::CharacterRange::from(), v8::internal::CharacterRange::is_valid(), v8::internal::String::kMaxUtf16CodeUnit, v8::internal::DispatchTable::Entry::out_set(), v8::internal::CharacterRange::set_from(), v8::internal::DispatchTable::Entry::set_to(), v8::internal::DispatchTable::Entry::to(), v8::internal::CharacterRange::to(), and tree().

Referenced by v8::internal::DispatchTableConstructor::AddRange(), and v8::internal::CharacterRange::Split().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Dump()

void v8::internal::DispatchTable::Dump ( )

◆ empty()

OutSet* v8::internal::DispatchTable::empty ( )
inlineprivate

Definition at line 375 of file jsregexp.h.

375 { return &empty_; }

References empty_.

Referenced by AddRange(), and Get().

+ Here is the caller graph for this function:

◆ ForEach()

template<typename Callback >
void v8::internal::DispatchTable::ForEach ( Callback *  callback)
inline

Definition at line 368 of file jsregexp.h.

368  {
369  return tree()->ForEach(callback);
370  }

References tree().

Referenced by v8::internal::CharacterRange::Split().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Get()

OutSet * v8::internal::DispatchTable::Get ( uc16  value)

Definition at line 5708 of file jsregexp.cc.

5708  {
5709  ZoneSplayTree<Config>::Locator loc;
5710  if (!tree()->FindGreatestLessThan(value, &loc))
5711  return empty();
5712  Entry* entry = &loc.value();
5713  if (value <= entry->to())
5714  return entry->out_set();
5715  else
5716  return empty();
5717 }
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file

References empty(), v8::internal::DispatchTable::Entry::out_set(), to(), and tree().

+ Here is the call graph for this function:

◆ tree()

ZoneSplayTree<Config>* v8::internal::DispatchTable::tree ( )
inlineprivate

Definition at line 377 of file jsregexp.h.

377 { return &tree_; }

References tree_.

Referenced by AddRange(), ForEach(), and Get().

+ Here is the caller graph for this function:

Member Data Documentation

◆ empty_

OutSet v8::internal::DispatchTable::empty_
private

Definition at line 376 of file jsregexp.h.

Referenced by empty().

◆ tree_

ZoneSplayTree<Config> v8::internal::DispatchTable::tree_
private

Definition at line 378 of file jsregexp.h.

Referenced by tree().


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