Revision f230a1cf deps/v8/test/cctest/test-dictionary.cc

View differences:

deps/v8/test/cctest/test-dictionary.cc
41 41

  
42 42
TEST(ObjectHashTable) {
43 43
  LocalContext context;
44
  Isolate* isolate = Isolate::Current();
44
  Isolate* isolate = CcTest::i_isolate();
45 45
  Factory* factory = isolate->factory();
46 46
  v8::HandleScope scope(context->GetIsolate());
47 47
  Handle<ObjectHashTable> table = factory->NewObjectHashTable(23);
......
50 50
  table = PutIntoObjectHashTable(table, a, b);
51 51
  CHECK_EQ(table->NumberOfElements(), 1);
52 52
  CHECK_EQ(table->Lookup(*a), *b);
53
  CHECK_EQ(table->Lookup(*b), HEAP->the_hole_value());
53
  CHECK_EQ(table->Lookup(*b), CcTest::heap()->the_hole_value());
54 54

  
55 55
  // Keys still have to be valid after objects were moved.
56
  HEAP->CollectGarbage(NEW_SPACE);
56
  CcTest::heap()->CollectGarbage(NEW_SPACE);
57 57
  CHECK_EQ(table->NumberOfElements(), 1);
58 58
  CHECK_EQ(table->Lookup(*a), *b);
59
  CHECK_EQ(table->Lookup(*b), HEAP->the_hole_value());
59
  CHECK_EQ(table->Lookup(*b), CcTest::heap()->the_hole_value());
60 60

  
61 61
  // Keys that are overwritten should not change number of elements.
62 62
  table = PutIntoObjectHashTable(table, a, factory->NewJSArray(13));
......
67 67
  table = PutIntoObjectHashTable(table, a, factory->the_hole_value());
68 68
  CHECK_EQ(table->NumberOfElements(), 0);
69 69
  CHECK_EQ(table->NumberOfDeletedElements(), 1);
70
  CHECK_EQ(table->Lookup(*a), HEAP->the_hole_value());
70
  CHECK_EQ(table->Lookup(*a), CcTest::heap()->the_hole_value());
71 71

  
72 72
  // Keys should map back to their respective values and also should get
73 73
  // an identity hash code generated.
......
87 87
    Handle<JSReceiver> key = factory->NewJSArray(7);
88 88
    CHECK(key->GetIdentityHash(ALLOW_CREATION)->ToObjectChecked()->IsSmi());
89 89
    CHECK_EQ(table->FindEntry(*key), ObjectHashTable::kNotFound);
90
    CHECK_EQ(table->Lookup(*key), HEAP->the_hole_value());
90
    CHECK_EQ(table->Lookup(*key), CcTest::heap()->the_hole_value());
91 91
    CHECK(key->GetIdentityHash(OMIT_CREATION)->ToObjectChecked()->IsSmi());
92 92
  }
93 93

  
......
95 95
  // should not get an identity hash code generated.
96 96
  for (int i = 0; i < 100; i++) {
97 97
    Handle<JSReceiver> key = factory->NewJSArray(7);
98
    CHECK_EQ(table->Lookup(*key), HEAP->the_hole_value());
99
    CHECK_EQ(key->GetIdentityHash(OMIT_CREATION), HEAP->undefined_value());
98
    CHECK_EQ(table->Lookup(*key), CcTest::heap()->the_hole_value());
99
    CHECK_EQ(key->GetIdentityHash(OMIT_CREATION),
100
             CcTest::heap()->undefined_value());
100 101
  }
101 102
}
102 103

  
......
120 121

  
121 122
TEST(HashTableRehash) {
122 123
  LocalContext context;
123
  Isolate* isolate = Isolate::Current();
124
  Isolate* isolate = CcTest::i_isolate();
124 125
  Factory* factory = isolate->factory();
125 126
  v8::HandleScope scope(context->GetIsolate());
126 127
  // Test almost filled table.
......
156 157
TEST(ObjectHashSetCausesGC) {
157 158
  i::FLAG_stress_compaction = false;
158 159
  LocalContext context;
159
  Isolate* isolate = Isolate::Current();
160
  Isolate* isolate = CcTest::i_isolate();
160 161
  Factory* factory = isolate->factory();
161 162
  v8::HandleScope scope(context->GetIsolate());
162 163
  Handle<ObjectHashSet> table = factory->NewObjectHashSet(1);
......
170 171

  
171 172
  // Simulate a full heap so that generating an identity hash code
172 173
  // in subsequent calls will request GC.
173
  SimulateFullSpace(HEAP->new_space());
174
  SimulateFullSpace(HEAP->old_pointer_space());
174
  SimulateFullSpace(CcTest::heap()->new_space());
175
  SimulateFullSpace(CcTest::heap()->old_pointer_space());
175 176

  
176 177
  // Calling Contains() should not cause GC ever.
177 178
  CHECK(!table->Contains(*key));
......
189 190
TEST(ObjectHashTableCausesGC) {
190 191
  i::FLAG_stress_compaction = false;
191 192
  LocalContext context;
192
  Isolate* isolate = Isolate::Current();
193
  Isolate* isolate = CcTest::i_isolate();
193 194
  Factory* factory = isolate->factory();
194 195
  v8::HandleScope scope(context->GetIsolate());
195 196
  Handle<ObjectHashTable> table = factory->NewObjectHashTable(1);
......
203 204

  
204 205
  // Simulate a full heap so that generating an identity hash code
205 206
  // in subsequent calls will request GC.
206
  SimulateFullSpace(HEAP->new_space());
207
  SimulateFullSpace(HEAP->old_pointer_space());
207
  SimulateFullSpace(CcTest::heap()->new_space());
208
  SimulateFullSpace(CcTest::heap()->old_pointer_space());
208 209

  
209 210
  // Calling Lookup() should not cause GC ever.
210 211
  CHECK(table->Lookup(*key)->IsTheHole());

Also available in: Unified diff