[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}
This commit is contained in:
parent
69fa5f794f
commit
7ecb124a67
@ -2374,6 +2374,11 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall(
|
||||
constant, base::nullopt, new_arguments, speculation_mode,
|
||||
kMissingArgumentsAreUnknown, result_hints);
|
||||
}
|
||||
for (auto const& virtual_closure : arguments[0].virtual_closures()) {
|
||||
ProcessCalleeForCallOrConstruct(
|
||||
Callee(virtual_closure), base::nullopt, new_arguments,
|
||||
speculation_mode, kMissingArgumentsAreUnknown, result_hints);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Builtins::kPromiseConstructor:
|
||||
@ -2390,7 +2395,7 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall(
|
||||
SpeculationMode::kDisallowSpeculation,
|
||||
kMissingArgumentsAreUnknown, result_hints);
|
||||
}
|
||||
for (auto virtual_closure : arguments[0].virtual_closures()) {
|
||||
for (auto const& virtual_closure : arguments[0].virtual_closures()) {
|
||||
ProcessCalleeForCallOrConstruct(
|
||||
Callee(virtual_closure), base::nullopt, new_arguments,
|
||||
SpeculationMode::kDisallowSpeculation,
|
||||
@ -2407,6 +2412,11 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall(
|
||||
new_arguments, speculation_mode,
|
||||
padding, result_hints);
|
||||
}
|
||||
for (auto const& virtual_closure : arguments[0].virtual_closures()) {
|
||||
ProcessCalleeForCallOrConstruct(
|
||||
Callee(virtual_closure), base::nullopt, new_arguments,
|
||||
speculation_mode, padding, result_hints);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Builtins::kReflectApply:
|
||||
|
27
test/mjsunit/compiler/serializer-apply.js
Normal file
27
test/mjsunit/compiler/serializer-apply.js
Normal file
@ -0,0 +1,27 @@
|
||||
// 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());
|
27
test/mjsunit/compiler/serializer-call.js
Normal file
27
test/mjsunit/compiler/serializer-call.js
Normal file
@ -0,0 +1,27 @@
|
||||
// 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());
|
@ -407,6 +407,8 @@
|
||||
# Tests that depend on optimization (beyond doing assertOptimized).
|
||||
'compiler/is-being-interpreted-*': [SKIP],
|
||||
'compiler/serializer-accessors': [SKIP],
|
||||
'compiler/serializer-apply': [SKIP],
|
||||
'compiler/serializer-call': [SKIP],
|
||||
'compiler/serializer-transition-propagation': [SKIP],
|
||||
|
||||
# These tests check that we can trace the compiler.
|
||||
@ -1094,6 +1096,8 @@
|
||||
'compiler/is-being-interpreted-*': [SKIP],
|
||||
'compiler/load-elimination-const-field': [SKIP],
|
||||
'compiler/serializer-accessors': [SKIP],
|
||||
'compiler/serializer-apply': [SKIP],
|
||||
'compiler/serializer-call': [SKIP],
|
||||
'compiler/serializer-feedback-propagation-*': [SKIP],
|
||||
'compiler/serializer-transition-propagation': [SKIP],
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user