v8/test/mjsunit/keyed-store-generic.js
Sigurd Schneider 30be479711 Reland "[builtins] Separate species protectors for Array, TypedArray, Promise"
This is a reland of 5728b3fbc5

Original change's description:
> [builtins] Separate species protectors for Array, TypedArray, Promise
> 
> Previously, there was one species protector for Array, TypedArray and
> Promise. This CL splits the protector in three separate ones. This means
> that invalidating one of them does not have negative performance
> implications for the other ones.
> 
> Bug: chromium:835347, v8:7340
> Change-Id: Id84aa0071f17096192965264eb60ddadd1e8e73f
> Reviewed-on: https://chromium-review.googlesource.com/1023408
> Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#52733}

Bug: chromium:835347, v8:7340
Change-Id: I0c0188a0723e206ddb362834bcf872b23cd7666d
Reviewed-on: https://chromium-review.googlesource.com/1023811
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52742}
2018-04-23 17:52:50 +00:00

23 lines
687 B
JavaScript

// 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 --no-stress-opt
function f(a, i, v) { a[i] = v; }
f("make it generic", 0, 0);
(function TestIsConcatSpreadableProtector() {
var o = {length: 1, '0': 99};
%OptimizeObjectForAddingMultipleProperties(o, 0);
f(o, Symbol.isConcatSpreadable, true);
assertEquals([99], [].concat(o));
})();
(function TestSpeciesProtector() {
function MyArray() {}
assertTrue(%ArraySpeciesProtector());
f(Array.prototype, "constructor", MyArray);
assertFalse(%ArraySpeciesProtector());
})();