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

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

Issue 7089002: Implement core support for FixedDoubleArrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: final version before commit Created 9 years, 6 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-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 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
11 // with the distribution. 11 // with the distribution.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 enum VisitorId { 49 enum VisitorId {
50 kVisitSeqAsciiString = 0, 50 kVisitSeqAsciiString = 0,
51 kVisitSeqTwoByteString, 51 kVisitSeqTwoByteString,
52 kVisitShortcutCandidate, 52 kVisitShortcutCandidate,
53 kVisitByteArray, 53 kVisitByteArray,
54 kVisitFixedArray, 54 kVisitFixedArray,
55 kVisitFixedDoubleArray,
55 kVisitGlobalContext, 56 kVisitGlobalContext,
56 57
57 // For data objects, JS objects and structs along with generic visitor which 58 // For data objects, JS objects and structs along with generic visitor which
58 // can visit object of any size we provide visitors specialized by 59 // can visit object of any size we provide visitors specialized by
59 // object size in words. 60 // object size in words.
60 // Ids of specialized visitors are declared in a linear order (without 61 // Ids of specialized visitors are declared in a linear order (without
61 // holes) starting from the id of visitor specialized for 2 words objects 62 // holes) starting from the id of visitor specialized for 2 words objects
62 // (base visitor id) and ending with the id of generic visitor. 63 // (base visitor id) and ending with the id of generic visitor.
63 // Method GetVisitorIdForSize depends on this ordering to calculate visitor 64 // Method GetVisitorIdForSize depends on this ordering to calculate visitor
64 // id of specialized visitor from given instance size, base visitor id and 65 // id of specialized visitor from given instance size, base visitor id and
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 table_.Register(kVisitConsString, 279 table_.Register(kVisitConsString,
279 &FixedBodyVisitor<StaticVisitor, 280 &FixedBodyVisitor<StaticVisitor,
280 ConsString::BodyDescriptor, 281 ConsString::BodyDescriptor,
281 int>::Visit); 282 int>::Visit);
282 283
283 table_.Register(kVisitFixedArray, 284 table_.Register(kVisitFixedArray,
284 &FlexibleBodyVisitor<StaticVisitor, 285 &FlexibleBodyVisitor<StaticVisitor,
285 FixedArray::BodyDescriptor, 286 FixedArray::BodyDescriptor,
286 int>::Visit); 287 int>::Visit);
287 288
289 table_.Register(kVisitFixedDoubleArray, &VisitFixedDoubleArray);
290
288 table_.Register(kVisitGlobalContext, 291 table_.Register(kVisitGlobalContext,
289 &FixedBodyVisitor<StaticVisitor, 292 &FixedBodyVisitor<StaticVisitor,
290 Context::ScavengeBodyDescriptor, 293 Context::ScavengeBodyDescriptor,
291 int>::Visit); 294 int>::Visit);
292 295
293 table_.Register(kVisitByteArray, &VisitByteArray); 296 table_.Register(kVisitByteArray, &VisitByteArray);
294 297
295 table_.Register(kVisitSharedFunctionInfo, 298 table_.Register(kVisitSharedFunctionInfo,
296 &FixedBodyVisitor<StaticVisitor, 299 &FixedBodyVisitor<StaticVisitor,
297 SharedFunctionInfo::BodyDescriptor, 300 SharedFunctionInfo::BodyDescriptor,
(...skipping 24 matching lines...) Expand all
322 325
323 static inline void VisitPointers(Heap* heap, Object** start, Object** end) { 326 static inline void VisitPointers(Heap* heap, Object** start, Object** end) {
324 for (Object** p = start; p < end; p++) StaticVisitor::VisitPointer(heap, p); 327 for (Object** p = start; p < end; p++) StaticVisitor::VisitPointer(heap, p);
325 } 328 }
326 329
327 private: 330 private:
328 static inline int VisitByteArray(Map* map, HeapObject* object) { 331 static inline int VisitByteArray(Map* map, HeapObject* object) {
329 return reinterpret_cast<ByteArray*>(object)->ByteArraySize(); 332 return reinterpret_cast<ByteArray*>(object)->ByteArraySize();
330 } 333 }
331 334
335 static inline int VisitFixedDoubleArray(Map* map, HeapObject* object) {
336 int length = reinterpret_cast<FixedDoubleArray*>(object)->length();
337 return FixedDoubleArray::SizeFor(length);
338 }
339
332 static inline int VisitSeqAsciiString(Map* map, HeapObject* object) { 340 static inline int VisitSeqAsciiString(Map* map, HeapObject* object) {
333 return SeqAsciiString::cast(object)-> 341 return SeqAsciiString::cast(object)->
334 SeqAsciiStringSize(map->instance_type()); 342 SeqAsciiStringSize(map->instance_type());
335 } 343 }
336 344
337 static inline int VisitSeqTwoByteString(Map* map, HeapObject* object) { 345 static inline int VisitSeqTwoByteString(Map* map, HeapObject* object) {
338 return SeqTwoByteString::cast(object)-> 346 return SeqTwoByteString::cast(object)->
339 SeqTwoByteStringSize(map->instance_type()); 347 SeqTwoByteStringSize(map->instance_type());
340 } 348 }
341 349
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 423
416 for (; !it.done(); it.next()) { 424 for (; !it.done(); it.next()) {
417 it.rinfo()->template Visit<StaticVisitor>(heap); 425 it.rinfo()->template Visit<StaticVisitor>(heap);
418 } 426 }
419 } 427 }
420 428
421 429
422 } } // namespace v8::internal 430 } } // namespace v8::internal
423 431
424 #endif // V8_OBJECTS_VISITING_H_ 432 #endif // V8_OBJECTS_VISITING_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