39 using namespace v8::internal;
51 CHECK_EQ(table->NumberOfElements(), 1);
57 CHECK_EQ(table->NumberOfElements(), 1);
63 CHECK_EQ(table->NumberOfElements(), 1);
68 CHECK_EQ(table->NumberOfElements(), 0);
69 CHECK_EQ(table->NumberOfDeletedElements(), 1);
74 for (
int i = 0; i < 100; i++) {
78 CHECK_EQ(table->NumberOfElements(), i + 1);
80 CHECK_EQ(table->Lookup(*key), *value);
81 CHECK(key->GetIdentityHash()->IsSmi());
86 for (
int i = 0; i < 100; i++) {
91 CHECK(key->GetIdentityHash()->IsSmi());
96 for (
int i = 0; i < 100; i++) {
107 void insert(
int entry,
int key,
int value) {
132 for (
int i = 0; i < capacity - 1; i++) {
136 for (
int i = 0; i < capacity - 1; i++) {
145 for (
int i = 0; i < capacity / 2; i++) {
149 for (
int i = 0; i < capacity / 2; i++) {
157 TEST(ObjectHashSetCausesGC) {
158 i::FLAG_stress_compaction =
false;
179 CHECK(!table->Contains(*key));
188 CHECK(gc_count < isolate->heap()->gc_count());
194 TEST(ObjectHashTableCausesGC) {
195 i::FLAG_stress_compaction =
false;
215 CHECK(table->Lookup(*key)->IsTheHole());
220 CHECK(gc_count < isolate->heap()->gc_count());
Handle< ObjectHashTable > NewObjectHashTable(int at_least_space_for, MinimumCapacity capacity_option=USE_DEFAULT_MINIMUM_CAPACITY)
static const int kNotFound
#define CHECK_EQ(expected, value)
static Smi * FromInt(int value)
static Smi * cast(Object *object)
v8::Isolate * GetIsolate()
static Handle< ObjectHashSet > Add(Handle< ObjectHashSet > table, Handle< Object > key)
void insert(int entry, int key, int value)
static Handle< ObjectHashSet > Remove(Handle< ObjectHashSet > table, Handle< Object > key)
static Handle< Object > GetOrCreateIdentityHash(Handle< JSReceiver > object)
static i::Isolate * i_isolate()
bool SetHiddenValue(Handle< String > key, Handle< Value > value)
#define CHECK_NE(unexpected, value)
bool CollectGarbage(AllocationSpace space, const char *gc_reason=NULL, const GCCallbackFlags gc_callback_flags=kNoGCCallbackFlags)
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
static Handle< ObjectHashTable > Put(Handle< ObjectHashTable > table, Handle< Object > key, Handle< Object > value)
Handle< ObjectHashSet > NewObjectHashSet(int at_least_space_for)
Handle< JSArray > NewJSArray(ElementsKind elements_kind, int length, int capacity, ArrayStorageAllocationMode mode=INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, PretenureFlag pretenure=NOT_TENURED)