Commit eebf33a9 authored by danno@chromium.org's avatar danno@chromium.org

Consistently order receiver and holder argument in ElementAccessor.

R=jkummerow@chromium.org

Review URL: https://chromiumcodereview.appspot.com/9605006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10943 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8f0ee36d
This diff is collapsed.
......@@ -42,17 +42,32 @@ class ElementsAccessor {
virtual const char* name() const { return name_; }
virtual MaybeObject* Get(FixedArrayBase* backing_store,
uint32_t key,
// Returns true if a holder contains an element with the specified key
// without iterating up the prototype chain. The caller can optionally pass
// in the backing store to use for the check, which must be compatible with
// the ElementsKind of the ElementsAccessor. If backing_store is NULL, the
// holder->elements() is used as the backing store.
virtual bool HasElement(Object* receiver,
JSObject* holder,
uint32_t key,
FixedArrayBase* backing_store = NULL) = 0;
// Returns the element with the specified key or undefined if there is no such
// element. This method doesn't iterate up the prototype chain. The caller
// can optionally pass in the backing store to use for the check, which must
// be compatible with the ElementsKind of the ElementsAccessor. If
// backing_store is NULL, the holder->elements() is used as the backing store.
virtual MaybeObject* Get(Object* receiver,
JSObject* holder,
Object* receiver) = 0;
uint32_t key,
FixedArrayBase* backing_store = NULL) = 0;
// Modifies the length data property as specified for JSArrays and resizes the
// underlying backing store accordingly. The method honors the semantics of
// changing array sizes as defined in EcmaScript 5.1 15.4.5.2, i.e. array that
// have non-deletable elements can only be shrunk to the size of highest
// element that is non-deletable.
virtual MaybeObject* SetLength(JSObject* holder,
virtual MaybeObject* SetLength(JSArray* holder,
Object* new_length) = 0;
// Modifies both the length and capacity of a JSArray, resizing the underlying
......@@ -65,19 +80,15 @@ class ElementsAccessor {
int capacity,
int length) = 0;
// Deletes an element in an object, returning a new elements backing store.
virtual MaybeObject* Delete(JSObject* holder,
uint32_t key,
JSReceiver::DeleteMode mode) = 0;
virtual bool HasElement(FixedArrayBase* backing_store,
uint32_t key,
JSObject* holder,
Object* receiver) = 0;
virtual MaybeObject* AddElementsToFixedArray(FixedArrayBase* from,
FixedArray* to,
virtual MaybeObject* AddElementsToFixedArray(Object* receiver,
JSObject* holder,
Object* receiver) = 0;
FixedArray* to,
FixedArrayBase* from = NULL) = 0;
// Returns a shared ElementsAccessor for the specified ElementsKind.
static ElementsAccessor* ForKind(ElementsKind elements_kind) {
......
......@@ -691,10 +691,7 @@ MaybeObject* Object::GetElementWithReceiver(Object* receiver, uint32_t index) {
if (js_object->elements() != heap->empty_fixed_array()) {
MaybeObject* result = js_object->GetElementsAccessor()->Get(
js_object->elements(),
index,
js_object,
receiver);
receiver, js_object, index);
if (result != heap->the_hole_value()) return result;
}
}
......@@ -5551,7 +5548,7 @@ MaybeObject* PolymorphicCodeCacheHashTable::Put(MapHandleList* maps,
MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) {
ElementsAccessor* accessor = array->GetElementsAccessor();
MaybeObject* maybe_result =
accessor->AddElementsToFixedArray(array->elements(), this, array, array);
accessor->AddElementsToFixedArray(array, array, this);
FixedArray* result;
if (!maybe_result->To<FixedArray>(&result)) return maybe_result;
#ifdef DEBUG
......@@ -5569,7 +5566,7 @@ MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) {
MaybeObject* FixedArray::UnionOfKeys(FixedArray* other) {
ElementsAccessor* accessor = ElementsAccessor::ForArray(other);
MaybeObject* maybe_result =
accessor->AddElementsToFixedArray(other, this, NULL, NULL);
accessor->AddElementsToFixedArray(NULL, NULL, this, other);
FixedArray* result;
if (!maybe_result->To<FixedArray>(&result)) return maybe_result;
#ifdef DEBUG
......@@ -8895,7 +8892,7 @@ bool JSObject::HasElementWithInterceptor(JSReceiver* receiver, uint32_t index) {
}
if (holder_handle->GetElementsAccessor()->HasElement(
holder_handle->elements(), index, *holder_handle, *receiver_handle)) {
*receiver_handle, *holder_handle, index)) {
return true;
}
......@@ -9033,7 +9030,7 @@ bool JSObject::HasElementWithReceiver(JSReceiver* receiver, uint32_t index) {
}
ElementsAccessor* accessor = GetElementsAccessor();
if (accessor->HasElement(elements(), index, this, receiver)) {
if (accessor->HasElement(receiver, this, index)) {
return true;
}
......@@ -9894,10 +9891,9 @@ MaybeObject* JSObject::GetElementWithInterceptor(Object* receiver,
Heap* heap = holder_handle->GetHeap();
ElementsAccessor* handler = holder_handle->GetElementsAccessor();
MaybeObject* raw_result = handler->Get(holder_handle->elements(),
index,
MaybeObject* raw_result = handler->Get(*this_handle,
*holder_handle,
*this_handle);
index);
if (raw_result != heap->the_hole_value()) return raw_result;
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment