| OLD | NEW | 
|---|
| 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 851 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 862   // Check if we are able to generate the source from the token stream. | 862   // Check if we are able to generate the source from the token stream. | 
| 863   // Rescan this source and compare the token stream to see if they are | 863   // Rescan this source and compare the token stream to see if they are | 
| 864   // the same. | 864   // the same. | 
| 865   const TokenStream& expected_tokens = TokenStream::Handle(script.tokens()); | 865   const TokenStream& expected_tokens = TokenStream::Handle(script.tokens()); | 
| 866   TokenStream::Iterator expected_iterator( | 866   TokenStream::Iterator expected_iterator( | 
| 867       expected_tokens, 0, TokenStream::Iterator::kAllTokens); | 867       expected_tokens, 0, TokenStream::Iterator::kAllTokens); | 
| 868   const String& str = String::Handle(expected_tokens.GenerateSource()); | 868   const String& str = String::Handle(expected_tokens.GenerateSource()); | 
| 869   const String& private_key = String::Handle(expected_tokens.PrivateKey()); | 869   const String& private_key = String::Handle(expected_tokens.PrivateKey()); | 
| 870   Scanner scanner(str, private_key); | 870   Scanner scanner(str, private_key); | 
| 871   const TokenStream& reconstructed_tokens = | 871   const TokenStream& reconstructed_tokens = | 
| 872       TokenStream::Handle(TokenStream::New(scanner.GetStream(), private_key)); | 872       TokenStream::Handle(TokenStream::New(scanner.GetStream(), | 
|  | 873                                            private_key, | 
|  | 874                                            false)); | 
| 873   expected_iterator.SetCurrentPosition(0); | 875   expected_iterator.SetCurrentPosition(0); | 
| 874   TokenStream::Iterator reconstructed_iterator( | 876   TokenStream::Iterator reconstructed_iterator( | 
| 875       reconstructed_tokens, 0, TokenStream::Iterator::kAllTokens); | 877       reconstructed_tokens, 0, TokenStream::Iterator::kAllTokens); | 
| 876   Token::Kind expected_kind = expected_iterator.CurrentTokenKind(); | 878   Token::Kind expected_kind = expected_iterator.CurrentTokenKind(); | 
| 877   Token::Kind reconstructed_kind = reconstructed_iterator.CurrentTokenKind(); | 879   Token::Kind reconstructed_kind = reconstructed_iterator.CurrentTokenKind(); | 
| 878   String& expected_literal = String::Handle(); | 880   String& expected_literal = String::Handle(); | 
| 879   String& actual_literal = String::Handle(); | 881   String& actual_literal = String::Handle(); | 
| 880   while (expected_kind != Token::kEOS && reconstructed_kind != Token::kEOS) { | 882   while (expected_kind != Token::kEOS && reconstructed_kind != Token::kEOS) { | 
| 881     EXPECT_EQ(expected_kind, reconstructed_kind); | 883     EXPECT_EQ(expected_kind, reconstructed_kind); | 
| 882     expected_literal ^= expected_iterator.CurrentLiteral(); | 884     expected_literal ^= expected_iterator.CurrentLiteral(); | 
| (...skipping 2113 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2996   StackZone zone(Thread::Current()); | 2998   StackZone zone(Thread::Current()); | 
| 2997   uint8_t* buffer; | 2999   uint8_t* buffer; | 
| 2998   MessageWriter writer(&buffer, &zone_allocator, true); | 3000   MessageWriter writer(&buffer, &zone_allocator, true); | 
| 2999   writer.WriteInlinedObjectHeader(kOmittedObjectId); | 3001   writer.WriteInlinedObjectHeader(kOmittedObjectId); | 
| 3000   // For performance, we'd like single-byte headers when ids are omitted. | 3002   // For performance, we'd like single-byte headers when ids are omitted. | 
| 3001   // If this starts failing, consider renumbering the snapshot ids. | 3003   // If this starts failing, consider renumbering the snapshot ids. | 
| 3002   EXPECT_EQ(1, writer.BytesWritten()); | 3004   EXPECT_EQ(1, writer.BytesWritten()); | 
| 3003 } | 3005 } | 
| 3004 | 3006 | 
| 3005 }  // namespace dart | 3007 }  // namespace dart | 
| OLD | NEW | 
|---|