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..8e652a3f5c2994e4c931857f40ef5356f9057210 100644 |
| --- a/test/cctest/compiler/test-run-jscalls.cc |
| +++ b/test/cctest/compiler/test-run-jscalls.cc |
| @@ -245,3 +245,59 @@ TEST(CallEval) { |
| T.CheckCall(T.Val(42), T.Val("x"), T.undefined()); |
| } |
| + |
| +#if V8_TURBOFAN_TARGET |
| + |
| +TEST(ContextLoadedFromActivation) { |
| + FLAG_context_specialization = false; |
|
sigurds
2014/08/20 07:53:22
I left this flag in here.
I could add it as a para
titzer
2014/08/21 08:12:06
Please add a TODO.
sigurds
2014/08/21 09:14:13
Implemented it.
|
| + const char* script = |
| + "var x = 42;" |
| + "(function() {" |
| + " return function () { return x };" |
| + "})()"; |
| + FunctionTester T(script); |
| + |
| + v8::Isolate* isolate = CcTest::isolate(); |
| + v8::HandleScope outer(isolate); |
| + { |
| + v8::Local<v8::Context> env = v8::Context::New(isolate); |
|
titzer
2014/08/21 08:12:06
Maybe you can factor this out into function-tester
sigurds
2014/08/21 09:14:13
Done.
|
| + env->Enter(); |
| + v8::Local<v8::Value> fun = CompileRun(script); |
| + i::Handle<i::Object> oifun = v8::Utils::OpenHandle(*fun); |
| + i::Handle<i::JSFunction> ifun = Handle<JSFunction>::cast(oifun); |
| + ifun->set_code(T.function->code()); |
| + env->Global()->Set(v8_str("foo"), fun); |
| + CompileRun("var x = 24;"); |
| + ExpectInt32("foo();", 24); |
| + env->Exit(); |
| + } |
| +} |
| + |
| + |
| +TEST(BuiltinLoadedFromActivation) { |
| + i::FLAG_context_specialization = false; |
| + const char* script = |
| + "var x = 42;" |
| + "(function() {" |
| + " return function () { return this; };" |
| + "})()"; |
| + |
| + FunctionTester T(script); |
| + |
| + v8::Isolate* isolate = CcTest::isolate(); |
| + v8::HandleScope outer(isolate); |
| + { |
| + v8::Local<v8::Context> env = v8::Context::New(isolate); |
| + env->Enter(); |
| + v8::Local<v8::Value> fun = CompileRun(script); |
| + i::Handle<i::Object> oifun = v8::Utils::OpenHandle(*fun); |
| + i::Handle<i::JSFunction> ifun = Handle<JSFunction>::cast(oifun); |
| + ifun->set_code(T.function->code()); |
| + env->Global()->Set(v8_str("foo"), fun); |
| + CompileRun("var x = 24;"); |
| + ExpectObject("foo()", env->Global()); |
| + env->Exit(); |
| + } |
| +} |
| + |
| +#endif // V8_TURBO_TARGET |