2017-02-19 03:49:33 +00:00
|
|
|
// Copyright 2017 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
var array = [1.7, 1.7, 1.7];
|
|
|
|
var mutator = {
|
|
|
|
[Symbol.toPrimitive]() {
|
2019-06-12 14:00:50 +00:00
|
|
|
Object.defineProperties(
|
|
|
|
array, {0: {get() {}}, 1: {get() {}}, 2: {get() {}}});
|
|
|
|
|
2017-02-19 03:49:33 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
assertTrue(array.includes(undefined, mutator));
|
|
|
|
|
|
|
|
function search(array, searchElement, startIndex) {
|
|
|
|
return array.includes(searchElement, startIndex);
|
2019-06-12 14:00:50 +00:00
|
|
|
};
|
|
|
|
%PrepareFunctionForOptimization(search);
|
2017-02-19 03:49:33 +00:00
|
|
|
array = [1.7, 1.7, 1.7];
|
2019-06-12 14:00:50 +00:00
|
|
|
var not_mutator = {
|
|
|
|
[Symbol.toPrimitive]() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
};
|
2017-02-19 03:49:33 +00:00
|
|
|
assertFalse(search(array, undefined, not_mutator));
|
|
|
|
assertFalse(search(array, undefined, not_mutator));
|
|
|
|
%OptimizeFunctionOnNextCall(search);
|
|
|
|
assertTrue(search(array, undefined, mutator));
|