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

Side by Side Diff: src/store-buffer.h

Issue 6312147: Fix some correctness issues with the store buffer shown up by... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 10 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/heap.cc ('k') | src/store-buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // to attempt to remove any dupes. During the first part of a scavenge we 57 // to attempt to remove any dupes. During the first part of a scavenge we
58 // are using the store buffer to access the old spaces and at the same time 58 // are using the store buffer to access the old spaces and at the same time
59 // we are rebuilding the store buffer using this function. There is, however 59 // we are rebuilding the store buffer using this function. There is, however
60 // no issue of overwriting the buffer we are iterating over, because this 60 // no issue of overwriting the buffer we are iterating over, because this
61 // stage of the scavenge can only reduce the number of addresses in the store 61 // stage of the scavenge can only reduce the number of addresses in the store
62 // buffer (some objects are promoted so pointers to them do not need to be in 62 // buffer (some objects are promoted so pointers to them do not need to be in
63 // the store buffer). The later parts of the scavenge process the promotion 63 // the store buffer). The later parts of the scavenge process the promotion
64 // queue and they can overflow this buffer, which we must check for. 64 // queue and they can overflow this buffer, which we must check for.
65 static inline void EnterDirectlyIntoStoreBuffer(Address addr); 65 static inline void EnterDirectlyIntoStoreBuffer(Address addr);
66 66
67 enum RebuildStoreBufferMode {
68 kRebuildStoreBufferWhileIterating,
69 kPreserveStoreBufferWhileIterating};
70
71 // Iterates over all pointers that go from old space to new space. It will 67 // Iterates over all pointers that go from old space to new space. It will
72 // delete the store buffer as it starts so the callback should reenter 68 // delete the store buffer as it starts so the callback should reenter
73 // surviving old-to-new pointers into the store buffer to rebuild it. 69 // surviving old-to-new pointers into the store buffer to rebuild it.
74 static void IteratePointersToNewSpace(ObjectSlotCallback callback); 70 static void IteratePointersToNewSpace(ObjectSlotCallback callback);
75 71
76 static const int kStoreBufferOverflowBit = 1 << 16; 72 static const int kStoreBufferOverflowBit = 1 << 16;
77 static const int kStoreBufferSize = kStoreBufferOverflowBit; 73 static const int kStoreBufferSize = kStoreBufferOverflowBit;
78 static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address); 74 static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address);
79 static const int kOldStoreBufferLength = kStoreBufferLength * 16; 75 static const int kOldStoreBufferLength = kStoreBufferLength * 16;
80 static const int kHashMapLengthLog2 = 12; 76 static const int kHashMapLengthLog2 = 12;
81 static const int kHashMapLength = 1 << kHashMapLengthLog2; 77 static const int kHashMapLength = 1 << kHashMapLengthLog2;
82 78
83 static void Compact(); 79 static void Compact();
84 static void GCPrologue(GCType type, GCCallbackFlags flags); 80 static void GCPrologue(GCType type, GCCallbackFlags flags);
85 static void GCEpilogue(GCType type, GCCallbackFlags flags); 81 static void GCEpilogue(GCType type, GCCallbackFlags flags);
86 82
87 static Object*** Start() { return reinterpret_cast<Object***>(old_start_); } 83 static Object*** Start() { return reinterpret_cast<Object***>(old_start_); }
88 static Object*** Top() { return reinterpret_cast<Object***>(old_top_); } 84 static Object*** Top() { return reinterpret_cast<Object***>(old_top_); }
89 85
90 enum StoreBufferMode { 86 enum StoreBufferMode {
91 kStoreBufferFunctional, 87 kStoreBufferFunctional,
92 kStoreBufferDisabled, 88 kStoreBufferDisabled,
93 kStoreBufferBeingRebuilt 89 kStoreBufferBeingRebuilt
94 }; 90 };
95 91
96 static StoreBufferMode store_buffer_mode() { return store_buffer_mode_; } 92 static StoreBufferMode store_buffer_mode() { return store_buffer_mode_; }
93 static inline void set_store_buffer_mode(StoreBufferMode mode);
97 static bool old_buffer_is_sorted() { return old_buffer_is_sorted_; } 94 static bool old_buffer_is_sorted() { return old_buffer_is_sorted_; }
98 95
99 // Goes through the store buffer removing pointers to things that have 96 // Goes through the store buffer removing pointers to things that have
100 // been promoted. Rebuilds the store buffer completely if it overflowed. 97 // been promoted. Rebuilds the store buffer completely if it overflowed.
101 static void SortUniq(); 98 static void SortUniq();
102 static void Verify(); 99 static void Verify();
103 100
104 #ifdef DEBUG 101 #ifdef DEBUG
105 static void Clean(); 102 static void Clean();
106 // Slow, for asserts only. 103 // Slow, for asserts only.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 StoreBuffer::may_move_store_buffer_entries_ = stored_state_; 163 StoreBuffer::may_move_store_buffer_entries_ = stored_state_;
167 } 164 }
168 165
169 private: 166 private:
170 bool stored_state_; 167 bool stored_state_;
171 }; 168 };
172 169
173 } } // namespace v8::internal 170 } } // namespace v8::internal
174 171
175 #endif // V8_WRITE_BARRIER_H_ 172 #endif // V8_WRITE_BARRIER_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/store-buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698