v8/test/mjsunit/es6/proxies-ownkeys-clone.js
Mythri a508efa61d [ic] Update Clone/StoreInArrayLiteral builtins to handle no feedback case
Updates CloneIC builtin to take the CloneIC_slow path when there is no
feedback vector. Also fixes the CloneIC_Slow to handle proxies correctly.

StoreInArrayLiteralIC doesn't change the behaviour but just makes it
consistent with other ICs.

Bug: v8:8293
Change-Id: Ib824b3ef06db1595ce06f04669857bb957cbe072
Reviewed-on: https://chromium-review.googlesource.com/c/1475750
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59682}
2019-02-19 11:27:47 +00:00

26 lines
597 B
JavaScript

// Copyright 2019 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.
var p = new Proxy({a: 1, b: 2}, {
ownKeys() { return ['a', 'b']; }
});
// clone and return a
function f(a) {
var y = {...a}
return y;
}
// Call with different maps to force it into megamorphic state
f({a: 1, b: 2});
f({a1: 1, b1: 3});
f({a2: 1, b2: 3});
f({a3: 1, b3: 4});
f({a4: 1, b4: 5});
// Test that y was initialized correctly in the slow path
var clone = f(p);
assertEquals(clone.a, 1);
assertEquals(clone.b, 2);