[turboprop] Remove CompactElementsKind and its uses

We added this to add elements kind to handlers so Turboprop could
use the elements kind information for inlining array builtins when using
dynamic map checks. This information isn't useful without other map
based optimizations like constant folding to inline array builtins.
So we don't need this information.

Bug: v8:10582
Change-Id: I846c037ca2d87158dd017e2e23c7d1a0dfc685b4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2549950
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: Sathya Gunasekaran  <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71306}
This commit is contained in:
Mythri A 2020-11-19 17:46:03 +00:00 committed by Commit Bot
parent 2c66a0ef9f
commit b42136ea54
6 changed files with 12 additions and 58 deletions

View File

@ -48,20 +48,16 @@ Handle<Smi> LoadHandler::LoadSlow(Isolate* isolate) {
return handle(Smi::FromInt(config), isolate);
}
Handle<Smi> LoadHandler::LoadField(Isolate* isolate, FieldIndex field_index,
ElementsKind kind) {
Handle<Smi> LoadHandler::LoadField(Isolate* isolate, FieldIndex field_index) {
int config = KindBits::encode(kField) |
IsInobjectBits::encode(field_index.is_inobject()) |
IsDoubleBits::encode(field_index.is_double()) |
FieldIndexBits::encode(field_index.index()) |
CompactElementsKindBits::encode(ToCompactElementsKind(kind));
FieldIndexBits::encode(field_index.index());
return handle(Smi::FromInt(config), isolate);
}
Handle<Smi> LoadHandler::LoadConstantFromPrototype(Isolate* isolate,
ElementsKind kind) {
int config = KindBits::encode(kConstantFromPrototype) |
CompactElementsKindBits::encode(ToCompactElementsKind(kind));
Handle<Smi> LoadHandler::LoadConstantFromPrototype(Isolate* isolate) {
int config = KindBits::encode(kConstantFromPrototype);
return handle(Smi::FromInt(config), isolate);
}

View File

@ -335,22 +335,15 @@ void PrintSmiLoadHandler(int raw_handler, std::ostream& os) {
os << "kGlobal";
break;
case LoadHandler::Kind::kField: {
CompactElementsKind compact_elements_kind =
LoadHandler::CompactElementsKindBits::decode(raw_handler);
os << "kField, is in object = "
<< LoadHandler::IsInobjectBits::decode(raw_handler)
<< ", is double = " << LoadHandler::IsDoubleBits::decode(raw_handler)
<< ", field index = "
<< LoadHandler::FieldIndexBits::decode(raw_handler)
<< ", elements kind = "
<< CompactElementsKindToString(compact_elements_kind);
<< LoadHandler::FieldIndexBits::decode(raw_handler);
break;
}
case LoadHandler::Kind::kConstantFromPrototype: {
CompactElementsKind compact_elements_kind =
LoadHandler::CompactElementsKindBits::decode(raw_handler);
os << "kConstantFromPrototype, elements kind = "
<< CompactElementsKindToString(compact_elements_kind);
os << "kConstantFromPrototype ";
break;
}
case LoadHandler::Kind::kAccessor:

View File

@ -80,9 +80,8 @@ class LoadHandler final : public DataHandler {
// +1 here is to cover all possible JSObject header sizes.
using FieldIndexBits =
IsDoubleBits::Next<unsigned, kDescriptorIndexBitCount + 1>;
using CompactElementsKindBits = FieldIndexBits::Next<CompactElementsKind, 3>;
// Make sure we don't overflow the smi.
STATIC_ASSERT(CompactElementsKindBits::kLastUsedBit < kSmiValueSize);
STATIC_ASSERT(FieldIndexBits::kLastUsedBit < kSmiValueSize);
//
// Encoding when KindBits contains kElement or kIndexedString.
@ -122,13 +121,11 @@ class LoadHandler final : public DataHandler {
static inline Handle<Smi> LoadSlow(Isolate* isolate);
// Creates a Smi-handler for loading a field from fast object.
static inline Handle<Smi> LoadField(Isolate* isolate, FieldIndex field_index,
ElementsKind kind);
static inline Handle<Smi> LoadField(Isolate* isolate, FieldIndex field_index);
// Creates a Smi-handler for loading a cached constant from fast
// prototype object.
static inline Handle<Smi> LoadConstantFromPrototype(Isolate* isolate,
ElementsKind kind);
static inline Handle<Smi> LoadConstantFromPrototype(Isolate* isolate);
// Creates a Smi-handler for calling a getter on a fast object.
static inline Handle<Smi> LoadAccessor(Isolate* isolate, int descriptor);

View File

@ -844,7 +844,7 @@ Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) {
if (Accessors::IsJSObjectFieldAccessor(isolate(), map, lookup->name(),
&index)) {
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadFieldDH);
return LoadHandler::LoadField(isolate(), index, map->elements_kind());
return LoadHandler::LoadField(isolate(), index);
}
if (holder->IsJSModuleNamespace()) {
Handle<ObjectHashTable> exports(
@ -977,8 +977,7 @@ Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) {
} else {
DCHECK_EQ(kField, lookup->property_details().location());
FieldIndex field = lookup->GetFieldIndex();
smi_handler =
LoadHandler::LoadField(isolate(), field, map->elements_kind());
smi_handler = LoadHandler::LoadField(isolate(), field);
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadFieldDH);
if (holder_is_lookup_start_object) return smi_handler;
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadFieldFromPrototypeDH);
@ -1004,8 +1003,7 @@ Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) {
value->IsSmi() ? MaybeObjectHandle(*value, isolate())
: MaybeObjectHandle::Weak(*value, isolate());
smi_handler = LoadHandler::LoadConstantFromPrototype(
isolate(), map->elements_kind());
smi_handler = LoadHandler::LoadConstantFromPrototype(isolate());
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadConstantFromPrototypeDH);
return LoadHandler::LoadFromPrototype(isolate(), map, holder,
smi_handler, weak_value);

View File

@ -115,13 +115,6 @@ const char* ElementsKindToString(ElementsKind kind) {
}
}
const char* CompactElementsKindToString(CompactElementsKind kind) {
if (kind == CompactElementsKind::NON_COMPACT_ELEMENTS_KIND) {
return "NON_COMPACT_ELEMENTS_KIND";
}
return ElementsKindToString(static_cast<ElementsKind>(kind));
}
const ElementsKind kFastElementsKindSequence[kFastElementsKindCount] = {
PACKED_SMI_ELEMENTS, // 0
HOLEY_SMI_ELEMENTS, // 1

View File

@ -350,29 +350,6 @@ inline bool IsTransitionableFastElementsKind(ElementsKind from_kind) {
inline bool ElementsKindEqual(ElementsKind a, ElementsKind b) { return a == b; }
enum class CompactElementsKind : uint8_t {
PACKED_SMI_ELEMENTS = PACKED_SMI_ELEMENTS,
HOLEY_SMI_ELEMENTS = HOLEY_SMI_ELEMENTS,
PACKED_ELEMENTS = PACKED_ELEMENTS,
HOLEY_ELEMENTS = HOLEY_ELEMENTS,
PACKED_DOUBLE_ELEMENTS = PACKED_DOUBLE_ELEMENTS,
HOLEY_DOUBLE_ELEMENTS = HOLEY_DOUBLE_ELEMENTS,
NON_COMPACT_ELEMENTS_KIND
};
inline CompactElementsKind ToCompactElementsKind(ElementsKind kind) {
if (base::IsInRange(kind, PACKED_SMI_ELEMENTS, HOLEY_DOUBLE_ELEMENTS)) {
return static_cast<CompactElementsKind>(kind);
}
return CompactElementsKind::NON_COMPACT_ELEMENTS_KIND;
}
const char* CompactElementsKindToString(CompactElementsKind kind);
} // namespace internal
} // namespace v8