Revision: 3951
Author: [email protected]
Date: Thu Feb 25 05:19:28 2010
Log: Clean up use of ifdefs for ARM variants.
If you are cross-compiling snapshots for an ARM CPU that supports
VFP or ARMv7 instructions you need to define the
CAN_USE_VFP_INSTRUCTIONS and CAN_USE_ARMV7_INSTRUCTIONS in the
mksnapshot stage.  Otherwise the snapshot will not make use
of the instructions, resulting in slower floating point
performance.
Should also fix http://code.google.com/p/v8/issues/detail?id=590
Review URL: http://codereview.chromium.org/661075
http://code.google.com/p/v8/source/detail?r=3951

Modified:
 /branches/experimental/partial_snapshots/src/arm/assembler-arm.cc
 /branches/experimental/partial_snapshots/src/arm/cpu-arm.cc
 /branches/experimental/partial_snapshots/src/platform-freebsd.cc
 /branches/experimental/partial_snapshots/src/platform-linux.cc
 /branches/experimental/partial_snapshots/src/platform-openbsd.cc

=======================================
--- /branches/experimental/partial_snapshots/src/arm/assembler-arm.cc Tue Feb 23 07:23:56 2010 +++ /branches/experimental/partial_snapshots/src/arm/assembler-arm.cc Thu Feb 25 05:19:28 2010
@@ -47,10 +47,29 @@
 unsigned CpuFeatures::enabled_ = 0;
 unsigned CpuFeatures::found_by_runtime_probing_ = 0;

+
+#ifdef __arm__
+static uint64_t CpuFeaturesImpliedByCompiler() {
+  uint64_t answer = 0;
+#ifdef CAN_USE_ARMV7_INSTRUCTIONS
+  answer |= 1u << ARMv7;
+#endif  // def CAN_USE_ARMV7_INSTRUCTIONS
+ // If the compiler is allowed to use VFP then we can use VFP too in our code
+  // generation even when generating snapshots.  This won't work for cross
+  // compilation.
+#if defined(__VFP_FP__) && !defined(__SOFTFP__)
+  answer |= 1u << VFP3;
+#endif  // defined(__VFP_FP__) && !defined(__SOFTFP__)
+#ifdef CAN_USE_VFP_INSTRUCTIONS
+  answer |= 1u << VFP3;
+#endif  // def CAN_USE_VFP_INSTRUCTIONS
+  return answer;
+}
+#endif  // def __arm__
+
+
 void CpuFeatures::Probe() {
-  // If the compiler is allowed to use vfp then we can use vfp too in our
-  // code generation.
-#if !defined(__arm__)
+#ifndef __arm__
   // For the simulator=arm build, use VFP when FLAG_enable_vfp3 is enabled.
   if (FLAG_enable_vfp3) {
       supported_ |= 1u << VFP3;
@@ -59,9 +78,10 @@
   if (FLAG_enable_armv7) {
       supported_ |= 1u << ARMv7;
   }
-#else
+#else  // def __arm__
   if (Serializer::enabled()) {
     supported_ |= OS::CpuFeaturesImpliedByPlatform();
+    supported_ |= CpuFeaturesImpliedByCompiler();
     return;  // No features if we might serialize.
   }

@@ -76,7 +96,7 @@
     supported_ |= 1u << ARMv7;
     found_by_runtime_probing_ |= 1u << ARMv7;
   }
-#endif
+#endif  // def __arm__
 }


@@ -620,7 +640,7 @@
     if (!Serializer::enabled()) {
       Serializer::TooLateToEnableNow();
     }
-#endif
+#endif  // def DEBUG
     return Serializer::enabled();
   } else if (rmode == RelocInfo::NONE) {
     return false;
@@ -1225,14 +1245,16 @@

 // Exception-generating instructions and debugging support.
 void Assembler::stop(const char* msg) {
-#if !defined(__arm__)
+#ifndef __arm__
   // The simulator handles these special instructions and stops execution.
   emit(15 << 28 | ((intptr_t) msg));
-#else
- // Just issue a simple break instruction for now. Alternatively we could use
-  // the swi(0x9f0001) instruction on Linux.
+#else  // def __arm__
+#ifdef CAN_USE_ARMV5_INSTRUCTIONS
   bkpt(0);
-#endif
+#else  // ndef CAN_USE_ARMV5_INSTRUCTIONS
+  swi(0x9f0001);
+#endif  // ndef CAN_USE_ARMV5_INSTRUCTIONS
+#endif  // def __arm__
 }


=======================================
--- /branches/experimental/partial_snapshots/src/arm/cpu-arm.cc Tue Jan 12 23:45:53 2010 +++ /branches/experimental/partial_snapshots/src/arm/cpu-arm.cc Thu Feb 25 05:19:28 2010
@@ -122,7 +122,7 @@


 void CPU::DebugBreak() {
-#if !defined (__arm__)
+#if !defined (__arm__) || !defined(CAN_USE_ARMV5_INSTRUCTIONS)
   UNIMPLEMENTED();  // when building ARM emulator target
 #else
   asm volatile("bkpt 0");
=======================================
--- /branches/experimental/partial_snapshots/src/platform-freebsd.cc Mon Jan 25 04:37:31 2010 +++ /branches/experimental/partial_snapshots/src/platform-freebsd.cc Thu Feb 25 05:19:28 2010
@@ -192,7 +192,8 @@


 void OS::DebugBreak() {
-#if defined(__arm__) || defined(__thumb__)
+#if (defined(__arm__) || defined(__thumb__)) && \
+    defined(CAN_USE_ARMV5_INSTRUCTIONS)
   asm("bkpt 0");
 #else
   asm("int $3");
=======================================
--- /branches/experimental/partial_snapshots/src/platform-linux.cc Tue Feb 23 07:23:56 2010 +++ /branches/experimental/partial_snapshots/src/platform-linux.cc Thu Feb 25 05:19:28 2010
@@ -266,7 +266,8 @@
 void OS::DebugBreak() {
 // TODO(lrn): Introduce processor define for runtime system (!= V8_ARCH_x,
 //  which is the architecture of generated code).
-#if defined(__arm__) || defined(__thumb__)
+#if (defined(__arm__) || defined(__thumb__)) && \
+    defined(CAN_USE_ARMV5_INSTRUCTIONS)
   asm("bkpt 0");
 #elif defined(__mips__)
   asm("break");
=======================================
--- /branches/experimental/partial_snapshots/src/platform-openbsd.cc Mon Jan 25 04:37:31 2010 +++ /branches/experimental/partial_snapshots/src/platform-openbsd.cc Thu Feb 25 05:19:28 2010
@@ -190,7 +190,8 @@


 void OS::DebugBreak() {
-#if defined(__arm__) || defined(__thumb__)
+#if (defined(__arm__) || defined(__thumb__)) && \
+    defined(CAN_USE_ARMV5_INSTRUCTIONS)
   asm("bkpt 0");
 #else
   asm("int $3");

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to