OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 friend class Class; | 1292 friend class Class; |
1293 }; | 1293 }; |
1294 | 1294 |
1295 | 1295 |
1296 // A TypeArguments is an array of AbstractType. | 1296 // A TypeArguments is an array of AbstractType. |
1297 class TypeArguments : public Object { | 1297 class TypeArguments : public Object { |
1298 public: | 1298 public: |
1299 intptr_t Length() const; | 1299 intptr_t Length() const; |
1300 RawAbstractType* TypeAt(intptr_t index) const; | 1300 RawAbstractType* TypeAt(intptr_t index) const; |
1301 static intptr_t type_at_offset(intptr_t index) { | 1301 static intptr_t type_at_offset(intptr_t index) { |
1302 return OFFSET_OF(RawTypeArguments, types_) + index * kWordSize; | 1302 return OFFSET_OF_RETURNED_VALUE( |
| 1303 RawTypeArguments, types) + index * kWordSize; |
1303 } | 1304 } |
1304 void SetTypeAt(intptr_t index, const AbstractType& value) const; | 1305 void SetTypeAt(intptr_t index, const AbstractType& value) const; |
1305 | 1306 |
1306 // The name of this type argument vector, e.g. "<T, dynamic, List<T>, Smi>". | 1307 // The name of this type argument vector, e.g. "<T, dynamic, List<T>, Smi>". |
1307 RawString* Name() const { | 1308 RawString* Name() const { |
1308 return SubvectorName(0, Length(), kInternalName); | 1309 return SubvectorName(0, Length(), kInternalName); |
1309 } | 1310 } |
1310 | 1311 |
1311 // The name of this type argument vector, e.g. "<T, dynamic, List<T>, Smi>". | 1312 // The name of this type argument vector, e.g. "<T, dynamic, List<T>, Smi>". |
1312 // Names of internal classes are not mapped to their public interfaces. | 1313 // Names of internal classes are not mapped to their public interfaces. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 } | 1420 } |
1420 | 1421 |
1421 static const intptr_t kBytesPerElement = kWordSize; | 1422 static const intptr_t kBytesPerElement = kWordSize; |
1422 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 1423 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
1423 | 1424 |
1424 static intptr_t length_offset() { | 1425 static intptr_t length_offset() { |
1425 return OFFSET_OF(RawTypeArguments, length_); | 1426 return OFFSET_OF(RawTypeArguments, length_); |
1426 } | 1427 } |
1427 | 1428 |
1428 static intptr_t InstanceSize() { | 1429 static intptr_t InstanceSize() { |
1429 ASSERT(sizeof(RawTypeArguments) == OFFSET_OF(RawTypeArguments, types_)); | 1430 ASSERT(sizeof(RawTypeArguments) == |
| 1431 OFFSET_OF_RETURNED_VALUE(RawTypeArguments, types)); |
1430 return 0; | 1432 return 0; |
1431 } | 1433 } |
1432 | 1434 |
1433 static intptr_t InstanceSize(intptr_t len) { | 1435 static intptr_t InstanceSize(intptr_t len) { |
1434 // Ensure that the types_ is not adding to the object size, which includes | 1436 // Ensure that the types() is not adding to the object size, which includes |
1435 // 2 fields: instantiations_ and length_. | 1437 // 2 fields: instantiations_ and length_. |
1436 ASSERT(sizeof(RawTypeArguments) == (sizeof(RawObject) + (2 * kWordSize))); | 1438 ASSERT(sizeof(RawTypeArguments) == (sizeof(RawObject) + (2 * kWordSize))); |
1437 ASSERT(0 <= len && len <= kMaxElements); | 1439 ASSERT(0 <= len && len <= kMaxElements); |
1438 return RoundedAllocationSize( | 1440 return RoundedAllocationSize( |
1439 sizeof(RawTypeArguments) + (len * kBytesPerElement)); | 1441 sizeof(RawTypeArguments) + (len * kBytesPerElement)); |
1440 } | 1442 } |
1441 | 1443 |
1442 intptr_t Hash() const; | 1444 intptr_t Hash() const; |
1443 | 1445 |
1444 static RawTypeArguments* New(intptr_t len, Heap::Space space = Heap::kOld); | 1446 static RawTypeArguments* New(intptr_t len, Heap::Space space = Heap::kOld); |
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2881 uword EntryPoint() const { | 2883 uword EntryPoint() const { |
2882 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); | 2884 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); |
2883 } | 2885 } |
2884 | 2886 |
2885 static const intptr_t kMaxElements = (kIntptrMax - | 2887 static const intptr_t kMaxElements = (kIntptrMax - |
2886 (sizeof(RawInstructions) + | 2888 (sizeof(RawInstructions) + |
2887 sizeof(RawObject) + | 2889 sizeof(RawObject) + |
2888 (2 * OS::kMaxPreferredCodeAlignment))); | 2890 (2 * OS::kMaxPreferredCodeAlignment))); |
2889 | 2891 |
2890 static intptr_t InstanceSize() { | 2892 static intptr_t InstanceSize() { |
2891 ASSERT(sizeof(RawInstructions) == OFFSET_OF(RawInstructions, data_)); | 2893 ASSERT(sizeof(RawInstructions) == |
| 2894 OFFSET_OF_RETURNED_VALUE(RawInstructions, data)); |
2892 return 0; | 2895 return 0; |
2893 } | 2896 } |
2894 | 2897 |
2895 static intptr_t InstanceSize(intptr_t size) { | 2898 static intptr_t InstanceSize(intptr_t size) { |
2896 intptr_t instructions_size = Utils::RoundUp(size, | 2899 intptr_t instructions_size = Utils::RoundUp(size, |
2897 OS::PreferredCodeAlignment()); | 2900 OS::PreferredCodeAlignment()); |
2898 intptr_t result = instructions_size + HeaderSize(); | 2901 intptr_t result = instructions_size + HeaderSize(); |
2899 ASSERT(result % OS::PreferredCodeAlignment() == 0); | 2902 ASSERT(result % OS::PreferredCodeAlignment() == 0); |
2900 return result; | 2903 return result; |
2901 } | 2904 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2944 RawLocalVarDescriptors::VarInfo* info) const; | 2947 RawLocalVarDescriptors::VarInfo* info) const; |
2945 | 2948 |
2946 void GetInfo(intptr_t var_index, RawLocalVarDescriptors::VarInfo* info) const; | 2949 void GetInfo(intptr_t var_index, RawLocalVarDescriptors::VarInfo* info) const; |
2947 | 2950 |
2948 static const intptr_t kBytesPerElement = | 2951 static const intptr_t kBytesPerElement = |
2949 sizeof(RawLocalVarDescriptors::VarInfo); | 2952 sizeof(RawLocalVarDescriptors::VarInfo); |
2950 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 2953 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
2951 | 2954 |
2952 static intptr_t InstanceSize() { | 2955 static intptr_t InstanceSize() { |
2953 ASSERT(sizeof(RawLocalVarDescriptors) == | 2956 ASSERT(sizeof(RawLocalVarDescriptors) == |
2954 OFFSET_OF(RawLocalVarDescriptors, data_)); | 2957 OFFSET_OF_RETURNED_VALUE(RawLocalVarDescriptors, data)); |
2955 return 0; | 2958 return 0; |
2956 } | 2959 } |
2957 static intptr_t InstanceSize(intptr_t len) { | 2960 static intptr_t InstanceSize(intptr_t len) { |
2958 ASSERT(0 <= len && len <= kMaxElements); | 2961 ASSERT(0 <= len && len <= kMaxElements); |
2959 return RoundedAllocationSize( | 2962 return RoundedAllocationSize( |
2960 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement)); | 2963 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement)); |
2961 } | 2964 } |
2962 | 2965 |
2963 static RawLocalVarDescriptors* New(intptr_t num_variables); | 2966 static RawLocalVarDescriptors* New(intptr_t num_variables); |
2964 | 2967 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3014 SetKind(index, kind); | 3017 SetKind(index, kind); |
3015 SetDeoptId(index, deopt_id); | 3018 SetDeoptId(index, deopt_id); |
3016 SetTokenPos(index, token_pos); | 3019 SetTokenPos(index, token_pos); |
3017 SetTryIndex(index, try_index); | 3020 SetTryIndex(index, try_index); |
3018 } | 3021 } |
3019 | 3022 |
3020 static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize); | 3023 static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize); |
3021 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 3024 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
3022 | 3025 |
3023 static intptr_t InstanceSize() { | 3026 static intptr_t InstanceSize() { |
3024 ASSERT(sizeof(RawPcDescriptors) == OFFSET_OF(RawPcDescriptors, data_)); | 3027 ASSERT(sizeof(RawPcDescriptors) == |
| 3028 OFFSET_OF_RETURNED_VALUE(RawPcDescriptors, data)); |
3025 return 0; | 3029 return 0; |
3026 } | 3030 } |
3027 static intptr_t InstanceSize(intptr_t len) { | 3031 static intptr_t InstanceSize(intptr_t len) { |
3028 ASSERT(0 <= len && len <= kMaxElements); | 3032 ASSERT(0 <= len && len <= kMaxElements); |
3029 return RoundedAllocationSize( | 3033 return RoundedAllocationSize( |
3030 sizeof(RawPcDescriptors) + (len * kBytesPerElement)); | 3034 sizeof(RawPcDescriptors) + (len * kBytesPerElement)); |
3031 } | 3035 } |
3032 | 3036 |
3033 static RawPcDescriptors* New(intptr_t num_descriptors); | 3037 static RawPcDescriptors* New(intptr_t num_descriptors); |
3034 | 3038 |
(...skipping 15 matching lines...) Expand all Loading... |
3050 void SetKind(intptr_t index, PcDescriptors::Kind kind) const; | 3054 void SetKind(intptr_t index, PcDescriptors::Kind kind) const; |
3051 void SetDeoptId(intptr_t index, intptr_t value) const; | 3055 void SetDeoptId(intptr_t index, intptr_t value) const; |
3052 void SetTokenPos(intptr_t index, intptr_t value) const; | 3056 void SetTokenPos(intptr_t index, intptr_t value) const; |
3053 void SetTryIndex(intptr_t index, intptr_t value) const; | 3057 void SetTryIndex(intptr_t index, intptr_t value) const; |
3054 | 3058 |
3055 void SetLength(intptr_t value) const; | 3059 void SetLength(intptr_t value) const; |
3056 | 3060 |
3057 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { | 3061 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { |
3058 ASSERT((index >=0) && (index < Length())); | 3062 ASSERT((index >=0) && (index < Length())); |
3059 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; | 3063 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; |
3060 return &raw_ptr()->data_[data_index]; | 3064 return &raw_ptr()->data()[data_index]; |
3061 } | 3065 } |
3062 RawSmi** SmiAddr(intptr_t index, intptr_t entry_offset) const { | 3066 RawSmi** SmiAddr(intptr_t index, intptr_t entry_offset) const { |
3063 return reinterpret_cast<RawSmi**>(EntryAddr(index, entry_offset)); | 3067 return reinterpret_cast<RawSmi**>(EntryAddr(index, entry_offset)); |
3064 } | 3068 } |
3065 | 3069 |
3066 FINAL_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object); | 3070 FINAL_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object); |
3067 friend class Class; | 3071 friend class Class; |
3068 friend class Object; | 3072 friend class Object; |
3069 }; | 3073 }; |
3070 | 3074 |
(...skipping 14 matching lines...) Expand all Loading... |
3085 void SetPC(uword value) const { raw_ptr()->pc_ = value; } | 3089 void SetPC(uword value) const { raw_ptr()->pc_ = value; } |
3086 | 3090 |
3087 intptr_t RegisterBitCount() const { return raw_ptr()->register_bit_count_; } | 3091 intptr_t RegisterBitCount() const { return raw_ptr()->register_bit_count_; } |
3088 void SetRegisterBitCount(intptr_t register_bit_count) const { | 3092 void SetRegisterBitCount(intptr_t register_bit_count) const { |
3089 raw_ptr()->register_bit_count_ = register_bit_count; | 3093 raw_ptr()->register_bit_count_ = register_bit_count; |
3090 } | 3094 } |
3091 | 3095 |
3092 static const intptr_t kMaxLengthInBytes = kSmiMax; | 3096 static const intptr_t kMaxLengthInBytes = kSmiMax; |
3093 | 3097 |
3094 static intptr_t InstanceSize() { | 3098 static intptr_t InstanceSize() { |
3095 ASSERT(sizeof(RawStackmap) == OFFSET_OF(RawStackmap, data_)); | 3099 ASSERT(sizeof(RawStackmap) == OFFSET_OF_RETURNED_VALUE(RawStackmap, data)); |
3096 return 0; | 3100 return 0; |
3097 } | 3101 } |
3098 static intptr_t InstanceSize(intptr_t length) { | 3102 static intptr_t InstanceSize(intptr_t length) { |
3099 ASSERT(length >= 0); | 3103 ASSERT(length >= 0); |
3100 // The stackmap payload is in an array of bytes. | 3104 // The stackmap payload is in an array of bytes. |
3101 intptr_t payload_size = | 3105 intptr_t payload_size = |
3102 Utils::RoundUp(length, kBitsPerByte) / kBitsPerByte; | 3106 Utils::RoundUp(length, kBitsPerByte) / kBitsPerByte; |
3103 return RoundedAllocationSize(sizeof(RawStackmap) + payload_size); | 3107 return RoundedAllocationSize(sizeof(RawStackmap) + payload_size); |
3104 } | 3108 } |
3105 static RawStackmap* New(intptr_t pc_offset, | 3109 static RawStackmap* New(intptr_t pc_offset, |
(...skipping 29 matching lines...) Expand all Loading... |
3135 intptr_t outer_try_index, | 3139 intptr_t outer_try_index, |
3136 intptr_t handler_pc, | 3140 intptr_t handler_pc, |
3137 bool needs_stacktrace, | 3141 bool needs_stacktrace, |
3138 bool has_catch_all) const; | 3142 bool has_catch_all) const; |
3139 | 3143 |
3140 RawArray* GetHandledTypes(intptr_t try_index) const; | 3144 RawArray* GetHandledTypes(intptr_t try_index) const; |
3141 void SetHandledTypes(intptr_t try_index, const Array& handled_types) const; | 3145 void SetHandledTypes(intptr_t try_index, const Array& handled_types) const; |
3142 bool HasCatchAll(intptr_t try_index) const; | 3146 bool HasCatchAll(intptr_t try_index) const; |
3143 | 3147 |
3144 static intptr_t InstanceSize() { | 3148 static intptr_t InstanceSize() { |
3145 ASSERT(sizeof(RawExceptionHandlers) == OFFSET_OF(RawExceptionHandlers, | 3149 ASSERT(sizeof(RawExceptionHandlers) == |
3146 data_)); | 3150 OFFSET_OF_RETURNED_VALUE(RawExceptionHandlers, data)); |
3147 return 0; | 3151 return 0; |
3148 } | 3152 } |
3149 static intptr_t InstanceSize(intptr_t len) { | 3153 static intptr_t InstanceSize(intptr_t len) { |
3150 return RoundedAllocationSize( | 3154 return RoundedAllocationSize( |
3151 sizeof(RawExceptionHandlers) + | 3155 sizeof(RawExceptionHandlers) + |
3152 (len * sizeof(RawExceptionHandlers::HandlerInfo))); | 3156 (len * sizeof(RawExceptionHandlers::HandlerInfo))); |
3153 } | 3157 } |
3154 | 3158 |
3155 static RawExceptionHandlers* New(intptr_t num_handlers); | 3159 static RawExceptionHandlers* New(intptr_t num_handlers); |
3156 | 3160 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3205 | 3209 |
3206 // Returns the number of kMaterializeObject instructions in the prefix. | 3210 // Returns the number of kMaterializeObject instructions in the prefix. |
3207 intptr_t NumMaterializations() const; | 3211 intptr_t NumMaterializations() const; |
3208 | 3212 |
3209 static RawDeoptInfo* New(intptr_t num_commands); | 3213 static RawDeoptInfo* New(intptr_t num_commands); |
3210 | 3214 |
3211 static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize); | 3215 static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize); |
3212 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 3216 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
3213 | 3217 |
3214 static intptr_t InstanceSize() { | 3218 static intptr_t InstanceSize() { |
3215 ASSERT(sizeof(RawDeoptInfo) == OFFSET_OF(RawDeoptInfo, data_)); | 3219 ASSERT(sizeof(RawDeoptInfo) == |
| 3220 OFFSET_OF_RETURNED_VALUE(RawDeoptInfo, data)); |
3216 return 0; | 3221 return 0; |
3217 } | 3222 } |
3218 | 3223 |
3219 static intptr_t InstanceSize(intptr_t len) { | 3224 static intptr_t InstanceSize(intptr_t len) { |
3220 ASSERT(0 <= len && len <= kMaxElements); | 3225 ASSERT(0 <= len && len <= kMaxElements); |
3221 return RoundedAllocationSize(sizeof(RawDeoptInfo) + | 3226 return RoundedAllocationSize(sizeof(RawDeoptInfo) + |
3222 (len * kBytesPerElement)); | 3227 (len * kBytesPerElement)); |
3223 } | 3228 } |
3224 | 3229 |
3225 // 'index' corresponds to target, to-index. | 3230 // 'index' corresponds to target, to-index. |
(...skipping 15 matching lines...) Expand all Loading... |
3241 | 3246 |
3242 // Returns true iff decompression yields the same instructions as the | 3247 // Returns true iff decompression yields the same instructions as the |
3243 // original. | 3248 // original. |
3244 bool VerifyDecompression(const GrowableArray<DeoptInstr*>& original, | 3249 bool VerifyDecompression(const GrowableArray<DeoptInstr*>& original, |
3245 const Array& deopt_table) const; | 3250 const Array& deopt_table) const; |
3246 | 3251 |
3247 private: | 3252 private: |
3248 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { | 3253 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { |
3249 ASSERT((index >=0) && (index < Length())); | 3254 ASSERT((index >=0) && (index < Length())); |
3250 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; | 3255 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; |
3251 return &raw_ptr()->data_[data_index]; | 3256 return &raw_ptr()->data()[data_index]; |
3252 } | 3257 } |
3253 | 3258 |
3254 void SetLength(intptr_t value) const; | 3259 void SetLength(intptr_t value) const; |
3255 | 3260 |
3256 FINAL_HEAP_OBJECT_IMPLEMENTATION(DeoptInfo, Object); | 3261 FINAL_HEAP_OBJECT_IMPLEMENTATION(DeoptInfo, Object); |
3257 friend class Class; | 3262 friend class Class; |
3258 }; | 3263 }; |
3259 | 3264 |
3260 | 3265 |
3261 // Object holding information about an IC: test classes and their | 3266 // Object holding information about an IC: test classes and their |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3632 | 3637 |
3633 void set_owner(const Class& cls) { | 3638 void set_owner(const Class& cls) { |
3634 ASSERT(cls.IsOld()); | 3639 ASSERT(cls.IsOld()); |
3635 StorePointer(&raw_ptr()->owner_, reinterpret_cast<RawObject*>(cls.raw())); | 3640 StorePointer(&raw_ptr()->owner_, reinterpret_cast<RawObject*>(cls.raw())); |
3636 } | 3641 } |
3637 | 3642 |
3638 // We would have a VisitPointers function here to traverse all the | 3643 // We would have a VisitPointers function here to traverse all the |
3639 // embedded objects in the instructions using pointer_offsets. | 3644 // embedded objects in the instructions using pointer_offsets. |
3640 | 3645 |
3641 static const intptr_t kBytesPerElement = | 3646 static const intptr_t kBytesPerElement = |
3642 sizeof(reinterpret_cast<RawCode*>(0)->data_[0]); | 3647 sizeof(reinterpret_cast<RawCode*>(0)->data()[0]); |
3643 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 3648 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
3644 | 3649 |
3645 static intptr_t InstanceSize() { | 3650 static intptr_t InstanceSize() { |
3646 ASSERT(sizeof(RawCode) == OFFSET_OF(RawCode, data_)); | 3651 ASSERT(sizeof(RawCode) == OFFSET_OF_RETURNED_VALUE(RawCode, data)); |
3647 return 0; | 3652 return 0; |
3648 } | 3653 } |
3649 static intptr_t InstanceSize(intptr_t len) { | 3654 static intptr_t InstanceSize(intptr_t len) { |
3650 ASSERT(0 <= len && len <= kMaxElements); | 3655 ASSERT(0 <= len && len <= kMaxElements); |
3651 return RoundedAllocationSize(sizeof(RawCode) + (len * kBytesPerElement)); | 3656 return RoundedAllocationSize(sizeof(RawCode) + (len * kBytesPerElement)); |
3652 } | 3657 } |
3653 static RawCode* FinalizeCode(const Function& function, | 3658 static RawCode* FinalizeCode(const Function& function, |
3654 Assembler* assembler, | 3659 Assembler* assembler, |
3655 bool optimized = false); | 3660 bool optimized = false); |
3656 static RawCode* FinalizeCode(const char* name, | 3661 static RawCode* FinalizeCode(const char* name, |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3755 raw_ptr()->instructions_ = instructions; | 3760 raw_ptr()->instructions_ = instructions; |
3756 } | 3761 } |
3757 void set_pointer_offsets_length(intptr_t value) { | 3762 void set_pointer_offsets_length(intptr_t value) { |
3758 ASSERT(value >= 0); | 3763 ASSERT(value >= 0); |
3759 raw_ptr()->pointer_offsets_length_ = value; | 3764 raw_ptr()->pointer_offsets_length_ = value; |
3760 } | 3765 } |
3761 int32_t* PointerOffsetAddrAt(int index) const { | 3766 int32_t* PointerOffsetAddrAt(int index) const { |
3762 ASSERT(index >= 0); | 3767 ASSERT(index >= 0); |
3763 ASSERT(index < pointer_offsets_length()); | 3768 ASSERT(index < pointer_offsets_length()); |
3764 // TODO(iposva): Unit test is missing for this functionality. | 3769 // TODO(iposva): Unit test is missing for this functionality. |
3765 return &raw_ptr()->data_[index]; | 3770 return &raw_ptr()->data()[index]; |
3766 } | 3771 } |
3767 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) { | 3772 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) { |
3768 *PointerOffsetAddrAt(index) = offset_in_instructions; | 3773 *PointerOffsetAddrAt(index) = offset_in_instructions; |
3769 } | 3774 } |
3770 | 3775 |
3771 intptr_t BinarySearchInSCallTable(uword pc) const; | 3776 intptr_t BinarySearchInSCallTable(uword pc) const; |
3772 static RawCode* LookupCodeInIsolate(Isolate* isolate, uword pc); | 3777 static RawCode* LookupCodeInIsolate(Isolate* isolate, uword pc); |
3773 | 3778 |
3774 // New is a private method as RawInstruction and RawCode objects should | 3779 // New is a private method as RawInstruction and RawCode objects should |
3775 // only be created using the Code::FinalizeCode method. This method creates | 3780 // only be created using the Code::FinalizeCode method. This method creates |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3807 return *InstanceAddr(context_index); | 3812 return *InstanceAddr(context_index); |
3808 } | 3813 } |
3809 inline void SetAt(intptr_t context_index, const Instance& value) const; | 3814 inline void SetAt(intptr_t context_index, const Instance& value) const; |
3810 | 3815 |
3811 void Dump(int indent = 0) const; | 3816 void Dump(int indent = 0) const; |
3812 | 3817 |
3813 static const intptr_t kBytesPerElement = kWordSize; | 3818 static const intptr_t kBytesPerElement = kWordSize; |
3814 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 3819 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
3815 | 3820 |
3816 static intptr_t variable_offset(intptr_t context_index) { | 3821 static intptr_t variable_offset(intptr_t context_index) { |
3817 return OFFSET_OF(RawContext, data_[context_index]); | 3822 return OFFSET_OF_RETURNED_VALUE(RawContext, data) + |
| 3823 (kWordSize * context_index); |
3818 } | 3824 } |
3819 | 3825 |
3820 static intptr_t InstanceSize() { | 3826 static intptr_t InstanceSize() { |
3821 ASSERT(sizeof(RawContext) == OFFSET_OF(RawContext, data_)); | 3827 ASSERT(sizeof(RawContext) == OFFSET_OF_RETURNED_VALUE(RawContext, data)); |
3822 return 0; | 3828 return 0; |
3823 } | 3829 } |
3824 | 3830 |
3825 static intptr_t InstanceSize(intptr_t len) { | 3831 static intptr_t InstanceSize(intptr_t len) { |
3826 ASSERT(0 <= len && len <= kMaxElements); | 3832 ASSERT(0 <= len && len <= kMaxElements); |
3827 return RoundedAllocationSize(sizeof(RawContext) + (len * kBytesPerElement)); | 3833 return RoundedAllocationSize(sizeof(RawContext) + (len * kBytesPerElement)); |
3828 } | 3834 } |
3829 | 3835 |
3830 static RawContext* New(intptr_t num_variables, | 3836 static RawContext* New(intptr_t num_variables, |
3831 Heap::Space space = Heap::kNew); | 3837 Heap::Space space = Heap::kNew); |
3832 | 3838 |
3833 private: | 3839 private: |
3834 RawInstance** InstanceAddr(intptr_t context_index) const { | 3840 RawInstance** InstanceAddr(intptr_t context_index) const { |
3835 ASSERT((context_index >= 0) && (context_index < num_variables())); | 3841 ASSERT((context_index >= 0) && (context_index < num_variables())); |
3836 return &raw_ptr()->data_[context_index]; | 3842 return &raw_ptr()->data()[context_index]; |
3837 } | 3843 } |
3838 | 3844 |
3839 void set_isolate(Isolate* isolate) const { | 3845 void set_isolate(Isolate* isolate) const { |
3840 raw_ptr()->isolate_ = isolate; | 3846 raw_ptr()->isolate_ = isolate; |
3841 } | 3847 } |
3842 | 3848 |
3843 void set_num_variables(intptr_t num_variables) const { | 3849 void set_num_variables(intptr_t num_variables) const { |
3844 raw_ptr()->num_variables_ = num_variables; | 3850 raw_ptr()->num_variables_ = num_variables; |
3845 } | 3851 } |
3846 | 3852 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3884 void SetContextIndexAt(intptr_t scope_index, intptr_t context_index) const; | 3890 void SetContextIndexAt(intptr_t scope_index, intptr_t context_index) const; |
3885 | 3891 |
3886 intptr_t ContextLevelAt(intptr_t scope_index) const; | 3892 intptr_t ContextLevelAt(intptr_t scope_index) const; |
3887 void SetContextLevelAt(intptr_t scope_index, intptr_t context_level) const; | 3893 void SetContextLevelAt(intptr_t scope_index, intptr_t context_level) const; |
3888 | 3894 |
3889 static const intptr_t kBytesPerElement = | 3895 static const intptr_t kBytesPerElement = |
3890 sizeof(RawContextScope::VariableDesc); | 3896 sizeof(RawContextScope::VariableDesc); |
3891 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 3897 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
3892 | 3898 |
3893 static intptr_t InstanceSize() { | 3899 static intptr_t InstanceSize() { |
3894 ASSERT(sizeof(RawContextScope) == OFFSET_OF(RawContextScope, data_)); | 3900 ASSERT(sizeof(RawContextScope) == |
| 3901 OFFSET_OF_RETURNED_VALUE(RawContextScope, data)); |
3895 return 0; | 3902 return 0; |
3896 } | 3903 } |
3897 | 3904 |
3898 static intptr_t InstanceSize(intptr_t len) { | 3905 static intptr_t InstanceSize(intptr_t len) { |
3899 ASSERT(0 <= len && len <= kMaxElements); | 3906 ASSERT(0 <= len && len <= kMaxElements); |
3900 return RoundedAllocationSize( | 3907 return RoundedAllocationSize( |
3901 sizeof(RawContextScope) + (len * kBytesPerElement)); | 3908 sizeof(RawContextScope) + (len * kBytesPerElement)); |
3902 } | 3909 } |
3903 | 3910 |
3904 static RawContextScope* New(intptr_t num_variables); | 3911 static RawContextScope* New(intptr_t num_variables); |
(...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5535 } | 5542 } |
5536 | 5543 |
5537 static void SetCharAt(const String& str, intptr_t index, uint8_t code_point) { | 5544 static void SetCharAt(const String& str, intptr_t index, uint8_t code_point) { |
5538 *CharAddr(str, index) = code_point; | 5545 *CharAddr(str, index) = code_point; |
5539 } | 5546 } |
5540 static RawOneByteString* EscapeSpecialCharacters(const String& str); | 5547 static RawOneByteString* EscapeSpecialCharacters(const String& str); |
5541 // We use the same maximum elements for all strings. | 5548 // We use the same maximum elements for all strings. |
5542 static const intptr_t kBytesPerElement = 1; | 5549 static const intptr_t kBytesPerElement = 1; |
5543 static const intptr_t kMaxElements = String::kMaxElements; | 5550 static const intptr_t kMaxElements = String::kMaxElements; |
5544 | 5551 |
5545 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); } | 5552 static intptr_t data_offset() { |
| 5553 return OFFSET_OF_RETURNED_VALUE(RawOneByteString, data); |
| 5554 } |
5546 | 5555 |
5547 static intptr_t InstanceSize() { | 5556 static intptr_t InstanceSize() { |
5548 ASSERT(sizeof(RawOneByteString) == OFFSET_OF(RawOneByteString, data_)); | 5557 ASSERT(sizeof(RawOneByteString) == |
| 5558 OFFSET_OF_RETURNED_VALUE(RawOneByteString, data)); |
5549 return 0; | 5559 return 0; |
5550 } | 5560 } |
5551 | 5561 |
5552 static intptr_t InstanceSize(intptr_t len) { | 5562 static intptr_t InstanceSize(intptr_t len) { |
5553 ASSERT(sizeof(RawOneByteString) == String::kSizeofRawString); | 5563 ASSERT(sizeof(RawOneByteString) == String::kSizeofRawString); |
5554 ASSERT(0 <= len && len <= kMaxElements); | 5564 ASSERT(0 <= len && len <= kMaxElements); |
5555 return String::RoundedAllocationSize( | 5565 return String::RoundedAllocationSize( |
5556 sizeof(RawOneByteString) + (len * kBytesPerElement)); | 5566 sizeof(RawOneByteString) + (len * kBytesPerElement)); |
5557 } | 5567 } |
5558 | 5568 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5631 } | 5641 } |
5632 | 5642 |
5633 static RawOneByteString* raw_ptr(const String& str) { | 5643 static RawOneByteString* raw_ptr(const String& str) { |
5634 return reinterpret_cast<RawOneByteString*>(str.raw_ptr()); | 5644 return reinterpret_cast<RawOneByteString*>(str.raw_ptr()); |
5635 } | 5645 } |
5636 | 5646 |
5637 static uint8_t* CharAddr(const String& str, intptr_t index) { | 5647 static uint8_t* CharAddr(const String& str, intptr_t index) { |
5638 ASSERT((index >= 0) && (index < str.Length())); | 5648 ASSERT((index >= 0) && (index < str.Length())); |
5639 ASSERT(str.IsOneByteString()); | 5649 ASSERT(str.IsOneByteString()); |
5640 NoGCScope no_gc; | 5650 NoGCScope no_gc; |
5641 return &raw_ptr(str)->data_[index]; | 5651 return &raw_ptr(str)->data()[index]; |
5642 } | 5652 } |
5643 | 5653 |
5644 static RawOneByteString* ReadFrom(SnapshotReader* reader, | 5654 static RawOneByteString* ReadFrom(SnapshotReader* reader, |
5645 intptr_t object_id, | 5655 intptr_t object_id, |
5646 intptr_t tags, | 5656 intptr_t tags, |
5647 Snapshot::Kind kind); | 5657 Snapshot::Kind kind); |
5648 | 5658 |
5649 friend class Class; | 5659 friend class Class; |
5650 friend class String; | 5660 friend class String; |
5651 friend class ExternalOneByteString; | 5661 friend class ExternalOneByteString; |
(...skipping 10 matching lines...) Expand all Loading... |
5662 static void SetCharAt(const String& str, intptr_t index, uint16_t ch) { | 5672 static void SetCharAt(const String& str, intptr_t index, uint16_t ch) { |
5663 *CharAddr(str, index) = ch; | 5673 *CharAddr(str, index) = ch; |
5664 } | 5674 } |
5665 | 5675 |
5666 static RawTwoByteString* EscapeSpecialCharacters(const String& str); | 5676 static RawTwoByteString* EscapeSpecialCharacters(const String& str); |
5667 | 5677 |
5668 // We use the same maximum elements for all strings. | 5678 // We use the same maximum elements for all strings. |
5669 static const intptr_t kBytesPerElement = 2; | 5679 static const intptr_t kBytesPerElement = 2; |
5670 static const intptr_t kMaxElements = String::kMaxElements; | 5680 static const intptr_t kMaxElements = String::kMaxElements; |
5671 | 5681 |
5672 static intptr_t data_offset() { return OFFSET_OF(RawTwoByteString, data_); } | 5682 static intptr_t data_offset() { |
| 5683 return OFFSET_OF_RETURNED_VALUE(RawTwoByteString, data); |
| 5684 } |
5673 | 5685 |
5674 static intptr_t InstanceSize() { | 5686 static intptr_t InstanceSize() { |
5675 ASSERT(sizeof(RawTwoByteString) == OFFSET_OF(RawTwoByteString, data_)); | 5687 ASSERT(sizeof(RawTwoByteString) == |
| 5688 OFFSET_OF_RETURNED_VALUE(RawTwoByteString, data)); |
5676 return 0; | 5689 return 0; |
5677 } | 5690 } |
5678 | 5691 |
5679 static intptr_t InstanceSize(intptr_t len) { | 5692 static intptr_t InstanceSize(intptr_t len) { |
5680 ASSERT(sizeof(RawTwoByteString) == String::kSizeofRawString); | 5693 ASSERT(sizeof(RawTwoByteString) == String::kSizeofRawString); |
5681 ASSERT(0 <= len && len <= kMaxElements); | 5694 ASSERT(0 <= len && len <= kMaxElements); |
5682 return String::RoundedAllocationSize( | 5695 return String::RoundedAllocationSize( |
5683 sizeof(RawTwoByteString) + (len * kBytesPerElement)); | 5696 sizeof(RawTwoByteString) + (len * kBytesPerElement)); |
5684 } | 5697 } |
5685 | 5698 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5729 } | 5742 } |
5730 | 5743 |
5731 static RawTwoByteString* raw_ptr(const String& str) { | 5744 static RawTwoByteString* raw_ptr(const String& str) { |
5732 return reinterpret_cast<RawTwoByteString*>(str.raw_ptr()); | 5745 return reinterpret_cast<RawTwoByteString*>(str.raw_ptr()); |
5733 } | 5746 } |
5734 | 5747 |
5735 static uint16_t* CharAddr(const String& str, intptr_t index) { | 5748 static uint16_t* CharAddr(const String& str, intptr_t index) { |
5736 ASSERT((index >= 0) && (index < str.Length())); | 5749 ASSERT((index >= 0) && (index < str.Length())); |
5737 ASSERT(str.IsTwoByteString()); | 5750 ASSERT(str.IsTwoByteString()); |
5738 NoGCScope no_gc; | 5751 NoGCScope no_gc; |
5739 return &raw_ptr(str)->data_[index]; | 5752 return &raw_ptr(str)->data()[index]; |
5740 } | 5753 } |
5741 | 5754 |
5742 static RawTwoByteString* ReadFrom(SnapshotReader* reader, | 5755 static RawTwoByteString* ReadFrom(SnapshotReader* reader, |
5743 intptr_t object_id, | 5756 intptr_t object_id, |
5744 intptr_t tags, | 5757 intptr_t tags, |
5745 Snapshot::Kind kind); | 5758 Snapshot::Kind kind); |
5746 | 5759 |
5747 friend class Class; | 5760 friend class Class; |
5748 friend class String; | 5761 friend class String; |
5749 friend class SnapshotReader; | 5762 friend class SnapshotReader; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5935 }; | 5948 }; |
5936 | 5949 |
5937 | 5950 |
5938 class Array : public Instance { | 5951 class Array : public Instance { |
5939 public: | 5952 public: |
5940 intptr_t Length() const { | 5953 intptr_t Length() const { |
5941 ASSERT(!IsNull()); | 5954 ASSERT(!IsNull()); |
5942 return Smi::Value(raw_ptr()->length_); | 5955 return Smi::Value(raw_ptr()->length_); |
5943 } | 5956 } |
5944 static intptr_t length_offset() { return OFFSET_OF(RawArray, length_); } | 5957 static intptr_t length_offset() { return OFFSET_OF(RawArray, length_); } |
5945 static intptr_t data_offset() { return length_offset() + kWordSize; } | 5958 static intptr_t data_offset() { |
| 5959 return OFFSET_OF_RETURNED_VALUE(RawArray, data); |
| 5960 } |
5946 static intptr_t element_offset(intptr_t index) { | 5961 static intptr_t element_offset(intptr_t index) { |
5947 return data_offset() + kWordSize * index; | 5962 return OFFSET_OF_RETURNED_VALUE(RawArray, data) + kWordSize * index; |
5948 } | 5963 } |
5949 | 5964 |
5950 RawObject* At(intptr_t index) const { | 5965 RawObject* At(intptr_t index) const { |
5951 return *ObjectAddr(index); | 5966 return *ObjectAddr(index); |
5952 } | 5967 } |
5953 void SetAt(intptr_t index, const Object& value) const { | 5968 void SetAt(intptr_t index, const Object& value) const { |
5954 // TODO(iposva): Add storing NoGCScope. | 5969 // TODO(iposva): Add storing NoGCScope. |
5955 StorePointer(ObjectAddr(index), value.raw()); | 5970 StorePointer(ObjectAddr(index), value.raw()); |
5956 } | 5971 } |
5957 | 5972 |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6309 } | 6324 } |
6310 | 6325 |
6311 intptr_t LengthInBytes() const { | 6326 intptr_t LengthInBytes() const { |
6312 intptr_t cid = raw()->GetClassId(); | 6327 intptr_t cid = raw()->GetClassId(); |
6313 return (ElementSizeInBytes(cid) * Length()); | 6328 return (ElementSizeInBytes(cid) * Length()); |
6314 } | 6329 } |
6315 | 6330 |
6316 void* DataAddr(intptr_t byte_offset) const { | 6331 void* DataAddr(intptr_t byte_offset) const { |
6317 ASSERT((byte_offset == 0) || | 6332 ASSERT((byte_offset == 0) || |
6318 ((byte_offset > 0) && (byte_offset < LengthInBytes()))); | 6333 ((byte_offset > 0) && (byte_offset < LengthInBytes()))); |
6319 return reinterpret_cast<void*>(raw_ptr()->data_ + byte_offset); | 6334 return reinterpret_cast<void*>(raw_ptr()->data() + byte_offset); |
6320 } | 6335 } |
6321 | 6336 |
6322 #define TYPED_GETTER_SETTER(name, type) \ | 6337 #define TYPED_GETTER_SETTER(name, type) \ |
6323 type Get##name(intptr_t byte_offset) const { \ | 6338 type Get##name(intptr_t byte_offset) const { \ |
6324 return *reinterpret_cast<type*>(DataAddr(byte_offset)); \ | 6339 return *reinterpret_cast<type*>(DataAddr(byte_offset)); \ |
6325 } \ | 6340 } \ |
6326 void Set##name(intptr_t byte_offset, type value) const { \ | 6341 void Set##name(intptr_t byte_offset, type value) const { \ |
6327 *reinterpret_cast<type*>(DataAddr(byte_offset)) = value; \ | 6342 *reinterpret_cast<type*>(DataAddr(byte_offset)) = value; \ |
6328 } | 6343 } |
6329 TYPED_GETTER_SETTER(Int8, int8_t) | 6344 TYPED_GETTER_SETTER(Int8, int8_t) |
(...skipping 10 matching lines...) Expand all Loading... |
6340 TYPED_GETTER_SETTER(Int32x4, simd128_value_t) | 6355 TYPED_GETTER_SETTER(Int32x4, simd128_value_t) |
6341 TYPED_GETTER_SETTER(Float64x2, simd128_value_t) | 6356 TYPED_GETTER_SETTER(Float64x2, simd128_value_t) |
6342 | 6357 |
6343 #undef TYPED_GETTER_SETTER | 6358 #undef TYPED_GETTER_SETTER |
6344 | 6359 |
6345 static intptr_t length_offset() { | 6360 static intptr_t length_offset() { |
6346 return OFFSET_OF(RawTypedData, length_); | 6361 return OFFSET_OF(RawTypedData, length_); |
6347 } | 6362 } |
6348 | 6363 |
6349 static intptr_t data_offset() { | 6364 static intptr_t data_offset() { |
6350 return OFFSET_OF(RawTypedData, data_); | 6365 return OFFSET_OF_RETURNED_VALUE(RawTypedData, data); |
6351 } | 6366 } |
6352 | 6367 |
6353 static intptr_t InstanceSize() { | 6368 static intptr_t InstanceSize() { |
6354 ASSERT(sizeof(RawTypedData) == OFFSET_OF(RawTypedData, data_)); | 6369 ASSERT(sizeof(RawTypedData) == |
| 6370 OFFSET_OF_RETURNED_VALUE(RawTypedData, data)); |
6355 return 0; | 6371 return 0; |
6356 } | 6372 } |
6357 | 6373 |
6358 static intptr_t InstanceSize(intptr_t lengthInBytes) { | 6374 static intptr_t InstanceSize(intptr_t lengthInBytes) { |
6359 ASSERT(0 <= lengthInBytes && lengthInBytes <= kSmiMax); | 6375 ASSERT(0 <= lengthInBytes && lengthInBytes <= kSmiMax); |
6360 return RoundedAllocationSize(sizeof(RawTypedData) + lengthInBytes); | 6376 return RoundedAllocationSize(sizeof(RawTypedData) + lengthInBytes); |
6361 } | 6377 } |
6362 | 6378 |
6363 static intptr_t ElementSizeInBytes(intptr_t class_id) { | 6379 static intptr_t ElementSizeInBytes(intptr_t class_id) { |
6364 ASSERT(RawObject::IsTypedDataClassId(class_id)); | 6380 ASSERT(RawObject::IsTypedDataClassId(class_id)); |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6840 void* GetDataStartAddress() const; | 6856 void* GetDataStartAddress() const; |
6841 static RawJSRegExp* FromDataStartAddress(void* data); | 6857 static RawJSRegExp* FromDataStartAddress(void* data); |
6842 const char* Flags() const; | 6858 const char* Flags() const; |
6843 | 6859 |
6844 virtual bool CanonicalizeEquals(const Instance& other) const; | 6860 virtual bool CanonicalizeEquals(const Instance& other) const; |
6845 | 6861 |
6846 static const intptr_t kBytesPerElement = 1; | 6862 static const intptr_t kBytesPerElement = 1; |
6847 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 6863 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
6848 | 6864 |
6849 static intptr_t InstanceSize() { | 6865 static intptr_t InstanceSize() { |
6850 ASSERT(sizeof(RawJSRegExp) == OFFSET_OF(RawJSRegExp, data_)); | 6866 ASSERT(sizeof(RawJSRegExp) == OFFSET_OF_RETURNED_VALUE(RawJSRegExp, data)); |
6851 return 0; | 6867 return 0; |
6852 } | 6868 } |
6853 | 6869 |
6854 static intptr_t InstanceSize(intptr_t len) { | 6870 static intptr_t InstanceSize(intptr_t len) { |
6855 ASSERT(0 <= len && len <= kMaxElements); | 6871 ASSERT(0 <= len && len <= kMaxElements); |
6856 return RoundedAllocationSize( | 6872 return RoundedAllocationSize( |
6857 sizeof(RawJSRegExp) + (len * kBytesPerElement)); | 6873 sizeof(RawJSRegExp) + (len * kBytesPerElement)); |
6858 } | 6874 } |
6859 | 6875 |
6860 static RawJSRegExp* New(intptr_t length, Heap::Space space = Heap::kNew); | 6876 static RawJSRegExp* New(intptr_t length, Heap::Space space = Heap::kNew); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7042 | 7058 |
7043 | 7059 |
7044 intptr_t Instance::GetNativeField(int index) const { | 7060 intptr_t Instance::GetNativeField(int index) const { |
7045 ASSERT(IsValidNativeIndex(index)); | 7061 ASSERT(IsValidNativeIndex(index)); |
7046 NoGCScope no_gc; | 7062 NoGCScope no_gc; |
7047 RawTypedData* native_fields = | 7063 RawTypedData* native_fields = |
7048 reinterpret_cast<RawTypedData*>(*NativeFieldsAddr()); | 7064 reinterpret_cast<RawTypedData*>(*NativeFieldsAddr()); |
7049 if (native_fields == TypedData::null()) { | 7065 if (native_fields == TypedData::null()) { |
7050 return 0; | 7066 return 0; |
7051 } | 7067 } |
7052 return reinterpret_cast<intptr_t*>(native_fields->ptr()->data_)[index]; | 7068 return reinterpret_cast<intptr_t*>(native_fields->ptr()->data())[index]; |
7053 } | 7069 } |
7054 | 7070 |
7055 | 7071 |
7056 void Instance::GetNativeFields(uint16_t num_fields, | 7072 void Instance::GetNativeFields(uint16_t num_fields, |
7057 intptr_t* field_values) const { | 7073 intptr_t* field_values) const { |
7058 NoGCScope no_gc; | 7074 NoGCScope no_gc; |
7059 ASSERT(num_fields == NumNativeFields()); | 7075 ASSERT(num_fields == NumNativeFields()); |
7060 ASSERT(field_values != NULL); | 7076 ASSERT(field_values != NULL); |
7061 RawTypedData* native_fields = | 7077 RawTypedData* native_fields = |
7062 reinterpret_cast<RawTypedData*>(*NativeFieldsAddr()); | 7078 reinterpret_cast<RawTypedData*>(*NativeFieldsAddr()); |
7063 if (native_fields == TypedData::null()) { | 7079 if (native_fields == TypedData::null()) { |
7064 for (intptr_t i = 0; i < num_fields; i++) { | 7080 for (intptr_t i = 0; i < num_fields; i++) { |
7065 field_values[i] = 0; | 7081 field_values[i] = 0; |
7066 } | 7082 } |
7067 } | 7083 } |
7068 intptr_t* fields = reinterpret_cast<intptr_t*>(native_fields->ptr()->data_); | 7084 intptr_t* fields = reinterpret_cast<intptr_t*>(native_fields->ptr()->data()); |
7069 for (intptr_t i = 0; i < num_fields; i++) { | 7085 for (intptr_t i = 0; i < num_fields; i++) { |
7070 field_values[i] = fields[i]; | 7086 field_values[i] = fields[i]; |
7071 } | 7087 } |
7072 } | 7088 } |
7073 | 7089 |
7074 | 7090 |
7075 bool String::Equals(const String& str) const { | 7091 bool String::Equals(const String& str) const { |
7076 if (raw() == str.raw()) { | 7092 if (raw() == str.raw()) { |
7077 return true; // Both handles point to the same raw instance. | 7093 return true; // Both handles point to the same raw instance. |
7078 } | 7094 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7117 | 7133 |
7118 | 7134 |
7119 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7135 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7120 intptr_t index) { | 7136 intptr_t index) { |
7121 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7137 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7122 } | 7138 } |
7123 | 7139 |
7124 } // namespace dart | 7140 } // namespace dart |
7125 | 7141 |
7126 #endif // VM_OBJECT_H_ | 7142 #endif // VM_OBJECT_H_ |
OLD | NEW |