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

Unified Diff: src/objects-visiting.h

Issue 6777011: Specialize ScavengingVisitor for the case when all logging and profiling is disabled. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: use AtomicWord in VisitorDispatchTable instead of Callback Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
« src/heap.cc ('K') | « src/heap.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-visiting.h
diff --git a/src/objects-visiting.h b/src/objects-visiting.h
index 42f90608c35032452fc83b909ef13cd7d9000f61..da955da614f42cd7148f92794afa7b9f9339408e 100644
--- a/src/objects-visiting.h
+++ b/src/objects-visiting.h
@@ -141,13 +141,22 @@ class StaticVisitorBase : public AllStatic {
template<typename Callback>
class VisitorDispatchTable {
public:
+ void CopyFrom(VisitorDispatchTable* other) {
+ // We are not using memcpy to guarantee that during update
+ // every element of callbacks_ array will remain correct
+ // pointer (memcpy might be implemented as a byte copying loop).
+ for (int i = 0; i < StaticVisitorBase::kVisitorIdCount; i++) {
+ NoBarrier_Store(&callbacks_[i], other->callbacks_[i]);
+ }
+ }
+
inline Callback GetVisitor(Map* map) {
- return callbacks_[map->visitor_id()];
+ return reinterpret_cast<Callback>(callbacks_[map->visitor_id()]);
}
void Register(StaticVisitorBase::VisitorId id, Callback callback) {
ASSERT(id < StaticVisitorBase::kVisitorIdCount); // id is unsigned.
- callbacks_[id] = callback;
+ callbacks_[id] = reinterpret_cast<AtomicWord>(callback);
}
template<typename Visitor,
@@ -179,7 +188,7 @@ class VisitorDispatchTable {
}
private:
- Callback callbacks_[StaticVisitorBase::kVisitorIdCount];
+ AtomicWord callbacks_[StaticVisitorBase::kVisitorIdCount];
};
« src/heap.cc ('K') | « src/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698