[heap-profiler] Fix a bug in MergeNames function.
Bug: chromium:811925 Change-Id: I0b2d9562fa77d6d198a689769705a2d5e977abf9 Reviewed-on: https://chromium-review.googlesource.com/928701 Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Reviewed-by: Hannes Payer <hpayer@chromium.org> Commit-Queue: Ulan Degenbaev <ulan@chromium.org> Cr-Commit-Position: refs/heads/master@{#51432}
This commit is contained in:
parent
a98c889313
commit
4724d0ff81
@ -2045,7 +2045,7 @@ HeapEntry::Type EmbedderGraphNodeType(EmbedderGraphImpl::Node* node) {
|
||||
// Otherwise, the result is the embedder node name.
|
||||
const char* MergeNames(StringsStorage* names, const char* embedder_name,
|
||||
const char* wrapper_name) {
|
||||
for (const char* suffix = wrapper_name; suffix; suffix++) {
|
||||
for (const char* suffix = wrapper_name; *suffix; suffix++) {
|
||||
if (*suffix == '/') {
|
||||
return names->GetFormatted("%s %s", embedder_name, suffix);
|
||||
}
|
||||
|
@ -2938,6 +2938,14 @@ void BuildEmbedderGraphWithWrapperNode(v8::Isolate* v8_isolate,
|
||||
graph->AddNode(std::unique_ptr<Node>(new EmbedderNode("OtherNode", 20)));
|
||||
graph->AddEdge(global_node, embedder_node);
|
||||
graph->AddEdge(wrapper_node, other_node);
|
||||
|
||||
Node* wrapper_node2 = graph->AddNode(
|
||||
std::unique_ptr<Node>(new EmbedderNode("WrapperNode2", 10)));
|
||||
Node* embedder_node2 = graph->AddNode(std::unique_ptr<Node>(
|
||||
new EmbedderNode("EmbedderNode2", 10, wrapper_node2)));
|
||||
graph->AddEdge(global_node, embedder_node2);
|
||||
graph->AddEdge(embedder_node2, wrapper_node2);
|
||||
graph->AddEdge(wrapper_node2, other_node);
|
||||
}
|
||||
|
||||
TEST(EmbedderGraphWithWrapperNode) {
|
||||
@ -2963,6 +2971,14 @@ TEST(EmbedderGraphWithWrapperNode) {
|
||||
const v8::HeapGraphNode* wrapper_node =
|
||||
GetChildByName(embedder_node, "WrapperNode / TAG");
|
||||
CHECK(!wrapper_node);
|
||||
|
||||
const v8::HeapGraphNode* embedder_node2 =
|
||||
GetChildByName(global, "EmbedderNode2");
|
||||
other_node = GetChildByName(embedder_node2, "OtherNode");
|
||||
CHECK(other_node);
|
||||
const v8::HeapGraphNode* wrapper_node2 =
|
||||
GetChildByName(embedder_node, "WrapperNode2");
|
||||
CHECK(!wrapper_node2);
|
||||
}
|
||||
|
||||
static inline i::Address ToAddress(int n) {
|
||||
|
Loading…
Reference in New Issue
Block a user