OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 } | 1244 } |
1245 } | 1245 } |
1246 object_group_connections_.Clear(); | 1246 object_group_connections_.Clear(); |
1247 object_group_connections_.Initialize(kObjectGroupConnectionsCapacity); | 1247 object_group_connections_.Initialize(kObjectGroupConnectionsCapacity); |
1248 retainer_infos_.Clear(); | 1248 retainer_infos_.Clear(); |
1249 implicit_ref_connections_.Clear(); | 1249 implicit_ref_connections_.Clear(); |
1250 } | 1250 } |
1251 | 1251 |
1252 | 1252 |
1253 EternalHandles::EternalHandles() : size_(0) { | 1253 EternalHandles::EternalHandles() : size_(0) { |
1254 STATIC_ASSERT(v8::kUninitializedEternalIndex == kInvalidIndex); | |
1255 for (unsigned i = 0; i < ARRAY_SIZE(singleton_handles_); i++) { | 1254 for (unsigned i = 0; i < ARRAY_SIZE(singleton_handles_); i++) { |
1256 singleton_handles_[i] = kInvalidIndex; | 1255 singleton_handles_[i] = kInvalidIndex; |
1257 } | 1256 } |
1258 } | 1257 } |
1259 | 1258 |
1260 | 1259 |
1261 EternalHandles::~EternalHandles() { | 1260 EternalHandles::~EternalHandles() { |
1262 for (int i = 0; i < blocks_.length(); i++) delete[] blocks_[i]; | 1261 for (int i = 0; i < blocks_.length(); i++) delete[] blocks_[i]; |
1263 } | 1262 } |
1264 | 1263 |
(...skipping 21 matching lines...) Expand all Loading... |
1286 for (int i = 0; i < new_space_indices_.length(); i++) { | 1285 for (int i = 0; i < new_space_indices_.length(); i++) { |
1287 int index = new_space_indices_[i]; | 1286 int index = new_space_indices_[i]; |
1288 if (heap->InNewSpace(*GetLocation(index))) { | 1287 if (heap->InNewSpace(*GetLocation(index))) { |
1289 new_space_indices_[last++] = index; | 1288 new_space_indices_[last++] = index; |
1290 } | 1289 } |
1291 } | 1290 } |
1292 new_space_indices_.Rewind(last); | 1291 new_space_indices_.Rewind(last); |
1293 } | 1292 } |
1294 | 1293 |
1295 | 1294 |
1296 int EternalHandles::Create(Isolate* isolate, Object* object) { | 1295 void EternalHandles::Create(Isolate* isolate, Object* object, int* index) { |
1297 if (object == NULL) return kInvalidIndex; | 1296 ASSERT_EQ(kInvalidIndex, *index); |
| 1297 if (object == NULL) return; |
1298 ASSERT_NE(isolate->heap()->the_hole_value(), object); | 1298 ASSERT_NE(isolate->heap()->the_hole_value(), object); |
1299 int block = size_ >> kShift; | 1299 int block = size_ >> kShift; |
1300 int offset = size_ & kMask; | 1300 int offset = size_ & kMask; |
1301 // need to resize | 1301 // need to resize |
1302 if (offset == 0) { | 1302 if (offset == 0) { |
1303 Object** next_block = new Object*[kSize]; | 1303 Object** next_block = new Object*[kSize]; |
1304 Object* the_hole = isolate->heap()->the_hole_value(); | 1304 Object* the_hole = isolate->heap()->the_hole_value(); |
1305 MemsetPointer(next_block, the_hole, kSize); | 1305 MemsetPointer(next_block, the_hole, kSize); |
1306 blocks_.Add(next_block); | 1306 blocks_.Add(next_block); |
1307 } | 1307 } |
1308 ASSERT_EQ(isolate->heap()->the_hole_value(), blocks_[block][offset]); | 1308 ASSERT_EQ(isolate->heap()->the_hole_value(), blocks_[block][offset]); |
1309 blocks_[block][offset] = object; | 1309 blocks_[block][offset] = object; |
1310 if (isolate->heap()->InNewSpace(object)) { | 1310 if (isolate->heap()->InNewSpace(object)) { |
1311 new_space_indices_.Add(size_); | 1311 new_space_indices_.Add(size_); |
1312 } | 1312 } |
1313 return size_++; | 1313 *index = size_++; |
1314 } | 1314 } |
1315 | 1315 |
1316 | 1316 |
1317 } } // namespace v8::internal | 1317 } } // namespace v8::internal |
OLD | NEW |