[crankshaft] Don't inline array indexOf operations if receiver's proto is not a JSObject.
BUG=chromium:577112 LOG=N Review URL: https://codereview.chromium.org/1584303002 Cr-Commit-Position: refs/heads/master@{#33320}
This commit is contained in:
parent
ea5a1ac8b5
commit
1bb7cfda7f
@ -9058,6 +9058,7 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
|
||||
case kArrayLastIndexOf: {
|
||||
if (receiver_map.is_null()) return false;
|
||||
if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false;
|
||||
if (!receiver_map->prototype()->IsJSObject()) return false;
|
||||
ElementsKind kind = receiver_map->elements_kind();
|
||||
if (!IsFastElementsKind(kind)) return false;
|
||||
if (receiver_map->is_observed()) return false;
|
||||
|
15
test/mjsunit/regress/regress-crbug-577112.js
Normal file
15
test/mjsunit/regress/regress-crbug-577112.js
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2016 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
|
||||
|
||||
Array.prototype.__proto__ = null;
|
||||
var prototype = Array.prototype;
|
||||
function f() {
|
||||
prototype.lastIndexOf({});
|
||||
}
|
||||
f();
|
||||
f();
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
f();
|
Loading…
Reference in New Issue
Block a user