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

Unified Diff: src/property.h

Issue 14146005: Track representations of fields (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add test for tracking fields Created 7 years, 8 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 bbba8aea60d89f432c3ca4eb52b86726e56baf07..229241948a8c4ee0dc253e199bdbd1710fdb8159 100644
--- a/src/property.h
+++ b/src/property.h
@@ -65,7 +65,8 @@ class Descriptor BASE_EMBEDDED {
#endif
void SetEnumerationIndex(int index) {
- details_ = PropertyDetails(details_.attributes(), details_.type(), index);
+ details_ = PropertyDetails(details_.attributes(), details_.type(),
+ details_.representation(), index);
}
void SetSortedKeyIndex(int index) { details_ = details_.set_pointer(index); }
@@ -93,10 +94,11 @@ class Descriptor BASE_EMBEDDED {
Object* value,
PropertyAttributes attributes,
PropertyType type,
+ Representation representation,
int index)
: key_(key),
value_(value),
- details_(attributes, type, index) { }
+ details_(attributes, type, representation, index) { }
friend class DescriptorArray;
};
@@ -107,8 +109,10 @@ class FieldDescriptor: public Descriptor {
FieldDescriptor(Name* key,
int field_index,
PropertyAttributes attributes,
+ Representation representation,
int index = 0)
- : Descriptor(key, Smi::FromInt(field_index), attributes, FIELD, index) {}
+ : Descriptor(key, Smi::FromInt(field_index), attributes,
+ FIELD, representation, index) {}
};
@@ -118,7 +122,8 @@ class ConstantFunctionDescriptor: public Descriptor {
JSFunction* function,
PropertyAttributes attributes,
int index)
- : Descriptor(key, function, attributes, CONSTANT_FUNCTION, index) {}
+ : Descriptor(key, function, attributes,
+ CONSTANT_FUNCTION, Representation::Tagged(), index) {}
};
@@ -128,7 +133,8 @@ class CallbacksDescriptor: public Descriptor {
Object* foreign,
PropertyAttributes attributes,
int index = 0)
- : Descriptor(key, foreign, attributes, CALLBACKS, index) {}
+ : Descriptor(key, foreign, attributes, CALLBACKS,
+ Representation::Tagged(), index) {}
};
@@ -190,7 +196,7 @@ class LookupResult BASE_EMBEDDED {
lookup_type_(NOT_FOUND),
holder_(NULL),
cacheable_(true),
- details_(NONE, NONEXISTENT) {
+ details_(NONE, NONEXISTENT, Representation::None()) {
isolate->SetTopLookupResult(this);
}
@@ -208,9 +214,13 @@ class LookupResult BASE_EMBEDDED {
number_ = number;
}
+ bool CanHoldValue(Handle<Object> value) {
+ return value->FitsRepresentation(details_.representation());
+ }
+
void TransitionResult(JSObject* holder, int number) {
lookup_type_ = TRANSITION_TYPE;
- details_ = PropertyDetails(NONE, TRANSITION);
+ details_ = PropertyDetails(NONE, TRANSITION, Representation::None());
holder_ = holder;
number_ = number;
}
@@ -225,19 +235,19 @@ class LookupResult BASE_EMBEDDED {
void HandlerResult(JSProxy* proxy) {
lookup_type_ = HANDLER_TYPE;
holder_ = proxy;
- details_ = PropertyDetails(NONE, HANDLER);
+ details_ = PropertyDetails(NONE, HANDLER, Representation::None());
cacheable_ = false;
}
void InterceptorResult(JSObject* holder) {
lookup_type_ = INTERCEPTOR_TYPE;
holder_ = holder;
- details_ = PropertyDetails(NONE, INTERCEPTOR);
+ details_ = PropertyDetails(NONE, INTERCEPTOR, Representation::None());
}
void NotFound() {
lookup_type_ = NOT_FOUND;
- details_ = PropertyDetails(NONE, NONEXISTENT);
+ details_ = PropertyDetails(NONE, NONEXISTENT, Representation::None());
holder_ = NULL;
}
@@ -256,6 +266,11 @@ class LookupResult BASE_EMBEDDED {
return details_.type();
}
+ Representation representation() {
+ ASSERT(IsFound());
+ return details_.representation();
+ }
+
PropertyAttributes GetAttributes() {
ASSERT(!IsTransition());
ASSERT(IsFound());
« 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