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

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

Issue 1644793002: Replace intptr_t with TokenDescriptor (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months 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
« no previous file with comments | « runtime/vm/megamorphic_cache_table.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "vm/json_stream.h" 11 #include "vm/json_stream.h"
12 #include "vm/bitmap.h" 12 #include "vm/bitmap.h"
13 #include "vm/dart.h" 13 #include "vm/dart.h"
14 #include "vm/globals.h" 14 #include "vm/globals.h"
15 #include "vm/growable_array.h" 15 #include "vm/growable_array.h"
16 #include "vm/handles.h" 16 #include "vm/handles.h"
17 #include "vm/heap.h" 17 #include "vm/heap.h"
18 #include "vm/isolate.h" 18 #include "vm/isolate.h"
19 #include "vm/method_recognizer.h" 19 #include "vm/method_recognizer.h"
20 #include "vm/os.h" 20 #include "vm/os.h"
21 #include "vm/raw_object.h" 21 #include "vm/raw_object.h"
22 #include "vm/report.h" 22 #include "vm/report.h"
23 #include "vm/scanner.h" 23 #include "vm/scanner.h"
24 #include "vm/tags.h" 24 #include "vm/tags.h"
25 #include "vm/thread.h" 25 #include "vm/thread.h"
26 #include "vm/token_position.h"
26 #include "vm/verified_memory.h" 27 #include "vm/verified_memory.h"
27 28
28 namespace dart { 29 namespace dart {
29 30
30 // Forward declarations. 31 // Forward declarations.
31 #define DEFINE_FORWARD_DECLARATION(clazz) \ 32 #define DEFINE_FORWARD_DECLARATION(clazz) \
32 class clazz; 33 class clazz;
33 CLASS_LIST(DEFINE_FORWARD_DECLARATION) 34 CLASS_LIST(DEFINE_FORWARD_DECLARATION)
34 #undef DEFINE_FORWARD_DECLARATION 35 #undef DEFINE_FORWARD_DECLARATION
35 class Api; 36 class Api;
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 RawString* Name() const; 932 RawString* Name() const;
932 RawString* PrettyName() const; 933 RawString* PrettyName() const;
933 RawString* UserVisibleName() const; 934 RawString* UserVisibleName() const;
934 bool IsInFullSnapshot() const; 935 bool IsInFullSnapshot() const;
935 936
936 virtual RawString* DictionaryName() const { return Name(); } 937 virtual RawString* DictionaryName() const { return Name(); }
937 938
938 RawScript* script() const { return raw_ptr()->script_; } 939 RawScript* script() const { return raw_ptr()->script_; }
939 void set_script(const Script& value) const; 940 void set_script(const Script& value) const;
940 941
941 intptr_t token_pos() const { return raw_ptr()->token_pos_; } 942 TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
942 void set_token_pos(intptr_t value) const; 943 void set_token_pos(TokenPosition value) const;
943 944
944 intptr_t ComputeEndTokenPos() const; 945 TokenPosition ComputeEndTokenPos() const;
945 946
946 // This class represents a typedef if the signature function is not null. 947 // This class represents a typedef if the signature function is not null.
947 RawFunction* signature_function() const { 948 RawFunction* signature_function() const {
948 return raw_ptr()->signature_function_; 949 return raw_ptr()->signature_function_;
949 } 950 }
950 void set_signature_function(const Function& value) const; 951 void set_signature_function(const Function& value) const;
951 952
952 // Return the Type with type parameters declared by this class filled in with 953 // Return the Type with type parameters declared by this class filled in with
953 // dynamic and type parameters declared in superclasses filled in as declared 954 // dynamic and type parameters declared in superclasses filled in as declared
954 // in superclass clauses. 955 // in superclass clauses.
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 const Array& param_values) const; 1300 const Array& param_values) const;
1300 1301
1301 RawError* EnsureIsFinalized(Thread* thread) const; 1302 RawError* EnsureIsFinalized(Thread* thread) const;
1302 1303
1303 // Allocate a class used for VM internal objects. 1304 // Allocate a class used for VM internal objects.
1304 template <class FakeObject> static RawClass* New(); 1305 template <class FakeObject> static RawClass* New();
1305 1306
1306 // Allocate instance classes. 1307 // Allocate instance classes.
1307 static RawClass* New(const String& name, 1308 static RawClass* New(const String& name,
1308 const Script& script, 1309 const Script& script,
1309 intptr_t token_pos); 1310 TokenPosition token_pos);
1310 static RawClass* NewNativeWrapper(const Library& library, 1311 static RawClass* NewNativeWrapper(const Library& library,
1311 const String& name, 1312 const String& name,
1312 int num_fields); 1313 int num_fields);
1313 1314
1314 // Allocate the raw string classes. 1315 // Allocate the raw string classes.
1315 static RawClass* NewStringClass(intptr_t class_id); 1316 static RawClass* NewStringClass(intptr_t class_id);
1316 1317
1317 // Allocate the raw TypedData classes. 1318 // Allocate the raw TypedData classes.
1318 static RawClass* NewTypedDataClass(intptr_t class_id); 1319 static RawClass* NewTypedDataClass(intptr_t class_id);
1319 1320
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 1463
1463 1464
1464 // Unresolved class is used for storing unresolved names which will be resolved 1465 // Unresolved class is used for storing unresolved names which will be resolved
1465 // to a class after all classes have been loaded and finalized. 1466 // to a class after all classes have been loaded and finalized.
1466 class UnresolvedClass : public Object { 1467 class UnresolvedClass : public Object {
1467 public: 1468 public:
1468 RawLibraryPrefix* library_prefix() const { 1469 RawLibraryPrefix* library_prefix() const {
1469 return raw_ptr()->library_prefix_; 1470 return raw_ptr()->library_prefix_;
1470 } 1471 }
1471 RawString* ident() const { return raw_ptr()->ident_; } 1472 RawString* ident() const { return raw_ptr()->ident_; }
1472 intptr_t token_pos() const { return raw_ptr()->token_pos_; } 1473 TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
1473 1474
1474 RawString* Name() const; 1475 RawString* Name() const;
1475 1476
1476 static intptr_t InstanceSize() { 1477 static intptr_t InstanceSize() {
1477 return RoundedAllocationSize(sizeof(RawUnresolvedClass)); 1478 return RoundedAllocationSize(sizeof(RawUnresolvedClass));
1478 } 1479 }
1479 1480
1480 static RawUnresolvedClass* New(const LibraryPrefix& library_prefix, 1481 static RawUnresolvedClass* New(const LibraryPrefix& library_prefix,
1481 const String& ident, 1482 const String& ident,
1482 intptr_t token_pos); 1483 TokenPosition token_pos);
1483 1484
1484 private: 1485 private:
1485 void set_library_prefix(const LibraryPrefix& library_prefix) const; 1486 void set_library_prefix(const LibraryPrefix& library_prefix) const;
1486 void set_ident(const String& ident) const; 1487 void set_ident(const String& ident) const;
1487 void set_token_pos(intptr_t token_pos) const; 1488 void set_token_pos(TokenPosition token_pos) const;
1488 1489
1489 static RawUnresolvedClass* New(); 1490 static RawUnresolvedClass* New();
1490 1491
1491 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object); 1492 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object);
1492 friend class Class; 1493 friend class Class;
1493 }; 1494 };
1494 1495
1495 1496
1496 typedef ZoneGrowableHandlePtrArray<const AbstractType> Trail; 1497 typedef ZoneGrowableHandlePtrArray<const AbstractType> Trail;
1497 typedef ZoneGrowableHandlePtrArray<const AbstractType>* TrailPtr; 1498 typedef ZoneGrowableHandlePtrArray<const AbstractType>* TrailPtr;
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 return "?"; 1991 return "?";
1991 } 1992 }
1992 } 1993 }
1993 1994
1994 // It is only meaningful to interptret range feedback stored in the ICData 1995 // It is only meaningful to interptret range feedback stored in the ICData
1995 // when all checks are Mint or Smi. 1996 // when all checks are Mint or Smi.
1996 bool HasRangeFeedback() const; 1997 bool HasRangeFeedback() const;
1997 RangeFeedback DecodeRangeFeedbackAt(intptr_t idx) const; 1998 RangeFeedback DecodeRangeFeedbackAt(intptr_t idx) const;
1998 1999
1999 void PrintToJSONArray(const JSONArray& jsarray, 2000 void PrintToJSONArray(const JSONArray& jsarray,
2000 intptr_t token_pos, 2001 TokenPosition token_pos,
2001 bool is_static_call) const; 2002 bool is_static_call) const;
2002 void PrintToJSONArrayNew(const JSONArray& jsarray, 2003 void PrintToJSONArrayNew(const JSONArray& jsarray,
2003 intptr_t token_pos, 2004 TokenPosition token_pos,
2004 bool is_static_call) const; 2005 bool is_static_call) const;
2005 2006
2006 // Initialize the preallocated empty ICData entry arrays. 2007 // Initialize the preallocated empty ICData entry arrays.
2007 static void InitOnce(); 2008 static void InitOnce();
2008 2009
2009 enum { 2010 enum {
2010 kCachedICDataArrayCount = 4 2011 kCachedICDataArrayCount = 4
2011 }; 2012 };
2012 2013
2013 private: 2014 private:
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
2305 case RawFunction::kClosureFunction: 2306 case RawFunction::kClosureFunction:
2306 case RawFunction::kConstructor: 2307 case RawFunction::kConstructor:
2307 return false; 2308 return false;
2308 default: 2309 default:
2309 UNREACHABLE(); 2310 UNREACHABLE();
2310 return false; 2311 return false;
2311 } 2312 }
2312 } 2313 }
2313 bool IsInFactoryScope() const; 2314 bool IsInFactoryScope() const;
2314 2315
2315 intptr_t token_pos() const { return raw_ptr()->token_pos_; } 2316 TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
2316 void set_token_pos(intptr_t value) const; 2317 void set_token_pos(TokenPosition value) const;
2317 2318
2318 intptr_t end_token_pos() const { return raw_ptr()->end_token_pos_; } 2319 TokenPosition end_token_pos() const { return raw_ptr()->end_token_pos_; }
2319 void set_end_token_pos(intptr_t value) const { 2320 void set_end_token_pos(TokenPosition value) const {
2320 StoreNonPointer(&raw_ptr()->end_token_pos_, value); 2321 StoreNonPointer(&raw_ptr()->end_token_pos_, value);
2321 } 2322 }
2322 2323
2323 intptr_t num_fixed_parameters() const { 2324 intptr_t num_fixed_parameters() const {
2324 return raw_ptr()->num_fixed_parameters_; 2325 return raw_ptr()->num_fixed_parameters_;
2325 } 2326 }
2326 void set_num_fixed_parameters(intptr_t value) const; 2327 void set_num_fixed_parameters(intptr_t value) const;
2327 2328
2328 bool HasOptionalParameters() const { 2329 bool HasOptionalParameters() const {
2329 return raw_ptr()->num_optional_parameters_ != 0; 2330 return raw_ptr()->num_optional_parameters_ != 0;
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
2597 } 2598 }
2598 2599
2599 static RawFunction* New(const String& name, 2600 static RawFunction* New(const String& name,
2600 RawFunction::Kind kind, 2601 RawFunction::Kind kind,
2601 bool is_static, 2602 bool is_static,
2602 bool is_const, 2603 bool is_const,
2603 bool is_abstract, 2604 bool is_abstract,
2604 bool is_external, 2605 bool is_external,
2605 bool is_native, 2606 bool is_native,
2606 const Object& owner, 2607 const Object& owner,
2607 intptr_t token_pos); 2608 TokenPosition token_pos);
2608 2609
2609 // Allocates a new Function object representing a closure function. 2610 // Allocates a new Function object representing a closure function.
2610 static RawFunction* NewClosureFunction(const String& name, 2611 static RawFunction* NewClosureFunction(const String& name,
2611 const Function& parent, 2612 const Function& parent,
2612 intptr_t token_pos); 2613 TokenPosition token_pos);
2613 2614
2614 // Allocates a new Function object representing a signature function. 2615 // Allocates a new Function object representing a signature function.
2615 // The owner is the scope class of the function type. 2616 // The owner is the scope class of the function type.
2616 static RawFunction* NewSignatureFunction(const Class& owner, 2617 static RawFunction* NewSignatureFunction(const Class& owner,
2617 intptr_t token_pos); 2618 TokenPosition token_pos);
2618 2619
2619 static RawFunction* NewEvalFunction(const Class& owner, 2620 static RawFunction* NewEvalFunction(const Class& owner,
2620 const Script& script, 2621 const Script& script,
2621 bool is_static); 2622 bool is_static);
2622 2623
2623 RawFunction* CreateMethodExtractor(const String& getter_name) const; 2624 RawFunction* CreateMethodExtractor(const String& getter_name) const;
2624 RawFunction* GetMethodExtractor(const String& getter_name) const; 2625 RawFunction* GetMethodExtractor(const String& getter_name) const;
2625 2626
2626 // Allocate new function object, clone values from this function. The 2627 // Allocate new function object, clone values from this function. The
2627 // owner of the clone is new_owner. 2628 // owner of the clone is new_owner.
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2900 return RoundedAllocationSize(sizeof(RawField)); 2901 return RoundedAllocationSize(sizeof(RawField));
2901 } 2902 }
2902 2903
2903 static RawField* New(const String& name, 2904 static RawField* New(const String& name,
2904 bool is_static, 2905 bool is_static,
2905 bool is_final, 2906 bool is_final,
2906 bool is_const, 2907 bool is_const,
2907 bool is_reflectable, 2908 bool is_reflectable,
2908 const Class& owner, 2909 const Class& owner,
2909 const AbstractType& type, 2910 const AbstractType& type,
2910 intptr_t token_pos); 2911 TokenPosition token_pos);
2911 2912
2912 static RawField* NewTopLevel(const String& name, 2913 static RawField* NewTopLevel(const String& name,
2913 bool is_final, 2914 bool is_final,
2914 bool is_const, 2915 bool is_const,
2915 const Object& owner, 2916 const Object& owner,
2916 intptr_t token_pos); 2917 TokenPosition token_pos);
2917 2918
2918 // Allocate new field object, clone values from this field. The 2919 // Allocate new field object, clone values from this field. The
2919 // owner of the clone is new_owner. 2920 // owner of the clone is new_owner.
2920 RawField* Clone(const Class& new_owner) const; 2921 RawField* Clone(const Class& new_owner) const;
2921 2922
2922 static intptr_t instance_field_offset() { 2923 static intptr_t instance_field_offset() {
2923 return OFFSET_OF(RawField, value_.offset_); 2924 return OFFSET_OF(RawField, value_.offset_);
2924 } 2925 }
2925 static intptr_t static_value_offset() { 2926 static intptr_t static_value_offset() {
2926 return OFFSET_OF(RawField, value_.static_value_); 2927 return OFFSET_OF(RawField, value_.static_value_);
2927 } 2928 }
2928 2929
2929 static intptr_t kind_bits_offset() { return OFFSET_OF(RawField, kind_bits_); } 2930 static intptr_t kind_bits_offset() { return OFFSET_OF(RawField, kind_bits_); }
2930 2931
2931 intptr_t token_pos() const { return raw_ptr()->token_pos_; } 2932 TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
2932 2933
2933 bool has_initializer() const { 2934 bool has_initializer() const {
2934 return HasInitializerBit::decode(raw_ptr()->kind_bits_); 2935 return HasInitializerBit::decode(raw_ptr()->kind_bits_);
2935 } 2936 }
2936 // Called by parser after allocating field. 2937 // Called by parser after allocating field.
2937 void set_has_initializer(bool has_initializer) const { 2938 void set_has_initializer(bool has_initializer) const {
2938 ASSERT(Thread::Current()->IsMutatorThread()); 2939 ASSERT(Thread::Current()->IsMutatorThread());
2939 set_kind_bits(HasInitializerBit::update(has_initializer, 2940 set_kind_bits(HasInitializerBit::update(has_initializer,
2940 raw_ptr()->kind_bits_)); 2941 raw_ptr()->kind_bits_));
2941 } 2942 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
3099 } 3100 }
3100 void set_is_final(bool is_final) const { 3101 void set_is_final(bool is_final) const {
3101 set_kind_bits(FinalBit::update(is_final, raw_ptr()->kind_bits_)); 3102 set_kind_bits(FinalBit::update(is_final, raw_ptr()->kind_bits_));
3102 } 3103 }
3103 void set_is_const(bool value) const { 3104 void set_is_const(bool value) const {
3104 set_kind_bits(ConstBit::update(value, raw_ptr()->kind_bits_)); 3105 set_kind_bits(ConstBit::update(value, raw_ptr()->kind_bits_));
3105 } 3106 }
3106 void set_owner(const Object& value) const { 3107 void set_owner(const Object& value) const {
3107 StorePointer(&raw_ptr()->owner_, value.raw()); 3108 StorePointer(&raw_ptr()->owner_, value.raw());
3108 } 3109 }
3109 void set_token_pos(intptr_t token_pos) const { 3110 void set_token_pos(TokenPosition token_pos) const {
3110 StoreNonPointer(&raw_ptr()->token_pos_, token_pos); 3111 StoreNonPointer(&raw_ptr()->token_pos_, token_pos);
3111 } 3112 }
3112 void set_kind_bits(intptr_t value) const { 3113 void set_kind_bits(intptr_t value) const {
3113 StoreNonPointer(&raw_ptr()->kind_bits_, static_cast<uint8_t>(value)); 3114 StoreNonPointer(&raw_ptr()->kind_bits_, static_cast<uint8_t>(value));
3114 } 3115 }
3115 3116
3116 static RawField* New(); 3117 static RawField* New();
3117 3118
3118 FINAL_HEAP_OBJECT_IMPLEMENTATION(Field, Object); 3119 FINAL_HEAP_OBJECT_IMPLEMENTATION(Field, Object);
3119 friend class Class; 3120 friend class Class;
(...skipping 29 matching lines...) Expand all
3149 3150
3150 class TokenStream : public Object { 3151 class TokenStream : public Object {
3151 public: 3152 public:
3152 RawGrowableObjectArray* TokenObjects() const; 3153 RawGrowableObjectArray* TokenObjects() const;
3153 void SetTokenObjects(const GrowableObjectArray& value) const; 3154 void SetTokenObjects(const GrowableObjectArray& value) const;
3154 3155
3155 RawExternalTypedData* GetStream() const; 3156 RawExternalTypedData* GetStream() const;
3156 void SetStream(const ExternalTypedData& stream) const; 3157 void SetStream(const ExternalTypedData& stream) const;
3157 3158
3158 RawString* GenerateSource() const; 3159 RawString* GenerateSource() const;
3159 RawString* GenerateSource(intptr_t start, intptr_t end) const; 3160 RawString* GenerateSource(TokenPosition start,
3160 intptr_t ComputeSourcePosition(intptr_t tok_pos) const; 3161 TokenPosition end) const;
3162 TokenPosition ComputeSourcePosition(TokenPosition tok_pos) const;
3161 3163
3162 RawString* PrivateKey() const; 3164 RawString* PrivateKey() const;
3163 3165
3164 static const intptr_t kBytesPerElement = 1; 3166 static const intptr_t kBytesPerElement = 1;
3165 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; 3167 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement;
3166 3168
3167 static intptr_t InstanceSize() { 3169 static intptr_t InstanceSize() {
3168 return RoundedAllocationSize(sizeof(RawTokenStream)); 3170 return RoundedAllocationSize(sizeof(RawTokenStream));
3169 } 3171 }
3170 3172
3171 static RawTokenStream* New(intptr_t length); 3173 static RawTokenStream* New(intptr_t length);
3172 static RawTokenStream* New(const Scanner::GrowableTokenStream& tokens, 3174 static RawTokenStream* New(const Scanner::GrowableTokenStream& tokens,
3173 const String& private_key, 3175 const String& private_key,
3174 bool use_shared_tokens); 3176 bool use_shared_tokens);
3175 3177
3176 static void OpenSharedTokenList(Isolate* isolate); 3178 static void OpenSharedTokenList(Isolate* isolate);
3177 static void CloseSharedTokenList(Isolate* isolate); 3179 static void CloseSharedTokenList(Isolate* isolate);
3178 3180
3179 // The class Iterator encapsulates iteration over the tokens 3181 // The class Iterator encapsulates iteration over the tokens
3180 // in a TokenStream object. 3182 // in a TokenStream object.
3181 class Iterator : ValueObject { 3183 class Iterator : ValueObject {
3182 public: 3184 public:
3183 enum StreamType { 3185 enum StreamType {
3184 kNoNewlines, 3186 kNoNewlines,
3185 kAllTokens 3187 kAllTokens
3186 }; 3188 };
3187 3189
3188 Iterator(const TokenStream& tokens, 3190 Iterator(const TokenStream& tokens,
3189 intptr_t token_pos, 3191 TokenPosition token_pos,
3190 Iterator::StreamType stream_type = kNoNewlines); 3192 Iterator::StreamType stream_type = kNoNewlines);
3191 3193
3192 void SetStream(const TokenStream& tokens, intptr_t token_pos); 3194 void SetStream(const TokenStream& tokens, TokenPosition token_pos);
3193 bool IsValid() const; 3195 bool IsValid() const;
3194 3196
3195 inline Token::Kind CurrentTokenKind() const { 3197 inline Token::Kind CurrentTokenKind() const {
3196 return cur_token_kind_; 3198 return cur_token_kind_;
3197 } 3199 }
3198 3200
3199 Token::Kind LookaheadTokenKind(intptr_t num_tokens); 3201 Token::Kind LookaheadTokenKind(intptr_t num_tokens);
3200 3202
3201 intptr_t CurrentPosition() const; 3203 TokenPosition CurrentPosition() const;
3202 void SetCurrentPosition(intptr_t value); 3204 void SetCurrentPosition(TokenPosition token_pos);
3203 3205
3204 void Advance(); 3206 void Advance();
3205 3207
3206 RawObject* CurrentToken() const; 3208 RawObject* CurrentToken() const;
3207 RawString* CurrentLiteral() const; 3209 RawString* CurrentLiteral() const;
3208 RawString* MakeLiteralToken(const Object& obj) const; 3210 RawString* MakeLiteralToken(const Object& obj) const;
3209 3211
3210 private: 3212 private:
3211 // Read token from the token stream (could be a simple token or an index 3213 // Read token from the token stream (could be a simple token or an index
3212 // into the token objects array for IDENT or literal tokens). 3214 // into the token objects array for IDENT or literal tokens).
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3262 RawLibrary* FindLibrary() const; 3264 RawLibrary* FindLibrary() const;
3263 RawString* GetLine(intptr_t line_number, 3265 RawString* GetLine(intptr_t line_number,
3264 Heap::Space space = Heap::kNew) const; 3266 Heap::Space space = Heap::kNew) const;
3265 RawString* GetSnippet(intptr_t from_line, 3267 RawString* GetSnippet(intptr_t from_line,
3266 intptr_t from_column, 3268 intptr_t from_column,
3267 intptr_t to_line, 3269 intptr_t to_line,
3268 intptr_t to_column) const; 3270 intptr_t to_column) const;
3269 3271
3270 void SetLocationOffset(intptr_t line_offset, intptr_t col_offset) const; 3272 void SetLocationOffset(intptr_t line_offset, intptr_t col_offset) const;
3271 3273
3272 void GetTokenLocation(intptr_t token_pos, 3274 void GetTokenLocation(TokenPosition token_pos,
3273 intptr_t* line, 3275 intptr_t* line,
3274 intptr_t* column, 3276 intptr_t* column,
3275 intptr_t* token_len = NULL) const; 3277 intptr_t* token_len = NULL) const;
3276 3278
3277 // Returns index of first and last token on the given line. Returns both 3279 // Returns index of first and last token on the given line. Returns both
3278 // indices < 0 if no token exists on or after the line. If a token exists 3280 // indices < 0 if no token exists on or after the line. If a token exists
3279 // after, but not on given line, returns in *first_token_index the index of 3281 // after, but not on given line, returns in *first_token_index the index of
3280 // the first token after the line, and a negative value in *last_token_index. 3282 // the first token after the line, and a negative value in *last_token_index.
3281 void TokenRangeAtLine(intptr_t line_number, 3283 void TokenRangeAtLine(intptr_t line_number,
3282 intptr_t* first_token_index, 3284 TokenPosition* first_token_index,
3283 intptr_t* last_token_index) const; 3285 TokenPosition* last_token_index) const;
3284 3286
3285 static intptr_t InstanceSize() { 3287 static intptr_t InstanceSize() {
3286 return RoundedAllocationSize(sizeof(RawScript)); 3288 return RoundedAllocationSize(sizeof(RawScript));
3287 } 3289 }
3288 3290
3289 static RawScript* New(const String& url, 3291 static RawScript* New(const String& url,
3290 const String& source, 3292 const String& source,
3291 RawScript::Kind kind); 3293 RawScript::Kind kind);
3292 3294
3293 private: 3295 private:
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
3441 // look in the scopes of all libraries that are imported 3443 // look in the scopes of all libraries that are imported
3442 // without a library prefix. 3444 // without a library prefix.
3443 RawObject* ResolveName(const String& name) const; 3445 RawObject* ResolveName(const String& name) const;
3444 3446
3445 void AddAnonymousClass(const Class& cls) const; 3447 void AddAnonymousClass(const Class& cls) const;
3446 3448
3447 void AddExport(const Namespace& ns) const; 3449 void AddExport(const Namespace& ns) const;
3448 3450
3449 void AddClassMetadata(const Class& cls, 3451 void AddClassMetadata(const Class& cls,
3450 const Object& tl_owner, 3452 const Object& tl_owner,
3451 intptr_t token_pos) const; 3453 TokenPosition token_pos) const;
3452 void AddFieldMetadata(const Field& field, intptr_t token_pos) const; 3454 void AddFieldMetadata(const Field& field, TokenPosition token_pos) const;
3453 void AddFunctionMetadata(const Function& func, intptr_t token_pos) const; 3455 void AddFunctionMetadata(const Function& func,
3454 void AddLibraryMetadata(const Object& tl_owner, intptr_t token_pos) const; 3456 TokenPosition token_pos) const;
3457 void AddLibraryMetadata(const Object& tl_owner,
3458 TokenPosition token_pos) const;
3455 void AddTypeParameterMetadata(const TypeParameter& param, 3459 void AddTypeParameterMetadata(const TypeParameter& param,
3456 intptr_t token_pos) const; 3460 TokenPosition token_pos) const;
3457 RawObject* GetMetadata(const Object& obj) const; 3461 RawObject* GetMetadata(const Object& obj) const;
3458 3462
3459 RawClass* toplevel_class() const { 3463 RawClass* toplevel_class() const {
3460 return raw_ptr()->toplevel_class_; 3464 return raw_ptr()->toplevel_class_;
3461 } 3465 }
3462 void set_toplevel_class(const Class& value) const; 3466 void set_toplevel_class(const Class& value) const;
3463 3467
3464 RawGrowableObjectArray* patch_classes() const { 3468 RawGrowableObjectArray* patch_classes() const {
3465 return raw_ptr()->patch_classes_; 3469 return raw_ptr()->patch_classes_;
3466 } 3470 }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
3603 bool import_core_lib); 3607 bool import_core_lib);
3604 RawObject* LookupEntry(const String& name, intptr_t *index) const; 3608 RawObject* LookupEntry(const String& name, intptr_t *index) const;
3605 3609
3606 static bool IsKeyUsed(intptr_t key); 3610 static bool IsKeyUsed(intptr_t key);
3607 void AllocatePrivateKey() const; 3611 void AllocatePrivateKey() const;
3608 3612
3609 RawString* MakeMetadataName(const Object& obj) const; 3613 RawString* MakeMetadataName(const Object& obj) const;
3610 RawField* GetMetadataField(const String& metaname) const; 3614 RawField* GetMetadataField(const String& metaname) const;
3611 void AddMetadata(const Object& owner, 3615 void AddMetadata(const Object& owner,
3612 const String& name, 3616 const String& name,
3613 intptr_t token_pos) const; 3617 TokenPosition token_pos) const;
3614 3618
3615 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object); 3619 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object);
3616 3620
3617 friend class Bootstrap; 3621 friend class Bootstrap;
3618 friend class Class; 3622 friend class Class;
3619 friend class Debugger; 3623 friend class Debugger;
3620 friend class DictionaryIterator; 3624 friend class DictionaryIterator;
3621 friend class Namespace; 3625 friend class Namespace;
3622 friend class Object; 3626 friend class Object;
3623 }; 3627 };
3624 3628
3625 3629
3626 // A Namespace contains the names in a library dictionary, filtered by 3630 // A Namespace contains the names in a library dictionary, filtered by
3627 // the show/hide combinators. 3631 // the show/hide combinators.
3628 class Namespace : public Object { 3632 class Namespace : public Object {
3629 public: 3633 public:
3630 RawLibrary* library() const { return raw_ptr()->library_; } 3634 RawLibrary* library() const { return raw_ptr()->library_; }
3631 RawArray* show_names() const { return raw_ptr()->show_names_; } 3635 RawArray* show_names() const { return raw_ptr()->show_names_; }
3632 RawArray* hide_names() const { return raw_ptr()->hide_names_; } 3636 RawArray* hide_names() const { return raw_ptr()->hide_names_; }
3633 3637
3634 void AddMetadata(const Object& owner, intptr_t token_pos); 3638 void AddMetadata(const Object& owner, TokenPosition token_pos);
3635 RawObject* GetMetadata() const; 3639 RawObject* GetMetadata() const;
3636 3640
3637 static intptr_t InstanceSize() { 3641 static intptr_t InstanceSize() {
3638 return RoundedAllocationSize(sizeof(RawNamespace)); 3642 return RoundedAllocationSize(sizeof(RawNamespace));
3639 } 3643 }
3640 3644
3641 bool HidesName(const String& name) const; 3645 bool HidesName(const String& name) const;
3642 RawObject* Lookup(const String& name) const; 3646 RawObject* Lookup(const String& name) const;
3643 3647
3644 static RawNamespace* New(const Library& library, 3648 static RawNamespace* New(const Library& library,
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
3921 3925
3922 if ((cur_kind_ & kind_mask_) != 0) { 3926 if ((cur_kind_ & kind_mask_) != 0) {
3923 return true; // Current is valid. 3927 return true; // Current is valid.
3924 } 3928 }
3925 } 3929 }
3926 return false; 3930 return false;
3927 } 3931 }
3928 3932
3929 uword PcOffset() const { return cur_pc_offset_; } 3933 uword PcOffset() const { return cur_pc_offset_; }
3930 intptr_t DeoptId() const { return cur_deopt_id_; } 3934 intptr_t DeoptId() const { return cur_deopt_id_; }
3931 intptr_t TokenPos() const { return cur_token_pos_; } 3935 TokenPosition TokenPos() const { return TokenPosition(cur_token_pos_); }
3932 intptr_t TryIndex() const { return cur_try_index_; } 3936 intptr_t TryIndex() const { return cur_try_index_; }
3933 RawPcDescriptors::Kind Kind() const { 3937 RawPcDescriptors::Kind Kind() const {
3934 return static_cast<RawPcDescriptors::Kind>(cur_kind_); 3938 return static_cast<RawPcDescriptors::Kind>(cur_kind_);
3935 } 3939 }
3936 3940
3937 private: 3941 private:
3938 friend class PcDescriptors; 3942 friend class PcDescriptors;
3939 3943
3940 // For nested iterations, starting at element after. 3944 // For nested iterations, starting at element after.
3941 explicit Iterator(const Iterator& iter) 3945 explicit Iterator(const Iterator& iter)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
4014 while (byte_index_ < code_source_map_.Length()) { 4018 while (byte_index_ < code_source_map_.Length()) {
4015 cur_pc_offset_ += code_source_map_.DecodeInteger(&byte_index_); 4019 cur_pc_offset_ += code_source_map_.DecodeInteger(&byte_index_);
4016 cur_token_pos_ += code_source_map_.DecodeInteger(&byte_index_); 4020 cur_token_pos_ += code_source_map_.DecodeInteger(&byte_index_);
4017 4021
4018 return true; 4022 return true;
4019 } 4023 }
4020 return false; 4024 return false;
4021 } 4025 }
4022 4026
4023 uword PcOffset() const { return cur_pc_offset_; } 4027 uword PcOffset() const { return cur_pc_offset_; }
4024 intptr_t TokenPos() const { return cur_token_pos_; } 4028 TokenPosition TokenPos() const { return TokenPosition(cur_token_pos_); }
4025 4029
4026 private: 4030 private:
4027 friend class CodeSourceMap; 4031 friend class CodeSourceMap;
4028 4032
4029 const CodeSourceMap& code_source_map_; 4033 const CodeSourceMap& code_source_map_;
4030 intptr_t byte_index_; 4034 intptr_t byte_index_;
4031 4035
4032 intptr_t cur_pc_offset_; 4036 intptr_t cur_pc_offset_;
4033 intptr_t cur_token_pos_; 4037 intptr_t cur_token_pos_;
4034 }; 4038 };
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
4448 Assembler* assembler, 4452 Assembler* assembler,
4449 bool optimized); 4453 bool optimized);
4450 static RawCode* LookupCode(uword pc); 4454 static RawCode* LookupCode(uword pc);
4451 static RawCode* LookupCodeInVmIsolate(uword pc); 4455 static RawCode* LookupCodeInVmIsolate(uword pc);
4452 static RawCode* FindCode(uword pc, int64_t timestamp); 4456 static RawCode* FindCode(uword pc, int64_t timestamp);
4453 4457
4454 int32_t GetPointerOffsetAt(int index) const { 4458 int32_t GetPointerOffsetAt(int index) const {
4455 NoSafepointScope no_safepoint; 4459 NoSafepointScope no_safepoint;
4456 return *PointerOffsetAddrAt(index); 4460 return *PointerOffsetAddrAt(index);
4457 } 4461 }
4458 intptr_t GetTokenIndexOfPC(uword pc) const; 4462 TokenPosition GetTokenIndexOfPC(uword pc) const;
4459 4463
4460 enum { 4464 enum {
4461 kInvalidPc = -1 4465 kInvalidPc = -1
4462 }; 4466 };
4463 4467
4464 uword GetLazyDeoptPc() const; 4468 uword GetLazyDeoptPc() const;
4465 4469
4466 // Find pc, return 0 if not found. 4470 // Find pc, return 0 if not found.
4467 uword GetPcForDeoptId(intptr_t deopt_id, RawPcDescriptors::Kind kind) const; 4471 uword GetPcForDeoptId(intptr_t deopt_id, RawPcDescriptors::Kind kind) const;
4468 intptr_t GetDeoptIdForOsr(uword pc) const; 4472 intptr_t GetDeoptIdForOsr(uword pc) const;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
4653 // functions enclosing the local function. Each captured variable is represented 4657 // functions enclosing the local function. Each captured variable is represented
4654 // by its token position in the source, its name, its type, its allocation index 4658 // by its token position in the source, its name, its type, its allocation index
4655 // in the context, and its context level. The function nesting level and loop 4659 // in the context, and its context level. The function nesting level and loop
4656 // nesting level are not preserved, since they are only used until the context 4660 // nesting level are not preserved, since they are only used until the context
4657 // level is assigned. In addition the ContextScope has a field 'is_implicit' 4661 // level is assigned. In addition the ContextScope has a field 'is_implicit'
4658 // which is true if the ContextScope was created for an implicit closure. 4662 // which is true if the ContextScope was created for an implicit closure.
4659 class ContextScope : public Object { 4663 class ContextScope : public Object {
4660 public: 4664 public:
4661 intptr_t num_variables() const { return raw_ptr()->num_variables_; } 4665 intptr_t num_variables() const { return raw_ptr()->num_variables_; }
4662 4666
4663 intptr_t TokenIndexAt(intptr_t scope_index) const; 4667 TokenPosition TokenIndexAt(intptr_t scope_index) const;
4664 void SetTokenIndexAt(intptr_t scope_index, intptr_t token_pos) const; 4668 void SetTokenIndexAt(intptr_t scope_index, TokenPosition token_pos) const;
4665 4669
4666 RawString* NameAt(intptr_t scope_index) const; 4670 RawString* NameAt(intptr_t scope_index) const;
4667 void SetNameAt(intptr_t scope_index, const String& name) const; 4671 void SetNameAt(intptr_t scope_index, const String& name) const;
4668 4672
4669 bool IsFinalAt(intptr_t scope_index) const; 4673 bool IsFinalAt(intptr_t scope_index) const;
4670 void SetIsFinalAt(intptr_t scope_index, bool is_final) const; 4674 void SetIsFinalAt(intptr_t scope_index, bool is_final) const;
4671 4675
4672 bool IsConstAt(intptr_t scope_index) const; 4676 bool IsConstAt(intptr_t scope_index) const;
4673 void SetIsConstAt(intptr_t scope_index, bool is_const) const; 4677 void SetIsConstAt(intptr_t scope_index, bool is_const) const;
4674 4678
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
4878 // Build, cache, and return formatted message. 4882 // Build, cache, and return formatted message.
4879 RawString* FormatMessage() const; 4883 RawString* FormatMessage() const;
4880 4884
4881 static intptr_t InstanceSize() { 4885 static intptr_t InstanceSize() {
4882 return RoundedAllocationSize(sizeof(RawLanguageError)); 4886 return RoundedAllocationSize(sizeof(RawLanguageError));
4883 } 4887 }
4884 4888
4885 // A null script means no source and a negative token_pos means no position. 4889 // A null script means no source and a negative token_pos means no position.
4886 static RawLanguageError* NewFormatted(const Error& prev_error, 4890 static RawLanguageError* NewFormatted(const Error& prev_error,
4887 const Script& script, 4891 const Script& script,
4888 intptr_t token_pos, 4892 TokenPosition token_pos,
4889 bool report_after_token, 4893 bool report_after_token,
4890 Report::Kind kind, 4894 Report::Kind kind,
4891 Heap::Space space, 4895 Heap::Space space,
4892 const char* format, ...) 4896 const char* format, ...)
4893 PRINTF_ATTRIBUTE(7, 8); 4897 PRINTF_ATTRIBUTE(7, 8);
4894 4898
4895 static RawLanguageError* NewFormattedV(const Error& prev_error, 4899 static RawLanguageError* NewFormattedV(const Error& prev_error,
4896 const Script& script, 4900 const Script& script,
4897 intptr_t token_pos, 4901 TokenPosition token_pos,
4898 bool report_after_token, 4902 bool report_after_token,
4899 Report::Kind kind, 4903 Report::Kind kind,
4900 Heap::Space space, 4904 Heap::Space space,
4901 const char* format, va_list args); 4905 const char* format, va_list args);
4902 4906
4903 static RawLanguageError* New(const String& formatted_message, 4907 static RawLanguageError* New(const String& formatted_message,
4904 Report::Kind kind = Report::kError, 4908 Report::Kind kind = Report::kError,
4905 Heap::Space space = Heap::kNew); 4909 Heap::Space space = Heap::kNew);
4906 4910
4907 virtual const char* ToErrorCString() const; 4911 virtual const char* ToErrorCString() const;
4908 4912
4909 private: 4913 private:
4910 RawError* previous_error() const { 4914 RawError* previous_error() const {
4911 return raw_ptr()->previous_error_; 4915 return raw_ptr()->previous_error_;
4912 } 4916 }
4913 void set_previous_error(const Error& value) const; 4917 void set_previous_error(const Error& value) const;
4914 4918
4915 RawScript* script() const { return raw_ptr()->script_; } 4919 RawScript* script() const { return raw_ptr()->script_; }
4916 void set_script(const Script& value) const; 4920 void set_script(const Script& value) const;
4917 4921
4918 intptr_t token_pos() const { return raw_ptr()->token_pos_; } 4922 TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
4919 void set_token_pos(intptr_t value) const; 4923 void set_token_pos(TokenPosition value) const;
4920 4924
4921 bool report_after_token() const { return raw_ptr()->report_after_token_; } 4925 bool report_after_token() const { return raw_ptr()->report_after_token_; }
4922 void set_report_after_token(bool value); 4926 void set_report_after_token(bool value);
4923 4927
4924 void set_kind(uint8_t value) const; 4928 void set_kind(uint8_t value) const;
4925 4929
4926 RawString* message() const { return raw_ptr()->message_; } 4930 RawString* message() const { return raw_ptr()->message_; }
4927 void set_message(const String& value) const; 4931 void set_message(const String& value) const;
4928 4932
4929 RawString* formatted_message() const { return raw_ptr()->formatted_message_; } 4933 RawString* formatted_message() const { return raw_ptr()->formatted_message_; }
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
5192 virtual bool IsMalformedOrMalbounded() const; 5196 virtual bool IsMalformedOrMalbounded() const;
5193 virtual RawLanguageError* error() const; 5197 virtual RawLanguageError* error() const;
5194 virtual void set_error(const LanguageError& value) const; 5198 virtual void set_error(const LanguageError& value) const;
5195 virtual bool IsResolved() const; 5199 virtual bool IsResolved() const;
5196 virtual void SetIsResolved() const; 5200 virtual void SetIsResolved() const;
5197 virtual bool HasResolvedTypeClass() const; 5201 virtual bool HasResolvedTypeClass() const;
5198 virtual RawClass* type_class() const; 5202 virtual RawClass* type_class() const;
5199 virtual RawUnresolvedClass* unresolved_class() const; 5203 virtual RawUnresolvedClass* unresolved_class() const;
5200 virtual RawTypeArguments* arguments() const; 5204 virtual RawTypeArguments* arguments() const;
5201 virtual void set_arguments(const TypeArguments& value) const; 5205 virtual void set_arguments(const TypeArguments& value) const;
5202 virtual intptr_t token_pos() const; 5206 virtual TokenPosition token_pos() const;
5203 virtual bool IsInstantiated(TrailPtr trail = NULL) const; 5207 virtual bool IsInstantiated(TrailPtr trail = NULL) const;
5204 virtual bool CanonicalizeEquals(const Instance& other) const { 5208 virtual bool CanonicalizeEquals(const Instance& other) const {
5205 return Equals(other); 5209 return Equals(other);
5206 } 5210 }
5207 virtual bool Equals(const Instance& other) const { 5211 virtual bool Equals(const Instance& other) const {
5208 return IsEquivalent(other); 5212 return IsEquivalent(other);
5209 } 5213 }
5210 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const; 5214 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const;
5211 virtual bool IsRecursive() const; 5215 virtual bool IsRecursive() const;
5212 5216
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
5379 virtual bool IsResolved() const { 5383 virtual bool IsResolved() const {
5380 return raw_ptr()->type_state_ >= RawType::kResolved; 5384 return raw_ptr()->type_state_ >= RawType::kResolved;
5381 } 5385 }
5382 virtual void SetIsResolved() const; 5386 virtual void SetIsResolved() const;
5383 virtual bool HasResolvedTypeClass() const; // Own type class resolved. 5387 virtual bool HasResolvedTypeClass() const; // Own type class resolved.
5384 virtual RawClass* type_class() const; 5388 virtual RawClass* type_class() const;
5385 void set_type_class(const Object& value) const; 5389 void set_type_class(const Object& value) const;
5386 virtual RawUnresolvedClass* unresolved_class() const; 5390 virtual RawUnresolvedClass* unresolved_class() const;
5387 virtual RawTypeArguments* arguments() const { return raw_ptr()->arguments_; } 5391 virtual RawTypeArguments* arguments() const { return raw_ptr()->arguments_; }
5388 virtual void set_arguments(const TypeArguments& value) const; 5392 virtual void set_arguments(const TypeArguments& value) const;
5389 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } 5393 virtual TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
5390 virtual bool IsInstantiated(TrailPtr trail = NULL) const; 5394 virtual bool IsInstantiated(TrailPtr trail = NULL) const;
5391 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const; 5395 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const;
5392 virtual bool IsRecursive() const; 5396 virtual bool IsRecursive() const;
5393 virtual RawAbstractType* InstantiateFrom( 5397 virtual RawAbstractType* InstantiateFrom(
5394 const TypeArguments& instantiator_type_arguments, 5398 const TypeArguments& instantiator_type_arguments,
5395 Error* bound_error, 5399 Error* bound_error,
5396 TrailPtr trail = NULL, 5400 TrailPtr trail = NULL,
5397 Heap::Space space = Heap::kNew) const; 5401 Heap::Space space = Heap::kNew) const;
5398 virtual RawAbstractType* CloneUnfinalized() const; 5402 virtual RawAbstractType* CloneUnfinalized() const;
5399 virtual RawAbstractType* CloneUninstantiated( 5403 virtual RawAbstractType* CloneUninstantiated(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
5453 static RawType* ArrayType(); 5457 static RawType* ArrayType();
5454 5458
5455 // The 'Function' type. 5459 // The 'Function' type.
5456 static RawType* Function(); 5460 static RawType* Function();
5457 5461
5458 // The finalized type of the given non-parameterized class. 5462 // The finalized type of the given non-parameterized class.
5459 static RawType* NewNonParameterizedType(const Class& type_class); 5463 static RawType* NewNonParameterizedType(const Class& type_class);
5460 5464
5461 static RawType* New(const Object& clazz, 5465 static RawType* New(const Object& clazz,
5462 const TypeArguments& arguments, 5466 const TypeArguments& arguments,
5463 intptr_t token_pos, 5467 TokenPosition token_pos,
5464 Heap::Space space = Heap::kOld); 5468 Heap::Space space = Heap::kOld);
5465 5469
5466 private: 5470 private:
5467 void set_token_pos(intptr_t token_pos) const; 5471 void set_token_pos(TokenPosition token_pos) const;
5468 void set_type_state(int8_t state) const; 5472 void set_type_state(int8_t state) const;
5469 5473
5470 static RawType* New(Heap::Space space = Heap::kOld); 5474 static RawType* New(Heap::Space space = Heap::kOld);
5471 5475
5472 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType); 5476 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType);
5473 friend class Class; 5477 friend class Class;
5474 friend class TypeArguments; 5478 friend class TypeArguments;
5475 }; 5479 };
5476 5480
5477 5481
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
5526 // IsDynamicType(), IsBoolType(), etc... 5530 // IsDynamicType(), IsBoolType(), etc...
5527 virtual bool HasResolvedTypeClass() const { return false; } 5531 virtual bool HasResolvedTypeClass() const { return false; }
5528 // Return scope_class from virtual type_class() to factorize finalization 5532 // Return scope_class from virtual type_class() to factorize finalization
5529 // with Type, also a parameterized type. 5533 // with Type, also a parameterized type.
5530 virtual RawClass* type_class() const { return scope_class(); } 5534 virtual RawClass* type_class() const { return scope_class(); }
5531 RawClass* scope_class() const { return raw_ptr()->scope_class_; } 5535 RawClass* scope_class() const { return raw_ptr()->scope_class_; }
5532 void set_scope_class(const Class& value) const; 5536 void set_scope_class(const Class& value) const;
5533 virtual RawTypeArguments* arguments() const { return raw_ptr()->arguments_; } 5537 virtual RawTypeArguments* arguments() const { return raw_ptr()->arguments_; }
5534 virtual void set_arguments(const TypeArguments& value) const; 5538 virtual void set_arguments(const TypeArguments& value) const;
5535 RawFunction* signature() const { return raw_ptr()->signature_; } 5539 RawFunction* signature() const { return raw_ptr()->signature_; }
5536 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } 5540 virtual TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
5537 virtual bool IsInstantiated(TrailPtr trail = NULL) const; 5541 virtual bool IsInstantiated(TrailPtr trail = NULL) const;
5538 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const; 5542 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const;
5539 virtual bool IsRecursive() const; 5543 virtual bool IsRecursive() const;
5540 virtual RawAbstractType* InstantiateFrom( 5544 virtual RawAbstractType* InstantiateFrom(
5541 const TypeArguments& instantiator_type_arguments, 5545 const TypeArguments& instantiator_type_arguments,
5542 Error* malformed_error, 5546 Error* malformed_error,
5543 TrailPtr trail = NULL, 5547 TrailPtr trail = NULL,
5544 Heap::Space space = Heap::kNew) const; 5548 Heap::Space space = Heap::kNew) const;
5545 virtual RawAbstractType* CloneUnfinalized() const; 5549 virtual RawAbstractType* CloneUnfinalized() const;
5546 virtual RawAbstractType* CloneUninstantiated( 5550 virtual RawAbstractType* CloneUninstantiated(
5547 const Class& new_owner, 5551 const Class& new_owner,
5548 TrailPtr trail = NULL) const; 5552 TrailPtr trail = NULL) const;
5549 virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const; 5553 virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const;
5550 5554
5551 virtual intptr_t Hash() const; 5555 virtual intptr_t Hash() const;
5552 5556
5553 static intptr_t InstanceSize() { 5557 static intptr_t InstanceSize() {
5554 return RoundedAllocationSize(sizeof(RawFunctionType)); 5558 return RoundedAllocationSize(sizeof(RawFunctionType));
5555 } 5559 }
5556 5560
5557 static RawFunctionType* New(const Class& scope_class, 5561 static RawFunctionType* New(const Class& scope_class,
5558 const TypeArguments& arguments, 5562 const TypeArguments& arguments,
5559 const Function& signature, 5563 const Function& signature,
5560 intptr_t token_pos, 5564 TokenPosition token_pos,
5561 Heap::Space space = Heap::kOld); 5565 Heap::Space space = Heap::kOld);
5562 5566
5563 private: 5567 private:
5564 void set_signature(const Function& value) const; 5568 void set_signature(const Function& value) const;
5565 void set_token_pos(intptr_t token_pos) const; 5569 void set_token_pos(TokenPosition token_pos) const;
5566 void set_type_state(int8_t state) const; 5570 void set_type_state(int8_t state) const;
5567 5571
5568 static RawFunctionType* New(Heap::Space space = Heap::kOld); 5572 static RawFunctionType* New(Heap::Space space = Heap::kOld);
5569 5573
5570 FINAL_HEAP_OBJECT_IMPLEMENTATION(FunctionType, AbstractType); 5574 FINAL_HEAP_OBJECT_IMPLEMENTATION(FunctionType, AbstractType);
5571 friend class Class; 5575 friend class Class;
5572 friend class TypeArguments; 5576 friend class TypeArguments;
5573 }; 5577 };
5574 5578
5575 5579
(...skipping 23 matching lines...) Expand all
5599 return AbstractType::Handle(type()).HasResolvedTypeClass(); 5603 return AbstractType::Handle(type()).HasResolvedTypeClass();
5600 } 5604 }
5601 RawAbstractType* type() const { return raw_ptr()->type_; } 5605 RawAbstractType* type() const { return raw_ptr()->type_; }
5602 void set_type(const AbstractType& value) const; 5606 void set_type(const AbstractType& value) const;
5603 virtual RawClass* type_class() const { 5607 virtual RawClass* type_class() const {
5604 return AbstractType::Handle(type()).type_class(); 5608 return AbstractType::Handle(type()).type_class();
5605 } 5609 }
5606 virtual RawTypeArguments* arguments() const { 5610 virtual RawTypeArguments* arguments() const {
5607 return AbstractType::Handle(type()).arguments(); 5611 return AbstractType::Handle(type()).arguments();
5608 } 5612 }
5609 virtual intptr_t token_pos() const { 5613 virtual TokenPosition token_pos() const {
5610 return AbstractType::Handle(type()).token_pos(); 5614 return AbstractType::Handle(type()).token_pos();
5611 } 5615 }
5612 virtual bool IsInstantiated(TrailPtr trail = NULL) const; 5616 virtual bool IsInstantiated(TrailPtr trail = NULL) const;
5613 virtual bool IsEquivalent(const Instance& other, 5617 virtual bool IsEquivalent(const Instance& other,
5614 TrailPtr trail = NULL) const; 5618 TrailPtr trail = NULL) const;
5615 virtual bool IsRecursive() const { return true; } 5619 virtual bool IsRecursive() const { return true; }
5616 virtual RawTypeRef* InstantiateFrom( 5620 virtual RawTypeRef* InstantiateFrom(
5617 const TypeArguments& instantiator_type_arguments, 5621 const TypeArguments& instantiator_type_arguments,
5618 Error* bound_error, 5622 Error* bound_error,
5619 TrailPtr trail = NULL, 5623 TrailPtr trail = NULL,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
5682 RawAbstractType* bound() const { return raw_ptr()->bound_; } 5686 RawAbstractType* bound() const { return raw_ptr()->bound_; }
5683 void set_bound(const AbstractType& value) const; 5687 void set_bound(const AbstractType& value) const;
5684 // Returns true if bounded_type is below upper_bound, otherwise return false 5688 // Returns true if bounded_type is below upper_bound, otherwise return false
5685 // and set bound_error if both bounded_type and upper_bound are instantiated. 5689 // and set bound_error if both bounded_type and upper_bound are instantiated.
5686 // If one or both are not instantiated, returning false only means that the 5690 // If one or both are not instantiated, returning false only means that the
5687 // bound cannot be checked yet and this is not an error. 5691 // bound cannot be checked yet and this is not an error.
5688 bool CheckBound(const AbstractType& bounded_type, 5692 bool CheckBound(const AbstractType& bounded_type,
5689 const AbstractType& upper_bound, 5693 const AbstractType& upper_bound,
5690 Error* bound_error, 5694 Error* bound_error,
5691 Heap::Space space = Heap::kNew) const; 5695 Heap::Space space = Heap::kNew) const;
5692 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } 5696 virtual TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
5693 virtual bool IsInstantiated(TrailPtr trail = NULL) const { 5697 virtual bool IsInstantiated(TrailPtr trail = NULL) const {
5694 return false; 5698 return false;
5695 } 5699 }
5696 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const; 5700 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const;
5697 virtual bool IsRecursive() const { return false; } 5701 virtual bool IsRecursive() const { return false; }
5698 virtual RawAbstractType* InstantiateFrom( 5702 virtual RawAbstractType* InstantiateFrom(
5699 const TypeArguments& instantiator_type_arguments, 5703 const TypeArguments& instantiator_type_arguments,
5700 Error* bound_error, 5704 Error* bound_error,
5701 TrailPtr trail = NULL, 5705 TrailPtr trail = NULL,
5702 Heap::Space space = Heap::kNew) const; 5706 Heap::Space space = Heap::kNew) const;
5703 virtual RawAbstractType* CloneUnfinalized() const; 5707 virtual RawAbstractType* CloneUnfinalized() const;
5704 virtual RawAbstractType* CloneUninstantiated( 5708 virtual RawAbstractType* CloneUninstantiated(
5705 const Class& new_owner, TrailPtr trail = NULL) const; 5709 const Class& new_owner, TrailPtr trail = NULL) const;
5706 virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const { 5710 virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const {
5707 return raw(); 5711 return raw();
5708 } 5712 }
5709 5713
5710 virtual intptr_t Hash() const; 5714 virtual intptr_t Hash() const;
5711 5715
5712 static intptr_t InstanceSize() { 5716 static intptr_t InstanceSize() {
5713 return RoundedAllocationSize(sizeof(RawTypeParameter)); 5717 return RoundedAllocationSize(sizeof(RawTypeParameter));
5714 } 5718 }
5715 5719
5716 static RawTypeParameter* New(const Class& parameterized_class, 5720 static RawTypeParameter* New(const Class& parameterized_class,
5717 intptr_t index, 5721 intptr_t index,
5718 const String& name, 5722 const String& name,
5719 const AbstractType& bound, 5723 const AbstractType& bound,
5720 intptr_t token_pos); 5724 TokenPosition token_pos);
5721 5725
5722 private: 5726 private:
5723 void set_parameterized_class(const Class& value) const; 5727 void set_parameterized_class(const Class& value) const;
5724 void set_name(const String& value) const; 5728 void set_name(const String& value) const;
5725 void set_token_pos(intptr_t token_pos) const; 5729 void set_token_pos(TokenPosition token_pos) const;
5726 void set_type_state(int8_t state) const; 5730 void set_type_state(int8_t state) const;
5727 5731
5728 static RawTypeParameter* New(); 5732 static RawTypeParameter* New();
5729 5733
5730 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType); 5734 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType);
5731 friend class Class; 5735 friend class Class;
5732 }; 5736 };
5733 5737
5734 5738
5735 // A BoundedType represents a type instantiated at compile time from a type 5739 // A BoundedType represents a type instantiated at compile time from a type
(...skipping 25 matching lines...) Expand all
5761 return AbstractType::Handle(type()).unresolved_class(); 5765 return AbstractType::Handle(type()).unresolved_class();
5762 } 5766 }
5763 virtual RawTypeArguments* arguments() const { 5767 virtual RawTypeArguments* arguments() const {
5764 return AbstractType::Handle(type()).arguments(); 5768 return AbstractType::Handle(type()).arguments();
5765 } 5769 }
5766 RawAbstractType* type() const { return raw_ptr()->type_; } 5770 RawAbstractType* type() const { return raw_ptr()->type_; }
5767 RawAbstractType* bound() const { return raw_ptr()->bound_; } 5771 RawAbstractType* bound() const { return raw_ptr()->bound_; }
5768 RawTypeParameter* type_parameter() const { 5772 RawTypeParameter* type_parameter() const {
5769 return raw_ptr()->type_parameter_; 5773 return raw_ptr()->type_parameter_;
5770 } 5774 }
5771 virtual intptr_t token_pos() const { 5775 virtual TokenPosition token_pos() const {
5772 return AbstractType::Handle(type()).token_pos(); 5776 return AbstractType::Handle(type()).token_pos();
5773 } 5777 }
5774 virtual bool IsInstantiated(TrailPtr trail = NULL) const { 5778 virtual bool IsInstantiated(TrailPtr trail = NULL) const {
5775 // It is not possible to encounter an instantiated bounded type with an 5779 // It is not possible to encounter an instantiated bounded type with an
5776 // uninstantiated upper bound. Therefore, we do not need to check if the 5780 // uninstantiated upper bound. Therefore, we do not need to check if the
5777 // bound is instantiated. Moreover, doing so could lead into cycles, as in 5781 // bound is instantiated. Moreover, doing so could lead into cycles, as in
5778 // class C<T extends C<C>> { }. 5782 // class C<T extends C<C>> { }.
5779 return AbstractType::Handle(type()).IsInstantiated(); 5783 return AbstractType::Handle(type()).IsInstantiated();
5780 } 5784 }
5781 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const; 5785 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
5825 // A MixinAppType object is unfinalized by definition, since it is replaced at 5829 // A MixinAppType object is unfinalized by definition, since it is replaced at
5826 // class finalization time with a finalized (and possibly malformed or 5830 // class finalization time with a finalized (and possibly malformed or
5827 // malbounded) Type object. 5831 // malbounded) Type object.
5828 virtual bool IsFinalized() const { return false; } 5832 virtual bool IsFinalized() const { return false; }
5829 virtual bool IsMalformed() const { return false; } 5833 virtual bool IsMalformed() const { return false; }
5830 virtual bool IsMalbounded() const { return false; } 5834 virtual bool IsMalbounded() const { return false; }
5831 virtual bool IsMalformedOrMalbounded() const { return false; } 5835 virtual bool IsMalformedOrMalbounded() const { return false; }
5832 virtual bool IsResolved() const { return false; } 5836 virtual bool IsResolved() const { return false; }
5833 virtual bool HasResolvedTypeClass() const { return false; } 5837 virtual bool HasResolvedTypeClass() const { return false; }
5834 virtual RawString* Name() const; 5838 virtual RawString* Name() const;
5835 virtual intptr_t token_pos() const; 5839 virtual TokenPosition token_pos() const;
5836 5840
5837 // Returns the mixin composition depth of this mixin application type. 5841 // Returns the mixin composition depth of this mixin application type.
5838 intptr_t Depth() const; 5842 intptr_t Depth() const;
5839 5843
5840 // Returns the declared super type of the mixin application, which will also 5844 // Returns the declared super type of the mixin application, which will also
5841 // be the super type of the first synthesized class, e.g. class "S&M" will 5845 // be the super type of the first synthesized class, e.g. class "S&M" will
5842 // refer to super type "S<T>". 5846 // refer to super type "S<T>".
5843 RawAbstractType* super_type() const { return raw_ptr()->super_type_; } 5847 RawAbstractType* super_type() const { return raw_ptr()->super_type_; }
5844 5848
5845 // Returns the mixin type at the given mixin composition depth, e.g. N<V> at 5849 // Returns the mixin type at the given mixin composition depth, e.g. N<V> at
(...skipping 2531 matching lines...) Expand 10 before | Expand all | Expand 10 after
8377 8381
8378 8382
8379 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 8383 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
8380 intptr_t index) { 8384 intptr_t index) {
8381 return array.At((index * kEntryLength) + kTargetFunctionIndex); 8385 return array.At((index * kEntryLength) + kTargetFunctionIndex);
8382 } 8386 }
8383 8387
8384 } // namespace dart 8388 } // namespace dart
8385 8389
8386 #endif // VM_OBJECT_H_ 8390 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/megamorphic_cache_table.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698