V8 Project
v8::internal::Vector< T > Class Template Reference

#include <vector.h>

+ Inheritance diagram for v8::internal::Vector< T >:
+ Collaboration diagram for v8::internal::Vector< T >:

Classes

class  RawComparer
 

Public Member Functions

 Vector ()
 
 Vector (T *data, int length)
 
Vector< TSubVector (int from, int to)
 
int length () const
 
bool is_empty () const
 
Tstart () const
 
Toperator[] (int index) const
 
const Tat (int index) const
 
Tfirst ()
 
Tlast ()
 
Vector< TClone () const
 
void Sort (int(*cmp)(const T *, const T *))
 
void Sort ()
 
void Truncate (int length)
 
void Dispose ()
 
Vector< Toperator+ (int offset)
 
bool operator== (const Vector< T > &other) const
 

Static Public Member Functions

static Vector< TNew (int length)
 
static Vector< Tempty ()
 
template<typename S >
static Vector< Tcast (Vector< S > input)
 

Protected Member Functions

void set_start (T *start)
 

Private Attributes

Tstart_
 
int length_
 

Detailed Description

template<typename T>
class v8::internal::Vector< T >

Definition at line 20 of file vector.h.

Constructor & Destructor Documentation

◆ Vector() [1/2]

template<typename T >
v8::internal::Vector< T >::Vector ( )
inline

Definition at line 22 of file vector.h.

22 : start_(NULL), length_(0) {}
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 NULL

◆ Vector() [2/2]

template<typename T >
v8::internal::Vector< T >::Vector ( T data,
int  length 
)
inline

Definition at line 23 of file vector.h.

23  : start_(data), length_(length) {
24  DCHECK(length == 0 || (length > 0 && data != NULL));
25  }
int length() const
Definition: vector.h:41
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, v8::internal::Vector< T >::length(), and NULL.

+ Here is the call graph for this function:

Member Function Documentation

◆ at()

template<typename T >
const T& v8::internal::Vector< T >::at ( int  index) const
inline

Definition at line 55 of file vector.h.

55 { return operator[](index); }
T & operator[](int index) const
Definition: vector.h:50

References v8::internal::Vector< T >::operator[]().

Referenced by v8::internal::CallJsBuiltin().

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

◆ cast()

template<typename T >
template<typename S >
static Vector<T> v8::internal::Vector< T >::cast ( Vector< S input)
inlinestatic

Definition at line 98 of file vector.h.

98  {
99  return Vector<T>(reinterpret_cast<T*>(input.start()),
100  input.length() * sizeof(S) / sizeof(T));
101  }
#define T(name, string, precedence)
Definition: token.cc:25

References v8::internal::Vector< T >::length(), v8::internal::S, v8::internal::Vector< T >::start(), and T.

+ Here is the call graph for this function:

◆ Clone()

template<typename T >
Vector<T> v8::internal::Vector< T >::Clone ( ) const
inline

Definition at line 62 of file vector.h.

62  {
63  T* result = NewArray<T>(length_);
64  for (int i = 0; i < length_; i++) result[i] = start_[i];
65  return Vector<T>(result, length_);
66  }

References v8::internal::Vector< T >::length_, v8::internal::Vector< T >::start_, and T.

Referenced by v8::internal::CommandMessage::New().

+ Here is the caller graph for this function:

◆ Dispose()

template<typename T >
void v8::internal::Vector< T >::Dispose ( )
inline

Definition at line 83 of file vector.h.

83  {
85  start_ = NULL;
86  length_ = 0;
87  }
void DeleteArray(T *array)
Definition: allocation.h:68

References v8::internal::DeleteArray(), v8::internal::Vector< T >::length_, NULL, and v8::internal::Vector< T >::start_.

Referenced by v8::internal::LiteralBuffer::ConvertToTwoByte(), v8::internal::CommandMessage::Dispose(), v8::internal::LiteralBuffer::ExpandBuffer(), and v8::internal::LiteralBuffer::~LiteralBuffer().

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

