Revision: 24912
Author:   [email protected]
Date:     Mon Oct 27 16:40:04 2014 UTC
Log:      Add serializer test case to bug fix in r24871.

[email protected]

Review URL: https://codereview.chromium.org/680883003
https://code.google.com/p/v8/source/detail?r=24912

Modified:
 /branches/bleeding_edge/test/cctest/test-serialize.cc

=======================================
--- /branches/bleeding_edge/test/cctest/test-serialize.cc Fri Oct 24 12:40:05 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-serialize.cc Mon Oct 27 16:40:04 2014 UTC
@@ -826,19 +826,25 @@
 }


-TEST(SerializeToplevelLargeString) {
+TEST(SerializeToplevelLargeStrings) {
   FLAG_serialize_toplevel = true;
   LocalContext context;
   Isolate* isolate = CcTest::i_isolate();
+  Factory* f = isolate->factory();
isolate->compilation_cache()->Disable(); // Disable same-isolate code cache.

   v8::HandleScope scope(CcTest::isolate());

-  Vector<const uint8_t> source = ConstructSource(
+  Vector<const uint8_t> source_s = ConstructSource(
       STATIC_CHAR_VECTOR("var s = \""), STATIC_CHAR_VECTOR("abcdef"),
-      STATIC_CHAR_VECTOR("\"; s"), 1000000);
+      STATIC_CHAR_VECTOR("\";"), 1000000);
+  Vector<const uint8_t> source_t = ConstructSource(
+      STATIC_CHAR_VECTOR("var t = \""), STATIC_CHAR_VECTOR("uvwxyz"),
+      STATIC_CHAR_VECTOR("\"; s + t"), 999999);
   Handle<String> source_str =
-      isolate->factory()->NewStringFromOneByte(source).ToHandleChecked();
+      f->NewConsString(f->NewStringFromOneByte(source_s).ToHandleChecked(),
+                       f->NewStringFromOneByte(source_t).ToHandleChecked())
+          .ToHandleChecked();

   Handle<JSObject> global(isolate->context()->global_object());
   ScriptData* cache = NULL;
@@ -865,13 +871,19 @@
   Handle<Object> copy_result =
Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked();

-  CHECK_EQ(6 * 1000000, Handle<String>::cast(copy_result)->length());
- CHECK(isolate->heap()->InSpace(HeapObject::cast(*copy_result), LO_SPACE));
+  CHECK_EQ(6 * 1999999, Handle<String>::cast(copy_result)->length());
+  Handle<Object> property = JSObject::GetDataProperty(
+      isolate->global_object(), f->NewStringFromAsciiChecked("s"));
+  CHECK(isolate->heap()->InSpace(HeapObject::cast(*property), LO_SPACE));
+  property = JSObject::GetDataProperty(isolate->global_object(),
+                                       f->NewStringFromAsciiChecked("t"));
+  CHECK(isolate->heap()->InSpace(HeapObject::cast(*property), LO_SPACE));
// Make sure we do not serialize too much, e.g. include the source string.
-  CHECK_LT(cache->length(), 7000000);
+  CHECK_LT(cache->length(), 13000000);

   delete cache;
-  source.Dispose();
+  source_s.Dispose();
+  source_t.Dispose();
 }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to