v8/test/mjsunit/regress/regress-681383.js
jarin 9091eb19be [deoptimizer] Materialize array iterators in the deoptimizer.
This also introduces exhaustive switch-cases for instance types.

BUG=chromium:681383

Review-Url: https://codereview.chromium.org/2646433002
Cr-Commit-Position: refs/heads/master@{#42447}
2017-01-18 10:55:22 +00:00

20 lines
431 B
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 f(deopt) {
let array = [42];
let it = array[Symbol.iterator]();
if (deopt) {
%_DeoptimizeNow();
return it.next().value;
}
}
f(false);
f(false);
%OptimizeFunctionOnNextCall(f);
assertEquals(f(true), 42);