Revision: 21001
Author: [email protected]
Date: Mon Apr 28 08:18:38 2014 UTC
Log: Simplified CPU/CpuFeatures a bit.
This is a necessary intermediate step to disentangle the startup.
In the long run CPU and CpuFeatures should probably be merged,
and Serializer::enabled usage should be radically reduced, but
we're not there yet.
BUG=359977
LOG=y
[email protected]
Review URL: https://codereview.chromium.org/258993002
http://code.google.com/p/v8/source/detail?r=21001
Modified:
/branches/bleeding_edge/src/arm/assembler-arm.cc
/branches/bleeding_edge/src/arm/assembler-arm.h
/branches/bleeding_edge/src/arm/cpu-arm.cc
/branches/bleeding_edge/src/arm64/cpu-arm64.cc
/branches/bleeding_edge/src/arm64/cpu-arm64.h
/branches/bleeding_edge/src/cpu.h
/branches/bleeding_edge/src/flags.cc
/branches/bleeding_edge/src/flags.h
/branches/bleeding_edge/src/ia32/assembler-ia32.cc
/branches/bleeding_edge/src/ia32/assembler-ia32.h
/branches/bleeding_edge/src/ia32/cpu-ia32.cc
/branches/bleeding_edge/src/isolate.cc
/branches/bleeding_edge/src/mips/assembler-mips.cc
/branches/bleeding_edge/src/mips/assembler-mips.h
/branches/bleeding_edge/src/mips/cpu-mips.cc
/branches/bleeding_edge/src/mksnapshot.cc
/branches/bleeding_edge/src/v8.cc
/branches/bleeding_edge/src/x64/assembler-x64.cc
/branches/bleeding_edge/src/x64/assembler-x64.h
/branches/bleeding_edge/src/x64/cpu-x64.cc
=======================================
--- /branches/bleeding_edge/src/arm/assembler-arm.cc Fri Apr 25 11:00:37
2014 UTC
+++ /branches/bleeding_edge/src/arm/assembler-arm.cc Mon Apr 28 08:18:38
2014 UTC
@@ -48,7 +48,6 @@
#ifdef DEBUG
bool CpuFeatures::initialized_ = false;
#endif
-bool CpuFeatures::hint_creating_snapshot_ = false;
unsigned CpuFeatures::supported_ = 0;
unsigned CpuFeatures::found_by_runtime_probing_only_ = 0;
unsigned CpuFeatures::cross_compile_ = 0;
@@ -99,22 +98,6 @@
return VFPRegisters::Name(index, true);
}
-
-
-void CpuFeatures::SetHintCreatingSnapshot() {
- hint_creating_snapshot_ = true;
-}
-
-
-void CpuFeatures::ProbeWithoutIsolate() {
- Probe(hint_creating_snapshot_);
-}
-
-
-void CpuFeatures::Probe() {
- // The Serializer can only be queried after isolate initialization.
- Probe(Serializer::enabled());
-}
void CpuFeatures::Probe(bool serializer_enabled) {
@@ -133,8 +116,6 @@
if (serializer_enabled) {
// No probing for features if we might serialize (generate snapshot).
- printf(" ");
- PrintFeatures();
return;
}
=======================================
--- /branches/bleeding_edge/src/arm/assembler-arm.h Thu Apr 17 14:45:06
2014 UTC
+++ /branches/bleeding_edge/src/arm/assembler-arm.h Mon Apr 28 08:18:38
2014 UTC
@@ -56,12 +56,7 @@
public:
// Detect features of the target CPU. Set safe defaults if the serializer
// is enabled (snapshots must be portable).
- static void Probe();
-
- // A special case for printing target and features, which we want to do
- // before initializing the isolate
- static void SetHintCreatingSnapshot();
- static void ProbeWithoutIsolate();
+ static void Probe(bool serializer_enabled);
// Display target use when compiling.
static void PrintTarget();
@@ -97,11 +92,10 @@
return cross_compile_ == 0 ||
(cross_compile_ & mask) == mask;
}
+
+ static bool SupportsCrankshaft() { return
CpuFeatures::IsSupported(VFP3); }
private:
- static void Probe(bool serializer_enabled);
- static bool hint_creating_snapshot_;
-
static bool Check(CpuFeature f, unsigned set) {
return (set & flag2set(f)) != 0;
}
=======================================
--- /branches/bleeding_edge/src/arm/cpu-arm.cc Thu Jan 2 07:04:05 2014 UTC
+++ /branches/bleeding_edge/src/arm/cpu-arm.cc Mon Apr 28 08:18:38 2014 UTC
@@ -46,16 +46,6 @@
namespace v8 {
namespace internal {
-void CPU::SetUp() {
- CpuFeatures::Probe();
-}
-
-
-bool CPU::SupportsCrankshaft() {
- return CpuFeatures::IsSupported(VFP3);
-}
-
-
void CPU::FlushICache(void* start, size_t size) {
// Nothing to do flushing no instructions.
if (size == 0) {
=======================================
--- /branches/bleeding_edge/src/arm64/cpu-arm64.cc Fri Mar 21 09:28:26 2014
UTC
+++ /branches/bleeding_edge/src/arm64/cpu-arm64.cc Mon Apr 28 08:18:38 2014
UTC
@@ -49,16 +49,6 @@
unsigned CpuFeatures::icache_line_size_ = 1;
-void CPU::SetUp() {
- CpuFeatures::Probe();
-}
-
-
-bool CPU::SupportsCrankshaft() {
- return true;
-}
-
-
void CPU::FlushICache(void* address, size_t length) {
if (length == 0) {
return;
@@ -139,7 +129,7 @@
}
-void CpuFeatures::Probe() {
+void CpuFeatures::Probe(bool serializer_enabled) {
// Compute I and D cache line size. The cache type register holds
// information about the caches.
uint32_t cache_type_register = GetCacheType();
=======================================
--- /branches/bleeding_edge/src/arm64/cpu-arm64.h Fri Mar 21 09:28:26 2014
UTC
+++ /branches/bleeding_edge/src/arm64/cpu-arm64.h Mon Apr 28 08:18:38 2014
UTC
@@ -42,7 +42,7 @@
public:
// Detect features of the target CPU. Set safe defaults if the serializer
// is enabled (snapshots must be portable).
- static void Probe();
+ static void Probe(bool serializer_enabled);
// Check whether a feature is supported by the target CPU.
static bool IsSupported(CpuFeature f) {
@@ -80,6 +80,8 @@
ASSERT(cross_compile_ == 0);
return true;
}
+
+ static bool SupportsCrankshaft() { return true; }
private:
// Return the content of the cache type register.
=======================================
--- /branches/bleeding_edge/src/cpu.h Tue Sep 10 15:03:17 2013 UTC
+++ /branches/bleeding_edge/src/cpu.h Mon Apr 28 08:18:38 2014 UTC
@@ -102,11 +102,6 @@
// Returns the number of processors online.
static int NumberOfProcessorsOnline();
- // Initializes the cpu architecture support. Called once at VM startup.
- static void SetUp();
-
- static bool SupportsCrankshaft();
-
// Flush instruction cache.
static void FlushICache(void* start, size_t size);
=======================================
--- /branches/bleeding_edge/src/flags.cc Thu Apr 17 14:45:06 2014 UTC
+++ /branches/bleeding_edge/src/flags.cc Mon Apr 28 08:18:38 2014 UTC
@@ -358,12 +358,17 @@
}
return NULL;
}
+
+
+bool FlagList::serializer_enabled_ = false;
// static
int FlagList::SetFlagsFromCommandLine(int* argc,
char** argv,
- bool remove_flags) {
+ bool remove_flags,
+ bool serializer_enabled) {
+ serializer_enabled_ = serializer_enabled;
int return_code = 0;
// parse arguments
for (int i = 1; i < *argc;) {
@@ -545,7 +550,7 @@
void FlagList::PrintHelp() {
#if V8_TARGET_ARCH_ARM
CpuFeatures::PrintTarget();
- CpuFeatures::ProbeWithoutIsolate();
+ CpuFeatures::Probe(serializer_enabled_);
CpuFeatures::PrintFeatures();
#endif // V8_TARGET_ARCH_ARM
=======================================
--- /branches/bleeding_edge/src/flags.h Tue Sep 10 11:13:55 2013 UTC
+++ /branches/bleeding_edge/src/flags.h Mon Apr 28 08:18:38 2014 UTC
@@ -63,7 +63,10 @@
// --flag=value (non-bool flags only, no spaces around '=')
// --flag value (non-bool flags only)
// -- (equivalent to --js_arguments, captures all remaining
args)
- static int SetFlagsFromCommandLine(int* argc, char** argv, bool
remove_flags);
+ static int SetFlagsFromCommandLine(int* argc,
+ char** argv,
+ bool remove_flags,
+ bool serializer_enabled = false);
// Set the flag values by parsing the string str. Splits string into argc
// substrings argv[], each of which consisting of non-white-space chars,
@@ -78,6 +81,10 @@
// Set flags as consequence of being implied by another flag.
static void EnforceFlagImplications();
+
+ private:
+ // TODO(svenpanne) Remove this when Serializer/startup has been
refactored.
+ static bool serializer_enabled_;
};
} } // namespace v8::internal
=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32.cc Thu Apr 17 14:45:06
2014 UTC
+++ /branches/bleeding_edge/src/ia32/assembler-ia32.cc Mon Apr 28 08:18:38
2014 UTC
@@ -89,13 +89,13 @@
}
-void CpuFeatures::Probe() {
+void CpuFeatures::Probe(bool serializer_enabled) {
ASSERT(!initialized_);
ASSERT(supported_ == 0);
#ifdef DEBUG
initialized_ = true;
#endif
- if (Serializer::enabled()) {
+ if (serializer_enabled) {
supported_ |= OS::CpuFeaturesImpliedByPlatform();
return; // No features if we might serialize.
}
=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32.h Wed Apr 16 11:38:56
2014 UTC
+++ /branches/bleeding_edge/src/ia32/assembler-ia32.h Mon Apr 28 08:18:38
2014 UTC
@@ -530,7 +530,7 @@
public:
// Detect features of the target CPU. Set safe defaults if the serializer
// is enabled (snapshots must be portable).
- static void Probe();
+ static void Probe(bool serializer_enabled);
// Check whether a feature is supported by the target CPU.
static bool IsSupported(CpuFeature f) {
@@ -563,6 +563,8 @@
return cross_compile_ == 0 ||
(cross_compile_ & mask) == mask;
}
+
+ static bool SupportsCrankshaft() { return IsSupported(SSE2); }
private:
static bool Check(CpuFeature f, uint64_t set) {
=======================================
--- /branches/bleeding_edge/src/ia32/cpu-ia32.cc Fri Aug 23 11:43:30 2013
UTC
+++ /branches/bleeding_edge/src/ia32/cpu-ia32.cc Mon Apr 28 08:18:38 2014
UTC
@@ -41,16 +41,6 @@
namespace v8 {
namespace internal {
-void CPU::SetUp() {
- CpuFeatures::Probe();
-}
-
-
-bool CPU::SupportsCrankshaft() {
- return CpuFeatures::IsSupported(SSE2);
-}
-
-
void CPU::FlushICache(void* start, size_t size) {
// No need to flush the instruction cache on Intel. On Intel instruction
// cache flushing is only necessary when multiple cores running the same
=======================================
--- /branches/bleeding_edge/src/isolate.cc Fri Apr 25 13:49:22 2014 UTC
+++ /branches/bleeding_edge/src/isolate.cc Mon Apr 28 08:18:38 2014 UTC
@@ -1808,7 +1808,7 @@
use_crankshaft_ = FLAG_crankshaft
&& !Serializer::enabled()
- && CPU::SupportsCrankshaft();
+ && CpuFeatures::SupportsCrankshaft();
if (function_entry_hook() != NULL) {
// When function entry hooking is in effect, we have to create the code
=======================================
--- /branches/bleeding_edge/src/mips/assembler-mips.cc Thu Apr 17 20:06:50
2014 UTC
+++ /branches/bleeding_edge/src/mips/assembler-mips.cc Mon Apr 28 08:18:38
2014 UTC
@@ -46,7 +46,6 @@
#ifdef DEBUG
bool CpuFeatures::initialized_ = false;
#endif
-bool CpuFeatures::hint_creating_snapshot_ = false;
unsigned CpuFeatures::supported_ = 0;
unsigned CpuFeatures::found_by_runtime_probing_only_ = 0;
unsigned CpuFeatures::cross_compile_ = 0;
@@ -101,22 +100,6 @@
};
return names[index];
}
-
-
-void CpuFeatures::SetHintCreatingSnapshot() {
- hint_creating_snapshot_ = true;
-}
-
-
-void CpuFeatures::ProbeWithoutIsolate() {
- Probe(hint_creating_snapshot_);
-}
-
-
-void CpuFeatures::Probe() {
- // The Serializer can only be queried after isolate initialization.
- Probe(Serializer::enabled());
-}
void CpuFeatures::Probe(bool serializer_enabled) {
=======================================
--- /branches/bleeding_edge/src/mips/assembler-mips.h Thu Apr 17 20:06:50
2014 UTC
+++ /branches/bleeding_edge/src/mips/assembler-mips.h Mon Apr 28 08:18:38
2014 UTC
@@ -425,12 +425,10 @@
public:
// Detect features of the target CPU. Set safe defaults if the serializer
// is enabled (snapshots must be portable).
- static void Probe();
+ static void Probe(bool serializer_enabled);
// A special case for printing target and features, which we want to do
// before initializing the isolate
- static void SetHintCreatingSnapshot();
- static void ProbeWithoutIsolate();
// Check whether a feature is supported by the target CPU.
static bool IsSupported(CpuFeature f) {
@@ -458,11 +456,10 @@
return cross_compile_ == 0 ||
(cross_compile_ & mask) == mask;
}
+
+ static bool SupportsCrankshaft() { return CpuFeatures::IsSupported(FPU);
}
private:
- static void Probe(bool serializer_enabled);
- static bool hint_creating_snapshot_;
-
static bool Check(CpuFeature f, unsigned set) {
return (set & flag2set(f)) != 0;
}
=======================================
--- /branches/bleeding_edge/src/mips/cpu-mips.cc Fri Aug 23 11:43:30 2013
UTC
+++ /branches/bleeding_edge/src/mips/cpu-mips.cc Mon Apr 28 08:18:38 2014
UTC
@@ -47,16 +47,6 @@
namespace internal {
-void CPU::SetUp() {
- CpuFeatures::Probe();
-}
-
-
-bool CPU::SupportsCrankshaft() {
- return CpuFeatures::IsSupported(FPU);
-}
-
-
void CPU::FlushICache(void* start, size_t size) {
// Nothing to do, flushing no instructions.
if (size == 0) {
=======================================
--- /branches/bleeding_edge/src/mksnapshot.cc Thu Apr 24 12:31:10 2014 UTC
+++ /branches/bleeding_edge/src/mksnapshot.cc Mon Apr 28 08:18:38 2014 UTC
@@ -301,15 +301,9 @@
// By default, log code create information in the snapshot.
i::FLAG_log_code = true;
-#if V8_TARGET_ARCH_ARM
- // Printing flags on ARM requires knowing if we intend to enable
- // the serializer or not.
- v8::internal::CpuFeatures::SetHintCreatingSnapshot();
-#endif
-
// Print the usage if an error occurs when parsing the command line
// flags or if the help flag is set.
- int result = i::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
+ int result = i::FlagList::SetFlagsFromCommandLine(&argc, argv, true,
true);
if (result > 0 || argc != 2 || i::FLAG_help) {
::printf("Usage: %s [flag] ... outfile\n", argv[0]);
i::FlagList::PrintHelp();
=======================================
--- /branches/bleeding_edge/src/v8.cc Fri Apr 25 13:49:22 2014 UTC
+++ /branches/bleeding_edge/src/v8.cc Mon Apr 28 08:18:38 2014 UTC
@@ -144,7 +144,7 @@
platform_ = new DefaultPlatform;
#endif
Sampler::SetUp();
- CPU::SetUp();
+ CpuFeatures::Probe(Serializer::enabled());
OS::PostSetUp();
ElementsAccessor::InitializeOncePerProcess();
LOperand::SetUpCaches();
=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64.cc Thu Apr 17 14:45:06
2014 UTC
+++ /branches/bleeding_edge/src/x64/assembler-x64.cc Mon Apr 28 08:18:38
2014 UTC
@@ -52,13 +52,13 @@
}
-void CpuFeatures::Probe() {
+void CpuFeatures::Probe(bool serializer_enabled) {
ASSERT(supported_ == CpuFeatures::kDefaultCpuFeatures);
#ifdef DEBUG
initialized_ = true;
#endif
supported_ = kDefaultCpuFeatures;
- if (Serializer::enabled()) {
+ if (serializer_enabled) {
supported_ |= OS::CpuFeaturesImpliedByPlatform();
return; // No features if we might serialize.
}
=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64.h Wed Apr 16 11:38:56
2014 UTC
+++ /branches/bleeding_edge/src/x64/assembler-x64.h Mon Apr 28 08:18:38
2014 UTC
@@ -450,7 +450,7 @@
public:
// Detect features of the target CPU. Set safe defaults if the serializer
// is enabled (snapshots must be portable).
- static void Probe();
+ static void Probe(bool serializer_enabled);
// Check whether a feature is supported by the target CPU.
static bool IsSupported(CpuFeature f) {
@@ -483,6 +483,8 @@
return cross_compile_ == 0 ||
(cross_compile_ & mask) == mask;
}
+
+ static bool SupportsCrankshaft() { return true; }
private:
static bool Check(CpuFeature f, uint64_t set) {
=======================================
--- /branches/bleeding_edge/src/x64/cpu-x64.cc Fri Aug 23 11:43:30 2013 UTC
+++ /branches/bleeding_edge/src/x64/cpu-x64.cc Mon Apr 28 08:18:38 2014 UTC
@@ -41,16 +41,6 @@
namespace v8 {
namespace internal {
-void CPU::SetUp() {
- CpuFeatures::Probe();
-}
-
-
-bool CPU::SupportsCrankshaft() {
- return true; // Yay!
-}
-
-
void CPU::FlushICache(void* start, size_t size) {
// No need to flush the instruction cache on Intel. On Intel instruction
// cache flushing is only necessary when multiple cores running the same
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.