| 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 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2168 } | 2168 } |
| 2169 | 2169 |
| 2170 static RawTokenStream* New(intptr_t length); | 2170 static RawTokenStream* New(intptr_t length); |
| 2171 static RawTokenStream* New(const Scanner::GrowableTokenStream& tokens, | 2171 static RawTokenStream* New(const Scanner::GrowableTokenStream& tokens, |
| 2172 const String& private_key); | 2172 const String& private_key); |
| 2173 | 2173 |
| 2174 // The class Iterator encapsulates iteration over the tokens | 2174 // The class Iterator encapsulates iteration over the tokens |
| 2175 // in a TokenStream object. | 2175 // in a TokenStream object. |
| 2176 class Iterator : ValueObject { | 2176 class Iterator : ValueObject { |
| 2177 public: | 2177 public: |
| 2178 Iterator(const TokenStream& tokens, intptr_t token_pos); | 2178 enum StreamType { |
| 2179 kNoNewlines, |
| 2180 kAllTokens |
| 2181 }; |
| 2182 |
| 2183 Iterator(const TokenStream& tokens, |
| 2184 intptr_t token_pos, |
| 2185 Iterator::StreamType stream_type = kNoNewlines); |
| 2179 | 2186 |
| 2180 void SetStream(const TokenStream& tokens, intptr_t token_pos); | 2187 void SetStream(const TokenStream& tokens, intptr_t token_pos); |
| 2181 bool IsValid() const; | 2188 bool IsValid() const; |
| 2182 | 2189 |
| 2183 inline Token::Kind CurrentTokenKind() const { | 2190 inline Token::Kind CurrentTokenKind() const { |
| 2184 return cur_token_kind_; | 2191 return cur_token_kind_; |
| 2185 } | 2192 } |
| 2186 | 2193 |
| 2187 Token::Kind LookaheadTokenKind(intptr_t num_tokens); | 2194 Token::Kind LookaheadTokenKind(intptr_t num_tokens); |
| 2188 | 2195 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2205 } | 2212 } |
| 2206 | 2213 |
| 2207 TokenStream& tokens_; | 2214 TokenStream& tokens_; |
| 2208 ExternalTypedData& data_; | 2215 ExternalTypedData& data_; |
| 2209 ReadStream stream_; | 2216 ReadStream stream_; |
| 2210 Array& token_objects_; | 2217 Array& token_objects_; |
| 2211 Object& obj_; | 2218 Object& obj_; |
| 2212 intptr_t cur_token_pos_; | 2219 intptr_t cur_token_pos_; |
| 2213 Token::Kind cur_token_kind_; | 2220 Token::Kind cur_token_kind_; |
| 2214 intptr_t cur_token_obj_index_; | 2221 intptr_t cur_token_obj_index_; |
| 2222 Iterator::StreamType stream_type_; |
| 2215 }; | 2223 }; |
| 2216 | 2224 |
| 2217 private: | 2225 private: |
| 2218 void SetPrivateKey(const String& value) const; | 2226 void SetPrivateKey(const String& value) const; |
| 2219 | 2227 |
| 2220 static RawTokenStream* New(); | 2228 static RawTokenStream* New(); |
| 2221 static void DataFinalizer(Dart_WeakPersistentHandle handle, void *peer); | 2229 static void DataFinalizer(Dart_WeakPersistentHandle handle, void *peer); |
| 2222 | 2230 |
| 2223 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object); | 2231 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object); |
| 2224 friend class Class; | 2232 friend class Class; |
| (...skipping 3943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6168 | 6176 |
| 6169 | 6177 |
| 6170 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6178 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6171 intptr_t index) { | 6179 intptr_t index) { |
| 6172 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6180 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6173 } | 6181 } |
| 6174 | 6182 |
| 6175 } // namespace dart | 6183 } // namespace dart |
| 6176 | 6184 |
| 6177 #endif // VM_OBJECT_H_ | 6185 #endif // VM_OBJECT_H_ |
| OLD | NEW |