Commit b38795f3 authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[Interpreter] Increase allowed expression depth for logical test expressions

Changes the handling of TestResultScopes to allow them to be reused by
logical tests by rewiring instead of using a new TestResultScope. 
Also does the following:
 - moves some fields about in TestResultScope to reduce it's size
 - moves RegisterListFreeEvent to the end of ReleaseRegisters to enable
   it to be tail-called.

This increases the allowed depth of logical expressions which the
compiler can handle without overflowing the stack by about 2x on x64.

BUG=chromium:731861

Change-Id: I7733797bec5e52d07eec6332c07e2a886f2bbde1
Reviewed-on: https://chromium-review.googlesource.com/539521
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46039}
parent a971a64d
This diff is collapsed.
......@@ -159,6 +159,11 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
void VisitForInAssignment(Expression* expr, FeedbackSlot slot);
void VisitModuleNamespaceImports();
// Builds a logical OR/AND within a test context by rewiring the jumps based
// on the expression values.
void BuildLogicalTest(Token::Value token, Expression* left,
Expression* right);
// Builds an addition expression. If the result is a known string addition,
// then rather than emitting the add, the operands will converted to
// primitive, then to string and stored in registers in the
......@@ -181,6 +186,9 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
int AllocateBlockCoverageSlotIfEnabled(SourceRange range);
void BuildIncrementBlockCoverageCounterIfEnabled(int coverage_array_slot);
void BuildTest(ToBooleanMode mode, BytecodeLabels* then_labels,
BytecodeLabels* else_labels, TestFallthrough fallthrough);
// Visitors for obtaining expression result in the accumulator, in a
// register, or just getting the effect. Some visitors return a TypeHint which
// specifies the type of the result of the visited expression.
......@@ -194,6 +202,7 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
BytecodeLabels* else_labels, TestFallthrough fallthrough);
TypeHint VisitForAddOperand(Expression* expr, RegisterList* operand_registers,
Register* out_register);
void VisitInSameTestExecutionScope(Expression* expr);
// Returns the runtime function id for a store to super for the function's
// language mode.
......
......@@ -91,11 +91,11 @@ class BytecodeRegisterAllocator final {
// Release all registers above |register_index|.
void ReleaseRegisters(int register_index) {
int count = next_register_index_ - register_index;
next_register_index_ = register_index;
if (observer_) {
observer_->RegisterListFreeEvent(
RegisterList(register_index, next_register_index_ - register_index));
observer_->RegisterListFreeEvent(RegisterList(register_index, count));
}
next_register_index_ = register_index;
}
// Returns true if the register |reg| is a live register.
......
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