OLD | NEW |
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 878 matching lines...) Loading... |
889 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 889 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
890 if (obj->IsCode() && Code::cast(obj)->kind() == Code::BUILTIN) counter++; | 890 if (obj->IsCode() && Code::cast(obj)->kind() == Code::BUILTIN) counter++; |
891 } | 891 } |
892 return counter; | 892 return counter; |
893 } | 893 } |
894 | 894 |
895 | 895 |
896 static Handle<SharedFunctionInfo> CompileScript( | 896 static Handle<SharedFunctionInfo> CompileScript( |
897 Isolate* isolate, Handle<String> source, Handle<String> name, | 897 Isolate* isolate, Handle<String> source, Handle<String> name, |
898 ScriptData** cached_data, v8::ScriptCompiler::CompileOptions options) { | 898 ScriptData** cached_data, v8::ScriptCompiler::CompileOptions options) { |
899 return Compiler::CompileScript( | 899 return Compiler::GetSharedFunctionInfoForScript( |
900 source, name, 0, 0, v8::ScriptOriginOptions(), Handle<Object>(), | 900 source, name, 0, 0, v8::ScriptOriginOptions(), Handle<Object>(), |
901 Handle<Context>(isolate->native_context()), NULL, cached_data, options, | 901 Handle<Context>(isolate->native_context()), NULL, cached_data, options, |
902 NOT_NATIVES_CODE, false); | 902 NOT_NATIVES_CODE, false); |
903 } | 903 } |
904 | 904 |
905 | 905 |
906 TEST(SerializeToplevelOnePlusOne) { | 906 TEST(SerializeToplevelOnePlusOne) { |
907 FLAG_serialize_toplevel = true; | 907 FLAG_serialize_toplevel = true; |
908 LocalContext context; | 908 LocalContext context; |
909 Isolate* isolate = CcTest::i_isolate(); | 909 Isolate* isolate = CcTest::i_isolate(); |
(...skipping 844 matching lines...) Loading... |
1754 // Test that the code serializer can deal with weak cells that form a linked | 1754 // Test that the code serializer can deal with weak cells that form a linked |
1755 // list during incremental marking. | 1755 // list during incremental marking. |
1756 | 1756 |
1757 CcTest::InitializeVM(); | 1757 CcTest::InitializeVM(); |
1758 Isolate* isolate = CcTest::i_isolate(); | 1758 Isolate* isolate = CcTest::i_isolate(); |
1759 | 1759 |
1760 HandleScope scope(isolate); | 1760 HandleScope scope(isolate); |
1761 Handle<String> source = isolate->factory()->NewStringFromAsciiChecked( | 1761 Handle<String> source = isolate->factory()->NewStringFromAsciiChecked( |
1762 "function f() {} function g() {}"); | 1762 "function f() {} function g() {}"); |
1763 ScriptData* script_data = NULL; | 1763 ScriptData* script_data = NULL; |
1764 Handle<SharedFunctionInfo> shared = Compiler::CompileScript( | 1764 Handle<SharedFunctionInfo> shared = Compiler::GetSharedFunctionInfoForScript( |
1765 source, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), | 1765 source, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), |
1766 Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, | 1766 Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, |
1767 &script_data, v8::ScriptCompiler::kProduceCodeCache, NOT_NATIVES_CODE, | 1767 &script_data, v8::ScriptCompiler::kProduceCodeCache, NOT_NATIVES_CODE, |
1768 false); | 1768 false); |
1769 delete script_data; | 1769 delete script_data; |
1770 | 1770 |
1771 SimulateIncrementalMarking(isolate->heap()); | 1771 SimulateIncrementalMarking(isolate->heap()); |
1772 | 1772 |
1773 script_data = CodeSerializer::Serialize(isolate, shared, source); | 1773 script_data = CodeSerializer::Serialize(isolate, shared, source); |
1774 delete script_data; | 1774 delete script_data; |
1775 } | 1775 } |
1776 | 1776 |
1777 | 1777 |
1778 TEST(SerializationMemoryStats) { | 1778 TEST(SerializationMemoryStats) { |
1779 FLAG_profile_deserialization = true; | 1779 FLAG_profile_deserialization = true; |
1780 FLAG_always_opt = false; | 1780 FLAG_always_opt = false; |
1781 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); | 1781 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); |
1782 delete[] blob.data; | 1782 delete[] blob.data; |
1783 } | 1783 } |
OLD | NEW |