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

Unified Diff: src/property.h

Issue 15941016: Move field index into property details, freeing up the value slot of fields. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 7 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 | « src/objects-inl.h ('k') | src/property-details.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/property.h
diff --git a/src/property.h b/src/property.h
index 606f111525fb566056443bc80cc4de1a1ef79ca7..124775faec753abdb4ff680fb054565422b06544 100644
--- a/src/property.h
+++ b/src/property.h
@@ -44,10 +44,6 @@ namespace internal {
class Descriptor BASE_EMBEDDED {
public:
- static int IndexFromValue(Object* value) {
- return Smi::cast(value)->value();
- }
-
MUST_USE_RESULT MaybeObject* KeyToUniqueName() {
if (!key_->IsUniqueName()) {
MaybeObject* maybe_result = HEAP->InternalizeString(String::cast(key_));
@@ -89,10 +85,11 @@ class Descriptor BASE_EMBEDDED {
Object* value,
PropertyAttributes attributes,
PropertyType type,
- Representation representation)
+ Representation representation,
+ int field_index = 0)
: key_(key),
value_(value),
- details_(attributes, type, representation) { }
+ details_(attributes, type, representation, field_index) { }
friend class DescriptorArray;
};
@@ -104,8 +101,8 @@ class FieldDescriptor: public Descriptor {
int field_index,
PropertyAttributes attributes,
Representation representation)
- : Descriptor(key, Smi::FromInt(field_index), attributes,
- FIELD, representation) {}
+ : Descriptor(key, Smi::FromInt(0), attributes,
+ FIELD, representation, field_index) {}
};
@@ -311,7 +308,6 @@ class LookupResult BASE_EMBEDDED {
bool IsDontDelete() { return details_.IsDontDelete(); }
bool IsDontEnum() { return details_.IsDontEnum(); }
- bool IsDeleted() { return details_.IsDeleted(); }
bool IsFound() { return lookup_type_ != NOT_FOUND; }
bool IsTransition() { return lookup_type_ == TRANSITION_TYPE; }
bool IsHandler() { return lookup_type_ == HANDLER_TYPE; }
@@ -417,14 +413,12 @@ class LookupResult BASE_EMBEDDED {
PropertyIndex GetFieldIndex() {
ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
ASSERT(IsField());
- return PropertyIndex::NewFieldIndex(
- Descriptor::IndexFromValue(GetValue()));
+ return PropertyIndex::NewFieldIndex(GetFieldIndexFromMap(holder()->map()));
}
int GetLocalFieldIndexFromMap(Map* map) {
ASSERT(IsField());
- return Descriptor::IndexFromValue(GetValueFromMap(map)) -
- map->inobject_properties();
+ return GetFieldIndexFromMap(map) - map->inobject_properties();
}
int GetDictionaryEntry() {
@@ -466,6 +460,12 @@ class LookupResult BASE_EMBEDDED {
return map->instance_descriptors()->GetValue(number_);
}
+ int GetFieldIndexFromMap(Map* map) const {
+ ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
+ ASSERT(number_ < map->NumberOfOwnDescriptors());
+ return map->instance_descriptors()->GetFieldIndex(number_);
+ }
+
void Iterate(ObjectVisitor* visitor);
private:
« no previous file with comments | « src/objects-inl.h ('k') | src/property-details.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698