| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 | 48 |
| 49 // JSObjectsCluster describes a group of JS objects that are | 49 // JSObjectsCluster describes a group of JS objects that are |
| 50 // considered equivalent in terms of a particular profile. | 50 // considered equivalent in terms of a particular profile. |
| 51 class JSObjectsCluster BASE_EMBEDDED { | 51 class JSObjectsCluster BASE_EMBEDDED { |
| 52 public: | 52 public: |
| 53 // These special cases are used in retainer profile. | 53 // These special cases are used in retainer profile. |
| 54 enum SpecialCase { | 54 enum SpecialCase { |
| 55 ROOTS = 1, | 55 ROOTS = 1, |
| 56 GLOBAL_PROPERTY = 2, | 56 GLOBAL_PROPERTY = 2, |
| 57 SELF = 3 // This case is used in ClustersCoarser only. | 57 CODE = 3, |
| 58 SELF = 100 // This case is used in ClustersCoarser only. |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 JSObjectsCluster() : constructor_(NULL), instance_(NULL) {} | 61 JSObjectsCluster() : constructor_(NULL), instance_(NULL) {} |
| 61 explicit JSObjectsCluster(String* constructor) | 62 explicit JSObjectsCluster(String* constructor) |
| 62 : constructor_(constructor), instance_(NULL) {} | 63 : constructor_(constructor), instance_(NULL) {} |
| 63 explicit JSObjectsCluster(SpecialCase special) | 64 explicit JSObjectsCluster(SpecialCase special) |
| 64 : constructor_(FromSpecialCase(special)), instance_(NULL) {} | 65 : constructor_(FromSpecialCase(special)), instance_(NULL) {} |
| 65 JSObjectsCluster(String* constructor, Object* instance) | 66 JSObjectsCluster(String* constructor, Object* instance) |
| 66 : constructor_(constructor), instance_(instance) {} | 67 : constructor_(constructor), instance_(instance) {} |
| 67 | 68 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 90 // Allows null clusters to be printed. | 91 // Allows null clusters to be printed. |
| 91 void DebugPrint(StringStream* accumulator) const; | 92 void DebugPrint(StringStream* accumulator) const; |
| 92 | 93 |
| 93 private: | 94 private: |
| 94 static String* FromSpecialCase(SpecialCase special) { | 95 static String* FromSpecialCase(SpecialCase special) { |
| 95 // We use symbols that are illegal JS identifiers to identify special cases. | 96 // We use symbols that are illegal JS identifiers to identify special cases. |
| 96 // Their actual value is irrelevant for us. | 97 // Their actual value is irrelevant for us. |
| 97 switch (special) { | 98 switch (special) { |
| 98 case ROOTS: return Heap::result_symbol(); | 99 case ROOTS: return Heap::result_symbol(); |
| 99 case GLOBAL_PROPERTY: return Heap::code_symbol(); | 100 case GLOBAL_PROPERTY: return Heap::code_symbol(); |
| 101 case CODE: return Heap::arguments_shadow_symbol(); |
| 100 case SELF: return Heap::catch_var_symbol(); | 102 case SELF: return Heap::catch_var_symbol(); |
| 101 default: | 103 default: |
| 102 UNREACHABLE(); | 104 UNREACHABLE(); |
| 103 return NULL; | 105 return NULL; |
| 104 } | 106 } |
| 105 } | 107 } |
| 106 | 108 |
| 107 String* constructor_; | 109 String* constructor_; |
| 108 Object* instance_; | 110 Object* instance_; |
| 109 }; | 111 }; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 static void RecordJSObjectAllocation(Object* obj); | 264 static void RecordJSObjectAllocation(Object* obj); |
| 263 private: | 265 private: |
| 264 static bool can_log_; | 266 static bool can_log_; |
| 265 }; | 267 }; |
| 266 | 268 |
| 267 #endif // ENABLE_LOGGING_AND_PROFILING | 269 #endif // ENABLE_LOGGING_AND_PROFILING |
| 268 | 270 |
| 269 } } // namespace v8::internal | 271 } } // namespace v8::internal |
| 270 | 272 |
| 271 #endif // V8_HEAP_PROFILER_H_ | 273 #endif // V8_HEAP_PROFILER_H_ |
| OLD | NEW |