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 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1799 v8::ScriptCompiler::CompileUnboundScript( | 1799 v8::ScriptCompiler::CompileUnboundScript( |
1800 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache) | 1800 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache) |
1801 .ToLocalChecked(); | 1801 .ToLocalChecked(); |
1802 | 1802 |
1803 CHECK(!cache->rejected); | 1803 CHECK(!cache->rejected); |
1804 | 1804 |
1805 Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate2); | 1805 Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate2); |
1806 HandleScope i_scope(i_isolate); | 1806 HandleScope i_scope(i_isolate); |
1807 Handle<SharedFunctionInfo> toplevel = v8::Utils::OpenHandle(*unbound); | 1807 Handle<SharedFunctionInfo> toplevel = v8::Utils::OpenHandle(*unbound); |
1808 Handle<Script> script(Script::cast(toplevel->script())); | 1808 Handle<Script> script(Script::cast(toplevel->script())); |
1809 WeakFixedArray::Iterator iterator(script->shared_function_infos()); | |
1810 // Every function has been pre-compiled from the code cache. | 1809 // Every function has been pre-compiled from the code cache. |
1811 int count = 0; | 1810 int count = 0; |
1812 while (SharedFunctionInfo* shared = iterator.Next<SharedFunctionInfo>()) { | 1811 for (int index = 0; index < script->shared_function_infos()->length(); |
| 1812 ++index) { |
| 1813 Object* raw = script->shared_function_infos()->get(index); |
| 1814 if (raw->IsSmi()) continue; |
| 1815 SharedFunctionInfo* shared = |
| 1816 SharedFunctionInfo::cast(WeakCell::cast(raw)->value()); |
1813 CHECK(shared->is_compiled()); | 1817 CHECK(shared->is_compiled()); |
1814 CHECK_EQ(Code::kPreAgedCodeAge, shared->code()->GetAge()); | 1818 CHECK_EQ(Code::kPreAgedCodeAge, shared->code()->GetAge()); |
1815 count++; | 1819 count++; |
1816 } | 1820 } |
1817 CHECK_EQ(3, count); | 1821 CHECK_EQ(3, count); |
1818 } | 1822 } |
1819 isolate2->Dispose(); | 1823 isolate2->Dispose(); |
1820 } | 1824 } |
1821 | 1825 |
1822 TEST(Regress503552) { | 1826 TEST(Regress503552) { |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2301 } | 2305 } |
2302 delete[] blob.data; | 2306 delete[] blob.data; |
2303 } | 2307 } |
2304 | 2308 |
2305 TEST(SerializationMemoryStats) { | 2309 TEST(SerializationMemoryStats) { |
2306 FLAG_profile_deserialization = true; | 2310 FLAG_profile_deserialization = true; |
2307 FLAG_always_opt = false; | 2311 FLAG_always_opt = false; |
2308 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); | 2312 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); |
2309 delete[] blob.data; | 2313 delete[] blob.data; |
2310 } | 2314 } |
OLD | NEW |