OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "test/cctest/compiler/function-tester.h" | 7 #include "test/cctest/compiler/function-tester.h" |
8 | 8 |
9 using namespace v8::internal; | 9 using namespace v8::internal; |
10 using namespace v8::internal::compiler; | 10 using namespace v8::internal::compiler; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 | 227 |
228 TEST(ReceiverPatching) { | 228 TEST(ReceiverPatching) { |
229 // TODO(turbofan): Note that this test only checks that the function prologue | 229 // TODO(turbofan): Note that this test only checks that the function prologue |
230 // patches an undefined receiver to the global receiver. If this starts to | 230 // patches an undefined receiver to the global receiver. If this starts to |
231 // fail once we fix the calling protocol, just remove this test. | 231 // fail once we fix the calling protocol, just remove this test. |
232 FunctionTester T("(function(a) { return this; })"); | 232 FunctionTester T("(function(a) { return this; })"); |
233 Handle<JSObject> g(T.function->context()->global_object()->global_proxy()); | 233 Handle<JSObject> g(T.function->context()->global_object()->global_proxy()); |
234 T.CheckCall(g, T.undefined()); | 234 T.CheckCall(g, T.undefined()); |
235 } | 235 } |
| 236 |
| 237 |
| 238 TEST(CallEval) { |
| 239 FunctionTester T( |
| 240 "var x = 42;" |
| 241 "(function () {" |
| 242 "function bar() { return eval('x') };" |
| 243 "return bar;" |
| 244 "})();"); |
| 245 |
| 246 T.CheckCall(T.Val(42), T.Val("x"), T.undefined()); |
| 247 } |
OLD | NEW |