platform-nullos.cc 9.22 KB
Newer Older
1
// Copyright 2012 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
// 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"
38
#include "vm-state-inl.h"
39 40


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

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


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


58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
double fast_sin(double x) {
  UNIMPLEMENTED();
  return 0;
}


double fast_cos(double x) {
  UNIMPLEMENTED();
  return 0;
}


double fast_tan(double x) {
  UNIMPLEMENTED();
  return 0;
}


double fast_log(double x) {
  UNIMPLEMENTED();
  return 0;
}


82
// Initialize OS class early in the V8 startup.
83
void OS::SetUp() {
84 85 86 87 88
  // Seed the random number generator.
  UNIMPLEMENTED();
}


89 90 91 92 93
void OS::PostSetUp() {
  UNIMPLEMENTED();
}


94 95 96 97 98
void OS::TearDown() {
  UNIMPLEMENTED();
}


99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
// 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.
125
const char* OS::LocalTimezone(double time) {
126 127 128 129 130 131 132 133 134 135 136 137
  UNIMPLEMENTED();
  return "<none>";
}


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


138 139 140 141 142 143
int OS::GetLastError() {
  UNIMPLEMENTED();
  return 0;
}


144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
// 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);
162 163 164 165 166 167 168 169 170 171 172 173 174
}


void OS::FPrint(FILE* out, const char* format, ...) {
  va_list args;
  va_start(args, format);
  VFPrint(out, format, args);
  va_end(args);
}


void OS::VFPrint(FILE* out, const char* format, va_list args) {
  vfprintf(out, format, args);
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 201 202 203 204 205 206
}


// 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;
}


207 208 209 210 211
uint64_t OS::CpuFeaturesImpliedByPlatform() {
  return 0;
}


212 213 214 215 216
double OS::nan_value() {
  UNIMPLEMENTED();
  return 0;
}

217

218 219 220 221 222
CpuImplementer OS::GetCpuImplementer() {
  UNIMPLEMENTED();
}


223
bool OS::ArmCpuHasFeature(CpuFeature feature) {
224 225 226 227
  UNIMPLEMENTED();
}


228 229 230 231 232
bool OS::ArmUsingHardFloat() {
  UNIMPLEMENTED();
}


233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
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();
}


259 260 261 262 263
void OS::Guard(void* address, const size_t size) {
  UNIMPLEMENTED();
}


264 265 266 267 268
void OS::Sleep(int milliseconds) {
  UNIMPLEMENTED();
}


269 270 271 272 273 274
int OS::NumberOfCores() {
  UNIMPLEMENTED();
  return 0;
}


275 276 277 278 279 280 281 282 283 284 285
void OS::Abort() {
  // Minimalistic implementation for bootstrapping.
  abort();
}


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


286 287 288 289 290
void OS::DumpBacktrace() {
  // Currently unsupported.
}


291 292 293 294 295 296
OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) {
  UNIMPLEMENTED();
  return NULL;
}


297 298 299 300 301 302 303 304 305 306 307 308
OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size,
    void* initial) {
  UNIMPLEMENTED();
  return NULL;
}


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


309 310 311 312 313
void OS::SignalCodeMovingGC() {
  UNIMPLEMENTED();
}


314
int OS::StackWalk(Vector<OS::StackFrame> frames) {
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
  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;
}


348 349 350 351 352 353
bool VirtualMemory::Guard(void* address) {
  UNIMPLEMENTED();
  return false;
}


354 355 356 357 358 359
bool VirtualMemory::HasLazyCommits() {
  // TODO(alph): implement for the platform.
  return false;
}


360
class Thread::PlatformData : public Malloced {
361
 public:
362
  PlatformData() {
363 364 365 366 367 368 369
    UNIMPLEMENTED();
  }

  void* pd_data_;
};


370
Thread::Thread(const Options& options)
371
    : data_(new PlatformData()),
372 373
      stack_size_(options.stack_size) {
  set_name(options.name);
374 375 376 377
  UNIMPLEMENTED();
}


378
Thread::Thread(const char* name)
379
    : data_(new PlatformData()),
380
      stack_size_(0) {
381
  set_name(name);
382 383 384 385 386
  UNIMPLEMENTED();
}


Thread::~Thread() {
387
  delete data_;
388 389 390 391
  UNIMPLEMENTED();
}


392 393 394 395 396 397
void Thread::set_name(const char* name) {
  strncpy(name_, name, sizeof(name_));
  name_[sizeof(name_) - 1] = '\0';
}


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 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528
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);
}


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();
}


} }  // namespace v8::internal