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

Unified Diff: runtime/vm/snapshot_test.cc

Issue 1952023002: Minor cleanup based on profiler output of CompileParseFunction. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« runtime/vm/raw_object.h ('K') | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot_test.cc
diff --git a/runtime/vm/snapshot_test.cc b/runtime/vm/snapshot_test.cc
index ef7a10cfcc4ba283caffac486b9d9600604f0408..3bc4561bfc3d0072d8017ed6c0d11b1a40dcfcea 100644
--- a/runtime/vm/snapshot_test.cc
+++ b/runtime/vm/snapshot_test.cc
@@ -859,27 +859,32 @@ static void GenerateSourceAndCheck(const Script& script) {
// 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.
- const TokenStream& expected_tokens = TokenStream::Handle(script.tokens());
+ Zone* zone = Thread::Current()->zone();
+ const TokenStream& expected_tokens =
+ TokenStream::Handle(zone, script.tokens());
TokenStream::Iterator expected_iterator(
+ zone,
expected_tokens,
TokenPosition::kMinSource,
TokenStream::Iterator::kAllTokens);
- const String& str = String::Handle(expected_tokens.GenerateSource());
- const String& private_key = String::Handle(expected_tokens.PrivateKey());
+ const String& str = String::Handle(zone, expected_tokens.GenerateSource());
+ const String& private_key =
+ String::Handle(zone, expected_tokens.PrivateKey());
Scanner scanner(str, private_key);
const TokenStream& reconstructed_tokens =
- TokenStream::Handle(TokenStream::New(scanner.GetStream(),
- private_key,
- false));
+ TokenStream::Handle(zone, TokenStream::New(scanner.GetStream(),
+ private_key,
+ false));
expected_iterator.SetCurrentPosition(TokenPosition::kMinSource);
TokenStream::Iterator reconstructed_iterator(
+ zone,
reconstructed_tokens,
TokenPosition::kMinSource,
TokenStream::Iterator::kAllTokens);
Token::Kind expected_kind = expected_iterator.CurrentTokenKind();
Token::Kind reconstructed_kind = reconstructed_iterator.CurrentTokenKind();
- String& expected_literal = String::Handle();
- String& actual_literal = String::Handle();
+ String& expected_literal = String::Handle(zone);
+ String& actual_literal = String::Handle(zone);
while (expected_kind != Token::kEOS && reconstructed_kind != Token::kEOS) {
EXPECT_EQ(expected_kind, reconstructed_kind);
expected_literal ^= expected_iterator.CurrentLiteral();
@@ -937,13 +942,14 @@ TEST_CASE(SerializeScript) {
" }\n"
"}\n";
- String& url = String::Handle(String::New("dart-test:SerializeScript"));
- String& source = String::Handle(String::New(kScriptChars));
- Script& script = Script::Handle(Script::New(url,
- source,
- RawScript::kScriptTag));
- const String& lib_url = String::Handle(Symbols::New(thread, "TestLib"));
- Library& lib = Library::Handle(Library::New(lib_url));
+ Zone* zone = thread->zone();
+ String& url = String::Handle(zone, String::New("dart-test:SerializeScript"));
+ String& source = String::Handle(zone, String::New(kScriptChars));
+ Script& script = Script::Handle(zone, Script::New(url,
+ source,
+ RawScript::kScriptTag));
+ const String& lib_url = String::Handle(zone, Symbols::New(thread, "TestLib"));
+ Library& lib = Library::Handle(zone, Library::New(lib_url));
lib.Register();
EXPECT(CompilerTest::TestCompileScript(lib, script));
@@ -954,27 +960,30 @@ TEST_CASE(SerializeScript) {
// Read object back from the snapshot.
ScriptSnapshotReader reader(buffer, writer.BytesWritten(), thread);
- Script& serialized_script = Script::Handle(thread->zone());
+ Script& serialized_script = Script::Handle(zone);
serialized_script ^= reader.ReadObject();
// Check if the serialized script object matches the original script.
- String& expected_literal = String::Handle();
- String& actual_literal = String::Handle();
- String& str = String::Handle();
+ String& expected_literal = String::Handle(zone);
+ String& actual_literal = String::Handle(zone);
+ String& str = String::Handle(zone);
str ^= serialized_script.url();
EXPECT(url.Equals(str));
- const TokenStream& expected_tokens = TokenStream::Handle(script.tokens());
+ const TokenStream& expected_tokens =
+ TokenStream::Handle(zone, script.tokens());
const TokenStream& serialized_tokens =
- TokenStream::Handle(serialized_script.tokens());
+ TokenStream::Handle(zone, serialized_script.tokens());
const ExternalTypedData& expected_data =
- ExternalTypedData::Handle(expected_tokens.GetStream());
+ ExternalTypedData::Handle(zone, expected_tokens.GetStream());
const ExternalTypedData& serialized_data =
- ExternalTypedData::Handle(serialized_tokens.GetStream());
+ ExternalTypedData::Handle(zone, serialized_tokens.GetStream());
EXPECT_EQ(expected_data.Length(), serialized_data.Length());
- TokenStream::Iterator expected_iterator(expected_tokens,
+ TokenStream::Iterator expected_iterator(zone,
+ expected_tokens,
TokenPosition::kMinSource);
- TokenStream::Iterator serialized_iterator(serialized_tokens,
+ TokenStream::Iterator serialized_iterator(zone,
+ serialized_tokens,
TokenPosition::kMinSource);
Token::Kind expected_kind = expected_iterator.CurrentTokenKind();
Token::Kind serialized_kind = serialized_iterator.CurrentTokenKind();
« runtime/vm/raw_object.h ('K') | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698