Commit b807d112 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[turbofan] Fix ForInStatement that deopts during filter.

This adds a missing bailout id to a ForInStatement for when retrieving
and filtering a property name deoptimizes. This can happen with proxies
that have a getPropertyDescriptor trap.

R=jarin@chromium.org
TEST=mjsunit/for-in-opt

Review URL: https://codereview.chromium.org/1086083002

Cr-Commit-Position: refs/heads/master@{#27846}
parent 0179ec57
......@@ -1285,6 +1285,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
__ push(r1); // Enumerable.
__ push(r3); // Current entry.
__ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION);
PrepareForBailoutForId(stmt->FilterId(), TOS_REG);
__ mov(r3, Operand(r0), SetCC);
__ b(eq, loop_statement.continue_label());
......
......@@ -1272,6 +1272,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// just skip it.
__ Push(x1, x3);
__ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION);
PrepareForBailoutForId(stmt->FilterId(), TOS_REG);
__ Mov(x3, x0);
__ Cbz(x0, loop_statement.continue_label());
......
......@@ -921,12 +921,13 @@ class ForInStatement FINAL : public ForEachStatement {
ForInType for_in_type() const { return for_in_type_; }
void set_for_in_type(ForInType type) { for_in_type_ = type; }
static int num_ids() { return parent_num_ids() + 5; }
static int num_ids() { return parent_num_ids() + 6; }
BailoutId BodyId() const { return BailoutId(local_id(0)); }
BailoutId PrepareId() const { return BailoutId(local_id(1)); }
BailoutId EnumId() const { return BailoutId(local_id(2)); }
BailoutId ToObjectId() const { return BailoutId(local_id(3)); }
BailoutId AssignmentId() const { return BailoutId(local_id(4)); }
BailoutId FilterId() const { return BailoutId(local_id(4)); }
BailoutId AssignmentId() const { return BailoutId(local_id(5)); }
BailoutId ContinueId() const OVERRIDE { return EntryId(); }
BailoutId StackCheckId() const OVERRIDE { return BodyId(); }
......
......@@ -1270,8 +1270,7 @@ void AstGraphBuilder::VisitForInBody(ForInStatement* stmt) {
// is gone.
Node* res = NewNode(javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS),
function, obj, value);
// TODO(jarin): provide real bailout id.
PrepareFrameState(res, BailoutId::None());
PrepareFrameState(res, stmt->FilterId(), OutputFrameStateCombine::Push());
Node* property_missing =
NewNode(javascript()->StrictEqual(), res, jsgraph()->ZeroConstant());
{
......
......@@ -1210,6 +1210,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
__ push(ecx); // Enumerable.
__ push(ebx); // Current entry.
__ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION);
PrepareForBailoutForId(stmt->FilterId(), TOS_REG);
__ test(eax, eax);
__ j(equal, loop_statement.continue_label());
__ mov(ebx, eax);
......
......@@ -1273,6 +1273,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// just skip it.
__ Push(a1, a3); // Enumerable and current entry.
__ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION);
PrepareForBailoutForId(stmt->FilterId(), TOS_REG);
__ mov(a3, result_register());
__ Branch(loop_statement.continue_label(), eq, a3, Operand(zero_reg));
......
......@@ -1269,6 +1269,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// just skip it.
__ Push(a1, a3); // Enumerable and current entry.
__ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION);
PrepareForBailoutForId(stmt->FilterId(), TOS_REG);
__ mov(a3, result_register());
__ Branch(loop_statement.continue_label(), eq, a3, Operand(zero_reg));
......
......@@ -1241,6 +1241,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// just skip it.
__ Push(r4, r6); // Enumerable and current entry.
__ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION);
PrepareForBailoutForId(stmt->FilterId(), TOS_REG);
__ mr(r6, r3);
__ cmpi(r6, Operand::Zero());
__ beq(loop_statement.continue_label());
......
......@@ -1244,6 +1244,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
__ Push(rcx); // Enumerable.
__ Push(rbx); // Current entry.
__ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION);
PrepareForBailoutForId(stmt->FilterId(), TOS_REG);
__ Cmp(rax, Smi::FromInt(0));
__ j(equal, loop_statement.continue_label());
__ movp(rbx, rax);
......
......@@ -1199,6 +1199,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
__ push(ecx); // Enumerable.
__ push(ebx); // Current entry.
__ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION);
PrepareForBailoutForId(stmt->FilterId(), TOS_REG);
__ test(eax, eax);
__ j(equal, loop_statement.continue_label());
__ mov(ebx, eax);
......
......@@ -113,9 +113,6 @@
'debug-listbreakpoints': [PASS, NO_VARIANTS], # arm64 nosnap with turbofan
'debug-enable-disable-breakpoints': [PASS, NO_VARIANTS], #arm64 nosnap with turbofan.
# TODO(jarin): Fix for-in deopt points in turbofan.
'for-in-opt': [PASS, NO_VARIANTS],
# TODO(mstarzinger): Optimizing top-level code flushed out some correctness
# issues on ARM and ARM64.
'es6/math-log2-log10': [PASS, NO_VARIANTS], # on ARM and ARM64.
......
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