| 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 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 return counter; | 911 return counter; |
| 912 } | 912 } |
| 913 | 913 |
| 914 | 914 |
| 915 static Handle<SharedFunctionInfo> CompileScript( | 915 static Handle<SharedFunctionInfo> CompileScript( |
| 916 Isolate* isolate, Handle<String> source, Handle<String> name, | 916 Isolate* isolate, Handle<String> source, Handle<String> name, |
| 917 ScriptData** cached_data, v8::ScriptCompiler::CompileOptions options) { | 917 ScriptData** cached_data, v8::ScriptCompiler::CompileOptions options) { |
| 918 return Compiler::GetSharedFunctionInfoForScript( | 918 return Compiler::GetSharedFunctionInfoForScript( |
| 919 source, name, 0, 0, v8::ScriptOriginOptions(), Handle<Object>(), | 919 source, name, 0, 0, v8::ScriptOriginOptions(), Handle<Object>(), |
| 920 Handle<Context>(isolate->native_context()), NULL, cached_data, options, | 920 Handle<Context>(isolate->native_context()), NULL, cached_data, options, |
| 921 NOT_NATIVES_CODE, false); | 921 NOT_NATIVES_CODE); |
| 922 } | 922 } |
| 923 | 923 |
| 924 TEST(CodeSerializerOnePlusOne) { | 924 TEST(CodeSerializerOnePlusOne) { |
| 925 FLAG_serialize_toplevel = true; | 925 FLAG_serialize_toplevel = true; |
| 926 LocalContext context; | 926 LocalContext context; |
| 927 Isolate* isolate = CcTest::i_isolate(); | 927 Isolate* isolate = CcTest::i_isolate(); |
| 928 isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. | 928 isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. |
| 929 | 929 |
| 930 v8::HandleScope scope(CcTest::isolate()); | 930 v8::HandleScope scope(CcTest::isolate()); |
| 931 | 931 |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1826 CcTest::InitializeVM(); | 1826 CcTest::InitializeVM(); |
| 1827 Isolate* isolate = CcTest::i_isolate(); | 1827 Isolate* isolate = CcTest::i_isolate(); |
| 1828 | 1828 |
| 1829 HandleScope scope(isolate); | 1829 HandleScope scope(isolate); |
| 1830 Handle<String> source = isolate->factory()->NewStringFromAsciiChecked( | 1830 Handle<String> source = isolate->factory()->NewStringFromAsciiChecked( |
| 1831 "function f() {} function g() {}"); | 1831 "function f() {} function g() {}"); |
| 1832 ScriptData* script_data = NULL; | 1832 ScriptData* script_data = NULL; |
| 1833 Handle<SharedFunctionInfo> shared = Compiler::GetSharedFunctionInfoForScript( | 1833 Handle<SharedFunctionInfo> shared = Compiler::GetSharedFunctionInfoForScript( |
| 1834 source, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), | 1834 source, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), |
| 1835 Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, | 1835 Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, |
| 1836 &script_data, v8::ScriptCompiler::kProduceCodeCache, NOT_NATIVES_CODE, | 1836 &script_data, v8::ScriptCompiler::kProduceCodeCache, NOT_NATIVES_CODE); |
| 1837 false); | |
| 1838 delete script_data; | 1837 delete script_data; |
| 1839 | 1838 |
| 1840 heap::SimulateIncrementalMarking(isolate->heap()); | 1839 heap::SimulateIncrementalMarking(isolate->heap()); |
| 1841 | 1840 |
| 1842 script_data = CodeSerializer::Serialize(isolate, shared, source); | 1841 script_data = CodeSerializer::Serialize(isolate, shared, source); |
| 1843 delete script_data; | 1842 delete script_data; |
| 1844 } | 1843 } |
| 1845 | 1844 |
| 1846 #if V8_TARGET_ARCH_X64 | 1845 #if V8_TARGET_ARCH_X64 |
| 1847 TEST(CodeSerializerCell) { | 1846 TEST(CodeSerializerCell) { |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2532 } | 2531 } |
| 2533 delete[] blob.data; | 2532 delete[] blob.data; |
| 2534 } | 2533 } |
| 2535 | 2534 |
| 2536 TEST(SerializationMemoryStats) { | 2535 TEST(SerializationMemoryStats) { |
| 2537 FLAG_profile_deserialization = true; | 2536 FLAG_profile_deserialization = true; |
| 2538 FLAG_always_opt = false; | 2537 FLAG_always_opt = false; |
| 2539 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); | 2538 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); |
| 2540 delete[] blob.data; | 2539 delete[] blob.data; |
| 2541 } | 2540 } |
| OLD | NEW |