v8/test/mjsunit/compiler/serializer-call.js
Maya Lekova 7ecb124a67 [turbofan] Add missing data for Function.apply and .call
Add serialization of the virtual closures for Function.ptototype.apply
and Function.prototype.call. Also add tests for those.

Bug: v8:7790
Change-Id: I26374009c09958943ef36eae283a270875234e40
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1943155
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Auto-Submit: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65298}
2019-12-02 17:13:21 +00:00

28 lines
625 B
JavaScript

// Copyright 2019 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 --opt --no-always-opt
function call(cb) {
return cb.call(this, 42);
}
function bar() {
function foo(arg) {
%TurbofanStaticAssert(arg === 42);
return %IsBeingInterpreted();
}
%PrepareFunctionForOptimization(foo);
return call(foo);
}
%PrepareFunctionForOptimization(bar);
%PrepareFunctionForOptimization(call);
assertTrue(bar());
assertTrue(bar());
%OptimizeFunctionOnNextCall(bar);
assertFalse(bar());