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 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2870 uword EntryPoint() const { | 2872 uword EntryPoint() const { |
2871 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); | 2873 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); |
2872 } | 2874 } |
2873 | 2875 |
2874 static const intptr_t kMaxElements = (kIntptrMax - | 2876 static const intptr_t kMaxElements = (kIntptrMax - |
2875 (sizeof(RawInstructions) + | 2877 (sizeof(RawInstructions) + |
2876 sizeof(RawObject) + | 2878 sizeof(RawObject) + |
2877 (2 * OS::kMaxPreferredCodeAlignment))); | 2879 (2 * OS::kMaxPreferredCodeAlignment))); |
2878 | 2880 |
2879 static intptr_t InstanceSize() { | 2881 static intptr_t InstanceSize() { |
2880 ASSERT(sizeof(RawInstructions) == OFFSET_OF(RawInstructions, data_)); | 2882 ASSERT(sizeof(RawInstructions) == |
| 2883 OFFSET_OF_RETURNED_VALUE(RawInstructions, data)); |
2881 return 0; | 2884 return 0; |
2882 } | 2885 } |
2883 | 2886 |
2884 static intptr_t InstanceSize(intptr_t size) { | 2887 static intptr_t InstanceSize(intptr_t size) { |
2885 intptr_t instructions_size = Utils::RoundUp(size, | 2888 intptr_t instructions_size = Utils::RoundUp(size, |
2886 OS::PreferredCodeAlignment()); | 2889 OS::PreferredCodeAlignment()); |
2887 intptr_t result = instructions_size + HeaderSize(); | 2890 intptr_t result = instructions_size + HeaderSize(); |
2888 ASSERT(result % OS::PreferredCodeAlignment() == 0); | 2891 ASSERT(result % OS::PreferredCodeAlignment() == 0); |
2889 return result; | 2892 return result; |
2890 } | 2893 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2933 RawLocalVarDescriptors::VarInfo* info) const; | 2936 RawLocalVarDescriptors::VarInfo* info) const; |
2934 | 2937 |
2935 void GetInfo(intptr_t var_index, RawLocalVarDescriptors::VarInfo* info) const; | 2938 void GetInfo(intptr_t var_index, RawLocalVarDescriptors::VarInfo* info) const; |
2936 | 2939 |
2937 static const intptr_t kBytesPerElement = | 2940 static const intptr_t kBytesPerElement = |
2938 sizeof(RawLocalVarDescriptors::VarInfo); | 2941 sizeof(RawLocalVarDescriptors::VarInfo); |
2939 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 2942 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
2940 | 2943 |
2941 static intptr_t InstanceSize() { | 2944 static intptr_t InstanceSize() { |
2942 ASSERT(sizeof(RawLocalVarDescriptors) == | 2945 ASSERT(sizeof(RawLocalVarDescriptors) == |
2943 OFFSET_OF(RawLocalVarDescriptors, data_)); | 2946 OFFSET_OF_RETURNED_VALUE(RawLocalVarDescriptors, data)); |
2944 return 0; | 2947 return 0; |
2945 } | 2948 } |
2946 static intptr_t InstanceSize(intptr_t len) { | 2949 static intptr_t InstanceSize(intptr_t len) { |
2947 ASSERT(0 <= len && len <= kMaxElements); | 2950 ASSERT(0 <= len && len <= kMaxElements); |
2948 return RoundedAllocationSize( | 2951 return RoundedAllocationSize( |
2949 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement)); | 2952 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement)); |
2950 } | 2953 } |
2951 | 2954 |
2952 static RawLocalVarDescriptors* New(intptr_t num_variables); | 2955 static RawLocalVarDescriptors* New(intptr_t num_variables); |
2953 | 2956 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3003 SetKind(index, kind); | 3006 SetKind(index, kind); |
3004 SetDeoptId(index, deopt_id); | 3007 SetDeoptId(index, deopt_id); |
3005 SetTokenPos(index, token_pos); | 3008 SetTokenPos(index, token_pos); |
3006 SetTryIndex(index, try_index); | 3009 SetTryIndex(index, try_index); |
3007 } | 3010 } |
3008 | 3011 |
3009 static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize); | 3012 static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize); |
3010 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 3013 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
3011 | 3014 |
3012 static intptr_t InstanceSize() { | 3015 static intptr_t InstanceSize() { |
3013 ASSERT(sizeof(RawPcDescriptors) == OFFSET_OF(RawPcDescriptors, data_)); | 3016 ASSERT(sizeof(RawPcDescriptors) == |
| 3017 OFFSET_OF_RETURNED_VALUE(RawPcDescriptors, data)); |
3014 return 0; | 3018 return 0; |
3015 } | 3019 } |
3016 static intptr_t InstanceSize(intptr_t len) { | 3020 static intptr_t InstanceSize(intptr_t len) { |
3017 ASSERT(0 <= len && len <= kMaxElements); | 3021 ASSERT(0 <= len && len <= kMaxElements); |
3018 return RoundedAllocationSize( | 3022 return RoundedAllocationSize( |
3019 sizeof(RawPcDescriptors) + (len * kBytesPerElement)); | 3023 sizeof(RawPcDescriptors) + (len * kBytesPerElement)); |
3020 } | 3024 } |
3021 | 3025 |
3022 static RawPcDescriptors* New(intptr_t num_descriptors); | 3026 static RawPcDescriptors* New(intptr_t num_descriptors); |
3023 | 3027 |
(...skipping 15 matching lines...) Expand all Loading... |
3039 void SetKind(intptr_t index, PcDescriptors::Kind kind) const; | 3043 void SetKind(intptr_t index, PcDescriptors::Kind kind) const; |
3040 void SetDeoptId(intptr_t index, intptr_t value) const; | 3044 void SetDeoptId(intptr_t index, intptr_t value) const; |
3041 void SetTokenPos(intptr_t index, intptr_t value) const; | 3045 void SetTokenPos(intptr_t index, intptr_t value) const; |
3042 void SetTryIndex(intptr_t index, intptr_t value) const; | 3046 void SetTryIndex(intptr_t index, intptr_t value) const; |
3043 | 3047 |
3044 void SetLength(intptr_t value) const; | 3048 void SetLength(intptr_t value) const; |
3045 | 3049 |
3046 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { | 3050 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { |
3047 ASSERT((index >=0) && (index < Length())); | 3051 ASSERT((index >=0) && (index < Length())); |
3048 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; | 3052 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; |
3049 return &raw_ptr()->data_[data_index]; | 3053 return &raw_ptr()->data()[data_index]; |
3050 } | 3054 } |
3051 RawSmi** SmiAddr(intptr_t index, intptr_t entry_offset) const { | 3055 RawSmi** SmiAddr(intptr_t index, intptr_t entry_offset) const { |
3052 return reinterpret_cast<RawSmi**>(EntryAddr(index, entry_offset)); | 3056 return reinterpret_cast<RawSmi**>(EntryAddr(index, entry_offset)); |
3053 } | 3057 } |
3054 | 3058 |
3055 FINAL_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object); | 3059 FINAL_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object); |
3056 friend class Class; | 3060 friend class Class; |
3057 friend class Object; | 3061 friend class Object; |
3058 }; | 3062 }; |
3059 | 3063 |
(...skipping 14 matching lines...) Expand all Loading... |
3074 void SetPC(uword value) const { raw_ptr()->pc_ = value; } | 3078 void SetPC(uword value) const { raw_ptr()->pc_ = value; } |
3075 | 3079 |
3076 intptr_t RegisterBitCount() const { return raw_ptr()->register_bit_count_; } | 3080 intptr_t RegisterBitCount() const { return raw_ptr()->register_bit_count_; } |
3077 void SetRegisterBitCount(intptr_t register_bit_count) const { | 3081 void SetRegisterBitCount(intptr_t register_bit_count) const { |
3078 raw_ptr()->register_bit_count_ = register_bit_count; | 3082 raw_ptr()->register_bit_count_ = register_bit_count; |
3079 } | 3083 } |
3080 | 3084 |
3081 static const intptr_t kMaxLengthInBytes = kSmiMax; | 3085 static const intptr_t kMaxLengthInBytes = kSmiMax; |
3082 | 3086 |
3083 static intptr_t InstanceSize() { | 3087 static intptr_t InstanceSize() { |
3084 ASSERT(sizeof(RawStackmap) == OFFSET_OF(RawStackmap, data_)); | 3088 ASSERT(sizeof(RawStackmap) == OFFSET_OF_RETURNED_VALUE(RawStackmap, data)); |
3085 return 0; | 3089 return 0; |
3086 } | 3090 } |
3087 static intptr_t InstanceSize(intptr_t length) { | 3091 static intptr_t InstanceSize(intptr_t length) { |
3088 ASSERT(length >= 0); | 3092 ASSERT(length >= 0); |
3089 // The stackmap payload is in an array of bytes. | 3093 // The stackmap payload is in an array of bytes. |
3090 intptr_t payload_size = | 3094 intptr_t payload_size = |
3091 Utils::RoundUp(length, kBitsPerByte) / kBitsPerByte; | 3095 Utils::RoundUp(length, kBitsPerByte) / kBitsPerByte; |
3092 return RoundedAllocationSize(sizeof(RawStackmap) + payload_size); | 3096 return RoundedAllocationSize(sizeof(RawStackmap) + payload_size); |
3093 } | 3097 } |
3094 static RawStackmap* New(intptr_t pc_offset, | 3098 static RawStackmap* New(intptr_t pc_offset, |
(...skipping 29 matching lines...) Expand all Loading... |
3124 intptr_t outer_try_index, | 3128 intptr_t outer_try_index, |
3125 intptr_t handler_pc, | 3129 intptr_t handler_pc, |
3126 bool needs_stacktrace, | 3130 bool needs_stacktrace, |
3127 bool has_catch_all) const; | 3131 bool has_catch_all) const; |
3128 | 3132 |
3129 RawArray* GetHandledTypes(intptr_t try_index) const; | 3133 RawArray* GetHandledTypes(intptr_t try_index) const; |
3130 void SetHandledTypes(intptr_t try_index, const Array& handled_types) const; | 3134 void SetHandledTypes(intptr_t try_index, const Array& handled_types) const; |
3131 bool HasCatchAll(intptr_t try_index) const; | 3135 bool HasCatchAll(intptr_t try_index) const; |
3132 | 3136 |
3133 static intptr_t InstanceSize() { | 3137 static intptr_t InstanceSize() { |
3134 ASSERT(sizeof(RawExceptionHandlers) == OFFSET_OF(RawExceptionHandlers, | 3138 ASSERT(sizeof(RawExceptionHandlers) == |
3135 data_)); | 3139 OFFSET_OF_RETURNED_VALUE(RawExceptionHandlers, data)); |
3136 return 0; | 3140 return 0; |
3137 } | 3141 } |
3138 static intptr_t InstanceSize(intptr_t len) { | 3142 static intptr_t InstanceSize(intptr_t len) { |
3139 return RoundedAllocationSize( | 3143 return RoundedAllocationSize( |
3140 sizeof(RawExceptionHandlers) + | 3144 sizeof(RawExceptionHandlers) + |
3141 (len * sizeof(RawExceptionHandlers::HandlerInfo))); | 3145 (len * sizeof(RawExceptionHandlers::HandlerInfo))); |
3142 } | 3146 } |
3143 | 3147 |
3144 static RawExceptionHandlers* New(intptr_t num_handlers); | 3148 static RawExceptionHandlers* New(intptr_t num_handlers); |
3145 | 3149 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3194 | 3198 |
3195 // Returns the number of kMaterializeObject instructions in the prefix. | 3199 // Returns the number of kMaterializeObject instructions in the prefix. |
3196 intptr_t NumMaterializations() const; | 3200 intptr_t NumMaterializations() const; |
3197 | 3201 |
3198 static RawDeoptInfo* New(intptr_t num_commands); | 3202 static RawDeoptInfo* New(intptr_t num_commands); |
3199 | 3203 |
3200 static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize); | 3204 static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize); |
3201 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 3205 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
3202 | 3206 |
3203 static intptr_t InstanceSize() { | 3207 static intptr_t InstanceSize() { |
3204 ASSERT(sizeof(RawDeoptInfo) == OFFSET_OF(RawDeoptInfo, data_)); | 3208 ASSERT(sizeof(RawDeoptInfo) == |
| 3209 OFFSET_OF_RETURNED_VALUE(RawDeoptInfo, data)); |
3205 return 0; | 3210 return 0; |
3206 } | 3211 } |
3207 | 3212 |
3208 static intptr_t InstanceSize(intptr_t len) { | 3213 static intptr_t InstanceSize(intptr_t len) { |
3209 ASSERT(0 <= len && len <= kMaxElements); | 3214 ASSERT(0 <= len && len <= kMaxElements); |
3210 return RoundedAllocationSize(sizeof(RawDeoptInfo) + | 3215 return RoundedAllocationSize(sizeof(RawDeoptInfo) + |
3211 (len * kBytesPerElement)); | 3216 (len * kBytesPerElement)); |
3212 } | 3217 } |
3213 | 3218 |
3214 // 'index' corresponds to target, to-index. | 3219 // 'index' corresponds to target, to-index. |
(...skipping 15 matching lines...) Expand all Loading... |
3230 | 3235 |
3231 // Returns true iff decompression yields the same instructions as the | 3236 // Returns true iff decompression yields the same instructions as the |
3232 // original. | 3237 // original. |
3233 bool VerifyDecompression(const GrowableArray<DeoptInstr*>& original, | 3238 bool VerifyDecompression(const GrowableArray<DeoptInstr*>& original, |
3234 const Array& deopt_table) const; | 3239 const Array& deopt_table) const; |
3235 | 3240 |
3236 private: | 3241 private: |
3237 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { | 3242 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { |
3238 ASSERT((index >=0) && (index < Length())); | 3243 ASSERT((index >=0) && (index < Length())); |
3239 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; | 3244 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; |
3240 return &raw_ptr()->data_[data_index]; | 3245 return &raw_ptr()->data()[data_index]; |
3241 } | 3246 } |
3242 | 3247 |
3243 void SetLength(intptr_t value) const; | 3248 void SetLength(intptr_t value) const; |
3244 | 3249 |
3245 FINAL_HEAP_OBJECT_IMPLEMENTATION(DeoptInfo, Object); | 3250 FINAL_HEAP_OBJECT_IMPLEMENTATION(DeoptInfo, Object); |
3246 friend class Class; | 3251 friend class Class; |
3247 }; | 3252 }; |
3248 | 3253 |
3249 | 3254 |
3250 // Object holding information about an IC: test classes and their | 3255 // Object holding information about an IC: test classes and their |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3621 | 3626 |
3622 void set_owner(const Class& cls) { | 3627 void set_owner(const Class& cls) { |
3623 ASSERT(cls.IsOld()); | 3628 ASSERT(cls.IsOld()); |
3624 StorePointer(&raw_ptr()->owner_, reinterpret_cast<RawObject*>(cls.raw())); | 3629 StorePointer(&raw_ptr()->owner_, reinterpret_cast<RawObject*>(cls.raw())); |
3625 } | 3630 } |
3626 | 3631 |
3627 // We would have a VisitPointers function here to traverse all the | 3632 // We would have a VisitPointers function here to traverse all the |
3628 // embedded objects in the instructions using pointer_offsets. | 3633 // embedded objects in the instructions using pointer_offsets. |
3629 | 3634 |
3630 static const intptr_t kBytesPerElement = | 3635 static const intptr_t kBytesPerElement = |
3631 sizeof(reinterpret_cast<RawCode*>(0)->data_[0]); | 3636 sizeof(reinterpret_cast<RawCode*>(0)->data()[0]); |
3632 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 3637 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
3633 | 3638 |
3634 static intptr_t InstanceSize() { | 3639 static intptr_t InstanceSize() { |
3635 ASSERT(sizeof(RawCode) == OFFSET_OF(RawCode, data_)); | 3640 ASSERT(sizeof(RawCode) == OFFSET_OF_RETURNED_VALUE(RawCode, data)); |
3636 return 0; | 3641 return 0; |
3637 } | 3642 } |
3638 static intptr_t InstanceSize(intptr_t len) { | 3643 static intptr_t InstanceSize(intptr_t len) { |
3639 ASSERT(0 <= len && len <= kMaxElements); | 3644 ASSERT(0 <= len && len <= kMaxElements); |
3640 return RoundedAllocationSize(sizeof(RawCode) + (len * kBytesPerElement)); | 3645 return RoundedAllocationSize(sizeof(RawCode) + (len * kBytesPerElement)); |
3641 } | 3646 } |
3642 static RawCode* FinalizeCode(const Function& function, | 3647 static RawCode* FinalizeCode(const Function& function, |
3643 Assembler* assembler, | 3648 Assembler* assembler, |
3644 bool optimized = false); | 3649 bool optimized = false); |
3645 static RawCode* FinalizeCode(const char* name, | 3650 static RawCode* FinalizeCode(const char* name, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3753 raw_ptr()->instructions_ = instructions; | 3758 raw_ptr()->instructions_ = instructions; |
3754 } | 3759 } |
3755 void set_pointer_offsets_length(intptr_t value) { | 3760 void set_pointer_offsets_length(intptr_t value) { |
3756 ASSERT(value >= 0); | 3761 ASSERT(value >= 0); |
3757 raw_ptr()->pointer_offsets_length_ = value; | 3762 raw_ptr()->pointer_offsets_length_ = value; |
3758 } | 3763 } |
3759 int32_t* PointerOffsetAddrAt(int index) const { | 3764 int32_t* PointerOffsetAddrAt(int index) const { |
3760 ASSERT(index >= 0); | 3765 ASSERT(index >= 0); |
3761 ASSERT(index < pointer_offsets_length()); | 3766 ASSERT(index < pointer_offsets_length()); |
3762 // TODO(iposva): Unit test is missing for this functionality. | 3767 // TODO(iposva): Unit test is missing for this functionality. |
3763 return &raw_ptr()->data_[index]; | 3768 return &raw_ptr()->data()[index]; |
3764 } | 3769 } |
3765 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) { | 3770 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) { |
3766 *PointerOffsetAddrAt(index) = offset_in_instructions; | 3771 *PointerOffsetAddrAt(index) = offset_in_instructions; |
3767 } | 3772 } |
3768 | 3773 |
3769 intptr_t BinarySearchInSCallTable(uword pc) const; | 3774 intptr_t BinarySearchInSCallTable(uword pc) const; |
3770 static RawCode* LookupCodeInIsolate(Isolate* isolate, uword pc); | 3775 static RawCode* LookupCodeInIsolate(Isolate* isolate, uword pc); |
3771 | 3776 |
3772 // New is a private method as RawInstruction and RawCode objects should | 3777 // New is a private method as RawInstruction and RawCode objects should |
3773 // only be created using the Code::FinalizeCode method. This method creates | 3778 // only be created using the Code::FinalizeCode method. This method creates |
(...skipping 11 matching lines...) Expand all Loading... |
3785 | 3790 |
3786 | 3791 |
3787 class Context : public Object { | 3792 class Context : public Object { |
3788 public: | 3793 public: |
3789 RawContext* parent() const { return raw_ptr()->parent_; } | 3794 RawContext* parent() const { return raw_ptr()->parent_; } |
3790 void set_parent(const Context& parent) const { | 3795 void set_parent(const Context& parent) const { |
3791 ASSERT(parent.IsNull() || parent.isolate() == Isolate::Current()); | 3796 ASSERT(parent.IsNull() || parent.isolate() == Isolate::Current()); |
3792 StorePointer(&raw_ptr()->parent_, parent.raw()); | 3797 StorePointer(&raw_ptr()->parent_, parent.raw()); |
3793 } | 3798 } |
3794 static intptr_t parent_offset() { return OFFSET_OF(RawContext, parent_); } | 3799 static intptr_t parent_offset() { return OFFSET_OF(RawContext, parent_); } |
| 3800 static intptr_t data_offset() { return parent_offset() + kWordSize; } |
3795 | 3801 |
3796 Isolate* isolate() const { return raw_ptr()->isolate_; } | 3802 Isolate* isolate() const { return raw_ptr()->isolate_; } |
3797 static intptr_t isolate_offset() { return OFFSET_OF(RawContext, isolate_); } | 3803 static intptr_t isolate_offset() { return OFFSET_OF(RawContext, isolate_); } |
3798 | 3804 |
3799 intptr_t num_variables() const { return raw_ptr()->num_variables_; } | 3805 intptr_t num_variables() const { return raw_ptr()->num_variables_; } |
3800 static intptr_t num_variables_offset() { | 3806 static intptr_t num_variables_offset() { |
3801 return OFFSET_OF(RawContext, num_variables_); | 3807 return OFFSET_OF(RawContext, num_variables_); |
3802 } | 3808 } |
3803 | 3809 |
3804 RawInstance* At(intptr_t context_index) const { | 3810 RawInstance* At(intptr_t context_index) const { |
3805 return *InstanceAddr(context_index); | 3811 return *InstanceAddr(context_index); |
3806 } | 3812 } |
3807 inline void SetAt(intptr_t context_index, const Instance& value) const; | 3813 inline void SetAt(intptr_t context_index, const Instance& value) const; |
3808 | 3814 |
3809 void Dump(int indent = 0) const; | 3815 void Dump(int indent = 0) const; |
3810 | 3816 |
3811 static const intptr_t kBytesPerElement = kWordSize; | 3817 static const intptr_t kBytesPerElement = kWordSize; |
3812 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 3818 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
3813 | 3819 |
3814 static intptr_t variable_offset(intptr_t context_index) { | 3820 static intptr_t variable_offset(intptr_t context_index) { |
3815 return OFFSET_OF(RawContext, data_[context_index]); | 3821 return data_offset() + kWordSize * context_index; |
3816 } | 3822 } |
3817 | 3823 |
3818 static intptr_t InstanceSize() { | 3824 static intptr_t InstanceSize() { |
3819 ASSERT(sizeof(RawContext) == OFFSET_OF(RawContext, data_)); | 3825 ASSERT(sizeof(RawContext) == OFFSET_OF_RETURNED_VALUE(RawContext, data)); |
3820 return 0; | 3826 return 0; |
3821 } | 3827 } |
3822 | 3828 |
3823 static intptr_t InstanceSize(intptr_t len) { | 3829 static intptr_t InstanceSize(intptr_t len) { |
3824 ASSERT(0 <= len && len <= kMaxElements); | 3830 ASSERT(0 <= len && len <= kMaxElements); |
3825 return RoundedAllocationSize(sizeof(RawContext) + (len * kBytesPerElement)); | 3831 return RoundedAllocationSize(sizeof(RawContext) + (len * kBytesPerElement)); |
3826 } | 3832 } |
3827 | 3833 |
3828 static RawContext* New(intptr_t num_variables, | 3834 static RawContext* New(intptr_t num_variables, |
3829 Heap::Space space = Heap::kNew); | 3835 Heap::Space space = Heap::kNew); |
3830 | 3836 |
3831 private: | 3837 private: |
3832 RawInstance** InstanceAddr(intptr_t context_index) const { | 3838 RawInstance** InstanceAddr(intptr_t context_index) const { |
3833 ASSERT((context_index >= 0) && (context_index < num_variables())); | 3839 ASSERT((context_index >= 0) && (context_index < num_variables())); |
3834 return &raw_ptr()->data_[context_index]; | 3840 return &raw_ptr()->data()[context_index]; |
3835 } | 3841 } |
3836 | 3842 |
3837 void set_isolate(Isolate* isolate) const { | 3843 void set_isolate(Isolate* isolate) const { |
3838 raw_ptr()->isolate_ = isolate; | 3844 raw_ptr()->isolate_ = isolate; |
3839 } | 3845 } |
3840 | 3846 |
3841 void set_num_variables(intptr_t num_variables) const { | 3847 void set_num_variables(intptr_t num_variables) const { |
3842 raw_ptr()->num_variables_ = num_variables; | 3848 raw_ptr()->num_variables_ = num_variables; |
3843 } | 3849 } |
3844 | 3850 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3882 void SetContextIndexAt(intptr_t scope_index, intptr_t context_index) const; | 3888 void SetContextIndexAt(intptr_t scope_index, intptr_t context_index) const; |
3883 | 3889 |
3884 intptr_t ContextLevelAt(intptr_t scope_index) const; | 3890 intptr_t ContextLevelAt(intptr_t scope_index) const; |
3885 void SetContextLevelAt(intptr_t scope_index, intptr_t context_level) const; | 3891 void SetContextLevelAt(intptr_t scope_index, intptr_t context_level) const; |
3886 | 3892 |
3887 static const intptr_t kBytesPerElement = | 3893 static const intptr_t kBytesPerElement = |
3888 sizeof(RawContextScope::VariableDesc); | 3894 sizeof(RawContextScope::VariableDesc); |
3889 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 3895 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
3890 | 3896 |
3891 static intptr_t InstanceSize() { | 3897 static intptr_t InstanceSize() { |
3892 ASSERT(sizeof(RawContextScope) == OFFSET_OF(RawContextScope, data_)); | 3898 ASSERT(sizeof(RawContextScope) == |
| 3899 OFFSET_OF_RETURNED_VALUE(RawContextScope, data)); |
3893 return 0; | 3900 return 0; |
3894 } | 3901 } |
3895 | 3902 |
3896 static intptr_t InstanceSize(intptr_t len) { | 3903 static intptr_t InstanceSize(intptr_t len) { |
3897 ASSERT(0 <= len && len <= kMaxElements); | 3904 ASSERT(0 <= len && len <= kMaxElements); |
3898 return RoundedAllocationSize( | 3905 return RoundedAllocationSize( |
3899 sizeof(RawContextScope) + (len * kBytesPerElement)); | 3906 sizeof(RawContextScope) + (len * kBytesPerElement)); |
3900 } | 3907 } |
3901 | 3908 |
3902 static RawContextScope* New(intptr_t num_variables); | 3909 static RawContextScope* New(intptr_t num_variables); |
(...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5533 } | 5540 } |
5534 | 5541 |
5535 static void SetCharAt(const String& str, intptr_t index, uint8_t code_point) { | 5542 static void SetCharAt(const String& str, intptr_t index, uint8_t code_point) { |
5536 *CharAddr(str, index) = code_point; | 5543 *CharAddr(str, index) = code_point; |
5537 } | 5544 } |
5538 static RawOneByteString* EscapeSpecialCharacters(const String& str); | 5545 static RawOneByteString* EscapeSpecialCharacters(const String& str); |
5539 // We use the same maximum elements for all strings. | 5546 // We use the same maximum elements for all strings. |
5540 static const intptr_t kBytesPerElement = 1; | 5547 static const intptr_t kBytesPerElement = 1; |
5541 static const intptr_t kMaxElements = String::kMaxElements; | 5548 static const intptr_t kMaxElements = String::kMaxElements; |
5542 | 5549 |
5543 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); } | 5550 static intptr_t data_offset() { |
| 5551 return OFFSET_OF_RETURNED_VALUE(RawOneByteString, data); |
| 5552 } |
5544 | 5553 |
5545 static intptr_t InstanceSize() { | 5554 static intptr_t InstanceSize() { |
5546 ASSERT(sizeof(RawOneByteString) == OFFSET_OF(RawOneByteString, data_)); | 5555 ASSERT(sizeof(RawOneByteString) == |
| 5556 OFFSET_OF_RETURNED_VALUE(RawOneByteString, data)); |
5547 return 0; | 5557 return 0; |
5548 } | 5558 } |
5549 | 5559 |
5550 static intptr_t InstanceSize(intptr_t len) { | 5560 static intptr_t InstanceSize(intptr_t len) { |
5551 ASSERT(sizeof(RawOneByteString) == String::kSizeofRawString); | 5561 ASSERT(sizeof(RawOneByteString) == String::kSizeofRawString); |
5552 ASSERT(0 <= len && len <= kMaxElements); | 5562 ASSERT(0 <= len && len <= kMaxElements); |
5553 return String::RoundedAllocationSize( | 5563 return String::RoundedAllocationSize( |
5554 sizeof(RawOneByteString) + (len * kBytesPerElement)); | 5564 sizeof(RawOneByteString) + (len * kBytesPerElement)); |
5555 } | 5565 } |
5556 | 5566 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5629 } | 5639 } |
5630 | 5640 |
5631 static RawOneByteString* raw_ptr(const String& str) { | 5641 static RawOneByteString* raw_ptr(const String& str) { |
5632 return reinterpret_cast<RawOneByteString*>(str.raw_ptr()); | 5642 return reinterpret_cast<RawOneByteString*>(str.raw_ptr()); |
5633 } | 5643 } |
5634 | 5644 |
5635 static uint8_t* CharAddr(const String& str, intptr_t index) { | 5645 static uint8_t* CharAddr(const String& str, intptr_t index) { |
5636 ASSERT((index >= 0) && (index < str.Length())); | 5646 ASSERT((index >= 0) && (index < str.Length())); |
5637 ASSERT(str.IsOneByteString()); | 5647 ASSERT(str.IsOneByteString()); |
5638 NoGCScope no_gc; | 5648 NoGCScope no_gc; |
5639 return &raw_ptr(str)->data_[index]; | 5649 return &raw_ptr(str)->data()[index]; |
5640 } | 5650 } |
5641 | 5651 |
5642 static RawOneByteString* ReadFrom(SnapshotReader* reader, | 5652 static RawOneByteString* ReadFrom(SnapshotReader* reader, |
5643 intptr_t object_id, | 5653 intptr_t object_id, |
5644 intptr_t tags, | 5654 intptr_t tags, |
5645 Snapshot::Kind kind); | 5655 Snapshot::Kind kind); |
5646 | 5656 |
5647 friend class Class; | 5657 friend class Class; |
5648 friend class String; | 5658 friend class String; |
5649 friend class ExternalOneByteString; | 5659 friend class ExternalOneByteString; |
(...skipping 10 matching lines...) Expand all Loading... |
5660 static void SetCharAt(const String& str, intptr_t index, uint16_t ch) { | 5670 static void SetCharAt(const String& str, intptr_t index, uint16_t ch) { |
5661 *CharAddr(str, index) = ch; | 5671 *CharAddr(str, index) = ch; |
5662 } | 5672 } |
5663 | 5673 |
5664 static RawTwoByteString* EscapeSpecialCharacters(const String& str); | 5674 static RawTwoByteString* EscapeSpecialCharacters(const String& str); |
5665 | 5675 |
5666 // We use the same maximum elements for all strings. | 5676 // We use the same maximum elements for all strings. |
5667 static const intptr_t kBytesPerElement = 2; | 5677 static const intptr_t kBytesPerElement = 2; |
5668 static const intptr_t kMaxElements = String::kMaxElements; | 5678 static const intptr_t kMaxElements = String::kMaxElements; |
5669 | 5679 |
5670 static intptr_t data_offset() { return OFFSET_OF(RawTwoByteString, data_); } | 5680 static intptr_t data_offset() { |
| 5681 return OFFSET_OF_RETURNED_VALUE(RawTwoByteString, data); |
| 5682 } |
5671 | 5683 |
5672 static intptr_t InstanceSize() { | 5684 static intptr_t InstanceSize() { |
5673 ASSERT(sizeof(RawTwoByteString) == OFFSET_OF(RawTwoByteString, data_)); | 5685 ASSERT(sizeof(RawTwoByteString) == |
| 5686 OFFSET_OF_RETURNED_VALUE(RawTwoByteString, data)); |
5674 return 0; | 5687 return 0; |
5675 } | 5688 } |
5676 | 5689 |
5677 static intptr_t InstanceSize(intptr_t len) { | 5690 static intptr_t InstanceSize(intptr_t len) { |
5678 ASSERT(sizeof(RawTwoByteString) == String::kSizeofRawString); | 5691 ASSERT(sizeof(RawTwoByteString) == String::kSizeofRawString); |
5679 ASSERT(0 <= len && len <= kMaxElements); | 5692 ASSERT(0 <= len && len <= kMaxElements); |
5680 return String::RoundedAllocationSize( | 5693 return String::RoundedAllocationSize( |
5681 sizeof(RawTwoByteString) + (len * kBytesPerElement)); | 5694 sizeof(RawTwoByteString) + (len * kBytesPerElement)); |
5682 } | 5695 } |
5683 | 5696 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5727 } | 5740 } |
5728 | 5741 |
5729 static RawTwoByteString* raw_ptr(const String& str) { | 5742 static RawTwoByteString* raw_ptr(const String& str) { |
5730 return reinterpret_cast<RawTwoByteString*>(str.raw_ptr()); | 5743 return reinterpret_cast<RawTwoByteString*>(str.raw_ptr()); |
5731 } | 5744 } |
5732 | 5745 |
5733 static uint16_t* CharAddr(const String& str, intptr_t index) { | 5746 static uint16_t* CharAddr(const String& str, intptr_t index) { |
5734 ASSERT((index >= 0) && (index < str.Length())); | 5747 ASSERT((index >= 0) && (index < str.Length())); |
5735 ASSERT(str.IsTwoByteString()); | 5748 ASSERT(str.IsTwoByteString()); |
5736 NoGCScope no_gc; | 5749 NoGCScope no_gc; |
5737 return &raw_ptr(str)->data_[index]; | 5750 return &raw_ptr(str)->data()[index]; |
5738 } | 5751 } |
5739 | 5752 |
5740 static RawTwoByteString* ReadFrom(SnapshotReader* reader, | 5753 static RawTwoByteString* ReadFrom(SnapshotReader* reader, |
5741 intptr_t object_id, | 5754 intptr_t object_id, |
5742 intptr_t tags, | 5755 intptr_t tags, |
5743 Snapshot::Kind kind); | 5756 Snapshot::Kind kind); |
5744 | 5757 |
5745 friend class Class; | 5758 friend class Class; |
5746 friend class String; | 5759 friend class String; |
5747 friend class SnapshotReader; | 5760 friend class SnapshotReader; |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6307 } | 6320 } |
6308 | 6321 |
6309 intptr_t LengthInBytes() const { | 6322 intptr_t LengthInBytes() const { |
6310 intptr_t cid = raw()->GetClassId(); | 6323 intptr_t cid = raw()->GetClassId(); |
6311 return (ElementSizeInBytes(cid) * Length()); | 6324 return (ElementSizeInBytes(cid) * Length()); |
6312 } | 6325 } |
6313 | 6326 |
6314 void* DataAddr(intptr_t byte_offset) const { | 6327 void* DataAddr(intptr_t byte_offset) const { |
6315 ASSERT((byte_offset == 0) || | 6328 ASSERT((byte_offset == 0) || |
6316 ((byte_offset > 0) && (byte_offset < LengthInBytes()))); | 6329 ((byte_offset > 0) && (byte_offset < LengthInBytes()))); |
6317 return reinterpret_cast<void*>(raw_ptr()->data_ + byte_offset); | 6330 return reinterpret_cast<void*>(raw_ptr()->data() + byte_offset); |
6318 } | 6331 } |
6319 | 6332 |
6320 #define TYPED_GETTER_SETTER(name, type) \ | 6333 #define TYPED_GETTER_SETTER(name, type) \ |
6321 type Get##name(intptr_t byte_offset) const { \ | 6334 type Get##name(intptr_t byte_offset) const { \ |
6322 return *reinterpret_cast<type*>(DataAddr(byte_offset)); \ | 6335 return *reinterpret_cast<type*>(DataAddr(byte_offset)); \ |
6323 } \ | 6336 } \ |
6324 void Set##name(intptr_t byte_offset, type value) const { \ | 6337 void Set##name(intptr_t byte_offset, type value) const { \ |
6325 *reinterpret_cast<type*>(DataAddr(byte_offset)) = value; \ | 6338 *reinterpret_cast<type*>(DataAddr(byte_offset)) = value; \ |
6326 } | 6339 } |
6327 TYPED_GETTER_SETTER(Int8, int8_t) | 6340 TYPED_GETTER_SETTER(Int8, int8_t) |
(...skipping 10 matching lines...) Expand all Loading... |
6338 TYPED_GETTER_SETTER(Int32x4, simd128_value_t) | 6351 TYPED_GETTER_SETTER(Int32x4, simd128_value_t) |
6339 TYPED_GETTER_SETTER(Float64x2, simd128_value_t) | 6352 TYPED_GETTER_SETTER(Float64x2, simd128_value_t) |
6340 | 6353 |
6341 #undef TYPED_GETTER_SETTER | 6354 #undef TYPED_GETTER_SETTER |
6342 | 6355 |
6343 static intptr_t length_offset() { | 6356 static intptr_t length_offset() { |
6344 return OFFSET_OF(RawTypedData, length_); | 6357 return OFFSET_OF(RawTypedData, length_); |
6345 } | 6358 } |
6346 | 6359 |
6347 static intptr_t data_offset() { | 6360 static intptr_t data_offset() { |
6348 return OFFSET_OF(RawTypedData, data_); | 6361 return OFFSET_OF_RETURNED_VALUE(RawTypedData, data); |
6349 } | 6362 } |
6350 | 6363 |
6351 static intptr_t InstanceSize() { | 6364 static intptr_t InstanceSize() { |
6352 ASSERT(sizeof(RawTypedData) == OFFSET_OF(RawTypedData, data_)); | 6365 ASSERT(sizeof(RawTypedData) == |
| 6366 OFFSET_OF_RETURNED_VALUE(RawTypedData, data)); |
6353 return 0; | 6367 return 0; |
6354 } | 6368 } |
6355 | 6369 |
6356 static intptr_t InstanceSize(intptr_t lengthInBytes) { | 6370 static intptr_t InstanceSize(intptr_t lengthInBytes) { |
6357 ASSERT(0 <= lengthInBytes && lengthInBytes <= kSmiMax); | 6371 ASSERT(0 <= lengthInBytes && lengthInBytes <= kSmiMax); |
6358 return RoundedAllocationSize(sizeof(RawTypedData) + lengthInBytes); | 6372 return RoundedAllocationSize(sizeof(RawTypedData) + lengthInBytes); |
6359 } | 6373 } |
6360 | 6374 |
6361 static intptr_t ElementSizeInBytes(intptr_t class_id) { | 6375 static intptr_t ElementSizeInBytes(intptr_t class_id) { |
6362 ASSERT(RawObject::IsTypedDataClassId(class_id)); | 6376 ASSERT(RawObject::IsTypedDataClassId(class_id)); |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6838 void* GetDataStartAddress() const; | 6852 void* GetDataStartAddress() const; |
6839 static RawJSRegExp* FromDataStartAddress(void* data); | 6853 static RawJSRegExp* FromDataStartAddress(void* data); |
6840 const char* Flags() const; | 6854 const char* Flags() const; |
6841 | 6855 |
6842 virtual bool CanonicalizeEquals(const Instance& other) const; | 6856 virtual bool CanonicalizeEquals(const Instance& other) const; |
6843 | 6857 |
6844 static const intptr_t kBytesPerElement = 1; | 6858 static const intptr_t kBytesPerElement = 1; |
6845 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 6859 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
6846 | 6860 |
6847 static intptr_t InstanceSize() { | 6861 static intptr_t InstanceSize() { |
6848 ASSERT(sizeof(RawJSRegExp) == OFFSET_OF(RawJSRegExp, data_)); | 6862 ASSERT(sizeof(RawJSRegExp) == OFFSET_OF_RETURNED_VALUE(RawJSRegExp, data)); |
6849 return 0; | 6863 return 0; |
6850 } | 6864 } |
6851 | 6865 |
6852 static intptr_t InstanceSize(intptr_t len) { | 6866 static intptr_t InstanceSize(intptr_t len) { |
6853 ASSERT(0 <= len && len <= kMaxElements); | 6867 ASSERT(0 <= len && len <= kMaxElements); |
6854 return RoundedAllocationSize( | 6868 return RoundedAllocationSize( |
6855 sizeof(RawJSRegExp) + (len * kBytesPerElement)); | 6869 sizeof(RawJSRegExp) + (len * kBytesPerElement)); |
6856 } | 6870 } |
6857 | 6871 |
6858 static RawJSRegExp* New(intptr_t length, Heap::Space space = Heap::kNew); | 6872 static RawJSRegExp* New(intptr_t length, Heap::Space space = Heap::kNew); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7040 | 7054 |
7041 | 7055 |
7042 intptr_t Instance::GetNativeField(int index) const { | 7056 intptr_t Instance::GetNativeField(int index) const { |
7043 ASSERT(IsValidNativeIndex(index)); | 7057 ASSERT(IsValidNativeIndex(index)); |
7044 NoGCScope no_gc; | 7058 NoGCScope no_gc; |
7045 RawTypedData* native_fields = | 7059 RawTypedData* native_fields = |
7046 reinterpret_cast<RawTypedData*>(*NativeFieldsAddr()); | 7060 reinterpret_cast<RawTypedData*>(*NativeFieldsAddr()); |
7047 if (native_fields == TypedData::null()) { | 7061 if (native_fields == TypedData::null()) { |
7048 return 0; | 7062 return 0; |
7049 } | 7063 } |
7050 return reinterpret_cast<intptr_t*>(native_fields->ptr()->data_)[index]; | 7064 return reinterpret_cast<intptr_t*>(native_fields->ptr()->data())[index]; |
7051 } | 7065 } |
7052 | 7066 |
7053 | 7067 |
7054 void Instance::GetNativeFields(uint16_t num_fields, | 7068 void Instance::GetNativeFields(uint16_t num_fields, |
7055 intptr_t* field_values) const { | 7069 intptr_t* field_values) const { |
7056 NoGCScope no_gc; | 7070 NoGCScope no_gc; |
7057 ASSERT(num_fields == NumNativeFields()); | 7071 ASSERT(num_fields == NumNativeFields()); |
7058 ASSERT(field_values != NULL); | 7072 ASSERT(field_values != NULL); |
7059 RawTypedData* native_fields = | 7073 RawTypedData* native_fields = |
7060 reinterpret_cast<RawTypedData*>(*NativeFieldsAddr()); | 7074 reinterpret_cast<RawTypedData*>(*NativeFieldsAddr()); |
7061 if (native_fields == TypedData::null()) { | 7075 if (native_fields == TypedData::null()) { |
7062 for (intptr_t i = 0; i < num_fields; i++) { | 7076 for (intptr_t i = 0; i < num_fields; i++) { |
7063 field_values[i] = 0; | 7077 field_values[i] = 0; |
7064 } | 7078 } |
7065 } | 7079 } |
7066 intptr_t* fields = reinterpret_cast<intptr_t*>(native_fields->ptr()->data_); | 7080 intptr_t* fields = reinterpret_cast<intptr_t*>(native_fields->ptr()->data()); |
7067 for (intptr_t i = 0; i < num_fields; i++) { | 7081 for (intptr_t i = 0; i < num_fields; i++) { |
7068 field_values[i] = fields[i]; | 7082 field_values[i] = fields[i]; |
7069 } | 7083 } |
7070 } | 7084 } |
7071 | 7085 |
7072 | 7086 |
7073 bool String::Equals(const String& str) const { | 7087 bool String::Equals(const String& str) const { |
7074 if (raw() == str.raw()) { | 7088 if (raw() == str.raw()) { |
7075 return true; // Both handles point to the same raw instance. | 7089 return true; // Both handles point to the same raw instance. |
7076 } | 7090 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7115 | 7129 |
7116 | 7130 |
7117 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7131 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7118 intptr_t index) { | 7132 intptr_t index) { |
7119 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7133 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7120 } | 7134 } |
7121 | 7135 |
7122 } // namespace dart | 7136 } // namespace dart |
7123 | 7137 |
7124 #endif // VM_OBJECT_H_ | 7138 #endif // VM_OBJECT_H_ |
OLD | NEW |