From fbcc4a408e5d840166d64fe99de6d46b22287469 Mon Sep 17 00:00:00 2001 From: "erik.corry@gmail.com" Date: Thu, 27 Sep 2012 11:31:26 +0000 Subject: [PATCH] Add the VFP-ness to the minor number of the keyed store elements IC so that the version from the snapshot is not used if we have a more capable CPU at runtime. Review URL: https://chromiumcodereview.appspot.com/10984065 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12624 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/code-stubs-arm.cc | 6 ++++++ src/code-stubs.h | 20 ++++++++++++++++---- src/ia32/code-stubs-ia32.cc | 5 +++++ src/ic.h | 2 +- src/mips/code-stubs-mips.cc | 5 +++++ src/x64/code-stubs-x64.cc | 5 +++++ 6 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc index 02bf9c0..7ee0d39 100644 --- a/src/arm/code-stubs-arm.cc +++ b/src/arm/code-stubs-arm.cc @@ -7262,6 +7262,7 @@ static const AheadOfTimeWriteBarrierStubList kAheadOfTime[] = { #undef REG + bool RecordWriteStub::IsPregenerated() { for (const AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime; !entry->object.is(no_reg); @@ -7303,6 +7304,11 @@ void RecordWriteStub::GenerateFixedRegStubsAheadOfTime() { } +bool CodeStub::CanUseFPRegisters() { + return CpuFeatures::IsSupported(VFP2); +} + + // Takes the input in 3 registers: address_ value_ and object_. A pointer to // the value has just been written into the object, now this stub makes sure // we keep the GC informed. The word in the object where the value has been diff --git a/src/code-stubs.h b/src/code-stubs.h index f190632..a843841 100644 --- a/src/code-stubs.h +++ b/src/code-stubs.h @@ -162,6 +162,9 @@ class CodeStub BASE_EMBEDDED { // Lookup the code in the (possibly custom) cache. bool FindCodeInCache(Code** code_out); + protected: + static bool CanUseFPRegisters(); + private: // Nonvirtual wrapper around the stub-specific Generate function. Call // this function to set up the macro assembler and generate the code. @@ -998,13 +1001,15 @@ class KeyedStoreElementStub : public CodeStub { KeyedAccessGrowMode grow_mode) : is_js_array_(is_js_array), elements_kind_(elements_kind), - grow_mode_(grow_mode) { } + grow_mode_(grow_mode), + fp_registers_(CanUseFPRegisters()) { } Major MajorKey() { return KeyedStoreElement; } int MinorKey() { return ElementsKindBits::encode(elements_kind_) | IsJSArrayBits::encode(is_js_array_) | - GrowModeBits::encode(grow_mode_); + GrowModeBits::encode(grow_mode_) | + FPRegisters::encode(fp_registers_); } void Generate(MacroAssembler* masm); @@ -1013,10 +1018,12 @@ class KeyedStoreElementStub : public CodeStub { class ElementsKindBits: public BitField {}; class GrowModeBits: public BitField {}; class IsJSArrayBits: public BitField {}; + class FPRegisters: public BitField {}; bool is_js_array_; ElementsKind elements_kind_; KeyedAccessGrowMode grow_mode_; + bool fp_registers_; DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub); }; @@ -1132,14 +1139,19 @@ class ElementsTransitionAndStoreStub : public CodeStub { class StoreArrayLiteralElementStub : public CodeStub { public: - explicit StoreArrayLiteralElementStub() {} + StoreArrayLiteralElementStub() + : fp_registers_(CanUseFPRegisters()) { } private: + class FPRegisters: public BitField {}; + Major MajorKey() { return StoreArrayLiteralElement; } - int MinorKey() { return 0; } + int MinorKey() { return FPRegisters::encode(fp_registers_); } void Generate(MacroAssembler* masm); + bool fp_registers_; + DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); }; diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc index fa3711e..142abb5 100644 --- a/src/ia32/code-stubs-ia32.cc +++ b/src/ia32/code-stubs-ia32.cc @@ -7206,6 +7206,11 @@ void RecordWriteStub::GenerateFixedRegStubsAheadOfTime() { } +bool CodeStub::CanUseFPRegisters() { + return CpuFeatures::IsSupported(SSE2); +} + + // Takes the input in 3 registers: address_ value_ and object_. A pointer to // the value has just been written into the object, now this stub makes sure // we keep the GC informed. The word in the object where the value has been diff --git a/src/ic.h b/src/ic.h index 76867a9..8767f98 100644 --- a/src/ic.h +++ b/src/ic.h @@ -650,7 +650,7 @@ class KeyedStoreIC: public KeyedIC { } MUST_USE_RESULT MaybeObject* Store(State state, - StrictModeFlag strict_mode, + StrictModeFlag strict_mode, Handle object, Handle name, Handle value, diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc index 86af0dd..ee3127a 100644 --- a/src/mips/code-stubs-mips.cc +++ b/src/mips/code-stubs-mips.cc @@ -7512,6 +7512,11 @@ void RecordWriteStub::GenerateFixedRegStubsAheadOfTime() { } +bool CodeStub::CanUseFPRegisters() { + return CpuFeatures::IsSupported(FPU); +} + + // Takes the input in 3 registers: address_ value_ and object_. A pointer to // the value has just been written into the object, now this stub makes sure // we keep the GC informed. The word in the object where the value has been diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc index 79bb2d0..0bad960 100644 --- a/src/x64/code-stubs-x64.cc +++ b/src/x64/code-stubs-x64.cc @@ -6144,6 +6144,11 @@ void RecordWriteStub::GenerateFixedRegStubsAheadOfTime() { } +bool CodeStub::CanUseFPRegisters() { + return true; // Always have SSE2 on x64. +} + + // Takes the input in 3 registers: address_ value_ and object_. A pointer to // the value has just been written into the object, now this stub makes sure // we keep the GC informed. The word in the object where the value has been -- 2.7.4