Revert "CPUProfiler: Simplify CodeEntry constructor calls."
This reverts commit a6cc1e3b563c0d0689da35dbf8163545c8146ddd. One test starts failing on Windows. BUG=none TBR= yurys@chromium.org Review URL: https://codereview.chromium.org/17875002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15335 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
3634b61d21
commit
06200a3113
@ -46,9 +46,9 @@ const char* StringsStorage::GetFunctionName(const char* name) {
|
|||||||
CodeEntry::CodeEntry(Logger::LogEventsAndTags tag,
|
CodeEntry::CodeEntry(Logger::LogEventsAndTags tag,
|
||||||
const char* name_prefix,
|
const char* name_prefix,
|
||||||
const char* name,
|
const char* name,
|
||||||
int security_token_id,
|
|
||||||
const char* resource_name,
|
const char* resource_name,
|
||||||
int line_number)
|
int line_number,
|
||||||
|
int security_token_id)
|
||||||
: tag_(tag),
|
: tag_(tag),
|
||||||
name_prefix_(name_prefix),
|
name_prefix_(name_prefix),
|
||||||
name_(name),
|
name_(name),
|
||||||
|
@ -296,7 +296,12 @@ class DeleteNodesCallback {
|
|||||||
|
|
||||||
|
|
||||||
ProfileTree::ProfileTree()
|
ProfileTree::ProfileTree()
|
||||||
: root_entry_(Logger::FUNCTION_TAG, "", "(root)"),
|
: root_entry_(Logger::FUNCTION_TAG,
|
||||||
|
"",
|
||||||
|
"(root)",
|
||||||
|
"",
|
||||||
|
0,
|
||||||
|
TokenEnumerator::kNoSecurityToken),
|
||||||
next_node_id_(1),
|
next_node_id_(1),
|
||||||
root_(new ProfileNode(this, &root_entry_)) {
|
root_(new ProfileNode(this, &root_entry_)) {
|
||||||
}
|
}
|
||||||
@ -792,9 +797,9 @@ CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
|
|||||||
CodeEntry* entry = new CodeEntry(tag,
|
CodeEntry* entry = new CodeEntry(tag,
|
||||||
CodeEntry::kEmptyNamePrefix,
|
CodeEntry::kEmptyNamePrefix,
|
||||||
GetFunctionName(name),
|
GetFunctionName(name),
|
||||||
TokenEnumerator::kNoSecurityToken,
|
|
||||||
GetName(resource_name),
|
GetName(resource_name),
|
||||||
line_number);
|
line_number,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
code_entries_.Add(entry);
|
code_entries_.Add(entry);
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
@ -804,7 +809,10 @@ CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
|
|||||||
const char* name) {
|
const char* name) {
|
||||||
CodeEntry* entry = new CodeEntry(tag,
|
CodeEntry* entry = new CodeEntry(tag,
|
||||||
CodeEntry::kEmptyNamePrefix,
|
CodeEntry::kEmptyNamePrefix,
|
||||||
GetFunctionName(name));
|
GetFunctionName(name),
|
||||||
|
"",
|
||||||
|
v8::CpuProfileNode::kNoLineNumberInfo,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
code_entries_.Add(entry);
|
code_entries_.Add(entry);
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
@ -816,6 +824,8 @@ CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
|
|||||||
CodeEntry* entry = new CodeEntry(tag,
|
CodeEntry* entry = new CodeEntry(tag,
|
||||||
name_prefix,
|
name_prefix,
|
||||||
GetName(name),
|
GetName(name),
|
||||||
|
"",
|
||||||
|
v8::CpuProfileNode::kNoLineNumberInfo,
|
||||||
TokenEnumerator::kInheritsSecurityToken);
|
TokenEnumerator::kInheritsSecurityToken);
|
||||||
code_entries_.Add(entry);
|
code_entries_.Add(entry);
|
||||||
return entry;
|
return entry;
|
||||||
@ -827,6 +837,8 @@ CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
|
|||||||
CodeEntry* entry = new CodeEntry(tag,
|
CodeEntry* entry = new CodeEntry(tag,
|
||||||
"args_count: ",
|
"args_count: ",
|
||||||
GetName(args_count),
|
GetName(args_count),
|
||||||
|
"",
|
||||||
|
v8::CpuProfileNode::kNoLineNumberInfo,
|
||||||
TokenEnumerator::kInheritsSecurityToken);
|
TokenEnumerator::kInheritsSecurityToken);
|
||||||
code_entries_.Add(entry);
|
code_entries_.Add(entry);
|
||||||
return entry;
|
return entry;
|
||||||
|
@ -99,9 +99,9 @@ class CodeEntry {
|
|||||||
INLINE(CodeEntry(Logger::LogEventsAndTags tag,
|
INLINE(CodeEntry(Logger::LogEventsAndTags tag,
|
||||||
const char* name_prefix,
|
const char* name_prefix,
|
||||||
const char* name,
|
const char* name,
|
||||||
int security_token_id = TokenEnumerator::kNoSecurityToken,
|
const char* resource_name,
|
||||||
const char* resource_name = "",
|
int line_number,
|
||||||
int line_number = v8::CpuProfileNode::kNoLineNumberInfo));
|
int security_token_id));
|
||||||
~CodeEntry();
|
~CodeEntry();
|
||||||
|
|
||||||
INLINE(bool is_js_function() const) { return is_js_function_tag(tag_); }
|
INLINE(bool is_js_function() const) { return is_js_function_tag(tag_); }
|
||||||
|
@ -87,17 +87,20 @@ TEST(TokenEnumerator) {
|
|||||||
TEST(ProfileNodeFindOrAddChild) {
|
TEST(ProfileNodeFindOrAddChild) {
|
||||||
ProfileTree tree;
|
ProfileTree tree;
|
||||||
ProfileNode node(&tree, NULL);
|
ProfileNode node(&tree, NULL);
|
||||||
CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa");
|
CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
ProfileNode* childNode1 = node.FindOrAddChild(&entry1);
|
ProfileNode* childNode1 = node.FindOrAddChild(&entry1);
|
||||||
CHECK_NE(NULL, childNode1);
|
CHECK_NE(NULL, childNode1);
|
||||||
CHECK_EQ(childNode1, node.FindOrAddChild(&entry1));
|
CHECK_EQ(childNode1, node.FindOrAddChild(&entry1));
|
||||||
CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb");
|
CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", "", 0,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
ProfileNode* childNode2 = node.FindOrAddChild(&entry2);
|
ProfileNode* childNode2 = node.FindOrAddChild(&entry2);
|
||||||
CHECK_NE(NULL, childNode2);
|
CHECK_NE(NULL, childNode2);
|
||||||
CHECK_NE(childNode1, childNode2);
|
CHECK_NE(childNode1, childNode2);
|
||||||
CHECK_EQ(childNode1, node.FindOrAddChild(&entry1));
|
CHECK_EQ(childNode1, node.FindOrAddChild(&entry1));
|
||||||
CHECK_EQ(childNode2, node.FindOrAddChild(&entry2));
|
CHECK_EQ(childNode2, node.FindOrAddChild(&entry2));
|
||||||
CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc");
|
CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", "", 0,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
ProfileNode* childNode3 = node.FindOrAddChild(&entry3);
|
ProfileNode* childNode3 = node.FindOrAddChild(&entry3);
|
||||||
CHECK_NE(NULL, childNode3);
|
CHECK_NE(NULL, childNode3);
|
||||||
CHECK_NE(childNode1, childNode3);
|
CHECK_NE(childNode1, childNode3);
|
||||||
@ -113,15 +116,17 @@ TEST(ProfileNodeFindOrAddChildForSameFunction) {
|
|||||||
const char* aaa = "aaa";
|
const char* aaa = "aaa";
|
||||||
ProfileTree tree;
|
ProfileTree tree;
|
||||||
ProfileNode node(&tree, NULL);
|
ProfileNode node(&tree, NULL);
|
||||||
CodeEntry entry1(i::Logger::FUNCTION_TAG, empty, aaa);
|
CodeEntry entry1(i::Logger::FUNCTION_TAG, empty, aaa, empty, 0,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
ProfileNode* childNode1 = node.FindOrAddChild(&entry1);
|
ProfileNode* childNode1 = node.FindOrAddChild(&entry1);
|
||||||
CHECK_NE(NULL, childNode1);
|
CHECK_NE(NULL, childNode1);
|
||||||
CHECK_EQ(childNode1, node.FindOrAddChild(&entry1));
|
CHECK_EQ(childNode1, node.FindOrAddChild(&entry1));
|
||||||
// The same function again.
|
// The same function again.
|
||||||
CodeEntry entry2(i::Logger::FUNCTION_TAG, empty, aaa);
|
CodeEntry entry2(i::Logger::FUNCTION_TAG, empty, aaa, empty, 0,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
CHECK_EQ(childNode1, node.FindOrAddChild(&entry2));
|
CHECK_EQ(childNode1, node.FindOrAddChild(&entry2));
|
||||||
// Now with a different security token.
|
// Now with a different security token.
|
||||||
CodeEntry entry3(i::Logger::FUNCTION_TAG, empty, aaa,
|
CodeEntry entry3(i::Logger::FUNCTION_TAG, empty, aaa, empty, 0,
|
||||||
TokenEnumerator::kNoSecurityToken + 1);
|
TokenEnumerator::kNoSecurityToken + 1);
|
||||||
CHECK_EQ(childNode1, node.FindOrAddChild(&entry3));
|
CHECK_EQ(childNode1, node.FindOrAddChild(&entry3));
|
||||||
}
|
}
|
||||||
@ -157,9 +162,12 @@ class ProfileTreeTestHelper {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
TEST(ProfileTreeAddPathFromStart) {
|
TEST(ProfileTreeAddPathFromStart) {
|
||||||
CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa");
|
CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0,
|
||||||
CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb");
|
TokenEnumerator::kNoSecurityToken);
|
||||||
CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc");
|
CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", "", 0,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
|
CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", "", 0,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
ProfileTree tree;
|
ProfileTree tree;
|
||||||
ProfileTreeTestHelper helper(&tree);
|
ProfileTreeTestHelper helper(&tree);
|
||||||
CHECK_EQ(NULL, helper.Walk(&entry1));
|
CHECK_EQ(NULL, helper.Walk(&entry1));
|
||||||
@ -224,9 +232,12 @@ TEST(ProfileTreeAddPathFromStart) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(ProfileTreeAddPathFromEnd) {
|
TEST(ProfileTreeAddPathFromEnd) {
|
||||||
CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa");
|
CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0,
|
||||||
CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb");
|
TokenEnumerator::kNoSecurityToken);
|
||||||
CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc");
|
CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", "", 0,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
|
CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", "", 0,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
ProfileTree tree;
|
ProfileTree tree;
|
||||||
ProfileTreeTestHelper helper(&tree);
|
ProfileTreeTestHelper helper(&tree);
|
||||||
CHECK_EQ(NULL, helper.Walk(&entry1));
|
CHECK_EQ(NULL, helper.Walk(&entry1));
|
||||||
@ -304,7 +315,8 @@ TEST(ProfileTreeCalculateTotalTicks) {
|
|||||||
CHECK_EQ(1, empty_tree.root()->total_ticks());
|
CHECK_EQ(1, empty_tree.root()->total_ticks());
|
||||||
CHECK_EQ(1, empty_tree.root()->self_ticks());
|
CHECK_EQ(1, empty_tree.root()->self_ticks());
|
||||||
|
|
||||||
CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa");
|
CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
CodeEntry* e1_path[] = {&entry1};
|
CodeEntry* e1_path[] = {&entry1};
|
||||||
Vector<CodeEntry*> e1_path_vec(
|
Vector<CodeEntry*> e1_path_vec(
|
||||||
e1_path, sizeof(e1_path) / sizeof(e1_path[0]));
|
e1_path, sizeof(e1_path) / sizeof(e1_path[0]));
|
||||||
@ -325,7 +337,8 @@ TEST(ProfileTreeCalculateTotalTicks) {
|
|||||||
CHECK_EQ(1, node1->total_ticks());
|
CHECK_EQ(1, node1->total_ticks());
|
||||||
CHECK_EQ(1, node1->self_ticks());
|
CHECK_EQ(1, node1->self_ticks());
|
||||||
|
|
||||||
CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb");
|
CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", "", 0,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
CodeEntry* e1_e2_path[] = {&entry1, &entry2};
|
CodeEntry* e1_e2_path[] = {&entry1, &entry2};
|
||||||
Vector<CodeEntry*> e1_e2_path_vec(
|
Vector<CodeEntry*> e1_e2_path_vec(
|
||||||
e1_e2_path, sizeof(e1_e2_path) / sizeof(e1_e2_path[0]));
|
e1_e2_path, sizeof(e1_e2_path) / sizeof(e1_e2_path[0]));
|
||||||
@ -360,7 +373,8 @@ TEST(ProfileTreeCalculateTotalTicks) {
|
|||||||
CodeEntry* e2_path[] = {&entry2};
|
CodeEntry* e2_path[] = {&entry2};
|
||||||
Vector<CodeEntry*> e2_path_vec(
|
Vector<CodeEntry*> e2_path_vec(
|
||||||
e2_path, sizeof(e2_path) / sizeof(e2_path[0]));
|
e2_path, sizeof(e2_path) / sizeof(e2_path[0]));
|
||||||
CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc");
|
CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", "", 0,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
CodeEntry* e3_path[] = {&entry3};
|
CodeEntry* e3_path[] = {&entry3};
|
||||||
Vector<CodeEntry*> e3_path_vec(
|
Vector<CodeEntry*> e3_path_vec(
|
||||||
e3_path, sizeof(e3_path) / sizeof(e3_path[0]));
|
e3_path, sizeof(e3_path) / sizeof(e3_path[0]));
|
||||||
@ -418,11 +432,12 @@ TEST(ProfileTreeCalculateTotalTicks) {
|
|||||||
TEST(ProfileTreeFilteredClone) {
|
TEST(ProfileTreeFilteredClone) {
|
||||||
ProfileTree source_tree;
|
ProfileTree source_tree;
|
||||||
const int token0 = 0, token1 = 1, token2 = 2;
|
const int token0 = 0, token1 = 1, token2 = 2;
|
||||||
CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", token0);
|
CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0, token0);
|
||||||
CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", token1);
|
CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", "", 0, token1);
|
||||||
CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", token0);
|
CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", "", 0, token0);
|
||||||
CodeEntry entry4(i::Logger::FUNCTION_TAG, "", "ddd",
|
CodeEntry entry4(
|
||||||
TokenEnumerator::kInheritsSecurityToken);
|
i::Logger::FUNCTION_TAG, "", "ddd", "", 0,
|
||||||
|
TokenEnumerator::kInheritsSecurityToken);
|
||||||
|
|
||||||
{
|
{
|
||||||
CodeEntry* e1_e2_path[] = {&entry1, &entry2};
|
CodeEntry* e1_e2_path[] = {&entry1, &entry2};
|
||||||
@ -519,10 +534,14 @@ static inline i::Address ToAddress(int n) {
|
|||||||
|
|
||||||
TEST(CodeMapAddCode) {
|
TEST(CodeMapAddCode) {
|
||||||
CodeMap code_map;
|
CodeMap code_map;
|
||||||
CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa");
|
CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0,
|
||||||
CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb");
|
TokenEnumerator::kNoSecurityToken);
|
||||||
CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc");
|
CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", "", 0,
|
||||||
CodeEntry entry4(i::Logger::FUNCTION_TAG, "", "ddd");
|
TokenEnumerator::kNoSecurityToken);
|
||||||
|
CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", "", 0,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
|
CodeEntry entry4(i::Logger::FUNCTION_TAG, "", "ddd", "", 0,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
code_map.AddCode(ToAddress(0x1500), &entry1, 0x200);
|
code_map.AddCode(ToAddress(0x1500), &entry1, 0x200);
|
||||||
code_map.AddCode(ToAddress(0x1700), &entry2, 0x100);
|
code_map.AddCode(ToAddress(0x1700), &entry2, 0x100);
|
||||||
code_map.AddCode(ToAddress(0x1900), &entry3, 0x50);
|
code_map.AddCode(ToAddress(0x1900), &entry3, 0x50);
|
||||||
@ -549,8 +568,10 @@ TEST(CodeMapAddCode) {
|
|||||||
|
|
||||||
TEST(CodeMapMoveAndDeleteCode) {
|
TEST(CodeMapMoveAndDeleteCode) {
|
||||||
CodeMap code_map;
|
CodeMap code_map;
|
||||||
CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa");
|
CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0,
|
||||||
CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb");
|
TokenEnumerator::kNoSecurityToken);
|
||||||
|
CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "bbb", "", 0,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
code_map.AddCode(ToAddress(0x1500), &entry1, 0x200);
|
code_map.AddCode(ToAddress(0x1500), &entry1, 0x200);
|
||||||
code_map.AddCode(ToAddress(0x1700), &entry2, 0x100);
|
code_map.AddCode(ToAddress(0x1700), &entry2, 0x100);
|
||||||
CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500)));
|
CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500)));
|
||||||
@ -558,7 +579,8 @@ TEST(CodeMapMoveAndDeleteCode) {
|
|||||||
code_map.MoveCode(ToAddress(0x1500), ToAddress(0x1700)); // Deprecate bbb.
|
code_map.MoveCode(ToAddress(0x1500), ToAddress(0x1700)); // Deprecate bbb.
|
||||||
CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1500)));
|
CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1500)));
|
||||||
CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1700)));
|
CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1700)));
|
||||||
CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc");
|
CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "ccc", "", 0,
|
||||||
|
TokenEnumerator::kNoSecurityToken);
|
||||||
code_map.AddCode(ToAddress(0x1750), &entry3, 0x100);
|
code_map.AddCode(ToAddress(0x1750), &entry3, 0x100);
|
||||||
CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1700)));
|
CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1700)));
|
||||||
CHECK_EQ(&entry3, code_map.FindEntry(ToAddress(0x1750)));
|
CHECK_EQ(&entry3, code_map.FindEntry(ToAddress(0x1750)));
|
||||||
|
Loading…
Reference in New Issue
Block a user