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 2900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2911 } | 2911 } |
2912 RawArray* object_pool() const { return raw_ptr()->object_pool_; } | 2912 RawArray* object_pool() const { return raw_ptr()->object_pool_; } |
2913 static intptr_t object_pool_offset() { | 2913 static intptr_t object_pool_offset() { |
2914 return OFFSET_OF(RawInstructions, object_pool_); | 2914 return OFFSET_OF(RawInstructions, object_pool_); |
2915 } | 2915 } |
2916 | 2916 |
2917 uword EntryPoint() const { | 2917 uword EntryPoint() const { |
2918 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); | 2918 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); |
2919 } | 2919 } |
2920 | 2920 |
2921 static const intptr_t kMaxElements = (kIntptrMax - | 2921 static const intptr_t kMaxElements = (kMaxInt32 - |
2922 (sizeof(RawInstructions) + | 2922 (sizeof(RawInstructions) + |
2923 sizeof(RawObject) + | 2923 sizeof(RawObject) + |
2924 (2 * OS::kMaxPreferredCodeAlignment))); | 2924 (2 * OS::kMaxPreferredCodeAlignment))); |
2925 | 2925 |
2926 static intptr_t InstanceSize() { | 2926 static intptr_t InstanceSize() { |
2927 ASSERT(sizeof(RawInstructions) == | 2927 ASSERT(sizeof(RawInstructions) == |
2928 OFFSET_OF_RETURNED_VALUE(RawInstructions, data)); | 2928 OFFSET_OF_RETURNED_VALUE(RawInstructions, data)); |
2929 return 0; | 2929 return 0; |
2930 } | 2930 } |
2931 | 2931 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2977 RawString* GetName(intptr_t var_index) const; | 2977 RawString* GetName(intptr_t var_index) const; |
2978 | 2978 |
2979 void SetVar(intptr_t var_index, | 2979 void SetVar(intptr_t var_index, |
2980 const String& name, | 2980 const String& name, |
2981 RawLocalVarDescriptors::VarInfo* info) const; | 2981 RawLocalVarDescriptors::VarInfo* info) const; |
2982 | 2982 |
2983 void GetInfo(intptr_t var_index, RawLocalVarDescriptors::VarInfo* info) const; | 2983 void GetInfo(intptr_t var_index, RawLocalVarDescriptors::VarInfo* info) const; |
2984 | 2984 |
2985 static const intptr_t kBytesPerElement = | 2985 static const intptr_t kBytesPerElement = |
2986 sizeof(RawLocalVarDescriptors::VarInfo); | 2986 sizeof(RawLocalVarDescriptors::VarInfo); |
2987 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 2987 static const intptr_t kMaxElements = RawLocalVarDescriptors::kMaxIndex; |
2988 | 2988 |
2989 static intptr_t InstanceSize() { | 2989 static intptr_t InstanceSize() { |
2990 ASSERT(sizeof(RawLocalVarDescriptors) == | 2990 ASSERT(sizeof(RawLocalVarDescriptors) == |
2991 OFFSET_OF_RETURNED_VALUE(RawLocalVarDescriptors, data)); | 2991 OFFSET_OF_RETURNED_VALUE(RawLocalVarDescriptors, data)); |
2992 return 0; | 2992 return 0; |
2993 } | 2993 } |
2994 static intptr_t InstanceSize(intptr_t len) { | 2994 static intptr_t InstanceSize(intptr_t len) { |
2995 ASSERT(0 <= len && len <= kMaxElements); | 2995 ASSERT(0 <= len && len <= kMaxElements); |
2996 return RoundedAllocationSize( | 2996 return RoundedAllocationSize( |
2997 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement)); | 2997 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement)); |
(...skipping 24 matching lines...) Expand all Loading... |
3022 rec->set_token_pos(static_cast<int32_t>(token_pos), | 3022 rec->set_token_pos(static_cast<int32_t>(token_pos), |
3023 RecordSizeInBytes() == RawPcDescriptors::kCompressedRecSize); | 3023 RecordSizeInBytes() == RawPcDescriptors::kCompressedRecSize); |
3024 ASSERT(Utils::IsInt(16, try_index)); | 3024 ASSERT(Utils::IsInt(16, try_index)); |
3025 rec->set_try_index(try_index); | 3025 rec->set_try_index(try_index); |
3026 ASSERT(rec->try_index() == try_index); | 3026 ASSERT(rec->try_index() == try_index); |
3027 ASSERT(rec->token_pos() == token_pos); | 3027 ASSERT(rec->token_pos() == token_pos); |
3028 } | 3028 } |
3029 | 3029 |
3030 static const intptr_t kMaxBytesPerElement = | 3030 static const intptr_t kMaxBytesPerElement = |
3031 sizeof(RawPcDescriptors::PcDescriptorRec); | 3031 sizeof(RawPcDescriptors::PcDescriptorRec); |
3032 static const intptr_t kMaxElements = kSmiMax / kMaxBytesPerElement; | 3032 static const intptr_t kMaxElements = kSmi32Max / kMaxBytesPerElement; |
3033 | 3033 |
3034 static intptr_t InstanceSize() { | 3034 static intptr_t InstanceSize() { |
3035 ASSERT(sizeof(RawPcDescriptors) == | 3035 ASSERT(sizeof(RawPcDescriptors) == |
3036 OFFSET_OF_RETURNED_VALUE(RawPcDescriptors, data)); | 3036 OFFSET_OF_RETURNED_VALUE(RawPcDescriptors, data)); |
3037 return 0; | 3037 return 0; |
3038 } | 3038 } |
3039 static intptr_t InstanceSize(intptr_t len, intptr_t record_size_in_bytes) { | 3039 static intptr_t InstanceSize(intptr_t len, intptr_t record_size_in_bytes) { |
3040 ASSERT(0 <= len && len <= kMaxElements); | 3040 ASSERT(0 <= len && len <= kMaxElements); |
3041 return RoundedAllocationSize( | 3041 return RoundedAllocationSize( |
3042 sizeof(RawPcDescriptors) + (len * record_size_in_bytes)); | 3042 sizeof(RawPcDescriptors) + (len * record_size_in_bytes)); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3150 static const intptr_t kNoMaximum = -1; | 3150 static const intptr_t kNoMaximum = -1; |
3151 static const intptr_t kNoMinimum = -1; | 3151 static const intptr_t kNoMinimum = -1; |
3152 | 3152 |
3153 bool IsObject(intptr_t index) const { | 3153 bool IsObject(intptr_t index) const { |
3154 ASSERT(InRange(index)); | 3154 ASSERT(InRange(index)); |
3155 return GetBit(index); | 3155 return GetBit(index); |
3156 } | 3156 } |
3157 | 3157 |
3158 intptr_t Length() const { return raw_ptr()->length_; } | 3158 intptr_t Length() const { return raw_ptr()->length_; } |
3159 | 3159 |
3160 uword PC() const { return raw_ptr()->pc_; } | 3160 uint32_t PcOffset() const { return raw_ptr()->pc_offset_; } |
3161 void SetPC(uword value) const { raw_ptr()->pc_ = value; } | 3161 void SetPcOffset(uint32_t value) const { |
| 3162 ASSERT(value <= kMaxUint32); |
| 3163 raw_ptr()->pc_offset_ = value; |
| 3164 } |
3162 | 3165 |
3163 intptr_t RegisterBitCount() const { return raw_ptr()->register_bit_count_; } | 3166 intptr_t RegisterBitCount() const { return raw_ptr()->register_bit_count_; } |
3164 void SetRegisterBitCount(intptr_t register_bit_count) const { | 3167 void SetRegisterBitCount(intptr_t register_bit_count) const { |
| 3168 ASSERT(register_bit_count < kMaxInt32); |
3165 raw_ptr()->register_bit_count_ = register_bit_count; | 3169 raw_ptr()->register_bit_count_ = register_bit_count; |
3166 } | 3170 } |
3167 | 3171 |
3168 static const intptr_t kMaxLengthInBytes = kSmiMax; | 3172 static const intptr_t kMaxLengthInBytes = kSmiMax; |
3169 | 3173 |
3170 static intptr_t InstanceSize() { | 3174 static intptr_t InstanceSize() { |
3171 ASSERT(sizeof(RawStackmap) == OFFSET_OF_RETURNED_VALUE(RawStackmap, data)); | 3175 ASSERT(sizeof(RawStackmap) == OFFSET_OF_RETURNED_VALUE(RawStackmap, data)); |
3172 return 0; | 3176 return 0; |
3173 } | 3177 } |
3174 static intptr_t InstanceSize(intptr_t length) { | 3178 static intptr_t InstanceSize(intptr_t length) { |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3552 }; | 3556 }; |
3553 | 3557 |
3554 | 3558 |
3555 class Code : public Object { | 3559 class Code : public Object { |
3556 public: | 3560 public: |
3557 RawInstructions* instructions() const { return raw_ptr()->instructions_; } | 3561 RawInstructions* instructions() const { return raw_ptr()->instructions_; } |
3558 static intptr_t instructions_offset() { | 3562 static intptr_t instructions_offset() { |
3559 return OFFSET_OF(RawCode, instructions_); | 3563 return OFFSET_OF(RawCode, instructions_); |
3560 } | 3564 } |
3561 intptr_t pointer_offsets_length() const { | 3565 intptr_t pointer_offsets_length() const { |
3562 return raw_ptr()->pointer_offsets_length_; | 3566 return PtrOffBits::decode(raw_ptr()->state_bits_); |
3563 } | 3567 } |
3564 | 3568 |
3565 bool is_optimized() const { | 3569 bool is_optimized() const { |
3566 return OptimizedBit::decode(raw_ptr()->state_bits_); | 3570 return OptimizedBit::decode(raw_ptr()->state_bits_); |
3567 } | 3571 } |
3568 void set_is_optimized(bool value) const; | 3572 void set_is_optimized(bool value) const; |
3569 bool is_alive() const { | 3573 bool is_alive() const { |
3570 return AliveBit::decode(raw_ptr()->state_bits_); | 3574 return AliveBit::decode(raw_ptr()->state_bits_); |
3571 } | 3575 } |
3572 void set_is_alive(bool value) const; | 3576 void set_is_alive(bool value) const; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3608 | 3612 |
3609 RawArray* object_table() const { | 3613 RawArray* object_table() const { |
3610 return raw_ptr()->object_table_; | 3614 return raw_ptr()->object_table_; |
3611 } | 3615 } |
3612 void set_object_table(const Array& array) const; | 3616 void set_object_table(const Array& array) const; |
3613 | 3617 |
3614 RawArray* stackmaps() const { | 3618 RawArray* stackmaps() const { |
3615 return raw_ptr()->stackmaps_; | 3619 return raw_ptr()->stackmaps_; |
3616 } | 3620 } |
3617 void set_stackmaps(const Array& maps) const; | 3621 void set_stackmaps(const Array& maps) const; |
3618 RawStackmap* GetStackmap(uword pc, Array* stackmaps, Stackmap* map) const; | 3622 RawStackmap* GetStackmap( |
| 3623 uint32_t pc_offset, Array* stackmaps, Stackmap* map) const; |
3619 | 3624 |
3620 enum { | 3625 enum { |
3621 kSCallTableOffsetEntry = 0, | 3626 kSCallTableOffsetEntry = 0, |
3622 kSCallTableFunctionEntry = 1, | 3627 kSCallTableFunctionEntry = 1, |
3623 kSCallTableCodeEntry = 2, | 3628 kSCallTableCodeEntry = 2, |
3624 kSCallTableEntryLength = 3, | 3629 kSCallTableEntryLength = 3, |
3625 }; | 3630 }; |
3626 | 3631 |
3627 void set_static_calls_target_table(const Array& value) const; | 3632 void set_static_calls_target_table(const Array& value) const; |
3628 RawArray* static_calls_target_table() const { | 3633 RawArray* static_calls_target_table() const { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3782 intptr_t lazy_deopt_pc_offset() const { | 3787 intptr_t lazy_deopt_pc_offset() const { |
3783 return raw_ptr()->lazy_deopt_pc_offset_; | 3788 return raw_ptr()->lazy_deopt_pc_offset_; |
3784 } | 3789 } |
3785 void set_lazy_deopt_pc_offset(intptr_t pc) const { | 3790 void set_lazy_deopt_pc_offset(intptr_t pc) const { |
3786 raw_ptr()->lazy_deopt_pc_offset_ = pc; | 3791 raw_ptr()->lazy_deopt_pc_offset_ = pc; |
3787 } | 3792 } |
3788 | 3793 |
3789 private: | 3794 private: |
3790 void set_state_bits(intptr_t bits) const; | 3795 void set_state_bits(intptr_t bits) const; |
3791 | 3796 |
| 3797 friend class RawObject; // For RawObject::SizeFromClass(). |
3792 friend class RawCode; | 3798 friend class RawCode; |
3793 enum { | 3799 enum { |
3794 kOptimizedBit = 0, | 3800 kOptimizedBit = 0, |
3795 kAliveBit = 1, | 3801 kAliveBit = 1, |
| 3802 kPtrOffBit = 2, |
| 3803 kPtrOffSize = 30, |
3796 }; | 3804 }; |
3797 | 3805 |
3798 class OptimizedBit : public BitField<bool, kOptimizedBit, 1> {}; | 3806 class OptimizedBit : public BitField<bool, kOptimizedBit, 1> {}; |
3799 class AliveBit : public BitField<bool, kAliveBit, 1> {}; | 3807 class AliveBit : public BitField<bool, kAliveBit, 1> {}; |
| 3808 class PtrOffBits : public BitField<intptr_t, kPtrOffBit, kPtrOffSize> {}; |
3800 | 3809 |
3801 // An object finder visitor interface. | 3810 // An object finder visitor interface. |
3802 class FindRawCodeVisitor : public FindObjectVisitor { | 3811 class FindRawCodeVisitor : public FindObjectVisitor { |
3803 public: | 3812 public: |
3804 explicit FindRawCodeVisitor(uword pc) | 3813 explicit FindRawCodeVisitor(uword pc) |
3805 : FindObjectVisitor(Isolate::Current()), pc_(pc) { } | 3814 : FindObjectVisitor(Isolate::Current()), pc_(pc) { } |
3806 virtual ~FindRawCodeVisitor() { } | 3815 virtual ~FindRawCodeVisitor() { } |
3807 | 3816 |
3808 virtual uword filter_addr() const { return pc_; } | 3817 virtual uword filter_addr() const { return pc_; } |
3809 | 3818 |
(...skipping 10 matching lines...) Expand all Loading... |
3820 | 3829 |
3821 void set_compile_timestamp(int64_t timestamp) const { | 3830 void set_compile_timestamp(int64_t timestamp) const { |
3822 raw_ptr()->compile_timestamp_ = timestamp; | 3831 raw_ptr()->compile_timestamp_ = timestamp; |
3823 } | 3832 } |
3824 | 3833 |
3825 void set_instructions(RawInstructions* instructions) { | 3834 void set_instructions(RawInstructions* instructions) { |
3826 // RawInstructions are never allocated in New space and hence a | 3835 // RawInstructions are never allocated in New space and hence a |
3827 // store buffer update is not needed here. | 3836 // store buffer update is not needed here. |
3828 raw_ptr()->instructions_ = instructions; | 3837 raw_ptr()->instructions_ = instructions; |
3829 } | 3838 } |
| 3839 |
3830 void set_pointer_offsets_length(intptr_t value) { | 3840 void set_pointer_offsets_length(intptr_t value) { |
3831 ASSERT(value >= 0); | 3841 // The number of fixups is limited to 1-billion. |
3832 raw_ptr()->pointer_offsets_length_ = value; | 3842 ASSERT(Utils::IsUint(30, value)); |
| 3843 set_state_bits(PtrOffBits::update(value, raw_ptr()->state_bits_)); |
3833 } | 3844 } |
3834 int32_t* PointerOffsetAddrAt(int index) const { | 3845 int32_t* PointerOffsetAddrAt(int index) const { |
3835 ASSERT(index >= 0); | 3846 ASSERT(index >= 0); |
3836 ASSERT(index < pointer_offsets_length()); | 3847 ASSERT(index < pointer_offsets_length()); |
3837 // TODO(iposva): Unit test is missing for this functionality. | 3848 // TODO(iposva): Unit test is missing for this functionality. |
3838 return &raw_ptr()->data()[index]; | 3849 return &raw_ptr()->data()[index]; |
3839 } | 3850 } |
3840 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) { | 3851 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) { |
3841 *PointerOffsetAddrAt(index) = offset_in_instructions; | 3852 *PointerOffsetAddrAt(index) = offset_in_instructions; |
3842 } | 3853 } |
(...skipping 3145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6988 | 6999 |
6989 // Internal JavaScript regular expression object. | 7000 // Internal JavaScript regular expression object. |
6990 class JSRegExp : public Instance { | 7001 class JSRegExp : public Instance { |
6991 public: | 7002 public: |
6992 // Meaning of RegExType: | 7003 // Meaning of RegExType: |
6993 // kUninitialized: the type of th regexp has not been initialized yet. | 7004 // kUninitialized: the type of th regexp has not been initialized yet. |
6994 // kSimple: A simple pattern to match against, using string indexOf operation. | 7005 // kSimple: A simple pattern to match against, using string indexOf operation. |
6995 // kComplex: A complex pattern to match. | 7006 // kComplex: A complex pattern to match. |
6996 enum RegExType { | 7007 enum RegExType { |
6997 kUnitialized = 0, | 7008 kUnitialized = 0, |
6998 kSimple, | 7009 kSimple = 1, |
6999 kComplex, | 7010 kComplex = 2, |
7000 }; | 7011 }; |
7001 | 7012 |
7002 // Flags are passed to a regex object as follows: | 7013 // Flags are passed to a regex object as follows: |
7003 // 'i': ignore case, 'g': do global matches, 'm': pattern is multi line. | 7014 // 'i': ignore case, 'g': do global matches, 'm': pattern is multi line. |
7004 enum Flags { | 7015 enum Flags { |
7005 kNone = 0, | 7016 kNone = 0, |
7006 kGlobal = 1, | 7017 kGlobal = 1, |
7007 kIgnoreCase = 2, | 7018 kIgnoreCase = 2, |
7008 kMultiLine = 4, | 7019 kMultiLine = 4, |
7009 }; | 7020 }; |
7010 | 7021 |
7011 bool is_initialized() const { return (raw_ptr()->type_ != kUnitialized); } | 7022 enum { |
7012 bool is_simple() const { return (raw_ptr()->type_ == kSimple); } | 7023 kTypePos = 0, |
7013 bool is_complex() const { return (raw_ptr()->type_ == kComplex); } | 7024 kTypeSize = 2, |
| 7025 kFlagsPos = 2, |
| 7026 kFlagsSize = 4, |
| 7027 }; |
7014 | 7028 |
7015 bool is_global() const { return (raw_ptr()->flags_ & kGlobal); } | 7029 class TypeBits : public BitField<RegExType, kTypePos, kTypeSize> {}; |
7016 bool is_ignore_case() const { return (raw_ptr()->flags_ & kIgnoreCase); } | 7030 class FlagsBits : public BitField<intptr_t, kFlagsPos, kFlagsSize> {}; |
7017 bool is_multi_line() const { return (raw_ptr()->flags_ & kMultiLine); } | 7031 |
| 7032 bool is_initialized() const { return (type() != kUnitialized); } |
| 7033 bool is_simple() const { return (type() == kSimple); } |
| 7034 bool is_complex() const { return (type() == kComplex); } |
| 7035 |
| 7036 bool is_global() const { return (flags() & kGlobal); } |
| 7037 bool is_ignore_case() const { return (flags() & kIgnoreCase); } |
| 7038 bool is_multi_line() const { return (flags() & kMultiLine); } |
7018 | 7039 |
7019 RawString* pattern() const { return raw_ptr()->pattern_; } | 7040 RawString* pattern() const { return raw_ptr()->pattern_; } |
7020 RawSmi* num_bracket_expressions() const { | 7041 RawSmi* num_bracket_expressions() const { |
7021 return raw_ptr()->num_bracket_expressions_; | 7042 return raw_ptr()->num_bracket_expressions_; |
7022 } | 7043 } |
7023 | 7044 |
7024 void set_pattern(const String& pattern) const; | 7045 void set_pattern(const String& pattern) const; |
7025 void set_num_bracket_expressions(intptr_t value) const; | 7046 void set_num_bracket_expressions(intptr_t value) const; |
7026 void set_is_global() const { raw_ptr()->flags_ |= kGlobal; } | 7047 void set_is_global() const { set_flags(flags() | kGlobal); } |
7027 void set_is_ignore_case() const { raw_ptr()->flags_ |= kIgnoreCase; } | 7048 void set_is_ignore_case() const { set_flags(flags() | kIgnoreCase); } |
7028 void set_is_multi_line() const { raw_ptr()->flags_ |= kMultiLine; } | 7049 void set_is_multi_line() const { set_flags(flags() | kMultiLine); } |
7029 void set_is_simple() const { raw_ptr()->type_ = kSimple; } | 7050 void set_is_simple() const { set_type(kSimple); } |
7030 void set_is_complex() const { raw_ptr()->type_ = kComplex; } | 7051 void set_is_complex() const { set_type(kComplex); } |
7031 | 7052 |
7032 void* GetDataStartAddress() const; | 7053 void* GetDataStartAddress() const; |
7033 static RawJSRegExp* FromDataStartAddress(void* data); | 7054 static RawJSRegExp* FromDataStartAddress(void* data); |
7034 const char* Flags() const; | 7055 const char* Flags() const; |
7035 | 7056 |
7036 virtual bool CanonicalizeEquals(const Instance& other) const; | 7057 virtual bool CanonicalizeEquals(const Instance& other) const; |
7037 | 7058 |
7038 static const intptr_t kBytesPerElement = 1; | 7059 static const intptr_t kBytesPerElement = 1; |
7039 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 7060 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
7040 | 7061 |
7041 static intptr_t InstanceSize() { | 7062 static intptr_t InstanceSize() { |
7042 ASSERT(sizeof(RawJSRegExp) == OFFSET_OF_RETURNED_VALUE(RawJSRegExp, data)); | 7063 ASSERT(sizeof(RawJSRegExp) == OFFSET_OF_RETURNED_VALUE(RawJSRegExp, data)); |
7043 return 0; | 7064 return 0; |
7044 } | 7065 } |
7045 | 7066 |
7046 static intptr_t InstanceSize(intptr_t len) { | 7067 static intptr_t InstanceSize(intptr_t len) { |
7047 ASSERT(0 <= len && len <= kMaxElements); | 7068 ASSERT(0 <= len && len <= kMaxElements); |
7048 return RoundedAllocationSize( | 7069 return RoundedAllocationSize( |
7049 sizeof(RawJSRegExp) + (len * kBytesPerElement)); | 7070 sizeof(RawJSRegExp) + (len * kBytesPerElement)); |
7050 } | 7071 } |
7051 | 7072 |
7052 static RawJSRegExp* New(intptr_t length, Heap::Space space = Heap::kNew); | 7073 static RawJSRegExp* New(intptr_t length, Heap::Space space = Heap::kNew); |
7053 | 7074 |
7054 private: | 7075 private: |
7055 void set_type(RegExType type) const { raw_ptr()->type_ = type; } | 7076 void set_type(RegExType type) const { |
7056 void set_flags(intptr_t value) const { raw_ptr()->flags_ = value; } | 7077 raw_ptr()->type_flags_ = TypeBits::update(type, raw_ptr()->type_flags_); |
| 7078 } |
| 7079 void set_flags(intptr_t value) const { |
| 7080 raw_ptr()->type_flags_ = FlagsBits::update(value, raw_ptr()->type_flags_); |
| 7081 } |
| 7082 |
| 7083 RegExType type() const { |
| 7084 return TypeBits::decode(raw_ptr()->type_flags_); |
| 7085 } |
| 7086 intptr_t flags() const { |
| 7087 return FlagsBits::decode(raw_ptr()->type_flags_); |
| 7088 } |
7057 | 7089 |
7058 void SetLength(intptr_t value) const { | 7090 void SetLength(intptr_t value) const { |
7059 // This is only safe because we create a new Smi, which does not cause | 7091 // This is only safe because we create a new Smi, which does not cause |
7060 // heap allocation. | 7092 // heap allocation. |
7061 raw_ptr()->data_length_ = Smi::New(value); | 7093 raw_ptr()->data_length_ = Smi::New(value); |
7062 } | 7094 } |
7063 | 7095 |
7064 FINAL_HEAP_OBJECT_IMPLEMENTATION(JSRegExp, Instance); | 7096 FINAL_HEAP_OBJECT_IMPLEMENTATION(JSRegExp, Instance); |
7065 friend class Class; | 7097 friend class Class; |
7066 }; | 7098 }; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7309 | 7341 |
7310 | 7342 |
7311 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7343 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7312 intptr_t index) { | 7344 intptr_t index) { |
7313 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7345 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7314 } | 7346 } |
7315 | 7347 |
7316 } // namespace dart | 7348 } // namespace dart |
7317 | 7349 |
7318 #endif // VM_OBJECT_H_ | 7350 #endif // VM_OBJECT_H_ |
OLD | NEW |