Revision: 13844
Author: [email protected]
Date: Wed Mar 6 08:15:01 2013
Log: Make sure that on x86 we don't generate SSE2 code in the snapshot.
BUG=
Review URL: https://codereview.chromium.org/12391033
http://code.google.com/p/v8/source/detail?r=13844
Modified:
/branches/bleeding_edge/src/arm/assembler-arm.h
/branches/bleeding_edge/src/arm/builtins-arm.cc
/branches/bleeding_edge/src/assembler.cc
/branches/bleeding_edge/src/ia32/assembler-ia32.h
/branches/bleeding_edge/src/ia32/builtins-ia32.cc
/branches/bleeding_edge/src/ia32/code-stubs-ia32.cc
/branches/bleeding_edge/src/ia32/code-stubs-ia32.h
/branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
/branches/bleeding_edge/src/isolate.cc
/branches/bleeding_edge/src/mips/assembler-mips.h
/branches/bleeding_edge/src/mips/builtins-mips.cc
/branches/bleeding_edge/src/x64/assembler-x64.h
=======================================
--- /branches/bleeding_edge/src/arm/assembler-arm.h Tue Mar 5 02:48:16 2013
+++ /branches/bleeding_edge/src/arm/assembler-arm.h Wed Mar 6 08:15:01 2013
@@ -74,31 +74,10 @@
(static_cast<uint64_t>(1) << f)) != 0;
}
- class TryForceFeatureScope BASE_EMBEDDED {
- public:
- explicit TryForceFeatureScope(CpuFeature f)
- : old_supported_(CpuFeatures::supported_) {
- if (CanForce()) {
- CpuFeatures::supported_ |= (1u << f);
- }
- }
-
- ~TryForceFeatureScope() {
- if (CanForce()) {
- CpuFeatures::supported_ = old_supported_;
- }
- }
-
- private:
- static bool CanForce() {
- // It's only safe to temporarily force support of CPU features
- // when there's only a single isolate, which is guaranteed when
- // the serializer is enabled.
- return Serializer::enabled();
- }
-
- const unsigned old_supported_;
- };
+ static bool IsSafeForSnapshot(CpuFeature f) {
+ return (IsSupported(f) &&
+ (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f)));
+ }
private:
#ifdef DEBUG
=======================================
--- /branches/bleeding_edge/src/arm/builtins-arm.cc Wed Mar 6 07:11:27 2013
+++ /branches/bleeding_edge/src/arm/builtins-arm.cc Wed Mar 6 08:15:01 2013
@@ -1377,12 +1377,6 @@
void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
- CpuFeatures::TryForceFeatureScope scope(VFP3);
- if (!CPU::SupportsCrankshaft()) {
- __ Abort("Unreachable code: Cannot optimize without VFP3 support.");
- return;
- }
-
// Lookup the function in the JavaScript frame and push it as an
// argument to the on-stack replacement function.
__ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
=======================================
--- /branches/bleeding_edge/src/assembler.cc Tue Mar 5 02:48:16 2013
+++ /branches/bleeding_edge/src/assembler.cc Wed Mar 6 08:15:01 2013
@@ -186,9 +186,7 @@
#ifdef DEBUG
CpuFeatureScope::CpuFeatureScope(AssemblerBase* assembler, CpuFeature f)
: assembler_(assembler) {
- ASSERT(CpuFeatures::IsSupported(f));
- ASSERT(!Serializer::enabled() ||
- !CpuFeatures::IsFoundByRuntimeProbingOnly(f));
+ ASSERT(CpuFeatures::IsSafeForSnapshot(f));
old_enabled_ = assembler_->enabled_cpu_features();
uint64_t mask = static_cast<uint64_t>(1) << f;
// TODO(svenpanne) This special case below doesn't belong here!
=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32.h Tue Mar 5 02:48:16
2013
+++ /branches/bleeding_edge/src/ia32/assembler-ia32.h Wed Mar 6 08:15:01
2013
@@ -536,31 +536,10 @@
(static_cast<uint64_t>(1) << f)) != 0;
}
- class TryForceFeatureScope BASE_EMBEDDED {
- public:
- explicit TryForceFeatureScope(CpuFeature f)
- : old_supported_(CpuFeatures::supported_) {
- if (CanForce()) {
- CpuFeatures::supported_ |= (static_cast<uint64_t>(1) << f);
- }
- }
-
- ~TryForceFeatureScope() {
- if (CanForce()) {
- CpuFeatures::supported_ = old_supported_;
- }
- }
-
- private:
- static bool CanForce() {
- // It's only safe to temporarily force support of CPU features
- // when there's only a single isolate, which is guaranteed when
- // the serializer is enabled.
- return Serializer::enabled();
- }
-
- const uint64_t old_supported_;
- };
+ static bool IsSafeForSnapshot(CpuFeature f) {
+ return (IsSupported(f) &&
+ (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f)));
+ }
private:
#ifdef DEBUG
=======================================
--- /branches/bleeding_edge/src/ia32/builtins-ia32.cc Fri Mar 1 08:59:53
2013
+++ /branches/bleeding_edge/src/ia32/builtins-ia32.cc Wed Mar 6 08:15:01
2013
@@ -643,6 +643,8 @@
void Builtins::Generate_NotifyOSR(MacroAssembler* masm) {
// TODO(kasperl): Do we need to save/restore the XMM registers too?
+ // TODO(mvstanton): We should save these regs, do this in a future
+ // checkin.
// For now, we are relying on the fact that Runtime::NotifyOSR
// doesn't do any garbage collection which allows us to save/restore
@@ -1792,12 +1794,6 @@
void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
- CpuFeatures::TryForceFeatureScope scope(SSE2);
- if (!CpuFeatures::IsSupported(SSE2) && FLAG_debug_code) {
- __ Abort("Unreachable code: Cannot optimize without SSE2 support.");
- return;
- }
-
// Get the loop depth of the stack guard check. This is recorded in
// a test(eax, depth) instruction right after the call.
Label stack_check;
=======================================
--- /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Tue Mar 5 08:31:11
2013
+++ /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Wed Mar 6 08:15:01
2013
@@ -7516,11 +7516,9 @@
void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(
Isolate* isolate) {
- StoreBufferOverflowStub stub1(kDontSaveFPRegs);
- stub1.GetCode(isolate)->set_is_pregenerated(true);
-
- CpuFeatures::TryForceFeatureScope scope(SSE2);
- if (CpuFeatures::IsSupported(SSE2)) {
+ StoreBufferOverflowStub stub(kDontSaveFPRegs);
+ stub.GetCode(isolate)->set_is_pregenerated(true);
+ if (CpuFeatures::IsSafeForSnapshot(SSE2)) {
StoreBufferOverflowStub stub2(kSaveFPRegs);
stub2.GetCode(isolate)->set_is_pregenerated(true);
}
=======================================
--- /branches/bleeding_edge/src/ia32/code-stubs-ia32.h Tue Mar 5 02:48:16
2013
+++ /branches/bleeding_edge/src/ia32/code-stubs-ia32.h Wed Mar 6 08:15:01
2013
@@ -64,7 +64,9 @@
class StoreBufferOverflowStub: public PlatformCodeStub {
public:
explicit StoreBufferOverflowStub(SaveFPRegsMode save_fp)
- : save_doubles_(save_fp) { }
+ : save_doubles_(save_fp) {
+ ASSERT(CpuFeatures::IsSafeForSnapshot(SSE2) || save_fp ==
kDontSaveFPRegs);
+ }
void Generate(MacroAssembler* masm);
@@ -397,6 +399,7 @@
regs_(object, // An input reg.
address, // An input reg.
value) { // One scratch reg.
+ ASSERT(CpuFeatures::IsSafeForSnapshot(SSE2) || fp_mode ==
kDontSaveFPRegs);
}
enum Mode {
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Tue Mar 5
02:48:16 2013
+++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Wed Mar 6
08:15:01 2013
@@ -40,6 +40,12 @@
namespace internal {
+static SaveFPRegsMode GetSaveFPRegsMode() {
+ // We don't need to save floating point regs when generating the snapshot
+ return CpuFeatures::IsSafeForSnapshot(SSE2) ? kSaveFPRegs :
kDontSaveFPRegs;
+}
+
+
// When invoking builtins, we need to record the safepoint in the middle of
// the invoke instruction sequence generated by the macro assembler.
class SafepointGenerator : public CallWrapper {
@@ -2847,7 +2853,7 @@
offset,
value,
temp,
- kSaveFPRegs,
+ GetSaveFPRegsMode(),
EMIT_REMEMBERED_SET,
check_needed);
}
@@ -4179,7 +4185,7 @@
HeapObject::kMapOffset,
temp_map,
temp,
- kSaveFPRegs,
+ GetSaveFPRegsMode(),
OMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
}
@@ -4198,7 +4204,7 @@
offset,
value,
temp,
- kSaveFPRegs,
+ GetSaveFPRegsMode(),
EMIT_REMEMBERED_SET,
check_needed);
}
@@ -4213,7 +4219,7 @@
offset,
value,
object,
- kSaveFPRegs,
+ GetSaveFPRegsMode(),
EMIT_REMEMBERED_SET,
check_needed);
}
@@ -4360,7 +4366,7 @@
__ RecordWrite(elements,
key,
value,
- kSaveFPRegs,
+ GetSaveFPRegsMode(),
EMIT_REMEMBERED_SET,
check_needed);
}
=======================================
--- /branches/bleeding_edge/src/isolate.cc Wed Mar 6 02:49:34 2013
+++ /branches/bleeding_edge/src/isolate.cc Wed Mar 6 08:15:01 2013
@@ -2156,8 +2156,10 @@
}
if (!Serializer::enabled()) {
- // Ensure that the stub failure trampoline has been generated.
+ // Ensure that all stubs which need to be generated ahead of time, but
+ // cannot be serialized into the snapshot have been generated.
HandleScope scope(this);
+ StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(this);
CodeStub::GenerateFPStubs(this);
StubFailureTrampolineStub::GenerateAheadOfTime(this);
}
=======================================
--- /branches/bleeding_edge/src/mips/assembler-mips.h Tue Mar 5 02:48:16
2013
+++ /branches/bleeding_edge/src/mips/assembler-mips.h Wed Mar 6 08:15:01
2013
@@ -413,32 +413,6 @@
(static_cast<uint64_t>(1) << f)) != 0;
}
- class TryForceFeatureScope BASE_EMBEDDED {
- public:
- explicit TryForceFeatureScope(CpuFeature f)
- : old_supported_(CpuFeatures::supported_) {
- if (CanForce()) {
- CpuFeatures::supported_ |= (1u << f);
- }
- }
-
- ~TryForceFeatureScope() {
- if (CanForce()) {
- CpuFeatures::supported_ = old_supported_;
- }
- }
-
- private:
- static bool CanForce() {
- // It's only safe to temporarily force support of CPU features
- // when there's only a single isolate, which is guaranteed when
- // the serializer is enabled.
- return Serializer::enabled();
- }
-
- const unsigned old_supported_;
- };
-
private:
#ifdef DEBUG
static bool initialized_;
=======================================
--- /branches/bleeding_edge/src/mips/builtins-mips.cc Wed Mar 6 07:11:27
2013
+++ /branches/bleeding_edge/src/mips/builtins-mips.cc Wed Mar 6 08:15:01
2013
@@ -1409,12 +1409,6 @@
void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
- CpuFeatures::TryForceFeatureScope scope(VFP3);
- if (!CpuFeatures::IsSupported(FPU)) {
- __ Abort("Unreachable code: Cannot optimize without FPU support.");
- return;
- }
-
// Lookup the function in the JavaScript frame and push it as an
// argument to the on-stack replacement function.
__ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64.h Tue Mar 5 02:48:16 2013
+++ /branches/bleeding_edge/src/x64/assembler-x64.h Wed Mar 6 08:15:01 2013
@@ -473,6 +473,11 @@
return (found_by_runtime_probing_only_ &
(static_cast<uint64_t>(1) << f)) != 0;
}
+
+ static bool IsSafeForSnapshot(CpuFeature f) {
+ return (IsSupported(f) &&
+ (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f)));
+ }
private:
// Safe defaults include SSE2 and CMOV for X64. It is always available,
if
--
--
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/groups/opt_out.