Chromium Code Reviews| Index: src/runtime.cc |
| diff --git a/src/runtime.cc b/src/runtime.cc |
| index dd36a53929aa18c5cd0207d3db7561e1196cfd41..83a3b4951e3a0447dca55b6390a79347259a0289 100644 |
| --- a/src/runtime.cc |
| +++ b/src/runtime.cc |
| @@ -14664,6 +14664,7 @@ static MaybeObject* ArrayConstructorCommon(Isolate* isolate, |
| Arguments* caller_args) { |
| bool holey = false; |
| bool can_use_type_feedback = true; |
| + Handle<AllocationSite> site; |
|
Toon Verwaest
2013/11/06 16:42:44
Can we just declare it below, right above the if w
mvstanton
2013/11/07 16:34:05
Done.
|
| if (caller_args->length() == 1) { |
| Object* argument_one = (*caller_args)[0]; |
| if (argument_one->IsSmi()) { |
| @@ -14680,15 +14681,21 @@ 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); |
| + Cell::cast(*type_info)->value()->IsAllocationSite()) { |
| + site = Handle<AllocationSite>( |
| + AllocationSite::cast(Cell::cast(*type_info)->value()), isolate); |
| + } |
| + |
| + if (!site.is_null() && !can_use_type_feedback) { |
|
Toon Verwaest
2013/11/06 16:42:44
I find all these !site.is_null() a bit hard to rea
mvstanton
2013/11/07 16:34:05
I pulled out turning the type_info into an allocat
|
| + // Mark the allocation site as un-inlinable. |
| + site->SetDoNotInlineCall(); |
| + } |
| + |
| + JSArray* array; |
| + MaybeObject* maybe_array; |
| + if (!site.is_null() && can_use_type_feedback) { |
| ASSERT(!site->SitePointsToLiteral()); |
| ElementsKind to_kind = site->GetElementsKind(); |
| if (holey && !IsFastHoleyElementsKind(to_kind)) { |
| @@ -14715,8 +14722,15 @@ 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 (old_kind != array->GetElementsKind() && !site.is_null()) { |
| + // 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; |
| } |