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

Side by Side Diff: runtime/vm/object.h

Issue 1420103006: Shared token objects (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: cleanup Created 5 years, 1 month 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
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 #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 3083 matching lines...) Expand 10 before | Expand all | Expand 10 after
3094 void set_literal(const String& literal) const; 3094 void set_literal(const String& literal) const;
3095 void set_value(const Object& value) const; 3095 void set_value(const Object& value) const;
3096 3096
3097 FINAL_HEAP_OBJECT_IMPLEMENTATION(LiteralToken, Object); 3097 FINAL_HEAP_OBJECT_IMPLEMENTATION(LiteralToken, Object);
3098 friend class Class; 3098 friend class Class;
3099 }; 3099 };
3100 3100
3101 3101
3102 class TokenStream : public Object { 3102 class TokenStream : public Object {
3103 public: 3103 public:
3104 RawArray* TokenObjects() const; 3104 RawGrowableObjectArray* TokenObjects() const;
3105 void SetTokenObjects(const Array& value) const; 3105 void SetTokenObjects(const GrowableObjectArray& value) const;
3106 3106
3107 RawExternalTypedData* GetStream() const; 3107 RawExternalTypedData* GetStream() const;
3108 void SetStream(const ExternalTypedData& stream) const; 3108 void SetStream(const ExternalTypedData& stream) const;
3109 3109
3110 RawString* GenerateSource() const; 3110 RawString* GenerateSource() const;
3111 RawString* GenerateSource(intptr_t start, intptr_t end) const; 3111 RawString* GenerateSource(intptr_t start, intptr_t end) const;
3112 intptr_t ComputeSourcePosition(intptr_t tok_pos) const; 3112 intptr_t ComputeSourcePosition(intptr_t tok_pos) const;
3113 3113
3114 RawString* PrivateKey() const; 3114 RawString* PrivateKey() const;
3115 3115
3116 static const intptr_t kBytesPerElement = 1; 3116 static const intptr_t kBytesPerElement = 1;
3117 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; 3117 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement;
3118 3118
3119 static intptr_t InstanceSize() { 3119 static intptr_t InstanceSize() {
3120 return RoundedAllocationSize(sizeof(RawTokenStream)); 3120 return RoundedAllocationSize(sizeof(RawTokenStream));
3121 } 3121 }
3122 3122
3123 static RawTokenStream* New(intptr_t length); 3123 static RawTokenStream* New(intptr_t length);
3124 static RawTokenStream* New(const Scanner::GrowableTokenStream& tokens, 3124 static RawTokenStream* New(const Scanner::GrowableTokenStream& tokens,
3125 const String& private_key); 3125 const String& private_key,
3126 bool used_shared_tokens);
siva 2015/10/28 18:30:22 use_shared_tokens
hausner 2015/10/28 21:28:46 Doned.
3127
3128 static void OpenSharedTokenList(Isolate* isolate);
3129 static void CloseSharedTokenList(Isolate* isolate);
3126 3130
3127 // The class Iterator encapsulates iteration over the tokens 3131 // The class Iterator encapsulates iteration over the tokens
3128 // in a TokenStream object. 3132 // in a TokenStream object.
3129 class Iterator : ValueObject { 3133 class Iterator : ValueObject {
3130 public: 3134 public:
3131 enum StreamType { 3135 enum StreamType {
3132 kNoNewlines, 3136 kNoNewlines,
3133 kAllTokens 3137 kAllTokens
3134 }; 3138 };
3135 3139
(...skipping 24 matching lines...) Expand all
3160 // into the token objects array for IDENT or literal tokens). 3164 // into the token objects array for IDENT or literal tokens).
3161 intptr_t ReadToken() { 3165 intptr_t ReadToken() {
3162 int64_t value = stream_.ReadUnsigned(); 3166 int64_t value = stream_.ReadUnsigned();
3163 ASSERT((value >= 0) && (value <= kIntptrMax)); 3167 ASSERT((value >= 0) && (value <= kIntptrMax));
3164 return static_cast<intptr_t>(value); 3168 return static_cast<intptr_t>(value);
3165 } 3169 }
3166 3170
3167 TokenStream& tokens_; 3171 TokenStream& tokens_;
3168 ExternalTypedData& data_; 3172 ExternalTypedData& data_;
3169 ReadStream stream_; 3173 ReadStream stream_;
3170 Array& token_objects_; 3174 GrowableObjectArray& token_objects_;
3171 Object& obj_; 3175 Object& obj_;
3172 intptr_t cur_token_pos_; 3176 intptr_t cur_token_pos_;
3173 Token::Kind cur_token_kind_; 3177 Token::Kind cur_token_kind_;
3174 intptr_t cur_token_obj_index_; 3178 intptr_t cur_token_obj_index_;
3175 Iterator::StreamType stream_type_; 3179 Iterator::StreamType stream_type_;
3176 }; 3180 };
3177 3181
3178 private: 3182 private:
3179 void SetPrivateKey(const String& value) const; 3183 void SetPrivateKey(const String& value) const;
3180 3184
(...skipping 16 matching lines...) Expand all
3197 RawGrowableObjectArray* GenerateLineNumberArray() const; 3201 RawGrowableObjectArray* GenerateLineNumberArray() const;
3198 RawScript::Kind kind() const { 3202 RawScript::Kind kind() const {
3199 return static_cast<RawScript::Kind>(raw_ptr()->kind_); 3203 return static_cast<RawScript::Kind>(raw_ptr()->kind_);
3200 } 3204 }
3201 const char* GetKindAsCString() const; 3205 const char* GetKindAsCString() const;
3202 intptr_t line_offset() const { return raw_ptr()->line_offset_; } 3206 intptr_t line_offset() const { return raw_ptr()->line_offset_; }
3203 intptr_t col_offset() const { return raw_ptr()->col_offset_; } 3207 intptr_t col_offset() const { return raw_ptr()->col_offset_; }
3204 3208
3205 RawTokenStream* tokens() const { return raw_ptr()->tokens_; } 3209 RawTokenStream* tokens() const { return raw_ptr()->tokens_; }
3206 3210
3207 void Tokenize(const String& private_key) const; 3211 void Tokenize(const String& private_key,
3212 bool use_shared_tokens = true) const;
3208 3213
3209 RawLibrary* FindLibrary() const; 3214 RawLibrary* FindLibrary() const;
3210 RawString* GetLine(intptr_t line_number, 3215 RawString* GetLine(intptr_t line_number,
3211 Heap::Space space = Heap::kNew) const; 3216 Heap::Space space = Heap::kNew) const;
3212 RawString* GetSnippet(intptr_t from_line, 3217 RawString* GetSnippet(intptr_t from_line,
3213 intptr_t from_column, 3218 intptr_t from_column,
3214 intptr_t to_line, 3219 intptr_t to_line,
3215 intptr_t to_column) const; 3220 intptr_t to_column) const;
3216 3221
3217 void SetLocationOffset(intptr_t line_offset, intptr_t col_offset) const; 3222 void SetLocationOffset(intptr_t line_offset, intptr_t col_offset) const;
(...skipping 4958 matching lines...) Expand 10 before | Expand all | Expand 10 after
8176 8181
8177 8182
8178 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 8183 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
8179 intptr_t index) { 8184 intptr_t index) {
8180 return array.At((index * kEntryLength) + kTargetFunctionIndex); 8185 return array.At((index * kEntryLength) + kTargetFunctionIndex);
8181 } 8186 }
8182 8187
8183 } // namespace dart 8188 } // namespace dart
8184 8189
8185 #endif // VM_OBJECT_H_ 8190 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698