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

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

Issue 390303002: Do not dump user source code in the code serializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/serialize.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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 &cache, PRODUCE_CACHED_DATA, NOT_NATIVES_CODE); 700 &cache, PRODUCE_CACHED_DATA, NOT_NATIVES_CODE);
701 701
702 int builtins_count = CountBuiltins(); 702 int builtins_count = CountBuiltins();
703 703
704 Handle<SharedFunctionInfo> copy = 704 Handle<SharedFunctionInfo> copy =
705 Compiler::CompileScript(source2_string, Handle<String>(), 0, 0, false, 705 Compiler::CompileScript(source2_string, Handle<String>(), 0, 0, false,
706 Handle<Context>(isolate->native_context()), NULL, 706 Handle<Context>(isolate->native_context()), NULL,
707 &cache, CONSUME_CACHED_DATA, NOT_NATIVES_CODE); 707 &cache, CONSUME_CACHED_DATA, NOT_NATIVES_CODE);
708 708
709 CHECK_NE(*orig, *copy); 709 CHECK_NE(*orig, *copy);
710 CHECK(Script::cast(copy->script())->source() == *source2_string);
711
710 Handle<JSFunction> copy_fun = 712 Handle<JSFunction> copy_fun =
711 isolate->factory()->NewFunctionFromSharedFunctionInfo( 713 isolate->factory()->NewFunctionFromSharedFunctionInfo(
712 copy, isolate->native_context()); 714 copy, isolate->native_context());
713 Handle<JSObject> global(isolate->context()->global_object()); 715 Handle<JSObject> global(isolate->context()->global_object());
714 Handle<Object> copy_result = 716 Handle<Object> copy_result =
715 Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked(); 717 Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked();
716 CHECK_EQ(2, Handle<Smi>::cast(copy_result)->value()); 718 CHECK_EQ(2, Handle<Smi>::cast(copy_result)->value());
717 719
718 CHECK_EQ(builtins_count, CountBuiltins()); 720 CHECK_EQ(builtins_count, CountBuiltins());
719 721
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 Execution::Call(isolate, orig_fun, global, 0, NULL).ToHandleChecked(); 753 Execution::Call(isolate, orig_fun, global, 0, NULL).ToHandleChecked();
752 CHECK(orig_result->IsInternalizedString()); 754 CHECK(orig_result->IsInternalizedString());
753 755
754 int builtins_count = CountBuiltins(); 756 int builtins_count = CountBuiltins();
755 757
756 Handle<SharedFunctionInfo> copy = 758 Handle<SharedFunctionInfo> copy =
757 Compiler::CompileScript(source2_string, Handle<String>(), 0, 0, false, 759 Compiler::CompileScript(source2_string, Handle<String>(), 0, 0, false,
758 Handle<Context>(isolate->native_context()), NULL, 760 Handle<Context>(isolate->native_context()), NULL,
759 &cache, CONSUME_CACHED_DATA, NOT_NATIVES_CODE); 761 &cache, CONSUME_CACHED_DATA, NOT_NATIVES_CODE);
760 CHECK_NE(*orig, *copy); 762 CHECK_NE(*orig, *copy);
763 CHECK(Script::cast(copy->script())->source() == *source2_string);
764
761 Handle<JSFunction> copy_fun = 765 Handle<JSFunction> copy_fun =
762 isolate->factory()->NewFunctionFromSharedFunctionInfo( 766 isolate->factory()->NewFunctionFromSharedFunctionInfo(
763 copy, isolate->native_context()); 767 copy, isolate->native_context());
764 CHECK_NE(*orig_fun, *copy_fun); 768 CHECK_NE(*orig_fun, *copy_fun);
765 Handle<Object> copy_result = 769 Handle<Object> copy_result =
766 Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked(); 770 Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked();
767 CHECK(orig_result.is_identical_to(copy_result)); 771 CHECK(orig_result.is_identical_to(copy_result));
768 Handle<String> expected = 772 Handle<String> expected =
769 isolate->factory()->NewStringFromAsciiChecked("string1"); 773 isolate->factory()->NewStringFromAsciiChecked("string1");
770 774
771 CHECK(Handle<String>::cast(copy_result)->Equals(*expected)); 775 CHECK(Handle<String>::cast(copy_result)->Equals(*expected));
772 CHECK_EQ(builtins_count, CountBuiltins()); 776 CHECK_EQ(builtins_count, CountBuiltins());
773 777
774 delete cache; 778 delete cache;
775 } 779 }
OLDNEW
« 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