platform-nullos.cc 8.4 KB
Newer Older
1
// Copyright 2006-2008 the V8 project authors. All rights reserved.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
//       notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
//       copyright notice, this list of conditions and the following
//       disclaimer in the documentation and/or other materials provided
//       with the distribution.
//     * Neither the name of Google Inc. nor the names of its
//       contributors may be used to endorse or promote products derived
//       from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// Platform specific code for NULLOS goes here

// Minimal include to get access to abort, fprintf and friends for bootstrapping
// messages.
#include <stdio.h>
#include <stdlib.h>

#include "v8.h"

#include "platform.h"


40 41
namespace v8 {
namespace internal {
42 43 44 45 46 47 48 49

// Give V8 the opportunity to override the default ceil behaviour.
double ceiling(double x) {
  UNIMPLEMENTED();
  return 0;
}


50 51 52 53 54 55 56
// Give V8 the opportunity to override the default fmod behavior.
double modulo(double x, double y) {
  UNIMPLEMENTED();
  return 0;
}


57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
// Initialize OS class early in the V8 startup.
void OS::Setup() {
  // Seed the random number generator.
  UNIMPLEMENTED();
}


// Returns the accumulated user time for thread.
int OS::GetUserTime(uint32_t* secs,  uint32_t* usecs) {
  UNIMPLEMENTED();
  *secs = 0;
  *usecs = 0;
  return 0;
}


// Returns current time as the number of milliseconds since
// 00:00:00 UTC, January 1, 1970.
double OS::TimeCurrentMillis() {
  UNIMPLEMENTED();
  return 0;
}


// Returns ticks in microsecond resolution.
int64_t OS::Ticks() {
  UNIMPLEMENTED();
  return 0;
}


// Returns a string identifying the current timezone taking into
// account daylight saving.
90
const char* OS::LocalTimezone(double time) {
91 92 93 94 95 96 97 98 99 100 101 102
  UNIMPLEMENTED();
  return "<none>";
}


// Returns the daylight savings offset in milliseconds for the given time.
double OS::DaylightSavingsOffset(double time) {
  UNIMPLEMENTED();
  return 0;
}


103 104 105 106 107 108
int OS::GetLastError() {
  UNIMPLEMENTED();
  return 0;
}


109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
// Returns the local time offset in milliseconds east of UTC without
// taking daylight savings time into account.
double OS::LocalTimeOffset() {
  UNIMPLEMENTED();
  return 0;
}


// Print (debug) message to console.
void OS::Print(const char* format, ...) {
  UNIMPLEMENTED();
}


// Print (debug) message to console.
void OS::VPrint(const char* format, va_list args) {
  // Minimalistic implementation for bootstrapping.
  vfprintf(stdout, format, args);
}


// Print error message to console.
void OS::PrintError(const char* format, ...) {
  // Minimalistic implementation for bootstrapping.
  va_list args;
  va_start(args, format);
  VPrintError(format, args);
  va_end(args);
}


// Print error message to console.
void OS::VPrintError(const char* format, va_list args) {
  // Minimalistic implementation for bootstrapping.
  vfprintf(stderr, format, args);
}


int OS::SNPrintF(char* str, size_t size, const char* format, ...) {
  UNIMPLEMENTED();
  return 0;
}


int OS::VSNPrintF(char* str, size_t size, const char* format, va_list args) {
  UNIMPLEMENTED();
  return 0;
}


159 160 161 162 163
uint64_t OS::CpuFeaturesImpliedByPlatform() {
  return 0;
}


164 165 166 167 168
double OS::nan_value() {
  UNIMPLEMENTED();
  return 0;
}

169

170
bool OS::ArmCpuHasFeature(CpuFeature feature) {
171 172 173 174
  UNIMPLEMENTED();
}


175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
bool OS::IsOutsideAllocatedSpace(void* address) {
  UNIMPLEMENTED();
  return false;
}


size_t OS::AllocateAlignment() {
  UNIMPLEMENTED();
  return 0;
}


void* OS::Allocate(const size_t requested,
                   size_t* allocated,
                   bool executable) {
  UNIMPLEMENTED();
  return NULL;
}


void OS::Free(void* buf, const size_t length) {
  // TODO(1240712): potential system call return value which is ignored here.
  UNIMPLEMENTED();
}


201 202 203 204 205 206 207 208 209 210 211 212 213 214
#ifdef ENABLE_HEAP_PROTECTION

void OS::Protect(void* address, size_t size) {
  UNIMPLEMENTED();
}


void OS::Unprotect(void* address, size_t size, bool is_executable) {
  UNIMPLEMENTED();
}

#endif


215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
void OS::Sleep(int milliseconds) {
  UNIMPLEMENTED();
}


void OS::Abort() {
  // Minimalistic implementation for bootstrapping.
  abort();
}


void OS::DebugBreak() {
  UNIMPLEMENTED();
}


OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size,
    void* initial) {
  UNIMPLEMENTED();
  return NULL;
}


void OS::LogSharedLibraryAddresses() {
  UNIMPLEMENTED();
}


243
int OS::StackWalk(Vector<OS::StackFrame> frames) {
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460
  UNIMPLEMENTED();
  return 0;
}


VirtualMemory::VirtualMemory(size_t size, void* address_hint) {
  UNIMPLEMENTED();
}


VirtualMemory::~VirtualMemory() {
  UNIMPLEMENTED();
}


bool VirtualMemory::IsReserved() {
  UNIMPLEMENTED();
  return false;
}


bool VirtualMemory::Commit(void* address, size_t size, bool executable) {
  UNIMPLEMENTED();
  return false;
}


bool VirtualMemory::Uncommit(void* address, size_t size) {
  UNIMPLEMENTED();
  return false;
}


class ThreadHandle::PlatformData : public Malloced {
 public:
  explicit PlatformData(ThreadHandle::Kind kind) {
    UNIMPLEMENTED();
  }

