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 7727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7738 } | 7738 } |
7739 | 7739 |
7740 static uint8_t* Reallocate(uint8_t* ptr, | 7740 static uint8_t* Reallocate(uint8_t* ptr, |
7741 intptr_t old_size, | 7741 intptr_t old_size, |
7742 intptr_t new_size) { | 7742 intptr_t new_size) { |
7743 void* new_ptr = ::realloc(reinterpret_cast<void*>(ptr), new_size); | 7743 void* new_ptr = ::realloc(reinterpret_cast<void*>(ptr), new_size); |
7744 return reinterpret_cast<uint8_t*>(new_ptr); | 7744 return reinterpret_cast<uint8_t*>(new_ptr); |
7745 } | 7745 } |
7746 | 7746 |
7747 static const intptr_t kInitialTableSize = 32; | 7747 static const intptr_t kInitialTableSize = 32; |
7748 static const double kMaxLoadFactor = 0.75; | 7748 static const double kMaxLoadFactor; |
7749 | 7749 |
7750 uint8_t* buffer_; | 7750 uint8_t* buffer_; |
7751 WriteStream stream_; | 7751 WriteStream stream_; |
7752 CompressedTokenMap tokens_; | 7752 CompressedTokenMap tokens_; |
7753 | 7753 |
7754 DISALLOW_COPY_AND_ASSIGN(CompressedTokenStreamData); | 7754 DISALLOW_COPY_AND_ASSIGN(CompressedTokenStreamData); |
7755 }; | 7755 }; |
7756 | 7756 |
7757 | 7757 |
| 7758 const double CompressedTokenStreamData::kMaxLoadFactor = 0.75; |
| 7759 |
| 7760 |
7758 RawTokenStream* TokenStream::New(const Scanner::GrowableTokenStream& tokens, | 7761 RawTokenStream* TokenStream::New(const Scanner::GrowableTokenStream& tokens, |
7759 const String& private_key) { | 7762 const String& private_key) { |
7760 // Copy the relevant data out of the scanner into a compressed stream of | 7763 // Copy the relevant data out of the scanner into a compressed stream of |
7761 // tokens. | 7764 // tokens. |
7762 CompressedTokenStreamData data; | 7765 CompressedTokenStreamData data; |
7763 intptr_t len = tokens.length(); | 7766 intptr_t len = tokens.length(); |
7764 for (intptr_t i = 0; i < len; i++) { | 7767 for (intptr_t i = 0; i < len; i++) { |
7765 Scanner::TokenDescriptor token = tokens[i]; | 7768 Scanner::TokenDescriptor token = tokens[i]; |
7766 if (token.kind == Token::kIDENT) { // Identifier token. | 7769 if (token.kind == Token::kIDENT) { // Identifier token. |
7767 if (FLAG_compiler_stats) { | 7770 if (FLAG_compiler_stats) { |
(...skipping 11393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19161 return tag_label.ToCString(); | 19164 return tag_label.ToCString(); |
19162 } | 19165 } |
19163 | 19166 |
19164 | 19167 |
19165 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 19168 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
19166 Instance::PrintJSONImpl(stream, ref); | 19169 Instance::PrintJSONImpl(stream, ref); |
19167 } | 19170 } |
19168 | 19171 |
19169 | 19172 |
19170 } // namespace dart | 19173 } // namespace dart |
OLD | NEW |