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 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3005 } | 3005 } |
3006 RawArray* object_pool() const { return raw_ptr()->object_pool_; } | 3006 RawArray* object_pool() const { return raw_ptr()->object_pool_; } |
3007 static intptr_t object_pool_offset() { | 3007 static intptr_t object_pool_offset() { |
3008 return OFFSET_OF(RawInstructions, object_pool_); | 3008 return OFFSET_OF(RawInstructions, object_pool_); |
3009 } | 3009 } |
3010 | 3010 |
3011 uword EntryPoint() const { | 3011 uword EntryPoint() const { |
3012 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); | 3012 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); |
3013 } | 3013 } |
3014 | 3014 |
3015 static const intptr_t kMaxElements = (kIntptrMax - | 3015 static const intptr_t kMaxElements = (kMaxInt32 - |
3016 (sizeof(RawInstructions) + | 3016 (sizeof(RawInstructions) + |
3017 sizeof(RawObject) + | 3017 sizeof(RawObject) + |
3018 (2 * OS::kMaxPreferredCodeAlignment))); | 3018 (2 * OS::kMaxPreferredCodeAlignment))); |
3019 | 3019 |
3020 static intptr_t InstanceSize() { | 3020 static intptr_t InstanceSize() { |
3021 ASSERT(sizeof(RawInstructions) == | 3021 ASSERT(sizeof(RawInstructions) == |
3022 OFFSET_OF_RETURNED_VALUE(RawInstructions, data)); | 3022 OFFSET_OF_RETURNED_VALUE(RawInstructions, data)); |
3023 return 0; | 3023 return 0; |
3024 } | 3024 } |
3025 | 3025 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3071 RawString* GetName(intptr_t var_index) const; | 3071 RawString* GetName(intptr_t var_index) const; |
3072 | 3072 |
3073 void SetVar(intptr_t var_index, | 3073 void SetVar(intptr_t var_index, |
3074 const String& name, | 3074 const String& name, |
3075 RawLocalVarDescriptors::VarInfo* info) const; | 3075 RawLocalVarDescriptors::VarInfo* info) const; |
3076 | 3076 |
3077 void GetInfo(intptr_t var_index, RawLocalVarDescriptors::VarInfo* info) const; | 3077 void GetInfo(intptr_t var_index, RawLocalVarDescriptors::VarInfo* info) const; |
3078 | 3078 |
3079 static const intptr_t kBytesPerElement = | 3079 static const intptr_t kBytesPerElement = |
3080 sizeof(RawLocalVarDescriptors::VarInfo); | 3080 sizeof(RawLocalVarDescriptors::VarInfo); |
3081 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 3081 static const intptr_t kMaxElements = RawLocalVarDescriptors::kMaxIndex; |
3082 | 3082 |
3083 static intptr_t InstanceSize() { | 3083 static intptr_t InstanceSize() { |
3084 ASSERT(sizeof(RawLocalVarDescriptors) == | 3084 ASSERT(sizeof(RawLocalVarDescriptors) == |
3085 OFFSET_OF_RETURNED_VALUE(RawLocalVarDescriptors, data)); | 3085 OFFSET_OF_RETURNED_VALUE(RawLocalVarDescriptors, data)); |
3086 return 0; | 3086 return 0; |
3087 } | 3087 } |
3088 static intptr_t InstanceSize(intptr_t len) { | 3088 static intptr_t InstanceSize(intptr_t len) { |
3089 ASSERT(0 <= len && len <= kMaxElements); | 3089 ASSERT(0 <= len && len <= kMaxElements); |
3090 return RoundedAllocationSize( | 3090 return RoundedAllocationSize( |
3091 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement)); | 3091 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement)); |
(...skipping 26 matching lines...) Expand all Loading... |
3118 rec->set_token_pos(static_cast<int32_t>(token_pos), | 3118 rec->set_token_pos(static_cast<int32_t>(token_pos), |
3119 RecordSizeInBytes() == RawPcDescriptors::kCompressedRecSize); | 3119 RecordSizeInBytes() == RawPcDescriptors::kCompressedRecSize); |
3120 ASSERT(Utils::IsInt(16, try_index)); | 3120 ASSERT(Utils::IsInt(16, try_index)); |
3121 rec->set_try_index(try_index); | 3121 rec->set_try_index(try_index); |
3122 ASSERT(rec->try_index() == try_index); | 3122 ASSERT(rec->try_index() == try_index); |
3123 ASSERT(rec->token_pos() == token_pos); | 3123 ASSERT(rec->token_pos() == token_pos); |
3124 } | 3124 } |
3125 | 3125 |
3126 static const intptr_t kMaxBytesPerElement = | 3126 static const intptr_t kMaxBytesPerElement = |
3127 sizeof(RawPcDescriptors::PcDescriptorRec); | 3127 sizeof(RawPcDescriptors::PcDescriptorRec); |
3128 static const intptr_t kMaxElements = kSmiMax / kMaxBytesPerElement; | 3128 static const intptr_t kMaxElements = kMaxInt32 / kMaxBytesPerElement; |
3129 | 3129 |
3130 static intptr_t InstanceSize() { | 3130 static intptr_t InstanceSize() { |
3131 ASSERT(sizeof(RawPcDescriptors) == | 3131 ASSERT(sizeof(RawPcDescriptors) == |
3132 OFFSET_OF_RETURNED_VALUE(RawPcDescriptors, data)); | 3132 OFFSET_OF_RETURNED_VALUE(RawPcDescriptors, data)); |
3133 return 0; | 3133 return 0; |
3134 } | 3134 } |
3135 static intptr_t InstanceSize(intptr_t len, intptr_t record_size_in_bytes) { | 3135 static intptr_t InstanceSize(intptr_t len, intptr_t record_size_in_bytes) { |
3136 ASSERT(0 <= len && len <= kMaxElements); | 3136 ASSERT(0 <= len && len <= kMaxElements); |
3137 return RoundedAllocationSize( | 3137 return RoundedAllocationSize( |
3138 sizeof(RawPcDescriptors) + (len * record_size_in_bytes)); | 3138 sizeof(RawPcDescriptors) + (len * record_size_in_bytes)); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3246 static const intptr_t kNoMaximum = -1; | 3246 static const intptr_t kNoMaximum = -1; |
3247 static const intptr_t kNoMinimum = -1; | 3247 static const intptr_t kNoMinimum = -1; |
3248 | 3248 |
3249 bool IsObject(intptr_t index) const { | 3249 bool IsObject(intptr_t index) const { |
3250 ASSERT(InRange(index)); | 3250 ASSERT(InRange(index)); |
3251 return GetBit(index); | 3251 return GetBit(index); |
3252 } | 3252 } |
3253 | 3253 |
3254 intptr_t Length() const { return raw_ptr()->length_; } | 3254 intptr_t Length() const { return raw_ptr()->length_; } |
3255 | 3255 |
3256 uword PC() const { return raw_ptr()->pc_; } | 3256 uint32_t PcOffset() const { return raw_ptr()->pc_offset_; } |
3257 void SetPC(uword value) const { raw_ptr()->pc_ = value; } | 3257 void SetPcOffset(uint32_t value) const { |
| 3258 ASSERT(value <= kMaxUint32); |
| 3259 raw_ptr()->pc_offset_ = value; |
| 3260 } |
3258 | 3261 |
3259 intptr_t RegisterBitCount() const { return raw_ptr()->register_bit_count_; } | 3262 intptr_t RegisterBitCount() const { return raw_ptr()->register_bit_count_; } |
3260 void SetRegisterBitCount(intptr_t register_bit_count) const { | 3263 void SetRegisterBitCount(intptr_t register_bit_count) const { |
| 3264 ASSERT(register_bit_count < kMaxInt32); |
3261 raw_ptr()->register_bit_count_ = register_bit_count; | 3265 raw_ptr()->register_bit_count_ = register_bit_count; |
3262 } | 3266 } |
3263 | 3267 |
3264 static const intptr_t kMaxLengthInBytes = kSmiMax; | 3268 static const intptr_t kMaxLengthInBytes = kSmiMax; |
3265 | 3269 |
3266 static intptr_t InstanceSize() { | 3270 static intptr_t InstanceSize() { |
3267 ASSERT(sizeof(RawStackmap) == OFFSET_OF_RETURNED_VALUE(RawStackmap, data)); | 3271 ASSERT(sizeof(RawStackmap) == OFFSET_OF_RETURNED_VALUE(RawStackmap, data)); |
3268 return 0; | 3272 return 0; |
3269 } | 3273 } |
3270 static intptr_t InstanceSize(intptr_t length) { | 3274 static intptr_t InstanceSize(intptr_t length) { |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3654 }; | 3658 }; |
3655 | 3659 |
3656 | 3660 |
3657 class Code : public Object { | 3661 class Code : public Object { |
3658 public: | 3662 public: |
3659 RawInstructions* instructions() const { return raw_ptr()->instructions_; } | 3663 RawInstructions* instructions() const { return raw_ptr()->instructions_; } |
3660 static intptr_t instructions_offset() { | 3664 static intptr_t instructions_offset() { |
3661 return OFFSET_OF(RawCode, instructions_); | 3665 return OFFSET_OF(RawCode, instructions_); |
3662 } | 3666 } |
3663 intptr_t pointer_offsets_length() const { | 3667 intptr_t pointer_offsets_length() const { |
3664 return raw_ptr()->pointer_offsets_length_; | 3668 return PtrOffBits::decode(raw_ptr()->state_bits_); |
3665 } | 3669 } |
3666 | 3670 |
3667 bool is_optimized() const { | 3671 bool is_optimized() const { |
3668 return OptimizedBit::decode(raw_ptr()->state_bits_); | 3672 return OptimizedBit::decode(raw_ptr()->state_bits_); |
3669 } | 3673 } |
3670 void set_is_optimized(bool value) const; | 3674 void set_is_optimized(bool value) const; |
3671 bool is_alive() const { | 3675 bool is_alive() const { |
3672 return AliveBit::decode(raw_ptr()->state_bits_); | 3676 return AliveBit::decode(raw_ptr()->state_bits_); |
3673 } | 3677 } |
3674 void set_is_alive(bool value) const; | 3678 void set_is_alive(bool value) const; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3710 | 3714 |
3711 RawArray* object_table() const { | 3715 RawArray* object_table() const { |
3712 return raw_ptr()->object_table_; | 3716 return raw_ptr()->object_table_; |
3713 } | 3717 } |
3714 void set_object_table(const Array& array) const; | 3718 void set_object_table(const Array& array) const; |
3715 | 3719 |
3716 RawArray* stackmaps() const { | 3720 RawArray* stackmaps() const { |
3717 return raw_ptr()->stackmaps_; | 3721 return raw_ptr()->stackmaps_; |
3718 } | 3722 } |
3719 void set_stackmaps(const Array& maps) const; | 3723 void set_stackmaps(const Array& maps) const; |
3720 RawStackmap* GetStackmap(uword pc, Array* stackmaps, Stackmap* map) const; | 3724 RawStackmap* GetStackmap( |
| 3725 uint32_t pc_offset, Array* stackmaps, Stackmap* map) const; |
3721 | 3726 |
3722 enum { | 3727 enum { |
3723 kSCallTableOffsetEntry = 0, | 3728 kSCallTableOffsetEntry = 0, |
3724 kSCallTableFunctionEntry = 1, | 3729 kSCallTableFunctionEntry = 1, |
3725 kSCallTableCodeEntry = 2, | 3730 kSCallTableCodeEntry = 2, |
3726 kSCallTableEntryLength = 3, | 3731 kSCallTableEntryLength = 3, |
3727 }; | 3732 }; |
3728 | 3733 |
3729 void set_static_calls_target_table(const Array& value) const; | 3734 void set_static_calls_target_table(const Array& value) const; |
3730 RawArray* static_calls_target_table() const { | 3735 RawArray* static_calls_target_table() const { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3884 intptr_t lazy_deopt_pc_offset() const { | 3889 intptr_t lazy_deopt_pc_offset() const { |
3885 return raw_ptr()->lazy_deopt_pc_offset_; | 3890 return raw_ptr()->lazy_deopt_pc_offset_; |
3886 } | 3891 } |
3887 void set_lazy_deopt_pc_offset(intptr_t pc) const { | 3892 void set_lazy_deopt_pc_offset(intptr_t pc) const { |
3888 raw_ptr()->lazy_deopt_pc_offset_ = pc; | 3893 raw_ptr()->lazy_deopt_pc_offset_ = pc; |
3889 } | 3894 } |
3890 | 3895 |
3891 private: | 3896 private: |
3892 void set_state_bits(intptr_t bits) const; | 3897 void set_state_bits(intptr_t bits) const; |
3893 | 3898 |
| 3899 friend class RawObject; // For RawObject::SizeFromClass(). |
3894 friend class RawCode; | 3900 friend class RawCode; |
3895 enum { | 3901 enum { |
3896 kOptimizedBit = 0, | 3902 kOptimizedBit = 0, |
3897 kAliveBit = 1, | 3903 kAliveBit = 1, |
| 3904 kPtrOffBit = 2, |
| 3905 kPtrOffSize = 30, |
3898 }; | 3906 }; |
3899 | 3907 |
3900 class OptimizedBit : public BitField<bool, kOptimizedBit, 1> {}; | 3908 class OptimizedBit : public BitField<bool, kOptimizedBit, 1> {}; |
3901 class AliveBit : public BitField<bool, kAliveBit, 1> {}; | 3909 class AliveBit : public BitField<bool, kAliveBit, 1> {}; |
| 3910 class PtrOffBits : public BitField<intptr_t, kPtrOffBit, kPtrOffSize> {}; |
3902 | 3911 |
3903 // An object finder visitor interface. | 3912 // An object finder visitor interface. |
3904 class FindRawCodeVisitor : public FindObjectVisitor { | 3913 class FindRawCodeVisitor : public FindObjectVisitor { |
3905 public: | 3914 public: |
3906 explicit FindRawCodeVisitor(uword pc) | 3915 explicit FindRawCodeVisitor(uword pc) |
3907 : FindObjectVisitor(Isolate::Current()), pc_(pc) { } | 3916 : FindObjectVisitor(Isolate::Current()), pc_(pc) { } |
3908 virtual ~FindRawCodeVisitor() { } | 3917 virtual ~FindRawCodeVisitor() { } |
3909 | 3918 |
3910 virtual uword filter_addr() const { return pc_; } | 3919 virtual uword filter_addr() const { return pc_; } |
3911 | 3920 |
(...skipping 10 matching lines...) Expand all Loading... |
3922 | 3931 |
3923 void set_compile_timestamp(int64_t timestamp) const { | 3932 void set_compile_timestamp(int64_t timestamp) const { |
3924 raw_ptr()->compile_timestamp_ = timestamp; | 3933 raw_ptr()->compile_timestamp_ = timestamp; |
3925 } | 3934 } |
3926 | 3935 |
3927 void set_instructions(RawInstructions* instructions) { | 3936 void set_instructions(RawInstructions* instructions) { |
3928 // RawInstructions are never allocated in New space and hence a | 3937 // RawInstructions are never allocated in New space and hence a |
3929 // store buffer update is not needed here. | 3938 // store buffer update is not needed here. |
3930 raw_ptr()->instructions_ = instructions; | 3939 raw_ptr()->instructions_ = instructions; |
3931 } | 3940 } |
| 3941 |
3932 void set_pointer_offsets_length(intptr_t value) { | 3942 void set_pointer_offsets_length(intptr_t value) { |
3933 ASSERT(value >= 0); | 3943 // The number of fixups is limited to 1-billion. |
3934 raw_ptr()->pointer_offsets_length_ = value; | 3944 ASSERT(Utils::IsUint(30, value)); |
| 3945 set_state_bits(PtrOffBits::update(value, raw_ptr()->state_bits_)); |
3935 } | 3946 } |
3936 int32_t* PointerOffsetAddrAt(int index) const { | 3947 int32_t* PointerOffsetAddrAt(int index) const { |
3937 ASSERT(index >= 0); | 3948 ASSERT(index >= 0); |
3938 ASSERT(index < pointer_offsets_length()); | 3949 ASSERT(index < pointer_offsets_length()); |
3939 // TODO(iposva): Unit test is missing for this functionality. | 3950 // TODO(iposva): Unit test is missing for this functionality. |
3940 return &raw_ptr()->data()[index]; | 3951 return &raw_ptr()->data()[index]; |
3941 } | 3952 } |
3942 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) { | 3953 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) { |
3943 *PointerOffsetAddrAt(index) = offset_in_instructions; | 3954 *PointerOffsetAddrAt(index) = offset_in_instructions; |
3944 } | 3955 } |
(...skipping 3151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7096 | 7107 |
7097 // Internal JavaScript regular expression object. | 7108 // Internal JavaScript regular expression object. |
7098 class JSRegExp : public Instance { | 7109 class JSRegExp : public Instance { |
7099 public: | 7110 public: |
7100 // Meaning of RegExType: | 7111 // Meaning of RegExType: |
7101 // kUninitialized: the type of th regexp has not been initialized yet. | 7112 // kUninitialized: the type of th regexp has not been initialized yet. |
7102 // kSimple: A simple pattern to match against, using string indexOf operation. | 7113 // kSimple: A simple pattern to match against, using string indexOf operation. |
7103 // kComplex: A complex pattern to match. | 7114 // kComplex: A complex pattern to match. |
7104 enum RegExType { | 7115 enum RegExType { |
7105 kUnitialized = 0, | 7116 kUnitialized = 0, |
7106 kSimple, | 7117 kSimple = 1, |
7107 kComplex, | 7118 kComplex = 2, |
7108 }; | 7119 }; |
7109 | 7120 |
7110 // Flags are passed to a regex object as follows: | 7121 // Flags are passed to a regex object as follows: |
7111 // 'i': ignore case, 'g': do global matches, 'm': pattern is multi line. | 7122 // 'i': ignore case, 'g': do global matches, 'm': pattern is multi line. |
7112 enum Flags { | 7123 enum Flags { |
7113 kNone = 0, | 7124 kNone = 0, |
7114 kGlobal = 1, | 7125 kGlobal = 1, |
7115 kIgnoreCase = 2, | 7126 kIgnoreCase = 2, |
7116 kMultiLine = 4, | 7127 kMultiLine = 4, |
7117 }; | 7128 }; |
7118 | 7129 |
7119 bool is_initialized() const { return (raw_ptr()->type_ != kUnitialized); } | 7130 enum { |
7120 bool is_simple() const { return (raw_ptr()->type_ == kSimple); } | 7131 kTypePos = 0, |
7121 bool is_complex() const { return (raw_ptr()->type_ == kComplex); } | 7132 kTypeSize = 2, |
| 7133 kFlagsPos = 2, |
| 7134 kFlagsSize = 4, |
| 7135 }; |
7122 | 7136 |
7123 bool is_global() const { return (raw_ptr()->flags_ & kGlobal); } | 7137 class TypeBits : public BitField<RegExType, kTypePos, kTypeSize> {}; |
7124 bool is_ignore_case() const { return (raw_ptr()->flags_ & kIgnoreCase); } | 7138 class FlagsBits : public BitField<intptr_t, kFlagsPos, kFlagsSize> {}; |
7125 bool is_multi_line() const { return (raw_ptr()->flags_ & kMultiLine); } | 7139 |
| 7140 bool is_initialized() const { return (type() != kUnitialized); } |
| 7141 bool is_simple() const { return (type() == kSimple); } |
| 7142 bool is_complex() const { return (type() == kComplex); } |
| 7143 |
| 7144 bool is_global() const { return (flags() & kGlobal); } |
| 7145 bool is_ignore_case() const { return (flags() & kIgnoreCase); } |
| 7146 bool is_multi_line() const { return (flags() & kMultiLine); } |
7126 | 7147 |
7127 RawString* pattern() const { return raw_ptr()->pattern_; } | 7148 RawString* pattern() const { return raw_ptr()->pattern_; } |
7128 RawSmi* num_bracket_expressions() const { | 7149 RawSmi* num_bracket_expressions() const { |
7129 return raw_ptr()->num_bracket_expressions_; | 7150 return raw_ptr()->num_bracket_expressions_; |
7130 } | 7151 } |
7131 | 7152 |
7132 void set_pattern(const String& pattern) const; | 7153 void set_pattern(const String& pattern) const; |
7133 void set_num_bracket_expressions(intptr_t value) const; | 7154 void set_num_bracket_expressions(intptr_t value) const; |
7134 void set_is_global() const { raw_ptr()->flags_ |= kGlobal; } | 7155 void set_is_global() const { set_flags(flags() | kGlobal); } |
7135 void set_is_ignore_case() const { raw_ptr()->flags_ |= kIgnoreCase; } | 7156 void set_is_ignore_case() const { set_flags(flags() | kIgnoreCase); } |
7136 void set_is_multi_line() const { raw_ptr()->flags_ |= kMultiLine; } | 7157 void set_is_multi_line() const { set_flags(flags() | kMultiLine); } |
7137 void set_is_simple() const { raw_ptr()->type_ = kSimple; } | 7158 void set_is_simple() const { set_type(kSimple); } |
7138 void set_is_complex() const { raw_ptr()->type_ = kComplex; } | 7159 void set_is_complex() const { set_type(kComplex); } |
7139 | 7160 |
7140 void* GetDataStartAddress() const; | 7161 void* GetDataStartAddress() const; |
7141 static RawJSRegExp* FromDataStartAddress(void* data); | 7162 static RawJSRegExp* FromDataStartAddress(void* data); |
7142 const char* Flags() const; | 7163 const char* Flags() const; |
7143 | 7164 |
7144 virtual bool CanonicalizeEquals(const Instance& other) const; | 7165 virtual bool CanonicalizeEquals(const Instance& other) const; |
7145 | 7166 |
7146 static const intptr_t kBytesPerElement = 1; | 7167 static const intptr_t kBytesPerElement = 1; |
7147 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 7168 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
7148 | 7169 |
7149 static intptr_t InstanceSize() { | 7170 static intptr_t InstanceSize() { |
7150 ASSERT(sizeof(RawJSRegExp) == OFFSET_OF_RETURNED_VALUE(RawJSRegExp, data)); | 7171 ASSERT(sizeof(RawJSRegExp) == OFFSET_OF_RETURNED_VALUE(RawJSRegExp, data)); |
7151 return 0; | 7172 return 0; |
7152 } | 7173 } |
7153 | 7174 |
7154 static intptr_t InstanceSize(intptr_t len) { | 7175 static intptr_t InstanceSize(intptr_t len) { |
7155 ASSERT(0 <= len && len <= kMaxElements); | 7176 ASSERT(0 <= len && len <= kMaxElements); |
7156 return RoundedAllocationSize( | 7177 return RoundedAllocationSize( |
7157 sizeof(RawJSRegExp) + (len * kBytesPerElement)); | 7178 sizeof(RawJSRegExp) + (len * kBytesPerElement)); |
7158 } | 7179 } |
7159 | 7180 |
7160 static RawJSRegExp* New(intptr_t length, Heap::Space space = Heap::kNew); | 7181 static RawJSRegExp* New(intptr_t length, Heap::Space space = Heap::kNew); |
7161 | 7182 |
7162 private: | 7183 private: |
7163 void set_type(RegExType type) const { raw_ptr()->type_ = type; } | 7184 void set_type(RegExType type) const { |
7164 void set_flags(intptr_t value) const { raw_ptr()->flags_ = value; } | 7185 raw_ptr()->type_flags_ = TypeBits::update(type, raw_ptr()->type_flags_); |
| 7186 } |
| 7187 void set_flags(intptr_t value) const { |
| 7188 raw_ptr()->type_flags_ = FlagsBits::update(value, raw_ptr()->type_flags_); |
| 7189 } |
| 7190 |
| 7191 RegExType type() const { |
| 7192 return TypeBits::decode(raw_ptr()->type_flags_); |
| 7193 } |
| 7194 intptr_t flags() const { |
| 7195 return FlagsBits::decode(raw_ptr()->type_flags_); |
| 7196 } |
7165 | 7197 |
7166 void SetLength(intptr_t value) const { | 7198 void SetLength(intptr_t value) const { |
7167 // This is only safe because we create a new Smi, which does not cause | 7199 // This is only safe because we create a new Smi, which does not cause |
7168 // heap allocation. | 7200 // heap allocation. |
7169 raw_ptr()->data_length_ = Smi::New(value); | 7201 raw_ptr()->data_length_ = Smi::New(value); |
7170 } | 7202 } |
7171 | 7203 |
7172 FINAL_HEAP_OBJECT_IMPLEMENTATION(JSRegExp, Instance); | 7204 FINAL_HEAP_OBJECT_IMPLEMENTATION(JSRegExp, Instance); |
7173 friend class Class; | 7205 friend class Class; |
7174 }; | 7206 }; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7417 | 7449 |
7418 | 7450 |
7419 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7451 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7420 intptr_t index) { | 7452 intptr_t index) { |
7421 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7453 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7422 } | 7454 } |
7423 | 7455 |
7424 } // namespace dart | 7456 } // namespace dart |
7425 | 7457 |
7426 #endif // VM_OBJECT_H_ | 7458 #endif // VM_OBJECT_H_ |
OLD | NEW |