Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1375)

Unified Diff: test/cctest/test-serialize.cc

Issue 1005183006: Serializer: serialize internal references via object visitor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/serialize.cc ('K') | « src/x64/assembler-x64-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-serialize.cc
diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc
index 88711b842940447358be689ab52d0f9b71f263f3..16904da2edbca8368f3cc5f7530a28d09d465b20 100644
--- a/test/cctest/test-serialize.cc
+++ b/test/cctest/test-serialize.cc
@@ -1502,10 +1502,10 @@ TEST(SerializeInternalReference) {
" case 2:"
" case 3: j = 2; break;"
" case 4:"
- " case 5: j = 3; break;"
+ " case 5: j = foo(3) + 1; break;"
" default: j = 0; break;"
" }"
- " return j|0;"
+ " return j + 10;"
" }"
" return { foo: foo };"
"})(this, {}, undefined).foo;"
@@ -1525,8 +1525,25 @@ TEST(SerializeInternalReference) {
v8::Context::Scope c_scope(context);
v8::Handle<v8::Function> foo =
v8::Handle<v8::Function>::Cast(CompileRun("foo"));
+
+ // There are exactly 6 internal references.
+ int mask = RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) |
+ RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED);
+ RelocIterator it(v8::Utils::OpenHandle(*foo)->code(), mask);
+ for (int i = 0; i < 6; ++i) {
+ CHECK(!it.done());
+ it.next();
+ }
+ CHECK(it.done());
+
CHECK(v8::Utils::OpenHandle(*foo)->code()->is_turbofanned());
- CHECK_EQ(3, CompileRun("foo(4)")->ToInt32(isolate)->Int32Value());
+ CHECK_EQ(11, CompileRun("foo(0)")->ToInt32(isolate)->Int32Value());
+ CHECK_EQ(11, CompileRun("foo(1)")->ToInt32(isolate)->Int32Value());
+ CHECK_EQ(12, CompileRun("foo(2)")->ToInt32(isolate)->Int32Value());
+ CHECK_EQ(12, CompileRun("foo(3)")->ToInt32(isolate)->Int32Value());
+ CHECK_EQ(23, CompileRun("foo(4)")->ToInt32(isolate)->Int32Value());
+ CHECK_EQ(23, CompileRun("foo(5)")->ToInt32(isolate)->Int32Value());
+ CHECK_EQ(10, CompileRun("foo(6)")->ToInt32(isolate)->Int32Value());
}
isolate->Dispose();
}
« src/serialize.cc ('K') | « src/x64/assembler-x64-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698