| 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/bigint_operations.h" | 8 #include "vm/bigint_operations.h" |
| 9 #include "vm/bootstrap.h" | 9 #include "vm/bootstrap.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 kind_(kind), | 153 kind_(kind), |
| 154 isolate_(isolate), | 154 isolate_(isolate), |
| 155 cls_(Class::Handle()), | 155 cls_(Class::Handle()), |
| 156 obj_(Object::Handle()), | 156 obj_(Object::Handle()), |
| 157 str_(String::Handle()), | 157 str_(String::Handle()), |
| 158 library_(Library::Handle()), | 158 library_(Library::Handle()), |
| 159 type_(AbstractType::Handle()), | 159 type_(AbstractType::Handle()), |
| 160 type_arguments_(AbstractTypeArguments::Handle()), | 160 type_arguments_(AbstractTypeArguments::Handle()), |
| 161 tokens_(Array::Handle()), | 161 tokens_(Array::Handle()), |
| 162 stream_(TokenStream::Handle()), | 162 stream_(TokenStream::Handle()), |
| 163 data_(ExternalUint8Array::Handle()), | 163 data_(ExternalTypedData::Handle()), |
| 164 error_(UnhandledException::Handle()), | 164 error_(UnhandledException::Handle()), |
| 165 backward_references_((kind == Snapshot::kFull) ? | 165 backward_references_((kind == Snapshot::kFull) ? |
| 166 kNumInitialReferencesInFullSnapshot : | 166 kNumInitialReferencesInFullSnapshot : |
| 167 kNumInitialReferences) { | 167 kNumInitialReferences) { |
| 168 } | 168 } |
| 169 | 169 |
| 170 | 170 |
| 171 RawObject* SnapshotReader::ReadObject() { | 171 RawObject* SnapshotReader::ReadObject() { |
| 172 // Setup for long jump in case there is an exception while reading. | 172 // Setup for long jump in case there is an exception while reading. |
| 173 LongJump* base = isolate()->long_jump_base(); | 173 LongJump* base = isolate()->long_jump_base(); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 len); | 431 len); |
| 432 } | 432 } |
| 433 | 433 |
| 434 | 434 |
| 435 RawTokenStream* SnapshotReader::NewTokenStream(intptr_t len) { | 435 RawTokenStream* SnapshotReader::NewTokenStream(intptr_t len) { |
| 436 ASSERT(kind_ == Snapshot::kFull); | 436 ASSERT(kind_ == Snapshot::kFull); |
| 437 ASSERT(isolate()->no_gc_scope_depth() != 0); | 437 ASSERT(isolate()->no_gc_scope_depth() != 0); |
| 438 cls_ = Object::token_stream_class(); | 438 cls_ = Object::token_stream_class(); |
| 439 stream_ = reinterpret_cast<RawTokenStream*>( | 439 stream_ = reinterpret_cast<RawTokenStream*>( |
| 440 AllocateUninitialized(cls_, TokenStream::InstanceSize())); | 440 AllocateUninitialized(cls_, TokenStream::InstanceSize())); |
| 441 cls_ = object_store()->external_uint8_array_class(); | 441 cls_ = isolate()->class_table()->At(kExternalTypedDataUint8ArrayCid); |
| 442 uint8_t* array = const_cast<uint8_t*>(CurrentBufferAddress()); | 442 uint8_t* array = const_cast<uint8_t*>(CurrentBufferAddress()); |
| 443 ASSERT(array != NULL); | 443 ASSERT(array != NULL); |
| 444 Advance(len); | 444 Advance(len); |
| 445 data_ = reinterpret_cast<RawExternalUint8Array*>( | 445 data_ = reinterpret_cast<RawExternalTypedData*>( |
| 446 AllocateUninitialized(cls_, ExternalUint8Array::InstanceSize())); | 446 AllocateUninitialized(cls_, ExternalTypedData::InstanceSize())); |
| 447 data_.SetData(array); | 447 data_.SetData(array); |
| 448 data_.SetLength(len); | 448 data_.SetLength(len); |
| 449 stream_.SetStream(data_); | 449 stream_.SetStream(data_); |
| 450 return stream_.raw(); | 450 return stream_.raw(); |
| 451 } | 451 } |
| 452 | 452 |
| 453 | 453 |
| 454 RawContext* SnapshotReader::NewContext(intptr_t num_variables) { | 454 RawContext* SnapshotReader::NewContext(intptr_t num_variables) { |
| 455 ASSERT(kind_ == Snapshot::kFull); | 455 ASSERT(kind_ == Snapshot::kFull); |
| 456 ASSERT(isolate()->no_gc_scope_depth() != 0); | 456 ASSERT(isolate()->no_gc_scope_depth() != 0); |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 UnmarkAll(); | 1466 UnmarkAll(); |
| 1467 isolate->set_long_jump_base(base); | 1467 isolate->set_long_jump_base(base); |
| 1468 } else { | 1468 } else { |
| 1469 isolate->set_long_jump_base(base); | 1469 isolate->set_long_jump_base(base); |
| 1470 ThrowException(exception_type(), exception_msg()); | 1470 ThrowException(exception_type(), exception_msg()); |
| 1471 } | 1471 } |
| 1472 } | 1472 } |
| 1473 | 1473 |
| 1474 | 1474 |
| 1475 } // namespace dart | 1475 } // namespace dart |
| OLD | NEW |