Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Unified Diff: src/field-index.h

Issue 370573003: Hydrogenized KeyedLoadGeneric stub: Fix FieldIndex::GetLoadByFieldIndex() (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/field-index-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/field-index.h
diff --git a/src/field-index.h b/src/field-index.h
index b25e624736e95489ed11e618c27949bca0ce311b..096b33509f7d40dd16d7f046df897b70d511fdf5 100644
--- a/src/field-index.h
+++ b/src/field-index.h
@@ -28,6 +28,8 @@ class FieldIndex V8_FINAL {
static FieldIndex ForLoadByFieldIndex(Map* map, int index);
static FieldIndex ForKeyedLookupCacheIndex(Map* map, int index);
+ int GetLoadByFieldIndex() const;
+
bool is_inobject() const {
return IsInObjectBits::decode(bit_field_);
}
@@ -40,6 +42,7 @@ class FieldIndex V8_FINAL {
return index() * kPointerSize;
}
+ // Zero-indexed from beginning of the object.
int index() const {
return IndexBits::decode(bit_field_);
}
@@ -49,6 +52,8 @@ class FieldIndex V8_FINAL {
return index() - first_inobject_property_offset() / kPointerSize;
}
+ // Zero-based from the first inobject property. Overflows to out-of-object
+ // properties.
int property_index() const {
ASSERT(!IsHiddenField::decode(bit_field_));
int result = index() - first_inobject_property_offset() / kPointerSize;
@@ -58,21 +63,6 @@ class FieldIndex V8_FINAL {
return result;
}
- int GetLoadByFieldIndex() const {
- // For efficiency, the LoadByFieldIndex instruction takes an index that is
- // optimized for quick access. If the property is inline, the index is
- // positive. If it's out-of-line, the encoded index is -raw_index - 1 to
- // disambiguate the zero out-of-line index from the zero inobject case.
- // The index itself is shifted up by one bit, the lower-most bit
- // signifying if the field is a mutable double box (1) or not (0).
- int result = index() - first_inobject_property_offset() / kPointerSize;
- if (!is_inobject()) {
- result = -result - 1;
- }
- result <<= 1;
- return is_double() ? (result | 1) : result;
- }
-
int GetKeyedLookupCacheIndex() const;
int GetLoadFieldStubKey() const {
@@ -100,11 +90,14 @@ class FieldIndex V8_FINAL {
static const int kIndexBitsSize = kDescriptorIndexBitCount + 1;
+ // Index from beginning of object.
class IndexBits: public BitField<int, 0, kIndexBitsSize> {};
class IsInObjectBits: public BitField<bool, IndexBits::kNext, 1> {};
class IsDoubleBits: public BitField<bool, IsInObjectBits::kNext, 1> {};
+ // Number of inobject properties.
class InObjectPropertyBits: public BitField<int, IsDoubleBits::kNext,
kDescriptorIndexBitCount> {};
+ // Offset of first inobject property from beginning of object.
class FirstInobjectPropertyOffsetBits:
public BitField<int, InObjectPropertyBits::kNext, 7> {};
class IsHiddenField:
« no previous file with comments | « no previous file | src/field-index-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698