| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index dd36a53929aa18c5cd0207d3db7561e1196cfd41..285c1b12774cd230742f038b73dc80c430935fe1 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -14660,7 +14660,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsAccessAllowedForObserver) {
|
|
|
| static MaybeObject* ArrayConstructorCommon(Isolate* isolate,
|
| Handle<JSFunction> constructor,
|
| - Handle<Object> type_info,
|
| + Handle<AllocationSite> site,
|
| Arguments* caller_args) {
|
| bool holey = false;
|
| bool can_use_type_feedback = true;
|
| @@ -14682,14 +14682,7 @@ static MaybeObject* ArrayConstructorCommon(Isolate* isolate,
|
|
|
| JSArray* array;
|
| MaybeObject* maybe_array;
|
| - if (!type_info.is_null() &&
|
| - *type_info != isolate->heap()->undefined_value() &&
|
| - Cell::cast(*type_info)->value()->IsAllocationSite() &&
|
| - can_use_type_feedback) {
|
| - Handle<Cell> cell = Handle<Cell>::cast(type_info);
|
| - Handle<AllocationSite> site = Handle<AllocationSite>(
|
| - AllocationSite::cast(cell->value()), isolate);
|
| - ASSERT(!site->SitePointsToLiteral());
|
| + if (!site.is_null() && can_use_type_feedback) {
|
| ElementsKind to_kind = site->GetElementsKind();
|
| if (holey && !IsFastHoleyElementsKind(to_kind)) {
|
| to_kind = GetHoleyElementsKind(to_kind);
|
| @@ -14715,8 +14708,17 @@ static MaybeObject* ArrayConstructorCommon(Isolate* isolate,
|
| maybe_array = isolate->heap()->AllocateJSArrayStorage(array, 0, 0,
|
| DONT_INITIALIZE_ARRAY_ELEMENTS);
|
| if (maybe_array->IsFailure()) return maybe_array;
|
| + ElementsKind old_kind = array->GetElementsKind();
|
| maybe_array = ArrayConstructInitializeElements(array, caller_args);
|
| if (maybe_array->IsFailure()) return maybe_array;
|
| + if (!site.is_null() &&
|
| + (old_kind != array->GetElementsKind() ||
|
| + !can_use_type_feedback)) {
|
| + // The arguments passed in caused a transition. This kind of complexity
|
| + // can't be dealt with in the inlined hydrogen array constructor case.
|
| + // We must mark the allocationsite as un-inlinable.
|
| + site->SetDoNotInlineCall();
|
| + }
|
| return array;
|
| }
|
|
|
| @@ -14736,9 +14738,18 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayConstructor) {
|
| CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, parameters_start);
|
| CONVERT_ARG_HANDLE_CHECKED(Object, type_info, parameters_start + 1);
|
|
|
| + Handle<AllocationSite> site;
|
| + if (!type_info.is_null() &&
|
| + *type_info != isolate->heap()->undefined_value() &&
|
| + Cell::cast(*type_info)->value()->IsAllocationSite()) {
|
| + site = Handle<AllocationSite>(
|
| + AllocationSite::cast(Cell::cast(*type_info)->value()), isolate);
|
| + ASSERT(!site->SitePointsToLiteral());
|
| + }
|
| +
|
| return ArrayConstructorCommon(isolate,
|
| constructor,
|
| - type_info,
|
| + site,
|
| caller_args);
|
| }
|
|
|
| @@ -14756,7 +14767,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalArrayConstructor) {
|
|
|
| return ArrayConstructorCommon(isolate,
|
| constructor,
|
| - Handle<Object>::null(),
|
| + Handle<AllocationSite>::null(),
|
| caller_args);
|
| }
|
|
|
|
|