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

Side by Side Diff: test/mjsunit/osr-elements-kind.js

Issue 18214005: Added %NeverOptimize runtime call that can disable optimizations for a method for tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 expected = elements_kind.fast; 106 expected = elements_kind.fast;
107 } 107 }
108 assertEquals(expected, getKind(obj), name_opt); 108 assertEquals(expected, getKind(obj), name_opt);
109 } 109 }
110 110
111 // long-running loop forces OSR. 111 // long-running loop forces OSR.
112 for (var i = 0; i < 1000000; i++) { } 112 for (var i = 0; i < 1000000; i++) { }
113 113
114 if (support_smi_only_arrays) { 114 if (support_smi_only_arrays) {
115 function construct_smis() { 115 function construct_smis() {
116 try {} catch (e) {} // TODO(titzer): DisableOptimization 116 %NeverOptimize();
117 var a = [0, 0, 0]; 117 var a = [0, 0, 0];
118 a[0] = 0; // Send the COW array map to the steak house. 118 a[0] = 0; // Send the COW array map to the steak house.
119 assertKind(elements_kind.fast_smi_only, a); 119 assertKind(elements_kind.fast_smi_only, a);
120 return a; 120 return a;
121 } 121 }
122 function construct_doubles() { 122 function construct_doubles() {
123 try {} catch (e) {} // TODO(titzer): DisableOptimization 123 %NeverOptimize();
124 var a = construct_smis(); 124 var a = construct_smis();
125 a[0] = 1.5; 125 a[0] = 1.5;
126 assertKind(elements_kind.fast_double, a); 126 assertKind(elements_kind.fast_double, a);
127 return a; 127 return a;
128 } 128 }
129 129
130 // Test transition chain SMI->DOUBLE->FAST (crankshafted function will 130 // Test transition chain SMI->DOUBLE->FAST (crankshafted function will
131 // transition to FAST directly). 131 // transition to FAST directly).
132 function convert_mixed(array, value, kind) { 132 function convert_mixed(array, value, kind) {
133 try {} catch (e) {} // TODO(titzer): DisableOptimization 133 %NeverOptimize();
134 array[1] = value; 134 array[1] = value;
135 assertKind(kind, array); 135 assertKind(kind, array);
136 assertEquals(value, array[1]); 136 assertEquals(value, array[1]);
137 } 137 }
138 smis = construct_smis(); 138 smis = construct_smis();
139 convert_mixed(smis, 1.5, elements_kind.fast_double); 139 convert_mixed(smis, 1.5, elements_kind.fast_double);
140 140
141 doubles = construct_doubles(); 141 doubles = construct_doubles();
142 convert_mixed(doubles, "three", elements_kind.fast); 142 convert_mixed(doubles, "three", elements_kind.fast);
143 143
144 convert_mixed(construct_smis(), "three", elements_kind.fast); 144 convert_mixed(construct_smis(), "three", elements_kind.fast);
145 convert_mixed(construct_doubles(), "three", elements_kind.fast); 145 convert_mixed(construct_doubles(), "three", elements_kind.fast);
146 146
147 smis = construct_smis(); 147 smis = construct_smis();
148 doubles = construct_doubles(); 148 doubles = construct_doubles();
149 convert_mixed(smis, 1, elements_kind.fast); 149 convert_mixed(smis, 1, elements_kind.fast);
150 convert_mixed(doubles, 1, elements_kind.fast); 150 convert_mixed(doubles, 1, elements_kind.fast);
151 assertTrue(%HaveSameMap(smis, doubles)); 151 assertTrue(%HaveSameMap(smis, doubles));
152 } 152 }
153 153
154 // Throw away type information in the ICs for next stress run. 154 // Throw away type information in the ICs for next stress run.
155 gc(); 155 gc();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698