Index: src/elements.cc |
diff --git a/src/elements.cc b/src/elements.cc |
index 3d188291030ddc66ec5ffc8828d59376dd666c31..08b04de9d7cfec86e7534c99a34ca4db0e545af3 100644 |
--- a/src/elements.cc |
+++ b/src/elements.cc |
@@ -564,6 +564,27 @@ class ElementsAccessorBase : public ElementsAccessor { |
: backing_store->GetHeap()->the_hole_value(); |
} |
+ MUST_USE_RESULT virtual PropertyAttributes GetAttributes( |
+ Object* receiver, |
+ JSObject* holder, |
+ uint32_t key, |
+ FixedArrayBase* backing_store) { |
+ if (backing_store == NULL) { |
+ backing_store = holder->elements(); |
+ } |
+ return ElementsAccessorSubclass::GetAttributesImpl( |
+ receiver, holder, key, BackingStore::cast(backing_store)); |
+ } |
+ |
+ MUST_USE_RESULT static PropertyAttributes GetAttributesImpl( |
+ Object* receiver, |
+ JSObject* obj, |
+ uint32_t key, |
+ BackingStore* backing_store) { |
+ return (key < ElementsAccessorSubclass::GetCapacityImpl(backing_store)) |
+ ? NONE : ABSENT; |
rossberg
2012/11/07 18:41:42
That was wrong.
Michael Starzinger
2012/11/07 19:43:49
Nice catch.
|
+ } |
+ |
MUST_USE_RESULT virtual MaybeObject* SetLength(JSArray* array, |
Object* length) { |
return ElementsAccessorSubclass::SetLengthImpl( |
@@ -1143,6 +1164,17 @@ class ExternalElementsAccessor |
: backing_store->GetHeap()->undefined_value(); |
} |
+ |
+ MUST_USE_RESULT static PropertyAttributes GetAttributesImpl( |
+ Object* receiver, |
+ JSObject* obj, |
+ uint32_t key, |
+ BackingStore* backing_store) { |
+ return |
+ key < ExternalElementsAccessorSubclass::GetCapacityImpl(backing_store) |
+ ? NONE : ABSENT; |
+ } |
+ |
MUST_USE_RESULT static MaybeObject* SetLengthImpl( |
JSObject* obj, |
Object* length, |
@@ -1431,6 +1463,17 @@ class DictionaryElementsAccessor |
return obj->GetHeap()->the_hole_value(); |
} |
+ MUST_USE_RESULT static PropertyAttributes GetAttributesImpl( |
+ Object* receiver, |
+ JSObject* obj, |
+ uint32_t key, |
+ SeededNumberDictionary* backing_store) { |
+ int entry = backing_store->FindEntry(key); |
+ if (entry != SeededNumberDictionary::kNotFound) |
Michael Starzinger
2012/11/07 11:47:48
Curly brackets around body.
rossberg
2012/11/07 18:41:42
Done.
|
+ return backing_store->DetailsAt(entry).attributes(); |
+ return ABSENT; |
+ } |
+ |
static bool HasElementImpl(Object* receiver, |
JSObject* holder, |
uint32_t key, |
@@ -1490,6 +1533,29 @@ class NonStrictArgumentsElementsAccessor : public ElementsAccessorBase< |
} |
} |
+ MUST_USE_RESULT static PropertyAttributes GetAttributesImpl( |
+ Object* receiver, |
+ JSObject* obj, |
+ uint32_t key, |
+ FixedArray* parameter_map) { |
+ // Aliased parameters and non-aliased elements in a fast backing store |
+ // behave as FAST_ELEMENT. Non-aliased elements in a dictionary |
+ // backing store behave as DICTIONARY_ELEMENT. |
+ uint32_t length = parameter_map->length(); |
+ Object* probe = key < (length - 2) ? parameter_map->get(key + 2) : NULL; |
Michael Starzinger
2012/11/07 11:47:48
Better use the GetParameterMapArg() helper for tha
rossberg
2012/11/07 18:41:42
Done.
|
+ if (probe != NULL && !probe->IsTheHole()) return NONE; |
+ // If not aliased, check the arguments. |
+ FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); |
+ if (arguments->IsDictionary()) { |
Michael Starzinger
2012/11/07 11:47:48
Better delegate to the elements accessor for the u
rossberg
2012/11/07 18:41:42
Done.
|
+ SeededNumberDictionary* dictionary = |
+ SeededNumberDictionary::cast(arguments); |
+ int entry = dictionary->FindEntry(key); |
+ if (entry != SeededNumberDictionary::kNotFound) |
+ return dictionary->DetailsAt(entry).attributes(); |
+ } |
+ return ABSENT; |
+ } |
+ |
MUST_USE_RESULT static MaybeObject* SetLengthImpl( |
JSObject* obj, |
Object* length, |