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

Side by Side Diff: src/objects-visiting.h

Issue 10816007: Refactor incremental marking to use static visitor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Toon Verwaest. Created 8 years, 5 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.cc ('k') | src/objects-visiting-inl.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2012 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
11 // with the distribution. 11 // with the distribution.
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 int> JSObjectVisitor; 353 int> JSObjectVisitor;
354 354
355 typedef int (*Callback)(Map* map, HeapObject* object); 355 typedef int (*Callback)(Map* map, HeapObject* object);
356 356
357 static VisitorDispatchTable<Callback> table_; 357 static VisitorDispatchTable<Callback> table_;
358 }; 358 };
359 359
360 360
361 template<typename StaticVisitor> 361 template<typename StaticVisitor>
362 VisitorDispatchTable<typename StaticNewSpaceVisitor<StaticVisitor>::Callback> 362 VisitorDispatchTable<typename StaticNewSpaceVisitor<StaticVisitor>::Callback>
363 StaticNewSpaceVisitor<StaticVisitor>::table_; 363 StaticNewSpaceVisitor<StaticVisitor>::table_;
364
365
366 // Base class for visitors used to transitively mark the entire heap.
367 // IterateBody returns nothing.
368 // Certain types of objects might not be handled by this base class and
369 // no visitor function is registered by the generic initialization. A
370 // specialized visitor function needs to be provided by the inheriting
371 // class itself for those cases.
372 //
373 // This class is intended to be used in the following way:
374 //
375 // class SomeVisitor : public StaticMarkingVisitor<SomeVisitor> {
376 // ...
377 // }
378 //
379 // This is an example of Curiously recurring template pattern.
380 template<typename StaticVisitor>
381 class StaticMarkingVisitor : public StaticVisitorBase {
382 public:
383 static void Initialize();
384
385 static inline void IterateBody(Map* map, HeapObject* obj) {
386 table_.GetVisitor(map)(map, obj);
387 }
388
389 static inline void VisitCodeEntry(Heap* heap, Address entry_address);
390 static inline void VisitGlobalPropertyCell(Heap* heap, RelocInfo* rinfo);
391 static inline void VisitDebugTarget(Heap* heap, RelocInfo* rinfo);
392 static inline void VisitExternalReference(RelocInfo* rinfo) { }
393 static inline void VisitRuntimeEntry(RelocInfo* rinfo) { }
394
395 // TODO(mstarzinger): This should be made protected once refactoring is done.
396 static inline void VisitGlobalContext(Map* map, HeapObject* object);
397
398 protected:
399 static inline void VisitJSRegExp(Map* map, HeapObject* object);
400
401 class DataObjectVisitor {
402 public:
403 template<int size>
404 static inline void VisitSpecialized(Map* map, HeapObject* object) {
405 }
406
407 static inline void Visit(Map* map, HeapObject* object) {
408 }
409 };
410
411 typedef FlexibleBodyVisitor<StaticVisitor,
412 JSObject::BodyDescriptor,
413 void> JSObjectVisitor;
414
415 typedef FlexibleBodyVisitor<StaticVisitor,
416 StructBodyDescriptor,
417 void> StructObjectVisitor;
418
419 typedef void (*Callback)(Map* map, HeapObject* object);
420
421 static VisitorDispatchTable<Callback> table_;
422 };
423
424
425 template<typename StaticVisitor>
426 VisitorDispatchTable<typename StaticMarkingVisitor<StaticVisitor>::Callback>
427 StaticMarkingVisitor<StaticVisitor>::table_;
364 428
365 429
366 } } // namespace v8::internal 430 } } // namespace v8::internal
367 431
368 #endif // V8_OBJECTS_VISITING_H_ 432 #endif // V8_OBJECTS_VISITING_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698