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 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 // 0 (root) 0 #1 | 1616 // 0 (root) 0 #1 |
1617 // 0 (anonymous function) 19 #2 no reason script_b:1 | 1617 // 0 (anonymous function) 19 #2 no reason script_b:1 |
1618 // 0 baz 19 #3 TryCatchStatement script_b:3 | 1618 // 0 baz 19 #3 TryCatchStatement script_b:3 |
1619 // 0 foo 18 #4 TryCatchStatement script_a:2 | 1619 // 0 foo 18 #4 TryCatchStatement script_a:2 |
1620 // 1 bar 18 #5 no reason script_a:3 | 1620 // 1 bar 18 #5 no reason script_a:3 |
1621 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); | 1621 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); |
1622 const v8::CpuProfileNode* script = GetChild(env->GetIsolate(), root, | 1622 const v8::CpuProfileNode* script = GetChild(env->GetIsolate(), root, |
1623 ProfileGenerator::kAnonymousFunctionName); | 1623 ProfileGenerator::kAnonymousFunctionName); |
1624 CheckFunctionDetails(env->GetIsolate(), script, | 1624 CheckFunctionDetails(env->GetIsolate(), script, |
1625 ProfileGenerator::kAnonymousFunctionName, "script_b", | 1625 ProfileGenerator::kAnonymousFunctionName, "script_b", |
1626 script_b->GetId(), 1, 1); | 1626 script_b->GetUnboundScript()->GetId(), 1, 1); |
1627 const v8::CpuProfileNode* baz = GetChild(env->GetIsolate(), script, "baz"); | 1627 const v8::CpuProfileNode* baz = GetChild(env->GetIsolate(), script, "baz"); |
1628 CheckFunctionDetails(env->GetIsolate(), baz, "baz", "script_b", | 1628 CheckFunctionDetails(env->GetIsolate(), baz, "baz", "script_b", |
1629 script_b->GetId(), 3, 16); | 1629 script_b->GetUnboundScript()->GetId(), 3, 16); |
1630 const v8::CpuProfileNode* foo = GetChild(env->GetIsolate(), baz, "foo"); | 1630 const v8::CpuProfileNode* foo = GetChild(env->GetIsolate(), baz, "foo"); |
1631 CheckFunctionDetails(env->GetIsolate(), foo, "foo", "script_a", | 1631 CheckFunctionDetails(env->GetIsolate(), foo, "foo", "script_a", |
1632 script_a->GetId(), 2, 1); | 1632 script_a->GetUnboundScript()->GetId(), 2, 1); |
1633 const v8::CpuProfileNode* bar = GetChild(env->GetIsolate(), foo, "bar"); | 1633 const v8::CpuProfileNode* bar = GetChild(env->GetIsolate(), foo, "bar"); |
1634 CheckFunctionDetails(env->GetIsolate(), bar, "bar", "script_a", | 1634 CheckFunctionDetails(env->GetIsolate(), bar, "bar", "script_a", |
1635 script_a->GetId(), 3, 14); | 1635 script_a->GetUnboundScript()->GetId(), 3, 14); |
1636 } | 1636 } |
1637 | 1637 |
1638 | 1638 |
1639 TEST(DontStopOnFinishedProfileDelete) { | 1639 TEST(DontStopOnFinishedProfileDelete) { |
1640 v8::HandleScope scope(CcTest::isolate()); | 1640 v8::HandleScope scope(CcTest::isolate()); |
1641 v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); | 1641 v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); |
1642 v8::Context::Scope context_scope(env); | 1642 v8::Context::Scope context_scope(env); |
1643 v8::Isolate* isolate = env->GetIsolate(); | 1643 v8::Isolate* isolate = env->GetIsolate(); |
1644 | 1644 |
1645 v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler(); | 1645 v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler(); |
(...skipping 15 matching lines...) Expand all Loading... |
1661 inner_profile = NULL; | 1661 inner_profile = NULL; |
1662 CHECK_EQ(0, iprofiler->GetProfilesCount()); | 1662 CHECK_EQ(0, iprofiler->GetProfilesCount()); |
1663 | 1663 |
1664 v8::CpuProfile* outer_profile = profiler->StopProfiling(outer); | 1664 v8::CpuProfile* outer_profile = profiler->StopProfiling(outer); |
1665 CHECK(outer_profile); | 1665 CHECK(outer_profile); |
1666 CHECK_EQ(1, iprofiler->GetProfilesCount()); | 1666 CHECK_EQ(1, iprofiler->GetProfilesCount()); |
1667 outer_profile->Delete(); | 1667 outer_profile->Delete(); |
1668 outer_profile = NULL; | 1668 outer_profile = NULL; |
1669 CHECK_EQ(0, iprofiler->GetProfilesCount()); | 1669 CHECK_EQ(0, iprofiler->GetProfilesCount()); |
1670 } | 1670 } |
OLD | NEW |