OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // ---------------------------------------------------------------------------- | 102 // ---------------------------------------------------------------------------- |
103 // OS | 103 // OS |
104 // | 104 // |
105 // This class has static methods for the different platform specific | 105 // This class has static methods for the different platform specific |
106 // functions. Add methods here to cope with differences between the | 106 // functions. Add methods here to cope with differences between the |
107 // supported platforms. | 107 // supported platforms. |
108 | 108 |
109 class OS { | 109 class OS { |
110 public: | 110 public: |
111 // Initializes the platform OS support. Called once at VM startup. | 111 // Initializes the platform OS support. Called once at VM startup. |
112 static void Setup(); | 112 static void SetUp(); |
113 | 113 |
114 // Returns the accumulated user time for thread. This routine | 114 // Returns the accumulated user time for thread. This routine |
115 // can be used for profiling. The implementation should | 115 // can be used for profiling. The implementation should |
116 // strive for high-precision timer resolution, preferable | 116 // strive for high-precision timer resolution, preferable |
117 // micro-second resolution. | 117 // micro-second resolution. |
118 static int GetUserTime(uint32_t* secs, uint32_t* usecs); | 118 static int GetUserTime(uint32_t* secs, uint32_t* usecs); |
119 | 119 |
120 // Get a tick counter normalized to one tick per microsecond. | 120 // Get a tick counter normalized to one tick per microsecond. |
121 // Used for calculating time intervals. | 121 // Used for calculating time intervals. |
122 static int64_t Ticks(); | 122 static int64_t Ticks(); |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 470 |
471 | 471 |
472 // The thread name length is limited to 16 based on Linux's implementation of | 472 // The thread name length is limited to 16 based on Linux's implementation of |
473 // prctl(). | 473 // prctl(). |
474 static const int kMaxThreadNameLength = 16; | 474 static const int kMaxThreadNameLength = 16; |
475 | 475 |
476 class PlatformData; | 476 class PlatformData; |
477 PlatformData* data() { return data_; } | 477 PlatformData* data() { return data_; } |
478 | 478 |
479 private: | 479 private: |
480 void set_name(const char *name); | 480 void set_name(const char* name); |
481 | 481 |
482 PlatformData* data_; | 482 PlatformData* data_; |
483 | 483 |
484 char name_[kMaxThreadNameLength]; | 484 char name_[kMaxThreadNameLength]; |
485 int stack_size_; | 485 int stack_size_; |
486 | 486 |
487 DISALLOW_COPY_AND_ASSIGN(Thread); | 487 DISALLOW_COPY_AND_ASSIGN(Thread); |
488 }; | 488 }; |
489 | 489 |
490 | 490 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 | 586 |
587 // Data Transimission | 587 // Data Transimission |
588 virtual int Send(const char* data, int len) const = 0; | 588 virtual int Send(const char* data, int len) const = 0; |
589 virtual int Receive(char* data, int len) const = 0; | 589 virtual int Receive(char* data, int len) const = 0; |
590 | 590 |
591 // Set the value of the SO_REUSEADDR socket option. | 591 // Set the value of the SO_REUSEADDR socket option. |
592 virtual bool SetReuseAddress(bool reuse_address) = 0; | 592 virtual bool SetReuseAddress(bool reuse_address) = 0; |
593 | 593 |
594 virtual bool IsValid() const = 0; | 594 virtual bool IsValid() const = 0; |
595 | 595 |
596 static bool Setup(); | 596 static bool SetUp(); |
597 static int LastError(); | 597 static int LastError(); |
598 static uint16_t HToN(uint16_t value); | 598 static uint16_t HToN(uint16_t value); |
599 static uint16_t NToH(uint16_t value); | 599 static uint16_t NToH(uint16_t value); |
600 static uint32_t HToN(uint32_t value); | 600 static uint32_t HToN(uint32_t value); |
601 static uint32_t NToH(uint32_t value); | 601 static uint32_t NToH(uint32_t value); |
602 }; | 602 }; |
603 | 603 |
604 | 604 |
605 // ---------------------------------------------------------------------------- | 605 // ---------------------------------------------------------------------------- |
606 // Sampler | 606 // Sampler |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 Atomic32 active_; | 688 Atomic32 active_; |
689 PlatformData* data_; // Platform specific data. | 689 PlatformData* data_; // Platform specific data. |
690 int samples_taken_; // Counts stack samples taken. | 690 int samples_taken_; // Counts stack samples taken. |
691 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 691 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
692 }; | 692 }; |
693 | 693 |
694 | 694 |
695 } } // namespace v8::internal | 695 } } // namespace v8::internal |
696 | 696 |
697 #endif // V8_PLATFORM_H_ | 697 #endif // V8_PLATFORM_H_ |
OLD | NEW |