Chromium Code Reviews| Index: test/cctest/compiler/test-run-jscalls.cc |
| diff --git a/test/cctest/compiler/test-run-jscalls.cc b/test/cctest/compiler/test-run-jscalls.cc |
| index fa7e98d5ec8178940dcb901c0f29f71115453f14..6a8d39f9e622d829f59f678e412a69a6abc064f5 100644 |
| --- a/test/cctest/compiler/test-run-jscalls.cc |
| +++ b/test/cctest/compiler/test-run-jscalls.cc |
| @@ -245,3 +245,48 @@ TEST(CallEval) { |
| T.CheckCall(T.Val(42), T.Val("x"), T.undefined()); |
| } |
| + |
| +#if V8_TURBOFAN_TARGET |
|
titzer
2014/08/21 09:56:35
Why are these guarded with TURBOFAN_TARGET and the
sigurds
2014/08/21 12:29:00
Leftover, thanks. Removed guard.
|
| + |
| +TEST(ContextLoadedFromActivation) { |
| + const char* script = |
| + "var x = 42;" |
| + "(function() {" |
| + " return function () { return x };" |
| + "})()"; |
| + |
| + // Disable context specialization. |
| + FunctionTester T(script, false); |
| + v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate()); |
| + v8::Context::Scope scope(context); |
| + v8::Local<v8::Value> value = CompileRun(script); |
| + i::Handle<i::Object> ofun = v8::Utils::OpenHandle(*value); |
| + i::Handle<i::JSFunction> jsfun = Handle<JSFunction>::cast(ofun); |
| + jsfun->set_code(T.function->code()); |
| + context->Global()->Set(v8_str("foo"), v8::Utils::ToLocal(jsfun)); |
| + CompileRun("var x = 24;"); |
| + ExpectInt32("foo();", 24); |
| +} |
| + |
| + |
| +TEST(BuiltinLoadedFromActivation) { |
| + const char* script = |
| + "var x = 42;" |
| + "(function() {" |
| + " return function () { return this; };" |
| + "})()"; |
| + |
| + // Disable context specialization. |
| + FunctionTester T(script, false); |
| + v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate()); |
| + v8::Context::Scope scope(context); |
| + v8::Local<v8::Value> value = CompileRun(script); |
| + i::Handle<i::Object> ofun = v8::Utils::OpenHandle(*value); |
| + i::Handle<i::JSFunction> jsfun = Handle<JSFunction>::cast(ofun); |
| + jsfun->set_code(T.function->code()); |
| + context->Global()->Set(v8_str("foo"), v8::Utils::ToLocal(jsfun)); |
| + CompileRun("var x = 24;"); |
| + ExpectObject("foo()", context->Global()); |
| +} |
| + |
| +#endif // V8_TURBO_TARGET |