Index: src/elements.cc |
diff --git a/src/elements.cc b/src/elements.cc |
index 3d188291030ddc66ec5ffc8828d59376dd666c31..771b0b6f01ad4559f7dc0b6269f3cb07fb2841e5 100644 |
--- a/src/elements.cc |
+++ b/src/elements.cc |
@@ -564,6 +564,28 @@ 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) { |
+ if (key >= ElementsAccessorSubclass::GetCapacityImpl(backing_store)) |
Michael Starzinger
2012/11/07 19:43:50
Curly brackets around body.
rossberg
2012/11/08 11:22:56
Done.
|
+ return ABSENT; |
+ return backing_store->get(key)->IsTheHole() ? ABSENT : NONE; |
Toon Verwaest
2012/11/08 10:01:31
You can probably use is_the_hole(key) here.
rossberg
2012/11/08 11:22:56
Done.
|
+ } |
+ |
MUST_USE_RESULT virtual MaybeObject* SetLength(JSArray* array, |
Object* length) { |
return ElementsAccessorSubclass::SetLengthImpl( |
@@ -1143,6 +1165,17 @@ class ExternalElementsAccessor |
: backing_store->GetHeap()->undefined_value(); |
} |
+ |
Michael Starzinger
2012/11/07 19:54:03
Drop one of the two newlines.
rossberg
2012/11/08 11:22:56
Done.
|
+ 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 +1464,18 @@ 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) { |
+ return backing_store->DetailsAt(entry).attributes(); |
+ } |
+ return ABSENT; |
+ } |
+ |
static bool HasElementImpl(Object* receiver, |
JSObject* holder, |
uint32_t key, |
@@ -1490,6 +1535,25 @@ 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 |
Michael Starzinger
2012/11/07 19:43:50
I think we can drop all three lines of comments. I
rossberg
2012/11/08 11:22:56
Done.
|
+ // behave as FAST_ELEMENT. Non-aliased elements in a dictionary |
+ // backing store behave as DICTIONARY_ELEMENT. |
+ Object* probe = GetParameterMapArg(obj, parameter_map, key); |
+ if (!probe->IsTheHole()) { |
+ return NONE; |
+ } else { |
+ // If not aliased, check the arguments. |
+ FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); |
Toon Verwaest
2012/11/08 10:01:31
Can we use a constant here? (kArgumentsIndex or so
rossberg
2012/11/08 11:22:56
Just mirrored this after GetImpl, which does the s
|
+ return ElementsAccessor::ForArray(arguments)->GetAttributes( |
+ receiver, obj, key, arguments); |
+ } |
+ } |
+ |
MUST_USE_RESULT static MaybeObject* SetLengthImpl( |
JSObject* obj, |
Object* length, |