[serializer] remove test case for internal references.

This particular test case is a hack that abuses Turbofan to
generate code that contains a switch table. Now that some
builtins use the CodeStubAssembler to implement switch tables
we don't need this test case anymore.

TBR=jarin@chromium.org

Review-Url: https://codereview.chromium.org/2645943003
Cr-Commit-Position: refs/heads/master@{#42553}
This commit is contained in:
yangguo 2017-01-20 05:11:21 -08:00 committed by Commit bot
parent 7366d8954c
commit f40710bce3

View File

@ -1687,96 +1687,6 @@ TEST(CodeSerializerWithHarmonyScoping) {
isolate2->Dispose();
}
TEST(CodeSerializerInternalReference) {
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64
return;
#endif
// In ignition there are only relative jumps, so the following code
// would not have any internal references. This test is not relevant
// for ignition.
if (FLAG_ignition || FLAG_turbo) {
return;
}
// Disable experimental natives that are loaded after deserialization.
FLAG_function_context_specialization = false;
FLAG_always_opt = true;
const char* flag = "--turbo-filter=foo";
FlagList::SetFlagsFromString(flag, StrLength(flag));
const char* source =
"var foo = (function(stdlib, foreign, heap) {"
" function foo(i) {"
" i = i|0;"
" var j = 0;"
" switch (i) {"
" case 0:"
" case 1: j = 1; break;"
" case 2:"
" case 3: j = 2; break;"
" case 4:"
" case 5: j = foo(3) + 1; break;"
" default: j = 0; break;"
" }"
" return j + 10;"
" }"
" return { foo: foo };"
"})(this, {}, undefined).foo;"
"foo(1);";
v8::StartupData data = v8::V8::CreateSnapshotDataBlob(source);
CHECK(data.data);
v8::Isolate::CreateParams params;
params.snapshot_blob = &data;
params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(params);
{
v8::Isolate::Scope i_scope(isolate);
v8::HandleScope h_scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
delete[] data.data; // We can dispose of the snapshot blob now.
v8::Context::Scope c_scope(context);
v8::Local<v8::Function> foo =
v8::Local<v8::Function>::Cast(CompileRun("foo"));
// There are at least 6 internal references.
int mask = RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) |
RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED);
RelocIterator it(
Handle<JSFunction>::cast(v8::Utils::OpenHandle(*foo))->code(), mask);
for (int i = 0; i < 6; ++i) {
CHECK(!it.done());
it.next();
}
CHECK(Handle<JSFunction>::cast(v8::Utils::OpenHandle(*foo))
->code()
->is_turbofanned());
CHECK_EQ(11, CompileRun("foo(0)")
->Int32Value(isolate->GetCurrentContext())
.FromJust());
CHECK_EQ(11, CompileRun("foo(1)")
->Int32Value(isolate->GetCurrentContext())
.FromJust());
CHECK_EQ(12, CompileRun("foo(2)")
->Int32Value(isolate->GetCurrentContext())
.FromJust());
CHECK_EQ(12, CompileRun("foo(3)")
->Int32Value(isolate->GetCurrentContext())
.FromJust());
CHECK_EQ(23, CompileRun("foo(4)")
->Int32Value(isolate->GetCurrentContext())
.FromJust());
CHECK_EQ(23, CompileRun("foo(5)")
->Int32Value(isolate->GetCurrentContext())
.FromJust());
CHECK_EQ(10, CompileRun("foo(6)")
->Int32Value(isolate->GetCurrentContext())
.FromJust());
}
isolate->Dispose();
}
TEST(CodeSerializerEagerCompilationAndPreAge) {
if (FLAG_ignition || FLAG_turbo) return;