v8/test/mjsunit/compiler/serializer-apply.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
663 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 apply(arg) {
"use strict";
return arg.apply(this, arguments);
}
function bar() {
function foo(self, arg) {
%TurbofanStaticAssert(arg === 42);
return %IsBeingInterpreted();
}
%PrepareFunctionForOptimization(foo);
return apply(foo, 42);
}
%PrepareFunctionForOptimization(bar);
%PrepareFunctionForOptimization(apply);
assertTrue(bar());
assertTrue(bar());
%OptimizeFunctionOnNextCall(bar);
assertFalse(bar());