[explicit isolates] Fix up src/elements.cc
Pipe through Isolate into several elements.cc functions, to avoid using HeapObject::GetIsolate. In some cases, uses ReadOnlyObject::GetIsolate which is allowed. (Autogenerated using Leszek's clang-bubble-getisolate) Bug: v8:7786 Change-Id: Idcbfaadf95c3c2b96d03b606da5594774bac2f7e Reviewed-on: https://chromium-review.googlesource.com/1107706 Reviewed-by: Toon Verwaest <verwaest@chromium.org> Commit-Queue: Dan Elphick <delphick@chromium.org> Cr-Commit-Position: refs/heads/master@{#53932}
This commit is contained in:
parent
aa6f40d25b
commit
087aa1a53c
@ -633,7 +633,8 @@ void ArrayLiteral::BuildConstantElements(Isolate* isolate) {
|
||||
elements = isolate->factory()->NewFixedDoubleArray(constants_length);
|
||||
// We are copying from non-fast-double to fast-double.
|
||||
ElementsKind from_kind = TERMINAL_FAST_ELEMENTS_KIND;
|
||||
accessor->CopyElements(fixed_array, from_kind, elements, constants_length);
|
||||
accessor->CopyElements(isolate, fixed_array, from_kind, elements,
|
||||
constants_length);
|
||||
}
|
||||
|
||||
// Remember both the literal's constant values as well as the ElementsKind.
|
||||
|
205
src/elements.cc
205
src/elements.cc
@ -125,12 +125,11 @@ WriteBarrierMode GetWriteBarrierMode(ElementsKind kind) {
|
||||
return UPDATE_WRITE_BARRIER;
|
||||
}
|
||||
|
||||
void CopyObjectToObjectElements(FixedArrayBase* from_base,
|
||||
void CopyObjectToObjectElements(Isolate* isolate, FixedArrayBase* from_base,
|
||||
ElementsKind from_kind, uint32_t from_start,
|
||||
FixedArrayBase* to_base, ElementsKind to_kind,
|
||||
uint32_t to_start, int raw_copy_size) {
|
||||
DCHECK(to_base->map() !=
|
||||
from_base->GetIsolate()->heap()->fixed_cow_array_map());
|
||||
DCHECK(to_base->map() != isolate->heap()->fixed_cow_array_map());
|
||||
DisallowHeapAllocation no_allocation;
|
||||
int copy_size = raw_copy_size;
|
||||
if (raw_copy_size < 0) {
|
||||
@ -166,10 +165,10 @@ void CopyObjectToObjectElements(FixedArrayBase* from_base,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void CopyDictionaryToObjectElements(
|
||||
FixedArrayBase* from_base, uint32_t from_start, FixedArrayBase* to_base,
|
||||
ElementsKind to_kind, uint32_t to_start, int raw_copy_size) {
|
||||
Isolate* isolate, FixedArrayBase* from_base, uint32_t from_start,
|
||||
FixedArrayBase* to_base, ElementsKind to_kind, uint32_t to_start,
|
||||
int raw_copy_size) {
|
||||
DisallowHeapAllocation no_allocation;
|
||||
NumberDictionary* from = NumberDictionary::cast(from_base);
|
||||
int copy_size = raw_copy_size;
|
||||
@ -196,7 +195,6 @@ static void CopyDictionaryToObjectElements(
|
||||
copy_size = to_length - to_start;
|
||||
}
|
||||
WriteBarrierMode write_barrier_mode = GetWriteBarrierMode(to_kind);
|
||||
Isolate* isolate = from->GetIsolate();
|
||||
for (int i = 0; i < copy_size; i++) {
|
||||
int entry = from->FindEntry(isolate, i + from_start);
|
||||
if (entry != NumberDictionary::kNotFound) {
|
||||
@ -213,7 +211,8 @@ static void CopyDictionaryToObjectElements(
|
||||
// NOTE: this method violates the handlified function signature convention:
|
||||
// raw pointer parameters in the function that allocates.
|
||||
// See ElementsAccessorBase::CopyElements() for details.
|
||||
static void CopyDoubleToObjectElements(FixedArrayBase* from_base,
|
||||
static void CopyDoubleToObjectElements(Isolate* isolate,
|
||||
FixedArrayBase* from_base,
|
||||
uint32_t from_start,
|
||||
FixedArrayBase* to_base,
|
||||
uint32_t to_start, int raw_copy_size) {
|
||||
@ -244,7 +243,6 @@ static void CopyDoubleToObjectElements(FixedArrayBase* from_base,
|
||||
|
||||
// From here on, the code below could actually allocate. Therefore the raw
|
||||
// values are wrapped into handles.
|
||||
Isolate* isolate = from_base->GetIsolate();
|
||||
Handle<FixedDoubleArray> from(FixedDoubleArray::cast(from_base), isolate);
|
||||
Handle<FixedArray> to(FixedArray::cast(to_base), isolate);
|
||||
|
||||
@ -403,12 +401,9 @@ static void CopyObjectToDoubleElements(FixedArrayBase* from_base,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void CopyDictionaryToDoubleElements(FixedArrayBase* from_base,
|
||||
uint32_t from_start,
|
||||
FixedArrayBase* to_base,
|
||||
uint32_t to_start,
|
||||
int raw_copy_size) {
|
||||
static void CopyDictionaryToDoubleElements(
|
||||
Isolate* isolate, FixedArrayBase* from_base, uint32_t from_start,
|
||||
FixedArrayBase* to_base, uint32_t to_start, int raw_copy_size) {
|
||||
DisallowHeapAllocation no_allocation;
|
||||
NumberDictionary* from = NumberDictionary::cast(from_base);
|
||||
int copy_size = raw_copy_size;
|
||||
@ -428,7 +423,6 @@ static void CopyDictionaryToDoubleElements(FixedArrayBase* from_base,
|
||||
if (to_start + copy_size > to_length) {
|
||||
copy_size = to_length - to_start;
|
||||
}
|
||||
Isolate* isolate = from->GetIsolate();
|
||||
for (int i = 0; i < copy_size; i++) {
|
||||
int entry = from->FindEntry(isolate, i + from_start);
|
||||
if (entry != NumberDictionary::kNotFound) {
|
||||
@ -460,7 +454,7 @@ static void TraceTopFrame(Isolate* isolate) {
|
||||
}
|
||||
|
||||
static void SortIndices(
|
||||
Handle<FixedArray> indices, uint32_t sort_size,
|
||||
Isolate* isolate, Handle<FixedArray> indices, uint32_t sort_size,
|
||||
WriteBarrierMode write_barrier_mode = UPDATE_WRITE_BARRIER) {
|
||||
struct {
|
||||
bool operator()(const base::AtomicElement<Object*>& elementA,
|
||||
@ -483,8 +477,7 @@ static void SortIndices(
|
||||
indices->GetFirstElementAddress());
|
||||
std::sort(start, start + sort_size, cmp);
|
||||
if (write_barrier_mode != SKIP_WRITE_BARRIER) {
|
||||
FIXED_ARRAY_ELEMENTS_WRITE_BARRIER(indices->GetIsolate()->heap(), *indices,
|
||||
0, sort_size);
|
||||
FIXED_ARRAY_ELEMENTS_WRITE_BARRIER(isolate->heap(), *indices, 0, sort_size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -612,7 +605,8 @@ class ElementsAccessorBase : public InternalElementsAccessor {
|
||||
|
||||
static void TryTransitionResultArrayToPacked(Handle<JSArray> array) {
|
||||
if (!IsHoleyOrDictionaryElementsKind(kind())) return;
|
||||
Handle<FixedArrayBase> backing_store(array->elements());
|
||||
Handle<FixedArrayBase> backing_store(array->elements(),
|
||||
array->GetIsolate());
|
||||
int length = Smi::ToInt(array->length());
|
||||
if (!Subclass::IsPackedImpl(*array, *backing_store, 0, length)) {
|
||||
return;
|
||||
@ -762,7 +756,7 @@ class ElementsAccessorBase : public InternalElementsAccessor {
|
||||
|
||||
void SetLength(Handle<JSArray> array, uint32_t length) final {
|
||||
Subclass::SetLengthImpl(array->GetIsolate(), array, length,
|
||||
handle(array->elements()));
|
||||
handle(array->elements(), array->GetIsolate()));
|
||||
}
|
||||
|
||||
static void SetLengthImpl(Isolate* isolate, Handle<JSArray> array,
|
||||
@ -875,7 +869,7 @@ class ElementsAccessorBase : public InternalElementsAccessor {
|
||||
packed_size = Smi::ToInt(JSArray::cast(*object)->length());
|
||||
}
|
||||
|
||||
Subclass::CopyElementsImpl(*old_elements, src_index, *new_elements,
|
||||
Subclass::CopyElementsImpl(isolate, *old_elements, src_index, *new_elements,
|
||||
from_kind, dst_index, packed_size, copy_size);
|
||||
|
||||
return new_elements;
|
||||
@ -883,7 +877,7 @@ class ElementsAccessorBase : public InternalElementsAccessor {
|
||||
|
||||
static void TransitionElementsKindImpl(Handle<JSObject> object,
|
||||
Handle<Map> to_map) {
|
||||
Handle<Map> from_map = handle(object->map());
|
||||
Handle<Map> from_map = handle(object->map(), object->GetIsolate());
|
||||
ElementsKind from_kind = from_map->elements_kind();
|
||||
ElementsKind to_kind = to_map->elements_kind();
|
||||
if (IsHoleyElementsKind(from_kind)) {
|
||||
@ -895,7 +889,8 @@ class ElementsAccessorBase : public InternalElementsAccessor {
|
||||
DCHECK(IsFastElementsKind(to_kind));
|
||||
DCHECK_NE(TERMINAL_FAST_ELEMENTS_KIND, from_kind);
|
||||
|
||||
Handle<FixedArrayBase> from_elements(object->elements());
|
||||
Handle<FixedArrayBase> from_elements(object->elements(),
|
||||
object->GetIsolate());
|
||||
if (object->elements() == object->GetHeap()->empty_fixed_array() ||
|
||||
IsDoubleElementsKind(from_kind) == IsDoubleElementsKind(to_kind)) {
|
||||
// No change is needed to the elements() buffer, the transition
|
||||
@ -911,9 +906,9 @@ class ElementsAccessorBase : public InternalElementsAccessor {
|
||||
JSObject::SetMapAndElements(object, to_map, elements);
|
||||
}
|
||||
if (FLAG_trace_elements_transitions) {
|
||||
JSObject::PrintElementsTransition(stdout, object, from_kind,
|
||||
from_elements, to_kind,
|
||||
handle(object->elements()));
|
||||
JSObject::PrintElementsTransition(
|
||||
stdout, object, from_kind, from_elements, to_kind,
|
||||
handle(object->elements(), object->GetIsolate()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -927,7 +922,8 @@ class ElementsAccessorBase : public InternalElementsAccessor {
|
||||
// prototype object, make sure all of these optimizations are invalidated.
|
||||
object->GetIsolate()->UpdateNoElementsProtectorOnSetLength(object);
|
||||
}
|
||||
Handle<FixedArrayBase> old_elements(object->elements());
|
||||
Handle<FixedArrayBase> old_elements(object->elements(),
|
||||
object->GetIsolate());
|
||||
// This method should only be called if there's a reason to update the
|
||||
// elements.
|
||||
DCHECK(IsDoubleElementsKind(from_kind) != IsDoubleElementsKind(kind()) ||
|
||||
@ -973,7 +969,8 @@ class ElementsAccessorBase : public InternalElementsAccessor {
|
||||
object->WouldConvertToSlowElements(index)) {
|
||||
return false;
|
||||
}
|
||||
Handle<FixedArrayBase> old_elements(object->elements());
|
||||
Handle<FixedArrayBase> old_elements(object->elements(),
|
||||
object->GetIsolate());
|
||||
uint32_t new_capacity = JSObject::NewElementsCapacity(index + 1);
|
||||
DCHECK(static_cast<uint32_t>(old_elements->length()) < new_capacity);
|
||||
Handle<FixedArrayBase> elements =
|
||||
@ -994,10 +991,10 @@ class ElementsAccessorBase : public InternalElementsAccessor {
|
||||
Subclass::DeleteImpl(obj, entry);
|
||||
}
|
||||
|
||||
static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start,
|
||||
FixedArrayBase* to, ElementsKind from_kind,
|
||||
uint32_t to_start, int packed_size,
|
||||
int copy_size) {
|
||||
static void CopyElementsImpl(Isolate* isolate, FixedArrayBase* from,
|
||||
uint32_t from_start, FixedArrayBase* to,
|
||||
ElementsKind from_kind, uint32_t to_start,
|
||||
int packed_size, int copy_size) {
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
@ -1023,14 +1020,15 @@ class ElementsAccessorBase : public InternalElementsAccessor {
|
||||
// copying from object with fast double elements to object with object
|
||||
// elements. In all the other cases there are no allocations performed and
|
||||
// handle creation causes noticeable performance degradation of the builtin.
|
||||
Subclass::CopyElementsImpl(from, from_start, *to, from_kind, to_start,
|
||||
packed_size, copy_size);
|
||||
Subclass::CopyElementsImpl(from_holder->GetIsolate(), from, from_start, *to,
|
||||
from_kind, to_start, packed_size, copy_size);
|
||||
}
|
||||
|
||||
void CopyElements(Handle<FixedArrayBase> source, ElementsKind source_kind,
|
||||
void CopyElements(Isolate* isolate, Handle<FixedArrayBase> source,
|
||||
ElementsKind source_kind,
|
||||
Handle<FixedArrayBase> destination, int size) {
|
||||
Subclass::CopyElementsImpl(*source, 0, *destination, source_kind, 0,
|
||||
kPackedSizeNotKnown, size);
|
||||
Subclass::CopyElementsImpl(isolate, *source, 0, *destination, source_kind,
|
||||
0, kPackedSizeNotKnown, size);
|
||||
}
|
||||
|
||||
void CopyTypedArrayElementsSlice(JSTypedArray* source,
|
||||
@ -1058,7 +1056,8 @@ class ElementsAccessorBase : public InternalElementsAccessor {
|
||||
}
|
||||
|
||||
Handle<NumberDictionary> Normalize(Handle<JSObject> object) final {
|
||||
return Subclass::NormalizeImpl(object, handle(object->elements()));
|
||||
return Subclass::NormalizeImpl(
|
||||
object, handle(object->elements(), object->GetIsolate()));
|
||||
}
|
||||
|
||||
static Handle<NumberDictionary> NormalizeImpl(
|
||||
@ -1244,7 +1243,7 @@ class ElementsAccessorBase : public InternalElementsAccessor {
|
||||
combined_keys, &nof_indices);
|
||||
|
||||
if (needs_sorting) {
|
||||
SortIndices(combined_keys, nof_indices);
|
||||
SortIndices(isolate, combined_keys, nof_indices);
|
||||
// Indices from dictionary elements should only be converted after
|
||||
// sorting.
|
||||
if (convert == GetKeysConversion::kConvertToString) {
|
||||
@ -1257,8 +1256,9 @@ class ElementsAccessorBase : public InternalElementsAccessor {
|
||||
}
|
||||
|
||||
// Copy over the passed-in property keys.
|
||||
CopyObjectToObjectElements(*keys, PACKED_ELEMENTS, 0, *combined_keys,
|
||||
PACKED_ELEMENTS, nof_indices, nof_property_keys);
|
||||
CopyObjectToObjectElements(isolate, *keys, PACKED_ELEMENTS, 0,
|
||||
*combined_keys, PACKED_ELEMENTS, nof_indices,
|
||||
nof_property_keys);
|
||||
|
||||
// For holey elements and arguments we might have to shrink the collected
|
||||
// keys since the estimates might be off.
|
||||
@ -1480,10 +1480,10 @@ class DictionaryElementsAccessor
|
||||
array->set_length(*length_obj);
|
||||
}
|
||||
|
||||
static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start,
|
||||
FixedArrayBase* to, ElementsKind from_kind,
|
||||
uint32_t to_start, int packed_size,
|
||||
int copy_size) {
|
||||
static void CopyElementsImpl(Isolate* isolate, FixedArrayBase* from,
|
||||
uint32_t from_start, FixedArrayBase* to,
|
||||
ElementsKind from_kind, uint32_t to_start,
|
||||
int packed_size, int copy_size) {
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
@ -1498,7 +1498,7 @@ class DictionaryElementsAccessor
|
||||
JSObject::NormalizeElements(result_array);
|
||||
result_array->set_length(Smi::FromInt(result_length));
|
||||
Handle<NumberDictionary> source_dict(
|
||||
NumberDictionary::cast(receiver->elements()));
|
||||
NumberDictionary::cast(receiver->elements()), isolate);
|
||||
int entry_count = source_dict->Capacity();
|
||||
for (int i = 0; i < entry_count; i++) {
|
||||
Object* key = source_dict->KeyAt(i);
|
||||
@ -1506,7 +1506,7 @@ class DictionaryElementsAccessor
|
||||
uint64_t key_value = NumberToInt64(key);
|
||||
if (key_value >= start && key_value < end) {
|
||||
Handle<NumberDictionary> dest_dict(
|
||||
NumberDictionary::cast(result_array->elements()));
|
||||
NumberDictionary::cast(result_array->elements()), isolate);
|
||||
Handle<Object> value(source_dict->ValueAt(i), isolate);
|
||||
PropertyDetails details = source_dict->DetailsAt(i);
|
||||
PropertyAttributes attr = details.attributes();
|
||||
@ -1519,7 +1519,8 @@ class DictionaryElementsAccessor
|
||||
}
|
||||
|
||||
static void DeleteImpl(Handle<JSObject> obj, uint32_t entry) {
|
||||
Handle<NumberDictionary> dict(NumberDictionary::cast(obj->elements()));
|
||||
Handle<NumberDictionary> dict(NumberDictionary::cast(obj->elements()),
|
||||
obj->GetIsolate());
|
||||
dict = NumberDictionary::DeleteEntry(dict, entry);
|
||||
obj->set_elements(*dict);
|
||||
}
|
||||
@ -1581,7 +1582,8 @@ class DictionaryElementsAccessor
|
||||
Handle<NumberDictionary> dictionary =
|
||||
object->HasFastElements() || object->HasFastStringWrapperElements()
|
||||
? JSObject::NormalizeElements(object)
|
||||
: handle(NumberDictionary::cast(object->elements()));
|
||||
: handle(NumberDictionary::cast(object->elements()),
|
||||
object->GetIsolate());
|
||||
Handle<NumberDictionary> new_dictionary =
|
||||
NumberDictionary::Add(dictionary, index, value, details);
|
||||
new_dictionary->UpdateMaxNumberKey(index, object);
|
||||
@ -1672,7 +1674,7 @@ class DictionaryElementsAccessor
|
||||
elements->set(insertion_index, raw_key);
|
||||
insertion_index++;
|
||||
}
|
||||
SortIndices(elements, insertion_index);
|
||||
SortIndices(isolate, elements, insertion_index);
|
||||
for (int i = 0; i < insertion_index; i++) {
|
||||
keys->AddKey(elements->get(i));
|
||||
}
|
||||
@ -1939,7 +1941,7 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
|
||||
|
||||
static Handle<NumberDictionary> NormalizeImpl(Handle<JSObject> object,
|
||||
Handle<FixedArrayBase> store) {
|
||||
Isolate* isolate = store->GetIsolate();
|
||||
Isolate* isolate = object->GetIsolate();
|
||||
ElementsKind kind = Subclass::kind();
|
||||
|
||||
// Ensure that notifications fire if the array or object prototypes are
|
||||
@ -2107,7 +2109,7 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
|
||||
if (IsSmiOrObjectElementsKind(KindTraits::Kind)) {
|
||||
JSObject::EnsureWritableFastElements(obj);
|
||||
}
|
||||
DeleteCommon(obj, entry, handle(obj->elements()));
|
||||
DeleteCommon(obj, entry, handle(obj->elements(), obj->GetIsolate()));
|
||||
}
|
||||
|
||||
static bool HasEntryImpl(Isolate* isolate, FixedArrayBase* backing_store,
|
||||
@ -2188,14 +2190,16 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
|
||||
|
||||
static uint32_t PushImpl(Handle<JSArray> receiver,
|
||||
Arguments* args, uint32_t push_size) {
|
||||
Handle<FixedArrayBase> backing_store(receiver->elements());
|
||||
Handle<FixedArrayBase> backing_store(receiver->elements(),
|
||||
receiver->GetIsolate());
|
||||
return Subclass::AddArguments(receiver, backing_store, args, push_size,
|
||||
AT_END);
|
||||
}
|
||||
|
||||
static uint32_t UnshiftImpl(Handle<JSArray> receiver,
|
||||
Arguments* args, uint32_t unshift_size) {
|
||||
Handle<FixedArrayBase> backing_store(receiver->elements());
|
||||
Handle<FixedArrayBase> backing_store(receiver->elements(),
|
||||
receiver->GetIsolate());
|
||||
return Subclass::AddArguments(receiver, backing_store, args, unshift_size,
|
||||
AT_START);
|
||||
}
|
||||
@ -2208,9 +2212,9 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
|
||||
Handle<JSArray> result_array = isolate->factory()->NewJSArray(
|
||||
KindTraits::Kind, result_len, result_len);
|
||||
DisallowHeapAllocation no_gc;
|
||||
Subclass::CopyElementsImpl(*backing_store, start, result_array->elements(),
|
||||
KindTraits::Kind, 0, kPackedSizeNotKnown,
|
||||
result_len);
|
||||
Subclass::CopyElementsImpl(isolate, *backing_store, start,
|
||||
result_array->elements(), KindTraits::Kind, 0,
|
||||
kPackedSizeNotKnown, result_len);
|
||||
Subclass::TryTransitionResultArrayToPacked(result_array);
|
||||
return result_array;
|
||||
}
|
||||
@ -2244,7 +2248,7 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
|
||||
KindTraits::Kind, delete_count, delete_count);
|
||||
if (delete_count > 0) {
|
||||
DisallowHeapAllocation no_gc;
|
||||
Subclass::CopyElementsImpl(*backing_store, start,
|
||||
Subclass::CopyElementsImpl(isolate, *backing_store, start,
|
||||
deleted_elements->elements(), KindTraits::Kind,
|
||||
0, kPackedSizeNotKnown, delete_count);
|
||||
}
|
||||
@ -2501,8 +2505,8 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
|
||||
Handle<FixedArrayBase> new_elms = Subclass::ConvertElementsWithCapacity(
|
||||
receiver, backing_store, KindTraits::Kind, capacity, start);
|
||||
// Copy the trailing elements after start + delete_count
|
||||
Subclass::CopyElementsImpl(*backing_store, start + delete_count, *new_elms,
|
||||
KindTraits::Kind, start + add_count,
|
||||
Subclass::CopyElementsImpl(isolate, *backing_store, start + delete_count,
|
||||
*new_elms, KindTraits::Kind, start + add_count,
|
||||
kPackedSizeNotKnown,
|
||||
ElementsAccessor::kCopyToEndAndInitializeToHole);
|
||||
receiver->set_elements(*new_elms);
|
||||
@ -2620,10 +2624,10 @@ class FastSmiOrObjectElementsAccessor
|
||||
// See ElementsAccessor::CopyElements() for details.
|
||||
// This method could actually allocate if copying from double elements to
|
||||
// object elements.
|
||||
static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start,
|
||||
FixedArrayBase* to, ElementsKind from_kind,
|
||||
uint32_t to_start, int packed_size,
|
||||
int copy_size) {
|
||||
static void CopyElementsImpl(Isolate* isolate, FixedArrayBase* from,
|
||||
uint32_t from_start, FixedArrayBase* to,
|
||||
ElementsKind from_kind, uint32_t to_start,
|
||||
int packed_size, int copy_size) {
|
||||
DisallowHeapAllocation no_gc;
|
||||
ElementsKind to_kind = KindTraits::Kind;
|
||||
switch (from_kind) {
|
||||
@ -2631,19 +2635,20 @@ class FastSmiOrObjectElementsAccessor
|
||||
case HOLEY_SMI_ELEMENTS:
|
||||
case PACKED_ELEMENTS:
|
||||
case HOLEY_ELEMENTS:
|
||||
CopyObjectToObjectElements(from, from_kind, from_start, to, to_kind,
|
||||
to_start, copy_size);
|
||||
CopyObjectToObjectElements(isolate, from, from_kind, from_start, to,
|
||||
to_kind, to_start, copy_size);
|
||||
break;
|
||||
case PACKED_DOUBLE_ELEMENTS:
|
||||
case HOLEY_DOUBLE_ELEMENTS: {
|
||||
AllowHeapAllocation allow_allocation;
|
||||
DCHECK(IsObjectElementsKind(to_kind));
|
||||
CopyDoubleToObjectElements(from, from_start, to, to_start, copy_size);
|
||||
CopyDoubleToObjectElements(isolate, from, from_start, to, to_start,
|
||||
copy_size);
|
||||
break;
|
||||
}
|
||||
case DICTIONARY_ELEMENTS:
|
||||
CopyDictionaryToObjectElements(from, from_start, to, to_kind, to_start,
|
||||
copy_size);
|
||||
CopyDictionaryToObjectElements(isolate, from, from_start, to, to_kind,
|
||||
to_start, copy_size);
|
||||
break;
|
||||
case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
@ -2791,10 +2796,10 @@ class FastDoubleElementsAccessor
|
||||
FixedDoubleArray::cast(backing_store)->set(entry, value->Number());
|
||||
}
|
||||
|
||||
static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start,
|
||||
FixedArrayBase* to, ElementsKind from_kind,
|
||||
uint32_t to_start, int packed_size,
|
||||
int copy_size) {
|
||||
static void CopyElementsImpl(Isolate* isolate, FixedArrayBase* from,
|
||||
uint32_t from_start, FixedArrayBase* to,
|
||||
ElementsKind from_kind, uint32_t to_start,
|
||||
int packed_size, int copy_size) {
|
||||
DisallowHeapAllocation no_allocation;
|
||||
switch (from_kind) {
|
||||
case PACKED_SMI_ELEMENTS:
|
||||
@ -2813,7 +2818,7 @@ class FastDoubleElementsAccessor
|
||||
CopyObjectToDoubleElements(from, from_start, to, to_start, copy_size);
|
||||
break;
|
||||
case DICTIONARY_ELEMENTS:
|
||||
CopyDictionaryToDoubleElements(from, from_start, to, to_start,
|
||||
CopyDictionaryToDoubleElements(isolate, from, from_start, to, to_start,
|
||||
copy_size);
|
||||
break;
|
||||
case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
@ -3005,7 +3010,7 @@ class TypedElementsAccessor
|
||||
KeyAccumulator* accumulator,
|
||||
AddKeyConversion convert) {
|
||||
Isolate* isolate = receiver->GetIsolate();
|
||||
Handle<FixedArrayBase> elements(receiver->elements());
|
||||
Handle<FixedArrayBase> elements(receiver->elements(), isolate);
|
||||
uint32_t length = AccessorClass::GetCapacityImpl(*receiver, *elements);
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
Handle<Object> value = AccessorClass::GetImpl(isolate, *elements, i);
|
||||
@ -3019,7 +3024,7 @@ class TypedElementsAccessor
|
||||
PropertyFilter filter) {
|
||||
int count = 0;
|
||||
if ((filter & ONLY_CONFIGURABLE) == 0) {
|
||||
Handle<FixedArrayBase> elements(object->elements());
|
||||
Handle<FixedArrayBase> elements(object->elements(), isolate);
|
||||
uint32_t length = AccessorClass::GetCapacityImpl(*object, *elements);
|
||||
for (uint32_t index = 0; index < length; ++index) {
|
||||
Handle<Object> value =
|
||||
@ -3234,7 +3239,8 @@ class TypedElementsAccessor
|
||||
DCHECK(!WasNeutered(*object));
|
||||
DCHECK(object->IsJSTypedArray());
|
||||
Handle<FixedArray> result = isolate->factory()->NewFixedArray(length);
|
||||
Handle<BackingStore> elements(BackingStore::cast(object->elements()));
|
||||
Handle<BackingStore> elements(BackingStore::cast(object->elements()),
|
||||
isolate);
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
Handle<Object> value = AccessorClass::GetImpl(isolate, *elements, i);
|
||||
result->set(i, *value);
|
||||
@ -3488,7 +3494,7 @@ class TypedElementsAccessor
|
||||
size_t length, uint32_t offset) {
|
||||
Isolate* isolate = destination->GetIsolate();
|
||||
Handle<BackingStore> destination_elements(
|
||||
BackingStore::cast(destination->elements()));
|
||||
BackingStore::cast(destination->elements()), isolate);
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
LookupIterator it(isolate, source, i);
|
||||
Handle<Object> elem;
|
||||
@ -3787,7 +3793,7 @@ class SloppyArgumentsElementsAccessor
|
||||
|
||||
static void DeleteImpl(Handle<JSObject> obj, uint32_t entry) {
|
||||
Handle<SloppyArgumentsElements> elements(
|
||||
SloppyArgumentsElements::cast(obj->elements()));
|
||||
SloppyArgumentsElements::cast(obj->elements()), obj->GetIsolate());
|
||||
uint32_t length = elements->parameter_map_length();
|
||||
uint32_t delete_or_entry = entry;
|
||||
if (entry < length) {
|
||||
@ -3818,7 +3824,7 @@ class SloppyArgumentsElementsAccessor
|
||||
DirectCollectElementIndicesImpl(isolate, object, backing_store,
|
||||
GetKeysConversion::kKeepNumbers,
|
||||
ENUMERABLE_STRINGS, indices, &nof_indices);
|
||||
SortIndices(indices, nof_indices);
|
||||
SortIndices(isolate, indices, nof_indices);
|
||||
for (uint32_t i = 0; i < nof_indices; i++) {
|
||||
keys->AddKey(indices->get(i));
|
||||
}
|
||||
@ -4020,7 +4026,7 @@ class SlowSloppyArgumentsElementsAccessor
|
||||
Handle<FixedArrayBase> store, uint32_t entry,
|
||||
Handle<Object> value,
|
||||
PropertyAttributes attributes) {
|
||||
Isolate* isolate = store->GetIsolate();
|
||||
Isolate* isolate = object->GetIsolate();
|
||||
Handle<SloppyArgumentsElements> elements =
|
||||
Handle<SloppyArgumentsElements>::cast(store);
|
||||
uint32_t length = elements->parameter_map_length();
|
||||
@ -4084,7 +4090,7 @@ class FastSloppyArgumentsElementsAccessor
|
||||
static Handle<NumberDictionary> NormalizeImpl(
|
||||
Handle<JSObject> object, Handle<FixedArrayBase> elements) {
|
||||
Handle<FixedArray> arguments =
|
||||
GetArguments(elements->GetIsolate(), *elements);
|
||||
GetArguments(object->GetIsolate(), *elements);
|
||||
return FastHoleyObjectElementsAccessor::NormalizeImpl(object, arguments);
|
||||
}
|
||||
|
||||
@ -4138,23 +4144,23 @@ class FastSloppyArgumentsElementsAccessor
|
||||
PropertyAttributes attributes) {
|
||||
DCHECK_EQ(object->elements(), *store);
|
||||
Handle<SloppyArgumentsElements> elements(
|
||||
SloppyArgumentsElements::cast(*store));
|
||||
SloppyArgumentsElements::cast(*store), object->GetIsolate());
|
||||
NormalizeArgumentsElements(object, elements, &entry);
|
||||
SlowSloppyArgumentsElementsAccessor::ReconfigureImpl(object, store, entry,
|
||||
value, attributes);
|
||||
}
|
||||
|
||||
static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start,
|
||||
FixedArrayBase* to, ElementsKind from_kind,
|
||||
uint32_t to_start, int packed_size,
|
||||
int copy_size) {
|
||||
static void CopyElementsImpl(Isolate* isolate, FixedArrayBase* from,
|
||||
uint32_t from_start, FixedArrayBase* to,
|
||||
ElementsKind from_kind, uint32_t to_start,
|
||||
int packed_size, int copy_size) {
|
||||
DCHECK(!to->IsDictionary());
|
||||
if (from_kind == SLOW_SLOPPY_ARGUMENTS_ELEMENTS) {
|
||||
CopyDictionaryToObjectElements(from, from_start, to, HOLEY_ELEMENTS,
|
||||
to_start, copy_size);
|
||||
CopyDictionaryToObjectElements(isolate, from, from_start, to,
|
||||
HOLEY_ELEMENTS, to_start, copy_size);
|
||||
} else {
|
||||
DCHECK_EQ(FAST_SLOPPY_ARGUMENTS_ELEMENTS, from_kind);
|
||||
CopyObjectToObjectElements(from, HOLEY_ELEMENTS, from_start, to,
|
||||
CopyObjectToObjectElements(isolate, from, HOLEY_ELEMENTS, from_start, to,
|
||||
HOLEY_ELEMENTS, to_start, copy_size);
|
||||
}
|
||||
}
|
||||
@ -4309,7 +4315,8 @@ class StringWrapperElementsAccessor
|
||||
|
||||
static void GrowCapacityAndConvertImpl(Handle<JSObject> object,
|
||||
uint32_t capacity) {
|
||||
Handle<FixedArrayBase> old_elements(object->elements());
|
||||
Handle<FixedArrayBase> old_elements(object->elements(),
|
||||
object->GetIsolate());
|
||||
ElementsKind from_kind = object->GetElementsKind();
|
||||
if (from_kind == FAST_STRING_WRAPPER_ELEMENTS) {
|
||||
// The optimizing compiler relies on the prototype lookups of String
|
||||
@ -4327,17 +4334,17 @@ class StringWrapperElementsAccessor
|
||||
capacity);
|
||||
}
|
||||
|
||||
static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start,
|
||||
FixedArrayBase* to, ElementsKind from_kind,
|
||||
uint32_t to_start, int packed_size,
|
||||
int copy_size) {
|
||||
static void CopyElementsImpl(Isolate* isolate, FixedArrayBase* from,
|
||||
uint32_t from_start, FixedArrayBase* to,
|
||||
ElementsKind from_kind, uint32_t to_start,
|
||||
int packed_size, int copy_size) {
|
||||
DCHECK(!to->IsDictionary());
|
||||
if (from_kind == SLOW_STRING_WRAPPER_ELEMENTS) {
|
||||
CopyDictionaryToObjectElements(from, from_start, to, HOLEY_ELEMENTS,
|
||||
to_start, copy_size);
|
||||
CopyDictionaryToObjectElements(isolate, from, from_start, to,
|
||||
HOLEY_ELEMENTS, to_start, copy_size);
|
||||
} else {
|
||||
DCHECK_EQ(FAST_STRING_WRAPPER_ELEMENTS, from_kind);
|
||||
CopyObjectToObjectElements(from, HOLEY_ELEMENTS, from_start, to,
|
||||
CopyObjectToObjectElements(isolate, from, HOLEY_ELEMENTS, from_start, to,
|
||||
HOLEY_ELEMENTS, to_start, copy_size);
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ class ElementsAccessor {
|
||||
|
||||
virtual void Reverse(JSObject* receiver) = 0;
|
||||
|
||||
virtual void CopyElements(Handle<FixedArrayBase> source,
|
||||
virtual void CopyElements(Isolate* isolate, Handle<FixedArrayBase> source,
|
||||
ElementsKind source_kind,
|
||||
Handle<FixedArrayBase> destination, int size) = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user