~ubuntu-branches/ubuntu/saucy/libv8/saucy

« back to all changes in this revision

Viewing changes to src/platform-macos.cc

  • Committer: Package Import Robot
  • Author(s): Jérémy Lal
  • Date: 2012-04-07 16:26:13 UTC
  • mfrom: (15.1.27 sid)
  • Revision ID: package-import@ubuntu.com-20120407162613-dqo1m6w9r3fh8tst
Tags: 3.8.9.16-3
* mipsel build fixes :
  + v8_use_mips_abi_hardfloat=false, this lowers EABI requirements.
  + v8_can_use_fpu_instructions=false, detect if FPU is present.
  + set -Wno-unused-but-set-variable only on mipsel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright 2011 the V8 project authors. All rights reserved.
 
1
// Copyright 2012 the V8 project authors. All rights reserved.
2
2
// Redistribution and use in source and binary forms, with or without
3
3
// modification, are permitted provided that the following conditions are
4
4
// met:
75
75
namespace v8 {
76
76
namespace internal {
77
77
 
78
 
// 0 is never a valid thread id on MacOSX since a ptread_t is
 
78
// 0 is never a valid thread id on MacOSX since a pthread_t is
79
79
// a pointer.
80
80
static const pthread_t kNoThread = (pthread_t) 0;
81
81
 
93
93
static Mutex* limit_mutex = NULL;
94
94
 
95
95
 
96
 
void OS::Setup() {
 
96
void OS::SetUp() {
97
97
  // Seed the random number generator. We preserve microsecond resolution.
98
98
  uint64_t seed = Ticks() ^ (getpid() << 16);
99
99
  srandom(static_cast<unsigned int>(seed));
103
103
 
104
104
// We keep the lowest and highest addresses mapped as a quick way of
105
105
// determining that pointers are outside the heap (used mostly in assertions
106
 
// and verification).  The estimate is conservative, ie, not all addresses in
 
106
// and verification).  The estimate is conservative, i.e., not all addresses in
107
107
// 'allocated' space are actually allocated to our heap.  The range is
108
108
// [lowest, highest), inclusive on the low and and exclusive on the high end.
109
109
static void* lowest_ever_allocated = reinterpret_cast<void*>(-1);
429
429
}
430
430
 
431
431
 
 
432
bool VirtualMemory::Guard(void* address) {
 
433
  OS::Guard(address, OS::CommitPageSize());
 
434
  return true;
 
435
}
 
436
 
 
437
 
432
438
bool VirtualMemory::CommitRegion(void* address,
433
439
                                 size_t size,
434
440
                                 bool is_executable) {
473
479
  pthread_t thread_;  // Thread handle for pthread.
474
480
};
475
481
 
 
482
 
476
483
Thread::Thread(const Options& options)
477
484
    : data_(new PlatformData),
478
 
      stack_size_(options.stack_size) {
479
 
  set_name(options.name);
480
 
}
481
 
 
482
 
 
483
 
Thread::Thread(const char* name)
484
 
    : data_(new PlatformData),
485
 
      stack_size_(0) {
486
 
  set_name(name);
 
485
      stack_size_(options.stack_size()) {
 
486
  set_name(options.name());
487
487
}
488
488
 
489
489
 
736
736
  thread_act_t profiled_thread_;
737
737
};
738
738
 
 
739
 
739
740
class SamplerThread : public Thread {
740
741
 public:
 
742
  static const int kSamplerThreadStackSize = 32 * KB;
 
743
 
741
744
  explicit SamplerThread(int interval)
742
 
      : Thread("SamplerThread"),
 
745
      : Thread(Thread::Options("SamplerThread", kSamplerThreadStackSize)),
743
746
        interval_(interval) {}
744
747
 
745
748
  static void AddActiveSampler(Sampler* sampler) {
854
857
  static Mutex* mutex_;
855
858
  static SamplerThread* instance_;
856
859
 
 
860
 private:
857
861
  DISALLOW_COPY_AND_ASSIGN(SamplerThread);
858
862
};
859
863