| 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 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1714 v8::HandleScope h_scope(isolate); | 1714 v8::HandleScope h_scope(isolate); |
| 1715 v8::Local<v8::Context> context = v8::Context::New(isolate); | 1715 v8::Local<v8::Context> context = v8::Context::New(isolate); |
| 1716 delete[] data.data; // We can dispose of the snapshot blob now. | 1716 delete[] data.data; // We can dispose of the snapshot blob now. |
| 1717 v8::Context::Scope c_scope(context); | 1717 v8::Context::Scope c_scope(context); |
| 1718 v8::Local<v8::Function> foo = | 1718 v8::Local<v8::Function> foo = |
| 1719 v8::Local<v8::Function>::Cast(CompileRun("foo")); | 1719 v8::Local<v8::Function>::Cast(CompileRun("foo")); |
| 1720 | 1720 |
| 1721 // There are at least 6 internal references. | 1721 // There are at least 6 internal references. |
| 1722 int mask = RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) | | 1722 int mask = RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) | |
| 1723 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED); | 1723 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED); |
| 1724 RelocIterator it(v8::Utils::OpenHandle(*foo)->code(), mask); | 1724 RelocIterator it( |
| 1725 Handle<JSFunction>::cast(v8::Utils::OpenHandle(*foo))->code(), mask); |
| 1725 for (int i = 0; i < 6; ++i) { | 1726 for (int i = 0; i < 6; ++i) { |
| 1726 CHECK(!it.done()); | 1727 CHECK(!it.done()); |
| 1727 it.next(); | 1728 it.next(); |
| 1728 } | 1729 } |
| 1729 | 1730 |
| 1730 CHECK(v8::Utils::OpenHandle(*foo)->code()->is_turbofanned()); | 1731 CHECK(Handle<JSFunction>::cast(v8::Utils::OpenHandle(*foo)) |
| 1732 ->code() |
| 1733 ->is_turbofanned()); |
| 1731 CHECK_EQ(11, CompileRun("foo(0)") | 1734 CHECK_EQ(11, CompileRun("foo(0)") |
| 1732 ->Int32Value(isolate->GetCurrentContext()) | 1735 ->Int32Value(isolate->GetCurrentContext()) |
| 1733 .FromJust()); | 1736 .FromJust()); |
| 1734 CHECK_EQ(11, CompileRun("foo(1)") | 1737 CHECK_EQ(11, CompileRun("foo(1)") |
| 1735 ->Int32Value(isolate->GetCurrentContext()) | 1738 ->Int32Value(isolate->GetCurrentContext()) |
| 1736 .FromJust()); | 1739 .FromJust()); |
| 1737 CHECK_EQ(12, CompileRun("foo(2)") | 1740 CHECK_EQ(12, CompileRun("foo(2)") |
| 1738 ->Int32Value(isolate->GetCurrentContext()) | 1741 ->Int32Value(isolate->GetCurrentContext()) |
| 1739 .FromJust()); | 1742 .FromJust()); |
| 1740 CHECK_EQ(12, CompileRun("foo(3)") | 1743 CHECK_EQ(12, CompileRun("foo(3)") |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1778 delete script_data; | 1781 delete script_data; |
| 1779 } | 1782 } |
| 1780 | 1783 |
| 1781 | 1784 |
| 1782 TEST(SerializationMemoryStats) { | 1785 TEST(SerializationMemoryStats) { |
| 1783 FLAG_profile_deserialization = true; | 1786 FLAG_profile_deserialization = true; |
| 1784 FLAG_always_opt = false; | 1787 FLAG_always_opt = false; |
| 1785 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); | 1788 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); |
| 1786 delete[] blob.data; | 1789 delete[] blob.data; |
| 1787 } | 1790 } |
| OLD | NEW |