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

Side by Side Diff: test/cctest/compiler/test-js-typed-lowering.cc

Issue 983153002: [turbofan] Add an extra frame state for deoptimization before binary op. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tweak Created 5 years, 9 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
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/js-graph.h" 5 #include "src/compiler/js-graph.h"
6 #include "src/compiler/js-typed-lowering.h" 6 #include "src/compiler/js-typed-lowering.h"
7 #include "src/compiler/machine-operator.h" 7 #include "src/compiler/machine-operator.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 #include "src/compiler/opcodes.h" 9 #include "src/compiler/opcodes.h"
10 #include "src/compiler/operator-properties.h" 10 #include "src/compiler/operator-properties.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 Node* ReduceUnop(const Operator* op, Type* input_type) { 106 Node* ReduceUnop(const Operator* op, Type* input_type) {
107 return reduce(Unop(op, Parameter(input_type))); 107 return reduce(Unop(op, Parameter(input_type)));
108 } 108 }
109 109
110 Node* ReduceBinop(const Operator* op, Type* left_type, Type* right_type) { 110 Node* ReduceBinop(const Operator* op, Type* left_type, Type* right_type) {
111 return reduce(Binop(op, Parameter(left_type, 0), Parameter(right_type, 1))); 111 return reduce(Binop(op, Parameter(left_type, 0), Parameter(right_type, 1)));
112 } 112 }
113 113
114 Node* Binop(const Operator* op, Node* left, Node* right) { 114 Node* Binop(const Operator* op, Node* left, Node* right) {
115 // JS binops also require context, effect, and control 115 // JS binops also require context, effect, and control
116 if (OperatorProperties::HasFrameStateInput(op)) { 116 if (OperatorProperties::GetFrameStateInputCount(op) == 1) {
117 return graph.NewNode(op, left, right, context(), 117 return graph.NewNode(op, left, right, context(),
118 EmptyFrameState(context()), start(), control()); 118 EmptyFrameState(context()), start(), control());
119 } else if (OperatorProperties::GetFrameStateInputCount(op) == 2) {
120 return graph.NewNode(op, left, right, context(),
121 EmptyFrameState(context()),
122 EmptyFrameState(context()), start(), control());
119 } else { 123 } else {
120 return graph.NewNode(op, left, right, context(), start(), control()); 124 return graph.NewNode(op, left, right, context(), start(), control());
121 } 125 }
122 } 126 }
123 127
124 Node* Unop(const Operator* op, Node* input) { 128 Node* Unop(const Operator* op, Node* input) {
125 // JS unops also require context, effect, and control 129 // JS unops also require context, effect, and control
126 if (OperatorProperties::HasFrameStateInput(op)) { 130 if (OperatorProperties::GetFrameStateInputCount(op) > 0) {
131 DCHECK(OperatorProperties::GetFrameStateInputCount(op) == 1);
127 return graph.NewNode(op, input, context(), EmptyFrameState(context()), 132 return graph.NewNode(op, input, context(), EmptyFrameState(context()),
128 start(), control()); 133 start(), control());
129 } else { 134 } else {
130 return graph.NewNode(op, input, context(), start(), control()); 135 return graph.NewNode(op, input, context(), start(), control());
131 } 136 }
132 } 137 }
133 138
134 Node* UseForEffect(Node* node) { 139 Node* UseForEffect(Node* node) {
135 // TODO(titzer): use EffectPhi after fixing EffectCount 140 // TODO(titzer): use EffectPhi after fixing EffectCount
136 if (OperatorProperties::HasFrameStateInput(javascript.ToNumber())) { 141 if (OperatorProperties::GetFrameStateInputCount(javascript.ToNumber()) >
142 0) {
143 DCHECK(OperatorProperties::GetFrameStateInputCount(
144 javascript.ToNumber()) == 1);
137 return graph.NewNode(javascript.ToNumber(), node, context(), 145 return graph.NewNode(javascript.ToNumber(), node, context(),
138 EmptyFrameState(context()), node, control()); 146 EmptyFrameState(context()), node, control());
139 } else { 147 } else {
140 return graph.NewNode(javascript.ToNumber(), node, context(), node, 148 return graph.NewNode(javascript.ToNumber(), node, context(), node,
141 control()); 149 control());
142 } 150 }
143 } 151 }
144 152
145 void CheckEffectInput(Node* effect, Node* use) { 153 void CheckEffectInput(Node* effect, Node* use) {
146 CHECK_EQ(effect, NodeProperties::GetEffectInput(use)); 154 CHECK_EQ(effect, NodeProperties::GetEffectInput(use));
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 749
742 Node* effect_use = NULL; 750 Node* effect_use = NULL;
743 for (int i = 0; i < 10; i++) { 751 for (int i = 0; i < 10; i++) {
744 Node* p0 = R.Parameter(Type::Number()); 752 Node* p0 = R.Parameter(Type::Number());
745 Node* ton = R.Unop(R.javascript.ToNumber(), p0); 753 Node* ton = R.Unop(R.javascript.ToNumber(), p0);
746 Node* frame_state = R.EmptyFrameState(R.context()); 754 Node* frame_state = R.EmptyFrameState(R.context());
747 effect_use = NULL; 755 effect_use = NULL;
748 756
749 switch (i) { 757 switch (i) {
750 case 0: 758 case 0:
751 // TODO(jarin) Replace with a query of FLAG_turbo_deoptimization. 759 if (FLAG_turbo_deoptimization) {
752 if (OperatorProperties::HasFrameStateInput(R.javascript.ToNumber())) { 760 DCHECK(OperatorProperties::GetFrameStateInputCount(
761 R.javascript.ToNumber()) == 1);
753 effect_use = R.graph.NewNode(R.javascript.ToNumber(), p0, R.context(), 762 effect_use = R.graph.NewNode(R.javascript.ToNumber(), p0, R.context(),
754 frame_state, ton, R.start()); 763 frame_state, ton, R.start());
755 } else { 764 } else {
756 effect_use = R.graph.NewNode(R.javascript.ToNumber(), p0, R.context(), 765 effect_use = R.graph.NewNode(R.javascript.ToNumber(), p0, R.context(),
757 ton, R.start()); 766 ton, R.start());
758 } 767 }
759 break; 768 break;
760 case 1: 769 case 1:
761 // TODO(jarin) Replace with a query of FLAG_turbo_deoptimization. 770 if (FLAG_turbo_deoptimization) {
762 if (OperatorProperties::HasFrameStateInput(R.javascript.ToNumber())) { 771 DCHECK(OperatorProperties::GetFrameStateInputCount(
772 R.javascript.ToNumber()) == 1);
763 effect_use = 773 effect_use =
764 R.graph.NewNode(R.javascript.ToNumber(), ton, R.context(), 774 R.graph.NewNode(R.javascript.ToNumber(), ton, R.context(),
765 frame_state, ton, R.start()); 775 frame_state, ton, R.start());
766 } else { 776 } else {
767 effect_use = R.graph.NewNode(R.javascript.ToNumber(), ton, 777 effect_use = R.graph.NewNode(R.javascript.ToNumber(), ton,
768 R.context(), ton, R.start()); 778 R.context(), ton, R.start());
769 } 779 }
770 break; 780 break;
771 case 2: 781 case 2:
772 effect_use = R.graph.NewNode(R.common.EffectPhi(1), ton, R.start()); 782 effect_use = R.graph.NewNode(R.common.EffectPhi(1), ton, R.start());
773 case 3: 783 case 3:
774 effect_use = R.graph.NewNode(R.javascript.Add(), ton, ton, R.context(), 784 effect_use = R.graph.NewNode(R.javascript.Add(), ton, ton, R.context(),
775 frame_state, ton, R.start()); 785 frame_state, frame_state, ton, R.start());
776 break; 786 break;
777 case 4: 787 case 4:
778 effect_use = R.graph.NewNode(R.javascript.Add(), p0, p0, R.context(), 788 effect_use = R.graph.NewNode(R.javascript.Add(), p0, p0, R.context(),
779 frame_state, ton, R.start()); 789 frame_state, frame_state, ton, R.start());
780 break; 790 break;
781 case 5: 791 case 5:
782 effect_use = R.graph.NewNode(R.common.Return(), p0, ton, R.start()); 792 effect_use = R.graph.NewNode(R.common.Return(), p0, ton, R.start());
783 break; 793 break;
784 case 6: 794 case 6:
785 effect_use = R.graph.NewNode(R.common.Return(), ton, ton, R.start()); 795 effect_use = R.graph.NewNode(R.common.Return(), ton, ton, R.start());
786 } 796 }
787 797
788 R.CheckEffectInput(R.start(), ton); 798 R.CheckEffectInput(R.start(), ton);
789 if (effect_use != NULL) R.CheckEffectInput(ton, effect_use); 799 if (effect_use != NULL) R.CheckEffectInput(ton, effect_use);
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 CHECK_EQ(p1, r->InputAt(0)); 1291 CHECK_EQ(p1, r->InputAt(0));
1282 CHECK_EQ(p0, r->InputAt(1)); 1292 CHECK_EQ(p0, r->InputAt(1));
1283 } else { 1293 } else {
1284 CHECK_EQ(p0, r->InputAt(0)); 1294 CHECK_EQ(p0, r->InputAt(0));
1285 CHECK_EQ(p1, r->InputAt(1)); 1295 CHECK_EQ(p1, r->InputAt(1));
1286 } 1296 }
1287 } 1297 }
1288 } 1298 }
1289 } 1299 }
1290 } 1300 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/simplified-graph-builder.cc ('k') | test/unittests/compiler/js-operator-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698