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

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

Issue 6821009: Introduce runtime function %OptimizeFunctionOnNextCall to manually trigger optimization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // Check that %NewObjectFromBound looks at correct frame for inlined function. 49 // Check that %NewObjectFromBound looks at correct frame for inlined function.
50 function ff(x) { } 50 function ff(x) { }
51 function h(z2, y2) { 51 function h(z2, y2) {
52 var local_z = z2 >> 1; 52 var local_z = z2 >> 1;
53 ff(local_z); 53 ff(local_z);
54 var local_y = y2 >> 1; 54 var local_y = y2 >> 1;
55 ff(local_y); 55 ff(local_y);
56 return f(local_y, local_z); /* f should be inlined into h */ 56 return f(local_y, local_z); /* f should be inlined into h */
57 } 57 }
58 58
59 for (var i = 0; i < 100000; i++) f(2, 3); 59 for (var i = 0; i < 5; i++) f(2, 3);
60 %OptimizeFunctionOnNextCall(f);
61 %OptimizeFunctionOnNextCall(foo);
Mads Ager (chromium) 2011/04/11 11:06:38 Shouldn't be necessary.
Jakob Kummerow 2011/04/11 12:55:51 Done. This means foo no longer gets optimized (and
62 f(2, 3);
60 63
61 for (var i = 0; i < 100000; i++) g(3, 2); 64 for (var i = 0; i < 5; i++) g(3, 2);
65 %OptimizeFunctionOnNextCall(g);
66 g(3, 2);
62 67
63 for (var i = 0; i < 100000; i++) h(6, 4); 68 for (var i = 0; i < 5; i++) h(6, 4);
69 %OptimizeFunctionOnNextCall(h);
70 h(6, 4);
64 71
65 // Check that %_IsConstructCall returns correct value when inlined 72 // Check that %_IsConstructCall returns correct value when inlined
66 var NON_CONSTRUCT_MARKER = {}; 73 var NON_CONSTRUCT_MARKER = {};
67 var CONSTRUCT_MARKER = {}; 74 var CONSTRUCT_MARKER = {};
68 function baz() { 75 function baz() {
69 return (!%_IsConstructCall()) ? NON_CONSTRUCT_MARKER : CONSTRUCT_MARKER; 76 return (!%_IsConstructCall()) ? NON_CONSTRUCT_MARKER : CONSTRUCT_MARKER;
70 } 77 }
71 78
72 function bar(x, y, z) { 79 function bar(x, y, z) {
73 var non_construct = baz(); /* baz should be inlined */ 80 var non_construct = baz(); /* baz should be inlined */
74 assertEquals(non_construct, NON_CONSTRUCT_MARKER); 81 assertEquals(non_construct, NON_CONSTRUCT_MARKER);
75 var construct = new baz(); 82 var construct = new baz();
76 assertEquals(construct, CONSTRUCT_MARKER); 83 assertEquals(construct, CONSTRUCT_MARKER);
77 } 84 }
78 85
79 for (var i = 0; i < 100000; i++) new bar(1, 2, 3); 86 for (var i = 0; i < 5; i++) new bar(1, 2, 3);
87 %OptimizeFunctionOnNextCall(bar);
88 %OptimizeFunctionOnNextCall(baz);
Mads Ager (chromium) 2011/04/11 11:06:38 Shouldn't be needed.
Jakob Kummerow 2011/04/11 12:55:51 Done.
89 bar(1, 2, 3);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698