Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Side by Side Diff: test/mjsunit/regress/regress-crbug-594183.js

Issue 1912593002: [ic] Restore PROPERTY key tracking in keyed ICs (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/ic/ic.h ('K') | « src/type-info.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // 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: --allow-natives-syntax
6
7 var global = {}
8
9 var fish = [
10 {'name': 'foo'},
11 {'name': 'bar'},
12 ];
13
14 for (var i = 0; i < fish.length; i++) {
15 global[fish[i].name] = 1;
16 }
17
18 function load() {
19 var sum = 0;
20 for (var i = 0; i < fish.length; i++) {
21 var name = fish[i].name;
22 sum += global[name];
23 }
24 return sum;
25 }
26
27 load();
28 load();
29 %OptimizeFunctionOnNextCall(load);
30 load();
31 assertOptimized(load);
32
33 function store() {
34 for (var i = 0; i < fish.length; i++) {
35 var name = fish[i].name;
36 global[name] = 1;
37 }
38 }
39
40 store();
41 store();
42 %OptimizeFunctionOnNextCall(store);
43 store();
44 assertOptimized(store);
45
46 // Regression test for KeyedStoreIC bug: would use PROPERTY mode erroneously.
47
48 function store_element(obj, key) {
49 obj[key] = 0;
50 }
51
52 var o1 = new Array(3);
53 var o2 = new Array(3);
54 o2.o2 = "o2";
55 var o3 = new Array(3);
56 o3.o3 = "o3";
57 var o4 = new Array(3);
58 o4.o4 = "o4";
59 var o5 = new Array(3);
60 o5.o5 = "o5";
61 // Make the KeyedStoreIC megamorphic.
62 store_element(o1, 0); // Premonomorphic
63 store_element(o1, 0); // Monomorphic
64 store_element(o2, 0); // 2-way polymorphic.
65 store_element(o3, 0); // 3-way polymorphic.
66 store_element(o4, 0); // 4-way polymorphic.
67 store_element(o5, 0); // Megamorphic.
68
69 function inferrable_store(key) {
70 store_element(o5, key);
71 }
72
73 inferrable_store(0);
74 inferrable_store(0);
75 %OptimizeFunctionOnNextCall(inferrable_store);
76 inferrable_store(0);
77 assertOptimized(inferrable_store);
78 // If |inferrable_store| emitted a generic keyed store, it won't deopt upon
79 // seeing a property name key. It should have inferred a receiver map and
80 // emitted an elements store, however.
81 inferrable_store("deopt");
82 assertUnoptimized(inferrable_store);
OLDNEW
« src/ic/ic.h ('K') | « src/type-info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698