Commit 25d48ec3 authored by mvstanton's avatar mvstanton Committed by Commit bot

Vector ICs: Allow for more IC kinds.

We have plans to create more ICs, and we are out of bits to represent the Kind
in the flags field of the code object. The InlineCacheState can lose a bit
because it no longer needs the DEFAULT state. That state existed as a way to
detect errors where code incorrectly looked at a vector IC stub's
InlineCacheState instead of correctly determining said state from a glance at
the vector. This really isn't a danger anymore.

So, with the horse trading, we could now represent up to 32 code kinds.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#31666}
parent 798ce4e4
...@@ -975,7 +975,7 @@ class CallICStub: public PlatformCodeStub { ...@@ -975,7 +975,7 @@ class CallICStub: public PlatformCodeStub {
Code::Kind GetCodeKind() const override { return Code::CALL_IC; } Code::Kind GetCodeKind() const override { return Code::CALL_IC; }
InlineCacheState GetICState() const override { return DEFAULT; } InlineCacheState GetICState() const override { return GENERIC; }
ExtraICState GetExtraICState() const final { ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(minor_key_); return static_cast<ExtraICState>(minor_key_);
...@@ -2258,7 +2258,7 @@ class LoadICTrampolineStub : public PlatformCodeStub { ...@@ -2258,7 +2258,7 @@ class LoadICTrampolineStub : public PlatformCodeStub {
Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } Code::Kind GetCodeKind() const override { return Code::LOAD_IC; }
InlineCacheState GetICState() const final { return DEFAULT; } InlineCacheState GetICState() const final { return GENERIC; }
ExtraICState GetExtraICState() const final { ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(minor_key_); return static_cast<ExtraICState>(minor_key_);
...@@ -2294,7 +2294,7 @@ class VectorStoreICTrampolineStub : public PlatformCodeStub { ...@@ -2294,7 +2294,7 @@ class VectorStoreICTrampolineStub : public PlatformCodeStub {
Code::Kind GetCodeKind() const override { return Code::STORE_IC; } Code::Kind GetCodeKind() const override { return Code::STORE_IC; }
InlineCacheState GetICState() const final { return DEFAULT; } InlineCacheState GetICState() const final { return GENERIC; }
ExtraICState GetExtraICState() const final { ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(minor_key_); return static_cast<ExtraICState>(minor_key_);
...@@ -2332,7 +2332,7 @@ class CallICTrampolineStub : public PlatformCodeStub { ...@@ -2332,7 +2332,7 @@ class CallICTrampolineStub : public PlatformCodeStub {
Code::Kind GetCodeKind() const override { return Code::CALL_IC; } Code::Kind GetCodeKind() const override { return Code::CALL_IC; }
InlineCacheState GetICState() const final { return DEFAULT; } InlineCacheState GetICState() const final { return GENERIC; }
ExtraICState GetExtraICState() const final { ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(minor_key_); return static_cast<ExtraICState>(minor_key_);
...@@ -2358,7 +2358,7 @@ class LoadICStub : public PlatformCodeStub { ...@@ -2358,7 +2358,7 @@ class LoadICStub : public PlatformCodeStub {
void GenerateForTrampoline(MacroAssembler* masm); void GenerateForTrampoline(MacroAssembler* masm);
Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } Code::Kind GetCodeKind() const override { return Code::LOAD_IC; }
InlineCacheState GetICState() const final { return DEFAULT; } InlineCacheState GetICState() const final { return GENERIC; }
ExtraICState GetExtraICState() const final { ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(minor_key_); return static_cast<ExtraICState>(minor_key_);
} }
...@@ -2381,7 +2381,7 @@ class KeyedLoadICStub : public PlatformCodeStub { ...@@ -2381,7 +2381,7 @@ class KeyedLoadICStub : public PlatformCodeStub {
void GenerateForTrampoline(MacroAssembler* masm); void GenerateForTrampoline(MacroAssembler* masm);
Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; }
InlineCacheState GetICState() const final { return DEFAULT; } InlineCacheState GetICState() const final { return GENERIC; }
ExtraICState GetExtraICState() const final { ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(minor_key_); return static_cast<ExtraICState>(minor_key_);
} }
...@@ -2404,7 +2404,7 @@ class VectorStoreICStub : public PlatformCodeStub { ...@@ -2404,7 +2404,7 @@ class VectorStoreICStub : public PlatformCodeStub {
void GenerateForTrampoline(MacroAssembler* masm); void GenerateForTrampoline(MacroAssembler* masm);
Code::Kind GetCodeKind() const final { return Code::STORE_IC; } Code::Kind GetCodeKind() const final { return Code::STORE_IC; }
InlineCacheState GetICState() const final { return DEFAULT; } InlineCacheState GetICState() const final { return GENERIC; }
ExtraICState GetExtraICState() const final { ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(minor_key_); return static_cast<ExtraICState>(minor_key_);
} }
...@@ -2427,7 +2427,7 @@ class VectorKeyedStoreICStub : public PlatformCodeStub { ...@@ -2427,7 +2427,7 @@ class VectorKeyedStoreICStub : public PlatformCodeStub {
void GenerateForTrampoline(MacroAssembler* masm); void GenerateForTrampoline(MacroAssembler* masm);
Code::Kind GetCodeKind() const final { return Code::KEYED_STORE_IC; } Code::Kind GetCodeKind() const final { return Code::KEYED_STORE_IC; }
InlineCacheState GetICState() const final { return DEFAULT; } InlineCacheState GetICState() const final { return GENERIC; }
virtual ExtraICState GetExtraICState() const final { virtual ExtraICState GetExtraICState() const final {
return static_cast<ExtraICState>(minor_key_); return static_cast<ExtraICState>(minor_key_);
} }
......
...@@ -595,11 +595,7 @@ enum InlineCacheState { ...@@ -595,11 +595,7 @@ enum InlineCacheState {
// A generic handler is installed and no extra typefeedback is recorded. // A generic handler is installed and no extra typefeedback is recorded.
GENERIC, GENERIC,
// Special state for debug break or step in prepare stubs. // Special state for debug break or step in prepare stubs.
DEBUG_STUB, DEBUG_STUB
// Type-vector-based ICs have a default state, with the full calculation
// of IC state only determined by a look at the IC and the typevector
// together.
DEFAULT
}; };
......
...@@ -47,9 +47,6 @@ char IC::TransitionMarkFromState(IC::State state) { ...@@ -47,9 +47,6 @@ char IC::TransitionMarkFromState(IC::State state) {
// these cases fall through to the unreachable code below. // these cases fall through to the unreachable code below.
case DEBUG_STUB: case DEBUG_STUB:
break; break;
// Type-vector-based ICs resolve state to one of the above.
case DEFAULT:
break;
} }
UNREACHABLE(); UNREACHABLE();
return 0; return 0;
...@@ -388,7 +385,6 @@ static void ComputeTypeInfoCountDelta(IC::State old_state, IC::State new_state, ...@@ -388,7 +385,6 @@ static void ComputeTypeInfoCountDelta(IC::State old_state, IC::State new_state,
break; break;
case PROTOTYPE_FAILURE: case PROTOTYPE_FAILURE:
case DEBUG_STUB: case DEBUG_STUB:
case DEFAULT:
UNREACHABLE(); UNREACHABLE();
} }
} }
...@@ -918,7 +914,6 @@ void IC::PatchCache(Handle<Name> name, Handle<Code> code) { ...@@ -918,7 +914,6 @@ void IC::PatchCache(Handle<Name> name, Handle<Code> code) {
break; break;
case DEBUG_STUB: case DEBUG_STUB:
break; break;
case DEFAULT:
case GENERIC: case GENERIC:
UNREACHABLE(); UNREACHABLE();
break; break;
......
...@@ -13359,8 +13359,6 @@ const char* Code::ICState2String(InlineCacheState state) { ...@@ -13359,8 +13359,6 @@ const char* Code::ICState2String(InlineCacheState state) {
case MEGAMORPHIC: return "MEGAMORPHIC"; case MEGAMORPHIC: return "MEGAMORPHIC";
case GENERIC: return "GENERIC"; case GENERIC: return "GENERIC";
case DEBUG_STUB: return "DEBUG_STUB"; case DEBUG_STUB: return "DEBUG_STUB";
case DEFAULT:
return "DEFAULT";
} }
UNREACHABLE(); UNREACHABLE();
return NULL; return NULL;
......
...@@ -4855,9 +4855,9 @@ class Code: public HeapObject { ...@@ -4855,9 +4855,9 @@ class Code: public HeapObject {
NUMBER_OF_KINDS NUMBER_OF_KINDS
}; };
// No more than 16 kinds. The value is currently encoded in four bits in // No more than 32 kinds. The value is currently encoded in five bits in
// Flags. // Flags.
STATIC_ASSERT(NUMBER_OF_KINDS <= 16); STATIC_ASSERT(NUMBER_OF_KINDS <= 32);
static const char* Kind2String(Kind kind); static const char* Kind2String(Kind kind);
...@@ -5284,10 +5284,10 @@ class Code: public HeapObject { ...@@ -5284,10 +5284,10 @@ class Code: public HeapObject {
class ProfilerTicksField : public BitField<int, 4, 28> {}; class ProfilerTicksField : public BitField<int, 4, 28> {};
// Flags layout. BitField<type, shift, size>. // Flags layout. BitField<type, shift, size>.
class ICStateField : public BitField<InlineCacheState, 0, 4> {}; class ICStateField : public BitField<InlineCacheState, 0, 3> {};
class TypeField : public BitField<StubType, 4, 1> {}; class TypeField : public BitField<StubType, 3, 1> {};
class CacheHolderField : public BitField<CacheHolderFlag, 5, 2> {}; class CacheHolderField : public BitField<CacheHolderFlag, 4, 2> {};
class KindField : public BitField<Kind, 7, 4> {}; class KindField : public BitField<Kind, 6, 5> {};
class ExtraICStateField: public BitField<ExtraICState, 11, class ExtraICStateField: public BitField<ExtraICState, 11,
PlatformSmiTagging::kSmiValueSize - 11 + 1> {}; // NOLINT PlatformSmiTagging::kSmiValueSize - 11 + 1> {}; // NOLINT
......
...@@ -3818,16 +3818,12 @@ TEST(IncrementalMarkingPreservesMonomorphicIC) { ...@@ -3818,16 +3818,12 @@ TEST(IncrementalMarkingPreservesMonomorphicIC) {
Handle<JSFunction> f = Handle<JSFunction>::cast(v8::Utils::OpenHandle( Handle<JSFunction> f = Handle<JSFunction>::cast(v8::Utils::OpenHandle(
*v8::Handle<v8::Function>::Cast(CcTest::global()->Get(v8_str("f"))))); *v8::Handle<v8::Function>::Cast(CcTest::global()->Get(v8_str("f")))));
Code* ic_before = FindFirstIC(f->shared()->code(), Code::LOAD_IC);
CheckVectorIC(f, 0, MONOMORPHIC); CheckVectorIC(f, 0, MONOMORPHIC);
CHECK(ic_before->ic_state() == DEFAULT);
SimulateIncrementalMarking(CcTest::heap()); SimulateIncrementalMarking(CcTest::heap());
CcTest::heap()->CollectAllGarbage(); CcTest::heap()->CollectAllGarbage();
Code* ic_after = FindFirstIC(f->shared()->code(), Code::LOAD_IC);
CheckVectorIC(f, 0, MONOMORPHIC); CheckVectorIC(f, 0, MONOMORPHIC);
CHECK(ic_after->ic_state() == DEFAULT);
} }
...@@ -3850,18 +3846,14 @@ TEST(IncrementalMarkingClearsMonomorphicIC) { ...@@ -3850,18 +3846,14 @@ TEST(IncrementalMarkingClearsMonomorphicIC) {
Handle<JSFunction> f = Handle<JSFunction>::cast(v8::Utils::OpenHandle( Handle<JSFunction> f = Handle<JSFunction>::cast(v8::Utils::OpenHandle(
*v8::Handle<v8::Function>::Cast(CcTest::global()->Get(v8_str("f"))))); *v8::Handle<v8::Function>::Cast(CcTest::global()->Get(v8_str("f")))));
Code* ic_before = FindFirstIC(f->shared()->code(), Code::LOAD_IC);
CheckVectorIC(f, 0, MONOMORPHIC); CheckVectorIC(f, 0, MONOMORPHIC);
CHECK(ic_before->ic_state() == DEFAULT);
// Fire context dispose notification. // Fire context dispose notification.
CcTest::isolate()->ContextDisposedNotification(); CcTest::isolate()->ContextDisposedNotification();
SimulateIncrementalMarking(CcTest::heap()); SimulateIncrementalMarking(CcTest::heap());
CcTest::heap()->CollectAllGarbage(); CcTest::heap()->CollectAllGarbage();
Code* ic_after = FindFirstIC(f->shared()->code(), Code::LOAD_IC);
CheckVectorICCleared(f, 0); CheckVectorICCleared(f, 0);
CHECK(ic_after->ic_state() == DEFAULT);
} }
...@@ -3891,17 +3883,13 @@ TEST(IncrementalMarkingPreservesPolymorphicIC) { ...@@ -3891,17 +3883,13 @@ TEST(IncrementalMarkingPreservesPolymorphicIC) {
Handle<JSFunction> f = Handle<JSFunction>::cast(v8::Utils::OpenHandle( Handle<JSFunction> f = Handle<JSFunction>::cast(v8::Utils::OpenHandle(
*v8::Handle<v8::Function>::Cast(CcTest::global()->Get(v8_str("f"))))); *v8::Handle<v8::Function>::Cast(CcTest::global()->Get(v8_str("f")))));
Code* ic_before = FindFirstIC(f->shared()->code(), Code::LOAD_IC);
CheckVectorIC(f, 0, POLYMORPHIC); CheckVectorIC(f, 0, POLYMORPHIC);
CHECK(ic_before->ic_state() == DEFAULT);
// Fire context dispose notification. // Fire context dispose notification.
SimulateIncrementalMarking(CcTest::heap()); SimulateIncrementalMarking(CcTest::heap());
CcTest::heap()->CollectAllGarbage(); CcTest::heap()->CollectAllGarbage();
Code* ic_after = FindFirstIC(f->shared()->code(), Code::LOAD_IC);
CheckVectorIC(f, 0, POLYMORPHIC); CheckVectorIC(f, 0, POLYMORPHIC);
CHECK(ic_after->ic_state() == DEFAULT);
} }
...@@ -3931,9 +3919,7 @@ TEST(IncrementalMarkingClearsPolymorphicIC) { ...@@ -3931,9 +3919,7 @@ TEST(IncrementalMarkingClearsPolymorphicIC) {
Handle<JSFunction> f = Handle<JSFunction>::cast(v8::Utils::OpenHandle( Handle<JSFunction> f = Handle<JSFunction>::cast(v8::Utils::OpenHandle(
*v8::Handle<v8::Function>::Cast(CcTest::global()->Get(v8_str("f"))))); *v8::Handle<v8::Function>::Cast(CcTest::global()->Get(v8_str("f")))));
Code* ic_before = FindFirstIC(f->shared()->code(), Code::LOAD_IC);
CheckVectorIC(f, 0, POLYMORPHIC); CheckVectorIC(f, 0, POLYMORPHIC);
CHECK(ic_before->ic_state() == DEFAULT);
// Fire context dispose notification. // Fire context dispose notification.
CcTest::isolate()->ContextDisposedNotification(); CcTest::isolate()->ContextDisposedNotification();
...@@ -3941,7 +3927,6 @@ TEST(IncrementalMarkingClearsPolymorphicIC) { ...@@ -3941,7 +3927,6 @@ TEST(IncrementalMarkingClearsPolymorphicIC) {
CcTest::heap()->CollectAllGarbage(); CcTest::heap()->CollectAllGarbage();
CheckVectorICCleared(f, 0); CheckVectorICCleared(f, 0);
CHECK(ic_before->ic_state() == DEFAULT);
} }
......
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