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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 | 498 |
499 static bool Setup(); | 499 static bool Setup(); |
500 static int LastError(); | 500 static int LastError(); |
501 static uint16_t HToN(uint16_t value); | 501 static uint16_t HToN(uint16_t value); |
502 static uint16_t NToH(uint16_t value); | 502 static uint16_t NToH(uint16_t value); |
503 static uint32_t HToN(uint32_t value); | 503 static uint32_t HToN(uint32_t value); |
504 static uint32_t NToH(uint32_t value); | 504 static uint32_t NToH(uint32_t value); |
505 }; | 505 }; |
506 | 506 |
507 | 507 |
508 #ifdef ENABLE_LOGGING_AND_PROFILING | |
509 // ---------------------------------------------------------------------------- | 508 // ---------------------------------------------------------------------------- |
510 // Sampler | 509 // Sampler |
511 // | 510 // |
512 // A sampler periodically samples the state of the VM and optionally | 511 // A sampler periodically samples the state of the VM and optionally |
513 // (if used for profiling) the program counter and stack pointer for | 512 // (if used for profiling) the program counter and stack pointer for |
514 // the thread that created it. | 513 // the thread that created it. |
515 | 514 |
516 // TickSample captures the information collected for each sample. | 515 // TickSample captures the information collected for each sample. |
517 class TickSample { | 516 class TickSample { |
518 public: | 517 public: |
519 TickSample() | 518 TickSample() |
520 : pc(NULL), | 519 : pc(NULL), |
521 sp(NULL), | 520 sp(NULL), |
522 fp(NULL), | 521 fp(NULL), |
523 function(NULL), | 522 function(NULL), |
524 state(OTHER), | 523 state(OTHER), |
525 frames_count(0) {} | 524 frames_count(0) {} |
526 Address pc; // Instruction pointer. | 525 Address pc; // Instruction pointer. |
527 Address sp; // Stack pointer. | 526 Address sp; // Stack pointer. |
528 Address fp; // Frame pointer. | 527 Address fp; // Frame pointer. |
529 Address function; // The last called JS function. | 528 Address function; // The last called JS function. |
530 StateTag state; // The state of the VM. | 529 StateTag state; // The state of the VM. |
531 static const int kMaxFramesCount = 100; | 530 static const int kMaxFramesCount = 100; |
532 Address stack[kMaxFramesCount]; // Call stack. | 531 Address stack[kMaxFramesCount]; // Call stack. |
533 int frames_count; // Number of captured frames. | 532 int frames_count; // Number of captured frames. |
534 }; | 533 }; |
535 | 534 |
| 535 #ifdef ENABLE_LOGGING_AND_PROFILING |
536 class Sampler { | 536 class Sampler { |
537 public: | 537 public: |
538 // Initialize sampler. | 538 // Initialize sampler. |
539 explicit Sampler(int interval, bool profiling); | 539 explicit Sampler(int interval, bool profiling); |
540 virtual ~Sampler(); | 540 virtual ~Sampler(); |
541 | 541 |
542 // Performs stack sampling. | 542 // Performs stack sampling. |
543 virtual void SampleStack(TickSample* sample) = 0; | 543 virtual void SampleStack(TickSample* sample) = 0; |
544 | 544 |
545 // This method is called for each sampling period with the current | 545 // This method is called for each sampling period with the current |
(...skipping 18 matching lines...) Expand all Loading... |
564 bool active_; | 564 bool active_; |
565 PlatformData* data_; // Platform specific data. | 565 PlatformData* data_; // Platform specific data. |
566 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 566 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
567 }; | 567 }; |
568 | 568 |
569 #endif // ENABLE_LOGGING_AND_PROFILING | 569 #endif // ENABLE_LOGGING_AND_PROFILING |
570 | 570 |
571 } } // namespace v8::internal | 571 } } // namespace v8::internal |
572 | 572 |
573 #endif // V8_PLATFORM_H_ | 573 #endif // V8_PLATFORM_H_ |
OLD | NEW |