Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Side by Side Diff: test/cctest/test-dictionary.cc

Issue 257853003: ObjectHashTable's key and WeakHashTable's key types are now Handle<Object> instead of Object*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 Isolate* isolate = CcTest::i_isolate(); 133 Isolate* isolate = CcTest::i_isolate();
134 v8::HandleScope scope(context->GetIsolate()); 134 v8::HandleScope scope(context->GetIsolate());
135 // Test almost filled table. 135 // Test almost filled table.
136 { 136 {
137 Handle<ObjectHashTable> table = ObjectHashTable::New(isolate, 100); 137 Handle<ObjectHashTable> table = ObjectHashTable::New(isolate, 100);
138 ObjectHashTableTest* t = reinterpret_cast<ObjectHashTableTest*>(*table); 138 ObjectHashTableTest* t = reinterpret_cast<ObjectHashTableTest*>(*table);
139 int capacity = t->capacity(); 139 int capacity = t->capacity();
140 for (int i = 0; i < capacity - 1; i++) { 140 for (int i = 0; i < capacity - 1; i++) {
141 t->insert(i, i * i, i); 141 t->insert(i, i * i, i);
142 } 142 }
143 t->Rehash(Smi::FromInt(0)); 143 t->Rehash(handle(Smi::FromInt(0), isolate));
144 for (int i = 0; i < capacity - 1; i++) { 144 for (int i = 0; i < capacity - 1; i++) {
145 CHECK_EQ(i, t->lookup(i * i)); 145 CHECK_EQ(i, t->lookup(i * i));
146 } 146 }
147 } 147 }
148 // Test half-filled table. 148 // Test half-filled table.
149 { 149 {
150 Handle<ObjectHashTable> table = ObjectHashTable::New(isolate, 100); 150 Handle<ObjectHashTable> table = ObjectHashTable::New(isolate, 100);
151 ObjectHashTableTest* t = reinterpret_cast<ObjectHashTableTest*>(*table); 151 ObjectHashTableTest* t = reinterpret_cast<ObjectHashTableTest*>(*table);
152 int capacity = t->capacity(); 152 int capacity = t->capacity();
153 for (int i = 0; i < capacity / 2; i++) { 153 for (int i = 0; i < capacity / 2; i++) {
154 t->insert(i, i * i, i); 154 t->insert(i, i * i, i);
155 } 155 }
156 t->Rehash(Smi::FromInt(0)); 156 t->Rehash(handle(Smi::FromInt(0), isolate));
157 for (int i = 0; i < capacity / 2; i++) { 157 for (int i = 0; i < capacity / 2; i++) {
158 CHECK_EQ(i, t->lookup(i * i)); 158 CHECK_EQ(i, t->lookup(i * i));
159 } 159 }
160 } 160 }
161 } 161 }
162 162
163 163
164 #ifdef DEBUG 164 #ifdef DEBUG
165 template<class HashSet> 165 template<class HashSet>
166 static void TestHashSetCausesGC(Handle<HashSet> table) { 166 static void TestHashSetCausesGC(Handle<HashSet> table) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 LocalContext context; 239 LocalContext context;
240 v8::HandleScope scope(context->GetIsolate()); 240 v8::HandleScope scope(context->GetIsolate());
241 Isolate* isolate = CcTest::i_isolate(); 241 Isolate* isolate = CcTest::i_isolate();
242 TestHashMapCausesGC(ObjectHashTable::New(isolate, 1)); 242 TestHashMapCausesGC(ObjectHashTable::New(isolate, 1));
243 TestHashMapCausesGC(isolate->factory()->NewOrderedHashMap()); 243 TestHashMapCausesGC(isolate->factory()->NewOrderedHashMap());
244 } 244 }
245 #endif 245 #endif
246 246
247 247
248 } 248 }
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698