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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 invoke(f1, [2, 3]); | 116 invoke(f1, [2, 3]); |
117 invoke(f2, [2]); | 117 invoke(f2, [2]); |
118 invoke(f3, [2, 3, 4]); | 118 invoke(f3, [2, 3, 4]); |
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 new.target 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 baz(x) { |
130 return (!%_IsConstructCall()) ? NON_CONSTRUCT_MARKER : CONSTRUCT_MARKER; | 130 return (new.target === undefined) ? NON_CONSTRUCT_MARKER : CONSTRUCT_MARKER; |
131 } | 131 } |
132 | 132 |
133 function bar(x, y, z) { | 133 function bar(x, y, z) { |
134 var non_construct = baz(0); /* baz should be inlined */ | 134 var non_construct = baz(0); /* baz should be inlined */ |
135 assertSame(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 = baz(); /* baz should be inlined */ |
137 assertSame(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 = baz(0, 0); /* baz should be inlined */ |
139 assertSame(non_construct, NON_CONSTRUCT_MARKER); | 139 assertSame(non_construct, NON_CONSTRUCT_MARKER); |
140 var construct = new baz(0); | 140 var construct = new baz(0); |
141 assertSame(construct, CONSTRUCT_MARKER); | 141 assertSame(construct, CONSTRUCT_MARKER); |
142 var construct = new baz(0, 0); | 142 var construct = new baz(0, 0); |
143 assertSame(construct, CONSTRUCT_MARKER); | 143 assertSame(construct, CONSTRUCT_MARKER); |
144 } | 144 } |
145 | 145 |
146 invoke(bar, [1, 2, 3]); | 146 invoke(bar, [1, 2, 3]); |
OLD | NEW |