1// Copyright 2012 the V8 project authors. All rights reserved. 2// Redistribution and use in source and binary forms, with or without 3// modification, are permitted provided that the following conditions are 4// met: 5// 6// * Redistributions of source code must retain the above copyright 7// notice, this list of conditions and the following disclaimer. 8// * Redistributions in binary form must reproduce the above 9// copyright notice, this list of conditions and the following 10// disclaimer in the documentation and/or other materials provided 11// with the distribution. 12// * Neither the name of Google Inc. nor the names of its 13// contributors may be used to endorse or promote products derived 14// from this software without specific prior written permission. 15// 16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 28// Platform specific code for NULLOS goes here 29 30// Minimal include to get access to abort, fprintf and friends for bootstrapping 31// messages. 32#include <stdio.h> 33#include <stdlib.h> 34 35#include "v8.h" 36 37#include "platform.h" 38#include "vm-state-inl.h" 39 40 41namespace v8 { 42namespace internal { 43 44// Give V8 the opportunity to override the default ceil behaviour. 45double ceiling(double x) { 46 UNIMPLEMENTED(); 47 return 0; 48} 49 50 51// Give V8 the opportunity to override the default fmod behavior. 52double modulo(double x, double y) { 53 UNIMPLEMENTED(); 54 return 0; 55} 56 57 58double fast_sin(double x) { 59 UNIMPLEMENTED(); 60 return 0; 61} 62 63 64double fast_cos(double x) { 65 UNIMPLEMENTED(); 66 return 0; 67} 68 69 70double fast_tan(double x) { 71 UNIMPLEMENTED(); 72 return 0; 73} 74 75 76double fast_log(double x) { 77 UNIMPLEMENTED(); 78 return 0; 79} 80 81 82// Initialize OS class early in the V8 startup. 83void OS::SetUp() { 84 // Seed the random number generator. 85 UNIMPLEMENTED(); 86} 87 88 89void OS::PostSetUp() { 90 UNIMPLEMENTED(); 91} 92 93 94void OS::TearDown() { 95 UNIMPLEMENTED(); 96} 97 98 99// Returns the accumulated user time for thread. 100int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { 101 UNIMPLEMENTED(); 102 *secs = 0; 103 *usecs = 0; 104 return 0; 105} 106 107 108// Returns current time as the number of milliseconds since 109// 00:00:00 UTC, January 1, 1970. 110double OS::TimeCurrentMillis() { 111 UNIMPLEMENTED(); 112 return 0; 113} 114 115 116// Returns ticks in microsecond resolution. 117int64_t OS::Ticks() { 118 UNIMPLEMENTED(); 119 return 0; 120} 121 122 123// Returns a string identifying the current timezone taking into 124// account daylight saving. 125const char* OS::LocalTimezone(double time) { 126 UNIMPLEMENTED(); 127 return "<none>"; 128} 129 130 131// Returns the daylight savings offset in milliseconds for the given time. 132double OS::DaylightSavingsOffset(double time) { 133 UNIMPLEMENTED(); 134 return 0; 135} 136 137 138int OS::GetLastError() { 139 UNIMPLEMENTED(); 140 return 0; 141} 142 143 144// Returns the local time offset in milliseconds east of UTC without 145// taking daylight savings time into account. 146double OS::LocalTimeOffset() { 147 UNIMPLEMENTED(); 148 return 0; 149} 150 151 152// Print (debug) message to console. 153void OS::Print(const char* format, ...) { 154 UNIMPLEMENTED(); 155} 156 157 158// Print (debug) message to console. 159void OS::VPrint(const char* format, va_list args) { 160 // Minimalistic implementation for bootstrapping. 161 vfprintf(stdout, format, args); 162} 163 164 165void OS::FPrint(FILE* out, const char* format, ...) { 166 va_list args; 167 va_start(args, format); 168 VFPrint(out, format, args); 169 va_end(args); 170} 171 172 173void OS::VFPrint(FILE* out, const char* format, va_list args) { 174 vfprintf(out, format, args); 175} 176 177 178// Print error message to console. 179void OS::PrintError(const char* format, ...) { 180 // Minimalistic implementation for bootstrapping. 181 va_list args; 182 va_start(args, format); 183 VPrintError(format, args); 184 va_end(args); 185} 186 187 188// Print error message to console. 189void OS::VPrintError(const char* format, va_list args) { 190 // Minimalistic implementation for bootstrapping. 191 vfprintf(stderr, format, args); 192} 193 194 195int OS::SNPrintF(char* str, size_t size, const char* format, ...) { 196 UNIMPLEMENTED(); 197 return 0; 198} 199 200 201int OS::VSNPrintF(char* str, size_t size, const char* format, va_list args) { 202 UNIMPLEMENTED(); 203 return 0; 204} 205 206 207uint64_t OS::CpuFeaturesImpliedByPlatform() { 208 return 0; 209} 210 211 212double OS::nan_value() { 213 UNIMPLEMENTED(); 214 return 0; 215} 216 217 218CpuImplementer OS::GetCpuImplementer() { 219 UNIMPLEMENTED(); 220} 221 222 223CpuPart OS::GetCpuPart(CpuImplementer implementer) { 224 UNIMPLEMENTED(); 225} 226 227 228bool OS::ArmCpuHasFeature(CpuFeature feature) { 229 UNIMPLEMENTED(); 230} 231 232 233bool OS::ArmUsingHardFloat() { 234 UNIMPLEMENTED(); 235} 236 237 238bool OS::IsOutsideAllocatedSpace(void* address) { 239 UNIMPLEMENTED(); 240 return false; 241} 242 243 244size_t OS::AllocateAlignment() { 245 UNIMPLEMENTED(); 246 return 0; 247} 248 249 250void* OS::Allocate(const size_t requested, 251 size_t* allocated, 252 bool executable) { 253 UNIMPLEMENTED(); 254 return NULL; 255} 256 257 258void OS::Free(void* buf, const size_t length) { 259 // TODO(1240712): potential system call return value which is ignored here. 260 UNIMPLEMENTED(); 261} 262 263 264void OS::Guard(void* address, const size_t size) { 265 UNIMPLEMENTED(); 266} 267 268 269void OS::Sleep(int milliseconds) { 270 UNIMPLEMENTED(); 271} 272 273 274int OS::NumberOfCores() { 275 UNIMPLEMENTED(); 276 return 0; 277} 278 279 280void OS::Abort() { 281 // Minimalistic implementation for bootstrapping. 282 abort(); 283} 284 285 286void OS::DebugBreak() { 287 UNIMPLEMENTED(); 288} 289 290 291void OS::DumpBacktrace() { 292 // Currently unsupported. 293} 294 295 296OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) { 297 UNIMPLEMENTED(); 298 return NULL; 299} 300 301 302OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size, 303 void* initial) { 304 UNIMPLEMENTED(); 305 return NULL; 306} 307 308 309void OS::LogSharedLibraryAddresses() { 310 UNIMPLEMENTED(); 311} 312 313 314void OS::SignalCodeMovingGC() { 315 UNIMPLEMENTED(); 316} 317 318 319int OS::StackWalk(Vector<OS::StackFrame> frames) { 320 UNIMPLEMENTED(); 321 return 0; 322} 323 324 325VirtualMemory::VirtualMemory() { 326 UNIMPLEMENTED(); 327} 328 329 330VirtualMemory::VirtualMemory(size_t size) { 331 UNIMPLEMENTED(); 332} 333 334 335VirtualMemory::VirtualMemory(size_t size, void* address_hint) { 336 UNIMPLEMENTED(); 337} 338 339 340VirtualMemory::~VirtualMemory() { 341 UNIMPLEMENTED(); 342} 343 344 345bool VirtualMemory::IsReserved() { 346 UNIMPLEMENTED(); 347 return false; 348} 349 350 351void VirtualMemory::Reset() { 352 UNIMPLEMENTED(); 353} 354 355 356bool VirtualMemory::Commit(void* address, size_t size, bool executable) { 357 UNIMPLEMENTED(); 358 return false; 359} 360 361 362bool VirtualMemory::Uncommit(void* address, size_t size) { 363 UNIMPLEMENTED(); 364 return false; 365} 366 367 368bool VirtualMemory::Guard(void* address) { 369 UNIMPLEMENTED(); 370 return false; 371} 372 373 374void* VirtualMemory::ReserveRegion(size_t size) { 375 UNIMPLEMENTED(); 376 return NULL; 377} 378 379 380bool VirtualMemory::CommitRegion(void* base, size_t size, bool is_executable) { 381 UNIMPLEMENTED(); 382 return false; 383} 384 385 386bool VirtualMemory::UncommitRegion(void* base, size_t size) { 387 UNIMPLEMENTED(); 388 return false; 389} 390 391 392bool VirtualMemory::ReleaseRegion(void* base, size_t size) { 393 UNIMPLEMENTED(); 394 return false; 395} 396 397 398bool VirtualMemory::HasLazyCommits() { 399 // TODO(alph): implement for the platform. 400 return false; 401} 402 403 404class Thread::PlatformData : public Malloced { 405 public: 406 PlatformData() { 407 UNIMPLEMENTED(); 408 } 409 410 void* pd_data_; 411}; 412 413 414Thread::Thread(const Options& options) 415 : data_(new PlatformData()), 416 stack_size_(options.stack_size), 417 start_semaphore_(NULL) { 418 set_name(options.name); 419 UNIMPLEMENTED(); 420} 421 422 423Thread::Thread(const char* name) 424 : data_(new PlatformData()), 425 stack_size_(0) { 426 set_name(name); 427 UNIMPLEMENTED(); 428} 429 430 431Thread::~Thread() { 432 delete data_; 433 UNIMPLEMENTED(); 434} 435 436 437void Thread::set_name(const char* name) { 438 strncpy(name_, name, sizeof(name_)); 439 name_[sizeof(name_) - 1] = '\0'; 440} 441 442 443void Thread::Start() { 444 UNIMPLEMENTED(); 445} 446 447 448void Thread::Join() { 449 UNIMPLEMENTED(); 450} 451 452 453Thread::LocalStorageKey Thread::CreateThreadLocalKey() { 454 UNIMPLEMENTED(); 455 return static_cast<LocalStorageKey>(0); 456} 457 458 459void Thread::DeleteThreadLocalKey(LocalStorageKey key) { 460 UNIMPLEMENTED(); 461} 462 463 464void* Thread::GetThreadLocal(LocalStorageKey key) { 465 UNIMPLEMENTED(); 466 return NULL; 467} 468 469 470void Thread::SetThreadLocal(LocalStorageKey key, void* value) { 471 UNIMPLEMENTED(); 472} 473 474 475void Thread::YieldCPU() { 476 UNIMPLEMENTED(); 477} 478 479 480class NullMutex : public Mutex { 481 public: 482 NullMutex() : data_(NULL) { 483 UNIMPLEMENTED(); 484 } 485 486 virtual ~NullMutex() { 487 UNIMPLEMENTED(); 488 } 489 490 virtual int Lock() { 491 UNIMPLEMENTED(); 492 return 0; 493 } 494 495 virtual int Unlock() { 496 UNIMPLEMENTED(); 497 return 0; 498 } 499 500 private: 501 void* data_; 502}; 503 504 505Mutex* OS::CreateMutex() { 506 UNIMPLEMENTED(); 507 return new NullMutex(); 508} 509 510 511class NullSemaphore : public Semaphore { 512 public: 513 explicit NullSemaphore(int count) : data_(NULL) { 514 UNIMPLEMENTED(); 515 } 516 517 virtual ~NullSemaphore() { 518 UNIMPLEMENTED(); 519 } 520 521 virtual void Wait() { 522 UNIMPLEMENTED(); 523 } 524 525 virtual void Signal() { 526 UNIMPLEMENTED(); 527 } 528 private: 529 void* data_; 530}; 531 532 533Semaphore* OS::CreateSemaphore(int count) { 534 UNIMPLEMENTED(); 535 return new NullSemaphore(count); 536} 537 538 539class ProfileSampler::PlatformData : public Malloced { 540 public: 541 PlatformData() { 542 UNIMPLEMENTED(); 543 } 544}; 545 546 547ProfileSampler::ProfileSampler(int interval) { 548 UNIMPLEMENTED(); 549 // Shared setup follows. 550 data_ = new PlatformData(); 551 interval_ = interval; 552 active_ = false; 553} 554 555 556ProfileSampler::~ProfileSampler() { 557 UNIMPLEMENTED(); 558 // Shared tear down follows. 559 delete data_; 560} 561 562 563void ProfileSampler::Start() { 564 UNIMPLEMENTED(); 565} 566 567 568void ProfileSampler::Stop() { 569 UNIMPLEMENTED(); 570} 571 572 573} } // namespace v8::internal 574