blob: 8c2a8633d73f22bd3c7c6f963d434a27694e010e [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"
kasperl@chromium.orga5551262010-12-07 12:49:48 +000038#include "vm-state-inl.h"
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +000039
40
kasperl@chromium.org71affb52009-05-26 05:44:31 +000041namespace v8 {
42namespace internal {
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +000043
44// Give V8 the opportunity to override the default ceil behaviour.
45double ceiling(double x) {
46 UNIMPLEMENTED();
47 return 0;
48}
49
50
ager@chromium.org3811b432009-10-28 14:53:37 +000051// Give V8 the opportunity to override the default fmod behavior.
52double modulo(double x, double y) {
53 UNIMPLEMENTED();
54 return 0;
55}
56
57
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +000058// Initialize OS class early in the V8 startup.
59void OS::Setup() {
60 // Seed the random number generator.
61 UNIMPLEMENTED();
62}
63
64
65// Returns the accumulated user time for thread.
66int 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.
76double OS::TimeCurrentMillis() {
77 UNIMPLEMENTED();
78 return 0;
79}
80
81
82// Returns ticks in microsecond resolution.
83int64_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.
sgjesse@chromium.orgb9d7da12009-08-05 08:38:10 +000091const char* OS::LocalTimezone(double time) {
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +000092 UNIMPLEMENTED();
93 return "<none>";
94}
95
96
97// Returns the daylight savings offset in milliseconds for the given time.
98double OS::DaylightSavingsOffset(double time) {
99 UNIMPLEMENTED();
100 return 0;
101}
102
103
ager@chromium.orgea4f62e2010-08-16 16:28:43 +0000104int OS::GetLastError() {
105 UNIMPLEMENTED();
106 return 0;
107}
108
109
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000110// Returns the local time offset in milliseconds east of UTC without
111// taking daylight savings time into account.
112double OS::LocalTimeOffset() {
113 UNIMPLEMENTED();
114 return 0;
115}
116
117
118// Print (debug) message to console.
119void OS::Print(const char* format, ...) {
120 UNIMPLEMENTED();
121}
122
123
124// Print (debug) message to console.
125void OS::VPrint(const char* format, va_list args) {
126 // Minimalistic implementation for bootstrapping.
127 vfprintf(stdout, format, args);
128}
129
130
whesse@chromium.org023421e2010-12-21 12:19:12 +0000131void 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
139void OS::VFPrint(FILE* out, const char* format, va_list args) {
140 vfprintf(out, format, args);
141}
142
143
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000144// Print error message to console.
145void 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.
155void OS::VPrintError(const char* format, va_list args) {
156 // Minimalistic implementation for bootstrapping.
157 vfprintf(stderr, format, args);
158}
159
160
161int OS::SNPrintF(char* str, size_t size, const char* format, ...) {
162 UNIMPLEMENTED();
163 return 0;
164}
165
166
167int OS::VSNPrintF(char* str, size_t size, const char* format, va_list args) {
168 UNIMPLEMENTED();
169 return 0;
170}
171
172
ager@chromium.orgc4c92722009-11-18 14:12:51 +0000173uint64_t OS::CpuFeaturesImpliedByPlatform() {
174 return 0;
175}
176
177
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000178double OS::nan_value() {
179 UNIMPLEMENTED();
180 return 0;
181}
182
ager@chromium.orgc4c92722009-11-18 14:12:51 +0000183
184bool OS::ArmCpuHasFeature(CpuFeature feature) {
185 UNIMPLEMENTED();
186}
187
188
sgjesse@chromium.org8e8294a2011-05-02 14:30:53 +0000189bool OS::ArmUsingHardFloat() {
190 UNIMPLEMENTED();
191}
192
193
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000194bool OS::IsOutsideAllocatedSpace(void* address) {
195 UNIMPLEMENTED();
196 return false;
197}
198
199
200size_t OS::AllocateAlignment() {
201 UNIMPLEMENTED();
202 return 0;
203}
204
205
206void* OS::Allocate(const size_t requested,
207 size_t* allocated,
208 bool executable) {
209 UNIMPLEMENTED();
210 return NULL;
211}
212
213
214void OS::Free(void* buf, const size_t length) {
215 // TODO(1240712): potential system call return value which is ignored here.
216 UNIMPLEMENTED();
217}
218
219
rossberg@chromium.org717967f2011-07-20 13:44:42 +0000220void OS::Guard(void* address, const size_t size) {
221 UNIMPLEMENTED();
222}
223
224
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000225void OS::Sleep(int milliseconds) {
226 UNIMPLEMENTED();
227}
228
229
230void OS::Abort() {
231 // Minimalistic implementation for bootstrapping.
232 abort();
233}
234
235
236void OS::DebugBreak() {
237 UNIMPLEMENTED();
238}
239
240
vegorov@chromium.org0a4e9012011-01-24 12:33:13 +0000241OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) {
242 UNIMPLEMENTED();
243 return NULL;
244}
245
246
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000247OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size,
248 void* initial) {
249 UNIMPLEMENTED();
250 return NULL;
251}
252
253
254void OS::LogSharedLibraryAddresses() {
255 UNIMPLEMENTED();
256}
257
258
whesse@chromium.org4a5224e2010-10-20 12:37:07 +0000259void OS::SignalCodeMovingGC() {
260 UNIMPLEMENTED();
261}
262
263
ager@chromium.org65dad4b2009-04-23 08:48:43 +0000264int OS::StackWalk(Vector<OS::StackFrame> frames) {
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000265 UNIMPLEMENTED();
266 return 0;
267}
268
269
270VirtualMemory::VirtualMemory(size_t size, void* address_hint) {
271 UNIMPLEMENTED();
272}
273
274
275VirtualMemory::~VirtualMemory() {
276 UNIMPLEMENTED();
277}
278
279
280bool VirtualMemory::IsReserved() {
281 UNIMPLEMENTED();
282 return false;
283}
284
285
286bool VirtualMemory::Commit(void* address, size_t size, bool executable) {
287 UNIMPLEMENTED();
288 return false;
289}
290
291
292bool VirtualMemory::Uncommit(void* address, size_t size) {
293 UNIMPLEMENTED();
294 return false;
295}
296
297
ager@chromium.orga9aa5fa2011-04-13 08:46:07 +0000298class Thread::PlatformData : public Malloced {
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000299 public:
ager@chromium.orga9aa5fa2011-04-13 08:46:07 +0000300 PlatformData() {
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000301 UNIMPLEMENTED();
302 }
303
304 void* pd_data_;
305};
306
307
svenpanne@chromium.org6d786c92011-06-15 10:58:27 +0000308Thread::Thread(const Options& options)
ager@chromium.orga9aa5fa2011-04-13 08:46:07 +0000309 : data_(new PlatformData()),
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000310 stack_size_(options.stack_size) {
311 set_name(options.name);
lrn@chromium.org5d00b602011-01-05 09:51:43 +0000312 UNIMPLEMENTED();
313}
314
315
svenpanne@chromium.org6d786c92011-06-15 10:58:27 +0000316Thread::Thread(const char* name)
ager@chromium.orga9aa5fa2011-04-13 08:46:07 +0000317 : data_(new PlatformData()),
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000318 stack_size_(0) {
lrn@chromium.org5d00b602011-01-05 09:51:43 +0000319 set_name(name);
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000320 UNIMPLEMENTED();
321}
322
323
324Thread::~Thread() {
ager@chromium.orga9aa5fa2011-04-13 08:46:07 +0000325 delete data_;
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000326 UNIMPLEMENTED();
327}
328
329
lrn@chromium.org5d00b602011-01-05 09:51:43 +0000330void Thread::set_name(const char* name) {
331 strncpy(name_, name, sizeof(name_));
332 name_[sizeof(name_) - 1] = '\0';
333}
334
335
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000336void Thread::Start() {
337 UNIMPLEMENTED();
338}
339
340
341void Thread::Join() {
342 UNIMPLEMENTED();
343}
344
345
346Thread::LocalStorageKey Thread::CreateThreadLocalKey() {
347 UNIMPLEMENTED();
348 return static_cast<LocalStorageKey>(0);
349}
350
351
352void Thread::DeleteThreadLocalKey(LocalStorageKey key) {
353 UNIMPLEMENTED();
354}
355
356
357void* Thread::GetThreadLocal(LocalStorageKey key) {
358 UNIMPLEMENTED();
359 return NULL;
360}
361
362
363void Thread::SetThreadLocal(LocalStorageKey key, void* value) {
364 UNIMPLEMENTED();
365}
366
367
368void Thread::YieldCPU() {
369 UNIMPLEMENTED();
370}
371
372
373class NullMutex : public Mutex {
374 public:
375 NullMutex() : data_(NULL) {
376 UNIMPLEMENTED();
377 }
378
379 virtual ~NullMutex() {
380 UNIMPLEMENTED();
381 }
382
383 virtual int Lock() {
384 UNIMPLEMENTED();
385 return 0;
386 }
387
388 virtual int Unlock() {
389 UNIMPLEMENTED();
390 return 0;
391 }
392
393 private:
394 void* data_;
395};
396
397
398Mutex* OS::CreateMutex() {
399 UNIMPLEMENTED();
400 return new NullMutex();
401}
402
403
404class NullSemaphore : public Semaphore {
405 public:
406 explicit NullSemaphore(int count) : data_(NULL) {
407 UNIMPLEMENTED();
408 }
409
410 virtual ~NullSemaphore() {
411 UNIMPLEMENTED();
412 }
413
414 virtual void Wait() {
415 UNIMPLEMENTED();
416 }
417
418 virtual void Signal() {
419 UNIMPLEMENTED();
420 }
421 private:
422 void* data_;
423};
424
425
426Semaphore* OS::CreateSemaphore(int count) {
427 UNIMPLEMENTED();
428 return new NullSemaphore(count);
429}
430
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000431
432class ProfileSampler::PlatformData : public Malloced {
433 public:
434 PlatformData() {
435 UNIMPLEMENTED();
436 }
437};
438
439
440ProfileSampler::ProfileSampler(int interval) {
441 UNIMPLEMENTED();
442 // Shared setup follows.
443 data_ = new PlatformData();
444 interval_ = interval;
445 active_ = false;
446}
447
448
449ProfileSampler::~ProfileSampler() {
450 UNIMPLEMENTED();
451 // Shared tear down follows.
452 delete data_;
453}
454
455
456void ProfileSampler::Start() {
457 UNIMPLEMENTED();
458}
459
460
461void ProfileSampler::Stop() {
462 UNIMPLEMENTED();
463}
464
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000465
466} } // namespace v8::internal