37aa13fe3b
Support inlining of Array.prototype.filter in TurboFan. Bug: v8:1956 Change-Id: Iba4d683aaa86c6104e8a1cf4d0f549a0c516576a Reviewed-on: https://chromium-review.googlesource.com/657021 Commit-Queue: Michael Stanton <mvstanton@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#48040}
54 lines
1.6 KiB
JavaScript
54 lines
1.6 KiB
JavaScript
// Copyright 2017 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
|
|
|
|
(function TestNonCallableForEach() {
|
|
function foo() { [].forEach(undefined) }
|
|
assertThrows(foo, TypeError);
|
|
assertThrows(foo, TypeError);
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
assertThrows(foo, TypeError);
|
|
})();
|
|
|
|
(function TestNonCallableForEachCaught() {
|
|
function foo() { try { [].forEach(undefined) } catch(e) { return e } }
|
|
assertInstanceof(foo(), TypeError);
|
|
assertInstanceof(foo(), TypeError);
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
assertInstanceof(foo(), TypeError);
|
|
})();
|
|
|
|
(function TestNonCallableMap() {
|
|
function foo() { [].map(undefined); }
|
|
assertThrows(foo, TypeError);
|
|
assertThrows(foo, TypeError);
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
assertThrows(foo, TypeError);
|
|
})();
|
|
|
|
(function TestNonCallableMapCaught() {
|
|
function foo() { try { [].map(undefined) } catch(e) { return e } }
|
|
assertInstanceof(foo(), TypeError);
|
|
assertInstanceof(foo(), TypeError);
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
assertInstanceof(foo(), TypeError);
|
|
})();
|
|
|
|
(function TestNonCallableFilter() {
|
|
function foo() { [].filter(undefined); }
|
|
assertThrows(foo, TypeError);
|
|
assertThrows(foo, TypeError);
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
assertThrows(foo, TypeError);
|
|
})();
|
|
|
|
(function TestNonCallableFilterCaught() {
|
|
function foo() { try { [].filter(undefined) } catch(e) { return e } }
|
|
assertInstanceof(foo(), TypeError);
|
|
assertInstanceof(foo(), TypeError);
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
assertInstanceof(foo(), TypeError);
|
|
})();
|