Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/platform-linux.cc

Issue 11275184: First draft of the sh4 port Base URL: http://github.com/v8/v8.git@master
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } 277 }
278 } 278 }
279 fclose(f); 279 fclose(f);
280 280
281 // Did not find string in the proc file. 281 // Did not find string in the proc file.
282 return false; 282 return false;
283 } 283 }
284 #endif // def __mips__ 284 #endif // def __mips__
285 285
286 286
287 #ifdef __sh__
288 bool OS::SHCpuHasFeature(CpuFeature feature) {
289 switch (feature) {
290 case FPU:
291 // Assume FPU is always active.
292 // All supported SH4 implementation feature it
293 return true;
294 default:
295 UNREACHABLE();
296 }
297 return false;
298 }
299 #endif // def __sh__
300
301
287 int OS::ActivationFrameAlignment() { 302 int OS::ActivationFrameAlignment() {
288 #ifdef V8_TARGET_ARCH_ARM 303 #ifdef V8_TARGET_ARCH_ARM
289 // On EABI ARM targets this is required for fp correctness in the 304 // On EABI ARM targets this is required for fp correctness in the
290 // runtime system. 305 // runtime system.
291 return 8; 306 return 8;
292 #elif V8_TARGET_ARCH_MIPS 307 #elif V8_TARGET_ARCH_MIPS
293 return 8; 308 return 8;
309 #elif V8_TARGET_ARCH_SH4
310 return 4;
294 #endif 311 #endif
295 // With gcc 4.4 the tree vectorization optimizer can generate code 312 // With gcc 4.4 the tree vectorization optimizer can generate code
296 // that requires 16 byte alignment such as movdqa on x86. 313 // that requires 16 byte alignment such as movdqa on x86.
297 return 16; 314 return 16;
298 } 315 }
299 316
300 317
301 void OS::ReleaseStore(volatile AtomicWord* ptr, AtomicWord value) { 318 void OS::ReleaseStore(volatile AtomicWord* ptr, AtomicWord value) {
302 #if (defined(V8_TARGET_ARCH_ARM) && defined(__arm__)) || \ 319 #if (defined(V8_TARGET_ARCH_ARM) && defined(__arm__)) || \
303 (defined(V8_TARGET_ARCH_MIPS) && defined(__mips__)) 320 (defined(V8_TARGET_ARCH_MIPS) && defined(__mips__))
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 419
403 void OS::DebugBreak() { 420 void OS::DebugBreak() {
404 // TODO(lrn): Introduce processor define for runtime system (!= V8_ARCH_x, 421 // TODO(lrn): Introduce processor define for runtime system (!= V8_ARCH_x,
405 // which is the architecture of generated code). 422 // which is the architecture of generated code).
406 #if (defined(__arm__) || defined(__thumb__)) 423 #if (defined(__arm__) || defined(__thumb__))
407 # if defined(CAN_USE_ARMV5_INSTRUCTIONS) 424 # if defined(CAN_USE_ARMV5_INSTRUCTIONS)
408 asm("bkpt 0"); 425 asm("bkpt 0");
409 # endif 426 # endif
410 #elif defined(__mips__) 427 #elif defined(__mips__)
411 asm("break"); 428 asm("break");
429 #elif defined(__sh__)
430 asm("ldtlb");
412 #else 431 #else
413 asm("int $3"); 432 asm("int $3");
414 #endif 433 #endif
415 } 434 }
416 435
417 436
418 class PosixMemoryMappedFile : public OS::MemoryMappedFile { 437 class PosixMemoryMappedFile : public OS::MemoryMappedFile {
419 public: 438 public:
420 PosixMemoryMappedFile(FILE* file, void* memory, int size) 439 PosixMemoryMappedFile(FILE* file, void* memory, int size)
421 : file_(file), memory_(memory), size_(size) { } 440 : file_(file), memory_(memory), size_(size) { }
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 sample->pc = reinterpret_cast<Address>(mcontext.gregs[R15]); 1081 sample->pc = reinterpret_cast<Address>(mcontext.gregs[R15]);
1063 sample->sp = reinterpret_cast<Address>(mcontext.gregs[R13]); 1082 sample->sp = reinterpret_cast<Address>(mcontext.gregs[R13]);
1064 sample->fp = reinterpret_cast<Address>(mcontext.gregs[R11]); 1083 sample->fp = reinterpret_cast<Address>(mcontext.gregs[R11]);
1065 #else 1084 #else
1066 sample->pc = reinterpret_cast<Address>(mcontext.arm_pc); 1085 sample->pc = reinterpret_cast<Address>(mcontext.arm_pc);
1067 sample->sp = reinterpret_cast<Address>(mcontext.arm_sp); 1086 sample->sp = reinterpret_cast<Address>(mcontext.arm_sp);
1068 sample->fp = reinterpret_cast<Address>(mcontext.arm_fp); 1087 sample->fp = reinterpret_cast<Address>(mcontext.arm_fp);
1069 #endif // defined(__GLIBC__) && !defined(__UCLIBC__) && 1088 #endif // defined(__GLIBC__) && !defined(__UCLIBC__) &&
1070 // (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) 1089 // (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
1071 #elif V8_HOST_ARCH_MIPS 1090 #elif V8_HOST_ARCH_MIPS
1091 sample.pc = reinterpret_cast<Address>(mcontext.pc);
1092 sample.sp = reinterpret_cast<Address>(mcontext.gregs[29]);
1093 sample.fp = reinterpret_cast<Address>(mcontext.gregs[30]);
1094 #elif defined(V8_HOST_ARCH_SH4)
1072 sample->pc = reinterpret_cast<Address>(mcontext.pc); 1095 sample->pc = reinterpret_cast<Address>(mcontext.pc);
1073 sample->sp = reinterpret_cast<Address>(mcontext.gregs[29]); 1096 sample->sp = reinterpret_cast<Address>(mcontext.gregs[R15]);
1074 sample->fp = reinterpret_cast<Address>(mcontext.gregs[30]); 1097 sample->fp = reinterpret_cast<Address>(mcontext.gregs[R14]);
1075 #endif // V8_HOST_ARCH_* 1098 #endif // V8_HOST_ARCH_*
1076 sampler->SampleStack(sample); 1099 sampler->SampleStack(sample);
1077 sampler->Tick(sample); 1100 sampler->Tick(sample);
1078 } 1101 }
1079 1102
1080 1103
1081 class Sampler::PlatformData : public Malloced { 1104 class Sampler::PlatformData : public Malloced {
1082 public: 1105 public:
1083 PlatformData() : vm_tid_(GetThreadID()) {} 1106 PlatformData() : vm_tid_(GetThreadID()) {}
1084 1107
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 1336
1314 1337
1315 void Sampler::Stop() { 1338 void Sampler::Stop() {
1316 ASSERT(IsActive()); 1339 ASSERT(IsActive());
1317 SignalSender::RemoveActiveSampler(this); 1340 SignalSender::RemoveActiveSampler(this);
1318 SetActive(false); 1341 SetActive(false);
1319 } 1342 }
1320 1343
1321 1344
1322 } } // namespace v8::internal 1345 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698