OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 "\n\nbaz();\n" | 1622 "\n\nbaz();\n" |
1623 "stopProfiling();\n", | 1623 "stopProfiling();\n", |
1624 "script_b"); | 1624 "script_b"); |
1625 script_b->Run(); | 1625 script_b->Run(); |
1626 const v8::CpuProfile* profile = i::ProfilerExtension::last_profile; | 1626 const v8::CpuProfile* profile = i::ProfilerExtension::last_profile; |
1627 const v8::CpuProfileNode* current = profile->GetTopDownRoot(); | 1627 const v8::CpuProfileNode* current = profile->GetTopDownRoot(); |
1628 reinterpret_cast<ProfileNode*>( | 1628 reinterpret_cast<ProfileNode*>( |
1629 const_cast<v8::CpuProfileNode*>(current))->Print(0); | 1629 const_cast<v8::CpuProfileNode*>(current))->Print(0); |
1630 // The tree should look like this: | 1630 // The tree should look like this: |
1631 // 0 (root) 0 #1 | 1631 // 0 (root) 0 #1 |
1632 // 0 (anonymous function) 19 #2 no reason script_b:1 | 1632 // 0 "" 19 #2 no reason script_b:1 |
1633 // 0 baz 19 #3 TryCatchStatement script_b:3 | 1633 // 0 baz 19 #3 TryCatchStatement script_b:3 |
1634 // 0 foo 18 #4 TryCatchStatement script_a:2 | 1634 // 0 foo 18 #4 TryCatchStatement script_a:2 |
1635 // 1 bar 18 #5 no reason script_a:3 | 1635 // 1 bar 18 #5 no reason script_a:3 |
1636 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); | 1636 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); |
1637 const v8::CpuProfileNode* script = GetChild(env->GetIsolate(), root, | 1637 const v8::CpuProfileNode* script = GetChild(env->GetIsolate(), root, ""); |
1638 ProfileGenerator::kAnonymousFunctionName); | 1638 CheckFunctionDetails(env->GetIsolate(), script, "", "script_b", |
1639 CheckFunctionDetails(env->GetIsolate(), script, | |
1640 ProfileGenerator::kAnonymousFunctionName, "script_b", | |
1641 script_b->GetUnboundScript()->GetId(), 1, 1); | 1639 script_b->GetUnboundScript()->GetId(), 1, 1); |
1642 const v8::CpuProfileNode* baz = GetChild(env->GetIsolate(), script, "baz"); | 1640 const v8::CpuProfileNode* baz = GetChild(env->GetIsolate(), script, "baz"); |
1643 CheckFunctionDetails(env->GetIsolate(), baz, "baz", "script_b", | 1641 CheckFunctionDetails(env->GetIsolate(), baz, "baz", "script_b", |
1644 script_b->GetUnboundScript()->GetId(), 3, 16); | 1642 script_b->GetUnboundScript()->GetId(), 3, 16); |
1645 const v8::CpuProfileNode* foo = GetChild(env->GetIsolate(), baz, "foo"); | 1643 const v8::CpuProfileNode* foo = GetChild(env->GetIsolate(), baz, "foo"); |
1646 CheckFunctionDetails(env->GetIsolate(), foo, "foo", "script_a", | 1644 CheckFunctionDetails(env->GetIsolate(), foo, "foo", "script_a", |
1647 script_a->GetUnboundScript()->GetId(), 2, 1); | 1645 script_a->GetUnboundScript()->GetId(), 2, 1); |
1648 const v8::CpuProfileNode* bar = GetChild(env->GetIsolate(), foo, "bar"); | 1646 const v8::CpuProfileNode* bar = GetChild(env->GetIsolate(), foo, "bar"); |
1649 CheckFunctionDetails(env->GetIsolate(), bar, "bar", "script_a", | 1647 CheckFunctionDetails(env->GetIsolate(), bar, "bar", "script_a", |
1650 script_a->GetUnboundScript()->GetId(), 3, 14); | 1648 script_a->GetUnboundScript()->GetId(), 3, 14); |
(...skipping 25 matching lines...) Expand all Loading... |
1676 inner_profile = NULL; | 1674 inner_profile = NULL; |
1677 CHECK_EQ(0, iprofiler->GetProfilesCount()); | 1675 CHECK_EQ(0, iprofiler->GetProfilesCount()); |
1678 | 1676 |
1679 v8::CpuProfile* outer_profile = profiler->StopProfiling(outer); | 1677 v8::CpuProfile* outer_profile = profiler->StopProfiling(outer); |
1680 CHECK(outer_profile); | 1678 CHECK(outer_profile); |
1681 CHECK_EQ(1, iprofiler->GetProfilesCount()); | 1679 CHECK_EQ(1, iprofiler->GetProfilesCount()); |
1682 outer_profile->Delete(); | 1680 outer_profile->Delete(); |
1683 outer_profile = NULL; | 1681 outer_profile = NULL; |
1684 CHECK_EQ(0, iprofiler->GetProfilesCount()); | 1682 CHECK_EQ(0, iprofiler->GetProfilesCount()); |
1685 } | 1683 } |
OLD | NEW |