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