Index: runtime/vm/object.h |
=================================================================== |
--- runtime/vm/object.h (revision 37878) |
+++ runtime/vm/object.h (working copy) |
@@ -2952,7 +2952,7 @@ |
static const intptr_t kBytesPerElement = |
sizeof(RawLocalVarDescriptors::VarInfo); |
- static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
+ static const intptr_t kMaxElements = RawLocalVarDescriptors::kMaxIndex; |
static intptr_t InstanceSize() { |
ASSERT(sizeof(RawLocalVarDescriptors) == |
@@ -3078,8 +3078,11 @@ |
intptr_t Length() const { return raw_ptr()->length_; } |
- uword PC() const { return raw_ptr()->pc_; } |
- void SetPC(uword value) const { raw_ptr()->pc_ = value; } |
+ uword PC() const { return static_cast<uword>(raw_ptr()->pc_offset_); } |
Ivan Posva
2014/07/23 12:23:27
Unclear whether we are now storing the PC or the P
zra
2014/08/20 22:13:56
Changed to PcOffset, and SetPcOffset.
|
+ void SetPC(uword value) const { |
+ ASSERT(value <= kMaxUint32); |
+ raw_ptr()->pc_offset_ = static_cast<uint32_t>(value); |
+ } |
intptr_t RegisterBitCount() const { return raw_ptr()->register_bit_count_; } |
void SetRegisterBitCount(intptr_t register_bit_count) const { |
@@ -3480,7 +3483,7 @@ |
return OFFSET_OF(RawCode, instructions_); |
} |
intptr_t pointer_offsets_length() const { |
- return raw_ptr()->pointer_offsets_length_; |
+ return PtrOffBits::decode(raw_ptr()->state_bits_); |
} |
bool is_optimized() const { |
@@ -3714,14 +3717,18 @@ |
private: |
void set_state_bits(intptr_t bits) const; |
+ friend class RawObject; // For RawObject::SizeFromClass(). |
friend class RawCode; |
enum { |
kOptimizedBit = 0, |
kAliveBit = 1, |
+ kPtrOffBit = 2, |
+ kPtrOffSize = 30, |
}; |
class OptimizedBit : public BitField<bool, kOptimizedBit, 1> {}; |
class AliveBit : public BitField<bool, kAliveBit, 1> {}; |
+ class PtrOffBits : public BitField<intptr_t, kPtrOffBit, kPtrOffSize> {}; |
// An object finder visitor interface. |
class FindRawCodeVisitor : public FindObjectVisitor { |
@@ -3752,9 +3759,11 @@ |
// store buffer update is not needed here. |
raw_ptr()->instructions_ = instructions; |
} |
+ |
void set_pointer_offsets_length(intptr_t value) { |
- ASSERT(value >= 0); |
- raw_ptr()->pointer_offsets_length_ = value; |
+ // The number of fixups is limited to 1-billion. |
+ ASSERT(Utils::IsUint(30, value)); |
+ set_state_bits(PtrOffBits::update(value, raw_ptr()->state_bits_)); |
} |
int32_t* PointerOffsetAddrAt(int index) const { |
ASSERT(index >= 0); |
@@ -6828,8 +6837,8 @@ |
// kComplex: A complex pattern to match. |
enum RegExType { |
kUnitialized = 0, |
- kSimple, |
- kComplex, |
+ kSimple = 1, |
+ kComplex = 2, |
}; |
// Flags are passed to a regex object as follows: |
@@ -6841,14 +6850,24 @@ |
kMultiLine = 4, |
}; |
- bool is_initialized() const { return (raw_ptr()->type_ != kUnitialized); } |
- bool is_simple() const { return (raw_ptr()->type_ == kSimple); } |
- bool is_complex() const { return (raw_ptr()->type_ == kComplex); } |
+ enum { |
+ kTypePos = 0, |
+ kTypeSize = 2, |
+ kFlagsPos = 2, |
+ kFlagsSize = 4, |
+ }; |
- bool is_global() const { return (raw_ptr()->flags_ & kGlobal); } |
- bool is_ignore_case() const { return (raw_ptr()->flags_ & kIgnoreCase); } |
- bool is_multi_line() const { return (raw_ptr()->flags_ & kMultiLine); } |
+ class TypeBits : public BitField<RegExType, kTypePos, kTypeSize> {}; |
+ class FlagsBits : public BitField<intptr_t, kFlagsPos, kFlagsSize> {}; |
+ bool is_initialized() const { return (type() != kUnitialized); } |
+ bool is_simple() const { return (type() == kSimple); } |
+ bool is_complex() const { return (type() == kComplex); } |
+ |
+ bool is_global() const { return (flags() & kGlobal); } |
+ bool is_ignore_case() const { return (flags() & kIgnoreCase); } |
+ bool is_multi_line() const { return (flags() & kMultiLine); } |
+ |
RawString* pattern() const { return raw_ptr()->pattern_; } |
RawSmi* num_bracket_expressions() const { |
return raw_ptr()->num_bracket_expressions_; |
@@ -6856,11 +6875,11 @@ |
void set_pattern(const String& pattern) const; |
void set_num_bracket_expressions(intptr_t value) const; |
- void set_is_global() const { raw_ptr()->flags_ |= kGlobal; } |
- void set_is_ignore_case() const { raw_ptr()->flags_ |= kIgnoreCase; } |
- void set_is_multi_line() const { raw_ptr()->flags_ |= kMultiLine; } |
- void set_is_simple() const { raw_ptr()->type_ = kSimple; } |
- void set_is_complex() const { raw_ptr()->type_ = kComplex; } |
+ void set_is_global() const { set_flags(flags() | kGlobal); } |
+ void set_is_ignore_case() const { set_flags(flags() | kIgnoreCase); } |
+ void set_is_multi_line() const { set_flags(flags() | kMultiLine); } |
+ void set_is_simple() const { set_type(kSimple); } |
+ void set_is_complex() const { set_type(kComplex); } |
void* GetDataStartAddress() const; |
static RawJSRegExp* FromDataStartAddress(void* data); |
@@ -6885,9 +6904,20 @@ |
static RawJSRegExp* New(intptr_t length, Heap::Space space = Heap::kNew); |
private: |
- void set_type(RegExType type) const { raw_ptr()->type_ = type; } |
- void set_flags(intptr_t value) const { raw_ptr()->flags_ = value; } |
+ void set_type(RegExType type) const { |
+ raw_ptr()->type_flags_ = TypeBits::update(type, raw_ptr()->type_flags_); |
+ } |
+ void set_flags(intptr_t value) const { |
+ raw_ptr()->type_flags_ = FlagsBits::update(value, raw_ptr()->type_flags_); |
+ } |
+ RegExType type() const { |
+ return TypeBits::decode(raw_ptr()->type_flags_); |
+ } |
+ intptr_t flags() const { |
+ return FlagsBits::decode(raw_ptr()->type_flags_); |
+ } |
+ |
void SetLength(intptr_t value) const { |
// This is only safe because we create a new Smi, which does not cause |
// heap allocation. |