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

Side by Side Diff: src/mark-compact.cc

Issue 7635014: NewGC: Don't put tagged null pointers in garbage objects when updating pointers (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 4 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 | « no previous file | 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 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after
2363 2363
2364 2364
2365 static void UpdatePointer(HeapObject** p, HeapObject* object) { 2365 static void UpdatePointer(HeapObject** p, HeapObject* object) {
2366 ASSERT(*p == object); 2366 ASSERT(*p == object);
2367 2367
2368 Address old_addr = object->address(); 2368 Address old_addr = object->address();
2369 2369
2370 Address new_addr = Memory::Address_at(old_addr); 2370 Address new_addr = Memory::Address_at(old_addr);
2371 2371
2372 // The new space sweep will overwrite the map word of dead objects 2372 // The new space sweep will overwrite the map word of dead objects
2373 // with NULL. In this case we do not need to transfer this entry to 2373 // with NULL. In this case we do not need to transfer this entry to
Lasse Reichstein 2011/08/12 08:47:13 Does this mean we store NULL in the heap? We shoul
Erik Corry 2011/08/12 08:56:40 It doesn't really have anything to do with a Smi.
Lasse Reichstein 2011/08/12 09:21:48 So the comment is incorrect and we don't store NUL
2374 // the store buffer which we are rebuilding. 2374 // the store buffer which we are rebuilding.
2375 if (new_addr != NULL) { 2375 if (new_addr != NULL) {
2376 *p = HeapObject::FromAddress(new_addr); 2376 *p = HeapObject::FromAddress(new_addr);
2377 } else { 2377 } else {
2378 // We have to zap this pointer, because the store buffer may overflow later, 2378 // We have to zap this pointer, because the store buffer may overflow later,
2379 // and then we have to scan the entire heap and we don't want to find 2379 // and then we have to scan the entire heap and we don't want to find
2380 // spurious newspace pointers in the old space. 2380 // spurious newspace pointers in the old space.
2381 *p = HeapObject::FromAddress(NULL); // Fake heap object not in new space. 2381 *p = reinterpret_cast<HeapObject*>(Smi::FromInt(0));
Lasse Reichstein 2011/08/12 08:47:13 So we are not assuming that the value is HeapObjec
Erik Corry 2011/08/12 08:56:40 This is the value in the slot that used to point t
Lasse Reichstein 2011/08/12 09:21:48 Ah, so *p is always in the heap, and not in a stor
2382 } 2382 }
2383 } 2383 }
2384 2384
2385 2385
2386 static String* UpdateReferenceInExternalStringTableEntry(Heap* heap, 2386 static String* UpdateReferenceInExternalStringTableEntry(Heap* heap,
2387 Object** p) { 2387 Object** p) {
2388 MapWord map_word = HeapObject::cast(*p)->map_word(); 2388 MapWord map_word = HeapObject::cast(*p)->map_word();
2389 2389
2390 if (map_word.IsForwardingAddress()) { 2390 if (map_word.IsForwardingAddress()) {
2391 return String::cast(map_word.ToForwardingAddress()); 2391 return String::cast(map_word.ToForwardingAddress());
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
3427 while (buffer != NULL) { 3427 while (buffer != NULL) {
3428 SlotsBuffer* next_buffer = buffer->next(); 3428 SlotsBuffer* next_buffer = buffer->next();
3429 DeallocateBuffer(buffer); 3429 DeallocateBuffer(buffer);
3430 buffer = next_buffer; 3430 buffer = next_buffer;
3431 } 3431 }
3432 *buffer_address = NULL; 3432 *buffer_address = NULL;
3433 } 3433 }
3434 3434
3435 3435
3436 } } // namespace v8::internal 3436 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698