Commit cf1ebf36 authored by leszeks's avatar leszeks Committed by Commit bot

[ignition/turbo] Remove stack check from inlined functions

This removes the first stack check in inlined functions in the bytecode
graph builder, to match the behaviour of the AST graph builder.

I measure a ~1% statistically significant (p < 0.01) improvement on
Mandreel with --ignition-staging --turbo (on my x64 machine, YMMV).

Review-Url: https://codereview.chromium.org/2392333002
Cr-Commit-Position: refs/heads/master@{#40715}
parent 4fa2ebcb
......@@ -569,7 +569,7 @@ VectorSlotPair BytecodeGraphBuilder::CreateVectorSlotPair(int slot_id) {
return VectorSlotPair(feedback_vector(), slot);
}
bool BytecodeGraphBuilder::CreateGraph() {
bool BytecodeGraphBuilder::CreateGraph(bool stack_check) {
// Set up the basic structure of the graph. Outputs for {Start} are the formal
// parameters (including the receiver) plus new target, number of arguments,
// context and closure.
......@@ -581,7 +581,7 @@ bool BytecodeGraphBuilder::CreateGraph() {
GetFunctionContext());
set_environment(&env);
VisitBytecodes();
VisitBytecodes(stack_check);
// Finish the basic structure of the graph.
DCHECK_NE(0u, exit_controls_.size());
......@@ -641,7 +641,7 @@ void BytecodeGraphBuilder::ClearNonLiveSlotsInFrameStates() {
}
}
void BytecodeGraphBuilder::VisitBytecodes() {
void BytecodeGraphBuilder::VisitBytecodes(bool stack_check) {
BytecodeBranchAnalysis analysis(bytecode_array(), local_zone());
BytecodeLoopAnalysis loop_analysis(bytecode_array(), &analysis, local_zone());
analysis.Analyze();
......@@ -655,7 +655,7 @@ void BytecodeGraphBuilder::VisitBytecodes() {
bytecode_array()->source_position_table());
BuildOSRNormalEntryPoint();
while (!iterator.done()) {
for (; !iterator.done(); iterator.Advance()) {
int current_offset = iterator.current_offset();
UpdateCurrentSourcePosition(&source_position_iterator, current_offset);
EnterAndExitExceptionHandlers(current_offset);
......@@ -664,6 +664,13 @@ void BytecodeGraphBuilder::VisitBytecodes() {
BuildLoopHeaderEnvironment(current_offset);
BuildOSRLoopEntryPoint(current_offset);
// Skip the first stack check if stack_check is false
if (!stack_check &&
iterator.current_bytecode() == interpreter::Bytecode::kStackCheck) {
stack_check = true;
continue;
}
switch (iterator.current_bytecode()) {
#define BYTECODE_CASE(name, ...) \
case interpreter::Bytecode::k##name: \
......@@ -673,7 +680,6 @@ void BytecodeGraphBuilder::VisitBytecodes() {
#undef BYTECODE_CODE
}
}
iterator.Advance();
}
set_branch_analysis(nullptr);
......
......@@ -33,12 +33,12 @@ class BytecodeGraphBuilder {
SourcePositionTable* source_positions);
// Creates a graph by visiting bytecodes.
bool CreateGraph();
bool CreateGraph(bool stack_check = true);
private:
class Environment;
void VisitBytecodes();
void VisitBytecodes(bool stack_check);
// Get or create the node that represents the outer function closure.
Node* GetFunctionClosure();
......
......@@ -531,7 +531,7 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
Graph::SubgraphScope scope(graph());
BytecodeGraphBuilder graph_builder(&zone, &info, jsgraph(),
call.frequency(), nullptr);
graph_builder.CreateGraph();
graph_builder.CreateGraph(false);
// Extract the inlinee start/end nodes.
start = graph()->start();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment