Make ArrayList::Elements() static in order to be GC-safe
NOTREECHECKS=true Change-Id: I4ebd05d41d524ac0583b507fcdf7d4c15136d3b8 Reviewed-on: https://chromium-review.googlesource.com/567548 Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org> Commit-Queue: Adam Klein <adamk@chromium.org> Cr-Commit-Position: refs/heads/master@{#46570}
This commit is contained in:
parent
892d49a695
commit
5562f6a276
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user