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

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
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_descriptor.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 TokenDescriptor token_pos() const { return raw_ptr()->token_pos_; }
942 void set_token_pos(intptr_t value) const; 943 void set_token_pos(TokenDescriptor value) const;
943 944
944 intptr_t ComputeEndTokenPos() const; 945 TokenDescriptor 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 TokenDescriptor 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 TokenDescriptor 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 TokenDescriptor 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(TokenDescriptor 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 TokenDescriptor 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 TokenDescriptor 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 TokenDescriptor token_pos() const { return raw_ptr()->token_pos_; }
2316 void set_token_pos(intptr_t value) const; 2317 void set_token_pos(TokenDescriptor value) const;
2317 2318
2318 intptr_t end_token_pos() const { return raw_ptr()->end_token_pos_; } 2319 TokenDescriptor 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(TokenDescriptor 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 TokenDescriptor 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 TokenDescriptor 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 TokenDescriptor 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 TokenDescriptor 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 TokenDescriptor 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 TokenDescriptor 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(TokenDescriptor 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(TokenDescriptor start,
3160 intptr_t ComputeSourcePosition(intptr_t tok_pos) const; 3161 TokenDescriptor end) const;
3162 TokenDescriptor ComputeSourcePosition(TokenDescriptor 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
(...skipping 11 matching lines...) Expand all
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 intptr_t token_pos,
3190 Iterator::StreamType stream_type = kNoNewlines); 3192 Iterator::StreamType stream_type = kNoNewlines);
3191 3193
3194 Iterator(const TokenStream& tokens,
3195 TokenDescriptor token_pos,
3196 Iterator::StreamType stream_type = kNoNewlines);
3197
3192 void SetStream(const TokenStream& tokens, intptr_t token_pos); 3198 void SetStream(const TokenStream& tokens, intptr_t token_pos);
3199 void SetStream(const TokenStream& tokens, TokenDescriptor token_pos);
3193 bool IsValid() const; 3200 bool IsValid() const;
3194 3201
3195 inline Token::Kind CurrentTokenKind() const { 3202 inline Token::Kind CurrentTokenKind() const {
3196 return cur_token_kind_; 3203 return cur_token_kind_;
3197 } 3204 }
3198 3205
3199 Token::Kind LookaheadTokenKind(intptr_t num_tokens); 3206 Token::Kind LookaheadTokenKind(intptr_t num_tokens);
3200 3207
3201 intptr_t CurrentPosition() const; 3208 intptr_t CurrentPosition() const;
3202 void SetCurrentPosition(intptr_t value); 3209 void SetCurrentPosition(intptr_t value);
3210 void SetCurrentPosition(TokenDescriptor token_pos);
3203 3211
3204 void Advance(); 3212 void Advance();
3205 3213
3206 RawObject* CurrentToken() const; 3214 RawObject* CurrentToken() const;
3207 RawString* CurrentLiteral() const; 3215 RawString* CurrentLiteral() const;
3208 RawString* MakeLiteralToken(const Object& obj) const; 3216 RawString* MakeLiteralToken(const Object& obj) const;
3209 3217
3210 private: 3218 private:
3211 // Read token from the token stream (could be a simple token or an index 3219 // 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). 3220 // 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; 3270 RawLibrary* FindLibrary() const;
3263 RawString* GetLine(intptr_t line_number, 3271 RawString* GetLine(intptr_t line_number,
3264 Heap::Space space = Heap::kNew) const; 3272 Heap::Space space = Heap::kNew) const;
3265 RawString* GetSnippet(intptr_t from_line, 3273 RawString* GetSnippet(intptr_t from_line,
3266 intptr_t from_column, 3274 intptr_t from_column,
3267 intptr_t to_line, 3275 intptr_t to_line,
3268 intptr_t to_column) const; 3276 intptr_t to_column) const;
3269 3277
3270 void SetLocationOffset(intptr_t line_offset, intptr_t col_offset) const; 3278 void SetLocationOffset(intptr_t line_offset, intptr_t col_offset) const;
3271 3279
3272 void GetTokenLocation(intptr_t token_pos, 3280 void GetTokenLocation(TokenDescriptor token_pos,
3273 intptr_t* line, 3281 intptr_t* line,
3274 intptr_t* column, 3282 intptr_t* column,
3275 intptr_t* token_len = NULL) const; 3283 intptr_t* token_len = NULL) const;
3276 3284
3277 // Returns index of first and last token on the given line. Returns both 3285 // 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 3286 // 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 3287 // 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. 3288 // the first token after the line, and a negative value in *last_token_index.
3281 void TokenRangeAtLine(intptr_t line_number, 3289 void TokenRangeAtLine(intptr_t line_number,
3282 intptr_t* first_token_index, 3290 TokenDescriptor* first_token_index,
3283 intptr_t* last_token_index) const; 3291 TokenDescriptor* last_token_index) const;
3284 3292
3285 static intptr_t InstanceSize() { 3293 static intptr_t InstanceSize() {
3286 return RoundedAllocationSize(sizeof(RawScript)); 3294 return RoundedAllocationSize(sizeof(RawScript));
3287 } 3295 }
3288 3296
3289 static RawScript* New(const String& url, 3297 static RawScript* New(const String& url,
3290 const String& source, 3298 const String& source,
3291 RawScript::Kind kind); 3299 RawScript::Kind kind);
3292 3300
3293 private: 3301 private:
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
3441 // look in the scopes of all libraries that are imported 3449 // look in the scopes of all libraries that are imported
3442 // without a library prefix. 3450 // without a library prefix.
3443 RawObject* ResolveName(const String& name) const; 3451 RawObject* ResolveName(const String& name) const;
3444 3452
3445 void AddAnonymousClass(const Class& cls) const; 3453 void AddAnonymousClass(const Class& cls) const;
3446 3454
3447 void AddExport(const Namespace& ns) const; 3455 void AddExport(const Namespace& ns) const;
3448 3456
3449 void AddClassMetadata(const Class& cls, 3457 void AddClassMetadata(const Class& cls,
3450 const Object& tl_owner, 3458 const Object& tl_owner,
3451 intptr_t token_pos) const; 3459 TokenDescriptor token_pos) const;
3452 void AddFieldMetadata(const Field& field, intptr_t token_pos) const; 3460 void AddFieldMetadata(const Field& field, TokenDescriptor token_pos) const;
3453 void AddFunctionMetadata(const Function& func, intptr_t token_pos) const; 3461 void AddFunctionMetadata(const Function& func,
3454 void AddLibraryMetadata(const Object& tl_owner, intptr_t token_pos) const; 3462 TokenDescriptor token_pos) const;
3463 void AddLibraryMetadata(const Object& tl_owner,
3464 TokenDescriptor token_pos) const;
3455 void AddTypeParameterMetadata(const TypeParameter& param, 3465 void AddTypeParameterMetadata(const TypeParameter& param,
3456 intptr_t token_pos) const; 3466 TokenDescriptor token_pos) const;
3457 RawObject* GetMetadata(const Object& obj) const; 3467 RawObject* GetMetadata(const Object& obj) const;
3458 3468
3459 RawClass* toplevel_class() const { 3469 RawClass* toplevel_class() const {
3460 return raw_ptr()->toplevel_class_; 3470 return raw_ptr()->toplevel_class_;
3461 } 3471 }
3462 void set_toplevel_class(const Class& value) const; 3472 void set_toplevel_class(const Class& value) const;
3463 3473
3464 RawGrowableObjectArray* patch_classes() const { 3474 RawGrowableObjectArray* patch_classes() const {
3465 return raw_ptr()->patch_classes_; 3475 return raw_ptr()->patch_classes_;
3466 } 3476 }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
3603 bool import_core_lib); 3613 bool import_core_lib);
3604 RawObject* LookupEntry(const String& name, intptr_t *index) const; 3614 RawObject* LookupEntry(const String& name, intptr_t *index) const;
3605 3615
3606 static bool IsKeyUsed(intptr_t key); 3616 static bool IsKeyUsed(intptr_t key);
3607 void AllocatePrivateKey() const; 3617 void AllocatePrivateKey() const;
3608 3618
3609 RawString* MakeMetadataName(const Object& obj) const; 3619 RawString* MakeMetadataName(const Object& obj) const;
3610 RawField* GetMetadataField(const String& metaname) const; 3620 RawField* GetMetadataField(const String& metaname) const;
3611 void AddMetadata(const Object& owner, 3621 void AddMetadata(const Object& owner,
3612 const String& name, 3622 const String& name,
3613 intptr_t token_pos) const; 3623 TokenDescriptor token_pos) const;
3614 3624
3615 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object); 3625 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object);
3616 3626
3617 friend class Bootstrap; 3627 friend class Bootstrap;
3618 friend class Class; 3628 friend class Class;
3619 friend class Debugger; 3629 friend class Debugger;
3620 friend class DictionaryIterator; 3630 friend class DictionaryIterator;
3621 friend class Namespace; 3631 friend class Namespace;
3622 friend class Object; 3632 friend class Object;
3623 }; 3633 };
3624 3634
3625 3635
3626 // A Namespace contains the names in a library dictionary, filtered by 3636 // A Namespace contains the names in a library dictionary, filtered by
3627 // the show/hide combinators. 3637 // the show/hide combinators.
3628 class Namespace : public Object { 3638 class Namespace : public Object {
3629 public: 3639 public:
3630 RawLibrary* library() const { return raw_ptr()->library_; } 3640 RawLibrary* library() const { return raw_ptr()->library_; }
3631 RawArray* show_names() const { return raw_ptr()->show_names_; } 3641 RawArray* show_names() const { return raw_ptr()->show_names_; }
3632 RawArray* hide_names() const { return raw_ptr()->hide_names_; } 3642 RawArray* hide_names() const { return raw_ptr()->hide_names_; }
3633 3643
3634 void AddMetadata(const Object& owner, intptr_t token_pos); 3644 void AddMetadata(const Object& owner, TokenDescriptor token_pos);
3635 RawObject* GetMetadata() const; 3645 RawObject* GetMetadata() const;
3636 3646
3637 static intptr_t InstanceSize() { 3647 static intptr_t InstanceSize() {
3638 return RoundedAllocationSize(sizeof(RawNamespace)); 3648 return RoundedAllocationSize(sizeof(RawNamespace));
3639 } 3649 }
3640 3650
3641 bool HidesName(const String& name) const; 3651 bool HidesName(const String& name) const;
3642 RawObject* Lookup(const String& name) const; 3652 RawObject* Lookup(const String& name) const;
3643 3653
3644 static RawNamespace* New(const Library& library, 3654 static RawNamespace* New(const Library& library,
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
3921 3931
3922 if ((cur_kind_ & kind_mask_) != 0) { 3932 if ((cur_kind_ & kind_mask_) != 0) {
3923 return true; // Current is valid. 3933 return true; // Current is valid.
3924 } 3934 }
3925 } 3935 }
3926 return false; 3936 return false;
3927 } 3937 }
3928 3938
3929 uword PcOffset() const { return cur_pc_offset_; } 3939 uword PcOffset() const { return cur_pc_offset_; }
3930 intptr_t DeoptId() const { return cur_deopt_id_; } 3940 intptr_t DeoptId() const { return cur_deopt_id_; }
3931 intptr_t TokenPos() const { return cur_token_pos_; } 3941 TokenDescriptor TokenPos() const { return TokenDescriptor(cur_token_pos_); }
3932 intptr_t TryIndex() const { return cur_try_index_; } 3942 intptr_t TryIndex() const { return cur_try_index_; }
3933 RawPcDescriptors::Kind Kind() const { 3943 RawPcDescriptors::Kind Kind() const {
3934 return static_cast<RawPcDescriptors::Kind>(cur_kind_); 3944 return static_cast<RawPcDescriptors::Kind>(cur_kind_);
3935 } 3945 }
3936 3946
3937 private: 3947 private:
3938 friend class PcDescriptors; 3948 friend class PcDescriptors;
3939 3949
3940 // For nested iterations, starting at element after. 3950 // For nested iterations, starting at element after.
3941 explicit Iterator(const Iterator& iter) 3951 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()) { 4024 while (byte_index_ < code_source_map_.Length()) {
4015 cur_pc_offset_ += code_source_map_.DecodeInteger(&byte_index_); 4025 cur_pc_offset_ += code_source_map_.DecodeInteger(&byte_index_);
4016 cur_token_pos_ += code_source_map_.DecodeInteger(&byte_index_); 4026 cur_token_pos_ += code_source_map_.DecodeInteger(&byte_index_);
4017 4027
4018 return true; 4028 return true;
4019 } 4029 }
4020 return false; 4030 return false;
4021 } 4031 }
4022 4032
4023 uword PcOffset() const { return cur_pc_offset_; } 4033 uword PcOffset() const { return cur_pc_offset_; }
4024 intptr_t TokenPos() const { return cur_token_pos_; } 4034 TokenDescriptor TokenPos() const { return TokenDescriptor(cur_token_pos_); }
4025 4035
4026 private: 4036 private:
4027 friend class CodeSourceMap; 4037 friend class CodeSourceMap;
4028 4038
4029 const CodeSourceMap& code_source_map_; 4039 const CodeSourceMap& code_source_map_;
4030 intptr_t byte_index_; 4040 intptr_t byte_index_;
4031 4041
4032 intptr_t cur_pc_offset_; 4042 intptr_t cur_pc_offset_;
4033 intptr_t cur_token_pos_; 4043 intptr_t cur_token_pos_;
4034 }; 4044 };
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
4448 Assembler* assembler, 4458 Assembler* assembler,
4449 bool optimized); 4459 bool optimized);
4450 static RawCode* LookupCode(uword pc); 4460 static RawCode* LookupCode(uword pc);
4451 static RawCode* LookupCodeInVmIsolate(uword pc); 4461 static RawCode* LookupCodeInVmIsolate(uword pc);
4452 static RawCode* FindCode(uword pc, int64_t timestamp); 4462 static RawCode* FindCode(uword pc, int64_t timestamp);
4453 4463
4454 int32_t GetPointerOffsetAt(int index) const { 4464 int32_t GetPointerOffsetAt(int index) const {
4455 NoSafepointScope no_safepoint; 4465 NoSafepointScope no_safepoint;
4456 return *PointerOffsetAddrAt(index); 4466 return *PointerOffsetAddrAt(index);
4457 } 4467 }
4458 intptr_t GetTokenIndexOfPC(uword pc) const; 4468 TokenDescriptor GetTokenIndexOfPC(uword pc) const;
4459 4469
4460 enum { 4470 enum {
4461 kInvalidPc = -1 4471 kInvalidPc = -1
4462 }; 4472 };
4463 4473
4464 uword GetLazyDeoptPc() const; 4474 uword GetLazyDeoptPc() const;
4465 4475
4466 // Find pc, return 0 if not found. 4476 // Find pc, return 0 if not found.
4467 uword GetPcForDeoptId(intptr_t deopt_id, RawPcDescriptors::Kind kind) const; 4477 uword GetPcForDeoptId(intptr_t deopt_id, RawPcDescriptors::Kind kind) const;
4468 intptr_t GetDeoptIdForOsr(uword pc) const; 4478 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 4663 // 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 4664 // 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 4665 // 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 4666 // 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' 4667 // 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. 4668 // which is true if the ContextScope was created for an implicit closure.
4659 class ContextScope : public Object { 4669 class ContextScope : public Object {
4660 public: 4670 public:
4661 intptr_t num_variables() const { return raw_ptr()->num_variables_; } 4671 intptr_t num_variables() const { return raw_ptr()->num_variables_; }
4662 4672
4663 intptr_t TokenIndexAt(intptr_t scope_index) const; 4673 TokenDescriptor TokenIndexAt(intptr_t scope_index) const;
4664 void SetTokenIndexAt(intptr_t scope_index, intptr_t token_pos) const; 4674 void SetTokenIndexAt(intptr_t scope_index, TokenDescriptor token_pos) const;
4665 4675
4666 RawString* NameAt(intptr_t scope_index) const; 4676 RawString* NameAt(intptr_t scope_index) const;
4667 void SetNameAt(intptr_t scope_index, const String& name) const; 4677 void SetNameAt(intptr_t scope_index, const String& name) const;
4668 4678
4669 bool IsFinalAt(intptr_t scope_index) const; 4679 bool IsFinalAt(intptr_t scope_index) const;
4670 void SetIsFinalAt(intptr_t scope_index, bool is_final) const; 4680 void SetIsFinalAt(intptr_t scope_index, bool is_final) const;
4671 4681
4672 bool IsConstAt(intptr_t scope_index) const; 4682 bool IsConstAt(intptr_t scope_index) const;
4673 void SetIsConstAt(intptr_t scope_index, bool is_const) const; 4683 void SetIsConstAt(intptr_t scope_index, bool is_const) const;
4674 4684
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
4878 // Build, cache, and return formatted message. 4888 // Build, cache, and return formatted message.
4879 RawString* FormatMessage() const; 4889 RawString* FormatMessage() const;
4880 4890
4881 static intptr_t InstanceSize() { 4891 static intptr_t InstanceSize() {
4882 return RoundedAllocationSize(sizeof(RawLanguageError)); 4892 return RoundedAllocationSize(sizeof(RawLanguageError));
4883 } 4893 }
4884 4894
4885 // A null script means no source and a negative token_pos means no position. 4895 // A null script means no source and a negative token_pos means no position.
4886 static RawLanguageError* NewFormatted(const Error& prev_error, 4896 static RawLanguageError* NewFormatted(const Error& prev_error,
4887 const Script& script, 4897 const Script& script,
4888 intptr_t token_pos, 4898 TokenDescriptor token_pos,
4889 bool report_after_token, 4899 bool report_after_token,
4890 Report::Kind kind, 4900 Report::Kind kind,
4891 Heap::Space space, 4901 Heap::Space space,
4892 const char* format, ...) 4902 const char* format, ...)
4893 PRINTF_ATTRIBUTE(7, 8); 4903 PRINTF_ATTRIBUTE(7, 8);
4894 4904
4895 static RawLanguageError* NewFormattedV(const Error& prev_error, 4905 static RawLanguageError* NewFormattedV(const Error& prev_error,
4896 const Script& script, 4906 const Script& script,
4897 intptr_t token_pos, 4907 TokenDescriptor token_pos,
4898 bool report_after_token, 4908 bool report_after_token,
4899 Report::Kind kind, 4909 Report::Kind kind,
4900 Heap::Space space, 4910 Heap::Space space,
4901 const char* format, va_list args); 4911 const char* format, va_list args);
4902 4912
4903 static RawLanguageError* New(const String& formatted_message, 4913 static RawLanguageError* New(const String& formatted_message,
4904 Report::Kind kind = Report::kError, 4914 Report::Kind kind = Report::kError,
4905 Heap::Space space = Heap::kNew); 4915 Heap::Space space = Heap::kNew);
4906 4916
4907 virtual const char* ToErrorCString() const; 4917 virtual const char* ToErrorCString() const;
4908 4918
4909 private: 4919 private:
4910 RawError* previous_error() const { 4920 RawError* previous_error() const {
4911 return raw_ptr()->previous_error_; 4921 return raw_ptr()->previous_error_;
4912 } 4922 }
4913 void set_previous_error(const Error& value) const; 4923 void set_previous_error(const Error& value) const;
4914 4924
4915 RawScript* script() const { return raw_ptr()->script_; } 4925 RawScript* script() const { return raw_ptr()->script_; }
4916 void set_script(const Script& value) const; 4926 void set_script(const Script& value) const;
4917 4927
4918 intptr_t token_pos() const { return raw_ptr()->token_pos_; } 4928 TokenDescriptor token_pos() const { return raw_ptr()->token_pos_; }
4919 void set_token_pos(intptr_t value) const; 4929 void set_token_pos(TokenDescriptor value) const;
4920 4930
4921 bool report_after_token() const { return raw_ptr()->report_after_token_; } 4931 bool report_after_token() const { return raw_ptr()->report_after_token_; }
4922 void set_report_after_token(bool value); 4932 void set_report_after_token(bool value);
4923 4933
4924 void set_kind(uint8_t value) const; 4934 void set_kind(uint8_t value) const;
4925 4935
4926 RawString* message() const { return raw_ptr()->message_; } 4936 RawString* message() const { return raw_ptr()->message_; }
4927 void set_message(const String& value) const; 4937 void set_message(const String& value) const;
4928 4938
4929 RawString* formatted_message() const { return raw_ptr()->formatted_message_; } 4939 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; 5202 virtual bool IsMalformedOrMalbounded() const;
5193 virtual RawLanguageError* error() const; 5203 virtual RawLanguageError* error() const;
5194 virtual void set_error(const LanguageError& value) const; 5204 virtual void set_error(const LanguageError& value) const;
5195 virtual bool IsResolved() const; 5205 virtual bool IsResolved() const;
5196 virtual void SetIsResolved() const; 5206 virtual void SetIsResolved() const;
5197 virtual bool HasResolvedTypeClass() const; 5207 virtual bool HasResolvedTypeClass() const;
5198 virtual RawClass* type_class() const; 5208 virtual RawClass* type_class() const;
5199 virtual RawUnresolvedClass* unresolved_class() const; 5209 virtual RawUnresolvedClass* unresolved_class() const;
5200 virtual RawTypeArguments* arguments() const; 5210 virtual RawTypeArguments* arguments() const;
5201 virtual void set_arguments(const TypeArguments& value) const; 5211 virtual void set_arguments(const TypeArguments& value) const;
5202 virtual intptr_t token_pos() const; 5212 virtual TokenDescriptor token_pos() const;
5203 virtual bool IsInstantiated(TrailPtr trail = NULL) const; 5213 virtual bool IsInstantiated(TrailPtr trail = NULL) const;
5204 virtual bool CanonicalizeEquals(const Instance& other) const { 5214 virtual bool CanonicalizeEquals(const Instance& other) const {
5205 return Equals(other); 5215 return Equals(other);
5206 } 5216 }
5207 virtual bool Equals(const Instance& other) const { 5217 virtual bool Equals(const Instance& other) const {
5208 return IsEquivalent(other); 5218 return IsEquivalent(other);
5209 } 5219 }
5210 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const; 5220 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const;
5211 virtual bool IsRecursive() const; 5221 virtual bool IsRecursive() const;
5212 5222
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
5379 virtual bool IsResolved() const { 5389 virtual bool IsResolved() const {
5380 return raw_ptr()->type_state_ >= RawType::kResolved; 5390 return raw_ptr()->type_state_ >= RawType::kResolved;
5381 } 5391 }
5382 virtual void SetIsResolved() const; 5392 virtual void SetIsResolved() const;
5383 virtual bool HasResolvedTypeClass() const; // Own type class resolved. 5393 virtual bool HasResolvedTypeClass() const; // Own type class resolved.
5384 virtual RawClass* type_class() const; 5394 virtual RawClass* type_class() const;
5385 void set_type_class(const Object& value) const; 5395 void set_type_class(const Object& value) const;
5386 virtual RawUnresolvedClass* unresolved_class() const; 5396 virtual RawUnresolvedClass* unresolved_class() const;
5387 virtual RawTypeArguments* arguments() const { return raw_ptr()->arguments_; } 5397 virtual RawTypeArguments* arguments() const { return raw_ptr()->arguments_; }
5388 virtual void set_arguments(const TypeArguments& value) const; 5398 virtual void set_arguments(const TypeArguments& value) const;
5389 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } 5399 virtual TokenDescriptor token_pos() const { return raw_ptr()->token_pos_; }
5390 virtual bool IsInstantiated(TrailPtr trail = NULL) const; 5400 virtual bool IsInstantiated(TrailPtr trail = NULL) const;
5391 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const; 5401 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const;
5392 virtual bool IsRecursive() const; 5402 virtual bool IsRecursive() const;
5393 virtual RawAbstractType* InstantiateFrom( 5403 virtual RawAbstractType* InstantiateFrom(
5394 const TypeArguments& instantiator_type_arguments, 5404 const TypeArguments& instantiator_type_arguments,
5395 Error* bound_error, 5405 Error* bound_error,
5396 TrailPtr trail = NULL, 5406 TrailPtr trail = NULL,
5397 Heap::Space space = Heap::kNew) const; 5407 Heap::Space space = Heap::kNew) const;
5398 virtual RawAbstractType* CloneUnfinalized() const; 5408 virtual RawAbstractType* CloneUnfinalized() const;
5399 virtual RawAbstractType* CloneUninstantiated( 5409 virtual RawAbstractType* CloneUninstantiated(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
5453 static RawType* ArrayType(); 5463 static RawType* ArrayType();
5454 5464
5455 // The 'Function' type. 5465 // The 'Function' type.
5456 static RawType* Function(); 5466 static RawType* Function();
5457 5467
5458 // The finalized type of the given non-parameterized class. 5468 // The finalized type of the given non-parameterized class.
5459 static RawType* NewNonParameterizedType(const Class& type_class); 5469 static RawType* NewNonParameterizedType(const Class& type_class);
5460 5470
5461 static RawType* New(const Object& clazz, 5471 static RawType* New(const Object& clazz,
5462 const TypeArguments& arguments, 5472 const TypeArguments& arguments,
5463 intptr_t token_pos, 5473 TokenDescriptor token_pos,
5464 Heap::Space space = Heap::kOld); 5474 Heap::Space space = Heap::kOld);
5465 5475
5466 private: 5476 private:
5467 void set_token_pos(intptr_t token_pos) const; 5477 void set_token_pos(TokenDescriptor token_pos) const;
5468 void set_type_state(int8_t state) const; 5478 void set_type_state(int8_t state) const;
5469 5479
5470 static RawType* New(Heap::Space space = Heap::kOld); 5480 static RawType* New(Heap::Space space = Heap::kOld);
5471 5481
5472 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType); 5482 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType);
5473 friend class Class; 5483 friend class Class;
5474 friend class TypeArguments; 5484 friend class TypeArguments;
5475 }; 5485 };
5476 5486
5477 5487
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
5526 // IsDynamicType(), IsBoolType(), etc... 5536 // IsDynamicType(), IsBoolType(), etc...
5527 virtual bool HasResolvedTypeClass() const { return false; } 5537 virtual bool HasResolvedTypeClass() const { return false; }
5528 // Return scope_class from virtual type_class() to factorize finalization 5538 // Return scope_class from virtual type_class() to factorize finalization
5529 // with Type, also a parameterized type. 5539 // with Type, also a parameterized type.
5530 virtual RawClass* type_class() const { return scope_class(); } 5540 virtual RawClass* type_class() const { return scope_class(); }
5531 RawClass* scope_class() const { return raw_ptr()->scope_class_; } 5541 RawClass* scope_class() const { return raw_ptr()->scope_class_; }
5532 void set_scope_class(const Class& value) const; 5542 void set_scope_class(const Class& value) const;
5533 virtual RawTypeArguments* arguments() const { return raw_ptr()->arguments_; } 5543 virtual RawTypeArguments* arguments() const { return raw_ptr()->arguments_; }
5534 virtual void set_arguments(const TypeArguments& value) const; 5544 virtual void set_arguments(const TypeArguments& value) const;
5535 RawFunction* signature() const { return raw_ptr()->signature_; } 5545 RawFunction* signature() const { return raw_ptr()->signature_; }
5536 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } 5546 virtual TokenDescriptor token_pos() const { return raw_ptr()->token_pos_; }
5537 virtual bool IsInstantiated(TrailPtr trail = NULL) const; 5547 virtual bool IsInstantiated(TrailPtr trail = NULL) const;
5538 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const; 5548 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const;
5539 virtual bool IsRecursive() const; 5549 virtual bool IsRecursive() const;
5540 virtual RawAbstractType* InstantiateFrom( 5550 virtual RawAbstractType* InstantiateFrom(
5541 const TypeArguments& instantiator_type_arguments, 5551 const TypeArguments& instantiator_type_arguments,
5542 Error* malformed_error, 5552 Error* malformed_error,
5543 TrailPtr trail = NULL, 5553 TrailPtr trail = NULL,
5544 Heap::Space space = Heap::kNew) const; 5554 Heap::Space space = Heap::kNew) const;
5545 virtual RawAbstractType* CloneUnfinalized() const; 5555 virtual RawAbstractType* CloneUnfinalized() const;
5546 virtual RawAbstractType* CloneUninstantiated( 5556 virtual RawAbstractType* CloneUninstantiated(
5547 const Class& new_owner, 5557 const Class& new_owner,
5548 TrailPtr trail = NULL) const; 5558 TrailPtr trail = NULL) const;
5549 virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const; 5559 virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const;
5550 5560
5551 virtual intptr_t Hash() const; 5561 virtual intptr_t Hash() const;
5552 5562
5553 static intptr_t InstanceSize() { 5563 static intptr_t InstanceSize() {
5554 return RoundedAllocationSize(sizeof(RawFunctionType)); 5564 return RoundedAllocationSize(sizeof(RawFunctionType));
5555 } 5565 }
5556 5566
5557 static RawFunctionType* New(const Class& scope_class, 5567 static RawFunctionType* New(const Class& scope_class,
5558 const TypeArguments& arguments, 5568 const TypeArguments& arguments,
5559 const Function& signature, 5569 const Function& signature,
5560 intptr_t token_pos, 5570 TokenDescriptor token_pos,
5561 Heap::Space space = Heap::kOld); 5571 Heap::Space space = Heap::kOld);
5562 5572
5563 private: 5573 private:
5564 void set_signature(const Function& value) const; 5574 void set_signature(const Function& value) const;
5565 void set_token_pos(intptr_t token_pos) const; 5575 void set_token_pos(TokenDescriptor token_pos) const;
5566 void set_type_state(int8_t state) const; 5576 void set_type_state(int8_t state) const;
5567 5577
5568 static RawFunctionType* New(Heap::Space space = Heap::kOld); 5578 static RawFunctionType* New(Heap::Space space = Heap::kOld);
5569 5579
5570 FINAL_HEAP_OBJECT_IMPLEMENTATION(FunctionType, AbstractType); 5580 FINAL_HEAP_OBJECT_IMPLEMENTATION(FunctionType, AbstractType);
5571 friend class Class; 5581 friend class Class;
5572 friend class TypeArguments; 5582 friend class TypeArguments;
5573 }; 5583 };
5574 5584
5575 5585
(...skipping 23 matching lines...) Expand all
5599 return AbstractType::Handle(type()).HasResolvedTypeClass(); 5609 return AbstractType::Handle(type()).HasResolvedTypeClass();
5600 } 5610 }
5601 RawAbstractType* type() const { return raw_ptr()->type_; } 5611 RawAbstractType* type() const { return raw_ptr()->type_; }
5602 void set_type(const AbstractType& value) const; 5612 void set_type(const AbstractType& value) const;
5603 virtual RawClass* type_class() const { 5613 virtual RawClass* type_class() const {
5604 return AbstractType::Handle(type()).type_class(); 5614 return AbstractType::Handle(type()).type_class();
5605 } 5615 }
5606 virtual RawTypeArguments* arguments() const { 5616 virtual RawTypeArguments* arguments() const {
5607 return AbstractType::Handle(type()).arguments(); 5617 return AbstractType::Handle(type()).arguments();
5608 } 5618 }
5609 virtual intptr_t token_pos() const { 5619 virtual TokenDescriptor token_pos() const {
5610 return AbstractType::Handle(type()).token_pos(); 5620 return AbstractType::Handle(type()).token_pos();
5611 } 5621 }
5612 virtual bool IsInstantiated(TrailPtr trail = NULL) const; 5622 virtual bool IsInstantiated(TrailPtr trail = NULL) const;
5613 virtual bool IsEquivalent(const Instance& other, 5623 virtual bool IsEquivalent(const Instance& other,
5614 TrailPtr trail = NULL) const; 5624 TrailPtr trail = NULL) const;
5615 virtual bool IsRecursive() const { return true; } 5625 virtual bool IsRecursive() const { return true; }
5616 virtual RawTypeRef* InstantiateFrom( 5626 virtual RawTypeRef* InstantiateFrom(
5617 const TypeArguments& instantiator_type_arguments, 5627 const TypeArguments& instantiator_type_arguments,
5618 Error* bound_error, 5628 Error* bound_error,
5619 TrailPtr trail = NULL, 5629 TrailPtr trail = NULL,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
5682 RawAbstractType* bound() const { return raw_ptr()->bound_; } 5692 RawAbstractType* bound() const { return raw_ptr()->bound_; }
5683 void set_bound(const AbstractType& value) const; 5693 void set_bound(const AbstractType& value) const;
5684 // Returns true if bounded_type is below upper_bound, otherwise return false 5694 // 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. 5695 // 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 5696 // 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. 5697 // bound cannot be checked yet and this is not an error.
5688 bool CheckBound(const AbstractType& bounded_type, 5698 bool CheckBound(const AbstractType& bounded_type,
5689 const AbstractType& upper_bound, 5699 const AbstractType& upper_bound,
5690 Error* bound_error, 5700 Error* bound_error,
5691 Heap::Space space = Heap::kNew) const; 5701 Heap::Space space = Heap::kNew) const;
5692 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } 5702 virtual TokenDescriptor token_pos() const { return raw_ptr()->token_pos_; }
5693 virtual bool IsInstantiated(TrailPtr trail = NULL) const { 5703 virtual bool IsInstantiated(TrailPtr trail = NULL) const {
5694 return false; 5704 return false;
5695 } 5705 }
5696 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const; 5706 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const;
5697 virtual bool IsRecursive() const { return false; } 5707 virtual bool IsRecursive() const { return false; }
5698 virtual RawAbstractType* InstantiateFrom( 5708 virtual RawAbstractType* InstantiateFrom(
5699 const TypeArguments& instantiator_type_arguments, 5709 const TypeArguments& instantiator_type_arguments,
5700 Error* bound_error, 5710 Error* bound_error,
5701 TrailPtr trail = NULL, 5711 TrailPtr trail = NULL,
5702 Heap::Space space = Heap::kNew) const; 5712 Heap::Space space = Heap::kNew) const;
5703 virtual RawAbstractType* CloneUnfinalized() const; 5713 virtual RawAbstractType* CloneUnfinalized() const;
5704 virtual RawAbstractType* CloneUninstantiated( 5714 virtual RawAbstractType* CloneUninstantiated(
5705 const Class& new_owner, TrailPtr trail = NULL) const; 5715 const Class& new_owner, TrailPtr trail = NULL) const;
5706 virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const { 5716 virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const {
5707 return raw(); 5717 return raw();
5708 } 5718 }
5709 5719
5710 virtual intptr_t Hash() const; 5720 virtual intptr_t Hash() const;
5711 5721
5712 static intptr_t InstanceSize() { 5722 static intptr_t InstanceSize() {
5713 return RoundedAllocationSize(sizeof(RawTypeParameter)); 5723 return RoundedAllocationSize(sizeof(RawTypeParameter));
5714 } 5724 }
5715 5725
5716 static RawTypeParameter* New(const Class& parameterized_class, 5726 static RawTypeParameter* New(const Class& parameterized_class,
5717 intptr_t index, 5727 intptr_t index,
5718 const String& name, 5728 const String& name,
5719 const AbstractType& bound, 5729 const AbstractType& bound,
5720 intptr_t token_pos); 5730 TokenDescriptor token_pos);
5721 5731
5722 private: 5732 private:
5723 void set_parameterized_class(const Class& value) const; 5733 void set_parameterized_class(const Class& value) const;
5724 void set_name(const String& value) const; 5734 void set_name(const String& value) const;
5725 void set_token_pos(intptr_t token_pos) const; 5735 void set_token_pos(TokenDescriptor token_pos) const;
5726 void set_type_state(int8_t state) const; 5736 void set_type_state(int8_t state) const;
5727 5737
5728 static RawTypeParameter* New(); 5738 static RawTypeParameter* New();
5729 5739
5730 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType); 5740 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType);
5731 friend class Class; 5741 friend class Class;
5732 }; 5742 };
5733 5743
5734 5744
5735 // A BoundedType represents a type instantiated at compile time from a type 5745 // 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(); 5771 return AbstractType::Handle(type()).unresolved_class();
5762 } 5772 }
5763 virtual RawTypeArguments* arguments() const { 5773 virtual RawTypeArguments* arguments() const {
5764 return AbstractType::Handle(type()).arguments(); 5774 return AbstractType::Handle(type()).arguments();
5765 } 5775 }
5766 RawAbstractType* type() const { return raw_ptr()->type_; } 5776 RawAbstractType* type() const { return raw_ptr()->type_; }
5767 RawAbstractType* bound() const { return raw_ptr()->bound_; } 5777 RawAbstractType* bound() const { return raw_ptr()->bound_; }
5768 RawTypeParameter* type_parameter() const { 5778 RawTypeParameter* type_parameter() const {
5769 return raw_ptr()->type_parameter_; 5779 return raw_ptr()->type_parameter_;
5770 } 5780 }
5771 virtual intptr_t token_pos() const { 5781 virtual TokenDescriptor token_pos() const {
5772 return AbstractType::Handle(type()).token_pos(); 5782 return AbstractType::Handle(type()).token_pos();
5773 } 5783 }
5774 virtual bool IsInstantiated(TrailPtr trail = NULL) const { 5784 virtual bool IsInstantiated(TrailPtr trail = NULL) const {
5775 // It is not possible to encounter an instantiated bounded type with an 5785 // 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 5786 // 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 5787 // bound is instantiated. Moreover, doing so could lead into cycles, as in
5778 // class C<T extends C<C>> { }. 5788 // class C<T extends C<C>> { }.
5779 return AbstractType::Handle(type()).IsInstantiated(); 5789 return AbstractType::Handle(type()).IsInstantiated();
5780 } 5790 }
5781 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const; 5791 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 5835 // A MixinAppType object is unfinalized by definition, since it is replaced at
5826 // class finalization time with a finalized (and possibly malformed or 5836 // class finalization time with a finalized (and possibly malformed or
5827 // malbounded) Type object. 5837 // malbounded) Type object.
5828 virtual bool IsFinalized() const { return false; } 5838 virtual bool IsFinalized() const { return false; }
5829 virtual bool IsMalformed() const { return false; } 5839 virtual bool IsMalformed() const { return false; }
5830 virtual bool IsMalbounded() const { return false; } 5840 virtual bool IsMalbounded() const { return false; }
5831 virtual bool IsMalformedOrMalbounded() const { return false; } 5841 virtual bool IsMalformedOrMalbounded() const { return false; }
5832 virtual bool IsResolved() const { return false; } 5842 virtual bool IsResolved() const { return false; }
5833 virtual bool HasResolvedTypeClass() const { return false; } 5843 virtual bool HasResolvedTypeClass() const { return false; }
5834 virtual RawString* Name() const; 5844 virtual RawString* Name() const;
5835 virtual intptr_t token_pos() const; 5845 virtual TokenDescriptor token_pos() const;
5836 5846
5837 // Returns the mixin composition depth of this mixin application type. 5847 // Returns the mixin composition depth of this mixin application type.
5838 intptr_t Depth() const; 5848 intptr_t Depth() const;
5839 5849
5840 // Returns the declared super type of the mixin application, which will also 5850 // 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 5851 // be the super type of the first synthesized class, e.g. class "S&M" will
5842 // refer to super type "S<T>". 5852 // refer to super type "S<T>".
5843 RawAbstractType* super_type() const { return raw_ptr()->super_type_; } 5853 RawAbstractType* super_type() const { return raw_ptr()->super_type_; }
5844 5854
5845 // Returns the mixin type at the given mixin composition depth, e.g. N<V> at 5855 // 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 8387
8378 8388
8379 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 8389 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
8380 intptr_t index) { 8390 intptr_t index) {
8381 return array.At((index * kEntryLength) + kTargetFunctionIndex); 8391 return array.At((index * kEntryLength) + kTargetFunctionIndex);
8382 } 8392 }
8383 8393
8384 } // namespace dart 8394 } // namespace dart
8385 8395
8386 #endif // VM_OBJECT_H_ 8396 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698