Commit 40b7c513 authored by Toon Verwaest's avatar Toon Verwaest

Remove handle wrappers from basic elements accessors

BUG=
R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/934173004

Cr-Commit-Position: refs/heads/master@{#26736}
parent 4a030e84
......@@ -666,7 +666,7 @@ BUILTIN(ArraySlice) {
bool packed = true;
ElementsAccessor* accessor = ElementsAccessor::ForKind(kind);
for (int i = k; i < final; i++) {
if (!accessor->HasElement(object, i, elms)) {
if (!accessor->HasElement(*object, i, *elms)) {
packed = false;
break;
}
......
This diff is collapsed.
......@@ -32,15 +32,11 @@ class ElementsAccessor {
// 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(
Handle<JSObject> holder,
uint32_t key,
Handle<FixedArrayBase> backing_store) = 0;
virtual bool HasElement(JSObject* holder, uint32_t key,
FixedArrayBase* backing_store) = 0;
inline bool HasElement(
Handle<JSObject> holder,
uint32_t key) {
return HasElement(holder, key, handle(holder->elements()));
inline bool HasElement(JSObject* holder, uint32_t key) {
return HasElement(holder, key, holder->elements());
}
// Returns the element with the specified key or undefined if there is no such
......@@ -67,14 +63,11 @@ class ElementsAccessor {
// be compatible with the ElementsKind of the ElementsAccessor. If
// backing_store is NULL, the holder->elements() is used as the backing store.
MUST_USE_RESULT virtual PropertyAttributes GetAttributes(
Handle<JSObject> holder,
uint32_t key,
Handle<FixedArrayBase> backing_store) = 0;
JSObject* holder, uint32_t key, FixedArrayBase* backing_store) = 0;
MUST_USE_RESULT inline PropertyAttributes GetAttributes(
Handle<JSObject> holder,
uint32_t key) {
return GetAttributes(holder, key, handle(holder->elements()));
MUST_USE_RESULT inline PropertyAttributes GetAttributes(JSObject* holder,
uint32_t key) {
return GetAttributes(holder, key, holder->elements());
}
// Returns an element's accessors, or NULL if the element does not exist or
......@@ -175,7 +168,7 @@ class ElementsAccessor {
return elements_accessors_[elements_kind];
}
static ElementsAccessor* ForArray(Handle<FixedArrayBase> array);
static ElementsAccessor* ForArray(FixedArrayBase* array);
static void InitializeOncePerProcess();
static void TearDown();
......@@ -183,7 +176,7 @@ class ElementsAccessor {
protected:
friend class SloppyArgumentsElementsAccessor;
virtual uint32_t GetCapacity(Handle<FixedArrayBase> backing_store) = 0;
virtual uint32_t GetCapacity(FixedArrayBase* backing_store) = 0;
// Element handlers distinguish between indexes and keys when they manipulate
// elements. Indexes refer to elements in terms of their location in the
......
......@@ -731,7 +731,7 @@ MaybeHandle<Object> Object::SetElementWithReceiver(
if (!done &&
js_object->elements() != isolate->heap()->empty_fixed_array()) {
ElementsAccessor* accessor = js_object->GetElementsAccessor();
PropertyAttributes attrs = accessor->GetAttributes(js_object, index);
PropertyAttributes attrs = accessor->GetAttributes(*js_object, index);
if ((attrs & READ_ONLY) != 0) {
return WriteToReadOnlyElement(isolate, receiver, index, value,
language_mode);
......@@ -752,7 +752,7 @@ MaybeHandle<Object> Object::SetElementWithReceiver(
}
Handle<JSObject> target = Handle<JSObject>::cast(receiver);
ElementsAccessor* accessor = target->GetElementsAccessor();
PropertyAttributes attrs = accessor->GetAttributes(target, index);
PropertyAttributes attrs = accessor->GetAttributes(*target, index);
if ((attrs & READ_ONLY) != 0) {
return WriteToReadOnlyElement(isolate, receiver, index, value,
language_mode);
......@@ -4371,7 +4371,7 @@ Maybe<PropertyAttributes> JSObject::GetElementAttributeWithoutInterceptor(
Handle<JSObject> object, Handle<JSReceiver> receiver, uint32_t index,
bool check_prototype) {
PropertyAttributes attr =
object->GetElementsAccessor()->GetAttributes(object, index);
object->GetElementsAccessor()->GetAttributes(*object, index);
if (attr != ABSENT) return maybe(attr);
// Handle [] on String objects.
......@@ -8254,7 +8254,7 @@ MaybeHandle<FixedArray> FixedArray::AddKeysFromArrayLike(
MaybeHandle<FixedArray> FixedArray::UnionOfKeys(Handle<FixedArray> first,
Handle<FixedArray> second) {
ElementsAccessor* accessor = ElementsAccessor::ForArray(second);
ElementsAccessor* accessor = ElementsAccessor::ForArray(*second);
Handle<FixedArray> result;
ASSIGN_RETURN_ON_EXCEPTION(
first->GetIsolate(), result,
......
......@@ -420,7 +420,7 @@ static void CollectElementIndices(Handle<JSObject> object, uint32_t range,
uint32_t length = static_cast<uint32_t>(DoubleToInt32(length_num));
ElementsAccessor* accessor = object->GetElementsAccessor();
for (uint32_t i = 0; i < length; i++) {
if (accessor->HasElement(object, i)) {
if (accessor->HasElement(*object, i)) {
indices->Add(i);
}
}
......@@ -687,7 +687,7 @@ static bool IterateElements(Isolate* isolate, Handle<JSObject> receiver,
ElementsAccessor* accessor = receiver->GetElementsAccessor();
for (uint32_t index = 0; index < length; index++) {
HandleScope loop_scope(isolate);
if (accessor->HasElement(receiver, index)) {
if (accessor->HasElement(*receiver, index)) {
Handle<Object> element;
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, element, accessor->Get(receiver, receiver, index),
......@@ -979,7 +979,7 @@ RUNTIME_FUNCTION(Runtime_EstimateNumberOfElements) {
ElementsAccessor* accessor = array->GetElementsAccessor();
int holes = 0;
for (int i = 0; i < length; i += increment) {
if (!accessor->HasElement(array, i, elements)) {
if (!accessor->HasElement(*array, i, *elements)) {
++holes;
}
}
......
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