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

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

Issue 1216463003: [strong] Implement strong mode semantics for the count operation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cl feedback + eliminate runtime check Created 5 years, 5 months 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 | « src/arm64/full-codegen-arm64.cc ('k') | src/hydrogen.h » ('j') | 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/js-type-feedback.h" 10 #include "src/compiler/js-type-feedback.h"
(...skipping 2643 matching lines...) Expand 10 before | Expand all | Expand 10 after
2654 CreateVectorSlotPair(property->PropertyFeedbackSlot()); 2654 CreateVectorSlotPair(property->PropertyFeedbackSlot());
2655 old_value = BuildKeyedSuperLoad(receiver, home_object, key, pair); 2655 old_value = BuildKeyedSuperLoad(receiver, home_object, key, pair);
2656 states.AddToNode(old_value, property->LoadId(), 2656 states.AddToNode(old_value, property->LoadId(),
2657 OutputFrameStateCombine::Push()); 2657 OutputFrameStateCombine::Push());
2658 stack_depth = 3; 2658 stack_depth = 3;
2659 break; 2659 break;
2660 } 2660 }
2661 } 2661 }
2662 2662
2663 // Convert old value into a number. 2663 // Convert old value into a number.
2664 old_value = NewNode(javascript()->ToNumber(), old_value); 2664 if (!is_strong(language_mode())) {
2665 PrepareFrameState(old_value, expr->ToNumberId(), 2665 old_value = NewNode(javascript()->ToNumber(), old_value);
2666 OutputFrameStateCombine::Push()); 2666 PrepareFrameState(old_value, expr->ToNumberId(),
2667 OutputFrameStateCombine::Push());
2668 }
2667 2669
2668 // TODO(titzer): combine this framestate with the above? 2670 // TODO(titzer): combine this framestate with the above?
2669 FrameStateBeforeAndAfter store_states(this, assign_type == KEYED_PROPERTY 2671 FrameStateBeforeAndAfter store_states(this, assign_type == KEYED_PROPERTY
2670 ? expr->ToNumberId() 2672 ? expr->ToNumberId()
2671 : BailoutId::None()); 2673 : BailoutId::None());
2672 2674
2673 // Save result for postfix expressions at correct stack depth. 2675 // Save result for postfix expressions at correct stack depth.
2674 if (is_postfix) environment()->Poke(stack_depth, old_value); 2676 if (is_postfix) environment()->Poke(stack_depth, old_value);
2675 2677
2676 // Create node to perform +1/-1 operation. 2678 // Create node to perform +1/-1 operation.
2677 Node* value; 2679 Node* value;
2678 { 2680 {
2679 FrameStateBeforeAndAfter states(this, BailoutId::None()); 2681 FrameStateBeforeAndAfter states(this, BailoutId::None());
2680 value = 2682 value =
2681 BuildBinaryOp(old_value, jsgraph()->OneConstant(), expr->binary_op()); 2683 BuildBinaryOp(old_value, jsgraph()->OneConstant(), expr->binary_op());
2682 // This should never deoptimize because we have converted to number 2684 // This should never deoptimize outside strong mode because otherwise we
2683 // before. 2685 // have converted to number before.
2684 states.AddToNode(value, BailoutId::None(), 2686 states.AddToNode(value, is_strong(language_mode()) ? expr->ToNumberId()
2687 : BailoutId::None(),
2685 OutputFrameStateCombine::Ignore()); 2688 OutputFrameStateCombine::Ignore());
2686 } 2689 }
2687 2690
2688 // Store the value. 2691 // Store the value.
2689 VectorSlotPair feedback = CreateVectorSlotPair(expr->CountSlot()); 2692 VectorSlotPair feedback = CreateVectorSlotPair(expr->CountSlot());
2690 switch (assign_type) { 2693 switch (assign_type) {
2691 case VARIABLE: { 2694 case VARIABLE: {
2692 Variable* variable = expr->expression()->AsVariableProxy()->var(); 2695 Variable* variable = expr->expression()->AsVariableProxy()->var();
2693 environment()->Push(value); 2696 environment()->Push(value);
2694 BuildVariableAssignment(variable, value, expr->op(), feedback, 2697 BuildVariableAssignment(variable, value, expr->op(), feedback,
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
4171 // Phi does not exist yet, introduce one. 4174 // Phi does not exist yet, introduce one.
4172 value = NewPhi(inputs, value, control); 4175 value = NewPhi(inputs, value, control);
4173 value->ReplaceInput(inputs - 1, other); 4176 value->ReplaceInput(inputs - 1, other);
4174 } 4177 }
4175 return value; 4178 return value;
4176 } 4179 }
4177 4180
4178 } // namespace compiler 4181 } // namespace compiler
4179 } // namespace internal 4182 } // namespace internal
4180 } // namespace v8 4183 } // namespace v8
OLDNEW
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698