OLD | NEW |
| (Empty) |
1 // Copyright 2012 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::ArmUsingHardFloat() { | |
219 UNIMPLEMENTED(); | |
220 } | |
221 | |
222 | |
223 bool OS::IsOutsideAllocatedSpace(void* address) { | |
224 UNIMPLEMENTED(); | |
225 return false; | |
226 } | |
227 | |
228 | |
229 size_t OS::AllocateAlignment() { | |
230 UNIMPLEMENTED(); | |
231 return 0; | |
232 } | |
233 | |
234 | |
235 void* OS::Allocate(const size_t requested, | |
236 size_t* allocated, | |
237 bool executable) { | |
238 UNIMPLEMENTED(); | |
239 return NULL; | |
240 } | |
241 | |
242 | |
243 void OS::Free(void* buf, const size_t length) { | |
244 // TODO(1240712): potential system call return value which is ignored here. | |
245 UNIMPLEMENTED(); | |
246 } | |
247 | |
248 | |
249 void OS::Guard(void* address, const size_t size) { | |
250 UNIMPLEMENTED(); | |
251 } | |
252 | |
253 | |
254 void OS::Sleep(int milliseconds) { | |
255 UNIMPLEMENTED(); | |
256 } | |
257 | |
258 | |
259 int OS::NumberOfCores() { | |
260 UNIMPLEMENTED(); | |
261 return 0; | |
262 } | |
263 | |
264 | |
265 void OS::Abort() { | |
266 // Minimalistic implementation for bootstrapping. | |
267 abort(); | |
268 } | |
269 | |
270 | |
271 void OS::DebugBreak() { | |
272 UNIMPLEMENTED(); | |
273 } | |
274 | |
275 | |
276 void OS::DumpBacktrace() { | |
277 // Currently unsupported. | |
278 } | |
279 | |
280 | |
281 OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) { | |
282 UNIMPLEMENTED(); | |
283 return NULL; | |
284 } | |
285 | |
286 | |
287 OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size, | |
288 void* initial) { | |
289 UNIMPLEMENTED(); | |
290 return NULL; | |
291 } | |
292 | |
293 | |
294 void OS::LogSharedLibraryAddresses() { | |
295 UNIMPLEMENTED(); | |
296 } | |
297 | |
298 | |
299 void OS::SignalCodeMovingGC() { | |
300 UNIMPLEMENTED(); | |
301 } | |
302 | |
303 | |
304 int OS::StackWalk(Vector<OS::StackFrame> frames) { | |
305 UNIMPLEMENTED(); | |
306 return 0; | |
307 } | |
308 | |
309 | |
310 VirtualMemory::VirtualMemory() { | |
311 UNIMPLEMENTED(); | |
312 } | |
313 | |
314 | |
315 VirtualMemory::VirtualMemory(size_t size) { | |
316 UNIMPLEMENTED(); | |
317 } | |
318 | |
319 | |
320 VirtualMemory::VirtualMemory(size_t size, void* address_hint) { | |
321 UNIMPLEMENTED(); | |
322 } | |
323 | |
324 | |
325 VirtualMemory::~VirtualMemory() { | |
326 UNIMPLEMENTED(); | |
327 } | |
328 | |
329 | |
330 bool VirtualMemory::IsReserved() { | |
331 UNIMPLEMENTED(); | |
332 return false; | |
333 } | |
334 | |
335 | |
336 void VirtualMemory::Reset() { | |
337 UNIMPLEMENTED(); | |
338 } | |
339 | |
340 | |
341 bool VirtualMemory::Commit(void* address, size_t size, bool executable) { | |
342 UNIMPLEMENTED(); | |
343 return false; | |
344 } | |
345 | |
346 | |
347 bool VirtualMemory::Uncommit(void* address, size_t size) { | |
348 UNIMPLEMENTED(); | |
349 return false; | |
350 } | |
351 | |
352 | |
353 bool VirtualMemory::Guard(void* address) { | |
354 UNIMPLEMENTED(); | |
355 return false; | |
356 } | |
357 | |
358 | |
359 void* VirtualMemory::ReserveRegion(size_t size) { | |
360 UNIMPLEMENTED(); | |
361 return NULL; | |
362 } | |
363 | |
364 | |
365 bool VirtualMemory::CommitRegion(void* base, size_t size, bool is_executable) { | |
366 UNIMPLEMENTED(); | |
367 return false; | |
368 } | |
369 | |
370 | |
371 bool VirtualMemory::UncommitRegion(void* base, size_t size) { | |
372 UNIMPLEMENTED(); | |
373 return false; | |
374 } | |
375 | |
376 | |
377 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { | |
378 UNIMPLEMENTED(); | |
379 return false; | |
380 } | |
381 | |
382 | |
383 bool VirtualMemory::HasLazyCommits() { | |
384 // TODO(alph): implement for the platform. | |
385 return false; | |
386 } | |
387 | |
388 | |
389 class Thread::PlatformData : public Malloced { | |
390 public: | |
391 PlatformData() { | |
392 UNIMPLEMENTED(); | |
393 } | |
394 | |
395 void* pd_data_; | |
396 }; | |
397 | |
398 | |
399 Thread::Thread(const Options& options) | |
400 : data_(new PlatformData()), | |
401 stack_size_(options.stack_size), | |
402 start_semaphore_(NULL) { | |
403 set_name(options.name); | |
404 UNIMPLEMENTED(); | |
405 } | |
406 | |
407 | |
408 Thread::Thread(const char* name) | |
409 : data_(new PlatformData()), | |
410 stack_size_(0) { | |
411 set_name(name); | |
412 UNIMPLEMENTED(); | |
413 } | |
414 | |
415 | |
416 Thread::~Thread() { | |
417 delete data_; | |
418 UNIMPLEMENTED(); | |
419 } | |
420 | |
421 | |
422 void Thread::set_name(const char* name) { | |
423 strncpy(name_, name, sizeof(name_)); | |
424 name_[sizeof(name_) - 1] = '\0'; | |
425 } | |
426 | |
427 | |
428 void Thread::Start() { | |
429 UNIMPLEMENTED(); | |
430 } | |
431 | |
432 | |
433 void Thread::Join() { | |
434 UNIMPLEMENTED(); | |
435 } | |
436 | |
437 | |
438 Thread::LocalStorageKey Thread::CreateThreadLocalKey() { | |
439 UNIMPLEMENTED(); | |
440 return static_cast<LocalStorageKey>(0); | |
441 } | |
442 | |
443 | |
444 void Thread::DeleteThreadLocalKey(LocalStorageKey key) { | |
445 UNIMPLEMENTED(); | |
446 } | |
447 | |
448 | |
449 void* Thread::GetThreadLocal(LocalStorageKey key) { | |
450 UNIMPLEMENTED(); | |
451 return NULL; | |
452 } | |
453 | |
454 | |
455 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | |
456 UNIMPLEMENTED(); | |
457 } | |
458 | |
459 | |
460 void Thread::YieldCPU() { | |
461 UNIMPLEMENTED(); | |
462 } | |
463 | |
464 | |
465 class NullMutex : public Mutex { | |
466 public: | |
467 NullMutex() : data_(NULL) { | |
468 UNIMPLEMENTED(); | |
469 } | |
470 | |
471 virtual ~NullMutex() { | |
472 UNIMPLEMENTED(); | |
473 } | |
474 | |
475 virtual int Lock() { | |
476 UNIMPLEMENTED(); | |
477 return 0; | |
478 } | |
479 | |
480 virtual int Unlock() { | |
481 UNIMPLEMENTED(); | |
482 return 0; | |
483 } | |
484 | |
485 private: | |
486 void* data_; | |
487 }; | |
488 | |
489 | |
490 Mutex* OS::CreateMutex() { | |
491 UNIMPLEMENTED(); | |
492 return new NullMutex(); | |
493 } | |
494 | |
495 | |
496 class NullSemaphore : public Semaphore { | |
497 public: | |
498 explicit NullSemaphore(int count) : data_(NULL) { | |
499 UNIMPLEMENTED(); | |
500 } | |
501 | |
502 virtual ~NullSemaphore() { | |
503 UNIMPLEMENTED(); | |
504 } | |
505 | |
506 virtual void Wait() { | |
507 UNIMPLEMENTED(); | |
508 } | |
509 | |
510 virtual void Signal() { | |
511 UNIMPLEMENTED(); | |
512 } | |
513 private: | |
514 void* data_; | |
515 }; | |
516 | |
517 | |
518 Semaphore* OS::CreateSemaphore(int count) { | |
519 UNIMPLEMENTED(); | |
520 return new NullSemaphore(count); | |
521 } | |
522 | |
523 | |
524 class ProfileSampler::PlatformData : public Malloced { | |
525 public: | |
526 PlatformData() { | |
527 UNIMPLEMENTED(); | |
528 } | |
529 }; | |
530 | |
531 | |
532 ProfileSampler::ProfileSampler(int interval) { | |
533 UNIMPLEMENTED(); | |
534 // Shared setup follows. | |
535 data_ = new PlatformData(); | |
536 interval_ = interval; | |
537 active_ = false; | |
538 } | |
539 | |
540 | |
541 ProfileSampler::~ProfileSampler() { | |
542 UNIMPLEMENTED(); | |
543 // Shared tear down follows. | |
544 delete data_; | |
545 } | |
546 | |
547 | |
548 void ProfileSampler::Start() { | |
549 UNIMPLEMENTED(); | |
550 } | |
551 | |
552 | |
553 void ProfileSampler::Stop() { | |
554 UNIMPLEMENTED(); | |
555 } | |
556 | |
557 | |
558 } } // namespace v8::internal | |
OLD | NEW |