[change-array-by-copy] Ship it

All the new methods copy the receiver instead of mutate it, and
therefore are labeled as not having side effects in debug-evaluate.

I2S with 3 LGTMs:
https://groups.google.com/a/chromium.org/g/blink-dev/c/ptKolvGLGWY/m/_18d7JS9AQAJ

Bug: v8:12764
Change-Id: Ief0ee2b0ef37343d263cff5a144de253aeeec8d0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4022166
Reviewed-by: Marja Hölttä <marja@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84225}
This commit is contained in:
Shu-yu Guo 2022-11-10 16:42:03 -08:00 committed by V8 LUCI CQ
parent 8f7c493cd1
commit b687a05920
2 changed files with 17 additions and 3 deletions

View File

@ -612,7 +612,11 @@ DebugInfo::SideEffectState BuiltinGetSideEffectState(Builtin id) {
case Builtin::kArrayPrototypeLastIndexOf:
case Builtin::kArrayPrototypeSlice:
case Builtin::kArrayPrototypeToLocaleString:
case Builtin::kArrayPrototypeToReversed:
case Builtin::kArrayPrototypeToSorted:
case Builtin::kArrayPrototypeToSpliced:
case Builtin::kArrayPrototypeToString:
case Builtin::kArrayPrototypeWith:
case Builtin::kArrayForEach:
case Builtin::kArrayEvery:
case Builtin::kArraySome:
@ -653,6 +657,9 @@ DebugInfo::SideEffectState BuiltinGetSideEffectState(Builtin id) {
case Builtin::kTypedArrayPrototypeReduce:
case Builtin::kTypedArrayPrototypeReduceRight:
case Builtin::kTypedArrayPrototypeForEach:
case Builtin::kTypedArrayPrototypeToReversed:
case Builtin::kTypedArrayPrototypeToSorted:
case Builtin::kTypedArrayPrototypeWith:
// ArrayBuffer builtins.
case Builtin::kArrayBufferConstructor:
case Builtin::kArrayBufferPrototypeGetByteLength:
@ -1119,6 +1126,7 @@ static bool TransitivelyCalledBuiltinHasNoSideEffect(Builtin caller,
case Builtin::kArrayReduceRightLoopContinuation:
case Builtin::kArraySomeLoopContinuation:
case Builtin::kArrayTimSort:
case Builtin::kArrayTimSortIntoCopy:
case Builtin::kCall_ReceiverIsAny:
case Builtin::kCall_ReceiverIsNotNullOrUndefined:
case Builtin::kCall_ReceiverIsNullOrUndefined:
@ -1145,6 +1153,8 @@ static bool TransitivelyCalledBuiltinHasNoSideEffect(Builtin caller,
case Builtin::kFindOrderedHashSetEntry:
case Builtin::kFlatMapIntoArray:
case Builtin::kFlattenIntoArray:
case Builtin::kGenericArrayToReversed:
case Builtin::kGenericArrayWith:
case Builtin::kGetProperty:
case Builtin::kHasProperty:
case Builtin::kCreateHTML:
@ -1170,6 +1180,7 @@ static bool TransitivelyCalledBuiltinHasNoSideEffect(Builtin caller,
case Builtin::kToName:
case Builtin::kToObject:
case Builtin::kToString:
case Builtin::kTypedArrayMergeSort:
#ifdef V8_IS_TSAN
case Builtin::kTSANRelaxedStore8IgnoreFP:
case Builtin::kTSANRelaxedStore8SaveFP:
@ -1208,6 +1219,8 @@ static bool TransitivelyCalledBuiltinHasNoSideEffect(Builtin caller,
case Builtin::kFastCreateDataProperty:
switch (caller) {
case Builtin::kArrayPrototypeSlice:
case Builtin::kArrayPrototypeToSpliced:
case Builtin::kArrayPrototypeWith:
case Builtin::kArrayFilter:
return true;
default:
@ -1216,6 +1229,7 @@ static bool TransitivelyCalledBuiltinHasNoSideEffect(Builtin caller,
case Builtin::kSetProperty:
switch (caller) {
case Builtin::kArrayPrototypeSlice:
case Builtin::kArrayPrototypeToSorted:
case Builtin::kTypedArrayPrototypeMap:
case Builtin::kStringPrototypeMatchAll:
return true;

View File

@ -234,8 +234,7 @@ DEFINE_BOOL(harmony_shipping, true, "enable all shipped harmony features")
#define HARMONY_STAGED_BASE(V) \
V(harmony_rab_gsab, \
"harmony ResizableArrayBuffer / GrowableSharedArrayBuffer") \
V(harmony_array_grouping, "harmony array grouping") \
V(harmony_change_array_by_copy, "harmony change-Array-by-copy")
V(harmony_array_grouping, "harmony array grouping")
#ifdef V8_INTL_SUPPORT
#define HARMONY_STAGED(V) HARMONY_STAGED_BASE(V)
@ -250,7 +249,8 @@ DEFINE_BOOL(harmony_shipping, true, "enable all shipped harmony features")
V(harmony_class_static_blocks, "harmony static initializer blocks") \
V(harmony_array_find_last, "harmony array find last helpers") \
V(harmony_import_assertions, "harmony import assertions") \
V(harmony_symbol_as_weakmap_key, "harmony symbols as weakmap keys")
V(harmony_symbol_as_weakmap_key, "harmony symbols as weakmap keys") \
V(harmony_change_array_by_copy, "harmony change-Array-by-copy")
#ifdef V8_INTL_SUPPORT
#define HARMONY_SHIPPING(V) \