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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 invoke(g1, [3, 2]); | 119 invoke(g1, [3, 2]); |
120 invoke(g2, [3, 2, 4]); | 120 invoke(g2, [3, 2, 4]); |
121 invoke(g3, [4, 3, 2]); | 121 invoke(g3, [4, 3, 2]); |
122 invoke(h1, [6, 4]); | 122 invoke(h1, [6, 4]); |
123 invoke(h2, [6, 4, 8]); | 123 invoke(h2, [6, 4, 8]); |
124 invoke(h3, [8, 6, 4]); | 124 invoke(h3, [8, 6, 4]); |
125 | 125 |
126 // Check that %_IsConstructCall returns correct value when inlined | 126 // Check that %_IsConstructCall returns correct value when inlined |
127 var NON_CONSTRUCT_MARKER = {}; | 127 var NON_CONSTRUCT_MARKER = {}; |
128 var CONSTRUCT_MARKER = {}; | 128 var CONSTRUCT_MARKER = {}; |
129 function baz(x) { | 129 function baz1(x) { |
130 return (!%_IsConstructCall()) ? NON_CONSTRUCT_MARKER : CONSTRUCT_MARKER; | 130 return (!%_IsConstructCall()) ? NON_CONSTRUCT_MARKER : CONSTRUCT_MARKER; |
131 } | 131 } |
132 | 132 |
133 function bar(x, y, z) { | 133 function bar1(x, y, z) { |
134 var non_construct = baz(0); /* baz should be inlined */ | 134 var non_construct = baz1(0); /* baz should be inlined */ |
135 assertEquals(non_construct, NON_CONSTRUCT_MARKER); | 135 assertSame(non_construct, NON_CONSTRUCT_MARKER); |
136 var non_construct = baz(); /* baz should be inlined */ | 136 var non_construct = baz1(); /* baz should be inlined */ |
137 assertEquals(non_construct, NON_CONSTRUCT_MARKER); | 137 assertSame(non_construct, NON_CONSTRUCT_MARKER); |
138 var non_construct = baz(0, 0); /* baz should be inlined */ | 138 var non_construct = baz1(0, 0); /* baz should be inlined */ |
139 assertEquals(non_construct, NON_CONSTRUCT_MARKER); | 139 assertSame(non_construct, NON_CONSTRUCT_MARKER); |
140 var construct = new baz(0); | 140 var construct = new baz1(0); |
141 assertEquals(construct, CONSTRUCT_MARKER); | 141 assertSame(construct, CONSTRUCT_MARKER); |
| 142 var construct = new baz1(0, 0); |
| 143 assertSame(construct, CONSTRUCT_MARKER); |
142 } | 144 } |
143 | 145 |
144 invoke(bar, [1, 2, 3]); | 146 function baz2(x) { |
| 147 return (!%IsConstructCall()) ? NON_CONSTRUCT_MARKER : CONSTRUCT_MARKER; |
| 148 } |
| 149 |
| 150 function bar2(x, y, z) { |
| 151 var non_construct = baz2(0); /* baz should be inlined */ |
| 152 assertSame(non_construct, NON_CONSTRUCT_MARKER); |
| 153 var non_construct = baz2(); /* baz should be inlined */ |
| 154 assertSame(non_construct, NON_CONSTRUCT_MARKER); |
| 155 var non_construct = baz2(0, 0); /* baz should be inlined */ |
| 156 assertSame(non_construct, NON_CONSTRUCT_MARKER); |
| 157 var construct = new baz2(0); |
| 158 assertSame(construct, CONSTRUCT_MARKER); |
| 159 var construct = new baz2(0, 0); |
| 160 assertSame(construct, CONSTRUCT_MARKER); |
| 161 } |
| 162 |
| 163 invoke(bar1, [1, 2, 3]); |
| 164 invoke(bar2, [1, 2, 3]); |
OLD | NEW |