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

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

Issue 3135026: Merge flush code phase into marking phase. (Closed)
Patch Set: returned checked casts Created 10 years, 4 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
« no previous file with comments | « src/objects-inl.h ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 kVisitStruct8, 93 kVisitStruct8,
94 kVisitStruct9, 94 kVisitStruct9,
95 kVisitStructGeneric, 95 kVisitStructGeneric,
96 96
97 kVisitConsString, 97 kVisitConsString,
98 kVisitOddball, 98 kVisitOddball,
99 kVisitCode, 99 kVisitCode,
100 kVisitMap, 100 kVisitMap,
101 kVisitPropertyCell, 101 kVisitPropertyCell,
102 kVisitSharedFunctionInfo, 102 kVisitSharedFunctionInfo,
103 kVisitJSFunction,
103 104
104 kVisitorIdCount, 105 kVisitorIdCount,
105 kMinObjectSizeInWords = 2 106 kMinObjectSizeInWords = 2
106 }; 107 };
107 108
108 // Determine which specialized visitor should be used for given instance type 109 // Determine which specialized visitor should be used for given instance type
109 // and instance type. 110 // and instance type.
110 static VisitorId GetVisitorId(int instance_type, int instance_size); 111 static VisitorId GetVisitorId(int instance_type, int instance_size);
111 112
112 static VisitorId GetVisitorId(Map* map) { 113 static VisitorId GetVisitorId(Map* map) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 class FlexibleBodyVisitor : public BodyVisitorBase<StaticVisitor> { 198 class FlexibleBodyVisitor : public BodyVisitorBase<StaticVisitor> {
198 public: 199 public:
199 static inline ReturnType Visit(Map* map, HeapObject* object) { 200 static inline ReturnType Visit(Map* map, HeapObject* object) {
200 int object_size = BodyDescriptor::SizeOf(map, object); 201 int object_size = BodyDescriptor::SizeOf(map, object);
201 IteratePointers(object, BodyDescriptor::kStartOffset, object_size); 202 IteratePointers(object, BodyDescriptor::kStartOffset, object_size);
202 return static_cast<ReturnType>(object_size); 203 return static_cast<ReturnType>(object_size);
203 } 204 }
204 205
205 template<int object_size> 206 template<int object_size>
206 static inline ReturnType VisitSpecialized(Map* map, HeapObject* object) { 207 static inline ReturnType VisitSpecialized(Map* map, HeapObject* object) {
208 ASSERT(BodyDescriptor::SizeOf(map, object) == object_size);
207 IteratePointers(object, BodyDescriptor::kStartOffset, object_size); 209 IteratePointers(object, BodyDescriptor::kStartOffset, object_size);
208 return static_cast<ReturnType>(object_size); 210 return static_cast<ReturnType>(object_size);
209 } 211 }
210 }; 212 };
211 213
212 214
213 template<typename StaticVisitor, typename BodyDescriptor, typename ReturnType> 215 template<typename StaticVisitor, typename BodyDescriptor, typename ReturnType>
214 class FixedBodyVisitor : public BodyVisitorBase<StaticVisitor> { 216 class FixedBodyVisitor : public BodyVisitorBase<StaticVisitor> {
215 public: 217 public:
216 static inline ReturnType Visit(Map* map, HeapObject* object) { 218 static inline ReturnType Visit(Map* map, HeapObject* object) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 263
262 table_.Register(kVisitSharedFunctionInfo, 264 table_.Register(kVisitSharedFunctionInfo,
263 &FixedBodyVisitor<StaticVisitor, 265 &FixedBodyVisitor<StaticVisitor,
264 SharedFunctionInfo::BodyDescriptor, 266 SharedFunctionInfo::BodyDescriptor,
265 int>::Visit); 267 int>::Visit);
266 268
267 table_.Register(kVisitSeqAsciiString, &VisitSeqAsciiString); 269 table_.Register(kVisitSeqAsciiString, &VisitSeqAsciiString);
268 270
269 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); 271 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString);
270 272
273 table_.Register(kVisitJSFunction,
274 &JSObjectVisitor::
275 template VisitSpecialized<JSFunction::kSize>);
276
271 table_.RegisterSpecializations<DataObjectVisitor, 277 table_.RegisterSpecializations<DataObjectVisitor,
272 kVisitDataObject, 278 kVisitDataObject,
273 kVisitDataObjectGeneric>(); 279 kVisitDataObjectGeneric>();
274 table_.RegisterSpecializations<JSObjectVisitor, 280 table_.RegisterSpecializations<JSObjectVisitor,
275 kVisitJSObject, 281 kVisitJSObject,
276 kVisitJSObjectGeneric>(); 282 kVisitJSObjectGeneric>();
277 table_.RegisterSpecializations<StructVisitor, 283 table_.RegisterSpecializations<StructVisitor,
278 kVisitStruct, 284 kVisitStruct,
279 kVisitStructGeneric>(); 285 kVisitStructGeneric>();
280 } 286 }
281 287
282 static inline int IterateBody(Map* map, HeapObject* obj) { 288 static inline int IterateBody(Map* map, HeapObject* obj) {
283 return table_.GetVisitor(map)(map, obj); 289 return table_.GetVisitor(map)(map, obj);
284 } 290 }
285 291
286 static inline void VisitPointers(Object** start, Object** end) { 292 static inline void VisitPointers(Object** start, Object** end) {
287 for (Object** p = start; p < end; p++) StaticVisitor::VisitPointer(p); 293 for (Object** p = start; p < end; p++) StaticVisitor::VisitPointer(p);
288 } 294 }
289 295
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 379
374 for (; !it.done(); it.next()) { 380 for (; !it.done(); it.next()) {
375 it.rinfo()->template Visit<StaticVisitor>(); 381 it.rinfo()->template Visit<StaticVisitor>();
376 } 382 }
377 } 383 }
378 384
379 385
380 } } // namespace v8::internal 386 } } // namespace v8::internal
381 387
382 #endif // V8_OBJECTS_ITERATION_H_ 388 #endif // V8_OBJECTS_ITERATION_H_
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/objects-visiting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698