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

Unified Diff: src/property.h

Issue 480823004: Get rid of GetLazyValue and clients. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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/property.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 272a0a5ab9155b2cc228bd2fc2f0d3c76edeed0c..a1e8011b53aa138fb022440e457d030c44c98e9a 100644
--- a/src/property.h
+++ b/src/property.h
@@ -146,10 +146,14 @@ class LookupResult V8_FINAL BASE_EMBEDDED {
case FIELD:
return value->FitsRepresentation(representation()) &&
GetFieldType()->NowContains(value);
- case CONSTANT:
- DCHECK(GetConstant() != *value ||
+ case CONSTANT: {
+ Map* map =
+ lookup_type_ == DESCRIPTOR_TYPE ? holder_->map() : transition_;
+ Object* constant = GetConstantFromMap(map);
+ DCHECK(constant != *value ||
value->FitsRepresentation(representation()));
- return GetConstant() == *value;
+ return constant == *value;
+ }
case CALLBACKS:
case HANDLER:
case INTERCEPTOR:
@@ -262,10 +266,6 @@ class LookupResult V8_FINAL BASE_EMBEDDED {
return IsDescriptorOrDictionary() && type() == CONSTANT;
}
- bool IsConstantFunction() const {
- return IsConstant() && GetConstant()->IsJSFunction();
- }
-
bool IsDontDelete() const { return details_.IsDontDelete(); }
bool IsDontEnum() const { return details_.IsDontEnum(); }
bool IsFound() const { return lookup_type_ != NOT_FOUND; }
@@ -281,76 +281,9 @@ class LookupResult V8_FINAL BASE_EMBEDDED {
return IsFound() && !IsTransition();
}
- bool IsDataProperty() const {
- switch (lookup_type_) {
- case NOT_FOUND:
- case TRANSITION_TYPE:
- case HANDLER_TYPE:
- case INTERCEPTOR_TYPE:
- return false;
-
- case DESCRIPTOR_TYPE:
- case DICTIONARY_TYPE:
- switch (type()) {
- case FIELD:
- case NORMAL:
- case CONSTANT:
- return true;
- case CALLBACKS: {
- Object* callback = GetCallbackObject();
- DCHECK(!callback->IsForeign());
- return callback->IsAccessorInfo();
- }
- case HANDLER:
- case INTERCEPTOR:
- case NONEXISTENT:
- UNREACHABLE();
- return false;
- }
- }
- UNREACHABLE();
- return false;
- }
-
bool IsCacheable() const { return cacheable_; }
void DisallowCaching() { cacheable_ = false; }
- Object* GetLazyValue() const {
- switch (lookup_type_) {
- case NOT_FOUND:
- case TRANSITION_TYPE:
- case HANDLER_TYPE:
- case INTERCEPTOR_TYPE:
- return isolate()->heap()->the_hole_value();
-
- case DESCRIPTOR_TYPE:
- case DICTIONARY_TYPE:
- switch (type()) {
- case FIELD:
- return holder()->RawFastPropertyAt(GetFieldIndex());
- case NORMAL: {
- Object* value = holder()->property_dictionary()->ValueAt(
- GetDictionaryEntry());
- if (holder()->IsGlobalObject()) {
- value = PropertyCell::cast(value)->value();
- }
- return value;
- }
- case CONSTANT:
- return GetConstant();
- case CALLBACKS:
- return isolate()->heap()->the_hole_value();
- case HANDLER:
- case INTERCEPTOR:
- case NONEXISTENT:
- UNREACHABLE();
- return NULL;
- }
- }
- UNREACHABLE();
- return NULL;
- }
-
Map* GetTransitionTarget() const {
DCHECK(IsTransition());
return transition_;
@@ -384,42 +317,11 @@ class LookupResult V8_FINAL BASE_EMBEDDED {
return number_;
}
- JSFunction* GetConstantFunction() const {
- DCHECK(type() == CONSTANT);
- return JSFunction::cast(GetValue());
- }
-
Object* GetConstantFromMap(Map* map) const {
DCHECK(type() == CONSTANT);
return GetValueFromMap(map);
}
- JSFunction* GetConstantFunctionFromMap(Map* map) const {
- return JSFunction::cast(GetConstantFromMap(map));
- }
-
- Object* GetConstant() const {
- DCHECK(type() == CONSTANT);
- return GetValue();
- }
-
- Object* GetCallbackObject() const {
- DCHECK(!IsTransition());
- DCHECK(type() == CALLBACKS);
- return GetValue();
- }
-
- Object* GetValue() const {
- if (lookup_type_ == DESCRIPTOR_TYPE) {
- return GetValueFromMap(holder()->map());
- } else if (lookup_type_ == TRANSITION_TYPE) {
- return GetValueFromMap(transition_);
- }
- // In the dictionary case, the data is held in the value field.
- DCHECK(lookup_type_ == DICTIONARY_TYPE);
- return holder()->GetNormalizedProperty(this);
- }
-
Object* GetValueFromMap(Map* map) const {
DCHECK(lookup_type_ == DESCRIPTOR_TYPE ||
lookup_type_ == TRANSITION_TYPE);
« no previous file with comments | « src/objects.cc ('k') | src/property.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698