Commit c8c95120 authored by palfia@homejinni.com's avatar palfia@homejinni.com

MIPS: Serializer enable/disable flags need thread safety.

Port r20855 (ac70e129)

BUG=
R=plind44@gmail.com

Review URL: https://codereview.chromium.org/239173004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20859 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 15721154
...@@ -46,6 +46,7 @@ namespace internal { ...@@ -46,6 +46,7 @@ namespace internal {
#ifdef DEBUG #ifdef DEBUG
bool CpuFeatures::initialized_ = false; bool CpuFeatures::initialized_ = false;
#endif #endif
bool CpuFeatures::hint_creating_snapshot_ = false;
unsigned CpuFeatures::supported_ = 0; unsigned CpuFeatures::supported_ = 0;
unsigned CpuFeatures::found_by_runtime_probing_only_ = 0; unsigned CpuFeatures::found_by_runtime_probing_only_ = 0;
unsigned CpuFeatures::cross_compile_ = 0; unsigned CpuFeatures::cross_compile_ = 0;
...@@ -102,7 +103,23 @@ const char* DoubleRegister::AllocationIndexToString(int index) { ...@@ -102,7 +103,23 @@ const char* DoubleRegister::AllocationIndexToString(int index) {
} }
void CpuFeatures::SetHintCreatingSnapshot() {
hint_creating_snapshot_ = true;
}
void CpuFeatures::ProbeWithoutIsolate() {
Probe(hint_creating_snapshot_);
}
void CpuFeatures::Probe() { void CpuFeatures::Probe() {
// The Serializer can only be queried after isolate initialization.
Probe(Serializer::enabled());
}
void CpuFeatures::Probe(bool serializer_enabled) {
unsigned standard_features = (OS::CpuFeaturesImpliedByPlatform() | unsigned standard_features = (OS::CpuFeaturesImpliedByPlatform() |
CpuFeaturesImpliedByCompiler()); CpuFeaturesImpliedByCompiler());
ASSERT(supported_ == 0 || ASSERT(supported_ == 0 ||
...@@ -116,7 +133,7 @@ void CpuFeatures::Probe() { ...@@ -116,7 +133,7 @@ void CpuFeatures::Probe() {
// snapshot. // snapshot.
supported_ |= standard_features; supported_ |= standard_features;
if (Serializer::enabled()) { if (serializer_enabled) {
// No probing for features if we might serialize (generate snapshot). // No probing for features if we might serialize (generate snapshot).
return; return;
} }
...@@ -2080,11 +2097,6 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { ...@@ -2080,11 +2097,6 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
if (!RelocInfo::IsNone(rinfo.rmode())) { if (!RelocInfo::IsNone(rinfo.rmode())) {
// Don't record external references unless the heap will be serialized. // Don't record external references unless the heap will be serialized.
if (rmode == RelocInfo::EXTERNAL_REFERENCE) { if (rmode == RelocInfo::EXTERNAL_REFERENCE) {
#ifdef DEBUG
if (!Serializer::enabled()) {
Serializer::TooLateToEnableNow();
}
#endif
if (!Serializer::enabled() && !emit_debug_code()) { if (!Serializer::enabled() && !emit_debug_code()) {
return; return;
} }
......
...@@ -427,6 +427,11 @@ class CpuFeatures : public AllStatic { ...@@ -427,6 +427,11 @@ class CpuFeatures : public AllStatic {
// is enabled (snapshots must be portable). // is enabled (snapshots must be portable).
static void Probe(); 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();
// Check whether a feature is supported by the target CPU. // Check whether a feature is supported by the target CPU.
static bool IsSupported(CpuFeature f) { static bool IsSupported(CpuFeature f) {
ASSERT(initialized_); ASSERT(initialized_);
...@@ -455,6 +460,9 @@ class CpuFeatures : public AllStatic { ...@@ -455,6 +460,9 @@ class CpuFeatures : public AllStatic {
} }
private: private:
static void Probe(bool serializer_enabled);
static bool hint_creating_snapshot_;
static bool Check(CpuFeature f, unsigned set) { static bool Check(CpuFeature f, unsigned set) {
return (set & flag2set(f)) != 0; return (set & flag2set(f)) != 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment