OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 // ---------------------------------------------------------------------------- | 499 // ---------------------------------------------------------------------------- |
500 // Sampler | 500 // Sampler |
501 // | 501 // |
502 // A sampler periodically samples the state of the VM and optionally | 502 // A sampler periodically samples the state of the VM and optionally |
503 // (if used for profiling) the program counter and stack pointer for | 503 // (if used for profiling) the program counter and stack pointer for |
504 // the thread that created it. | 504 // the thread that created it. |
505 | 505 |
506 // TickSample captures the information collected for each sample. | 506 // TickSample captures the information collected for each sample. |
507 class TickSample { | 507 class TickSample { |
508 public: | 508 public: |
509 TickSample() : pc(0), sp(0), fp(0), state(OTHER), frames_count(0) {} | 509 TickSample() |
510 uintptr_t pc; // Instruction pointer. | 510 : pc(NULL), |
511 uintptr_t sp; // Stack pointer. | 511 sp(NULL), |
512 uintptr_t fp; // Frame pointer. | 512 fp(NULL), |
513 StateTag state; // The state of the VM. | 513 function(NULL), |
| 514 state(OTHER), |
| 515 frames_count(0) {} |
| 516 Address pc; // Instruction pointer. |
| 517 Address sp; // Stack pointer. |
| 518 Address fp; // Frame pointer. |
| 519 Address function; // The last called JS function. |
| 520 StateTag state; // The state of the VM. |
514 static const int kMaxFramesCount = 100; | 521 static const int kMaxFramesCount = 100; |
515 EmbeddedVector<Address, kMaxFramesCount> stack; // Call stack. | 522 EmbeddedVector<Address, kMaxFramesCount> stack; // Call stack. |
516 int frames_count; // Number of captured frames. | 523 int frames_count; // Number of captured frames. |
517 }; | 524 }; |
518 | 525 |
519 class Sampler { | 526 class Sampler { |
520 public: | 527 public: |
521 // Initialize sampler. | 528 // Initialize sampler. |
522 explicit Sampler(int interval, bool profiling); | 529 explicit Sampler(int interval, bool profiling); |
523 virtual ~Sampler(); | 530 virtual ~Sampler(); |
(...skipping 23 matching lines...) Expand all Loading... |
547 bool active_; | 554 bool active_; |
548 PlatformData* data_; // Platform specific data. | 555 PlatformData* data_; // Platform specific data. |
549 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 556 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
550 }; | 557 }; |
551 | 558 |
552 #endif // ENABLE_LOGGING_AND_PROFILING | 559 #endif // ENABLE_LOGGING_AND_PROFILING |
553 | 560 |
554 } } // namespace v8::internal | 561 } } // namespace v8::internal |
555 | 562 |
556 #endif // V8_PLATFORM_H_ | 563 #endif // V8_PLATFORM_H_ |
OLD | NEW |