[V8] Introduce a QML compilation mode
[profile/ivi/qtjsbackend.git] / src / 3rdparty / v8 / src / platform-nullos.cc
1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
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 #include "vm-state-inl.h"
39
40
41 namespace v8 {
42 namespace internal {
43
44 // Give V8 the opportunity to override the default ceil behaviour.
45 double ceiling(double x) {
46   UNIMPLEMENTED();
47   return 0;
48 }
49
50
51 // Give V8 the opportunity to override the default fmod behavior.
52 double modulo(double x, double y) {
53   UNIMPLEMENTED();
54   return 0;
55 }
56
57
58 double fast_sin(double x) {
59   UNIMPLEMENTED();
60   return 0;
61 }
62
63
64 double fast_cos(double x) {
65   UNIMPLEMENTED();
66   return 0;
67 }
68
69
70 double fast_tan(double x) {
71   UNIMPLEMENTED();
72   return 0;
73 }
74
75
76 double fast_log(double x) {
77   UNIMPLEMENTED();
78   return 0;
79 }
80
81
82 // Initialize OS class early in the V8 startup.
83 void OS::SetUp() {
84   // Seed the random number generator.
85   UNIMPLEMENTED();
86 }
87
88
89 void OS::PostSetUp() {
90   UNIMPLEMENTED();
91 }
92
93
94 void OS::TearDown() {
95   UNIMPLEMENTED();
96 }
97
98
99 // Returns the accumulated user time for thread.
100 int OS::GetUserTime(uint32_t* secs,  uint32_t* usecs) {
101   UNIMPLEMENTED();
102   *secs = 0;
103   *usecs = 0;
104   return 0;
105 }
106
107
108 // Returns current time as the number of milliseconds since
109 // 00:00:00 UTC, January 1, 1970.
110 double OS::TimeCurrentMillis() {
111   UNIMPLEMENTED();
112   return 0;
113 }
114
115
116 // Returns ticks in microsecond resolution.
117 int64_t OS::Ticks() {
118   UNIMPLEMENTED();
119   return 0;
120 }
121
122
123 // Returns a string identifying the current timezone taking into
124 // account daylight saving.
125 const char* OS::LocalTimezone(double time) {
126   UNIMPLEMENTED();
127   return "<none>";
128 }
129
130
131 // Returns the daylight savings offset in milliseconds for the given time.
132 double OS::DaylightSavingsOffset(double time) {
133   UNIMPLEMENTED();
134   return 0;
135 }
136
137
138 int OS::GetLastError() {
139   UNIMPLEMENTED();
140   return 0;
141 }
142
143
144 // Returns the local time offset in milliseconds east of UTC without
145 // taking daylight savings time into account.
146 double OS::LocalTimeOffset() {
147   UNIMPLEMENTED();
148   return 0;
149 }
150
151
152 // Print (debug) message to console.
153 void OS::Print(const char* format, ...) {
154   UNIMPLEMENTED();
155 }
156
157
158 // Print (debug) message to console.
159 void OS::VPrint(const char* format, va_list args) {
160   // Minimalistic implementation for bootstrapping.
161   vfprintf(stdout, format, args);
162 }
163
164
165 void OS::FPrint(FILE* out, const char* format, ...) {
166   va_list args;
167   va_start(args, format);
168   VFPrint(out, format, args);
169   va_end(args);
170 }
171
172
173 void OS::VFPrint(FILE* out, const char* format, va_list args) {
174   vfprintf(out, format, args);
175 }
176
177
178 // Print error message to console.
179 void OS::PrintError(const char* format, ...) {
180   // Minimalistic implementation for bootstrapping.
181   va_list args;
182   va_start(args, format);
183   VPrintError(format, args);
184   va_end(args);
185 }
186
187
188 // Print error message to console.
189 void OS::VPrintError(const char* format, va_list args) {
190   // Minimalistic implementation for bootstrapping.
191   vfprintf(stderr, format, args);
192 }
193
194
195 int OS::SNPrintF(char* str, size_t size, const char* format, ...) {
196   UNIMPLEMENTED();
197   return 0;
198 }
199
200
201 int OS::VSNPrintF(char* str, size_t size, const char* format, va_list args) {
202   UNIMPLEMENTED();
203   return 0;
204 }
205
206
207 uint64_t OS::CpuFeaturesImpliedByPlatform() {
208   return 0;
209 }
210
211
212 double OS::nan_value() {
213   UNIMPLEMENTED();
214   return 0;
215 }
216
217
218 bool OS::ArmCpuHasFeature(CpuFeature feature) {
219   UNIMPLEMENTED();
220 }
221
222
223 bool OS::ArmUsingHardFloat() {
224   UNIMPLEMENTED();
225 }
226
227
228 bool OS::IsOutsideAllocatedSpace(void* address) {
229   UNIMPLEMENTED();
230   return false;
231 }
232
233
234 size_t OS::AllocateAlignment() {
235   UNIMPLEMENTED();
236   return 0;
237 }
238
239
240 void* OS::Allocate(const size_t requested,
241                    size_t* allocated,
242                    bool executable) {
243   UNIMPLEMENTED();
244   return NULL;
245 }
246
247
248 void OS::Free(void* buf, const size_t length) {
249   // TODO(1240712): potential system call return value which is ignored here.
250   UNIMPLEMENTED();
251 }
252
253
254 void OS::Guard(void* address, const size_t size) {
255   UNIMPLEMENTED();
256 }
257
258
259 void OS::Sleep(int milliseconds) {
260   UNIMPLEMENTED();
261 }
262
263
264 void OS::Abort() {
265   // Minimalistic implementation for bootstrapping.
266   abort();
267 }
268
269
270 void OS::DebugBreak() {
271   UNIMPLEMENTED();
272 }
273
274
275 OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) {
276   UNIMPLEMENTED();
277   return NULL;
278 }
279
280
281 OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size,
282     void* initial) {
283   UNIMPLEMENTED();
284   return NULL;
285 }
286
287
288 void OS::LogSharedLibraryAddresses() {
289   UNIMPLEMENTED();
290 }
291
292
293 void OS::SignalCodeMovingGC() {
294   UNIMPLEMENTED();
295 }
296
297
298 int OS::StackWalk(Vector<OS::StackFrame> frames) {
299   UNIMPLEMENTED();
300   return 0;
301 }
302
303
304 VirtualMemory::VirtualMemory(size_t size, void* address_hint) {
305   UNIMPLEMENTED();
306 }
307
308
309 VirtualMemory::~VirtualMemory() {
310   UNIMPLEMENTED();
311 }
312
313
314 bool VirtualMemory::IsReserved() {
315   UNIMPLEMENTED();
316   return false;
317 }
318
319
320 bool VirtualMemory::Commit(void* address, size_t size, bool executable) {
321   UNIMPLEMENTED();
322   return false;
323 }
324
325
326 bool VirtualMemory::Uncommit(void* address, size_t size) {
327   UNIMPLEMENTED();
328   return false;
329 }
330
331
332 bool VirtualMemory::Guard(void* address) {
333   UNIMPLEMENTED();
334   return false;
335 }
336
337
338 class Thread::PlatformData : public Malloced {
339  public:
340   PlatformData() {
341     UNIMPLEMENTED();
342   }
343
344   void* pd_data_;
345 };
346
347
348 Thread::Thread(const Options& options)
349     : data_(new PlatformData()),
350       stack_size_(options.stack_size) {
351   set_name(options.name);
352   UNIMPLEMENTED();
353 }
354
355
356 Thread::Thread(const char* name)
357     : data_(new PlatformData()),
358       stack_size_(0) {
359   set_name(name);
360   UNIMPLEMENTED();
361 }
362
363
364 Thread::~Thread() {
365   delete data_;
366   UNIMPLEMENTED();
367 }
368
369
370 void Thread::set_name(const char* name) {
371   strncpy(name_, name, sizeof(name_));
372   name_[sizeof(name_) - 1] = '\0';
373 }
374
375
376 void Thread::Start() {
377   UNIMPLEMENTED();
378 }
379
380
381 void Thread::Join() {
382   UNIMPLEMENTED();
383 }
384
385
386 Thread::LocalStorageKey Thread::CreateThreadLocalKey() {
387   UNIMPLEMENTED();
388   return static_cast<LocalStorageKey>(0);
389 }
390
391
392 void Thread::DeleteThreadLocalKey(LocalStorageKey key) {
393   UNIMPLEMENTED();
394 }
395
396
397 void* Thread::GetThreadLocal(LocalStorageKey key) {
398   UNIMPLEMENTED();
399   return NULL;
400 }
401
402
403 void Thread::SetThreadLocal(LocalStorageKey key, void* value) {
404   UNIMPLEMENTED();
405 }
406
407
408 void Thread::YieldCPU() {
409   UNIMPLEMENTED();
410 }
411
412
413 class NullMutex : public Mutex {
414  public:
415   NullMutex() : data_(NULL) {
416     UNIMPLEMENTED();
417   }
418
419   virtual ~NullMutex() {
420     UNIMPLEMENTED();
421   }
422
423   virtual int Lock() {
424     UNIMPLEMENTED();
425     return 0;
426   }
427
428   virtual int Unlock() {
429     UNIMPLEMENTED();
430     return 0;
431   }
432
433  private:
434   void* data_;
435 };
436
437
438 Mutex* OS::CreateMutex() {
439   UNIMPLEMENTED();
440   return new NullMutex();
441 }
442
443
444 class NullSemaphore : public Semaphore {
445  public:
446   explicit NullSemaphore(int count) : data_(NULL) {
447     UNIMPLEMENTED();
448   }
449
450   virtual ~NullSemaphore() {
451     UNIMPLEMENTED();
452   }
453
454   virtual void Wait() {
455     UNIMPLEMENTED();
456   }
457
458   virtual void Signal() {
459     UNIMPLEMENTED();
460   }
461  private:
462   void* data_;
463 };
464
465
466 Semaphore* OS::CreateSemaphore(int count) {
467   UNIMPLEMENTED();
468   return new NullSemaphore(count);
469 }
470
471
472 class ProfileSampler::PlatformData  : public Malloced {
473  public:
474   PlatformData() {
475     UNIMPLEMENTED();
476   }
477 };
478
479
480 ProfileSampler::ProfileSampler(int interval) {
481   UNIMPLEMENTED();
482   // Shared setup follows.
483   data_ = new PlatformData();
484   interval_ = interval;
485   active_ = false;
486 }
487
488
489 ProfileSampler::~ProfileSampler() {
490   UNIMPLEMENTED();
491   // Shared tear down follows.
492   delete data_;
493 }
494
495
496 void ProfileSampler::Start() {
497   UNIMPLEMENTED();
498 }
499
500
501 void ProfileSampler::Stop() {
502   UNIMPLEMENTED();
503 }
504
505
506 } }  // namespace v8::internal