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

Side by Side Diff: src/compiler/js-generic-lowering.cc

Issue 1067193004: [TurboFan] Fixed handling of CcompareIC return type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 | « 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/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/code-stubs.h" 6 #include "src/code-stubs.h"
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/js-generic-lowering.h" 8 #include "src/compiler/js-generic-lowering.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 return result; 116 return result;
117 } 117 }
118 118
119 119
120 void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token) { 120 void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token) {
121 Callable callable = CodeFactory::CompareIC(isolate(), token); 121 Callable callable = CodeFactory::CompareIC(isolate(), token);
122 CallDescriptor* desc_compare = Linkage::GetStubCallDescriptor( 122 CallDescriptor* desc_compare = Linkage::GetStubCallDescriptor(
123 isolate(), zone(), callable.descriptor(), 0, 123 isolate(), zone(), callable.descriptor(), 0,
124 CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node), 124 CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node),
125 Operator::kNoProperties, kMachInt32); 125 Operator::kNoProperties, kMachIntPtr);
126 126
127 // Create a new call node asking a CompareIC for help. 127 // Create a new call node asking a CompareIC for help.
128 NodeVector inputs(zone()); 128 NodeVector inputs(zone());
129 inputs.reserve(node->InputCount() + 1); 129 inputs.reserve(node->InputCount() + 1);
130 inputs.push_back(jsgraph()->HeapConstant(callable.code())); 130 inputs.push_back(jsgraph()->HeapConstant(callable.code()));
131 inputs.push_back(NodeProperties::GetValueInput(node, 0)); 131 inputs.push_back(NodeProperties::GetValueInput(node, 0));
132 inputs.push_back(NodeProperties::GetValueInput(node, 1)); 132 inputs.push_back(NodeProperties::GetValueInput(node, 1));
133 inputs.push_back(NodeProperties::GetContextInput(node)); 133 inputs.push_back(NodeProperties::GetContextInput(node));
134 if (node->op()->HasProperty(Operator::kPure)) { 134 if (node->op()->HasProperty(Operator::kPure)) {
135 // A pure (strict) comparison doesn't have an effect, control or frame 135 // A pure (strict) comparison doesn't have an effect, control or frame
136 // state. But for the graph, we need to add control and effect inputs. 136 // state. But for the graph, we need to add control and effect inputs.
137 DCHECK(OperatorProperties::GetFrameStateInputCount(node->op()) == 0); 137 DCHECK(OperatorProperties::GetFrameStateInputCount(node->op()) == 0);
138 inputs.push_back(graph()->start()); 138 inputs.push_back(graph()->start());
139 inputs.push_back(graph()->start()); 139 inputs.push_back(graph()->start());
140 } else { 140 } else {
141 DCHECK((OperatorProperties::GetFrameStateInputCount(node->op()) == 1) == 141 DCHECK((OperatorProperties::GetFrameStateInputCount(node->op()) == 1) ==
142 FLAG_turbo_deoptimization); 142 FLAG_turbo_deoptimization);
143 if (FLAG_turbo_deoptimization) { 143 if (FLAG_turbo_deoptimization) {
144 inputs.push_back(NodeProperties::GetFrameStateInput(node, 0)); 144 inputs.push_back(NodeProperties::GetFrameStateInput(node, 0));
145 } 145 }
146 inputs.push_back(NodeProperties::GetEffectInput(node)); 146 inputs.push_back(NodeProperties::GetEffectInput(node));
147 inputs.push_back(NodeProperties::GetControlInput(node)); 147 inputs.push_back(NodeProperties::GetControlInput(node));
148 } 148 }
149 Node* compare = 149 Node* compare =
150 graph()->NewNode(common()->Call(desc_compare), 150 graph()->NewNode(common()->Call(desc_compare),
151 static_cast<int>(inputs.size()), &inputs.front()); 151 static_cast<int>(inputs.size()), &inputs.front());
152 NodeProperties::SetBounds(
153 compare, Bounds(Type::None(zone()), Type::UntaggedSigned(zone())));
154 152
155 // Decide how the return value from the above CompareIC can be converted into 153 // Decide how the return value from the above CompareIC can be converted into
156 // a JavaScript boolean oddball depending on the given token. 154 // a JavaScript boolean oddball depending on the given token.
157 Node* false_value = jsgraph()->FalseConstant(); 155 Node* false_value = jsgraph()->FalseConstant();
158 Node* true_value = jsgraph()->TrueConstant(); 156 Node* true_value = jsgraph()->TrueConstant();
159 const Operator* op = nullptr; 157 const Operator* op = nullptr;
160 switch (token) { 158 switch (token) {
161 case Token::EQ: // a == 0 159 case Token::EQ: // a == 0
162 case Token::EQ_STRICT: 160 case Token::EQ_STRICT:
163 op = machine()->WordEqual(); 161 op = machine()->WordEqual();
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 } 545 }
548 546
549 547
550 MachineOperatorBuilder* JSGenericLowering::machine() const { 548 MachineOperatorBuilder* JSGenericLowering::machine() const {
551 return jsgraph()->machine(); 549 return jsgraph()->machine();
552 } 550 }
553 551
554 } // namespace compiler 552 } // namespace compiler
555 } // namespace internal 553 } // namespace internal
556 } // namespace v8 554 } // 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