Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/snapshot.h" | 5 #include "vm/snapshot.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
| 9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1811 | 1811 |
| 1812 | 1812 |
| 1813 SnapshotWriter::SnapshotWriter(Thread* thread, | 1813 SnapshotWriter::SnapshotWriter(Thread* thread, |
| 1814 Snapshot::Kind kind, | 1814 Snapshot::Kind kind, |
| 1815 uint8_t** buffer, | 1815 uint8_t** buffer, |
| 1816 ReAlloc alloc, | 1816 ReAlloc alloc, |
| 1817 intptr_t initial_size, | 1817 intptr_t initial_size, |
| 1818 ForwardList* forward_list, | 1818 ForwardList* forward_list, |
| 1819 InstructionsWriter* instructions_writer, | 1819 InstructionsWriter* instructions_writer, |
| 1820 bool can_send_any_object, | 1820 bool can_send_any_object, |
| 1821 bool vm_isolate_is_symbolic) | 1821 bool writing_vm_isolate) |
| 1822 : BaseWriter(buffer, alloc, initial_size), | 1822 : BaseWriter(buffer, alloc, initial_size), |
| 1823 thread_(thread), | 1823 thread_(thread), |
| 1824 kind_(kind), | 1824 kind_(kind), |
| 1825 object_store_(isolate()->object_store()), | 1825 object_store_(isolate()->object_store()), |
| 1826 class_table_(isolate()->class_table()), | 1826 class_table_(isolate()->class_table()), |
| 1827 forward_list_(forward_list), | 1827 forward_list_(forward_list), |
| 1828 instructions_writer_(instructions_writer), | 1828 instructions_writer_(instructions_writer), |
| 1829 exception_type_(Exceptions::kNone), | 1829 exception_type_(Exceptions::kNone), |
| 1830 exception_msg_(NULL), | 1830 exception_msg_(NULL), |
| 1831 unmarked_objects_(false), | 1831 unmarked_objects_(false), |
| 1832 can_send_any_object_(can_send_any_object), | 1832 can_send_any_object_(can_send_any_object), |
| 1833 vm_isolate_is_symbolic_(vm_isolate_is_symbolic) { | 1833 writing_vm_isolate_(writing_vm_isolate) { |
| 1834 ASSERT(forward_list_ != NULL); | 1834 ASSERT(forward_list_ != NULL); |
| 1835 } | 1835 } |
| 1836 | 1836 |
| 1837 | 1837 |
| 1838 void SnapshotWriter::WriteObject(RawObject* rawobj) { | 1838 void SnapshotWriter::WriteObject(RawObject* rawobj) { |
| 1839 WriteObjectImpl(rawobj, kAsInlinedObject); | 1839 WriteObjectImpl(rawobj, kAsInlinedObject); |
| 1840 WriteForwardedObjects(); | 1840 WriteForwardedObjects(); |
| 1841 } | 1841 } |
| 1842 | 1842 |
| 1843 | 1843 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1915 } | 1915 } |
| 1916 | 1916 |
| 1917 // Check if it is a singleton ICData array object. | 1917 // Check if it is a singleton ICData array object. |
| 1918 for (intptr_t i = 0; i < ICData::kCachedICDataArrayCount; i++) { | 1918 for (intptr_t i = 0; i < ICData::kCachedICDataArrayCount; i++) { |
| 1919 if (rawobj == ICData::cached_icdata_arrays_[i]) { | 1919 if (rawobj == ICData::cached_icdata_arrays_[i]) { |
| 1920 WriteVMIsolateObject(kCachedICDataArray0 + i); | 1920 WriteVMIsolateObject(kCachedICDataArray0 + i); |
| 1921 return true; | 1921 return true; |
| 1922 } | 1922 } |
| 1923 } | 1923 } |
| 1924 | 1924 |
| 1925 if (writing_vm_isolate_) { | |
| 1926 if (id == kCodeCid) { | |
| 1927 ASSERT(Snapshot::IncludesCode(kind())); | |
| 1928 } | |
| 1929 // Write the object instead of a reference. | |
| 1930 return false; | |
| 1931 } | |
|
siva
2016/05/05 00:50:04
Instead of this code which is heard to read and un
| |
| 1932 | |
| 1925 if (Snapshot::IsFull(kind())) { | 1933 if (Snapshot::IsFull(kind())) { |
| 1926 // Check it is a predefined symbol in the VM isolate. | 1934 // Check it is a predefined symbol in the VM isolate. |
| 1927 id = Symbols::LookupVMSymbol(rawobj); | 1935 id = Symbols::LookupVMSymbol(rawobj); |
| 1928 if (id != kInvalidIndex) { | 1936 if (id != kInvalidIndex) { |
| 1929 WriteVMIsolateObject(id); | 1937 WriteVMIsolateObject(id); |
| 1930 return true; | 1938 return true; |
| 1931 } | 1939 } |
| 1932 | 1940 |
| 1933 // Check if it is an object from the vm isolate snapshot object table. | 1941 // Check if it is an object from the vm isolate snapshot object table. |
| 1934 id = FindVmSnapshotObject(rawobj); | 1942 id = FindVmSnapshotObject(rawobj); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1953 raw_obj->WriteTo(this, object_id, kind(), false); | 1961 raw_obj->WriteTo(this, object_id, kind(), false); |
| 1954 return true; | 1962 return true; |
| 1955 } | 1963 } |
| 1956 default: | 1964 default: |
| 1957 OS::Print("class id = %" Pd "\n", id); | 1965 OS::Print("class id = %" Pd "\n", id); |
| 1958 break; | 1966 break; |
| 1959 } | 1967 } |
| 1960 } | 1968 } |
| 1961 } | 1969 } |
| 1962 | 1970 |
| 1963 if (!vm_isolate_is_symbolic()) { | |
| 1964 return false; | |
| 1965 } | |
| 1966 | |
| 1967 const Object& obj = Object::Handle(rawobj); | 1971 const Object& obj = Object::Handle(rawobj); |
| 1968 FATAL1("Unexpected reference to object in VM isolate: %s\n", obj.ToCString()); | 1972 FATAL1("Unexpected reference to object in VM isolate: %s\n", obj.ToCString()); |
| 1969 return false; | 1973 return false; |
| 1970 } | 1974 } |
| 1971 | 1975 |
| 1972 #undef VM_OBJECT_WRITE | 1976 #undef VM_OBJECT_WRITE |
| 1973 | 1977 |
| 1974 | 1978 |
| 1975 // An object visitor which will iterate over all the script objects in the heap | 1979 // An object visitor which will iterate over all the script objects in the heap |
| 1976 // and either count them or collect them into an array. This is used during | 1980 // and either count them or collect them into an array. This is used during |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 2004 Object& objHandle_; | 2008 Object& objHandle_; |
| 2005 intptr_t count_; | 2009 intptr_t count_; |
| 2006 const Array* scripts_; | 2010 const Array* scripts_; |
| 2007 }; | 2011 }; |
| 2008 | 2012 |
| 2009 | 2013 |
| 2010 FullSnapshotWriter::FullSnapshotWriter(Snapshot::Kind kind, | 2014 FullSnapshotWriter::FullSnapshotWriter(Snapshot::Kind kind, |
| 2011 uint8_t** vm_isolate_snapshot_buffer, | 2015 uint8_t** vm_isolate_snapshot_buffer, |
| 2012 uint8_t** isolate_snapshot_buffer, | 2016 uint8_t** isolate_snapshot_buffer, |
| 2013 ReAlloc alloc, | 2017 ReAlloc alloc, |
| 2014 InstructionsWriter* instructions_writer, | 2018 InstructionsWriter* instructions_writer) |
| 2015 bool vm_isolate_is_symbolic) | |
| 2016 : thread_(Thread::Current()), | 2019 : thread_(Thread::Current()), |
| 2017 kind_(kind), | 2020 kind_(kind), |
| 2018 vm_isolate_snapshot_buffer_(vm_isolate_snapshot_buffer), | 2021 vm_isolate_snapshot_buffer_(vm_isolate_snapshot_buffer), |
| 2019 isolate_snapshot_buffer_(isolate_snapshot_buffer), | 2022 isolate_snapshot_buffer_(isolate_snapshot_buffer), |
| 2020 alloc_(alloc), | 2023 alloc_(alloc), |
| 2021 vm_isolate_snapshot_size_(0), | 2024 vm_isolate_snapshot_size_(0), |
| 2022 isolate_snapshot_size_(0), | 2025 isolate_snapshot_size_(0), |
| 2023 forward_list_(NULL), | 2026 forward_list_(NULL), |
| 2024 instructions_writer_(instructions_writer), | 2027 instructions_writer_(instructions_writer), |
| 2025 scripts_(Array::Handle(zone())), | 2028 scripts_(Array::Handle(zone())), |
| 2026 symbol_table_(Array::Handle(zone())), | 2029 saved_symbol_table_(Array::Handle(zone())), |
| 2027 vm_isolate_is_symbolic_(vm_isolate_is_symbolic) { | 2030 new_vm_symbol_table_(Array::Handle(zone())) { |
| 2028 ASSERT(isolate_snapshot_buffer_ != NULL); | 2031 ASSERT(isolate_snapshot_buffer_ != NULL); |
| 2029 ASSERT(alloc_ != NULL); | 2032 ASSERT(alloc_ != NULL); |
| 2030 ASSERT(isolate() != NULL); | 2033 ASSERT(isolate() != NULL); |
| 2031 ASSERT(ClassFinalizer::AllClassesFinalized()); | 2034 ASSERT(ClassFinalizer::AllClassesFinalized()); |
| 2032 ASSERT(isolate() != NULL); | 2035 ASSERT(isolate() != NULL); |
| 2033 ASSERT(heap() != NULL); | 2036 ASSERT(heap() != NULL); |
| 2034 ObjectStore* object_store = isolate()->object_store(); | 2037 ObjectStore* object_store = isolate()->object_store(); |
| 2035 ASSERT(object_store != NULL); | 2038 ASSERT(object_store != NULL); |
| 2036 // Ensure the class table is valid. | 2039 // Ensure the class table is valid. |
| 2037 #if defined(DEBUG) | 2040 #if defined(DEBUG) |
| 2038 isolate()->ValidateClassTable(); | 2041 isolate()->ValidateClassTable(); |
| 2039 #endif | 2042 #endif |
| 2040 | 2043 |
| 2041 // Collect all the script objects and their accompanying token stream objects | 2044 // Collect all the script objects and their accompanying token stream objects |
| 2042 // into an array so that we can write it out as part of the VM isolate | 2045 // into an array so that we can write it out as part of the VM isolate |
| 2043 // snapshot. We first count the number of script objects, allocate an array | 2046 // snapshot. We first count the number of script objects, allocate an array |
| 2044 // and then fill it up with the script objects. | 2047 // and then fill it up with the script objects. |
| 2045 ScriptVisitor scripts_counter(thread()); | 2048 ScriptVisitor scripts_counter(thread()); |
| 2046 heap()->IterateOldObjects(&scripts_counter); | 2049 heap()->IterateOldObjects(&scripts_counter); |
| 2047 intptr_t count = scripts_counter.count(); | 2050 intptr_t count = scripts_counter.count(); |
| 2048 scripts_ = Array::New(count, Heap::kOld); | 2051 scripts_ = Array::New(count, Heap::kOld); |
| 2049 ScriptVisitor script_visitor(thread(), &scripts_); | 2052 ScriptVisitor script_visitor(thread(), &scripts_); |
| 2050 heap()->IterateOldObjects(&script_visitor); | 2053 heap()->IterateOldObjects(&script_visitor); |
| 2051 | 2054 |
| 2052 if (vm_isolate_snapshot_buffer != NULL) { | 2055 if (vm_isolate_snapshot_buffer != NULL) { |
| 2053 // Stash the symbol table away for writing and reading into the vm isolate, | 2056 // Tuck away the current symbol table. |
| 2054 // and reset the symbol table for the regular isolate so that we do not | 2057 saved_symbol_table_ = object_store->symbol_table(); |
| 2055 // write these symbols into the snapshot of a regular dart isolate. | 2058 |
| 2056 symbol_table_ = object_store->symbol_table(); | 2059 // Create a unified symbol table that will be written as the vm isolate's |
| 2060 // symbol table. | |
| 2061 new_vm_symbol_table_ = Symbols::UnifiedSymbolTable(); | |
| 2062 | |
| 2063 // Create an empty symbol table that will be written as the isolate's symbol | |
| 2064 // table. | |
| 2057 Symbols::SetupSymbolTable(isolate()); | 2065 Symbols::SetupSymbolTable(isolate()); |
| 2058 } | 2066 } |
| 2059 | 2067 |
| 2060 forward_list_ = new ForwardList(thread(), SnapshotWriter::FirstObjectId()); | 2068 forward_list_ = new ForwardList(thread(), SnapshotWriter::FirstObjectId()); |
| 2061 ASSERT(forward_list_ != NULL); | 2069 ASSERT(forward_list_ != NULL); |
| 2062 } | 2070 } |
| 2063 | 2071 |
| 2064 | 2072 |
| 2065 FullSnapshotWriter::~FullSnapshotWriter() { | 2073 FullSnapshotWriter::~FullSnapshotWriter() { |
| 2066 delete forward_list_; | 2074 delete forward_list_; |
| 2067 // We may run Dart code afterwards, restore the symbol table if needed. | 2075 // We may run Dart code afterwards, restore the symbol table if needed. |
| 2068 if (!symbol_table_.IsNull()) { | 2076 if (!saved_symbol_table_.IsNull()) { |
| 2069 isolate()->object_store()->set_symbol_table(symbol_table_); | 2077 isolate()->object_store()->set_symbol_table(saved_symbol_table_); |
| 2070 symbol_table_ = Array::null(); | 2078 saved_symbol_table_ = Array::null(); |
| 2071 } | 2079 } |
| 2080 new_vm_symbol_table_ = Array::null(); | |
| 2072 scripts_ = Array::null(); | 2081 scripts_ = Array::null(); |
| 2073 } | 2082 } |
| 2074 | 2083 |
| 2075 | 2084 |
| 2076 void FullSnapshotWriter::WriteVmIsolateSnapshot() { | 2085 void FullSnapshotWriter::WriteVmIsolateSnapshot() { |
| 2077 ASSERT(vm_isolate_snapshot_buffer_ != NULL); | 2086 ASSERT(vm_isolate_snapshot_buffer_ != NULL); |
| 2078 SnapshotWriter writer(thread(), | 2087 SnapshotWriter writer(thread(), |
| 2079 kind_, | 2088 kind_, |
| 2080 vm_isolate_snapshot_buffer_, | 2089 vm_isolate_snapshot_buffer_, |
| 2081 alloc_, | 2090 alloc_, |
| 2082 kInitialSize, | 2091 kInitialSize, |
| 2083 forward_list_, | 2092 forward_list_, |
| 2084 instructions_writer_, | 2093 instructions_writer_, |
| 2085 true, /* can_send_any_object */ | 2094 true, /* can_send_any_object */ |
| 2086 vm_isolate_is_symbolic_); | 2095 true /* writing_vm_isolate */); |
| 2087 // Write full snapshot for the VM isolate. | 2096 // Write full snapshot for the VM isolate. |
| 2088 // Setup for long jump in case there is an exception while writing | 2097 // Setup for long jump in case there is an exception while writing |
| 2089 // the snapshot. | 2098 // the snapshot. |
| 2090 LongJumpScope jump; | 2099 LongJumpScope jump; |
| 2091 if (setjmp(*jump.Set()) == 0) { | 2100 if (setjmp(*jump.Set()) == 0) { |
| 2092 // Reserve space in the output buffer for a snapshot header. | 2101 // Reserve space in the output buffer for a snapshot header. |
| 2093 writer.ReserveHeader(); | 2102 writer.ReserveHeader(); |
| 2094 | 2103 |
| 2095 // Write out the version string. | 2104 // Write out the version string. |
| 2096 writer.WriteVersion(); | 2105 writer.WriteVersion(); |
| 2097 | 2106 |
| 2098 /* | 2107 /* |
| 2099 * Now Write out the following | 2108 * Now Write out the following |
| 2100 * - the symbol table | 2109 * - the symbol table |
| 2101 * - all the scripts and token streams for these scripts | 2110 * - all the scripts and token streams for these scripts |
| 2102 * | 2111 * - the stub code (precompiled snapshots only) |
| 2103 **/ | 2112 **/ |
| 2104 // Write out the symbol table. | 2113 // Write out the symbol table. |
| 2105 writer.WriteObject(symbol_table_.raw()); | 2114 writer.WriteObject(new_vm_symbol_table_.raw()); |
| 2106 | 2115 |
| 2107 // Write out all the script objects and the accompanying token streams | 2116 // Write out all the script objects and the accompanying token streams |
| 2108 // for the bootstrap libraries so that they are in the VM isolate | 2117 // for the bootstrap libraries so that they are in the VM isolate |
| 2109 // read only memory. | 2118 // read only memory. |
| 2110 writer.WriteObject(scripts_.raw()); | 2119 writer.WriteObject(scripts_.raw()); |
| 2111 | 2120 |
| 2112 if (Snapshot::IncludesCode(kind_)) { | 2121 if (Snapshot::IncludesCode(kind_)) { |
| 2113 ASSERT(!vm_isolate_is_symbolic_); | |
| 2114 StubCode::WriteTo(&writer); | 2122 StubCode::WriteTo(&writer); |
| 2115 } | 2123 } |
| 2116 | 2124 |
| 2117 | |
| 2118 writer.FillHeader(writer.kind()); | 2125 writer.FillHeader(writer.kind()); |
| 2119 | 2126 |
| 2120 vm_isolate_snapshot_size_ = writer.BytesWritten(); | 2127 vm_isolate_snapshot_size_ = writer.BytesWritten(); |
| 2121 } else { | 2128 } else { |
| 2122 writer.ThrowException(writer.exception_type(), writer.exception_msg()); | 2129 writer.ThrowException(writer.exception_type(), writer.exception_msg()); |
| 2123 } | 2130 } |
| 2124 } | 2131 } |
| 2125 | 2132 |
| 2126 | 2133 |
| 2127 void FullSnapshotWriter::WriteIsolateFullSnapshot() { | 2134 void FullSnapshotWriter::WriteIsolateFullSnapshot() { |
| 2128 SnapshotWriter writer(thread(), | 2135 SnapshotWriter writer(thread(), |
| 2129 kind_, | 2136 kind_, |
| 2130 isolate_snapshot_buffer_, | 2137 isolate_snapshot_buffer_, |
| 2131 alloc_, | 2138 alloc_, |
| 2132 kInitialSize, | 2139 kInitialSize, |
| 2133 forward_list_, | 2140 forward_list_, |
| 2134 instructions_writer_, | 2141 instructions_writer_, |
| 2135 true, /* can_send_any_object */ | 2142 true, /* can_send_any_object */ |
| 2136 true /* vm_isolate_is_symbolic */); | 2143 false /* writing_vm_isolate */); |
| 2137 ObjectStore* object_store = isolate()->object_store(); | 2144 ObjectStore* object_store = isolate()->object_store(); |
| 2138 ASSERT(object_store != NULL); | 2145 ASSERT(object_store != NULL); |
| 2139 | 2146 |
| 2140 // Write full snapshot for a regular isolate. | 2147 // Write full snapshot for a regular isolate. |
| 2141 // Setup for long jump in case there is an exception while writing | 2148 // Setup for long jump in case there is an exception while writing |
| 2142 // the snapshot. | 2149 // the snapshot. |
| 2143 LongJumpScope jump; | 2150 LongJumpScope jump; |
| 2144 if (setjmp(*jump.Set()) == 0) { | 2151 if (setjmp(*jump.Set()) == 0) { |
| 2145 // Reserve space in the output buffer for a snapshot header. | 2152 // Reserve space in the output buffer for a snapshot header. |
| 2146 writer.ReserveHeader(); | 2153 writer.ReserveHeader(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2190 | 2197 |
| 2191 PrecompiledSnapshotWriter::PrecompiledSnapshotWriter( | 2198 PrecompiledSnapshotWriter::PrecompiledSnapshotWriter( |
| 2192 uint8_t** vm_isolate_snapshot_buffer, | 2199 uint8_t** vm_isolate_snapshot_buffer, |
| 2193 uint8_t** isolate_snapshot_buffer, | 2200 uint8_t** isolate_snapshot_buffer, |
| 2194 ReAlloc alloc, | 2201 ReAlloc alloc, |
| 2195 InstructionsWriter* instructions_writer) | 2202 InstructionsWriter* instructions_writer) |
| 2196 : FullSnapshotWriter(Snapshot::kAppNoJIT, | 2203 : FullSnapshotWriter(Snapshot::kAppNoJIT, |
| 2197 vm_isolate_snapshot_buffer, | 2204 vm_isolate_snapshot_buffer, |
| 2198 isolate_snapshot_buffer, | 2205 isolate_snapshot_buffer, |
| 2199 alloc, | 2206 alloc, |
| 2200 instructions_writer, | 2207 instructions_writer) { |
| 2201 false /* vm_isolate_is_symbolic */) { | |
| 2202 } | 2208 } |
| 2203 | 2209 |
| 2204 | 2210 |
| 2205 PrecompiledSnapshotWriter::~PrecompiledSnapshotWriter() {} | 2211 PrecompiledSnapshotWriter::~PrecompiledSnapshotWriter() {} |
| 2206 | 2212 |
| 2207 | 2213 |
| 2208 ForwardList::ForwardList(Thread* thread, intptr_t first_object_id) | 2214 ForwardList::ForwardList(Thread* thread, intptr_t first_object_id) |
| 2209 : thread_(thread), | 2215 : thread_(thread), |
| 2210 first_object_id_(first_object_id), | 2216 first_object_id_(first_object_id), |
| 2211 nodes_(), | 2217 nodes_(), |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2270 // Check if object has already been serialized, in that case just write | 2276 // Check if object has already been serialized, in that case just write |
| 2271 // the object id out. | 2277 // the object id out. |
| 2272 intptr_t object_id = forward_list_->FindObject(rawobj); | 2278 intptr_t object_id = forward_list_->FindObject(rawobj); |
| 2273 if (object_id != kInvalidIndex) { | 2279 if (object_id != kInvalidIndex) { |
| 2274 WriteIndexedObject(object_id); | 2280 WriteIndexedObject(object_id); |
| 2275 return true; | 2281 return true; |
| 2276 } | 2282 } |
| 2277 | 2283 |
| 2278 // Now check if it is an object from the VM isolate. These objects are shared | 2284 // Now check if it is an object from the VM isolate. These objects are shared |
| 2279 // by all isolates. | 2285 // by all isolates. |
| 2280 if (rawobj->IsVMHeapObject() && HandleVMIsolateObject(rawobj)) { | 2286 if (rawobj->IsVMHeapObject() && HandleVMIsolateObject(rawobj)) { |
|
siva
2016/05/05 00:50:04
You could convert this to
if (rawobj->IsVMHeapObje
rmacnak
2016/05/05 20:40:57
It's not just kCodeCid but also kObjectPool (and w
| |
| 2281 return true; | 2287 return true; |
| 2282 } | 2288 } |
| 2283 | 2289 |
| 2284 // Check if it is a code object in that case just write a Null object | 2290 // Check if it is a code object in that case just write a Null object |
| 2285 // as we do not want code objects in the snapshot. | 2291 // as we do not want code objects in the snapshot. |
| 2286 if (cid == kCodeCid && !Snapshot::IncludesCode(kind_)) { | 2292 if (cid == kCodeCid && !Snapshot::IncludesCode(kind_)) { |
| 2287 WriteVMIsolateObject(kNullObject); | 2293 WriteVMIsolateObject(kNullObject); |
| 2288 return true; | 2294 return true; |
| 2289 } | 2295 } |
| 2290 | 2296 |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2706 ScriptSnapshotWriter::ScriptSnapshotWriter(uint8_t** buffer, | 2712 ScriptSnapshotWriter::ScriptSnapshotWriter(uint8_t** buffer, |
| 2707 ReAlloc alloc) | 2713 ReAlloc alloc) |
| 2708 : SnapshotWriter(Thread::Current(), | 2714 : SnapshotWriter(Thread::Current(), |
| 2709 Snapshot::kScript, | 2715 Snapshot::kScript, |
| 2710 buffer, | 2716 buffer, |
| 2711 alloc, | 2717 alloc, |
| 2712 kInitialSize, | 2718 kInitialSize, |
| 2713 &forward_list_, | 2719 &forward_list_, |
| 2714 NULL, /* instructions_writer */ | 2720 NULL, /* instructions_writer */ |
| 2715 true, /* can_send_any_object */ | 2721 true, /* can_send_any_object */ |
| 2716 true /* vm_isolate_is_symbolic */), | 2722 false /* writing_vm_isolate */), |
| 2717 forward_list_(thread(), kMaxPredefinedObjectIds) { | 2723 forward_list_(thread(), kMaxPredefinedObjectIds) { |
| 2718 ASSERT(buffer != NULL); | 2724 ASSERT(buffer != NULL); |
| 2719 ASSERT(alloc != NULL); | 2725 ASSERT(alloc != NULL); |
| 2720 } | 2726 } |
| 2721 | 2727 |
| 2722 | 2728 |
| 2723 void ScriptSnapshotWriter::WriteScriptSnapshot(const Library& lib) { | 2729 void ScriptSnapshotWriter::WriteScriptSnapshot(const Library& lib) { |
| 2724 ASSERT(kind() == Snapshot::kScript); | 2730 ASSERT(kind() == Snapshot::kScript); |
| 2725 ASSERT(isolate() != NULL); | 2731 ASSERT(isolate() != NULL); |
| 2726 ASSERT(ClassFinalizer::AllClassesFinalized()); | 2732 ASSERT(ClassFinalizer::AllClassesFinalized()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2762 ReAlloc alloc, | 2768 ReAlloc alloc, |
| 2763 bool can_send_any_object) | 2769 bool can_send_any_object) |
| 2764 : SnapshotWriter(Thread::Current(), | 2770 : SnapshotWriter(Thread::Current(), |
| 2765 Snapshot::kMessage, | 2771 Snapshot::kMessage, |
| 2766 buffer, | 2772 buffer, |
| 2767 alloc, | 2773 alloc, |
| 2768 kInitialSize, | 2774 kInitialSize, |
| 2769 &forward_list_, | 2775 &forward_list_, |
| 2770 NULL, /* instructions_writer */ | 2776 NULL, /* instructions_writer */ |
| 2771 can_send_any_object, | 2777 can_send_any_object, |
| 2772 true /* vm_isolate_is_symbolic */), | 2778 false /* writing_vm_isolate */), |
| 2773 forward_list_(thread(), kMaxPredefinedObjectIds) { | 2779 forward_list_(thread(), kMaxPredefinedObjectIds) { |
| 2774 ASSERT(buffer != NULL); | 2780 ASSERT(buffer != NULL); |
| 2775 ASSERT(alloc != NULL); | 2781 ASSERT(alloc != NULL); |
| 2776 } | 2782 } |
| 2777 | 2783 |
| 2778 | 2784 |
| 2779 void MessageWriter::WriteMessage(const Object& obj) { | 2785 void MessageWriter::WriteMessage(const Object& obj) { |
| 2780 ASSERT(kind() == Snapshot::kMessage); | 2786 ASSERT(kind() == Snapshot::kMessage); |
| 2781 ASSERT(isolate() != NULL); | 2787 ASSERT(isolate() != NULL); |
| 2782 | 2788 |
| 2783 // Setup for long jump in case there is an exception while writing | 2789 // Setup for long jump in case there is an exception while writing |
| 2784 // the message. | 2790 // the message. |
| 2785 LongJumpScope jump; | 2791 LongJumpScope jump; |
| 2786 if (setjmp(*jump.Set()) == 0) { | 2792 if (setjmp(*jump.Set()) == 0) { |
| 2787 NoSafepointScope no_safepoint; | 2793 NoSafepointScope no_safepoint; |
| 2788 WriteObject(obj.raw()); | 2794 WriteObject(obj.raw()); |
| 2789 } else { | 2795 } else { |
| 2790 ThrowException(exception_type(), exception_msg()); | 2796 ThrowException(exception_type(), exception_msg()); |
| 2791 } | 2797 } |
| 2792 } | 2798 } |
| 2793 | 2799 |
| 2794 | 2800 |
| 2795 } // namespace dart | 2801 } // namespace dart |
| OLD | NEW |