Commit 9f773b6e authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[cleanup] Remove unused HasComplexElements runtime function

This CL also removes "HasComplexElements" helpers on JSReceiver
and NumberDictionary.

Drive-by: Remove unused SmiLexicographicCompare runtime function.
The C++ funtion is still used, but it is entered using a fast
C call from Array#sort.

Bug: v8:9183
Change-Id: Ibb5d54cca623486806587bc90506af8d97910dc2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1617929
Commit-Queue: Simon Zünd <szuend@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Auto-Submit: Simon Zünd <szuend@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61644}
parent 5ce68669
......@@ -261,7 +261,6 @@ bool IntrinsicHasNoSideEffect(Runtime::FunctionId id) {
V(GetProperty) \
/* Arrays */ \
V(ArraySpeciesConstructor) \
V(HasComplexElements) \
V(HasFastPackedElements) \
V(NewArray) \
V(NormalizeElements) \
......@@ -335,7 +334,6 @@ bool IntrinsicHasNoSideEffect(Runtime::FunctionId id) {
V(IncrementUseCounter) \
V(MaxSmi) \
V(NewObject) \
V(SmiLexicographicCompare) \
V(StringMaxLength) \
V(StringToArray) \
/* Test */ \
......
......@@ -7360,21 +7360,6 @@ Handle<SimpleNumberDictionary> SimpleNumberDictionary::Set(
return AtPut(isolate, dictionary, key, value, PropertyDetails::Empty());
}
bool NumberDictionary::HasComplexElements() {
if (!requires_slow_elements()) return false;
ReadOnlyRoots roots = GetReadOnlyRoots();
int capacity = this->Capacity();
for (int i = 0; i < capacity; i++) {
Object k;
if (!this->ToKey(roots, i, &k)) continue;
PropertyDetails details = this->DetailsAt(i);
if (details.kind() == kAccessor) return true;
PropertyAttributes attr = details.attributes();
if (attr & ALL_ATTRIBUTES_MASK) return true;
}
return false;
}
void NumberDictionary::UpdateMaxNumberKey(uint32_t key,
Handle<JSObject> dictionary_holder) {
DisallowHeapAllocation no_allocation;
......
......@@ -341,10 +341,6 @@ class NumberDictionary
static const int kMaxNumberKeyIndex = kPrefixStartIndex;
void UpdateMaxNumberKey(uint32_t key, Handle<JSObject> dictionary_holder);
// Returns true if the dictionary contains any elements that are non-writable,
// non-configurable, non-enumerable, or have getters/setters.
bool HasComplexElements();
// Sorting support
void CopyValuesTo(FixedArray elements);
......
......@@ -1995,16 +1995,6 @@ bool JSReceiver::HasProxyInPrototype(Isolate* isolate) {
return false;
}
bool JSReceiver::HasComplexElements() {
if (IsJSProxy()) return true;
JSObject this_object = JSObject::cast(*this);
if (this_object->HasIndexedInterceptor()) {
return true;
}
if (!this_object->HasDictionaryElements()) return false;
return this_object->element_dictionary()->HasComplexElements();
}
// static
MaybeHandle<JSObject> JSObject::New(Handle<JSFunction> constructor,
Handle<JSReceiver> new_target,
......
......@@ -268,8 +268,6 @@ class JSReceiver : public HeapObject {
TORQUE_GENERATED_JSRECEIVER_FIELDS)
bool HasProxyInPrototype(Isolate* isolate);
bool HasComplexElements();
V8_WARN_UNUSED_RESULT static MaybeHandle<FixedArray> GetPrivateEntries(
Isolate* isolate, Handle<JSReceiver> receiver);
......
......@@ -558,20 +558,6 @@ RUNTIME_FUNCTION(Runtime_GrowArrayElements) {
return object->elements();
}
RUNTIME_FUNCTION(Runtime_HasComplexElements) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0);
for (PrototypeIterator iter(isolate, array, kStartAtReceiver);
!iter.IsAtEnd(); iter.Advance()) {
if (PrototypeIterator::GetCurrent<JSReceiver>(iter)->HasComplexElements()) {
return ReadOnlyRoots(isolate).true_value();
}
}
return ReadOnlyRoots(isolate).false_value();
}
// ES6 22.1.2.2 Array.isArray
RUNTIME_FUNCTION(Runtime_ArrayIsArray) {
HandleScope shs(isolate);
......
......@@ -78,21 +78,6 @@ RUNTIME_FUNCTION(Runtime_NumberToString) {
return *isolate->factory()->NumberToString(number);
}
// Compare two Smis x, y as if they were converted to strings and then
// compared lexicographically. Returns:
// -1 if x < y
// 0 if x == y
// 1 if x > y
// TODO(szuend): Remove once the call-site in src/js/array.js is gone.
RUNTIME_FUNCTION(Runtime_SmiLexicographicCompare) {
SealHandleScope shs(isolate);
DCHECK_EQ(2, args.length());
CONVERT_ARG_CHECKED(Smi, x_value, 0);
CONVERT_ARG_CHECKED(Smi, y_value, 1);
return Object(Smi::LexicographicCompare(isolate, x_value, y_value));
}
RUNTIME_FUNCTION(Runtime_MaxSmi) {
SealHandleScope shs(isolate);
DCHECK_EQ(0, args.length());
......
......@@ -43,7 +43,6 @@ namespace internal {
F(ArrayIsArray, 1, 1) \
F(ArraySpeciesConstructor, 1, 1) \
F(GrowArrayElements, 2, 1) \
F(HasComplexElements, 1, 1) \
I(IsArray, 1, 1) \
F(NewArray, -1 /* >= 3 */, 1) \
F(NormalizeElements, 1, 1) \
......@@ -269,7 +268,6 @@ namespace internal {
F(IsValidSmi, 1, 1) \
F(MaxSmi, 0, 1) \
F(NumberToString, 1, 1) \
F(SmiLexicographicCompare, 2, 1) \
F(StringParseFloat, 1, 1) \
F(StringParseInt, 2, 1) \
F(StringToNumber, 1, 1)
......
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