◆ empty()

template<typename T >
static Vector<T> v8::internal::Vector< T >::empty ( )
inlinestatic

Definition at line 95 of file vector.h.

95 { return Vector<T>(NULL, 0); }

References NULL.

Referenced by v8::internal::SetVectorContents().

+ Here is the caller graph for this function:

◆ first()

template<typename T >
T& v8::internal::Vector< T >::first ( )
inline

Definition at line 57 of file vector.h.

57 { return start_[0]; }

References v8::internal::Vector< T >::start_.

◆ is_empty()

template<typename T >
bool v8::internal::Vector< T >::is_empty ( ) const
inline

Definition at line 44 of file vector.h.

44 { return length_ == 0; }

References v8::internal::Vector< T >::length_.

◆ last()

template<typename T >
T& v8::internal::Vector< T >::last ( )
inline

Definition at line 59 of file vector.h.

59 { return start_[length_ - 1]; }

References v8::internal::Vector< T >::length_, and v8::internal::Vector< T >::start_.

◆ length()

template<typename T >
int v8::internal::Vector< T >::length ( ) const
inline

Definition at line 41 of file vector.h.

41 { return length_; }

References v8::internal::Vector< T >::length_.

Referenced by v8::internal::Collector< T, growth_factor, max_growth >::AddBlock(), v8::internal::SimpleStringBuilder::AddCharacter(), v8::internal::StringBuilder::AddFormattedList(), v8::internal::DuplicateFinder::AddNumber(), v8::internal::ProfileTree::AddPathFromEnd(), v8::internal::AllocationTraceTree::AddPathFromEnd(), v8::internal::ProfileTree::AddPathFromStart(), v8::internal::RegExpBuilder::AddQuantifierToAtom(), v8::internal::SimpleStringBuilder::AddSubstring(), v8::internal::Heap::AllocateOneByteInternalizedString(), v8::internal::Heap::AllocateTwoByteInternalizedString(), v8::internal::AstRawString::AsArrayIndex(), v8::internal::Bignum::AssignDecimalString(), v8::internal::Bignum::AssignHexString(), v8::internal::DuplicateFinder::BackupKey(), v8::internal::BignumStrtod(), v8::internal::StringSearch< PatternChar, SubjectChar >::BoyerMooreHorspoolSearch(), v8::internal::StringSearch< PatternChar, SubjectChar >::BoyerMooreSearch(), v8::internal::CalculateLineEndsImpl(), v8::internal::Vector< T >::cast(), v8::internal::AstRawString::Compare(), v8::internal::StringHasher::ComputeUtf8Hash(), v8::internal::LiteralBuffer::ConvertToTwoByte(), v8::internal::Heap::CopyCode(), v8::internal::CodeAgingHelper::CopyYoungSequenceTo(), v8::internal::Logger::DebugEvent(), v8::internal::CodeSerializer::Deserialize(), v8::internal::DiyFpStrtod(), v8::internal::DoubleStrtod(), v8::internal::DoubleToCString(), v8::internal::DropActivationsInActiveThreadImpl(), v8::internal::Debug::EnqueueCommandMessage(), v8::internal::TextNode::FilterOneByte(), v8::internal::SimpleStringBuilder::Finalize(), v8::internal::FindOneByteStringIndices(), v8::internal::FindStringIndices(), v8::internal::FindStringIndicesDispatch(), v8::internal::FindTwoByteStringIndices(), v8::V8::GetCompressedStartupData(), v8::internal::AstValueFactory::GetOneByteString(), v8::internal::TextNode::GetQuickCheckDetails(), v8::internal::AstValueFactory::GetString(), v8::internal::AstValueFactory::GetTwoByteString(), v8::internal::SequentialStringKey< Char >::Hash(), v8::internal::DuplicateFinder::Hash(), v8::internal::FINAL< kOperandKind, kNumCachedOperands >::HCallWithDescriptor(), v8::internal::StringSearch< PatternChar, SubjectChar >::InitialSearch(), v8::internal::LiteralBuffer::INLINE(), v8::Shell::InstallUtilityScript(), v8::internal::AstRawString::Internalize(), v8::internal::IntToCString(), v8::internal::LiteralBuffer::is_contextual_keyword(), v8::internal::DuplicateFinder::IsNumberCanonical(), v8::internal::Heap::IsOneByte(), v8::internal::AstRawString::IsOneByteEqualTo(), v8::internal::String::IsOneByteEqualTo(), v8::internal::String::IsTwoByteEqualTo(), v8::internal::String::IsUtf8EqualTo(), v8::internal::CodeAgingHelper::IsYoung(), v8::internal::JoinSparseArrayWithSeparator(), v8::internal::AstRawString::length(), v8::internal::StringSearch< PatternChar, SubjectChar >::LinearSearch(), v8::internal::Vector< T >::New(), v8::internal::FINAL< kOperandKind, kNumCachedOperands >::New(), v8::internal::LiteralBuffer::NewCapacity(), v8::internal::SequenceCollector< T, growth_factor, max_growth >::NewChunk(), v8::internal::Debug::NotifyMessageHandler(), v8::internal::CompiledReplacement::ParseReplacementPattern(), v8::internal::JSFunction::PassesFilter(), v8::internal::PatchPositionsInCode(), v8::internal::RawMatch(), v8::internal::Deserializer::ReadChunk(), v8::internal::ReadDiyFp(), v8::internal::ReadUint64(), v8::internal::ProfileGenerator::RecordTickSample(), v8::internal::Scanner::ScanIdentifierOrKeyword(), v8::internal::HeapSnapshotJSONSerializer::SerializeStrings(), v8::internal::HeapSnapshotJSONSerializer::SerializeTraceNode(), v8::internal::StringSearch< PatternChar, SubjectChar >::SingleCharSearch(), v8::internal::SimpleStringBuilder::size(), v8::internal::Vector< T >::Sort(), v8::internal::CharacterRange::Split(), v8::internal::StringMatchBackwards(), v8::internal::StringSearch< PatternChar, SubjectChar >::StringSearch(), v8::internal::StringToDouble(), v8::internal::StringToInt(), v8::internal::StrNCpy(), v8::internal::Strtod(), v8::internal::TextNode::TextEmitPass(), v8::internal::TrimLeadingZeros(), v8::internal::TrimToMaxSignificantDigits(), v8::internal::TrimTrailingZeros(), v8::internal::Vector< T >::Truncate(), v8::internal::Vector< T >::Vector(), v8::internal::compiler::Pipeline::VerifyAndPrintGraph(), v8::internal::VSNPrintF(), v8::internal::WriteOneByteData(), v8::internal::CompleteParserRecorder::WriteString(), v8::internal::Collector< T, growth_factor, max_growth >::WriteTo(), v8::internal::WriteTwoByteData(), v8::internal::CodeAgingHelper::young_sequence_length(), and v8::internal::LiteralBuffer::~LiteralBuffer().

