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

Side by Side Diff: test/cctest/test-serialize.cc

Issue 1028483003: Version 4.2.77.10 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.2
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 unified diff | Download patch
« no previous file with comments | « src/compiler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2010 the V8 project authors. All rights reserved. 1 // Copyright 2007-2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 Handle<Object> copy_result = 786 Handle<Object> copy_result =
787 Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked(); 787 Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked();
788 CHECK_EQ(2, Handle<Smi>::cast(copy_result)->value()); 788 CHECK_EQ(2, Handle<Smi>::cast(copy_result)->value());
789 789
790 CHECK_EQ(builtins_count, CountBuiltins()); 790 CHECK_EQ(builtins_count, CountBuiltins());
791 791
792 delete cache; 792 delete cache;
793 } 793 }
794 794
795 795
796 TEST(CodeCachePromotedToCompilationCache) {
797 FLAG_serialize_toplevel = true;
798 LocalContext context;
799 Isolate* isolate = CcTest::i_isolate();
800
801 v8::HandleScope scope(CcTest::isolate());
802
803 const char* source = "1 + 1";
804
805 Handle<String> src = isolate->factory()
806 ->NewStringFromUtf8(CStrVector(source))
807 .ToHandleChecked();
808 ScriptData* cache = NULL;
809
810 CompileScript(isolate, src, src, &cache,
811 v8::ScriptCompiler::kProduceCodeCache);
812
813 DisallowCompilation no_compile_expected(isolate);
814 Handle<SharedFunctionInfo> copy = CompileScript(
815 isolate, src, src, &cache, v8::ScriptCompiler::kConsumeCodeCache);
816
817 CHECK(isolate->compilation_cache()
818 ->LookupScript(src, src, 0, 0, false, false,
819 isolate->native_context(), SLOPPY)
820 .ToHandleChecked()
821 .is_identical_to(copy));
822
823 delete cache;
824 }
825
826
796 TEST(SerializeToplevelInternalizedString) { 827 TEST(SerializeToplevelInternalizedString) {
797 FLAG_serialize_toplevel = true; 828 FLAG_serialize_toplevel = true;
798 LocalContext context; 829 LocalContext context;
799 Isolate* isolate = CcTest::i_isolate(); 830 Isolate* isolate = CcTest::i_isolate();
800 isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. 831 isolate->compilation_cache()->Disable(); // Disable same-isolate code cache.
801 832
802 v8::HandleScope scope(CcTest::isolate()); 833 v8::HandleScope scope(CcTest::isolate());
803 834
804 const char* source = "'string1'"; 835 const char* source = "'string1'";
805 836
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 { 1447 {
1417 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2)); 1448 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2));
1418 script = v8::ScriptCompiler::CompileUnbound( 1449 script = v8::ScriptCompiler::CompileUnbound(
1419 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); 1450 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache);
1420 } 1451 }
1421 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); 1452 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run();
1422 CHECK(result->ToString(isolate2)->Equals(v8_str("XY"))); 1453 CHECK(result->ToString(isolate2)->Equals(v8_str("XY")));
1423 } 1454 }
1424 isolate2->Dispose(); 1455 isolate2->Dispose();
1425 } 1456 }
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698