Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index 7d8a55e7dec15bdfde69103b84c667e3bd07d0e7..482b7944644361cd50f0728cc064b5a6dcd0e5fa 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; |
@@ -7922,6 +7936,10 @@ class AccessorPair: public Struct { |
} |
} |
+ bool ContainsAccessor() { |
+ return IsJSAccessor(getter()) || IsJSAccessor(setter()); |
+ } |
+ |
#ifdef OBJECT_PRINT |
void AccessorPairPrint(FILE* out = stdout); |
#endif |
@@ -7934,6 +7952,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); |
}; |