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}
This commit is contained in:
Toon Verwaest 2015-02-19 09:17:55 +01:00
parent 4a030e849c
commit 40b7c513c6
5 changed files with 69 additions and 93 deletions

View File

@ -666,7 +666,7 @@ BUILTIN(ArraySlice) {
bool packed = true; bool packed = true;
ElementsAccessor* accessor = ElementsAccessor::ForKind(kind); ElementsAccessor* accessor = ElementsAccessor::ForKind(kind);
for (int i = k; i < final; i++) { for (int i = k; i < final; i++) {
if (!accessor->HasElement(object, i, elms)) { if (!accessor->HasElement(*object, i, *elms)) {
packed = false; packed = false;
break; break;
} }

View File

@ -587,14 +587,14 @@ class ElementsAccessorBase : public ElementsAccessor {
ElementsAccessorSubclass::ValidateImpl(holder); ElementsAccessorSubclass::ValidateImpl(holder);
} }
static bool HasElementImpl(Handle<JSObject> holder, uint32_t key, static bool HasElementImpl(JSObject* holder, uint32_t key,
Handle<FixedArrayBase> backing_store) { FixedArrayBase* backing_store) {
return ElementsAccessorSubclass::GetAttributesImpl(holder, key, return ElementsAccessorSubclass::GetAttributesImpl(holder, key,
backing_store) != ABSENT; backing_store) != ABSENT;
} }
virtual bool HasElement(Handle<JSObject> holder, uint32_t key, virtual bool HasElement(JSObject* holder, uint32_t key,
Handle<FixedArrayBase> backing_store) FINAL { FixedArrayBase* backing_store) FINAL {
return ElementsAccessorSubclass::HasElementImpl(holder, key, backing_store); return ElementsAccessorSubclass::HasElementImpl(holder, key, backing_store);
} }
@ -620,7 +620,7 @@ class ElementsAccessorBase : public ElementsAccessor {
Handle<JSObject> obj, Handle<JSObject> obj,
uint32_t key, uint32_t key,
Handle<FixedArrayBase> backing_store) { Handle<FixedArrayBase> backing_store) {
if (key < ElementsAccessorSubclass::GetCapacityImpl(backing_store)) { if (key < ElementsAccessorSubclass::GetCapacityImpl(*backing_store)) {
return BackingStore::get(Handle<BackingStore>::cast(backing_store), key); return BackingStore::get(Handle<BackingStore>::cast(backing_store), key);
} else { } else {
return backing_store->GetIsolate()->factory()->the_hole_value(); return backing_store->GetIsolate()->factory()->the_hole_value();
@ -628,22 +628,17 @@ class ElementsAccessorBase : public ElementsAccessor {
} }
MUST_USE_RESULT virtual PropertyAttributes GetAttributes( MUST_USE_RESULT virtual PropertyAttributes GetAttributes(
Handle<JSObject> holder, uint32_t key, JSObject* holder, uint32_t key, FixedArrayBase* backing_store) FINAL {
Handle<FixedArrayBase> backing_store) FINAL {
return ElementsAccessorSubclass::GetAttributesImpl(holder, key, return ElementsAccessorSubclass::GetAttributesImpl(holder, key,
backing_store); backing_store);
} }
MUST_USE_RESULT static PropertyAttributes GetAttributesImpl( MUST_USE_RESULT static PropertyAttributes GetAttributesImpl(
Handle<JSObject> obj, JSObject* obj, uint32_t key, FixedArrayBase* backing_store) {
uint32_t key,
Handle<FixedArrayBase> backing_store) {
if (key >= ElementsAccessorSubclass::GetCapacityImpl(backing_store)) { if (key >= ElementsAccessorSubclass::GetCapacityImpl(backing_store)) {
return ABSENT; return ABSENT;
} }
return return BackingStore::cast(backing_store)->is_the_hole(key) ? ABSENT : NONE;
Handle<BackingStore>::cast(backing_store)->is_the_hole(key)
? ABSENT : NONE;
} }
MUST_USE_RESULT virtual MaybeHandle<AccessorPair> GetAccessorPair( MUST_USE_RESULT virtual MaybeHandle<AccessorPair> GetAccessorPair(
@ -751,7 +746,7 @@ class ElementsAccessorBase : public ElementsAccessor {
// Optimize if 'other' is empty. // Optimize if 'other' is empty.
// We cannot optimize if 'this' is empty, as other may have holes. // We cannot optimize if 'this' is empty, as other may have holes.
uint32_t len1 = ElementsAccessorSubclass::GetCapacityImpl(from); uint32_t len1 = ElementsAccessorSubclass::GetCapacityImpl(*from);
if (len1 == 0) return to; if (len1 == 0) return to;
Isolate* isolate = from->GetIsolate(); Isolate* isolate = from->GetIsolate();
@ -760,7 +755,7 @@ class ElementsAccessorBase : public ElementsAccessor {
uint32_t extra = 0; uint32_t extra = 0;
for (uint32_t y = 0; y < len1; y++) { for (uint32_t y = 0; y < len1; y++) {
uint32_t key = ElementsAccessorSubclass::GetKeyForIndexImpl(from, y); uint32_t key = ElementsAccessorSubclass::GetKeyForIndexImpl(from, y);
if (ElementsAccessorSubclass::HasElementImpl(holder, key, from)) { if (ElementsAccessorSubclass::HasElementImpl(*holder, key, *from)) {
Handle<Object> value; Handle<Object> value;
ASSIGN_RETURN_ON_EXCEPTION( ASSIGN_RETURN_ON_EXCEPTION(
isolate, value, isolate, value,
@ -797,7 +792,7 @@ class ElementsAccessorBase : public ElementsAccessor {
for (uint32_t y = 0; y < len1; y++) { for (uint32_t y = 0; y < len1; y++) {
uint32_t key = uint32_t key =
ElementsAccessorSubclass::GetKeyForIndexImpl(from, y); ElementsAccessorSubclass::GetKeyForIndexImpl(from, y);
if (ElementsAccessorSubclass::HasElementImpl(holder, key, from)) { if (ElementsAccessorSubclass::HasElementImpl(*holder, key, *from)) {
Handle<Object> value; Handle<Object> value;
ASSIGN_RETURN_ON_EXCEPTION( ASSIGN_RETURN_ON_EXCEPTION(
isolate, value, isolate, value,
@ -817,11 +812,11 @@ class ElementsAccessorBase : public ElementsAccessor {
} }
protected: protected:
static uint32_t GetCapacityImpl(Handle<FixedArrayBase> backing_store) { static uint32_t GetCapacityImpl(FixedArrayBase* backing_store) {
return backing_store->length(); return backing_store->length();
} }
uint32_t GetCapacity(Handle<FixedArrayBase> backing_store) FINAL { uint32_t GetCapacity(FixedArrayBase* backing_store) FINAL {
return ElementsAccessorSubclass::GetCapacityImpl(backing_store); return ElementsAccessorSubclass::GetCapacityImpl(backing_store);
} }
@ -969,14 +964,12 @@ class FastElementsAccessor
return DeleteCommon(obj, key, language_mode); return DeleteCommon(obj, key, language_mode);
} }
static bool HasElementImpl( static bool HasElementImpl(JSObject* holder, uint32_t key,
Handle<JSObject> holder, FixedArrayBase* backing_store) {
uint32_t key,
Handle<FixedArrayBase> backing_store) {
if (key >= static_cast<uint32_t>(backing_store->length())) { if (key >= static_cast<uint32_t>(backing_store->length())) {
return false; return false;
} }
return !Handle<BackingStore>::cast(backing_store)->is_the_hole(key); return !BackingStore::cast(backing_store)->is_the_hole(key);
} }
static void ValidateContents(Handle<JSObject> holder, int length) { static void ValidateContents(Handle<JSObject> holder, int length) {
@ -1260,7 +1253,7 @@ class TypedElementsAccessor
Handle<JSObject> obj, Handle<JSObject> obj,
uint32_t key, uint32_t key,
Handle<FixedArrayBase> backing_store) { Handle<FixedArrayBase> backing_store) {
if (key < AccessorClass::GetCapacityImpl(backing_store)) { if (key < AccessorClass::GetCapacityImpl(*backing_store)) {
return BackingStore::get(Handle<BackingStore>::cast(backing_store), key); return BackingStore::get(Handle<BackingStore>::cast(backing_store), key);
} else { } else {
return backing_store->GetIsolate()->factory()->undefined_value(); return backing_store->GetIsolate()->factory()->undefined_value();
@ -1268,9 +1261,7 @@ class TypedElementsAccessor
} }
MUST_USE_RESULT static PropertyAttributes GetAttributesImpl( MUST_USE_RESULT static PropertyAttributes GetAttributesImpl(
Handle<JSObject> obj, JSObject* obj, uint32_t key, FixedArrayBase* backing_store) {
uint32_t key,
Handle<FixedArrayBase> backing_store) {
return return
key < AccessorClass::GetCapacityImpl(backing_store) key < AccessorClass::GetCapacityImpl(backing_store)
? NONE : ABSENT; ? NONE : ABSENT;
@ -1291,8 +1282,8 @@ class TypedElementsAccessor
return obj->GetIsolate()->factory()->true_value(); return obj->GetIsolate()->factory()->true_value();
} }
static bool HasElementImpl(Handle<JSObject> holder, uint32_t key, static bool HasElementImpl(JSObject* holder, uint32_t key,
Handle<FixedArrayBase> backing_store) { FixedArrayBase* backing_store) {
uint32_t capacity = uint32_t capacity =
AccessorClass::GetCapacityImpl(backing_store); AccessorClass::GetCapacityImpl(backing_store);
return key < capacity; return key < capacity;
@ -1461,11 +1452,9 @@ class DictionaryElementsAccessor
} }
MUST_USE_RESULT static PropertyAttributes GetAttributesImpl( MUST_USE_RESULT static PropertyAttributes GetAttributesImpl(
Handle<JSObject> obj, JSObject* obj, uint32_t key, FixedArrayBase* backing_store) {
uint32_t key, SeededNumberDictionary* dictionary =
Handle<FixedArrayBase> backing_store) { SeededNumberDictionary::cast(backing_store);
Handle<SeededNumberDictionary> dictionary =
Handle<SeededNumberDictionary>::cast(backing_store);
int entry = dictionary->FindEntry(key); int entry = dictionary->FindEntry(key);
if (entry != SeededNumberDictionary::kNotFound) { if (entry != SeededNumberDictionary::kNotFound) {
return dictionary->DetailsAt(entry).attributes(); return dictionary->DetailsAt(entry).attributes();
@ -1488,10 +1477,9 @@ class DictionaryElementsAccessor
return MaybeHandle<AccessorPair>(); return MaybeHandle<AccessorPair>();
} }
static bool HasElementImpl(Handle<JSObject> holder, uint32_t key, static bool HasElementImpl(JSObject* holder, uint32_t key,
Handle<FixedArrayBase> store) { FixedArrayBase* store) {
Handle<SeededNumberDictionary> backing_store = SeededNumberDictionary* backing_store = SeededNumberDictionary::cast(store);
Handle<SeededNumberDictionary>::cast(store);
return backing_store->FindEntry(key) != SeededNumberDictionary::kNotFound; return backing_store->FindEntry(key) != SeededNumberDictionary::kNotFound;
} }
@ -1526,11 +1514,11 @@ class SloppyArgumentsElementsAccessor : public ElementsAccessorBase<
Handle<FixedArrayBase> parameters) { Handle<FixedArrayBase> parameters) {
Isolate* isolate = obj->GetIsolate(); Isolate* isolate = obj->GetIsolate();
Handle<FixedArray> parameter_map = Handle<FixedArray>::cast(parameters); Handle<FixedArray> parameter_map = Handle<FixedArray>::cast(parameters);
Handle<Object> probe = GetParameterMapArg(obj, parameter_map, key); Object* probe = GetParameterMapArg(*obj, *parameter_map, key);
if (!probe->IsTheHole()) { if (!probe->IsTheHole()) {
DisallowHeapAllocation no_gc; DisallowHeapAllocation no_gc;
Context* context = Context::cast(parameter_map->get(0)); Context* context = Context::cast(parameter_map->get(0));
int context_index = Handle<Smi>::cast(probe)->value(); int context_index = Smi::cast(probe)->value();
DCHECK(!context->get(context_index)->IsTheHole()); DCHECK(!context->get(context_index)->IsTheHole());
return handle(context->get(context_index), isolate); return handle(context->get(context_index), isolate);
} else { } else {
@ -1538,10 +1526,9 @@ class SloppyArgumentsElementsAccessor : public ElementsAccessorBase<
Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1)), Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1)),
isolate); isolate);
Handle<Object> result; Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION( ASSIGN_RETURN_ON_EXCEPTION(isolate, result,
isolate, result, ElementsAccessor::ForArray(*arguments)
ElementsAccessor::ForArray(arguments)->Get( ->Get(receiver, obj, key, arguments),
receiver, obj, key, arguments),
Object); Object);
// Elements of the arguments object in slow mode might be slow aliases. // Elements of the arguments object in slow mode might be slow aliases.
if (result->IsAliasedArgumentsEntry()) { if (result->IsAliasedArgumentsEntry()) {
@ -1558,16 +1545,14 @@ class SloppyArgumentsElementsAccessor : public ElementsAccessorBase<
} }
MUST_USE_RESULT static PropertyAttributes GetAttributesImpl( MUST_USE_RESULT static PropertyAttributes GetAttributesImpl(
Handle<JSObject> obj, JSObject* obj, uint32_t key, FixedArrayBase* backing_store) {
uint32_t key, FixedArray* parameter_map = FixedArray::cast(backing_store);
Handle<FixedArrayBase> backing_store) { Object* probe = GetParameterMapArg(obj, parameter_map, key);
Handle<FixedArray> parameter_map = Handle<FixedArray>::cast(backing_store);
Handle<Object> probe = GetParameterMapArg(obj, parameter_map, key);
if (!probe->IsTheHole()) { if (!probe->IsTheHole()) {
return NONE; return NONE;
} else { } else {
// If not aliased, check the arguments. // If not aliased, check the arguments.
Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1))); FixedArray* arguments = FixedArray::cast(parameter_map->get(1));
return ElementsAccessor::ForArray(arguments) return ElementsAccessor::ForArray(arguments)
->GetAttributes(obj, key, arguments); ->GetAttributes(obj, key, arguments);
} }
@ -1578,13 +1563,13 @@ class SloppyArgumentsElementsAccessor : public ElementsAccessorBase<
uint32_t key, uint32_t key,
Handle<FixedArrayBase> parameters) { Handle<FixedArrayBase> parameters) {
Handle<FixedArray> parameter_map = Handle<FixedArray>::cast(parameters); Handle<FixedArray> parameter_map = Handle<FixedArray>::cast(parameters);
Handle<Object> probe = GetParameterMapArg(obj, parameter_map, key); Object* probe = GetParameterMapArg(*obj, *parameter_map, key);
if (!probe->IsTheHole()) { if (!probe->IsTheHole()) {
return MaybeHandle<AccessorPair>(); return MaybeHandle<AccessorPair>();
} else { } else {
// If not aliased, check the arguments. // If not aliased, check the arguments.
Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1))); Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1)));
return ElementsAccessor::ForArray(arguments) return ElementsAccessor::ForArray(*arguments)
->GetAccessorPair(obj, key, arguments); ->GetAccessorPair(obj, key, arguments);
} }
} }
@ -1603,7 +1588,8 @@ class SloppyArgumentsElementsAccessor : public ElementsAccessorBase<
Handle<JSObject> obj, uint32_t key, LanguageMode language_mode) FINAL { Handle<JSObject> obj, uint32_t key, LanguageMode language_mode) FINAL {
Isolate* isolate = obj->GetIsolate(); Isolate* isolate = obj->GetIsolate();
Handle<FixedArray> parameter_map(FixedArray::cast(obj->elements())); Handle<FixedArray> parameter_map(FixedArray::cast(obj->elements()));
Handle<Object> probe = GetParameterMapArg(obj, parameter_map, key); Handle<Object> probe(GetParameterMapArg(*obj, *parameter_map, key),
isolate);
if (!probe->IsTheHole()) { if (!probe->IsTheHole()) {
// TODO(kmillikin): We could check if this was the last aliased // TODO(kmillikin): We could check if this was the last aliased
// parameter, and revert to normal elements in that case. That // parameter, and revert to normal elements in that case. That
@ -1632,10 +1618,9 @@ class SloppyArgumentsElementsAccessor : public ElementsAccessorBase<
UNREACHABLE(); UNREACHABLE();
} }
static uint32_t GetCapacityImpl(Handle<FixedArrayBase> backing_store) { static uint32_t GetCapacityImpl(FixedArrayBase* backing_store) {
Handle<FixedArray> parameter_map = Handle<FixedArray>::cast(backing_store); FixedArray* parameter_map = FixedArray::cast(backing_store);
Handle<FixedArrayBase> arguments( FixedArrayBase* arguments = FixedArrayBase::cast(parameter_map->get(1));
FixedArrayBase::cast(parameter_map->get(1)));
return Max(static_cast<uint32_t>(parameter_map->length() - 2), return Max(static_cast<uint32_t>(parameter_map->length() - 2),
ForArray(arguments)->GetCapacity(arguments)); ForArray(arguments)->GetCapacity(arguments));
} }
@ -1646,22 +1631,20 @@ class SloppyArgumentsElementsAccessor : public ElementsAccessorBase<
} }
private: private:
static Handle<Object> GetParameterMapArg(Handle<JSObject> holder, static Object* GetParameterMapArg(JSObject* holder, FixedArray* parameter_map,
Handle<FixedArray> parameter_map,
uint32_t key) { uint32_t key) {
Isolate* isolate = holder->GetIsolate(); Isolate* isolate = holder->GetIsolate();
uint32_t length = holder->IsJSArray() uint32_t length = holder->IsJSArray()
? Smi::cast(Handle<JSArray>::cast(holder)->length())->value() ? Smi::cast(JSArray::cast(holder)->length())->value()
: parameter_map->length(); : parameter_map->length();
return key < (length - 2) return key < (length - 2) ? parameter_map->get(key + 2)
? handle(parameter_map->get(key + 2), isolate) : isolate->heap()->the_hole_value();
: Handle<Object>::cast(isolate->factory()->the_hole_value());
} }
}; };
ElementsAccessor* ElementsAccessor::ForArray(Handle<FixedArrayBase> array) { ElementsAccessor* ElementsAccessor::ForArray(FixedArrayBase* array) {
return elements_accessors_[ElementsKindForArray(*array)]; return elements_accessors_[ElementsKindForArray(array)];
} }

View File

@ -32,15 +32,11 @@ class ElementsAccessor {
// in the backing store to use for the check, which must be compatible with // 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 // the ElementsKind of the ElementsAccessor. If backing_store is NULL, the
// holder->elements() is used as the backing store. // holder->elements() is used as the backing store.
virtual bool HasElement( virtual bool HasElement(JSObject* holder, uint32_t key,
Handle<JSObject> holder, FixedArrayBase* backing_store) = 0;
uint32_t key,
Handle<FixedArrayBase> backing_store) = 0;
inline bool HasElement( inline bool HasElement(JSObject* holder, uint32_t key) {
Handle<JSObject> holder, return HasElement(holder, key, holder->elements());
uint32_t key) {
return HasElement(holder, key, handle(holder->elements()));
} }
// Returns the element with the specified key or undefined if there is no such // 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 // be compatible with the ElementsKind of the ElementsAccessor. If
// backing_store is NULL, the holder->elements() is used as the backing store. // backing_store is NULL, the holder->elements() is used as the backing store.
MUST_USE_RESULT virtual PropertyAttributes GetAttributes( MUST_USE_RESULT virtual PropertyAttributes GetAttributes(
Handle<JSObject> holder, JSObject* holder, uint32_t key, FixedArrayBase* backing_store) = 0;
uint32_t key,
Handle<FixedArrayBase> backing_store) = 0;
MUST_USE_RESULT inline PropertyAttributes GetAttributes( MUST_USE_RESULT inline PropertyAttributes GetAttributes(JSObject* holder,
Handle<JSObject> holder,
uint32_t key) { uint32_t key) {
return GetAttributes(holder, key, handle(holder->elements())); return GetAttributes(holder, key, holder->elements());
} }
// Returns an element's accessors, or NULL if the element does not exist or // 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]; return elements_accessors_[elements_kind];
} }
static ElementsAccessor* ForArray(Handle<FixedArrayBase> array); static ElementsAccessor* ForArray(FixedArrayBase* array);
static void InitializeOncePerProcess(); static void InitializeOncePerProcess();
static void TearDown(); static void TearDown();
@ -183,7 +176,7 @@ class ElementsAccessor {
protected: protected:
friend class SloppyArgumentsElementsAccessor; 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 // Element handlers distinguish between indexes and keys when they manipulate
// elements. Indexes refer to elements in terms of their location in the // elements. Indexes refer to elements in terms of their location in the

View File

@ -731,7 +731,7 @@ MaybeHandle<Object> Object::SetElementWithReceiver(
if (!done && if (!done &&
js_object->elements() != isolate->heap()->empty_fixed_array()) { js_object->elements() != isolate->heap()->empty_fixed_array()) {
ElementsAccessor* accessor = js_object->GetElementsAccessor(); ElementsAccessor* accessor = js_object->GetElementsAccessor();
PropertyAttributes attrs = accessor->GetAttributes(js_object, index); PropertyAttributes attrs = accessor->GetAttributes(*js_object, index);
if ((attrs & READ_ONLY) != 0) { if ((attrs & READ_ONLY) != 0) {
return WriteToReadOnlyElement(isolate, receiver, index, value, return WriteToReadOnlyElement(isolate, receiver, index, value,
language_mode); language_mode);
@ -752,7 +752,7 @@ MaybeHandle<Object> Object::SetElementWithReceiver(
} }
Handle<JSObject> target = Handle<JSObject>::cast(receiver); Handle<JSObject> target = Handle<JSObject>::cast(receiver);
ElementsAccessor* accessor = target->GetElementsAccessor(); ElementsAccessor* accessor = target->GetElementsAccessor();
PropertyAttributes attrs = accessor->GetAttributes(target, index); PropertyAttributes attrs = accessor->GetAttributes(*target, index);
if ((attrs & READ_ONLY) != 0) { if ((attrs & READ_ONLY) != 0) {
return WriteToReadOnlyElement(isolate, receiver, index, value, return WriteToReadOnlyElement(isolate, receiver, index, value,
language_mode); language_mode);
@ -4371,7 +4371,7 @@ Maybe<PropertyAttributes> JSObject::GetElementAttributeWithoutInterceptor(
Handle<JSObject> object, Handle<JSReceiver> receiver, uint32_t index, Handle<JSObject> object, Handle<JSReceiver> receiver, uint32_t index,
bool check_prototype) { bool check_prototype) {
PropertyAttributes attr = PropertyAttributes attr =
object->GetElementsAccessor()->GetAttributes(object, index); object->GetElementsAccessor()->GetAttributes(*object, index);
if (attr != ABSENT) return maybe(attr); if (attr != ABSENT) return maybe(attr);
// Handle [] on String objects. // Handle [] on String objects.
@ -8254,7 +8254,7 @@ MaybeHandle<FixedArray> FixedArray::AddKeysFromArrayLike(
MaybeHandle<FixedArray> FixedArray::UnionOfKeys(Handle<FixedArray> first, MaybeHandle<FixedArray> FixedArray::UnionOfKeys(Handle<FixedArray> first,
Handle<FixedArray> second) { Handle<FixedArray> second) {
ElementsAccessor* accessor = ElementsAccessor::ForArray(second); ElementsAccessor* accessor = ElementsAccessor::ForArray(*second);
Handle<FixedArray> result; Handle<FixedArray> result;
ASSIGN_RETURN_ON_EXCEPTION( ASSIGN_RETURN_ON_EXCEPTION(
first->GetIsolate(), result, first->GetIsolate(), result,

View File

@ -420,7 +420,7 @@ static void CollectElementIndices(Handle<JSObject> object, uint32_t range,
uint32_t length = static_cast<uint32_t>(DoubleToInt32(length_num)); uint32_t length = static_cast<uint32_t>(DoubleToInt32(length_num));
ElementsAccessor* accessor = object->GetElementsAccessor(); ElementsAccessor* accessor = object->GetElementsAccessor();
for (uint32_t i = 0; i < length; i++) { for (uint32_t i = 0; i < length; i++) {
if (accessor->HasElement(object, i)) { if (accessor->HasElement(*object, i)) {
indices->Add(i); indices->Add(i);
} }
} }
@ -687,7 +687,7 @@ static bool IterateElements(Isolate* isolate, Handle<JSObject> receiver,
ElementsAccessor* accessor = receiver->GetElementsAccessor(); ElementsAccessor* accessor = receiver->GetElementsAccessor();
for (uint32_t index = 0; index < length; index++) { for (uint32_t index = 0; index < length; index++) {
HandleScope loop_scope(isolate); HandleScope loop_scope(isolate);
if (accessor->HasElement(receiver, index)) { if (accessor->HasElement(*receiver, index)) {
Handle<Object> element; Handle<Object> element;
ASSIGN_RETURN_ON_EXCEPTION_VALUE( ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, element, accessor->Get(receiver, receiver, index), isolate, element, accessor->Get(receiver, receiver, index),
@ -979,7 +979,7 @@ RUNTIME_FUNCTION(Runtime_EstimateNumberOfElements) {
ElementsAccessor* accessor = array->GetElementsAccessor(); ElementsAccessor* accessor = array->GetElementsAccessor();
int holes = 0; int holes = 0;
for (int i = 0; i < length; i += increment) { for (int i = 0; i < length; i += increment) {
if (!accessor->HasElement(array, i, elements)) { if (!accessor->HasElement(*array, i, *elements)) {
++holes; ++holes;
} }
} }