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