Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index be75faba65c0d58183868a185d7c4e6e3ff523da..4e02d6f19f819c884ccb93800122305848e00476 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -2589,6 +2589,20 @@ class DescriptorArray: public FixedArray { |
static const int kMaxNumberOfDescriptors = 1024 + 512; |
private: |
+ // An entry in a DescriptorArray, represented as an (array, index) pair. |
+ class Entry { |
+ public: |
+ inline explicit Entry(DescriptorArray* descs, int index) : |
+ descs_(descs), index_(index) { } |
+ |
+ inline PropertyType type() { return descs_->GetType(index_); } |
+ inline Object* GetCallbackObject() { return descs_->GetValue(index_); } |
+ |
+ private: |
+ DescriptorArray* descs_; |
+ int index_; |
+ }; |
+ |
// Conversion from descriptor number to array indices. |
static int ToKeyIndex(int descriptor_number) { |
return descriptor_number+kFirstIndex; |
@@ -7919,6 +7933,10 @@ class AccessorPair: public Struct { |
} |
} |
+ bool ContainsAccessor() { |
+ return IsJSAccessor(getter()) || IsJSAccessor(setter()); |
+ } |
+ |
#ifdef OBJECT_PRINT |
void AccessorPairPrint(FILE* out = stdout); |
#endif |
@@ -7931,6 +7949,15 @@ class AccessorPair: public Struct { |
static const int kSize = kSetterOffset + kPointerSize; |
private: |
+ // Strangely enough, in addition to functions and harmony proxies, the spec |
+ // requires us to consider undefined as a kind of accessor, too: |
+ // var obj = {}; |
+ // Object.defineProperty(obj, "foo", {get: undefined}); |
+ // assertTrue("foo" in obj); |
+ bool IsJSAccessor(Object* obj) { |
+ return obj->IsSpecFunction() || obj->IsUndefined(); |
+ } |
+ |
DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorPair); |
}; |