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

Unified Diff: vm/raw_object_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/raw_object.cc ('k') | vm/snapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/raw_object_snapshot.cc
===================================================================
--- vm/raw_object_snapshot.cc (revision 11973)
+++ vm/raw_object_snapshot.cc (working copy)
@@ -654,11 +654,12 @@
// Set the object tags.
token_stream.set_tags(tags);
- // Read the stream of tokens into the TokenStream object.
- {
+ // Read the stream of tokens into the TokenStream object for script
+ // snapshots as we made a copy of token stream.
+ if (kind == Snapshot::kScript) {
NoGCScope no_gc;
- reader->ReadBytes(reinterpret_cast<uint8_t*>(token_stream.EntryAddr(0)),
- len);
+ RawExternalUint8Array* stream = token_stream.GetStream();
+ reader->ReadBytes(stream->ptr()->external_data_->data(), len);
}
// Read in the literal/identifier token array.
@@ -687,9 +688,10 @@
writer->WriteIntptrValue(writer->GetObjectTags(this));
// Write out the length field and the token stream.
- intptr_t len = Smi::Value(ptr()->length_);
- writer->Write<RawObject*>(ptr()->length_);
- writer->WriteBytes(reinterpret_cast<uint8_t*>(ptr()->data_), len);
+ RawExternalUint8Array* stream = ptr()->stream_;
+ intptr_t len = Smi::Value(stream->ptr()->length_);
+ writer->Write<RawObject*>(stream->ptr()->length_);
+ writer->WriteBytes(stream->ptr()->external_data_->data(), len);
// Write out the literal/identifier token array.
writer->WriteObjectImpl(ptr()->token_objects_);
« no previous file with comments | « vm/raw_object.cc ('k') | vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698