OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 15 matching lines...) Expand all Loading... |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 // Flags: --nofull-compiler --nofast-compiler | 28 // Flags: --nofull-compiler --nofast-compiler |
29 | 29 |
30 // Test paths in the code generator where values in specific registers | 30 // Test paths in the code generator where values in specific registers |
31 // get moved around. | 31 // get moved around. |
32 function identity(x) { | 32 function identity(x) { |
33 return x; | 33 return x; |
34 } | 34 } |
35 | 35 |
| 36 function lookup(w, a) { |
| 37 // This function tests a code path in the generation of a keyed load IC |
| 38 // where the key and the value are both in the same register. |
| 39 a = a; |
| 40 w[a] = a; |
| 41 } |
| 42 |
36 function cover_codegen_paths() { | 43 function cover_codegen_paths() { |
37 var x = 1; | 44 var x = 1; |
38 | 45 |
39 // This test depends on the fixed order of register allocation. We try to | 46 // This test depends on the fixed order of register allocation. We try to |
40 // get values in specific registers (ia32, x64): | 47 // get values in specific registers (ia32, x64): |
41 var a; // Register eax, rax. | 48 var a; // Register eax, rax. |
42 var b; // Register ebx, rbx. | 49 var b; // Register ebx, rbx. |
43 var c; // Register ecx, rcx. | 50 var c; // Register ecx, rcx. |
44 var d; // Register edx, rdx. | 51 var d; // Register edx, rdx. |
45 var di; // Register edi, rdi. | 52 var di; // Register edi, rdi. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 131 |
125 x = identity(-1073741824); | 132 x = identity(-1073741824); |
126 a = x + 1; | 133 a = x + 1; |
127 b = x + 1; | 134 b = x + 1; |
128 c = x + 1; | 135 c = x + 1; |
129 d = x + 1; | 136 d = x + 1; |
130 di = x + 1; | 137 di = x + 1; |
131 assertEquals(1073741824, 1 - di); | 138 assertEquals(1073741824, 1 - di); |
132 | 139 |
133 x = 3; | 140 x = 3; |
| 141 var w = { }; |
| 142 lookup(w, x); |
| 143 lookup(w, x); |
| 144 lookup(w, x); |
| 145 |
| 146 x = 3; // Terminate while loop. |
134 } | 147 } |
135 } | 148 } |
136 | 149 |
137 cover_codegen_paths(); | 150 cover_codegen_paths(); |
OLD | NEW |