blob: 49d3dd988d8b24a7dd83f1613ce231e8bf3ae964 [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
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000189bool OS::IsOutsideAllocatedSpace(void* address) {
190 UNIMPLEMENTED();
191 return false;
192}
193
194
195size_t OS::AllocateAlignment() {
196 UNIMPLEMENTED();
197 return 0;
198}
199
200
201void* OS::Allocate(const size_t requested,
202 size_t* allocated,
203 bool executable) {
204 UNIMPLEMENTED();
205 return NULL;
206}
207
208
209void 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
kasperl@chromium.orgf5aa8372009-03-24 14:47:14 +0000215#ifdef ENABLE_HEAP_PROTECTION
216
217void OS::Protect(void* address, size_t size) {
218 UNIMPLEMENTED();
219}
220
221
222void OS::Unprotect(void* address, size_t size, bool is_executable) {
223 UNIMPLEMENTED();
224}
225
226#endif
227
228
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000229void OS::Sleep(int milliseconds) {
230 UNIMPLEMENTED();
231}
232
233
234void OS::Abort() {
235 // Minimalistic implementation for bootstrapping.
236 abort();
237}
238
239
240void OS::DebugBreak() {
241 UNIMPLEMENTED();
242}
243
244
vegorov@chromium.org0a4e9012011-01-24 12:33:13 +0000245OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) {
246 UNIMPLEMENTED();
247 return NULL;
248}
249
250
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000251OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size,
252 void* initial) {
253 UNIMPLEMENTED();
254 return NULL;
255}
256
257
258void OS::LogSharedLibraryAddresses() {
259 UNIMPLEMENTED();
260}
261
262
whesse@chromium.org4a5224e2010-10-20 12:37:07 +0000263void OS::SignalCodeMovingGC() {
264 UNIMPLEMENTED();
265}
266
267
ager@chromium.org65dad4b2009-04-23 08:48:43 +0000268int OS::StackWalk(Vector<OS::StackFrame> frames) {
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000269 UNIMPLEMENTED();
270 return 0;
271}
272
273
274VirtualMemory::VirtualMemory(size_t size, void* address_hint) {
275 UNIMPLEMENTED();
276}
277
278
279VirtualMemory::~VirtualMemory() {
280 UNIMPLEMENTED();
281}
282
283
284bool VirtualMemory::IsReserved() {
285 UNIMPLEMENTED();
286 return false;
287}
288
289
290bool VirtualMemory::Commit(void* address, size_t size, bool executable) {
291 UNIMPLEMENTED();
292 return false;
293}
294
295
296bool VirtualMemory::Uncommit(void* address, size_t size) {
297 UNIMPLEMENTED();
298 return false;
299}
300
301
302class ThreadHandle::PlatformData : public Malloced {
303 public:
304 explicit PlatformData(ThreadHandle::Kind kind) {
305 UNIMPLEMENTED();
306 }
307
308 void* pd_data_;
309};
310
311
312ThreadHandle::ThreadHandle(Kind kind) {
313 UNIMPLEMENTED();
314 // Shared setup follows.
315 data_ = new PlatformData(kind);
316}
317
318
319void ThreadHandle::Initialize(ThreadHandle::Kind kind) {
320 UNIMPLEMENTED();
321}
322
323
324ThreadHandle::~ThreadHandle() {
325 UNIMPLEMENTED();
326 // Shared tear down follows.
327 delete data_;
328}
329
330
331bool ThreadHandle::IsSelf() const {
332 UNIMPLEMENTED();
333 return false;
334}
335
336
337bool ThreadHandle::IsValid() const {
338 UNIMPLEMENTED();
339 return false;
340}
341
342
343Thread::Thread() : ThreadHandle(ThreadHandle::INVALID) {
lrn@chromium.org5d00b602011-01-05 09:51:43 +0000344 set_name("v8:<unknown>");
345 UNIMPLEMENTED();
346}
347
348
349Thread::Thread(const char* name) : ThreadHandle(ThreadHandle::INVALID) {
350 set_name(name);
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000351 UNIMPLEMENTED();
352}
353
354
355Thread::~Thread() {
356 UNIMPLEMENTED();
357}
358
359
lrn@chromium.org5d00b602011-01-05 09:51:43 +0000360void Thread::set_name(const char* name) {
361 strncpy(name_, name, sizeof(name_));
362 name_[sizeof(name_) - 1] = '\0';
363}
364
365
mads.s.ager@gmail.com769cc962008-08-06 10:02:49 +0000366void Thread::Start() {
367 UNIMPLEMENTED();
368}
369
370
371void Thread::Join() {
372 UNIMPLEMENTED();
373}
374
375
376Thread::LocalStorageKey Thread::CreateThreadLocalKey() {
377 UNIMPLEMENTED();
378 return static_cast<LocalStorageKey>(0);
379}
380
381
382void Thread::DeleteThreadLocalKey(LocalStorageKey key) {
383 UNIMPLEMENTED();
384}
385
386
387void* Thread::GetThreadLocal(LocalStorageKey key) {
388 UNIMPLEMENTED();
389 return NULL;
390}
391
392
393void Thread::SetThreadLocal(LocalStorageKey key, void* value) {
394 UNIMPLEMENTED();
395}
396
397
398void Thread::YieldCPU() {
399 UNIMPLEMENTED();
400}
401
402
403class NullMutex : public Mutex {
404 public:
405 NullMutex() : data_(NULL) {
406 UNIMPLEMENTED();
407 }
408
409 virtual ~NullMutex() {
410 UNIMPLEMENTED();
411 }
412
413 virtual int Lock() {
414 UNIMPLEMENTED();
415 return 0;
416 }
417
418 virtual int Unlock() {
419 UNIMPLEMENTED();
420 return 0;
421 }
422
423 private:
424 void* data_;
425};
426
427
428Mutex* OS::CreateMutex() {
429 UNIMPLEMENTED();
430 return new NullMutex();
431}
432
433
434class NullSemaphore : public Semaphore {
435 public:
436 explicit NullSemaphore(int count) : data_(NULL) {
437 UNIMPLEMENTED();
438 }
439
440 virtual ~NullSemaphore() {
441 UNIMPLEMENTED();
442 }
443
444 virtual void Wait() {
445 UNIMPLEMENTED();
446 }
447
448 virtual void Signal() {
449 UNIMPLEMENTED();
450 }
451 private:
452 void* data_;
453};
454
455
456Semaphore* OS::CreateSemaphore(int count) {
457 UNIMPLEMENTED();
458 return new NullSemaphore(count);
459}
460
461#ifdef ENABLE_LOGGING_AND_PROFILING
462
463class ProfileSampler::PlatformData : public Malloced {
464 public:
465 PlatformData() {
466 UNIMPLEMENTED();
467 }
468};
469
470
471ProfileSampler::ProfileSampler(int interval) {
472 UNIMPLEMENTED();
473 // Shared setup follows.
474 data_ = new PlatformData();
475 interval_ = interval;
476 active_ = false;
477}
478
479
480ProfileSampler::~ProfileSampler() {
481 UNIMPLEMENTED();
482 // Shared tear down follows.
483 delete data_;
484}
485
486
487void ProfileSampler::Start() {
488 UNIMPLEMENTED();
489}
490
491
492void ProfileSampler::Stop() {
493 UNIMPLEMENTED();
494}
495
496#endif // ENABLE_LOGGING_AND_PROFILING
497
498} } // namespace v8::internal