[crankshaft] Don't inline array resize operations if receiver's proto is not a JSObject.

BUG=chromium:571064
LOG=Y
TBR=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/1548363003

Cr-Commit-Position: refs/heads/master@{#33058}
This commit is contained in:
ishell 2015-12-29 06:34:26 -08:00 committed by Commit bot
parent c1aded3c4b
commit bae0d6c8dc
2 changed files with 20 additions and 1 deletions

View File

@ -8703,7 +8703,7 @@ bool HOptimizedGraphBuilder::IsReadOnlyLengthDescriptor(
// static
bool HOptimizedGraphBuilder::CanInlineArrayResizeOperation(
Handle<Map> receiver_map) {
return !receiver_map.is_null() &&
return !receiver_map.is_null() && receiver_map->prototype()->IsJSObject() &&
receiver_map->instance_type() == JS_ARRAY_TYPE &&
IsFastElementsKind(receiver_map->elements_kind()) &&
!receiver_map->is_dictionary_map() && !receiver_map->is_observed() &&

View File

@ -0,0 +1,19 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --enable-slow-asserts
Array.prototype.__proto__ = null;
var func = Array.prototype.push;
var prototype = Array.prototype;
function CallFunc(a) {
func.call(a);
}
function CallFuncWithPrototype() {
CallFunc(prototype);
}
CallFunc([]);
CallFunc([]);
%OptimizeFunctionOnNextCall(CallFuncWithPrototype);
CallFuncWithPrototype();