| OLD | NEW |
| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 // Base class for all static visitors. | 44 // Base class for all static visitors. |
| 45 class StaticVisitorBase : public AllStatic { | 45 class StaticVisitorBase : public AllStatic { |
| 46 public: | 46 public: |
| 47 enum VisitorId { | 47 enum VisitorId { |
| 48 kVisitSeqAsciiString = 0, | 48 kVisitSeqAsciiString = 0, |
| 49 kVisitSeqTwoByteString, | 49 kVisitSeqTwoByteString, |
| 50 kVisitShortcutCandidate, | 50 kVisitShortcutCandidate, |
| 51 kVisitByteArray, | 51 kVisitByteArray, |
| 52 kVisitFixedArray, | 52 kVisitFixedArray, |
| 53 kVisitGlobalContext, |
| 53 | 54 |
| 54 // For data objects, JS objects and structs along with generic visitor which | 55 // For data objects, JS objects and structs along with generic visitor which |
| 55 // can visit object of any size we provide visitors specialized by | 56 // can visit object of any size we provide visitors specialized by |
| 56 // object size in words. | 57 // object size in words. |
| 57 // Ids of specialized visitors are declared in a linear order (without | 58 // Ids of specialized visitors are declared in a linear order (without |
| 58 // holes) starting from the id of visitor specialized for 2 words objects | 59 // holes) starting from the id of visitor specialized for 2 words objects |
| 59 // (base visitor id) and ending with the id of generic visitor. | 60 // (base visitor id) and ending with the id of generic visitor. |
| 60 // Method GetVisitorIdForSize depends on this ordering to calculate visitor | 61 // Method GetVisitorIdForSize depends on this ordering to calculate visitor |
| 61 // id of specialized visitor from given instance size, base visitor id and | 62 // id of specialized visitor from given instance size, base visitor id and |
| 62 // generic visitor's id. | 63 // generic visitor's id. |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 table_.Register(kVisitConsString, | 257 table_.Register(kVisitConsString, |
| 257 &FixedBodyVisitor<StaticVisitor, | 258 &FixedBodyVisitor<StaticVisitor, |
| 258 ConsString::BodyDescriptor, | 259 ConsString::BodyDescriptor, |
| 259 int>::Visit); | 260 int>::Visit); |
| 260 | 261 |
| 261 table_.Register(kVisitFixedArray, | 262 table_.Register(kVisitFixedArray, |
| 262 &FlexibleBodyVisitor<StaticVisitor, | 263 &FlexibleBodyVisitor<StaticVisitor, |
| 263 FixedArray::BodyDescriptor, | 264 FixedArray::BodyDescriptor, |
| 264 int>::Visit); | 265 int>::Visit); |
| 265 | 266 |
| 267 table_.Register(kVisitGlobalContext, |
| 268 &FixedBodyVisitor<StaticVisitor, |
| 269 Context::ScavengeBodyDescriptor, |
| 270 int>::Visit); |
| 271 |
| 266 table_.Register(kVisitByteArray, &VisitByteArray); | 272 table_.Register(kVisitByteArray, &VisitByteArray); |
| 267 | 273 |
| 268 table_.Register(kVisitSharedFunctionInfo, | 274 table_.Register(kVisitSharedFunctionInfo, |
| 269 &FixedBodyVisitor<StaticVisitor, | 275 &FixedBodyVisitor<StaticVisitor, |
| 270 SharedFunctionInfo::BodyDescriptor, | 276 SharedFunctionInfo::BodyDescriptor, |
| 271 int>::Visit); | 277 int>::Visit); |
| 272 | 278 |
| 273 table_.Register(kVisitSeqAsciiString, &VisitSeqAsciiString); | 279 table_.Register(kVisitSeqAsciiString, &VisitSeqAsciiString); |
| 274 | 280 |
| 275 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); | 281 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 389 |
| 384 for (; !it.done(); it.next()) { | 390 for (; !it.done(); it.next()) { |
| 385 it.rinfo()->template Visit<StaticVisitor>(); | 391 it.rinfo()->template Visit<StaticVisitor>(); |
| 386 } | 392 } |
| 387 } | 393 } |
| 388 | 394 |
| 389 | 395 |
| 390 } } // namespace v8::internal | 396 } } // namespace v8::internal |
| 391 | 397 |
| 392 #endif // V8_OBJECTS_VISITING_H_ | 398 #endif // V8_OBJECTS_VISITING_H_ |
| OLD | NEW |