◆ New()

template<typename T >
static Vector<T> v8::internal::Vector< T >::New ( int  length)
inlinestatic

Definition at line 27 of file vector.h.

27  {
28  return Vector<T>(NewArray<T>(length), length);
29  }

References v8::internal::Vector< T >::length().

Referenced by v8::internal::Collector< T, growth_factor, max_growth >::Collector(), v8::internal::LiteralBuffer::ConvertToTwoByte(), v8::internal::LiteralBuffer::ExpandBuffer(), v8::internal::StringsStorage::GetCopy(), v8::internal::StringsStorage::GetVFormatted(), v8::internal::Collector< T, growth_factor, max_growth >::NewChunk(), v8::internal::SequenceCollector< T, growth_factor, max_growth >::NewChunk(), v8::internal::SimpleStringBuilder::SimpleStringBuilder(), and v8::internal::Collector< T, growth_factor, max_growth >::ToVector().

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

◆ operator+()

template<typename T >
Vector<T> v8::internal::Vector< T >::operator+ ( int  offset)
inline

Definition at line 89 of file vector.h.

89  {
90  DCHECK(offset < length_);
91  return Vector<T>(start_ + offset, length_ - offset);
92  }

References DCHECK, v8::internal::Vector< T >::length_, and v8::internal::Vector< T >::start_.

