| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 CodeEntry* entry3 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc"); | 421 CodeEntry* entry3 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc"); |
| 422 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); | 422 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); |
| 423 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); | 423 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); |
| 424 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); | 424 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); |
| 425 | 425 |
| 426 // We are building the following calls tree: | 426 // We are building the following calls tree: |
| 427 // -> aaa #3 - sample1 | 427 // -> aaa #3 - sample1 |
| 428 // (root)#1 -> aaa #2 -> bbb #4 -> ccc #5 - sample2 | 428 // (root)#1 -> aaa #2 -> bbb #4 -> ccc #5 - sample2 |
| 429 // -> ccc #6 -> aaa #7 - sample3 | 429 // -> ccc #6 -> aaa #7 - sample3 |
| 430 TickSample sample1; | 430 TickSample sample1; |
| 431 sample1.timestamp = v8::base::TimeTicks::HighResolutionNow(); |
| 431 sample1.pc = ToAddress(0x1600); | 432 sample1.pc = ToAddress(0x1600); |
| 432 sample1.stack[0] = ToAddress(0x1510); | 433 sample1.stack[0] = ToAddress(0x1510); |
| 433 sample1.frames_count = 1; | 434 sample1.frames_count = 1; |
| 434 generator.RecordTickSample(sample1); | 435 generator.RecordTickSample(sample1); |
| 435 TickSample sample2; | 436 TickSample sample2; |
| 437 sample2.timestamp = v8::base::TimeTicks::HighResolutionNow(); |
| 436 sample2.pc = ToAddress(0x1925); | 438 sample2.pc = ToAddress(0x1925); |
| 437 sample2.stack[0] = ToAddress(0x1780); | 439 sample2.stack[0] = ToAddress(0x1780); |
| 438 sample2.stack[1] = ToAddress(0x10000); // non-existent. | 440 sample2.stack[1] = ToAddress(0x10000); // non-existent. |
| 439 sample2.stack[2] = ToAddress(0x1620); | 441 sample2.stack[2] = ToAddress(0x1620); |
| 440 sample2.frames_count = 3; | 442 sample2.frames_count = 3; |
| 441 generator.RecordTickSample(sample2); | 443 generator.RecordTickSample(sample2); |
| 442 TickSample sample3; | 444 TickSample sample3; |
| 445 sample3.timestamp = v8::base::TimeTicks::HighResolutionNow(); |
| 443 sample3.pc = ToAddress(0x1510); | 446 sample3.pc = ToAddress(0x1510); |
| 444 sample3.stack[0] = ToAddress(0x1910); | 447 sample3.stack[0] = ToAddress(0x1910); |
| 445 sample3.stack[1] = ToAddress(0x1610); | 448 sample3.stack[1] = ToAddress(0x1610); |
| 446 sample3.frames_count = 2; | 449 sample3.frames_count = 2; |
| 447 generator.RecordTickSample(sample3); | 450 generator.RecordTickSample(sample3); |
| 448 | 451 |
| 449 CpuProfile* profile = profiles.StopProfiling(""); | 452 CpuProfile* profile = profiles.StopProfiling(""); |
| 450 unsigned nodeId = 1; | 453 unsigned nodeId = 1; |
| 451 CheckNodeIds(profile->top_down()->root(), &nodeId); | 454 CheckNodeIds(profile->top_down()->root(), &nodeId); |
| 452 CHECK_EQ(7u, nodeId - 1); | 455 CHECK_EQ(7u, nodeId - 1); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 CHECK(const_cast<v8::CpuProfileNode*>(current)); | 721 CHECK(const_cast<v8::CpuProfileNode*>(current)); |
| 719 | 722 |
| 720 current = PickChild(current, "TryFinally"); | 723 current = PickChild(current, "TryFinally"); |
| 721 CHECK(const_cast<v8::CpuProfileNode*>(current)); | 724 CHECK(const_cast<v8::CpuProfileNode*>(current)); |
| 722 CHECK(!strcmp("TryFinallyStatement", current->GetBailoutReason())); | 725 CHECK(!strcmp("TryFinallyStatement", current->GetBailoutReason())); |
| 723 | 726 |
| 724 current = PickChild(current, "Debugger"); | 727 current = PickChild(current, "Debugger"); |
| 725 CHECK(const_cast<v8::CpuProfileNode*>(current)); | 728 CHECK(const_cast<v8::CpuProfileNode*>(current)); |
| 726 CHECK(!strcmp("DebuggerStatement", current->GetBailoutReason())); | 729 CHECK(!strcmp("DebuggerStatement", current->GetBailoutReason())); |
| 727 } | 730 } |
| OLD | NEW |