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 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 const v8::CpuProfileNode* baz = GetChild(env->GetIsolate(), script, "baz"); | 1526 const v8::CpuProfileNode* baz = GetChild(env->GetIsolate(), script, "baz"); |
1527 CheckFunctionDetails(env->GetIsolate(), baz, "baz", "script_b", | 1527 CheckFunctionDetails(env->GetIsolate(), baz, "baz", "script_b", |
1528 script_b->GetId(), 3, 16); | 1528 script_b->GetId(), 3, 16); |
1529 const v8::CpuProfileNode* foo = GetChild(env->GetIsolate(), baz, "foo"); | 1529 const v8::CpuProfileNode* foo = GetChild(env->GetIsolate(), baz, "foo"); |
1530 CheckFunctionDetails(env->GetIsolate(), foo, "foo", "script_a", | 1530 CheckFunctionDetails(env->GetIsolate(), foo, "foo", "script_a", |
1531 script_a->GetId(), 2, 1); | 1531 script_a->GetId(), 2, 1); |
1532 const v8::CpuProfileNode* bar = GetChild(env->GetIsolate(), foo, "bar"); | 1532 const v8::CpuProfileNode* bar = GetChild(env->GetIsolate(), foo, "bar"); |
1533 CheckFunctionDetails(env->GetIsolate(), bar, "bar", "script_a", | 1533 CheckFunctionDetails(env->GetIsolate(), bar, "bar", "script_a", |
1534 script_a->GetId(), 3, 14); | 1534 script_a->GetId(), 3, 14); |
1535 } | 1535 } |
| 1536 |
| 1537 |
| 1538 TEST(DontStopOnFinishedProfileDelete) { |
| 1539 const char* extensions[] = { "v8/profiler" }; |
| 1540 v8::ExtensionConfiguration config(1, extensions); |
| 1541 LocalContext env(&config); |
| 1542 v8::Isolate* isolate = env->GetIsolate(); |
| 1543 v8::HandleScope handleScope(isolate); |
| 1544 |
| 1545 v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler(); |
| 1546 |
| 1547 CHECK_EQ(0, profiler->GetProfileCount()); |
| 1548 v8::Handle<v8::String> outer = v8::String::NewFromUtf8(isolate, "outer"); |
| 1549 profiler->StartCpuProfiling(outer); |
| 1550 CHECK_EQ(0, profiler->GetProfileCount()); |
| 1551 |
| 1552 v8::Handle<v8::String> inner = v8::String::NewFromUtf8(isolate, "inner"); |
| 1553 profiler->StartCpuProfiling(inner); |
| 1554 CHECK_EQ(0, profiler->GetProfileCount()); |
| 1555 |
| 1556 const v8::CpuProfile* inner_profile = profiler->StopCpuProfiling(inner); |
| 1557 CHECK(inner_profile); |
| 1558 CHECK_EQ(1, profiler->GetProfileCount()); |
| 1559 const_cast<v8::CpuProfile*>(inner_profile)->Delete(); |
| 1560 inner_profile = NULL; |
| 1561 CHECK_EQ(0, profiler->GetProfileCount()); |
| 1562 |
| 1563 const v8::CpuProfile* outer_profile = profiler->StopCpuProfiling(outer); |
| 1564 CHECK(outer_profile); |
| 1565 CHECK_EQ(1, profiler->GetProfileCount()); |
| 1566 const_cast<v8::CpuProfile*>(outer_profile)->Delete(); |
| 1567 outer_profile = NULL; |
| 1568 CHECK_EQ(0, profiler->GetProfileCount()); |
| 1569 } |
OLD | NEW |