◆ operator==()

template<typename T >
bool v8::internal::Vector< T >::operator== ( const Vector< T > &  other) const
inline

Definition at line 103 of file vector.h.

103  {
104  if (length_ != other.length_) return false;
105  if (start_ == other.start_) return true;
106  for (int i = 0; i < length_; ++i) {
107  if (start_[i] != other.start_[i]) {
108  return false;
109  }
110  }
111  return true;
112  }

References v8::internal::Vector< T >::length_, and v8::internal::Vector< T >::start_.

◆ operator[]()

template<typename T >
T& v8::internal::Vector< T >::operator[] ( int  index) const
inline

Definition at line 50 of file vector.h.

50  {
51  DCHECK(0 <= index && index < length_);
52  return start_[index];
53  }

References DCHECK, v8::internal::Vector< T >::length_, and v8::internal::Vector< T >::start_.

Referenced by v8::internal::Vector< T >::at().

+ Here is the caller graph for this function:

◆ set_start()

template<typename T >
void v8::internal::Vector< T >::set_start ( T start)
inlineprotected

Definition at line 115 of file vector.h.

115 { start_ = start; }
T * start() const
Definition: vector.h:47

References v8::internal::Vector< T >::start(), and v8::internal::Vector< T >::start_.

Referenced by v8::internal::EmbeddedVector< T, kSize >::EmbeddedVector(), and v8::internal::EmbeddedVector< T, kSize >::operator=().

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

◆ Sort() [1/2]

template<typename T >
void v8::internal::Vector< T >::Sort ( )
inline

Definition at line 72 of file vector.h.

72  {
73  std::sort(start(), start() + length());
74  }

References v8::internal::Vector< T >::length(), and v8::internal::Vector< T >::start().

+ Here is the call graph for this function:

◆ Sort() [2/2]

template<typename T >
void v8::internal::Vector< T >::Sort ( int(*)(const T *, const T *)  cmp)
inline

Definition at line 68 of file vector.h.

68  {
69  std::sort(start(), start() + length(), RawComparer(cmp));
70  }

References v8::internal::Vector< T >::length(), and v8::internal::Vector< T >::start().

+ Here is the call graph for this function:

◆ start()

template<typename T >
T* v8::internal::Vector< T >::start ( ) const
inline

Definition at line 47 of file vector.h.

47 { return start_; }

References v8::internal::Vector< T >::start_.

