예제 #1
0
dom::Nullable<uint64_t> DominatorTree::GetImmediateDominator(
    uint64_t aNodeId) const {
  JS::ubi::Node::Id id(aNodeId);
  Maybe<JS::ubi::Node> node = mHeapSnapshot->getNodeById(id);
  if (node.isNothing()) return dom::Nullable<uint64_t>();

  JS::ubi::Node dominator = mDominatorTree.getImmediateDominator(*node);
  if (!dominator || dominator == *node) return dom::Nullable<uint64_t>();

  return dom::Nullable<uint64_t>(dominator.identifier());
}
                         "DeserializedNodes report the deserialized size.");
  return 0;
}

DEF_TEST(DeserializedNodeUbiNodes, {
    const char16_t* typeName = MOZ_UTF16("TestTypeName");
    const char* className = "MyObjectClassName";

    NodeId id = 1L << 33;
    uint64_t size = 1L << 60;
    MockDeserializedNode mocked(id, typeName, size);
    mocked.jsObjectClassName = mozilla::UniquePtr<char[]>(strdup(className));
    ASSERT_TRUE(!!mocked.jsObjectClassName);

    DeserializedNode& deserialized = mocked;
    JS::ubi::Node ubi(&deserialized);

    // Test the ubi::Node accessors.

    EXPECT_EQ(size, ubi.size(fakeMallocSizeOf));
    EXPECT_EQ(typeName, ubi.typeName());
    EXPECT_EQ(id, ubi.identifier());
    EXPECT_FALSE(ubi.isLive());
    EXPECT_EQ(strcmp(ubi.jsObjectClassName(), className), 0);

    // Test the ubi::Node's edges.

    UniquePtr<DeserializedNode> referent1(new MockDeserializedNode(1,
                                                                   nullptr,
                                                                   10));
    DeserializedEdge edge1;
예제 #3
0
                         "DeserializedNodes report the deserialized size.");
  return 0;
}

DEF_TEST(DeserializedNodeUbiNodes, {
    const char16_t* typeName = MOZ_UTF16("TestTypeName");
    const char* className = "MyObjectClassName";

    NodeId id = uint64_t(1) << 33;
    uint64_t size = uint64_t(1) << 60;
    MockDeserializedNode mocked(id, typeName, size);
    mocked.coarseType = JS::ubi::CoarseType::Script;
    mocked.jsObjectClassName = className;

    DeserializedNode& deserialized = mocked;
    JS::ubi::Node ubi(&deserialized);

    // Test the ubi::Node accessors.

    EXPECT_EQ(size, ubi.size(fakeMallocSizeOf));
    EXPECT_EQ(typeName, ubi.typeName());
    EXPECT_EQ(JS::ubi::CoarseType::Script, ubi.coarseType());
    EXPECT_EQ(id, ubi.identifier());
    EXPECT_FALSE(ubi.isLive());
    EXPECT_EQ(ubi.jsObjectClassName(), className);

    // Test the ubi::Node's edges.

    UniquePtr<DeserializedNode> referent1(new MockDeserializedNode(1,
                                                                   nullptr,
                                                                   10));