blob: 98cb23032a5dfd0b407f22c0e2cb853b8dd1ee44 [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
40namespace v8 { namespace internal {
41
42// Give V8 the opportunity to override the default ceil behaviour.
43double ceiling(double x) {
44 UNIMPLEMENTED();
45 return 0;
46}
47
48
49// Initialize OS class early in the V8 startup.
50void OS::Setup() {
51 // Seed the random number generator.
52 UNIMPLEMENTED();
53}
54
55
56// Returns the accumulated user time for thread.
57int 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.
67double OS::TimeCurrentMillis() {
68 UNIMPLEMENTED();
69 return 0;
70}
71
72
73// Returns ticks in microsecond resolution.
74int64_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.
82char* OS::LocalTimezone(double time) {
83 UNIMPLEMENTED();
84 return "<none>";
85}
86
87
88// Returns the daylight savings offset in milliseconds for the given time.
89double 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.
97double OS::LocalTimeOffset() {
98 UNIMPLEMENTED();
99 return 0;
100}
101
102
103// Print (debug) message to console.
104void OS::Print(const char* format, ...) {
105 UNIMPLEMENTED();
106}
107
108
109// Print (debug) message to console.
110void 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.
117void 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.
127void OS::VPrintError(const char* format, va_list args) {
128 // Minimalistic implementation for bootstrapping.
129 vfprintf(stderr, format, args);
130}
131
132
133int OS::SNPrintF(char* str, size_t size, const char* format, ...) {
134 UNIMPLEMENTED();
135 return 0;
136}
137
138
139int OS::VSNPrintF(char* str, size_t size, const char* format, va_list args) {
140 UNIMPLEMENTED();
141 return 0;
142}
143
144
145double OS::nan_value() {
146 UNIMPLEMENTED();
147 return 0;
148}
149
150bool OS::IsOutsideAllocatedSpace(void* address) {
151 UNIMPLEMENTED();
152 return false;
153}
154
155
156size_t OS::AllocateAlignment() {
157 UNIMPLEMENTED();
158 return 0;
159}
160
161
162void* OS::Allocate(const size_t requested,
163 size_t* allocated,
164 bool executable) {
165 UNIMPLEMENTED();
166 return NULL;
167}
168
169
170void 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
176void OS::Sleep(int milliseconds) {
177 UNIMPLEMENTED();
178}
179
180
181void OS::Abort() {
182 // Minimalistic implementation for bootstrapping.
183 abort();
184}
185
186
187void OS::DebugBreak() {
188 UNIMPLEMENTED();
189}
190
191
192OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size,
193 void* initial) {
194 UNIMPLEMENTED();
195 return NULL;
196}
197
198
199void OS::LogSharedLibraryAddresses() {
200 UNIMPLEMENTED();
201}
202
203
204int OS::StackWalk(OS::StackFrame* frames, int frames_size) {
205 UNIMPLEMENTED();
206 return 0;
207}
208
209
210VirtualMemory::VirtualMemory(size_t size, void* address_hint) {
211 UNIMPLEMENTED();
212}
213
214
215VirtualMemory::~VirtualMemory() {
216 UNIMPLEMENTED();
217}
218
219
220bool VirtualMemory::IsReserved() {
221 UNIMPLEMENTED();
222 return false;
223}
224
225
226bool VirtualMemory::Commit(void* address, size_t size, bool executable) {
227 UNIMPLEMENTED();
228 return false;
229}
230
231
232bool VirtualMemory::Uncommit(void* address, size_t size) {
233 UNIMPLEMENTED();
234 return false;
235}
236
237
238class ThreadHandle::PlatformData : public Malloced {
239 public:
240 explicit PlatformData(ThreadHandle::Kind kind) {
241 UNIMPLEMENTED();
242 }
243
244 void* pd_data_;
245};
246
247
248ThreadHandle::ThreadHandle(Kind kind) {
249 UNIMPLEMENTED();
250 // Shared setup follows.
251 data_ = new PlatformData(kind);
252}
253
254
255void ThreadHandle::Initialize(ThreadHandle::Kind kind) {
256 UNIMPLEMENTED();
257}
258
259
260ThreadHandle::~ThreadHandle() {
261 UNIMPLEMENTED();
262 // Shared tear down follows.
263 delete data_;
264}
265
266
267bool ThreadHandle::IsSelf() const {
268 UNIMPLEMENTED();
269 return false;
270}
271
272
273bool ThreadHandle::IsValid() const {
274 UNIMPLEMENTED();
275 return false;
276}
277
278
279Thread::Thread() : ThreadHandle(ThreadHandle::INVALID) {
280 UNIMPLEMENTED();
281}
282
283
284Thread::~Thread() {
285 UNIMPLEMENTED();
286}
287
288
289void Thread::Start() {
290 UNIMPLEMENTED();
291}
292
293
294void Thread::Join() {
295 UNIMPLEMENTED();
296}
297
298
299Thread::LocalStorageKey Thread::CreateThreadLocalKey() {
300 UNIMPLEMENTED();
301 return static_cast<LocalStorageKey>(0);
302}
303
304
305void Thread::DeleteThreadLocalKey(LocalStorageKey key) {
306 UNIMPLEMENTED();
307}
308
309
310void* Thread::GetThreadLocal(LocalStorageKey key) {
311 UNIMPLEMENTED();
312 return NULL;
313}
314
315
316void Thread::SetThreadLocal(LocalStorageKey key, void* value) {
317 UNIMPLEMENTED();
318}
319
320
321void Thread::YieldCPU() {
322 UNIMPLEMENTED();
323}
324
325
326class 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
351Mutex* OS::CreateMutex() {
352 UNIMPLEMENTED();
353 return new NullMutex();
354}
355
356
357class 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
379Semaphore* OS::CreateSemaphore(int count) {
380 UNIMPLEMENTED();
381 return new NullSemaphore(count);
382}
383
384#ifdef ENABLE_LOGGING_AND_PROFILING
385
386class ProfileSampler::PlatformData : public Malloced {
387 public:
388 PlatformData() {
389 UNIMPLEMENTED();
390 }
391};
392
393
394ProfileSampler::ProfileSampler(int interval) {
395 UNIMPLEMENTED();
396 // Shared setup follows.
397 data_ = new PlatformData();
398 interval_ = interval;
399 active_ = false;
400}
401
402
403ProfileSampler::~ProfileSampler() {
404 UNIMPLEMENTED();
405 // Shared tear down follows.
406 delete data_;
407}
408
409
410void ProfileSampler::Start() {
411 UNIMPLEMENTED();
412}
413
414
415void ProfileSampler::Stop() {
416 UNIMPLEMENTED();
417}
418
419#endif // ENABLE_LOGGING_AND_PROFILING
420
421} } // namespace v8::internal