OLD | NEW |
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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 for (var i = 0; i < N; i++) { | 164 for (var i = 0; i < N; i++) { |
165 old_array[i] = uint32_array[1]; | 165 old_array[i] = uint32_array[1]; |
166 } | 166 } |
167 } | 167 } |
168 | 168 |
169 FillOldArrayWithHeapNumbers(1); | 169 FillOldArrayWithHeapNumbers(1); |
170 FillOldArrayWithHeapNumbers(1); | 170 FillOldArrayWithHeapNumbers(1); |
171 %OptimizeFunctionOnNextCall(FillOldArrayWithHeapNumbers); | 171 %OptimizeFunctionOnNextCall(FillOldArrayWithHeapNumbers); |
172 FillOldArrayWithHeapNumbers(old_array.length); | 172 FillOldArrayWithHeapNumbers(old_array.length); |
173 gc(); | 173 gc(); |
| 174 |
| 175 // Test that HArgumentsObject does not prevent uint32 optimization and |
| 176 // that arguments object with uint32 values inside is correctly materialized. |
| 177 function Pack(x, y) { |
| 178 try { // Prevent inlining. |
| 179 return [x, y]; |
| 180 } catch (e) { |
| 181 } |
| 182 } |
| 183 |
| 184 function InnerWithArguments(x, f) { |
| 185 "use strict"; |
| 186 x >>>= 8; |
| 187 return f(arguments[0], x|0); |
| 188 } |
| 189 |
| 190 function Outer(v, f) { |
| 191 return InnerWithArguments(v >>> 0, f); |
| 192 } |
| 193 |
| 194 assertArrayEquals([0x0100, 0x01], Outer(0x0100, Pack)); |
| 195 assertArrayEquals([0x0100, 0x01], Outer(0x0100, Pack)); |
| 196 assertArrayEquals([0x0100, 0x01], Outer(0x0100, Pack)); |
| 197 %OptimizeFunctionOnNextCall(Outer); |
| 198 assertArrayEquals([0x0100, 0x01], Outer(0x0100, Pack)); |
| 199 assertArrayEquals([0xFFFFFFFF, 0x00FFFFFF], Outer(-1, Pack)); |
| 200 |
| 201 // Cause deopt inside InnerWithArguments by passing different pack function. |
| 202 assertArrayEquals([0xFFFFFFFF, 0x00FFFFFF], Outer(-1, function (x, y) { |
| 203 return [x, y]; |
| 204 })); |
OLD | NEW |