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

Unified Diff: vm/snapshot_test.cc

Issue 10414005: Remove script source from the snapshot in order to reduce the size and to make the image size small… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 7 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_snapshot.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/snapshot_test.cc
===================================================================
--- vm/snapshot_test.cc (revision 7771)
+++ vm/snapshot_test.cc (working copy)
@@ -746,8 +746,6 @@
// Check if the serialized script object matches the original script.
String& str = String::Handle();
- str ^= serialized_script.source();
- EXPECT(source.Equals(str));
str ^= serialized_script.url();
EXPECT(url.Equals(str));
const TokenStream& expected_tokens = TokenStream::Handle(script.tokens());
@@ -762,6 +760,20 @@
actual_literal ^= serialized_tokens.LiteralAt(i);
EXPECT(expected_literal.Equals(actual_literal));
}
+ // Check if we are able to generate the source from the token stream.
+ // Rescan this source and compare the token stream to see if they are
+ // the same.
+ str ^= serialized_tokens.GenerateSource();
+ const String& dummy_key = String::Handle(String::New(""));
+ Scanner scanner(str, dummy_key);
+ const TokenStream& reconstructed_tokens =
+ TokenStream::Handle(TokenStream::New(scanner.GetStream()));
+ for (intptr_t i = 0; i < expected_tokens.Length(); i++) {
+ EXPECT_EQ(expected_tokens.KindAt(i), serialized_tokens.KindAt(i));
+ expected_literal ^= expected_tokens.LiteralAt(i);
+ actual_literal ^= reconstructed_tokens.LiteralAt(i);
+ EXPECT(expected_literal.Equals(actual_literal));
+ }
free(buffer);
}
« no previous file with comments | « vm/raw_object_snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698