Commit 2e150bdf authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[cleanup] Remove dead code from Array#sort

R=jgruber@chromium.org

Bug: v8:8834
Change-Id: I36b3fc2e29111054caf395b6875f238bf43ab3de
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1518177
Auto-Submit: Simon Zünd <szuend@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60194}
parent 9e4948d8
...@@ -292,21 +292,6 @@ namespace array { ...@@ -292,21 +292,6 @@ namespace array {
} }
} }
UnsafeCast<CompareBuiltinFn>(implicit context: Context)(o: Object):
CompareBuiltinFn {
return %RawDownCast<CompareBuiltinFn>(o);
}
UnsafeCast<LoadFn>(implicit context: Context)(o: Object): LoadFn {
return %RawDownCast<LoadFn>(o);
}
UnsafeCast<StoreFn>(implicit context: Context)(o: Object): StoreFn {
return %RawDownCast<StoreFn>(o);
}
UnsafeCast<CanUseSameAccessorFn>(implicit context: Context)(o: Object):
CanUseSameAccessorFn {
return %RawDownCast<CanUseSameAccessorFn>(o);
}
builtin SortCompareDefault( builtin SortCompareDefault(
context: Context, comparefn: Object, x: Object, y: Object): Number { context: Context, comparefn: Object, x: Object, y: Object): Number {
assert(comparefn == Undefined); assert(comparefn == Undefined);
...@@ -353,14 +338,14 @@ namespace array { ...@@ -353,14 +338,14 @@ namespace array {
builtin CanUseSameAccessor<ElementsAccessor: type>( builtin CanUseSameAccessor<ElementsAccessor: type>(
context: Context, receiver: JSReceiver, initialReceiverMap: Object, context: Context, receiver: JSReceiver, initialReceiverMap: Object,
initialReceiverLength: Number): Boolean { initialReceiverLength: Number): Boolean {
const a: JSArray = UnsafeCast<JSArray>(receiver); if (receiver.map != initialReceiverMap) return False;
if (a.map != initialReceiverMap) return False;
assert(TaggedIsSmi(initialReceiverLength)); assert(TaggedIsSmi(initialReceiverLength));
let originalLength: Smi = UnsafeCast<Smi>(initialReceiverLength); const array = UnsafeCast<JSArray>(receiver);
if (UnsafeCast<Smi>(a.length) != originalLength) return False; const originalLength = UnsafeCast<Smi>(initialReceiverLength);
return True; return SelectBooleanConstant(
UnsafeCast<Smi>(array.length) == originalLength);
} }
CanUseSameAccessor<GenericElementsAccessor>( CanUseSameAccessor<GenericElementsAccessor>(
...@@ -373,8 +358,7 @@ namespace array { ...@@ -373,8 +358,7 @@ namespace array {
CanUseSameAccessor<DictionaryElements>( CanUseSameAccessor<DictionaryElements>(
context: Context, receiver: JSReceiver, initialReceiverMap: Object, context: Context, receiver: JSReceiver, initialReceiverMap: Object,
initialReceiverLength: Number): Boolean { initialReceiverLength: Number): Boolean {
let obj: JSReceiver = UnsafeCast<JSReceiver>(receiver); return SelectBooleanConstant(receiver.map == initialReceiverMap);
return SelectBooleanConstant(obj.map == initialReceiverMap);
} }
// Re-loading the stack-size is done in a few places. The small macro allows // Re-loading the stack-size is done in a few places. The small macro allows
...@@ -423,7 +407,7 @@ namespace array { ...@@ -423,7 +407,7 @@ namespace array {
sortState: SortState, requestedSize: Smi): FixedArray { sortState: SortState, requestedSize: Smi): FixedArray {
const minSize: Smi = SmiMax(kSortStateTempSize, requestedSize); const minSize: Smi = SmiMax(kSortStateTempSize, requestedSize);
const currentSize: Smi = UnsafeCast<Smi>(sortState.tempArray.length); const currentSize: Smi = sortState.tempArray.length;
if (currentSize >= minSize) { if (currentSize >= minSize) {
return sortState.tempArray; return sortState.tempArray;
} }
......
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