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

Side by Side Diff: test/mjsunit/strong-rooted-literals.js

Issue 2674593003: [TypeFeedbackVector] Root feedback vectors at function literal site. (Closed)
Patch Set: REBASE+liveedit fix. Created 3 years, 10 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
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 --expose-gc --turbo
6
7 // Make sure literals are strongly rooted and safe from weak-code deopts.
8
9 (function() {
10 function foo() {
11 var a = {y: 0};
12 a.y = 1;
13 return a;
14 }
15
16 foo();
17 foo();
18 % OptimizeFunctionOnNextCall(foo);
19 foo();
20 gc();
21 assertOptimized(foo);
22 })();
23
24 (function() {
25 function hot(o) {
26 return o.x + o.y;
27 }
28 function mapPlus(a, y) {
29 return a.map(x => hot({x, y}));
30 }
31
32 var a = [1, 2, 3];
33 print(mapPlus(a, 1));
34 print(mapPlus(a, 2));
35 % OptimizeFunctionOnNextCall(hot);
36 print(mapPlus(a, 3));
37 gc(); // BOOOM!
38 assertOptimized(hot);
39 print(mapPlus(a, 4));
40 })();
41
42 // Verify that we can handle the creation of a new script, where the
43 // code is cached and the feedback vector has to be re-created.
44 (function() {
45 var sopen = 'function wrapper() { ';
46 var s1 = 'function foo() { return bar(5); } ';
47 var s2 = 'foo(); foo(); %OptimizeFunctionOnNextCall(foo); foo(); ';
48 var sclose = '} wrapper(); ';
49 var s = sopen + s1 + s2 + sclose;
50 function bar(i){return i + 3};
51
52 for (var i = 0; i < 4; i++) {
53 eval(s);
54 }
55 })();
OLDNEW
« no previous file with comments | « test/cctest/test-serialize.cc ('k') | test/unittests/interpreter/interpreter-assembler-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698