5 #ifndef V8_HYDROGEN_UNIQUE_H_
6 #define V8_HYDROGEN_UNIQUE_H_
48 DCHECK(!AllowHeapAllocation::IsAllowed() ||
handle->IsMap());
132 template <
typename T>
140 : size_(0), capacity_(capacity),
142 DCHECK(capacity <= kMaxCapacity);
155 for (
int i = 0;
i < size_;
i++) {
156 if (array_[
i] == uniq)
return;
159 Grow(size_ + 1, zone);
160 for (
int j = size_ - 1; j >=
i; j--) array_[j + 1] = array_[j];
167 Grow(size_ + 1, zone);
168 array_[size_++] = uniq;
173 for (
int i = 0;
i < size_;
i++) {
174 if (array_[
i] == uniq) {
175 while (++
i < size_) array_[
i - 1] = array_[
i];
184 if (that->size_ != this->size_)
return false;
185 for (
int i = 0;
i < this->size_;
i++) {
186 if (this->array_[
i] != that->array_[
i])
return false;
193 template <
typename U>
195 for (
int i = 0;
i < this->size_; ++
i) {
206 if (that->size_ < this->size_)
return false;
208 for (
int i = 0;
i < this->size_;
i++) {
211 if (sought == that->array_[j++])
break;
213 if ((this->size_ -
i) > (that->size_ - j))
return false;
222 if (that->size_ == 0 || this->size_ == 0)
return new(zone)
UniqueSet<T>();
225 Min(this->size_, that->size_), zone);
227 int i = 0, j = 0, k = 0;
228 while (i < this->size_ && j < that->size_) {
232 out->array_[k++] = a;
249 if (that->size_ == 0)
return this->Copy(zone);
250 if (this->size_ == 0)
return that->Copy(zone);
253 this->size_ + that->size_, zone);
255 int i = 0, j = 0, k = 0;
256 while (i < this->size_ && j < that->size_) {
260 out->array_[k++] = a;
264 out->array_[k++] = a;
267 out->array_[k++] = b;
272 while (i < this->size_) out->array_[k++] = this->array_[
i++];
273 while (j < that->size_) out->array_[k++] = that->array_[j++];
282 if (that->size_ == 0)
return this->Copy(zone);
287 while (i < this->size_) {
289 if (!that->Contains(cand)) {
290 out->array_[j++] = cand;
302 copy->size_ = this->size_;
303 memcpy(copy->array_, this->array_, this->size_ *
sizeof(
Unique<T>));
316 DCHECK(index >= 0 && index < size_);
317 return array_[index];
323 static const int kMaxCapacity = 65535;
332 if (capacity_ <
size) {
333 int new_capacity = 2 * capacity_ +
size;
334 if (new_capacity > kMaxCapacity) new_capacity = kMaxCapacity;
337 memcpy(new_array, array_, size_ *
sizeof(
Unique<T>));
339 capacity_ = new_capacity;
Source to read snapshot and builtins files from.
void Remove(Unique< T > uniq)
UniqueSet< T > * Intersect(const UniqueSet< T > *that, Zone *zone) const
bool IsSubset(const UniqueSet< T > *that) const
bool Contains(const Unique< U > elem) const
void Grow(int size, Zone *zone)
UniqueSet< T > * Union(const UniqueSet< T > *that, Zone *zone) const
UniqueSet(int capacity, Zone *zone)
void Add(Unique< T > uniq, Zone *zone)
UniqueSet(Unique< T > uniq, Zone *zone)
Unique< T > at(int index) const
bool Equals(const UniqueSet< T > *that) const
UniqueSet< T > * Subtract(const UniqueSet< T > *that, Zone *zone) const
UniqueSet< T > * Copy(Zone *zone) const
Unique(Handle< T > handle)
intptr_t Hashcode() const
Handle< T > handle() const
static Unique< T > cast(Unique< S > that)
Unique(Address raw_address, Handle< T > handle)
bool operator==(const Unique< U > &other) const
bool IsKnownGlobal(void *global) const
static Unique< T > CreateImmovable(Handle< T > handle)
bool IsInitialized() const
friend class SideEffectsTracker
static Unique< T > CreateUninitialized(Handle< T > handle)
bool operator!=(const Unique< U > &other) const
enable harmony numeric enable harmony object literal extensions Optimize object size
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
#define DCHECK_NE(v1, v2)
#define DCHECK(condition)
T * NewArray(size_t size)
static LifetimePosition Min(LifetimePosition a, LifetimePosition b)
Debugger support for the V8 JavaScript engine.
#define T(name, string, precedence)