Remove the uses of the arguments from all calls.

Before, Hydrogen call instructions had uses of the PushArgument instructions
for their arguments.  These operands were unneeded, bloated the IR, and
caused calls to be the only Hydrogen instructions with an unpredictable
number of operands.

Now, PushArgument is a pure side-effecting instruction that has no uses.

Review URL: http://codereview.chromium.org/6480030

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6749 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent bbba0dbd
......@@ -290,61 +290,6 @@ void HLoadKeyedGeneric::InternalSetOperandAt(int index, HValue* value) {
}
void HCallKeyed::InternalSetOperandAt(int index, HValue* value) {
// The key and all the arguments are stored in the base class's arguments_
// vector. The context is in the object itself. Ugly.
if (index <= argument_count()) {
arguments_[index] = value;
} else {
context_ = value;
}
}
void HCallNamed::InternalSetOperandAt(int index, HValue* value) {
// The arguments are in the base class's arguments_ vector. The context
// is in the object itself.
if (index < argument_count()) {
arguments_[index] = value;
} else {
context_ = value;
}
}
void HCallFunction::InternalSetOperandAt(int index, HValue* value) {
// The arguments are in the base class's arguments_ vector. The context
// is in the object itself.
if (index < argument_count()) {
arguments_[index] = value;
} else {
context_ = value;
}
}
void HCallGlobal::InternalSetOperandAt(int index, HValue* value) {
// The arguments are in the base class's arguments_ vector. The context
// is in the object itself.
if (index < argument_count()) {
arguments_[index] = value;
} else {
context_ = value;
}
}
void HCallNew::InternalSetOperandAt(int index, HValue* value) {
// The arguments are in the base class's arguments_ vector. The context
// is in the object itself.
if (index < argument_count()) {
arguments_[index] = value;
} else {
context_ = value;
}
}
void HStoreKeyedGeneric::InternalSetOperandAt(int index, HValue* value) {
if (index < 3) {
operands_[index] = value;
......@@ -609,26 +554,64 @@ void HInstruction::Verify() {
#endif
HCall::HCall(int count) : arguments_(Zone::NewArray<HValue*>(count), count) {
for (int i = 0; i < count; ++i) arguments_[i] = NULL;
set_representation(Representation::Tagged());
SetAllSideEffects();
void HCall::PrintDataTo(StringStream* stream) const {
stream->Add("#%d", argument_count());
}
void HCall::PrintDataTo(StringStream* stream) const {
stream->Add("(");
for (int i = 0; i < arguments_.length(); ++i) {
if (i != 0) stream->Add(", ");
arguments_.at(i)->PrintNameTo(stream);
void HUnaryCall::PrintDataTo(StringStream* stream) const {
value()->PrintNameTo(stream);
stream->Add(" ");
HCall::PrintDataTo(stream);
}
void HBinaryCall::PrintDataTo(StringStream* stream) const {
first()->PrintNameTo(stream);
stream->Add(" ");
second()->PrintNameTo(stream);
stream->Add(" ");
HCall::PrintDataTo(stream);
}
void HCallConstantFunction::PrintDataTo(StringStream* stream) const {
if (IsApplyFunction()) {
stream->Add("optimized apply ");
} else {
stream->Add("%o ", function()->shared()->DebugName());
}
stream->Add(")");
HCall::PrintDataTo(stream);
}
void HCallNamed::PrintDataTo(StringStream* stream) const {
stream->Add("%o ", *name());
HUnaryCall::PrintDataTo(stream);
}
void HCallGlobal::PrintDataTo(StringStream* stream) const {
stream->Add("%o ", *name());
HUnaryCall::PrintDataTo(stream);
}
void HCallKnownGlobal::PrintDataTo(StringStream* stream) const {
stream->Add("o ", target()->shared()->DebugName());
HCall::PrintDataTo(stream);
}
void HCallRuntime::PrintDataTo(StringStream* stream) const {
stream->Add("%o ", *name());
HCall::PrintDataTo(stream);
}
void HClassOfTest::PrintDataTo(StringStream* stream) const {
stream->Add("class_of_test(");
value()->PrintTo(stream);
value()->PrintNameTo(stream);
stream->Add(", \"%o\")", *class_name());
}
......@@ -642,22 +625,6 @@ void HAccessArgumentsAt::PrintDataTo(StringStream* stream) const {
}
void HCall::SetArgumentAt(int index, HPushArgument* push_argument) {
push_argument->set_argument_index(index);
SetOperandAt(index, push_argument);
}
void HCallConstantFunction::PrintDataTo(StringStream* stream) const {
if (IsApplyFunction()) {
stream->Add("SPECIAL function: apply");
} else {
stream->Add("%s", *(function()->shared()->DebugName()->ToCString()));
}
HCall::PrintDataTo(stream);
}
void HControlInstruction::PrintDataTo(StringStream* stream) const {
if (FirstSuccessor() != NULL) {
int first_id = FirstSuccessor()->block_id();
......@@ -745,14 +712,6 @@ void HTypeofIs::PrintDataTo(StringStream* stream) const {
}
void HPushArgument::PrintDataTo(StringStream* stream) const {
HUnaryOperation::PrintDataTo(stream);
if (argument_index() != -1) {
stream->Add(" [%d]", argument_index_);
}
}
void HChange::PrintDataTo(StringStream* stream) const {
HUnaryOperation::PrintDataTo(stream);
stream->Add(" %s to %s", from_.Mnemonic(), to_.Mnemonic());
......@@ -787,44 +746,10 @@ void HCheckFunction::PrintDataTo(StringStream* stream) const {
}
void HCallKeyed::PrintDataTo(StringStream* stream) const {
stream->Add("[");
key()->PrintNameTo(stream);
stream->Add("](");
for (int i = 1; i < arguments_.length(); ++i) {
if (i != 1) stream->Add(", ");
arguments_.at(i)->PrintNameTo(stream);
}
stream->Add(")");
}
void HCallNamed::PrintDataTo(StringStream* stream) const {
SmartPointer<char> name_string = name()->ToCString();
stream->Add("%s ", *name_string);
HCall::PrintDataTo(stream);
}
void HCallGlobal::PrintDataTo(StringStream* stream) const {
SmartPointer<char> name_string = name()->ToCString();
stream->Add("%s ", *name_string);
HCall::PrintDataTo(stream);
}
void HCallRuntime::PrintDataTo(StringStream* stream) const {
SmartPointer<char> name_string = name()->ToCString();
stream->Add("%s ", *name_string);
HCall::PrintDataTo(stream);
}
void HCallStub::PrintDataTo(StringStream* stream) const {
HUnaryOperation::PrintDataTo(stream);
stream->Add(" %s(%d)",
CodeStub::MajorName(major_key_, false),
argument_count_);
stream->Add("%s ",
CodeStub::MajorName(major_key_, false));
HUnaryCall::PrintDataTo(stream);
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -706,19 +706,17 @@ class HGraphBuilder: public AstVisitor {
HBasicBlock* true_block,
HBasicBlock* false_block);
// Visit an argument and wrap it in a PushArgument instruction.
HValue* VisitArgument(Expression* expr);
// Visit an argument subexpression.
void VisitArgument(Expression* expr);
void VisitArgumentList(ZoneList<Expression*>* arguments);
void AddPhi(HPhi* phi);
void PushAndAdd(HInstruction* instr);
void PushArgumentsForStubCall(int argument_count);
// Remove the arguments from the bailout environment and emit instructions
// to push them as outgoing parameters.
void ProcessCall(HCall* call);
void PreProcessCall(HCall* call);
void AssumeRepresentation(HValue* value, Representation r);
static Representation ToRepresentation(TypeInfo info);
......
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