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

Unified Diff: vm/snapshot.cc

Issue 10914050: Use external byte arrays for token stream, this moves the token stream out of the isolate heap. For… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « vm/snapshot.h ('k') | vm/snapshot_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/snapshot.cc
===================================================================
--- vm/snapshot.cc (revision 11973)
+++ vm/snapshot.cc (working copy)
@@ -156,6 +156,8 @@
type_(AbstractType::Handle()),
type_arguments_(AbstractTypeArguments::Handle()),
tokens_(Array::Handle()),
+ stream_(TokenStream::Handle()),
+ data_(ExternalUint8Array::Handle()),
backward_references_((kind == Snapshot::kFull) ?
kNumInitialReferencesInFullSnapshot :
kNumInitialReferences) {
@@ -403,9 +405,24 @@
RawTokenStream* SnapshotReader::NewTokenStream(intptr_t len) {
- ALLOC_NEW_OBJECT_WITH_LEN(TokenStream,
- Object::token_stream_class(),
- len);
+ ASSERT(kind_ == Snapshot::kFull);
+ ASSERT(isolate()->no_gc_scope_depth() != 0);
+ cls_ = Object::token_stream_class();
+ stream_ = reinterpret_cast<RawTokenStream*>(
+ AllocateUninitialized(cls_, TokenStream::InstanceSize()));
+ cls_ = object_store()->external_int8_array_class();
+ uint8_t* array = const_cast<uint8_t*>(CurrentBufferAddress());
+ ASSERT(array != NULL);
+ Advance(len);
+ ExternalByteArrayData<uint8_t>* external_data =
+ new ExternalByteArrayData<uint8_t>(array, NULL, NULL);
+ ASSERT(external_data != NULL);
+ data_ = reinterpret_cast<RawExternalUint8Array*>(
+ AllocateUninitialized(cls_, ExternalUint8Array::InstanceSize()));
+ data_.SetExternalData(external_data);
+ data_.SetLength(len);
+ stream_.SetStream(data_);
+ return stream_.raw();
}
« no previous file with comments | « vm/snapshot.h ('k') | vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698