Referenced by v8::internal::OutputStreamWriter::AddNumberImpl(), v8::internal::ProfileTree::AddPathFromEnd(), v8::internal::AllocationTraceTree::AddPathFromEnd(), v8::internal::ProfileTree::AddPathFromStart(), v8::internal::OutputStreamWriter::AddSubstring(), v8::internal::Heap::AllocateOneByteInternalizedString(), v8::internal::Heap::AllocateTwoByteInternalizedString(), v8::internal::CallJsBuiltin(), v8::internal::Vector< T >::cast(), v8::internal::AstRawString::Compare(), v8::internal::StringHasher::ComputeUtf8Hash(), v8::internal::LiteralBuffer::ConvertToTwoByte(), v8::internal::Heap::CopyCode(), v8::internal::CodeAgingHelper::CopyYoungSequenceTo(), v8::internal::DoubleToCString(), v8::internal::Debug::EnqueueCommandMessage(), v8::internal::LiteralBuffer::ExpandBuffer(), v8::internal::TextNode::FilterOneByte(), v8::internal::SimpleStringBuilder::Finalize(), v8::internal::FindOneByteStringIndices(), v8::internal::FindTwoByteStringIndices(), v8::internal::AstRawString::FirstCharacter(), v8::V8::GetCompressedStartupData(), v8::internal::StringsStorage::GetCopy(), v8::internal::AstValueFactory::GetOneByteString(), v8::internal::AstValueFactory::GetString(), v8::internal::AstValueFactory::GetTwoByteString(), v8::internal::StringsStorage::GetVFormatted(), v8::internal::SequentialStringKey< Char >::Hash(), v8::internal::StringSearch< PatternChar, SubjectChar >::InitialSearch(), v8::Shell::InstallUtilityScript(), v8::internal::IntToCString(), v8::internal::LiteralBuffer::is_contextual_keyword(), v8::internal::AstRawString::IsOneByteEqualTo(), v8::internal::String::IsOneByteEqualTo(), v8::internal::String::IsTwoByteEqualTo(), v8::internal::String::IsUtf8EqualTo(), v8::internal::CodeAgingHelper::IsYoung(), v8::internal::StringSearch< PatternChar, SubjectChar >::LinearSearch(), v8::internal::Logger::LogCompiledFunctions(), v8::internal::LowLevelLogger::LowLevelLogger(), v8::internal::String::MakeExternal(), v8::internal::Debug::NotifyMessageHandler(), v8::Object::ObjectProtoToString(), v8::internal::LiteralBuffer::one_byte_literal(), v8::internal::PatchPositionsInCode(), v8::internal::PerfBasicLogger::PerfBasicLogger(), v8::internal::FlatStringReader::PostGarbageCollection(), v8::internal::AstRawString::raw_data(), v8::internal::Deserializer::ReadChunk(), v8::internal::ProfileGenerator::RecordTickSample(), v8::internal::RUNTIME_FUNCTION(), v8::internal::Scanner::ScanIdentifierOrKeyword(), v8::internal::HeapSnapshotJSONSerializer::SerializeNode(), v8::internal::Vector< T >::set_start(), v8::internal::FlagList::SetFlagsFromString(), v8::internal::StringSearch< PatternChar, SubjectChar >::SingleCharSearch(), v8::internal::Vector< T >::Sort(), v8::internal::StringToDouble(), v8::internal::StringToInt(), v8::internal::StrNCpy(), v8::internal::Vector< T >::SubVector(), v8::internal::TrimLeadingZeros(), v8::internal::TrimTrailingZeros(), v8::internal::LiteralBuffer::two_byte_literal(), v8::internal::compiler::Pipeline::VerifyAndPrintGraph(), v8::internal::VSNPrintF(), v8::internal::OutputStreamWriter::WriteChunk(), v8::internal::WriteOneByteData(), v8::internal::WriteTwoByteData(), and v8::internal::ScopedVector< T >::~ScopedVector().

+ Here is the caller graph for this function:

◆ SubVector()

template<typename T >
Vector<T> v8::internal::Vector< T >::SubVector ( int  from,
int  to 
)
inline

Definition at line 33 of file vector.h.

33  {
35  SLOW_DCHECK(from < to);
36  DCHECK(0 <= from);
37  return Vector<T>(start() + from, to - from);
38  }
#define SLOW_DCHECK(condition)
Definition: checks.h:30
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 DCHECK, v8::internal::Vector< T >::length_, SLOW_DCHECK, v8::internal::Vector< T >::start(), and to().

Referenced by v8::internal::OutputStreamWriter::AddNumberImpl(), v8::internal::RegExpBuilder::AddQuantifierToAtom(), v8::internal::JSFunction::PassesFilter(), v8::internal::TrimLeadingZeros(), and v8::internal::TrimTrailingZeros().

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

◆ Truncate()

template<typename T >
void v8::internal::Vector< T >::Truncate ( int  length)
inline

Definition at line 76 of file vector.h.

76  {
77  DCHECK(length <= length_);
78  length_ = length;
79  }

References DCHECK, v8::internal::Vector< T >::length(), and v8::internal::Vector< T >::length_.

+ Here is the call graph for this function:

Member Data Documentation

◆ length_

◆ start_


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