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