Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 1409933003: [turbofan] Fix frame states for CountOperation (again). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after
2584 2584
2585 void AstGraphBuilder::VisitCountOperation(CountOperation* expr) { 2585 void AstGraphBuilder::VisitCountOperation(CountOperation* expr) {
2586 DCHECK(expr->expression()->IsValidReferenceExpressionOrThis()); 2586 DCHECK(expr->expression()->IsValidReferenceExpressionOrThis());
2587 2587
2588 // Left-hand side can only be a property, a global or a variable slot. 2588 // Left-hand side can only be a property, a global or a variable slot.
2589 Property* property = expr->expression()->AsProperty(); 2589 Property* property = expr->expression()->AsProperty();
2590 LhsKind assign_type = Property::GetAssignType(property); 2590 LhsKind assign_type = Property::GetAssignType(property);
2591 2591
2592 // Reserve space for result of postfix operation. 2592 // Reserve space for result of postfix operation.
2593 bool is_postfix = expr->is_postfix() && !ast_context()->IsEffect(); 2593 bool is_postfix = expr->is_postfix() && !ast_context()->IsEffect();
2594 if (is_postfix) environment()->Push(jsgraph()->UndefinedConstant()); 2594 if (is_postfix && assign_type != VARIABLE) {
2595 environment()->Push(jsgraph()->ZeroConstant());
2596 }
2595 2597
2596 // Evaluate LHS expression and get old value. 2598 // Evaluate LHS expression and get old value.
2597 Node* old_value = NULL; 2599 Node* old_value = NULL;
2598 int stack_depth = -1; 2600 int stack_depth = -1;
2599 switch (assign_type) { 2601 switch (assign_type) {
2600 case VARIABLE: { 2602 case VARIABLE: {
2601 VariableProxy* proxy = expr->expression()->AsVariableProxy(); 2603 VariableProxy* proxy = expr->expression()->AsVariableProxy();
2602 VectorSlotPair pair = CreateVectorSlotPair(proxy->VariableFeedbackSlot()); 2604 VectorSlotPair pair = CreateVectorSlotPair(proxy->VariableFeedbackSlot());
2603 FrameStateBeforeAndAfter states(this, BeforeId(proxy)); 2605 FrameStateBeforeAndAfter states(this, BeforeId(proxy));
2604 old_value = 2606 old_value =
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2667 } 2669 }
2668 } 2670 }
2669 2671
2670 // Convert old value into a number. 2672 // Convert old value into a number.
2671 if (!is_strong(language_mode())) { 2673 if (!is_strong(language_mode())) {
2672 old_value = NewNode(javascript()->ToNumber(), old_value); 2674 old_value = NewNode(javascript()->ToNumber(), old_value);
2673 PrepareFrameState(old_value, expr->ToNumberId(), 2675 PrepareFrameState(old_value, expr->ToNumberId(),
2674 OutputFrameStateCombine::Push()); 2676 OutputFrameStateCombine::Push());
2675 } 2677 }
2676 2678
2679 // Create a proper eager frame state for the stores.
2680 environment()->Push(old_value);
2681 FrameStateBeforeAndAfter store_states(this, expr->ToNumberId());
2682 old_value = environment()->Pop();
2683
2677 // Save result for postfix expressions at correct stack depth. 2684 // Save result for postfix expressions at correct stack depth.
2678 if (is_postfix) { 2685 if (is_postfix) {
2679 environment()->Poke(stack_depth, old_value); 2686 if (assign_type != VARIABLE) {
2680 } else { 2687 environment()->Poke(stack_depth, old_value);
2681 environment()->Push(old_value); 2688 } else {
2689 environment()->Push(old_value);
2690 }
2682 } 2691 }
2683 // TODO(bmeurer): This might not match the fullcodegen in case of non VARIABLE
2684 // eager deoptimization; we will figure out when we get there.
2685 FrameStateBeforeAndAfter store_states(this, expr->ToNumberId());
2686 if (!is_postfix) old_value = environment()->Pop();
2687 2692
2688 // Create node to perform +1/-1 operation. 2693 // Create node to perform +1/-1 operation.
2689 Node* value; 2694 Node* value;
2690 { 2695 {
2691 FrameStateBeforeAndAfter states(this, BailoutId::None()); 2696 FrameStateBeforeAndAfter states(this, BailoutId::None());
2692 value = 2697 value =
2693 BuildBinaryOp(old_value, jsgraph()->OneConstant(), expr->binary_op()); 2698 BuildBinaryOp(old_value, jsgraph()->OneConstant(), expr->binary_op());
2694 // This should never deoptimize outside strong mode because otherwise we 2699 // This should never deoptimize outside strong mode because otherwise we
2695 // have converted to number before. 2700 // have converted to number before.
2696 states.AddToNode(value, is_strong(language_mode()) ? expr->ToNumberId() 2701 states.AddToNode(value, is_strong(language_mode()) ? expr->ToNumberId()
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after
4217 // Phi does not exist yet, introduce one. 4222 // Phi does not exist yet, introduce one.
4218 value = NewPhi(inputs, value, control); 4223 value = NewPhi(inputs, value, control);
4219 value->ReplaceInput(inputs - 1, other); 4224 value->ReplaceInput(inputs - 1, other);
4220 } 4225 }
4221 return value; 4226 return value;
4222 } 4227 }
4223 4228
4224 } // namespace compiler 4229 } // namespace compiler
4225 } // namespace internal 4230 } // namespace internal
4226 } // namespace v8 4231 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698