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