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

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

Issue 604373008: Serialize all external strings except for native source code strings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 | « src/serialize.cc ('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 262a9df667c98289706a212b85784e6f1eb60487..02fac5afd9b4ab02a61fba99f78ecc98d5b5beff 100644
--- a/test/cctest/test-serialize.cc
+++ b/test/cctest/test-serialize.cc
@@ -1046,8 +1046,7 @@ TEST(SerializeToplevelLargeExternalString) {
CHECK_NE(*orig, *copy);
Handle<JSFunction> copy_fun =
- isolate->factory()->NewFunctionFromSharedFunctionInfo(
- copy, isolate->native_context());
+ f->NewFunctionFromSharedFunctionInfo(copy, isolate->native_context());
Handle<Object> copy_result =
Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked();
@@ -1059,6 +1058,59 @@ TEST(SerializeToplevelLargeExternalString) {
}
+TEST(SerializeToplevelExternalScriptName) {
+ FLAG_serialize_toplevel = true;
+ LocalContext context;
+ Isolate* isolate = CcTest::i_isolate();
+ isolate->compilation_cache()->Disable(); // Disable same-isolate code cache.
+
+ Factory* f = isolate->factory();
+
+ v8::HandleScope scope(CcTest::isolate());
+
+ const char* source =
+ "var a = [1, 2, 3, 4];"
+ "a.reduce(function(x, y) { return x + y }, 0)";
+
+ Handle<String> source_string =
+ f->NewStringFromUtf8(CStrVector(source)).ToHandleChecked();
+
+ const SerializerOneByteResource one_byte_resource("one_byte", 8);
+ Handle<String> name =
+ f->NewExternalStringFromOneByte(&one_byte_resource).ToHandleChecked();
+ CHECK(name->IsExternalOneByteString());
+ CHECK(!name->IsInternalizedString());
+
+ Handle<JSObject> global(isolate->context()->global_object());
+ ScriptData* cache = NULL;
+
+ Handle<SharedFunctionInfo> orig = Compiler::CompileScript(
+ source_string, name, 0, 0, false,
+ Handle<Context>(isolate->native_context()), NULL, &cache,
+ v8::ScriptCompiler::kProduceCodeCache, NOT_NATIVES_CODE);
+
+ Handle<SharedFunctionInfo> copy;
+ {
+ DisallowCompilation no_compile_expected(isolate);
+ copy = Compiler::CompileScript(
+ source_string, name, 0, 0, false,
+ Handle<Context>(isolate->native_context()), NULL, &cache,
+ v8::ScriptCompiler::kConsumeCodeCache, NOT_NATIVES_CODE);
+ }
+ CHECK_NE(*orig, *copy);
+
+ Handle<JSFunction> copy_fun =
+ f->NewFunctionFromSharedFunctionInfo(copy, isolate->native_context());
+
+ Handle<Object> copy_result =
+ Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked();
+
+ CHECK_EQ(10.0f, copy_result->Number());
+
+ delete cache;
+}
+
+
TEST(SerializeToplevelIsolates) {
FLAG_serialize_toplevel = true;
« no previous file with comments | « src/serialize.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698