| 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 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 return counter; | 924 return counter; |
| 925 } | 925 } |
| 926 | 926 |
| 927 | 927 |
| 928 static Handle<SharedFunctionInfo> CompileScript( | 928 static Handle<SharedFunctionInfo> CompileScript( |
| 929 Isolate* isolate, Handle<String> source, Handle<String> name, | 929 Isolate* isolate, Handle<String> source, Handle<String> name, |
| 930 ScriptData** cached_data, v8::ScriptCompiler::CompileOptions options) { | 930 ScriptData** cached_data, v8::ScriptCompiler::CompileOptions options) { |
| 931 return Compiler::GetSharedFunctionInfoForScript( | 931 return Compiler::GetSharedFunctionInfoForScript( |
| 932 source, name, 0, 0, v8::ScriptOriginOptions(), Handle<Object>(), | 932 source, name, 0, 0, v8::ScriptOriginOptions(), Handle<Object>(), |
| 933 Handle<Context>(isolate->native_context()), NULL, cached_data, options, | 933 Handle<Context>(isolate->native_context()), NULL, cached_data, options, |
| 934 NOT_NATIVES_CODE, false); | 934 NOT_NATIVES_CODE); |
| 935 } | 935 } |
| 936 | 936 |
| 937 TEST(CodeSerializerOnePlusOne) { | 937 TEST(CodeSerializerOnePlusOne) { |
| 938 FLAG_serialize_toplevel = true; | 938 FLAG_serialize_toplevel = true; |
| 939 LocalContext context; | 939 LocalContext context; |
| 940 Isolate* isolate = CcTest::i_isolate(); | 940 Isolate* isolate = CcTest::i_isolate(); |
| 941 isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. | 941 isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. |
| 942 | 942 |
| 943 v8::HandleScope scope(CcTest::isolate()); | 943 v8::HandleScope scope(CcTest::isolate()); |
| 944 | 944 |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 CcTest::InitializeVM(); | 1839 CcTest::InitializeVM(); |
| 1840 Isolate* isolate = CcTest::i_isolate(); | 1840 Isolate* isolate = CcTest::i_isolate(); |
| 1841 | 1841 |
| 1842 HandleScope scope(isolate); | 1842 HandleScope scope(isolate); |
| 1843 Handle<String> source = isolate->factory()->NewStringFromAsciiChecked( | 1843 Handle<String> source = isolate->factory()->NewStringFromAsciiChecked( |
| 1844 "function f() {} function g() {}"); | 1844 "function f() {} function g() {}"); |
| 1845 ScriptData* script_data = NULL; | 1845 ScriptData* script_data = NULL; |
| 1846 Handle<SharedFunctionInfo> shared = Compiler::GetSharedFunctionInfoForScript( | 1846 Handle<SharedFunctionInfo> shared = Compiler::GetSharedFunctionInfoForScript( |
| 1847 source, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), | 1847 source, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), |
| 1848 Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, | 1848 Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, |
| 1849 &script_data, v8::ScriptCompiler::kProduceCodeCache, NOT_NATIVES_CODE, | 1849 &script_data, v8::ScriptCompiler::kProduceCodeCache, NOT_NATIVES_CODE); |
| 1850 false); | |
| 1851 delete script_data; | 1850 delete script_data; |
| 1852 | 1851 |
| 1853 heap::SimulateIncrementalMarking(isolate->heap()); | 1852 heap::SimulateIncrementalMarking(isolate->heap()); |
| 1854 | 1853 |
| 1855 script_data = CodeSerializer::Serialize(isolate, shared, source); | 1854 script_data = CodeSerializer::Serialize(isolate, shared, source); |
| 1856 delete script_data; | 1855 delete script_data; |
| 1857 } | 1856 } |
| 1858 | 1857 |
| 1859 #if V8_TARGET_ARCH_X64 | 1858 #if V8_TARGET_ARCH_X64 |
| 1860 TEST(CodeSerializerCell) { | 1859 TEST(CodeSerializerCell) { |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2547 } | 2546 } |
| 2548 delete[] blob.data; | 2547 delete[] blob.data; |
| 2549 } | 2548 } |
| 2550 | 2549 |
| 2551 TEST(SerializationMemoryStats) { | 2550 TEST(SerializationMemoryStats) { |
| 2552 FLAG_profile_deserialization = true; | 2551 FLAG_profile_deserialization = true; |
| 2553 FLAG_always_opt = false; | 2552 FLAG_always_opt = false; |
| 2554 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); | 2553 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); |
| 2555 delete[] blob.data; | 2554 delete[] blob.data; |
| 2556 } | 2555 } |
| OLD | NEW |