Commit 5562f6a2 authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

Make ArrayList::Elements() static in order to be GC-safe

NOTREECHECKS=true

Change-Id: I4ebd05d41d524ac0583b507fcdf7d4c15136d3b8
Reviewed-on: https://chromium-review.googlesource.com/567548Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46570}
parent 892d49a6
......@@ -1000,10 +1000,11 @@ Handle<JSObject> ConvertToJSObject(Isolate* isolate,
ArrayList::cast(feedback->get(value_index)));
int position = Smi::ToInt(key);
JSObject::AddDataElement(type_profile, position,
isolate->factory()->NewJSArrayWithElements(
position_specific_types->Elements()),
PropertyAttributes::NONE)
JSObject::AddDataElement(
type_profile, position,
isolate->factory()->NewJSArrayWithElements(
ArrayList::Elements(position_specific_types)),
PropertyAttributes::NONE)
.ToHandleChecked();
}
}
......
......@@ -10136,10 +10136,12 @@ Handle<ArrayList> ArrayList::New(Isolate* isolate, int size) {
return result;
}
Handle<FixedArray> ArrayList::Elements() const {
Handle<FixedArray> result = GetIsolate()->factory()->NewFixedArray(Length());
Handle<FixedArray> ArrayList::Elements(Handle<ArrayList> array) {
int length = array->Length();
Handle<FixedArray> result =
array->GetIsolate()->factory()->NewFixedArray(length);
// Do not copy the first entry, i.e., the length.
CopyTo(kFirstIndex, *result, 0, Length());
array->CopyTo(kFirstIndex, *result, 0, length);
return result;
}
......
......@@ -3026,7 +3026,7 @@ class ArrayList : public FixedArray {
// Return a copy of the list of size Length() without the first entry. The
// number returned by Length() is stored in the first entry.
Handle<FixedArray> Elements() const;
static Handle<FixedArray> Elements(Handle<ArrayList> array);
bool IsFull();
DECL_CAST(ArrayList)
......
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