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

Unified Diff: src/compiler/js-generic-lowering.cc

Issue 526953004: Lazy deoptimization for comparisons in Turbofan. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/ia32/linkage-ia32.cc ('k') | src/compiler/linkage.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-generic-lowering.cc
diff --git a/src/compiler/js-generic-lowering.cc b/src/compiler/js-generic-lowering.cc
index a2253bf53ab2be4862da414c383d89ccfaccfbde..2ff98387f7cd88d0d47ad9b9a80ad409195fb01a 100644
--- a/src/compiler/js-generic-lowering.cc
+++ b/src/compiler/js-generic-lowering.cc
@@ -300,28 +300,48 @@ void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token,
bool pure) {
BinaryOpICStub stub(isolate(), Token::ADD); // TODO(mstarzinger): Hack.
CodeStubInterfaceDescriptor* d = stub.GetInterfaceDescriptor();
+ bool has_frame_state = OperatorProperties::HasFrameStateInput(node->op());
CallDescriptor* desc_compare = linkage()->GetStubCallDescriptor(
- d, 0, CallDescriptor::kPatchableCallSiteWithNop);
+ d, 0, CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node));
Handle<Code> ic = CompareIC::GetUninitialized(isolate(), token);
- Node* compare;
+ NodeVector inputs(zone());
+ inputs.reserve(node->InputCount() + 1);
+ inputs.push_back(CodeConstant(ic));
+ inputs.push_back(NodeProperties::GetValueInput(node, 0));
+ inputs.push_back(NodeProperties::GetValueInput(node, 1));
+ inputs.push_back(NodeProperties::GetContextInput(node));
if (pure) {
- // A pure (strict) comparison doesn't have an effect or control.
- // But for the graph, we need to add these inputs.
- compare = graph()->NewNode(common()->Call(desc_compare), CodeConstant(ic),
- NodeProperties::GetValueInput(node, 0),
- NodeProperties::GetValueInput(node, 1),
- NodeProperties::GetContextInput(node),
- graph()->start(), graph()->start());
+ // A pure (strict) comparison doesn't have an effect, control or frame
+ // state. But for the graph, we need to add control and effect inputs.
+ DCHECK(!has_frame_state);
+ inputs.push_back(graph()->start());
+ inputs.push_back(graph()->start());
} else {
- compare = graph()->NewNode(common()->Call(desc_compare), CodeConstant(ic),
- NodeProperties::GetValueInput(node, 0),
- NodeProperties::GetValueInput(node, 1),
- NodeProperties::GetContextInput(node),
- NodeProperties::GetEffectInput(node),
- NodeProperties::GetControlInput(node));
+ DCHECK(has_frame_state == FLAG_turbo_deoptimization);
+ if (FLAG_turbo_deoptimization) {
+ inputs.push_back(NodeProperties::GetFrameStateInput(node));
+ }
+ inputs.push_back(NodeProperties::GetEffectInput(node));
+ inputs.push_back(NodeProperties::GetControlInput(node));
}
+ Node* compare = graph()->NewNode(common()->Call(desc_compare), inputs.size(),
+ &inputs.front());
+
node->ReplaceInput(0, compare);
node->ReplaceInput(1, SmiConstant(token));
+
+ if (has_frame_state) {
+ // Remove the frame state from inputs.
+ // TODO(jarin) This should use Node::RemoveInput (which does not exist yet).
+ int dest = NodeProperties::FirstFrameStateIndex(node);
+ for (int i = NodeProperties::PastFrameStateIndex(node);
+ i < node->InputCount(); i++) {
+ node->ReplaceInput(dest, node->InputAt(i));
+ dest++;
+ }
+ node->TrimInputCount(dest);
+ }
+
ReplaceWithRuntimeCall(node, Runtime::kBooleanize);
}
@@ -361,8 +381,7 @@ void JSGenericLowering::ReplaceWithRuntimeCall(Node* node,
Operator::Property props = node->op()->properties();
const Runtime::Function* fun = Runtime::FunctionForId(f);
int nargs = (nargs_override < 0) ? fun->nargs : nargs_override;
- CallDescriptor* desc =
- linkage()->GetRuntimeCallDescriptor(f, nargs, props, FlagsForNode(node));
+ CallDescriptor* desc = linkage()->GetRuntimeCallDescriptor(f, nargs, props);
Node* ref = ExternalConstant(ExternalReference(f, isolate()));
Node* arity = Int32Constant(nargs);
if (!centrystub_constant_.is_set()) {
« no previous file with comments | « src/compiler/ia32/linkage-ia32.cc ('k') | src/compiler/linkage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698