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

Side by Side Diff: runtime/vm/snapshot_test.cc

Issue 1969563002: Eliminate GrowableTokenStream (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 unified diff | Download patch
« runtime/vm/scanner_test.cc ('K') | « runtime/vm/scanner_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "platform/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "include/dart_tools_api.h" 7 #include "include/dart_tools_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 const TokenStream& expected_tokens = 863 const TokenStream& expected_tokens =
864 TokenStream::Handle(zone, script.tokens()); 864 TokenStream::Handle(zone, script.tokens());
865 TokenStream::Iterator expected_iterator( 865 TokenStream::Iterator expected_iterator(
866 zone, 866 zone,
867 expected_tokens, 867 expected_tokens,
868 TokenPosition::kMinSource, 868 TokenPosition::kMinSource,
869 TokenStream::Iterator::kAllTokens); 869 TokenStream::Iterator::kAllTokens);
870 const String& str = String::Handle(zone, expected_tokens.GenerateSource()); 870 const String& str = String::Handle(zone, expected_tokens.GenerateSource());
871 const String& private_key = 871 const String& private_key =
872 String::Handle(zone, expected_tokens.PrivateKey()); 872 String::Handle(zone, expected_tokens.PrivateKey());
873 Scanner scanner(str, private_key);
874 const TokenStream& reconstructed_tokens = 873 const TokenStream& reconstructed_tokens =
875 TokenStream::Handle(zone, TokenStream::New(scanner.GetStream(), 874 TokenStream::Handle(zone, TokenStream::New(str,
876 private_key, 875 private_key,
877 false)); 876 false));
878 expected_iterator.SetCurrentPosition(TokenPosition::kMinSource); 877 expected_iterator.SetCurrentPosition(TokenPosition::kMinSource);
879 TokenStream::Iterator reconstructed_iterator( 878 TokenStream::Iterator reconstructed_iterator(
880 zone, 879 zone,
881 reconstructed_tokens, 880 reconstructed_tokens,
882 TokenPosition::kMinSource, 881 TokenPosition::kMinSource,
883 TokenStream::Iterator::kAllTokens); 882 TokenStream::Iterator::kAllTokens);
884 Token::Kind expected_kind = expected_iterator.CurrentTokenKind(); 883 Token::Kind expected_kind = expected_iterator.CurrentTokenKind();
885 Token::Kind reconstructed_kind = reconstructed_iterator.CurrentTokenKind(); 884 Token::Kind reconstructed_kind = reconstructed_iterator.CurrentTokenKind();
(...skipping 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after
3017 StackZone zone(Thread::Current()); 3016 StackZone zone(Thread::Current());
3018 uint8_t* buffer; 3017 uint8_t* buffer;
3019 MessageWriter writer(&buffer, &zone_allocator, true); 3018 MessageWriter writer(&buffer, &zone_allocator, true);
3020 writer.WriteInlinedObjectHeader(kOmittedObjectId); 3019 writer.WriteInlinedObjectHeader(kOmittedObjectId);
3021 // For performance, we'd like single-byte headers when ids are omitted. 3020 // For performance, we'd like single-byte headers when ids are omitted.
3022 // If this starts failing, consider renumbering the snapshot ids. 3021 // If this starts failing, consider renumbering the snapshot ids.
3023 EXPECT_EQ(1, writer.BytesWritten()); 3022 EXPECT_EQ(1, writer.BytesWritten());
3024 } 3023 }
3025 3024
3026 } // namespace dart 3025 } // namespace dart
OLDNEW
« runtime/vm/scanner_test.cc ('K') | « runtime/vm/scanner_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698