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

Side by Side Diff: test/mjsunit/regress/regress-4121.js

Issue 1181163002: Map::TryUpdate() must be in sync with Map::Update(). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « test/cctest/test-migrations.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 2015 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 function Migrator(o) {
8 return o.foo;
9 }
10 function Loader(o) {
11 return o[0];
12 }
13
14 var first_smi_array = [1];
15 var second_smi_array = [2];
16 var first_object_array = ["first"];
17 var second_object_array = ["string"];
18
19 assertTrue(%HasFastSmiElements(first_smi_array));
20 assertTrue(%HasFastSmiElements(second_smi_array));
21 assertTrue(%HasFastObjectElements(first_object_array));
22 assertTrue(%HasFastObjectElements(second_object_array));
23
24 // Prepare identical transition chains for smi and object arrays.
25 first_smi_array.foo = 0;
26 second_smi_array.foo = 0;
27 first_object_array.foo = 0;
28 second_object_array.foo = 0;
29
30 // Collect type feedback for not-yet-deprecated original object array map.
31 for (var i = 0; i < 3; i++) Migrator(second_object_array);
32
33 // Blaze a migration trail for smi array maps.
34 // This marks the migrated smi array map as a migration target.
35 first_smi_array.foo = 0.5;
36 print(second_smi_array.foo);
37
38 // Deprecate original object array map.
39 // Use TryMigrate from deferred optimized code to migrate second object array.
40 first_object_array.foo = 0.5;
41 %OptimizeFunctionOnNextCall(Migrator);
42 Migrator(second_object_array);
43
44 // |second_object_array| now erroneously has a smi map.
45 // Optimized code assuming smi elements will expose this.
46
47 for (var i = 0; i < 3; i++) Loader(second_smi_array);
48 %OptimizeFunctionOnNextCall(Loader);
49 assertEquals("string", Loader(second_object_array));
50
51 // Any of the following checks will also fail:
52 assertTrue(%HasFastObjectElements(second_object_array));
53 assertFalse(%HasFastSmiElements(second_object_array));
54 assertTrue(%HaveSameMap(first_object_array, second_object_array));
55 assertFalse(%HaveSameMap(first_smi_array, second_object_array));
OLDNEW
« no previous file with comments | « test/cctest/test-migrations.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698