Reviewers: mvstanton,
Message:
ptal
Description:
update vector ics to handle megamorphic keyed loads
[email protected]
BUG=
Please review this at https://codereview.chromium.org/889863002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+33, -41 lines):
M src/code-stubs-hydrogen.cc
M src/heap/heap.h
M src/ic/ic.cc
M src/type-feedback-vector.h
M src/type-feedback-vector.cc
M src/type-feedback-vector-inl.h
M tools/v8heapconst.py
Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index
1f318b7c38157f2a1e4d008139f31b3136eb994f..c679d4c3f56bca0efde13b763756b81216526777
100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -2171,14 +2171,15 @@ HValue*
CodeStubGraphBuilder<VectorKeyedLoadStub>::BuildCodeStub() {
}
array_checker.Else();
{
- // Check if the IC is in generic state.
- IfBuilder generic_checker(this);
- HConstant* generic_symbol =
- Add<HConstant>(isolate()->factory()->generic_symbol());
- generic_checker.If<HCompareObjectEqAndBranch>(feedback,
generic_symbol);
- generic_checker.Then();
+ // Check if the IC is in megamorphic state.
+ IfBuilder megamorphic_checker(this);
+ HConstant* megamorphic_symbol =
+ Add<HConstant>(isolate()->factory()->megamorphic_symbol());
+ megamorphic_checker.If<HCompareObjectEqAndBranch>(feedback,
+ megamorphic_symbol);
+ megamorphic_checker.Then();
{
- // Tail-call to the generic KeyedLoadIC, treating it like a handler.
+ // Tail-call to the megamorphic KeyedLoadIC, treating it like a
handler.
Handle<Code> stub = KeyedLoadIC::ChooseMegamorphicStub(isolate());
HValue* constant_stub = Add<HConstant>(stub);
LoadDescriptor descriptor(isolate());
@@ -2187,7 +2188,7 @@ HValue*
CodeStubGraphBuilder<VectorKeyedLoadStub>::BuildCodeStub() {
Vector<HValue*>(op_vals, 3), TAIL_CALL);
// We never return here, it is a tail call.
}
- generic_checker.End();
+ megamorphic_checker.End();
}
array_checker.End();
Index: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index
643a1519f5fe980f5792ba0f6af5dc2ffcaa0b33..ceae148bbc1862e51a5133356ecc4ed7f3db2b73
100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -291,7 +291,6 @@ namespace internal {
V(uninitialized_symbol) \
V(megamorphic_symbol) \
V(premonomorphic_symbol) \
- V(generic_symbol) \
V(stack_trace_symbol) \
V(detailed_stack_trace_symbol) \
V(normal_ic_symbol) \
Index: src/ic/ic.cc
diff --git a/src/ic/ic.cc b/src/ic/ic.cc
index
7a2a36b39e60f7a75db2ea641e9b8b3c4ffa889c..6d002919c23d92215633f5cc22bffe339ea72555
100644
--- a/src/ic/ic.cc
+++ b/src/ic/ic.cc
@@ -637,10 +637,10 @@ void IC::ConfigureVectorState(IC::State new_state) {
}
} else if (kind() == Code::KEYED_LOAD_IC) {
KeyedLoadICNexus* nexus = casted_nexus<KeyedLoadICNexus>();
- if (new_state == GENERIC) {
- nexus->ConfigureGeneric();
- } else if (new_state == PREMONOMORPHIC) {
+ if (new_state == PREMONOMORPHIC) {
nexus->ConfigurePremonomorphic();
+ } else if (new_state == MEGAMORPHIC) {
+ nexus->ConfigureMegamorphic();
} else {
UNREACHABLE();
}
@@ -704,7 +704,7 @@ MaybeHandle<Object> LoadIC::Load(Handle<Object> object,
Handle<Name> name) {
// Rewrite to the generic keyed load stub.
if (FLAG_use_ic) {
if (UseVector()) {
- ConfigureVectorState(GENERIC);
+ ConfigureVectorState(MEGAMORPHIC);
} else {
set_target(*megamorphic_stub());
}
@@ -1433,7 +1433,7 @@ MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object>
object,
if (!is_vector_set() || stub.is_null()) {
Code* generic = *megamorphic_stub();
if (!stub.is_null() && *stub == generic) {
- ConfigureVectorState(GENERIC);
+ ConfigureVectorState(MEGAMORPHIC);
TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic");
}
Index: src/type-feedback-vector-inl.h
diff --git a/src/type-feedback-vector-inl.h b/src/type-feedback-vector-inl.h
index
612004ebee7e7dc9d4b7419f6563b92325e93da4..9b64082d35cec2f314bf5f255378bd65f996a565
100644
--- a/src/type-feedback-vector-inl.h
+++ b/src/type-feedback-vector-inl.h
@@ -30,11 +30,6 @@ Handle<Object>
TypeFeedbackVector::PremonomorphicSentinel(Isolate* isolate) {
}
-Handle<Object> TypeFeedbackVector::GenericSentinel(Isolate* isolate) {
- return isolate->factory()->generic_symbol();
-}
-
-
Handle<Object> TypeFeedbackVector::MonomorphicArraySentinel(
Isolate* isolate, ElementsKind elements_kind) {
return Handle<Object>(Smi::FromInt(static_cast<int>(elements_kind)),
isolate);
Index: src/type-feedback-vector.cc
diff --git a/src/type-feedback-vector.cc b/src/type-feedback-vector.cc
index
c51d9877f1c27c4e31fcdb02316a36c1883e2c92..2316f2979951fa285e85eb5d50c72323fafc4856
100644
--- a/src/type-feedback-vector.cc
+++ b/src/type-feedback-vector.cc
@@ -264,8 +264,8 @@ InlineCacheState KeyedLoadICNexus::StateFromFeedback()
const {
return UNINITIALIZED;
} else if (feedback == *vector()->PremonomorphicSentinel(isolate)) {
return PREMONOMORPHIC;
- } else if (feedback == *vector()->GenericSentinel(isolate)) {
- return GENERIC;
+ } else if (feedback == *vector()->MegamorphicSentinel(isolate)) {
+ return MEGAMORPHIC;
} else if (feedback->IsFixedArray()) {
// Determine state purely by our structure, don't check if the maps are
// cleared.
@@ -323,8 +323,8 @@ void
CallICNexus::ConfigureMonomorphic(Handle<JSFunction> function) {
}
-void KeyedLoadICNexus::ConfigureGeneric() {
- SetFeedback(*vector()->GenericSentinel(GetIsolate()),
SKIP_WRITE_BARRIER);
+void KeyedLoadICNexus::ConfigureMegamorphic() {
+ SetFeedback(*vector()->MegamorphicSentinel(GetIsolate()),
SKIP_WRITE_BARRIER);
}
Index: src/type-feedback-vector.h
diff --git a/src/type-feedback-vector.h b/src/type-feedback-vector.h
index
864f336f90cb733f3e2ce28d875383bc25782231..fee985191f6122890c598aa06424a38ecb325dda
100644
--- a/src/type-feedback-vector.h
+++ b/src/type-feedback-vector.h
@@ -175,9 +175,6 @@ class TypeFeedbackVector : public FixedArray {
// The object that indicates a premonomorphic state.
static inline Handle<Object> PremonomorphicSentinel(Isolate* isolate);
- // The object that indicates a generic state.
- static inline Handle<Object> GenericSentinel(Isolate* isolate);
-
// The object that indicates a monomorphic state of Array with
// ElementsKind
static inline Handle<Object> MonomorphicArraySentinel(
@@ -348,7 +345,7 @@ class KeyedLoadICNexus : public FeedbackNexus {
void Clear(Code* host);
- void ConfigureGeneric();
+ void ConfigureMegamorphic();
void ConfigurePremonomorphic();
// name can be a null handle for element loads.
void ConfigureMonomorphic(Handle<Name> name, Handle<HeapType> type,
Index: tools/v8heapconst.py
diff --git a/tools/v8heapconst.py b/tools/v8heapconst.py
index
8ef0c1093893d2283a512d1c6ff0c0577baf84d4..97045457b646901d5b2eb84599eb2f9197a13ca8
100644
--- a/tools/v8heapconst.py
+++ b/tools/v8heapconst.py
@@ -216,8 +216,8 @@ KNOWN_MAPS = {
0x08cd9: (187, "JSMessageObjectMap"),
0x08d01: (136, "ForeignMap"),
0x08d29: (189, "NeanderMap"),
- 0x08d51: (171, "AllocationMementoMap"),
- 0x08d79: (170, "AllocationSiteMap"),
+ 0x08d51: (170, "AllocationSiteMap"),
+ 0x08d79: (171, "AllocationMementoMap"),
0x08da1: (174, "PolymorphicCodeCacheMap"),
0x08dc9: (172, "ScriptMap"),
0x08e19: (189, "ExternalMap"),
@@ -255,16 +255,16 @@ KNOWN_OBJECTS = {
("OLD_POINTER_SPACE", 0x09531): "TerminationException",
("OLD_POINTER_SPACE", 0x09541): "MessageListeners",
("OLD_POINTER_SPACE", 0x0955d): "CodeStubs",
- ("OLD_POINTER_SPACE", 0x10f91): "NonMonomorphicCache",
- ("OLD_POINTER_SPACE", 0x115a5): "PolymorphicCodeCache",
- ("OLD_POINTER_SPACE", 0x115ad): "NativesSourceCache",
- ("OLD_POINTER_SPACE", 0x11621): "EmptyScript",
- ("OLD_POINTER_SPACE", 0x1165d): "IntrinsicFunctionNames",
- ("OLD_POINTER_SPACE", 0x17679): "ObservationState",
- ("OLD_POINTER_SPACE", 0x17685): "SymbolRegistry",
- ("OLD_POINTER_SPACE", 0x18041): "EmptySlowElementDictionary",
- ("OLD_POINTER_SPACE", 0x181dd): "AllocationSitesScratchpad",
- ("OLD_POINTER_SPACE", 0x4560d): "StringTable",
+ ("OLD_POINTER_SPACE", 0x1139d): "NonMonomorphicCache",
+ ("OLD_POINTER_SPACE", 0x119b1): "PolymorphicCodeCache",
+ ("OLD_POINTER_SPACE", 0x119b9): "NativesSourceCache",
+ ("OLD_POINTER_SPACE", 0x11a2d): "EmptyScript",
+ ("OLD_POINTER_SPACE", 0x11a69): "IntrinsicFunctionNames",
+ ("OLD_POINTER_SPACE", 0x17a85): "ObservationState",
+ ("OLD_POINTER_SPACE", 0x17a91): "SymbolRegistry",
+ ("OLD_POINTER_SPACE", 0x1844d): "EmptySlowElementDictionary",
+ ("OLD_POINTER_SPACE", 0x185e9): "AllocationSitesScratchpad",
+ ("OLD_POINTER_SPACE", 0x45d11): "StringTable",
("OLD_DATA_SPACE", 0x08081): "EmptyDescriptorArray",
("OLD_DATA_SPACE", 0x08089): "EmptyFixedArray",
("OLD_DATA_SPACE", 0x080a9): "NanValue",
@@ -290,6 +290,6 @@ KNOWN_OBJECTS = {
("OLD_DATA_SPACE", 0x082ed): "EmptyFixedUint8ClampedArray",
("OLD_DATA_SPACE", 0x082f5): "InfinityValue",
("OLD_DATA_SPACE", 0x08301): "MinusZeroValue",
- ("CODE_SPACE", 0x16881): "JsEntryCode",
- ("CODE_SPACE", 0x2a8e1): "JsConstructEntryCode",
+ ("CODE_SPACE", 0x17da1): "JsEntryCode",
+ ("CODE_SPACE", 0x2a921): "JsConstructEntryCode",
}
--
--
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.