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

Unified Diff: src/property.h

Issue 10626004: Cleaning up usage of lookup results. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | « src/objects.cc ('k') | src/runtime.cc » ('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 aa851f1c88a468a68f3540f2ceee56a085dc2ff8..5abc69eebbf180f68d7397ece997bbce6d015f49 100644
--- a/src/property.h
+++ b/src/property.h
@@ -189,7 +189,7 @@ class LookupResult BASE_EMBEDDED {
lookup_type_(NOT_FOUND),
holder_(NULL),
cacheable_(true),
- details_(NONE, NORMAL) {
+ details_(NONE, NONEXISTENT) {
isolate->SetTopLookupResult(this);
}
@@ -237,6 +237,7 @@ class LookupResult BASE_EMBEDDED {
void NotFound() {
lookup_type_ = NOT_FOUND;
+ details_ = PropertyDetails(NONE, NONEXISTENT);
holder_ = NULL;
}
@@ -250,6 +251,7 @@ class LookupResult BASE_EMBEDDED {
return JSProxy::cast(holder_);
}
+
PropertyType type() {
ASSERT(IsFound());
return details_.type();
@@ -264,12 +266,18 @@ class LookupResult BASE_EMBEDDED {
return details_;
}
+ bool IsFastPropertyType() { return type() != NORMAL; }
danno 2012/06/21 14:34:30 Add asserts for (IsFound());
bool IsReadOnly() { return details_.IsReadOnly(); }
+ bool IsCallbacks() { return details_.type() == CALLBACKS; }
danno 2012/06/21 14:34:30 Add asserts for (IsFound());
bool IsDontDelete() { return details_.IsDontDelete(); }
bool IsDontEnum() { return details_.IsDontEnum(); }
bool IsDeleted() { return details_.IsDeleted(); }
bool IsFound() { return lookup_type_ != NOT_FOUND; }
bool IsHandler() { return lookup_type_ == HANDLER_TYPE; }
+ bool IsInterceptor() { return lookup_type_ == INTERCEPTOR_TYPE; }
+ bool IsField() { return details_.type() == FIELD; }
danno 2012/06/21 14:34:30 Add asserts for (IsFound());
+ bool IsNormal() { return details_.type() == NORMAL; }
danno 2012/06/21 14:34:30 Add asserts for (IsFound());
+ bool IsConstantFunction() { return details_.type() == CONSTANT_FUNCTION; }
danno 2012/06/21 14:34:30 Add asserts for (IsFound());
// Is the result is a property excluding transitions and the null descriptor?
bool IsProperty() {
@@ -298,7 +306,6 @@ class LookupResult BASE_EMBEDDED {
}
}
-
Map* GetTransitionMap() {
ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
ASSERT(type() == MAP_TRANSITION ||
@@ -314,13 +321,13 @@ class LookupResult BASE_EMBEDDED {
int GetFieldIndex() {
ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
- ASSERT(type() == FIELD);
+ ASSERT(IsField());
return Descriptor::IndexFromValue(GetValue());
}
int GetLocalFieldIndexFromMap(Map* map) {
ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
- ASSERT(type() == FIELD);
+ ASSERT(IsField());
return Descriptor::IndexFromValue(
map->instance_descriptors()->GetValue(number_)) -
map->inobject_properties();
« no previous file with comments | « src/objects.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698