From 85058ce97dccc8c5c394bbb3393bcc7079f88bb5 Mon Sep 17 00:00:00 2001 From: "sigurds@chromium.org" Date: Tue, 19 Aug 2014 11:24:24 +0000 Subject: [PATCH] Set ScopeInfo when compiling for unit tests. This is required to correctly treat eval in unit tests. BUG= R=mstarzinger@chromium.org Review URL: https://codereview.chromium.org/453953002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23193 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- test/cctest/compiler/function-tester.h | 2 ++ test/cctest/compiler/test-changes-lowering.cc | 3 +++ test/cctest/compiler/test-codegen-deopt.cc | 2 ++ test/cctest/compiler/test-run-jscalls.cc | 12 ++++++++++++ 4 files changed, 19 insertions(+) diff --git a/test/cctest/compiler/function-tester.h b/test/cctest/compiler/function-tester.h index 2ed2fe9..67b704d 100644 --- a/test/cctest/compiler/function-tester.h +++ b/test/cctest/compiler/function-tester.h @@ -46,6 +46,8 @@ class FunctionTester : public InitializedHandleScope { CHECK(Rewriter::Rewrite(&info)); CHECK(Scope::Analyze(&info)); CHECK_NE(NULL, info.scope()); + Handle scope_info = ScopeInfo::Create(info.scope(), info.zone()); + info.shared_info()->set_scope_info(*scope_info); EnsureDeoptimizationSupport(&info); diff --git a/test/cctest/compiler/test-changes-lowering.cc b/test/cctest/compiler/test-changes-lowering.cc index e3ee4a4..78503e8 100644 --- a/test/cctest/compiler/test-changes-lowering.cc +++ b/test/cctest/compiler/test-changes-lowering.cc @@ -59,6 +59,9 @@ class ChangesLoweringTester : public GraphBuilderTester { CHECK(Rewriter::Rewrite(&info)); CHECK(Scope::Analyze(&info)); CHECK_NE(NULL, info.scope()); + Handle scope_info = + ScopeInfo::Create(info.scope(), info.zone()); + info.shared_info()->set_scope_info(*scope_info); Pipeline pipeline(&info); Linkage linkage(&info); Handle code = diff --git a/test/cctest/compiler/test-codegen-deopt.cc b/test/cctest/compiler/test-codegen-deopt.cc index 7f5fd9f..1e30e93 100644 --- a/test/cctest/compiler/test-codegen-deopt.cc +++ b/test/cctest/compiler/test-codegen-deopt.cc @@ -50,6 +50,8 @@ class DeoptCodegenTester { CHECK(Rewriter::Rewrite(&info)); CHECK(Scope::Analyze(&info)); CHECK_NE(NULL, info.scope()); + Handle scope_info = ScopeInfo::Create(info.scope(), info.zone()); + info.shared_info()->set_scope_info(*scope_info); FunctionTester::EnsureDeoptimizationSupport(&info); diff --git a/test/cctest/compiler/test-run-jscalls.cc b/test/cctest/compiler/test-run-jscalls.cc index 2ad7e50..fa7e98d 100644 --- a/test/cctest/compiler/test-run-jscalls.cc +++ b/test/cctest/compiler/test-run-jscalls.cc @@ -233,3 +233,15 @@ TEST(ReceiverPatching) { Handle g(T.function->context()->global_object()->global_proxy()); T.CheckCall(g, T.undefined()); } + + +TEST(CallEval) { + FunctionTester T( + "var x = 42;" + "(function () {" + "function bar() { return eval('x') };" + "return bar;" + "})();"); + + T.CheckCall(T.Val(42), T.Val("x"), T.undefined()); +} -- 2.7.4