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

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

Issue 7348008: Merge up to 8597 to experimental/gc from the bleeding edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 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-printer.cc ('k') | src/objects-visiting.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 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // Base class for all static visitors. 46 // Base class for all static visitors.
47 class StaticVisitorBase : public AllStatic { 47 class StaticVisitorBase : public AllStatic {
48 public: 48 public:
49 enum VisitorId { 49 enum VisitorId {
50 kVisitSeqAsciiString = 0, 50 kVisitSeqAsciiString = 0,
51 kVisitSeqTwoByteString, 51 kVisitSeqTwoByteString,
52 kVisitShortcutCandidate, 52 kVisitShortcutCandidate,
53 kVisitByteArray, 53 kVisitByteArray,
54 kVisitFreeSpace, 54 kVisitFreeSpace,
55 kVisitFixedArray, 55 kVisitFixedArray,
56 kVisitFixedDoubleArray,
56 kVisitGlobalContext, 57 kVisitGlobalContext,
57 58
58 // For data objects, JS objects and structs along with generic visitor which 59 // For data objects, JS objects and structs along with generic visitor which
59 // can visit object of any size we provide visitors specialized by 60 // can visit object of any size we provide visitors specialized by
60 // object size in words. 61 // object size in words.
61 // Ids of specialized visitors are declared in a linear order (without 62 // Ids of specialized visitors are declared in a linear order (without
62 // holes) starting from the id of visitor specialized for 2 words objects 63 // holes) starting from the id of visitor specialized for 2 words objects
63 // (base visitor id) and ending with the id of generic visitor. 64 // (base visitor id) and ending with the id of generic visitor.
64 // Method GetVisitorIdForSize depends on this ordering to calculate visitor 65 // Method GetVisitorIdForSize depends on this ordering to calculate visitor
65 // id of specialized visitor from given instance size, base visitor id and 66 // id of specialized visitor from given instance size, base visitor id and
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 kVisitStruct9, 99 kVisitStruct9,
99 kVisitStructGeneric, 100 kVisitStructGeneric,
100 101
101 kVisitConsString, 102 kVisitConsString,
102 kVisitOddball, 103 kVisitOddball,
103 kVisitCode, 104 kVisitCode,
104 kVisitMap, 105 kVisitMap,
105 kVisitPropertyCell, 106 kVisitPropertyCell,
106 kVisitSharedFunctionInfo, 107 kVisitSharedFunctionInfo,
107 kVisitJSFunction, 108 kVisitJSFunction,
109 kVisitJSRegExp,
108 110
109 kVisitorIdCount, 111 kVisitorIdCount,
110 kMinObjectSizeInWords = 2 112 kMinObjectSizeInWords = 2
111 }; 113 };
112 114
113 // Visitor ID should fit in one byte. 115 // Visitor ID should fit in one byte.
114 STATIC_ASSERT(kVisitorIdCount <= 256); 116 STATIC_ASSERT(kVisitorIdCount <= 256);
115 117
116 // Determine which specialized visitor should be used for given instance type 118 // Determine which specialized visitor should be used for given instance type
117 // and instance type. 119 // and instance type.
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 280
279 static inline void VisitPointers(Heap* heap, Object** start, Object** end) { 281 static inline void VisitPointers(Heap* heap, Object** start, Object** end) {
280 for (Object** p = start; p < end; p++) StaticVisitor::VisitPointer(heap, p); 282 for (Object** p = start; p < end; p++) StaticVisitor::VisitPointer(heap, p);
281 } 283 }
282 284
283 private: 285 private:
284 static inline int VisitByteArray(Map* map, HeapObject* object) { 286 static inline int VisitByteArray(Map* map, HeapObject* object) {
285 return reinterpret_cast<ByteArray*>(object)->ByteArraySize(); 287 return reinterpret_cast<ByteArray*>(object)->ByteArraySize();
286 } 288 }
287 289
290 static inline int VisitFixedDoubleArray(Map* map, HeapObject* object) {
291 int length = reinterpret_cast<FixedDoubleArray*>(object)->length();
292 return FixedDoubleArray::SizeFor(length);
293 }
294
288 static inline int VisitSeqAsciiString(Map* map, HeapObject* object) { 295 static inline int VisitSeqAsciiString(Map* map, HeapObject* object) {
289 return SeqAsciiString::cast(object)-> 296 return SeqAsciiString::cast(object)->
290 SeqAsciiStringSize(map->instance_type()); 297 SeqAsciiStringSize(map->instance_type());
291 } 298 }
292 299
300 static inline int VisitJSRegExp(Map* map, HeapObject* object) {
301 return JSObjectVisitor::Visit(map, object);
302 }
303
293 static inline int VisitSeqTwoByteString(Map* map, HeapObject* object) { 304 static inline int VisitSeqTwoByteString(Map* map, HeapObject* object) {
294 return SeqTwoByteString::cast(object)-> 305 return SeqTwoByteString::cast(object)->
295 SeqTwoByteStringSize(map->instance_type()); 306 SeqTwoByteStringSize(map->instance_type());
296 } 307 }
297 308
298 static inline int VisitFreeSpace(Map* map, HeapObject* object) { 309 static inline int VisitFreeSpace(Map* map, HeapObject* object) {
299 return FreeSpace::cast(object)->Size(); 310 return FreeSpace::cast(object)->Size();
300 } 311 }
301 312
302 class DataObjectVisitor { 313 class DataObjectVisitor {
(...skipping 23 matching lines...) Expand all
326 337
327 338
328 template<typename StaticVisitor> 339 template<typename StaticVisitor>
329 VisitorDispatchTable<typename StaticNewSpaceVisitor<StaticVisitor>::Callback> 340 VisitorDispatchTable<typename StaticNewSpaceVisitor<StaticVisitor>::Callback>
330 StaticNewSpaceVisitor<StaticVisitor>::table_; 341 StaticNewSpaceVisitor<StaticVisitor>::table_;
331 342
332 343
333 } } // namespace v8::internal 344 } } // namespace v8::internal
334 345
335 #endif // V8_OBJECTS_VISITING_H_ 346 #endif // V8_OBJECTS_VISITING_H_
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | src/objects-visiting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698