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

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

Issue 10702168: Add counters that automatically track object sizes and counts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Whitespace change 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/mark-compact.cc ('k') | src/v8-counters.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 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 28 matching lines...) Expand all
39 // pointers to specialized visit functions. Each map has the visitor_id 39 // pointers to specialized visit functions. Each map has the visitor_id
40 // field which contains an index of specialized visitor to use. 40 // field which contains an index of specialized visitor to use.
41 41
42 namespace v8 { 42 namespace v8 {
43 namespace internal { 43 namespace internal {
44 44
45 45
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 #define VISITOR_ID_LIST(V) \
50 V(SeqAsciiString) \
51 V(SeqTwoByteString) \
52 V(ShortcutCandidate) \
53 V(ByteArray) \
54 V(FreeSpace) \
55 V(FixedArray) \
56 V(FixedDoubleArray) \
57 V(GlobalContext) \
58 V(DataObject2) \
59 V(DataObject3) \
60 V(DataObject4) \
61 V(DataObject5) \
62 V(DataObject6) \
63 V(DataObject7) \
64 V(DataObject8) \
65 V(DataObject9) \
66 V(DataObjectGeneric) \
67 V(JSObject2) \
68 V(JSObject3) \
69 V(JSObject4) \
70 V(JSObject5) \
71 V(JSObject6) \
72 V(JSObject7) \
73 V(JSObject8) \
74 V(JSObject9) \
75 V(JSObjectGeneric) \
76 V(Struct2) \
77 V(Struct3) \
78 V(Struct4) \
79 V(Struct5) \
80 V(Struct6) \
81 V(Struct7) \
82 V(Struct8) \
83 V(Struct9) \
84 V(StructGeneric) \
85 V(ConsString) \
86 V(SlicedString) \
87 V(Oddball) \
88 V(Code) \
89 V(Map) \
90 V(PropertyCell) \
91 V(SharedFunctionInfo) \
92 V(JSFunction) \
93 V(JSWeakMap) \
94 V(JSRegExp)
95
96 // For data objects, JS objects and structs along with generic visitor which
97 // can visit object of any size we provide visitors specialized by
98 // object size in words.
99 // Ids of specialized visitors are declared in a linear order (without
100 // holes) starting from the id of visitor specialized for 2 words objects
101 // (base visitor id) and ending with the id of generic visitor.
102 // Method GetVisitorIdForSize depends on this ordering to calculate visitor
103 // id of specialized visitor from given instance size, base visitor id and
104 // generic visitor's id.
49 enum VisitorId { 105 enum VisitorId {
50 kVisitSeqAsciiString = 0, 106 #define VISITOR_ID_ENUM_DECL(id) kVisit##id,
51 kVisitSeqTwoByteString, 107 VISITOR_ID_LIST(VISITOR_ID_ENUM_DECL)
52 kVisitShortcutCandidate, 108 #undef VISITOR_ID_ENUM_DECL
53 kVisitByteArray,
54 kVisitFreeSpace,
55 kVisitFixedArray,
56 kVisitFixedDoubleArray,
57 kVisitGlobalContext,
58
59 // For data objects, JS objects and structs along with generic visitor which
60 // can visit object of any size we provide visitors specialized by
61 // object size in words.
62 // Ids of specialized visitors are declared in a linear order (without
63 // holes) starting from the id of visitor specialized for 2 words objects
64 // (base visitor id) and ending with the id of generic visitor.
65 // Method GetVisitorIdForSize depends on this ordering to calculate visitor
66 // id of specialized visitor from given instance size, base visitor id and
67 // generic visitor's id.
68
69 kVisitDataObject,
70 kVisitDataObject2 = kVisitDataObject,
71 kVisitDataObject3,
72 kVisitDataObject4,
73 kVisitDataObject5,
74 kVisitDataObject6,
75 kVisitDataObject7,
76 kVisitDataObject8,
77 kVisitDataObject9,
78 kVisitDataObjectGeneric,
79
80 kVisitJSObject,
81 kVisitJSObject2 = kVisitJSObject,
82 kVisitJSObject3,
83 kVisitJSObject4,
84 kVisitJSObject5,
85 kVisitJSObject6,
86 kVisitJSObject7,
87 kVisitJSObject8,
88 kVisitJSObject9,
89 kVisitJSObjectGeneric,
90
91 kVisitStruct,
92 kVisitStruct2 = kVisitStruct,
93 kVisitStruct3,
94 kVisitStruct4,
95 kVisitStruct5,
96 kVisitStruct6,
97 kVisitStruct7,
98 kVisitStruct8,
99 kVisitStruct9,
100 kVisitStructGeneric,
101
102 kVisitConsString,
103 kVisitSlicedString,
104 kVisitOddball,
105 kVisitCode,
106 kVisitMap,
107 kVisitPropertyCell,
108 kVisitSharedFunctionInfo,
109 kVisitJSFunction,
110 kVisitJSWeakMap,
111 kVisitJSRegExp,
112
113 kVisitorIdCount, 109 kVisitorIdCount,
110 kVisitDataObject = kVisitDataObject2,
111 kVisitJSObject = kVisitJSObject2,
112 kVisitStruct = kVisitStruct2,
114 kMinObjectSizeInWords = 2 113 kMinObjectSizeInWords = 2
115 }; 114 };
116 115
117 // Visitor ID should fit in one byte. 116 // Visitor ID should fit in one byte.
118 STATIC_ASSERT(kVisitorIdCount <= 256); 117 STATIC_ASSERT(kVisitorIdCount <= 256);
119 118
120 // Determine which specialized visitor should be used for given instance type 119 // Determine which specialized visitor should be used for given instance type
121 // and instance type. 120 // and instance type.
122 static VisitorId GetVisitorId(int instance_type, int instance_size); 121 static VisitorId GetVisitorId(int instance_type, int instance_size);
123 122
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 359
361 360
362 template<typename StaticVisitor> 361 template<typename StaticVisitor>
363 VisitorDispatchTable<typename StaticNewSpaceVisitor<StaticVisitor>::Callback> 362 VisitorDispatchTable<typename StaticNewSpaceVisitor<StaticVisitor>::Callback>
364 StaticNewSpaceVisitor<StaticVisitor>::table_; 363 StaticNewSpaceVisitor<StaticVisitor>::table_;
365 364
366 365
367 } } // namespace v8::internal 366 } } // namespace v8::internal
368 367
369 #endif // V8_OBJECTS_VISITING_H_ 368 #endif // V8_OBJECTS_VISITING_H_
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698