| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 static void SignalCodeMovingGC(); | 281 static void SignalCodeMovingGC(); |
| 282 | 282 |
| 283 // The return value indicates the CPU features we are sure of because of the | 283 // The return value indicates the CPU features we are sure of because of the |
| 284 // OS. For example MacOSX doesn't run on any x86 CPUs that don't have SSE2 | 284 // OS. For example MacOSX doesn't run on any x86 CPUs that don't have SSE2 |
| 285 // instructions. | 285 // instructions. |
| 286 // This is a little messy because the interpretation is subject to the cross | 286 // This is a little messy because the interpretation is subject to the cross |
| 287 // of the CPU and the OS. The bits in the answer correspond to the bit | 287 // of the CPU and the OS. The bits in the answer correspond to the bit |
| 288 // positions indicated by the members of the CpuFeature enum from globals.h | 288 // positions indicated by the members of the CpuFeature enum from globals.h |
| 289 static uint64_t CpuFeaturesImpliedByPlatform(); | 289 static uint64_t CpuFeaturesImpliedByPlatform(); |
| 290 | 290 |
| 291 // Maximum size of the virtual memory. 0 means there is no artificial |
| 292 // limit. |
| 293 static intptr_t MaxVirtualMemory(); |
| 294 |
| 291 // Returns the double constant NAN | 295 // Returns the double constant NAN |
| 292 static double nan_value(); | 296 static double nan_value(); |
| 293 | 297 |
| 294 // Support runtime detection of VFP3 on ARM CPUs. | 298 // Support runtime detection of VFP3 on ARM CPUs. |
| 295 static bool ArmCpuHasFeature(CpuFeature feature); | 299 static bool ArmCpuHasFeature(CpuFeature feature); |
| 296 | 300 |
| 297 // Support runtime detection of whether the hard float option of the | 301 // Support runtime detection of whether the hard float option of the |
| 298 // EABI is used. | 302 // EABI is used. |
| 299 static bool ArmUsingHardFloat(); | 303 static bool ArmUsingHardFloat(); |
| 300 | 304 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 LOCAL_STORAGE_KEY_MAX_VALUE = kMaxInt | 390 LOCAL_STORAGE_KEY_MAX_VALUE = kMaxInt |
| 387 }; | 391 }; |
| 388 | 392 |
| 389 struct Options { | 393 struct Options { |
| 390 Options() : name("v8:<unknown>"), stack_size(0) {} | 394 Options() : name("v8:<unknown>"), stack_size(0) {} |
| 391 | 395 |
| 392 const char* name; | 396 const char* name; |
| 393 int stack_size; | 397 int stack_size; |
| 394 }; | 398 }; |
| 395 | 399 |
| 396 // Create new thread (with a value for storing in the TLS isolate field). | 400 // Create new thread. |
| 397 Thread(Isolate* isolate, const Options& options); | 401 explicit Thread(const Options& options); |
| 398 Thread(Isolate* isolate, const char* name); | 402 explicit Thread(const char* name); |
| 399 virtual ~Thread(); | 403 virtual ~Thread(); |
| 400 | 404 |
| 401 // Start new thread by calling the Run() method in the new thread. | 405 // Start new thread by calling the Run() method in the new thread. |
| 402 void Start(); | 406 void Start(); |
| 403 | 407 |
| 404 // Wait until thread terminates. | 408 // Wait until thread terminates. |
| 405 void Join(); | 409 void Join(); |
| 406 | 410 |
| 407 inline const char* name() const { | 411 inline const char* name() const { |
| 408 return name_; | 412 return name_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 435 } | 439 } |
| 436 #else | 440 #else |
| 437 static inline void* GetExistingThreadLocal(LocalStorageKey key) { | 441 static inline void* GetExistingThreadLocal(LocalStorageKey key) { |
| 438 return GetThreadLocal(key); | 442 return GetThreadLocal(key); |
| 439 } | 443 } |
| 440 #endif | 444 #endif |
| 441 | 445 |
| 442 // A hint to the scheduler to let another thread run. | 446 // A hint to the scheduler to let another thread run. |
| 443 static void YieldCPU(); | 447 static void YieldCPU(); |
| 444 | 448 |
| 445 Isolate* isolate() const { return isolate_; } | |
| 446 | 449 |
| 447 // The thread name length is limited to 16 based on Linux's implementation of | 450 // The thread name length is limited to 16 based on Linux's implementation of |
| 448 // prctl(). | 451 // prctl(). |
| 449 static const int kMaxThreadNameLength = 16; | 452 static const int kMaxThreadNameLength = 16; |
| 450 | 453 |
| 451 class PlatformData; | 454 class PlatformData; |
| 452 PlatformData* data() { return data_; } | 455 PlatformData* data() { return data_; } |
| 453 | 456 |
| 454 private: | 457 private: |
| 455 void set_name(const char *name); | 458 void set_name(const char *name); |
| 456 | 459 |
| 457 PlatformData* data_; | 460 PlatformData* data_; |
| 458 | 461 |
| 459 Isolate* isolate_; | |
| 460 char name_[kMaxThreadNameLength]; | 462 char name_[kMaxThreadNameLength]; |
| 461 int stack_size_; | 463 int stack_size_; |
| 462 | 464 |
| 463 DISALLOW_COPY_AND_ASSIGN(Thread); | 465 DISALLOW_COPY_AND_ASSIGN(Thread); |
| 464 }; | 466 }; |
| 465 | 467 |
| 466 | 468 |
| 467 // ---------------------------------------------------------------------------- | 469 // ---------------------------------------------------------------------------- |
| 468 // Mutex | 470 // Mutex |
| 469 // | 471 // |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 int samples_taken_; // Counts stack samples taken. | 669 int samples_taken_; // Counts stack samples taken. |
| 668 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 670 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
| 669 }; | 671 }; |
| 670 | 672 |
| 671 | 673 |
| 672 #endif // ENABLE_LOGGING_AND_PROFILING | 674 #endif // ENABLE_LOGGING_AND_PROFILING |
| 673 | 675 |
| 674 } } // namespace v8::internal | 676 } } // namespace v8::internal |
| 675 | 677 |
| 676 #endif // V8_PLATFORM_H_ | 678 #endif // V8_PLATFORM_H_ |
| OLD | NEW |