OLD | NEW |
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 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2097 const v8::HeapGraphNode* context_object = | 2097 const v8::HeapGraphNode* context_object = |
2098 GetProperty(ok_object, v8::HeapGraphEdge::kInternal, "context"); | 2098 GetProperty(ok_object, v8::HeapGraphEdge::kInternal, "context"); |
2099 CHECK_NE(NULL, context_object); | 2099 CHECK_NE(NULL, context_object); |
2100 // Check the objects are not duplicated in the context. | 2100 // Check the objects are not duplicated in the context. |
2101 CHECK_EQ(v8::internal::Context::MIN_CONTEXT_SLOTS + num_objects - 1, | 2101 CHECK_EQ(v8::internal::Context::MIN_CONTEXT_SLOTS + num_objects - 1, |
2102 context_object->GetChildrenCount()); | 2102 context_object->GetChildrenCount()); |
2103 // Check all the objects have got their names. | 2103 // Check all the objects have got their names. |
2104 // ... well check just every 15th because otherwise it's too slow in debug. | 2104 // ... well check just every 15th because otherwise it's too slow in debug. |
2105 for (int i = 0; i < num_objects - 1; i += 15) { | 2105 for (int i = 0; i < num_objects - 1; i += 15) { |
2106 i::EmbeddedVector<char, 100> var_name; | 2106 i::EmbeddedVector<char, 100> var_name; |
2107 i::OS::SNPrintF(var_name, "f_%d", i); | 2107 i::SNPrintF(var_name, "f_%d", i); |
2108 const v8::HeapGraphNode* f_object = GetProperty( | 2108 const v8::HeapGraphNode* f_object = GetProperty( |
2109 context_object, v8::HeapGraphEdge::kContextVariable, var_name.start()); | 2109 context_object, v8::HeapGraphEdge::kContextVariable, var_name.start()); |
2110 CHECK_NE(NULL, f_object); | 2110 CHECK_NE(NULL, f_object); |
2111 } | 2111 } |
2112 } | 2112 } |
2113 | 2113 |
2114 | 2114 |
2115 TEST(AllocationSitesAreVisible) { | 2115 TEST(AllocationSitesAreVisible) { |
2116 LocalContext env; | 2116 LocalContext env; |
2117 v8::Isolate* isolate = env->GetIsolate(); | 2117 v8::Isolate* isolate = env->GetIsolate(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2192 int depth) { | 2192 int depth) { |
2193 const v8::HeapGraphNode* node = snapshot->GetRoot(); | 2193 const v8::HeapGraphNode* node = snapshot->GetRoot(); |
2194 for (int current_depth = 0; current_depth < depth; ++current_depth) { | 2194 for (int current_depth = 0; current_depth < depth; ++current_depth) { |
2195 int i, count = node->GetChildrenCount(); | 2195 int i, count = node->GetChildrenCount(); |
2196 for (i = 0; i < count; ++i) { | 2196 for (i = 0; i < count; ++i) { |
2197 const v8::HeapGraphEdge* edge = node->GetChild(i); | 2197 const v8::HeapGraphEdge* edge = node->GetChild(i); |
2198 const v8::HeapGraphNode* to_node = edge->GetToNode(); | 2198 const v8::HeapGraphNode* to_node = edge->GetToNode(); |
2199 v8::String::Utf8Value edge_name(edge->GetName()); | 2199 v8::String::Utf8Value edge_name(edge->GetName()); |
2200 v8::String::Utf8Value node_name(to_node->GetName()); | 2200 v8::String::Utf8Value node_name(to_node->GetName()); |
2201 i::EmbeddedVector<char, 100> name; | 2201 i::EmbeddedVector<char, 100> name; |
2202 i::OS::SNPrintF(name, "%s::%s", *edge_name, *node_name); | 2202 i::SNPrintF(name, "%s::%s", *edge_name, *node_name); |
2203 if (strstr(name.start(), path[current_depth])) { | 2203 if (strstr(name.start(), path[current_depth])) { |
2204 node = to_node; | 2204 node = to_node; |
2205 break; | 2205 break; |
2206 } | 2206 } |
2207 } | 2207 } |
2208 if (i == count) return NULL; | 2208 if (i == count) return NULL; |
2209 } | 2209 } |
2210 return node; | 2210 return node; |
2211 } | 2211 } |
2212 | 2212 |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2677 map.AddRange(ToAddress(0x180), 0x80, 6U); | 2677 map.AddRange(ToAddress(0x180), 0x80, 6U); |
2678 map.AddRange(ToAddress(0x180), 0x80, 7U); | 2678 map.AddRange(ToAddress(0x180), 0x80, 7U); |
2679 CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180))); | 2679 CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180))); |
2680 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); | 2680 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); |
2681 CHECK_EQ(3, static_cast<int>(map.size())); | 2681 CHECK_EQ(3, static_cast<int>(map.size())); |
2682 | 2682 |
2683 map.Clear(); | 2683 map.Clear(); |
2684 CHECK_EQ(0, static_cast<int>(map.size())); | 2684 CHECK_EQ(0, static_cast<int>(map.size())); |
2685 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400))); | 2685 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400))); |
2686 } | 2686 } |
OLD | NEW |