| 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 "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 7932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7943 RawTokenStream* TokenStream::New(const Scanner::GrowableTokenStream& tokens, | 7943 RawTokenStream* TokenStream::New(const Scanner::GrowableTokenStream& tokens, |
| 7944 const String& private_key) { | 7944 const String& private_key) { |
| 7945 Isolate* isolate = Isolate::Current(); | 7945 Isolate* isolate = Isolate::Current(); |
| 7946 // Copy the relevant data out of the scanner into a compressed stream of | 7946 // Copy the relevant data out of the scanner into a compressed stream of |
| 7947 // tokens. | 7947 // tokens. |
| 7948 CompressedTokenStreamData data; | 7948 CompressedTokenStreamData data; |
| 7949 intptr_t len = tokens.length(); | 7949 intptr_t len = tokens.length(); |
| 7950 for (intptr_t i = 0; i < len; i++) { | 7950 for (intptr_t i = 0; i < len; i++) { |
| 7951 Scanner::TokenDescriptor token = tokens[i]; | 7951 Scanner::TokenDescriptor token = tokens[i]; |
| 7952 if (token.kind == Token::kIDENT) { // Identifier token. | 7952 if (token.kind == Token::kIDENT) { // Identifier token. |
| 7953 if (FLAG_compiler_stats) { | |
| 7954 INC_STAT(isolate, num_ident_tokens_total, 1); | |
| 7955 } | |
| 7956 data.AddIdentToken(token.literal); | 7953 data.AddIdentToken(token.literal); |
| 7957 } else if (Token::NeedsLiteralToken(token.kind)) { // Literal token. | 7954 } else if (Token::NeedsLiteralToken(token.kind)) { // Literal token. |
| 7958 if (FLAG_compiler_stats) { | |
| 7959 INC_STAT(isolate, num_literal_tokens_total, 1); | |
| 7960 } | |
| 7961 data.AddLiteralToken(token); | 7955 data.AddLiteralToken(token); |
| 7962 } else { // Keyword, pseudo keyword etc. | 7956 } else { // Keyword, pseudo keyword etc. |
| 7963 ASSERT(token.kind < Token::kNumTokens); | 7957 ASSERT(token.kind < Token::kNumTokens); |
| 7964 data.AddSimpleToken(token.kind); | 7958 data.AddSimpleToken(token.kind); |
| 7965 } | 7959 } |
| 7966 } | 7960 } |
| 7967 INC_STAT(isolate, num_tokens_total, len); | |
| 7968 data.AddSimpleToken(Token::kEOS); // End of stream. | 7961 data.AddSimpleToken(Token::kEOS); // End of stream. |
| 7969 | 7962 |
| 7970 // Create and setup the token stream object. | 7963 // Create and setup the token stream object. |
| 7971 const ExternalTypedData& stream = ExternalTypedData::Handle( | 7964 const ExternalTypedData& stream = ExternalTypedData::Handle( |
| 7972 isolate, | 7965 isolate, |
| 7973 ExternalTypedData::New(kExternalTypedDataUint8ArrayCid, | 7966 ExternalTypedData::New(kExternalTypedDataUint8ArrayCid, |
| 7974 data.GetStream(), data.Length(), Heap::kOld)); | 7967 data.GetStream(), data.Length(), Heap::kOld)); |
| 7975 stream.AddFinalizer(data.GetStream(), DataFinalizer); | 7968 stream.AddFinalizer(data.GetStream(), DataFinalizer); |
| 7976 const TokenStream& result = TokenStream::Handle(isolate, New()); | 7969 const TokenStream& result = TokenStream::Handle(isolate, New()); |
| 7977 result.SetPrivateKey(private_key); | 7970 result.SetPrivateKey(private_key); |
| (...skipping 12727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20705 return tag_label.ToCString(); | 20698 return tag_label.ToCString(); |
| 20706 } | 20699 } |
| 20707 | 20700 |
| 20708 | 20701 |
| 20709 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20702 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20710 Instance::PrintJSONImpl(stream, ref); | 20703 Instance::PrintJSONImpl(stream, ref); |
| 20711 } | 20704 } |
| 20712 | 20705 |
| 20713 | 20706 |
| 20714 } // namespace dart | 20707 } // namespace dart |
| OLD | NEW |