blob: 275f7d62d33394a20acbe2dda65ed7defb539d6a [file] [log] [blame]
Ben Murdoch61f157c2016-09-16 13:49:30 +01001// Copyright 2016 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Flags: --no-inline-new
6
7function keyed_store(obj, key, value) {
8 obj[key] = value;
9}
10
11function foo() {
12 obj = {};
13 obj.smi = 1;
14 obj.dbl = 1.5;
15 obj.obj = {a:1};
16
17 // Transition keyed store IC to polymorphic.
18 keyed_store(obj, "smi", 100);
19 keyed_store(obj, "dbl", 100);
20 keyed_store(obj, "obj", 100);
21
22 // Now call with a FAST_SMI_ELEMENTS object.
23 var smi_array = [5, 1, 1];
24 keyed_store(smi_array, 1, 6);
25 // Transition from FAST_SMI_ELEMENTS to FAST_DOUBLE_ELEMENTS.
26 keyed_store(smi_array, 2, 1.2);
27}
28
29foo();