Commit 286957b4 authored by titzer@chromium.org's avatar titzer@chromium.org

Add a bit to HObjectAccess to encode immutable fields.

BUG=
R=ishell@chromium.org

Review URL: https://codereview.chromium.org/98163003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18471 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent acf24331
......@@ -5947,6 +5947,10 @@ class HObjectAccess V8_FINAL {
return name_;
}
inline bool immutable() const {
return ImmutableField::decode(value_);
}
inline HObjectAccess WithRepresentation(Representation representation) {
return HObjectAccess(portion(), offset(), representation, name());
}
......@@ -6181,22 +6185,26 @@ class HObjectAccess V8_FINAL {
HObjectAccess(Portion portion, int offset,
Representation representation = Representation::Tagged(),
Handle<String> name = Handle<String>::null())
Handle<String> name = Handle<String>::null(),
bool immutable = false)
: value_(PortionField::encode(portion) |
RepresentationField::encode(representation.kind()) |
ImmutableField::encode(immutable ? 1 : 0) |
OffsetField::encode(offset)),
name_(name) {
// assert that the fields decode correctly
ASSERT(this->offset() == offset);
ASSERT(this->portion() == portion);
ASSERT(this->immutable() == immutable);
ASSERT(RepresentationField::decode(value_) == representation.kind());
}
class PortionField : public BitField<Portion, 0, 3> {};
class RepresentationField : public BitField<Representation::Kind, 3, 4> {};
class OffsetField : public BitField<int, 7, 25> {};
class ImmutableField : public BitField<bool, 7, 1> {};
class OffsetField : public BitField<int, 8, 24> {};
uint32_t value_; // encodes portion, representation, and offset
uint32_t value_; // encodes portion, representation, immutable, and offset
Handle<String> name_;
friend class HLoadNamedField;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment