Commit 5081f4cc authored by mstarzinger's avatar mstarzinger Committed by Commit bot

Remove deprecated constant helpers from JSGenericLowering.

R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/761143002

Cr-Commit-Position: refs/heads/master@{#25548}
parent ffca7c03
......@@ -33,31 +33,6 @@ void JSGenericLowering::PatchInsertInput(Node* node, int index, Node* input) {
}
Node* JSGenericLowering::SmiConstant(int32_t immediate) {
return jsgraph()->SmiConstant(immediate);
}
Node* JSGenericLowering::Int32Constant(int immediate) {
return jsgraph()->Int32Constant(immediate);
}
Node* JSGenericLowering::CodeConstant(Handle<Code> code) {
return jsgraph()->HeapConstant(code);
}
Node* JSGenericLowering::FunctionConstant(Handle<JSFunction> function) {
return jsgraph()->HeapConstant(function);
}
Node* JSGenericLowering::ExternalConstant(ExternalReference ref) {
return jsgraph()->ExternalConstant(ref);
}
Reduction JSGenericLowering::Reduce(Node* node) {
switch (node->opcode()) {
#define DECLARE_CASE(x) \
......@@ -160,7 +135,7 @@ void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token,
CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node));
NodeVector inputs(zone());
inputs.reserve(node->InputCount() + 1);
inputs.push_back(CodeConstant(callable.code()));
inputs.push_back(jsgraph()->HeapConstant(callable.code()));
inputs.push_back(NodeProperties::GetValueInput(node, 0));
inputs.push_back(NodeProperties::GetValueInput(node, 1));
inputs.push_back(NodeProperties::GetContextInput(node));
......@@ -183,7 +158,7 @@ void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token,
static_cast<int>(inputs.size()), &inputs.front());
node->ReplaceInput(0, compare);
node->ReplaceInput(1, SmiConstant(token));
node->ReplaceInput(1, jsgraph()->SmiConstant(token));
if (has_frame_state) {
// Remove the frame state from inputs.
......@@ -198,7 +173,7 @@ void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable,
CallDescriptor::Flags flags) {
CallDescriptor* desc = linkage()->GetStubCallDescriptor(
callable.descriptor(), 0, flags | FlagsForNode(node));
Node* stub_code = CodeConstant(callable.code());
Node* stub_code = jsgraph()->HeapConstant(callable.code());
PatchInsertInput(node, 0, stub_code);
PatchOperator(node, common()->Call(desc));
}
......@@ -215,8 +190,8 @@ void JSGenericLowering::ReplaceWithBuiltinCall(Node* node,
// of code across native contexts. Fix this by loading from given context.
Handle<JSFunction> function(
JSFunction::cast(info()->context()->builtins()->javascript_builtin(id)));
Node* stub_code = CodeConstant(callable.code());
Node* function_node = FunctionConstant(function);
Node* stub_code = jsgraph()->HeapConstant(callable.code());
Node* function_node = jsgraph()->HeapConstant(function);
PatchInsertInput(node, 0, stub_code);
PatchInsertInput(node, 1, function_node);
PatchOperator(node, common()->Call(desc));
......@@ -231,8 +206,8 @@ void JSGenericLowering::ReplaceWithRuntimeCall(Node* node,
int nargs = (nargs_override < 0) ? fun->nargs : nargs_override;
CallDescriptor* desc =
linkage()->GetRuntimeCallDescriptor(f, nargs, properties);
Node* ref = ExternalConstant(ExternalReference(f, isolate()));
Node* arity = Int32Constant(nargs);
Node* ref = jsgraph()->ExternalConstant(ExternalReference(f, isolate()));
Node* arity = jsgraph()->Int32Constant(nargs);
PatchInsertInput(node, 0, jsgraph()->CEntryStubConstant(fun->result_size));
PatchInsertInput(node, nargs + 1, ref);
PatchInsertInput(node, nargs + 2, arity);
......@@ -311,7 +286,7 @@ void JSGenericLowering::LowerJSStoreNamed(Node* node) {
void JSGenericLowering::LowerJSDeleteProperty(Node* node) {
StrictMode strict_mode = OpParameter<StrictMode>(node);
PatchInsertInput(node, 2, SmiConstant(strict_mode));
PatchInsertInput(node, 2, jsgraph()->SmiConstant(strict_mode));
ReplaceWithBuiltinCall(node, Builtins::DELETE, 3);
}
......@@ -329,7 +304,7 @@ void JSGenericLowering::LowerJSInstanceOf(Node* node) {
CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
CallDescriptor* desc =
linkage()->GetStubCallDescriptor(d, 0, FlagsForNode(node));
Node* stub_code = CodeConstant(stub.GetCode());
Node* stub_code = jsgraph()->HeapConstant(stub.GetCode());
PatchInsertInput(node, 0, stub_code);
PatchOperator(node, common()->Call(desc));
}
......@@ -339,14 +314,15 @@ void JSGenericLowering::LowerJSLoadContext(Node* node) {
const ContextAccess& access = ContextAccessOf(node->op());
for (size_t i = 0; i < access.depth(); ++i) {
node->ReplaceInput(
0, graph()->NewNode(
machine()->Load(kMachAnyTagged),
NodeProperties::GetValueInput(node, 0),
Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)),
NodeProperties::GetEffectInput(node), graph()->start()));
0, graph()->NewNode(machine()->Load(kMachAnyTagged),
NodeProperties::GetValueInput(node, 0),
jsgraph()->Int32Constant(
Context::SlotOffset(Context::PREVIOUS_INDEX)),
NodeProperties::GetEffectInput(node),
graph()->start()));
}
node->ReplaceInput(
1, Int32Constant(Context::SlotOffset(static_cast<int>(access.index()))));
node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset(
static_cast<int>(access.index()))));
node->AppendInput(zone(), graph()->start());
PatchOperator(node, machine()->Load(kMachAnyTagged));
}
......@@ -356,15 +332,16 @@ void JSGenericLowering::LowerJSStoreContext(Node* node) {
const ContextAccess& access = ContextAccessOf(node->op());
for (size_t i = 0; i < access.depth(); ++i) {
node->ReplaceInput(
0, graph()->NewNode(
machine()->Load(kMachAnyTagged),
NodeProperties::GetValueInput(node, 0),
Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)),
NodeProperties::GetEffectInput(node), graph()->start()));
0, graph()->NewNode(machine()->Load(kMachAnyTagged),
NodeProperties::GetValueInput(node, 0),
jsgraph()->Int32Constant(
Context::SlotOffset(Context::PREVIOUS_INDEX)),
NodeProperties::GetEffectInput(node),
graph()->start()));
}
node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1));
node->ReplaceInput(
1, Int32Constant(Context::SlotOffset(static_cast<int>(access.index()))));
node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset(
static_cast<int>(access.index()))));
PatchOperator(node, machine()->Store(StoreRepresentation(kMachAnyTagged,
kFullWriteBarrier)));
}
......@@ -376,10 +353,10 @@ void JSGenericLowering::LowerJSCallConstruct(Node* node) {
CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
CallDescriptor* desc =
linkage()->GetStubCallDescriptor(d, arity, FlagsForNode(node));
Node* stub_code = CodeConstant(stub.GetCode());
Node* stub_code = jsgraph()->HeapConstant(stub.GetCode());
Node* construct = NodeProperties::GetValueInput(node, 0);
PatchInsertInput(node, 0, stub_code);
PatchInsertInput(node, 1, Int32Constant(arity - 1));
PatchInsertInput(node, 1, jsgraph()->Int32Constant(arity - 1));
PatchInsertInput(node, 2, construct);
PatchInsertInput(node, 3, jsgraph()->UndefinedConstant());
PatchOperator(node, common()->Call(desc));
......@@ -434,7 +411,7 @@ void JSGenericLowering::LowerJSCallFunction(Node* node) {
CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
CallDescriptor* desc = linkage()->GetStubCallDescriptor(
d, static_cast<int>(p.arity() - 1), FlagsForNode(node));
Node* stub_code = CodeConstant(stub.GetCode());
Node* stub_code = jsgraph()->HeapConstant(stub.GetCode());
PatchInsertInput(node, 0, stub_code);
PatchOperator(node, common()->Call(desc));
}
......
......@@ -36,13 +36,6 @@ class JSGenericLowering : public Reducer {
JS_OP_LIST(DECLARE_LOWER)
#undef DECLARE_LOWER
// Helpers to create new constant nodes.
Node* SmiConstant(int immediate);
Node* Int32Constant(int immediate);
Node* CodeConstant(Handle<Code> code);
Node* FunctionConstant(Handle<JSFunction> function);
Node* ExternalConstant(ExternalReference ref);
// Helpers to patch existing nodes in the graph.
void PatchOperator(Node* node, const Operator* new_op);
void PatchInsertInput(Node* node, int index, Node* input);
......@@ -53,6 +46,9 @@ class JSGenericLowering : public Reducer {
void ReplaceWithBuiltinCall(Node* node, Builtins::JavaScript id, int args);
void ReplaceWithRuntimeCall(Node* node, Runtime::FunctionId f, int args = -1);
// Helper for optimization of JSCallFunction.
bool TryLowerDirectJSCall(Node* node);
Zone* zone() const { return graph()->zone(); }
Isolate* isolate() const { return zone()->isolate(); }
JSGraph* jsgraph() const { return jsgraph_; }
......@@ -66,8 +62,6 @@ class JSGenericLowering : public Reducer {
CompilationInfo* info_;
JSGraph* jsgraph_;
Linkage* linkage_;
bool TryLowerDirectJSCall(Node* node);
};
} // namespace compiler
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment