OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 function strict_return_this() { "use strict"; return this; } | 161 function strict_return_this() { "use strict"; return this; } |
162 function return_this() { return this; } | 162 function return_this() { return this; } |
163 function strict_eval(s) { "use strict"; return eval(s); } | 163 function strict_eval(s) { "use strict"; return eval(s); } |
164 function non_strict_eval(s) { return eval(s); } | 164 function non_strict_eval(s) { return eval(s); } |
165 | 165 |
166 outer_eval_conversion3(strict_return_this, 'undefined'); | 166 outer_eval_conversion3(strict_return_this, 'undefined'); |
167 outer_eval_conversion3(return_this, 'object'); | 167 outer_eval_conversion3(return_this, 'object'); |
168 outer_eval_conversion3(strict_eval, 'undefined'); | 168 outer_eval_conversion3(strict_eval, 'undefined'); |
169 outer_eval_conversion3(non_strict_eval, 'object'); | 169 outer_eval_conversion3(non_strict_eval, 'object'); |
170 | 170 |
171 // TODO(ager): I'm not sure this is in accordance with the spec. At | 171 outer_eval_conversion3(eval, 'undefined'); |
172 // the moment, any call to eval where eval is not bound in the global | |
173 // context is treated as an indirect call to eval which means that the | |
174 // global context is used and the global object is passed as the | |
175 // receiver. | |
176 outer_eval_conversion3(eval, 'object'); | |
177 | 172 |
178 function test_constant_function() { | 173 function test_constant_function() { |
179 var o = { f: function() { "use strict"; return this; } }; | 174 var o = { f: function() { "use strict"; return this; } }; |
180 this.__proto__ = o; | 175 this.__proto__ = o; |
181 for (var i = 0; i < 10; i++) assertEquals(void 0, f()); | 176 for (var i = 0; i < 10; i++) assertEquals(void 0, f()); |
182 } | 177 } |
183 test_constant_function(); | 178 test_constant_function(); |
184 | 179 |
185 function test_field() { | 180 function test_field() { |
186 var o = { }; | 181 var o = { }; |
187 o.f = function() {}; | 182 o.f = function() {}; |
188 o.f = function() { "use strict"; return this; }; | 183 o.f = function() { "use strict"; return this; }; |
189 this.__proto__ = o; | 184 this.__proto__ = o; |
190 for (var i = 0; i < 10; i++) assertEquals(void 0, f()); | 185 for (var i = 0; i < 10; i++) assertEquals(void 0, f()); |
191 } | 186 } |
192 test_field(); | 187 test_field(); |
OLD | NEW |