Commit 72200dde authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[cleanup] Remove unused GetArrayKeys runtime function

R=yangguo@chromium.org

Bug: v8:9183
Change-Id: I0f06c9a32983f7131a36ace1fd6873e88e375fe3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1617259
Commit-Queue: Yang Guo <yangguo@chromium.org>
Auto-Submit: Simon Zünd <szuend@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61610}
parent 06bf8261
......@@ -263,7 +263,6 @@ bool IntrinsicHasNoSideEffect(Runtime::FunctionId id) {
/* Arrays */ \
V(ArraySpeciesConstructor) \
V(EstimateNumberOfElements) \
V(GetArrayKeys) \
V(HasComplexElements) \
V(HasFastPackedElements) \
V(NewArray) \
......
......@@ -460,58 +460,6 @@ RUNTIME_FUNCTION(Runtime_EstimateNumberOfElements) {
}
}
// Returns an array that tells you where in the [0, length) interval an array
// might have elements. Can either return an array of keys (positive integers
// or undefined) or a number representing the positive length of an interval
// starting at index 0.
// Intervals can span over some keys that are not in the object.
RUNTIME_FUNCTION(Runtime_GetArrayKeys) {
HandleScope scope(isolate);
DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0);
CONVERT_NUMBER_CHECKED(uint32_t, length, Uint32, args[1]);
ElementsKind kind = array->GetElementsKind();
if (IsFastElementsKind(kind) || IsFixedTypedArrayElementsKind(kind)) {
uint32_t actual_length = static_cast<uint32_t>(array->elements()->length());
return *isolate->factory()->NewNumberFromUint(Min(actual_length, length));
}
if (kind == FAST_STRING_WRAPPER_ELEMENTS) {
int string_length =
String::cast(Handle<JSValue>::cast(array)->value())->length();
int backing_store_length = array->elements()->length();
return *isolate->factory()->NewNumberFromUint(
Min(length,
static_cast<uint32_t>(Max(string_length, backing_store_length))));
}
KeyAccumulator accumulator(isolate, KeyCollectionMode::kOwnOnly,
ALL_PROPERTIES);
for (PrototypeIterator iter(isolate, array, kStartAtReceiver);
!iter.IsAtEnd(); iter.Advance()) {
Handle<JSReceiver> current(PrototypeIterator::GetCurrent<JSReceiver>(iter));
if (current->HasComplexElements()) {
return *isolate->factory()->NewNumberFromUint(length);
}
accumulator.CollectOwnElementIndices(array,
Handle<JSObject>::cast(current));
}
// Erase any keys >= length.
Handle<FixedArray> keys =
accumulator.GetKeys(GetKeysConversion::kKeepNumbers);
int j = 0;
for (int i = 0; i < keys->length(); i++) {
if (NumberToUint32(keys->get(i)) >= length) continue;
if (i != j) keys->set(j, keys->get(i));
j++;
}
keys = FixedArray::ShrinkOrEmpty(isolate, keys, j);
return *isolate->factory()->NewJSArrayWithElements(keys);
}
RUNTIME_FUNCTION(Runtime_TrySliceSimpleNonFastElements) {
HandleScope scope(isolate);
DCHECK_EQ(3, args.length());
......
......@@ -43,7 +43,6 @@ namespace internal {
F(ArrayIsArray, 1, 1) \
F(ArraySpeciesConstructor, 1, 1) \
F(EstimateNumberOfElements, 1, 1) \
F(GetArrayKeys, 2, 1) \
F(GrowArrayElements, 2, 1) \
F(HasComplexElements, 1, 1) \
I(IsArray, 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