Commit 1bdf1001 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[turbofan] Don't specialize for keyed access with constant name

Instead optimize based on the name feedback. This simplifies matters
for concurrent optimization.

Drive-by: Rename "index" to "key" for clarity where appropriate.

Bug: v8:7790
Change-Id: Id6db1174c7840c24044bc655e0ffee6a5b0de21c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1559742
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60709}
parent a667b6b3
...@@ -614,11 +614,7 @@ StringData* StringData::GetCharAsString(JSHeapBroker* broker, uint32_t index, ...@@ -614,11 +614,7 @@ StringData* StringData::GetCharAsString(JSHeapBroker* broker, uint32_t index,
InternalizedStringData::InternalizedStringData( InternalizedStringData::InternalizedStringData(
JSHeapBroker* broker, ObjectData** storage, JSHeapBroker* broker, ObjectData** storage,
Handle<InternalizedString> object) Handle<InternalizedString> object)
: StringData(broker, storage, object) { : StringData(broker, storage, object) {}
if (!object->AsArrayIndex(&array_index_)) {
array_index_ = InternalizedStringRef::kNotAnArrayIndex;
}
}
namespace { namespace {
...@@ -2428,19 +2424,6 @@ base::Optional<double> StringRef::ToNumber() { ...@@ -2428,19 +2424,6 @@ base::Optional<double> StringRef::ToNumber() {
return data()->AsString()->to_number(); return data()->AsString()->to_number();
} }
uint32_t InternalizedStringRef::array_index() const {
if (broker()->mode() == JSHeapBroker::kDisabled) {
AllowHandleDereference allow_handle_dereference;
AllowHandleAllocation allow_handle_allocation;
uint32_t result;
if (!object()->AsArrayIndex(&result)) {
result = kNotAnArrayIndex;
}
return result;
}
return data()->AsInternalizedString()->array_index();
}
ObjectRef FixedArrayRef::get(int i) const { ObjectRef FixedArrayRef::get(int i) const {
if (broker()->mode() == JSHeapBroker::kDisabled) { if (broker()->mode() == JSHeapBroker::kDisabled) {
AllowHandleAllocation handle_allocation; AllowHandleAllocation handle_allocation;
......
...@@ -652,9 +652,6 @@ class InternalizedStringRef : public StringRef { ...@@ -652,9 +652,6 @@ class InternalizedStringRef : public StringRef {
public: public:
using StringRef::StringRef; using StringRef::StringRef;
Handle<InternalizedString> object() const; Handle<InternalizedString> object() const;
uint32_t array_index() const;
static const uint32_t kNotAnArrayIndex = -1; // 2^32-1 is not a valid index.
}; };
class ProcessedFeedback : public ZoneObject { class ProcessedFeedback : public ZoneObject {
......
...@@ -98,7 +98,7 @@ class V8_EXPORT_PRIVATE JSNativeContextSpecialization final ...@@ -98,7 +98,7 @@ class V8_EXPORT_PRIVATE JSNativeContextSpecialization final
AccessMode access_mode, AccessMode access_mode,
KeyedAccessLoadMode load_mode, KeyedAccessLoadMode load_mode,
KeyedAccessStoreMode store_mode); KeyedAccessStoreMode store_mode);
Reduction ReduceKeyedAccess(Node* node, Node* index, Node* value, Reduction ReduceKeyedAccess(Node* node, Node* key, Node* value,
FeedbackNexus const& nexus, FeedbackNexus const& nexus,
AccessMode access_mode, AccessMode access_mode,
KeyedAccessLoadMode load_mode, KeyedAccessLoadMode load_mode,
...@@ -110,15 +110,14 @@ class V8_EXPORT_PRIVATE JSNativeContextSpecialization final ...@@ -110,15 +110,14 @@ class V8_EXPORT_PRIVATE JSNativeContextSpecialization final
Reduction ReduceNamedAccess(Node* node, Node* value, Reduction ReduceNamedAccess(Node* node, Node* value,
MapHandles const& receiver_maps, MapHandles const& receiver_maps,
Handle<Name> name, AccessMode access_mode, Handle<Name> name, AccessMode access_mode,
Node* index = nullptr); Node* key = nullptr);
Reduction ReduceGlobalAccess(Node* node, Node* receiver, Node* value, Reduction ReduceGlobalAccess(Node* node, Node* receiver, Node* value,
Handle<Name> name, AccessMode access_mode, Handle<Name> name, AccessMode access_mode,
Node* index = nullptr); Node* key = nullptr);
Reduction ReduceGlobalAccess(Node* node, Node* receiver, Node* value, Reduction ReduceGlobalAccess(Node* node, Node* receiver, Node* value,
Handle<Name> name, AccessMode access_mode, Handle<Name> name, AccessMode access_mode,
Node* index, Node* key, PropertyCellRef const& property_cell);
PropertyCellRef const& property_cell); Reduction ReduceKeyedLoadFromHeapConstant(Node* node, Node* key,
Reduction ReduceKeyedLoadFromHeapConstant(Node* node, Node* index,
FeedbackNexus const& nexus, FeedbackNexus const& nexus,
AccessMode access_mode, AccessMode access_mode,
KeyedAccessLoadMode load_mode); KeyedAccessLoadMode load_mode);
......
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