Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: runtime/vm/snapshot.cc

Issue 1311403009: More precompiled snapshotting. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/snapshot.h ('k') | runtime/vm/stub_code.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 field_(Field::Handle(zone_)), 191 field_(Field::Handle(zone_)),
192 str_(String::Handle(zone_)), 192 str_(String::Handle(zone_)),
193 library_(Library::Handle(zone_)), 193 library_(Library::Handle(zone_)),
194 type_(AbstractType::Handle(zone_)), 194 type_(AbstractType::Handle(zone_)),
195 type_arguments_(TypeArguments::Handle(zone_)), 195 type_arguments_(TypeArguments::Handle(zone_)),
196 tokens_(Array::Handle(zone_)), 196 tokens_(Array::Handle(zone_)),
197 stream_(TokenStream::Handle(zone_)), 197 stream_(TokenStream::Handle(zone_)),
198 data_(ExternalTypedData::Handle(zone_)), 198 data_(ExternalTypedData::Handle(zone_)),
199 typed_data_(TypedData::Handle(zone_)), 199 typed_data_(TypedData::Handle(zone_)),
200 code_(Code::Handle(zone_)), 200 code_(Code::Handle(zone_)),
201 function_(Function::Handle(zone_)),
202 megamorphic_cache_(MegamorphicCache::Handle(zone_)),
201 error_(UnhandledException::Handle(zone_)), 203 error_(UnhandledException::Handle(zone_)),
202 max_vm_isolate_object_id_( 204 max_vm_isolate_object_id_(
203 (kind == Snapshot::kFull) ? 205 (kind == Snapshot::kFull) ?
204 Object::vm_isolate_snapshot_object_table().Length() : 0), 206 Object::vm_isolate_snapshot_object_table().Length() : 0),
205 backward_references_(backward_refs), 207 backward_references_(backward_refs),
206 instructions_reader_(NULL) { 208 instructions_reader_(NULL) {
207 if (instructions_buffer != NULL) { 209 if (instructions_buffer != NULL) {
208 instructions_reader_ = new InstructionsReader(instructions_buffer); 210 instructions_reader_ = new InstructionsReader(instructions_buffer);
209 } 211 }
210 } 212 }
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 *(ArrayHandle()) ^= ReadObject(); 1537 *(ArrayHandle()) ^= ReadObject();
1536 // TODO(rmacnak): 1538 // TODO(rmacnak):
1537 // ArgumentsDescriptor::InitOnceFromSnapshot(i, *(ArrayHandle())); 1539 // ArgumentsDescriptor::InitOnceFromSnapshot(i, *(ArrayHandle()));
1538 } 1540 }
1539 1541
1540 ObjectPool::CheckedHandle(ReadObject()); // empty pool 1542 ObjectPool::CheckedHandle(ReadObject()); // empty pool
1541 PcDescriptors::CheckedHandle(ReadObject()); // empty pc desc 1543 PcDescriptors::CheckedHandle(ReadObject()); // empty pc desc
1542 LocalVarDescriptors::CheckedHandle(ReadObject()); // empty var desc 1544 LocalVarDescriptors::CheckedHandle(ReadObject()); // empty var desc
1543 ExceptionHandlers::CheckedHandle(ReadObject()); // empty exc handlers 1545 ExceptionHandlers::CheckedHandle(ReadObject()); // empty exc handlers
1544 1546
1545 #define READ_STUB(name) \ 1547 StubCode::ReadFrom(this);
1546 *(CodeHandle()) ^= ReadObject();
1547 // TODO(rmacnak):
1548 // StubCode::name##_entry()->InitOnceFromSnapshot(CodeHandle())
1549 VM_STUB_CODE_LIST(READ_STUB);
1550 #undef READ_STUB
1551 } 1548 }
1552 1549
1553 // Validate the class table. 1550 // Validate the class table.
1554 #if defined(DEBUG) 1551 #if defined(DEBUG)
1555 isolate->ValidateClassTable(); 1552 isolate->ValidateClassTable();
1556 #endif 1553 #endif
1557 1554
1558 return ApiError::null(); 1555 return ApiError::null();
1559 } 1556 }
1560 } 1557 }
1561 1558
1562 1559
1563 IsolateSnapshotReader::IsolateSnapshotReader(const uint8_t* buffer, 1560 IsolateSnapshotReader::IsolateSnapshotReader(const uint8_t* buffer,
1564 intptr_t size, 1561 intptr_t size,
1565 const uint8_t* instructions_buffer, 1562 const uint8_t* instructions_buffer,
1566 Thread* thread) 1563 Thread* thread)
1567 : SnapshotReader(buffer, 1564 : SnapshotReader(buffer,
1568 size, 1565 size,
1569 instructions_buffer, 1566 instructions_buffer,
1570 Snapshot::kFull, 1567 Snapshot::kFull,
1571 new ZoneGrowableArray<BackRefNode>( 1568 new ZoneGrowableArray<BackRefNode>(
1572 kNumInitialReferencesInFullSnapshot), 1569 kNumInitialReferencesInFullSnapshot),
1573 thread) { 1570 thread) {
1571 isolate()->set_compilation_allowed(instructions_buffer_ == NULL);
1574 } 1572 }
1575 1573
1576 1574
1577 IsolateSnapshotReader::~IsolateSnapshotReader() { 1575 IsolateSnapshotReader::~IsolateSnapshotReader() {
1578 ResetBackwardReferenceTable(); 1576 ResetBackwardReferenceTable();
1579 } 1577 }
1580 1578
1581 1579
1582 ScriptSnapshotReader::ScriptSnapshotReader(const uint8_t* buffer, 1580 ScriptSnapshotReader::ScriptSnapshotReader(const uint8_t* buffer,
1583 intptr_t size, 1581 intptr_t size,
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 i < ArgumentsDescriptor::kCachedDescriptorCount; 1942 i < ArgumentsDescriptor::kCachedDescriptorCount;
1945 i++) { 1943 i++) {
1946 writer.WriteObject(ArgumentsDescriptor::cached_args_descriptors_[i]); 1944 writer.WriteObject(ArgumentsDescriptor::cached_args_descriptors_[i]);
1947 } 1945 }
1948 1946
1949 writer.WriteObject(Object::empty_object_pool().raw()); 1947 writer.WriteObject(Object::empty_object_pool().raw());
1950 writer.WriteObject(Object::empty_descriptors().raw()); 1948 writer.WriteObject(Object::empty_descriptors().raw());
1951 writer.WriteObject(Object::empty_var_descriptors().raw()); 1949 writer.WriteObject(Object::empty_var_descriptors().raw());
1952 writer.WriteObject(Object::empty_exception_handlers().raw()); 1950 writer.WriteObject(Object::empty_exception_handlers().raw());
1953 1951
1954 #define WRITE_STUB(name) \ 1952 StubCode::WriteTo(&writer);
1955 writer.WriteObject(StubCode::name##_entry()->code());
1956 VM_STUB_CODE_LIST(WRITE_STUB);
1957 #undef WRITE_STUB
1958 } 1953 }
1959 1954
1960 1955
1961 writer.FillHeader(writer.kind()); 1956 writer.FillHeader(writer.kind());
1962 1957
1963 vm_isolate_snapshot_size_ = writer.BytesWritten(); 1958 vm_isolate_snapshot_size_ = writer.BytesWritten();
1964 } else { 1959 } else {
1965 writer.ThrowException(writer.exception_type(), writer.exception_msg()); 1960 writer.ThrowException(writer.exception_type(), writer.exception_msg());
1966 } 1961 }
1967 } 1962 }
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
2788 NoSafepointScope no_safepoint; 2783 NoSafepointScope no_safepoint;
2789 WriteObject(obj.raw()); 2784 WriteObject(obj.raw());
2790 UnmarkAll(); 2785 UnmarkAll();
2791 } else { 2786 } else {
2792 ThrowException(exception_type(), exception_msg()); 2787 ThrowException(exception_type(), exception_msg());
2793 } 2788 }
2794 } 2789 }
2795 2790
2796 2791
2797 } // namespace dart 2792 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/snapshot.h ('k') | runtime/vm/stub_code.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698