1 // Copyright 2006-2008 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 41 namespace v8 { 42 namespace internal { 43 44 // Give V8 the opportunity to override the default ceil behaviour. 45 double ceiling(double x) { 46 UNIMPLEMENTED(); 47 return 0; 48 } 49 50 51 // Give V8 the opportunity to override the default fmod behavior. 52 double modulo(double x, double y) { 53 UNIMPLEMENTED(); 54 return 0; 55 } 56 57 58 // Initialize OS class early in the V8 startup. 59 void OS::Setup() { 60 // Seed the random number generator. 61 UNIMPLEMENTED(); 62 } 63 64 65 // Returns the accumulated user time for thread. 66 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { 67 UNIMPLEMENTED(); 68 *secs = 0; 69 *usecs = 0; 70 return 0; 71 } 72 73 74 // Returns current time as the number of milliseconds since 75 // 00:00:00 UTC, January 1, 1970. 76 double OS::TimeCurrentMillis() { 77 UNIMPLEMENTED(); 78 return 0; 79 } 80 81 82 // Returns ticks in microsecond resolution. 83 int64_t OS::Ticks() { 84 UNIMPLEMENTED(); 85 return 0; 86 } 87 88 89 // Returns a string identifying the current timezone taking into 90 // account daylight saving. 91 const char* OS::LocalTimezone(double time) { 92 UNIMPLEMENTED(); 93 return "<none>"; 94 } 95 96 97 // Returns the daylight savings offset in milliseconds for the given time. 98 double OS::DaylightSavingsOffset(double time) { 99 UNIMPLEMENTED(); 100 return 0; 101 } 102 103 104 int OS::GetLastError() { 105 UNIMPLEMENTED(); 106 return 0; 107 } 108 109 110 // Returns the local time offset in milliseconds east of UTC without 111 // taking daylight savings time into account. 112 double OS::LocalTimeOffset() { 113 UNIMPLEMENTED(); 114 return 0; 115 } 116 117 118 // Print (debug) message to console. 119 void OS::Print(const char* format, ...) { 120 UNIMPLEMENTED(); 121 } 122 123 124 // Print (debug) message to console. 125 void OS::VPrint(const char* format, va_list args) { 126 // Minimalistic implementation for bootstrapping. 127 vfprintf(stdout, format, args); 128 } 129 130 131 void OS::FPrint(FILE* out, const char* format, ...) { 132 va_list args; 133 va_start(args, format); 134 VFPrint(out, format, args); 135 va_end(args); 136 } 137 138 139 void OS::VFPrint(FILE* out, const char* format, va_list args) { 140 vfprintf(out, format, args); 141 } 142 143 144 // Print error message to console. 145 void OS::PrintError(const char* format, ...) { 146 // Minimalistic implementation for bootstrapping. 147 va_list args; 148 va_start(args, format); 149 VPrintError(format, args); 150 va_end(args); 151 } 152 153 154 // Print error message to console. 155 void OS::VPrintError(const char* format, va_list args) { 156 // Minimalistic implementation for bootstrapping. 157 vfprintf(stderr, format, args); 158 } 159 160 161 int OS::SNPrintF(char* str, size_t size, const char* format, ...) { 162 UNIMPLEMENTED(); 163 return 0; 164 } 165 166 167 int OS::VSNPrintF(char* str, size_t size, const char* format, va_list args) { 168 UNIMPLEMENTED(); 169 return 0; 170 } 171 172 173 uint64_t OS::CpuFeaturesImpliedByPlatform() { 174 return 0; 175 } 176 177 178 double OS::nan_value() { 179 UNIMPLEMENTED(); 180 return 0; 181 } 182 183 184 bool OS::ArmCpuHasFeature(CpuFeature feature) { 185 UNIMPLEMENTED(); 186 } 187 188 189 bool OS::IsOutsideAllocatedSpace(void* address) { 190 UNIMPLEMENTED(); 191 return false; 192 } 193 194 195 size_t OS::AllocateAlignment() { 196 UNIMPLEMENTED(); 197 return 0; 198 } 199 200 201 void* OS::Allocate(const size_t requested, 202 size_t* allocated, 203 bool executable) { 204 UNIMPLEMENTED(); 205 return NULL; 206 } 207 208 209 void OS::Free(void* buf, const size_t length) { 210 // TODO(1240712): potential system call return value which is ignored here. 211 UNIMPLEMENTED(); 212 } 213 214 215 #ifdef ENABLE_HEAP_PROTECTION 216 217 void OS::Protect(void* address, size_t size) { 218 UNIMPLEMENTED(); 219 } 220 221 222 void OS::Unprotect(void* address, size_t size, bool is_executable) { 223 UNIMPLEMENTED(); 224 } 225 226 #endif 227 228 229 void OS::Sleep(int milliseconds) { 230 UNIMPLEMENTED(); 231 } 232 233 234 void OS::Abort() { 235 // Minimalistic implementation for bootstrapping. 236 abort(); 237 } 238 239 240 void OS::DebugBreak() { 241 UNIMPLEMENTED(); 242 } 243 244 245 OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) { 246 UNIMPLEMENTED(); 247 return NULL; 248 } 249 250 251 OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size, 252 void* initial) { 253 UNIMPLEMENTED(); 254 return NULL; 255 } 256 257 258 void OS::LogSharedLibraryAddresses() { 259 UNIMPLEMENTED(); 260 } 261 262 263 void OS::SignalCodeMovingGC() { 264 UNIMPLEMENTED(); 265 } 266 267 268 int OS::StackWalk(Vector<OS::StackFrame> frames) { 269 UNIMPLEMENTED(); 270 return 0; 271 } 272 273 274 VirtualMemory::VirtualMemory(size_t size, void* address_hint) { 275 UNIMPLEMENTED(); 276 } 277 278 279 VirtualMemory::~VirtualMemory() { 280 UNIMPLEMENTED(); 281 } 282 283 284 bool VirtualMemory::IsReserved() { 285 UNIMPLEMENTED(); 286 return false; 287 } 288 289 290 bool VirtualMemory::Commit(void* address, size_t size, bool executable) { 291 UNIMPLEMENTED(); 292 return false; 293 } 294 295 296 bool VirtualMemory::Uncommit(void* address, size_t size) { 297 UNIMPLEMENTED(); 298 return false; 299 } 300 301 302 class Thread::PlatformData : public Malloced { 303 public: 304 PlatformData() { 305 UNIMPLEMENTED(); 306 } 307 308 void* pd_data_; 309 }; 310 311 312 Thread::Thread(Isolate* isolate, const Options& options) 313 : data_(new PlatformData()), 314 isolate_(isolate), 315 stack_size_(options.stack_size) { 316 set_name(options.name); 317 UNIMPLEMENTED(); 318 } 319 320 321 Thread::Thread(Isolate* isolate, const char* name) 322 : data_(new PlatformData()), 323 isolate_(isolate), 324 stack_size_(0) { 325 set_name(name); 326 UNIMPLEMENTED(); 327 } 328 329 330 Thread::~Thread() { 331 delete data_; 332 UNIMPLEMENTED(); 333 } 334 335 336 void Thread::set_name(const char* name) { 337 strncpy(name_, name, sizeof(name_)); 338 name_[sizeof(name_) - 1] = '\0'; 339 } 340 341 342 void Thread::Start() { 343 UNIMPLEMENTED(); 344 } 345 346 347 void Thread::Join() { 348 UNIMPLEMENTED(); 349 } 350 351 352 Thread::LocalStorageKey Thread::CreateThreadLocalKey() { 353 UNIMPLEMENTED(); 354 return static_cast<LocalStorageKey>(0); 355 } 356 357 358 void Thread::DeleteThreadLocalKey(LocalStorageKey key) { 359 UNIMPLEMENTED(); 360 } 361 362 363 void* Thread::GetThreadLocal(LocalStorageKey key) { 364 UNIMPLEMENTED(); 365 return NULL; 366 } 367 368 369 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { 370 UNIMPLEMENTED(); 371 } 372 373 374 void Thread::YieldCPU() { 375 UNIMPLEMENTED(); 376 } 377 378 379 class NullMutex : public Mutex { 380 public: 381 NullMutex() : data_(NULL) { 382 UNIMPLEMENTED(); 383 } 384 385 virtual ~NullMutex() { 386 UNIMPLEMENTED(); 387 } 388 389 virtual int Lock() { 390 UNIMPLEMENTED(); 391 return 0; 392 } 393 394 virtual int Unlock() { 395 UNIMPLEMENTED(); 396 return 0; 397 } 398 399 private: 400 void* data_; 401 }; 402 403 404 Mutex* OS::CreateMutex() { 405 UNIMPLEMENTED(); 406 return new NullMutex(); 407 } 408 409 410 class NullSemaphore : public Semaphore { 411 public: 412 explicit NullSemaphore(int count) : data_(NULL) { 413 UNIMPLEMENTED(); 414 } 415 416 virtual ~NullSemaphore() { 417 UNIMPLEMENTED(); 418 } 419 420 virtual void Wait() { 421 UNIMPLEMENTED(); 422 } 423 424 virtual void Signal() { 425 UNIMPLEMENTED(); 426 } 427 private: 428 void* data_; 429 }; 430 431 432 Semaphore* OS::CreateSemaphore(int count) { 433 UNIMPLEMENTED(); 434 return new NullSemaphore(count); 435 } 436 437 #ifdef ENABLE_LOGGING_AND_PROFILING 438 439 class ProfileSampler::PlatformData : public Malloced { 440 public: 441 PlatformData() { 442 UNIMPLEMENTED(); 443 } 444 }; 445 446 447 ProfileSampler::ProfileSampler(int interval) { 448 UNIMPLEMENTED(); 449 // Shared setup follows. 450 data_ = new PlatformData(); 451 interval_ = interval; 452 active_ = false; 453 } 454 455 456 ProfileSampler::~ProfileSampler() { 457 UNIMPLEMENTED(); 458 // Shared tear down follows. 459 delete data_; 460 } 461 462 463 void ProfileSampler::Start() { 464 UNIMPLEMENTED(); 465 } 466 467 468 void ProfileSampler::Stop() { 469 UNIMPLEMENTED(); 470 } 471 472 #endif // ENABLE_LOGGING_AND_PROFILING 473 474 } } // namespace v8::internal 475