  void* pd_data_;
};


ThreadHandle::ThreadHandle(Kind kind) {
  UNIMPLEMENTED();
  // Shared setup follows.
  data_ = new PlatformData(kind);
}


void ThreadHandle::Initialize(ThreadHandle::Kind kind) {
  UNIMPLEMENTED();
}


ThreadHandle::~ThreadHandle() {
  UNIMPLEMENTED();
  // Shared tear down follows.
  delete data_;
}


bool ThreadHandle::IsSelf() const {
  UNIMPLEMENTED();
  return false;
}


bool ThreadHandle::IsValid() const {
  UNIMPLEMENTED();
  return false;
}


Thread::Thread() : ThreadHandle(ThreadHandle::INVALID) {
  UNIMPLEMENTED();
}


Thread::~Thread() {
  UNIMPLEMENTED();
}


void Thread::Start() {
  UNIMPLEMENTED();
}


void Thread::Join() {
  UNIMPLEMENTED();
}


Thread::LocalStorageKey Thread::CreateThreadLocalKey() {
  UNIMPLEMENTED();
  return static_cast<LocalStorageKey>(0);
}


void Thread::DeleteThreadLocalKey(LocalStorageKey key) {
  UNIMPLEMENTED();
}


void* Thread::GetThreadLocal(LocalStorageKey key) {
  UNIMPLEMENTED();
  return NULL;
}


void Thread::SetThreadLocal(LocalStorageKey key, void* value) {
  UNIMPLEMENTED();
}


void Thread::YieldCPU() {
  UNIMPLEMENTED();
}


class NullMutex : public Mutex {
 public:
  NullMutex() : data_(NULL) {
    UNIMPLEMENTED();
  }

  virtual ~NullMutex() {
    UNIMPLEMENTED();
  }

  virtual int Lock() {
    UNIMPLEMENTED();
    return 0;
  }

  virtual int Unlock() {
    UNIMPLEMENTED();
    return 0;
  }

 private:
  void* data_;
};


Mutex* OS::CreateMutex() {
  UNIMPLEMENTED();
  return new NullMutex();
}


class NullSemaphore : public Semaphore {
 public:
  explicit NullSemaphore(int count) : data_(NULL) {
    UNIMPLEMENTED();
  }

  virtual ~NullSemaphore() {
    UNIMPLEMENTED();
  }

  virtual void Wait() {
    UNIMPLEMENTED();
  }

  virtual void Signal() {
    UNIMPLEMENTED();
  }
 private:
  void* data_;
};


Semaphore* OS::CreateSemaphore(int count) {
  UNIMPLEMENTED();
  return new NullSemaphore(count);
}

#ifdef ENABLE_LOGGING_AND_PROFILING

class ProfileSampler::PlatformData  : public Malloced {
 public:
  PlatformData() {
    UNIMPLEMENTED();
  }
};


ProfileSampler::ProfileSampler(int interval) {
  UNIMPLEMENTED();
  // Shared setup follows.
  data_ = new PlatformData();
  interval_ = interval;
  active_ = false;
}


ProfileSampler::~ProfileSampler() {
  UNIMPLEMENTED();
  // Shared tear down follows.
  delete data_;
}


void ProfileSampler::Start() {
  UNIMPLEMENTED();
}


void ProfileSampler::Stop() {
  UNIMPLEMENTED();
}

#endif  // ENABLE_LOGGING_AND_PROFILING

} }  // namespace v8::internal