[turbofan] JSCreateClosure doesn't have any JS observable side effects.
The JSCreateClosure operator was not marked as Eliminatable, esp. it wasn't marked as NoWrite (read: no JavaScript observable side-effect), which lead to a weird performance cliff with the new Array builtin inlining. For example a.forEach(c => c); was not inlined, whereas const f = c => c; a.forEach(f); was properly inlined, despite not causing any trouble for TurboFan in general. The reason was that the JSCreateClosure for the arrow function was marked as "can cause potential side effect", which it cannot. This fixes the operator to be properly marked as Eliminatable, thus removing this performance cliff. BUG=v8:1956,v8:6475 R=danno@chromium.org Review-Url: https://codereview.chromium.org/2930933002 Cr-Commit-Position: refs/heads/master@{#45801}
This commit is contained in:
parent
4e86ae8c2c
commit
2a20ded9a1
@ -398,9 +398,9 @@ void JSGenericLowering::LowerJSCreateClosure(Node* node) {
|
||||
CallDescriptor::Flags flags = FrameStateFlagForCall(node);
|
||||
Handle<SharedFunctionInfo> const shared_info = p.shared_info();
|
||||
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(shared_info));
|
||||
node->RemoveInput(3); // control
|
||||
|
||||
// Use the FastNewClosurebuiltin only for functions allocated in new
|
||||
// space.
|
||||
// Use the FastNewClosure builtin only for functions allocated in new space.
|
||||
if (p.pretenure() == NOT_TENURED) {
|
||||
Callable callable = CodeFactory::FastNewClosure(isolate());
|
||||
node->InsertInput(zone(), 1,
|
||||
|
@ -1064,11 +1064,11 @@ const Operator* JSOperatorBuilder::CreateClosure(
|
||||
Handle<SharedFunctionInfo> shared_info, VectorSlotPair const& feedback,
|
||||
PretenureFlag pretenure) {
|
||||
CreateClosureParameters parameters(shared_info, feedback, pretenure);
|
||||
return new (zone()) Operator1<CreateClosureParameters>( // --
|
||||
IrOpcode::kJSCreateClosure, Operator::kNoThrow, // opcode
|
||||
"JSCreateClosure", // name
|
||||
0, 1, 1, 1, 1, 0, // counts
|
||||
parameters); // parameter
|
||||
return new (zone()) Operator1<CreateClosureParameters>( // --
|
||||
IrOpcode::kJSCreateClosure, Operator::kEliminatable, // opcode
|
||||
"JSCreateClosure", // name
|
||||
0, 1, 1, 1, 1, 0, // counts
|
||||
parameters); // parameter
|
||||
}
|
||||
|
||||
const Operator* JSOperatorBuilder::CreateLiteralArray(
|
||||
|
Loading…
Reference in New Issue
Block a user