| Index: test/cctest/test-compiler.cc
|
| diff --git a/test/cctest/test-compiler.cc b/test/cctest/test-compiler.cc
|
| index 24eb87c223511459e0d07e770e33ffcbc31e176d..065a58dad8a89eb639fdbfef2d3e55508beae240 100644
|
| --- a/test/cctest/test-compiler.cc
|
| +++ b/test/cctest/test-compiler.cc
|
| @@ -312,6 +312,40 @@ TEST(GetScriptLineNumber) {
|
| }
|
|
|
|
|
| +TEST(FeedbackVectorPreservedAcrossRecompiles) {
|
| + if (i::FLAG_always_opt || !i::FLAG_crankshaft) return;
|
| + i::FLAG_allow_natives_syntax = true;
|
| + CcTest::InitializeVM();
|
| + v8::HandleScope scope(CcTest::isolate());
|
| +
|
| + // Make sure function f has a call that uses a type feedback slot.
|
| + CompileRun("function fun() {};"
|
| + "fun1 = fun;"
|
| + "function f(a) { a(); } f(fun1);");
|
| +
|
| + Handle<JSFunction> f =
|
| + v8::Utils::OpenHandle(
|
| + *v8::Handle<v8::Function>::Cast(
|
| + CcTest::global()->Get(v8_str("f"))));
|
| +
|
| + // We shouldn't have deoptimization support. We want to recompile and
|
| + // verify that our feedback vector preserves information.
|
| + CHECK(!f->shared()->has_deoptimization_support());
|
| + Handle<FixedArray> feedback_vector(f->shared()->feedback_vector());
|
| +
|
| + // Verify that we gathered feedback.
|
| + CHECK_EQ(1, feedback_vector->length());
|
| + CHECK(feedback_vector->get(0)->IsJSFunction());
|
| +
|
| + CompileRun("%OptimizeFunctionOnNextCall(f); f(fun1);");
|
| +
|
| + // Verify that the feedback is still "gathered" despite a recompilation
|
| + // of the full code.
|
| + CHECK(f->shared()->has_deoptimization_support());
|
| + CHECK(f->shared()->feedback_vector()->get(0)->IsJSFunction());
|
| +}
|
| +
|
| +
|
| // Test that optimized code for different closures is actually shared
|
| // immediately by the FastNewClosureStub when run in the same context.
|
| TEST(OptimizedCodeSharing) {
|
|
|