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

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

Issue 882443004: Revert of Only use FreeSpace objects in the free list. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-spaces.cc » ('j') | 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 583bd4ff8b7d66f361727e23dec1b920b9eec0dc..4c6e6231d6cff658d8242b2ef42fcc198ab20046 100644
--- a/test/cctest/test-serialize.cc
+++ b/test/cctest/test-serialize.cc
@@ -156,23 +156,6 @@
}
-Vector<const uint8_t> ConstructSource(Vector<const uint8_t> head,
- Vector<const uint8_t> body,
- Vector<const uint8_t> tail, int repeats) {
- int source_length = head.length() + body.length() * repeats + tail.length();
- uint8_t* source = NewArray<uint8_t>(static_cast<size_t>(source_length));
- CopyChars(source, head.start(), head.length());
- for (int i = 0; i < repeats; i++) {
- CopyChars(source + head.length() + i * body.length(), body.start(),
- body.length());
- }
- CopyChars(source + head.length() + repeats * body.length(), tail.start(),
- tail.length());
- return Vector<const uint8_t>(const_cast<const uint8_t*>(source),
- source_length);
-}
-
-
// Test that the whole heap can be serialized.
UNINITIALIZED_TEST(Serialize) {
if (!Snapshot::HaveASnapshotToStartFrom()) {
@@ -317,32 +300,6 @@
}
-// Test that the whole heap can be serialized.
-UNINITIALIZED_TEST(SerializeMultiplePages) {
- if (!Snapshot::HaveASnapshotToStartFrom()) {
- v8::Isolate::CreateParams params;
- params.enable_serializer = true;
- v8::Isolate* isolate = v8::Isolate::New(params);
- {
- v8::Isolate::Scope isolate_scope(isolate);
- v8::HandleScope handle_scope(isolate);
- v8::Local<v8::Context> context = v8::Context::New(isolate);
- v8::Context::Scope context_scope(context);
- Vector<const uint8_t> source = ConstructSource(
- STATIC_CHAR_VECTOR("var s='"), STATIC_CHAR_VECTOR("A"),
- STATIC_CHAR_VECTOR("';"), Page::kMaxRegularHeapObjectSize - 100);
- v8::Handle<v8::String> source_str = v8::String::NewFromOneByte(
- isolate, source.start(), v8::String::kNormalString, source.length());
- CompileRun(source_str);
- }
-
- Isolate* internal_isolate = reinterpret_cast<Isolate*>(isolate);
- internal_isolate->heap()->CollectAllAvailableGarbage("serialize");
- WriteToFile(internal_isolate, FLAG_testing_serialization_file);
- }
-}
-
-
UNINITIALIZED_TEST(PartialSerialization) {
if (!Snapshot::HaveASnapshotToStartFrom()) {
v8::Isolate::CreateParams params;
@@ -589,6 +546,7 @@
params.enable_serializer = true;
v8::Isolate* v8_isolate = v8::Isolate::New(params);
Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate);
+ Heap* heap = isolate->heap();
{
v8::Isolate::Scope isolate_scope(v8_isolate);
@@ -611,16 +569,6 @@
"var r = Math.random() + Math.cos(0);"
"var f = (function(a, b) { return a + b; }).bind(1, 2, 3);"
"var s = parseInt('12345');");
-
- Vector<const uint8_t> source = ConstructSource(
- STATIC_CHAR_VECTOR("function g() { return [,"),
- STATIC_CHAR_VECTOR("1,"),
- STATIC_CHAR_VECTOR("];} a = g(); b = g(); b.push(1);"), 100000);
- v8::Handle<v8::String> source_str = v8::String::NewFromOneByte(
- v8_isolate, source.start(), v8::String::kNormalString,
- source.length());
- CompileRun(source_str);
- source.Dispose();
}
// Make sure all builtin scripts are cached.
{
@@ -631,7 +579,7 @@
}
// If we don't do this then we end up with a stray root pointing at the
// context even after we have disposed of env.
- isolate->heap()->CollectAllAvailableGarbage("snapshotting");
+ heap->CollectAllGarbage(Heap::kNoGCFlags);
int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
@@ -719,10 +667,6 @@
CHECK_EQ(5, f);
v8::Handle<v8::String> s = CompileRun("s")->ToString(v8_isolate);
CHECK(s->Equals(v8_str("12345")));
- int a = CompileRun("a.length")->ToNumber(v8_isolate)->Int32Value();
- CHECK_EQ(100001, a);
- int b = CompileRun("b.length")->ToNumber(v8_isolate)->Int32Value();
- CHECK_EQ(100002, b);
}
}
v8_isolate->Dispose();
@@ -872,6 +816,23 @@
CHECK_EQ(builtins_count, CountBuiltins());
delete cache;
+}
+
+
+Vector<const uint8_t> ConstructSource(Vector<const uint8_t> head,
+ Vector<const uint8_t> body,
+ Vector<const uint8_t> tail, int repeats) {
+ int source_length = head.length() + body.length() * repeats + tail.length();
+ uint8_t* source = NewArray<uint8_t>(static_cast<size_t>(source_length));
+ CopyChars(source, head.start(), head.length());
+ for (int i = 0; i < repeats; i++) {
+ CopyChars(source + head.length() + i * body.length(), body.start(),
+ body.length());
+ }
+ CopyChars(source + head.length() + repeats * body.length(), tail.start(),
+ tail.length());
+ return Vector<const uint8_t>(const_cast<const uint8_t*>(source),
+ source_length);
}
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698