HIR refactoring.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6910 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 16cc5283
...@@ -346,7 +346,7 @@ void LAccessArgumentsAt::PrintDataTo(StringStream* stream) { ...@@ -346,7 +346,7 @@ void LAccessArgumentsAt::PrintDataTo(StringStream* stream) {
} }
void LStoreNamed::PrintDataTo(StringStream* stream) { void LStoreNamedField::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream); object()->PrintTo(stream);
stream->Add("."); stream->Add(".");
stream->Add(*String::cast(*name())->ToCString()); stream->Add(*String::cast(*name())->ToCString());
...@@ -355,7 +355,25 @@ void LStoreNamed::PrintDataTo(StringStream* stream) { ...@@ -355,7 +355,25 @@ void LStoreNamed::PrintDataTo(StringStream* stream) {
} }
void LStoreKeyed::PrintDataTo(StringStream* stream) { void LStoreNamedGeneric::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
stream->Add(".");
stream->Add(*String::cast(*name())->ToCString());
stream->Add(" <- ");
value()->PrintTo(stream);
}
void LStoreKeyedFastElement::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
stream->Add("[");
key()->PrintTo(stream);
stream->Add("] <- ");
value()->PrintTo(stream);
}
void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream); object()->PrintTo(stream);
stream->Add("["); stream->Add("[");
key()->PrintTo(stream); key()->PrintTo(stream);
......
...@@ -42,8 +42,6 @@ class LCodeGen; ...@@ -42,8 +42,6 @@ class LCodeGen;
#define LITHIUM_ALL_INSTRUCTION_LIST(V) \ #define LITHIUM_ALL_INSTRUCTION_LIST(V) \
V(ControlInstruction) \ V(ControlInstruction) \
V(Call) \ V(Call) \
V(StoreKeyed) \
V(StoreNamed) \
LITHIUM_CONCRETE_INSTRUCTION_LIST(V) LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
...@@ -1523,32 +1521,22 @@ class LSmiUntag: public LTemplateInstruction<1, 1, 0> { ...@@ -1523,32 +1521,22 @@ class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
}; };
class LStoreNamed: public LTemplateInstruction<0, 2, 0> { class LStoreNamedField: public LTemplateInstruction<0, 2, 0> {
public: public:
LStoreNamed(LOperand* obj, LOperand* val) { LStoreNamedField(LOperand* obj, LOperand* val) {
inputs_[0] = obj; inputs_[0] = obj;
inputs_[1] = val; inputs_[1] = val;
} }
DECLARE_INSTRUCTION(StoreNamed) DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
DECLARE_HYDROGEN_ACCESSOR(StoreNamed) DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
virtual void PrintDataTo(StringStream* stream); virtual void PrintDataTo(StringStream* stream);
LOperand* object() { return inputs_[0]; } LOperand* object() { return inputs_[0]; }
LOperand* value() { return inputs_[1]; } LOperand* value() { return inputs_[1]; }
Handle<Object> name() const { return hydrogen()->name(); }
};
class LStoreNamedField: public LStoreNamed {
public:
LStoreNamedField(LOperand* obj, LOperand* val)
: LStoreNamed(obj, val) { }
DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
Handle<Object> name() const { return hydrogen()->name(); }
bool is_in_object() { return hydrogen()->is_in_object(); } bool is_in_object() { return hydrogen()->is_in_object(); }
int offset() { return hydrogen()->offset(); } int offset() { return hydrogen()->offset(); }
bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); } bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); }
...@@ -1556,25 +1544,35 @@ class LStoreNamedField: public LStoreNamed { ...@@ -1556,25 +1544,35 @@ class LStoreNamedField: public LStoreNamed {
}; };
class LStoreNamedGeneric: public LStoreNamed { class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
public: public:
LStoreNamedGeneric(LOperand* obj, LOperand* val) LStoreNamedGeneric(LOperand* obj, LOperand* val) {
: LStoreNamed(obj, val) { } inputs_[0] = obj;
inputs_[1] = val;
}
DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic") DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric) DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
virtual void PrintDataTo(StringStream* stream);
LOperand* object() { return inputs_[0]; }
LOperand* value() { return inputs_[1]; }
Handle<Object> name() const { return hydrogen()->name(); }
}; };
class LStoreKeyed: public LTemplateInstruction<0, 3, 0> { class LStoreKeyedFastElement: public LTemplateInstruction<0, 3, 0> {
public: public:
LStoreKeyed(LOperand* obj, LOperand* key, LOperand* val) { LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) {
inputs_[0] = obj; inputs_[0] = obj;
inputs_[1] = key; inputs_[1] = key;
inputs_[2] = val; inputs_[2] = val;
} }
DECLARE_INSTRUCTION(StoreKeyed) DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
"store-keyed-fast-element")
DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
virtual void PrintDataTo(StringStream* stream); virtual void PrintDataTo(StringStream* stream);
...@@ -1584,23 +1582,21 @@ class LStoreKeyed: public LTemplateInstruction<0, 3, 0> { ...@@ -1584,23 +1582,21 @@ class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
}; };
class LStoreKeyedFastElement: public LStoreKeyed { class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
public: public:
LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* val) {
: LStoreKeyed(obj, key, val) {} inputs_[0] = obj;
inputs_[1] = key;
DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, inputs_[2] = val;
"store-keyed-fast-element") }
DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
};
DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
class LStoreKeyedGeneric: public LStoreKeyed { virtual void PrintDataTo(StringStream* stream);
public:
LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* val)
: LStoreKeyed(obj, key, val) { }
DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic") LOperand* object() { return inputs_[0]; }
LOperand* key() { return inputs_[1]; }
LOperand* value() { return inputs_[2]; }
}; };
......
...@@ -284,33 +284,6 @@ void HValue::SetOperandAt(int index, HValue* value) { ...@@ -284,33 +284,6 @@ void HValue::SetOperandAt(int index, HValue* value) {
} }
void HLoadKeyedGeneric::InternalSetOperandAt(int index, HValue* value) {
if (index < 2) {
operands_[index] = value;
} else {
context_ = value;
}
}
void HStoreKeyedGeneric::InternalSetOperandAt(int index, HValue* value) {
if (index < 3) {
operands_[index] = value;
} else {
context_ = value;
}
}
void HStoreNamedGeneric::InternalSetOperandAt(int index, HValue* value) {
if (index < 2) {
operands_[index] = value;
} else {
context_ = value;
}
}
void HValue::ReplaceAndDelete(HValue* other) { void HValue::ReplaceAndDelete(HValue* other) {
ReplaceValue(other); ReplaceValue(other);
Delete(); Delete();
...@@ -564,15 +537,10 @@ void HInstruction::Verify() { ...@@ -564,15 +537,10 @@ void HInstruction::Verify() {
#endif #endif
void HCall::PrintDataTo(StringStream* stream) {
stream->Add("#%d", argument_count());
}
void HUnaryCall::PrintDataTo(StringStream* stream) { void HUnaryCall::PrintDataTo(StringStream* stream) {
value()->PrintNameTo(stream); value()->PrintNameTo(stream);
stream->Add(" "); stream->Add(" ");
HCall::PrintDataTo(stream); stream->Add("#%d", argument_count());
} }
...@@ -581,7 +549,7 @@ void HBinaryCall::PrintDataTo(StringStream* stream) { ...@@ -581,7 +549,7 @@ void HBinaryCall::PrintDataTo(StringStream* stream) {
stream->Add(" "); stream->Add(" ");
second()->PrintNameTo(stream); second()->PrintNameTo(stream);
stream->Add(" "); stream->Add(" ");
HCall::PrintDataTo(stream); stream->Add("#%d", argument_count());
} }
...@@ -591,7 +559,7 @@ void HCallConstantFunction::PrintDataTo(StringStream* stream) { ...@@ -591,7 +559,7 @@ void HCallConstantFunction::PrintDataTo(StringStream* stream) {
} else { } else {
stream->Add("%o ", function()->shared()->DebugName()); stream->Add("%o ", function()->shared()->DebugName());
} }
HCall::PrintDataTo(stream); stream->Add("#%d", argument_count());
} }
...@@ -609,13 +577,13 @@ void HCallGlobal::PrintDataTo(StringStream* stream) { ...@@ -609,13 +577,13 @@ void HCallGlobal::PrintDataTo(StringStream* stream) {
void HCallKnownGlobal::PrintDataTo(StringStream* stream) { void HCallKnownGlobal::PrintDataTo(StringStream* stream) {
stream->Add("o ", target()->shared()->DebugName()); stream->Add("o ", target()->shared()->DebugName());
HCall::PrintDataTo(stream); stream->Add("#%d", argument_count());
} }
void HCallRuntime::PrintDataTo(StringStream* stream) { void HCallRuntime::PrintDataTo(StringStream* stream) {
stream->Add("%o ", *name()); stream->Add("%o ", *name());
HCall::PrintDataTo(stream); stream->Add("#%d", argument_count());
} }
...@@ -1162,7 +1130,15 @@ void HLoadNamedField::PrintDataTo(StringStream* stream) { ...@@ -1162,7 +1130,15 @@ void HLoadNamedField::PrintDataTo(StringStream* stream) {
} }
void HLoadKeyed::PrintDataTo(StringStream* stream) { void HLoadKeyedFastElement::PrintDataTo(StringStream* stream) {
object()->PrintNameTo(stream);
stream->Add("[");
key()->PrintNameTo(stream);
stream->Add("]");
}
void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) {
object()->PrintNameTo(stream); object()->PrintNameTo(stream);
stream->Add("["); stream->Add("[");
key()->PrintNameTo(stream); key()->PrintNameTo(stream);
...@@ -1178,7 +1154,7 @@ void HLoadPixelArrayElement::PrintDataTo(StringStream* stream) { ...@@ -1178,7 +1154,7 @@ void HLoadPixelArrayElement::PrintDataTo(StringStream* stream) {
} }
void HStoreNamed::PrintDataTo(StringStream* stream) { void HStoreNamedGeneric::PrintDataTo(StringStream* stream) {
object()->PrintNameTo(stream); object()->PrintNameTo(stream);
stream->Add("."); stream->Add(".");
ASSERT(name()->IsString()); ASSERT(name()->IsString());
...@@ -1189,14 +1165,28 @@ void HStoreNamed::PrintDataTo(StringStream* stream) { ...@@ -1189,14 +1165,28 @@ void HStoreNamed::PrintDataTo(StringStream* stream) {
void HStoreNamedField::PrintDataTo(StringStream* stream) { void HStoreNamedField::PrintDataTo(StringStream* stream) {
HStoreNamed::PrintDataTo(stream); object()->PrintNameTo(stream);
stream->Add(".");
ASSERT(name()->IsString());
stream->Add(*String::cast(*name())->ToCString());
stream->Add(" = ");
value()->PrintNameTo(stream);
if (!transition().is_null()) { if (!transition().is_null()) {
stream->Add(" (transition map %p)", *transition()); stream->Add(" (transition map %p)", *transition());
} }
} }
void HStoreKeyed::PrintDataTo(StringStream* stream) { void HStoreKeyedFastElement::PrintDataTo(StringStream* stream) {
object()->PrintNameTo(stream);
stream->Add("[");
key()->PrintNameTo(stream);
stream->Add("] = ");
value()->PrintNameTo(stream);
}
void HStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
object()->PrintNameTo(stream); object()->PrintNameTo(stream);
stream->Add("["); stream->Add("[");
key()->PrintNameTo(stream); key()->PrintNameTo(stream);
......
This diff is collapsed.
...@@ -2258,7 +2258,8 @@ void HGraphBuilder::PushAndAdd(HInstruction* instr) { ...@@ -2258,7 +2258,8 @@ void HGraphBuilder::PushAndAdd(HInstruction* instr) {
} }
void HGraphBuilder::PreProcessCall(HCall* call) { template <int V>
HInstruction* HGraphBuilder::PreProcessCall(HCall<V>* call) {
int count = call->argument_count(); int count = call->argument_count();
ZoneList<HValue*> arguments(count); ZoneList<HValue*> arguments(count);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
...@@ -2268,6 +2269,7 @@ void HGraphBuilder::PreProcessCall(HCall* call) { ...@@ -2268,6 +2269,7 @@ void HGraphBuilder::PreProcessCall(HCall* call) {
while (!arguments.is_empty()) { while (!arguments.is_empty()) {
AddInstruction(new HPushArgument(arguments.RemoveLast())); AddInstruction(new HPushArgument(arguments.RemoveLast()));
} }
return call;
} }
...@@ -3951,7 +3953,8 @@ void HGraphBuilder::HandlePolymorphicCallNamed(Call* expr, ...@@ -3951,7 +3953,8 @@ void HGraphBuilder::HandlePolymorphicCallNamed(Call* expr,
// Check for bailout, as trying to inline might fail due to bailout // Check for bailout, as trying to inline might fail due to bailout
// during hydrogen processing. // during hydrogen processing.
CHECK_BAILOUT; CHECK_BAILOUT;
HCall* call = new HCallConstantFunction(expr->target(), argument_count); HCallConstantFunction* call =
new HCallConstantFunction(expr->target(), argument_count);
call->set_position(expr->position()); call->set_position(expr->position());
PreProcessCall(call); PreProcessCall(call);
PushAndAdd(call); PushAndAdd(call);
...@@ -3968,7 +3971,7 @@ void HGraphBuilder::HandlePolymorphicCallNamed(Call* expr, ...@@ -3968,7 +3971,7 @@ void HGraphBuilder::HandlePolymorphicCallNamed(Call* expr,
if (maps.length() == 0) { if (maps.length() == 0) {
HContext* context = new HContext; HContext* context = new HContext;
AddInstruction(context); AddInstruction(context);
HCall* call = new HCallNamed(context, name, argument_count); HCallNamed* call = new HCallNamed(context, name, argument_count);
call->set_position(expr->position()); call->set_position(expr->position());
PreProcessCall(call); PreProcessCall(call);
ast_context()->ReturnInstruction(call, expr->id()); ast_context()->ReturnInstruction(call, expr->id());
...@@ -3981,7 +3984,7 @@ void HGraphBuilder::HandlePolymorphicCallNamed(Call* expr, ...@@ -3981,7 +3984,7 @@ void HGraphBuilder::HandlePolymorphicCallNamed(Call* expr,
} else { } else {
HContext* context = new HContext; HContext* context = new HContext;
AddInstruction(context); AddInstruction(context);
HCall* call = new HCallNamed(context, name, argument_count); HCallNamed* call = new HCallNamed(context, name, argument_count);
call->set_position(expr->position()); call->set_position(expr->position());
PreProcessCall(call); PreProcessCall(call);
PushAndAdd(call); PushAndAdd(call);
...@@ -4382,7 +4385,7 @@ static bool HasCustomCallGenerator(Handle<JSFunction> function) { ...@@ -4382,7 +4385,7 @@ static bool HasCustomCallGenerator(Handle<JSFunction> function) {
void HGraphBuilder::VisitCall(Call* expr) { void HGraphBuilder::VisitCall(Call* expr) {
Expression* callee = expr->expression(); Expression* callee = expr->expression();
int argument_count = expr->arguments()->length() + 1; // Plus receiver. int argument_count = expr->arguments()->length() + 1; // Plus receiver.
HCall* call = NULL; HInstruction* call = NULL;
Property* prop = callee->AsProperty(); Property* prop = callee->AsProperty();
if (prop != NULL) { if (prop != NULL) {
...@@ -4402,9 +4405,8 @@ void HGraphBuilder::VisitCall(Call* expr) { ...@@ -4402,9 +4405,8 @@ void HGraphBuilder::VisitCall(Call* expr) {
HContext* context = new HContext; HContext* context = new HContext;
AddInstruction(context); AddInstruction(context);
call = new HCallKeyed(context, key, argument_count); call = PreProcessCall(new HCallKeyed(context, key, argument_count));
call->set_position(expr->position()); call->set_position(expr->position());
PreProcessCall(call);
Drop(1); // Key. Drop(1); // Key.
ast_context()->ReturnInstruction(call, expr->id()); ast_context()->ReturnInstruction(call, expr->id());
return; return;
...@@ -4444,7 +4446,7 @@ void HGraphBuilder::VisitCall(Call* expr) { ...@@ -4444,7 +4446,7 @@ void HGraphBuilder::VisitCall(Call* expr) {
// IC when a primitive receiver check is required. // IC when a primitive receiver check is required.
HContext* context = new HContext; HContext* context = new HContext;
AddInstruction(context); AddInstruction(context);
call = new HCallNamed(context, name, argument_count); call = PreProcessCall(new HCallNamed(context, name, argument_count));
} else { } else {
AddCheckConstantFunction(expr, receiver, receiver_map, true); AddCheckConstantFunction(expr, receiver, receiver_map, true);
...@@ -4464,7 +4466,8 @@ void HGraphBuilder::VisitCall(Call* expr) { ...@@ -4464,7 +4466,8 @@ void HGraphBuilder::VisitCall(Call* expr) {
// Check for bailout, as the TryInline call in the if condition above // Check for bailout, as the TryInline call in the if condition above
// might return false due to bailout during hydrogen processing. // might return false due to bailout during hydrogen processing.
CHECK_BAILOUT; CHECK_BAILOUT;
call = new HCallConstantFunction(expr->target(), argument_count); call = PreProcessCall(new HCallConstantFunction(expr->target(),
argument_count));
} }
} }
} else if (types != NULL && types->length() > 1) { } else if (types != NULL && types->length() > 1) {
...@@ -4475,7 +4478,7 @@ void HGraphBuilder::VisitCall(Call* expr) { ...@@ -4475,7 +4478,7 @@ void HGraphBuilder::VisitCall(Call* expr) {
} else { } else {
HContext* context = new HContext; HContext* context = new HContext;
AddInstruction(context); AddInstruction(context);
call = new HCallNamed(context, name, argument_count); call = PreProcessCall(new HCallNamed(context, name, argument_count));
} }
} else { } else {
...@@ -4536,7 +4539,8 @@ void HGraphBuilder::VisitCall(Call* expr) { ...@@ -4536,7 +4539,8 @@ void HGraphBuilder::VisitCall(Call* expr) {
// during hydrogen processing. // during hydrogen processing.
CHECK_BAILOUT; CHECK_BAILOUT;
call = new HCallKnownGlobal(expr->target(), argument_count); call = PreProcessCall(new HCallKnownGlobal(expr->target(),
argument_count));
} else { } else {
HContext* context = new HContext; HContext* context = new HContext;
AddInstruction(context); AddInstruction(context);
...@@ -4544,7 +4548,9 @@ void HGraphBuilder::VisitCall(Call* expr) { ...@@ -4544,7 +4548,9 @@ void HGraphBuilder::VisitCall(Call* expr) {
VisitExpressions(expr->arguments()); VisitExpressions(expr->arguments());
CHECK_BAILOUT; CHECK_BAILOUT;
call = new HCallGlobal(context, var->name(), argument_count); call = PreProcessCall(new HCallGlobal(context,
var->name(),
argument_count));
} }
} else { } else {
...@@ -4556,12 +4562,11 @@ void HGraphBuilder::VisitCall(Call* expr) { ...@@ -4556,12 +4562,11 @@ void HGraphBuilder::VisitCall(Call* expr) {
VisitExpressions(expr->arguments()); VisitExpressions(expr->arguments());
CHECK_BAILOUT; CHECK_BAILOUT;
call = new HCallFunction(context, argument_count); call = PreProcessCall(new HCallFunction(context, argument_count));
} }
} }
call->set_position(expr->position()); call->set_position(expr->position());
PreProcessCall(call);
ast_context()->ReturnInstruction(call, expr->id()); ast_context()->ReturnInstruction(call, expr->id());
} }
...@@ -4580,7 +4585,7 @@ void HGraphBuilder::VisitCallNew(CallNew* expr) { ...@@ -4580,7 +4585,7 @@ void HGraphBuilder::VisitCallNew(CallNew* expr) {
// to the construct call. // to the construct call.
int arg_count = expr->arguments()->length() + 1; // Plus constructor. int arg_count = expr->arguments()->length() + 1; // Plus constructor.
HValue* constructor = environment()->ExpressionStackAt(arg_count - 1); HValue* constructor = environment()->ExpressionStackAt(arg_count - 1);
HCall* call = new HCallNew(context, constructor, arg_count); HCallNew* call = new HCallNew(context, constructor, arg_count);
call->set_position(expr->position()); call->set_position(expr->position());
PreProcessCall(call); PreProcessCall(call);
ast_context()->ReturnInstruction(call, expr->id()); ast_context()->ReturnInstruction(call, expr->id());
...@@ -4629,7 +4634,7 @@ void HGraphBuilder::VisitCallRuntime(CallRuntime* expr) { ...@@ -4629,7 +4634,7 @@ void HGraphBuilder::VisitCallRuntime(CallRuntime* expr) {
Handle<String> name = expr->name(); Handle<String> name = expr->name();
int argument_count = expr->arguments()->length(); int argument_count = expr->arguments()->length();
HCall* call = new HCallRuntime(name, function, argument_count); HCallRuntime* call = new HCallRuntime(name, function, argument_count);
call->set_position(RelocInfo::kNoPosition); call->set_position(RelocInfo::kNoPosition);
Drop(argument_count); Drop(argument_count);
ast_context()->ReturnInstruction(call, expr->id()); ast_context()->ReturnInstruction(call, expr->id());
......
...@@ -729,7 +729,7 @@ class HGraphBuilder: public AstVisitor { ...@@ -729,7 +729,7 @@ class HGraphBuilder: public AstVisitor {
// Remove the arguments from the bailout environment and emit instructions // Remove the arguments from the bailout environment and emit instructions
// to push them as outgoing parameters. // to push them as outgoing parameters.
void PreProcessCall(HCall* call); template <int V> HInstruction* PreProcessCall(HCall<V>* call);
void AssumeRepresentation(HValue* value, Representation r); void AssumeRepresentation(HValue* value, Representation r);
static Representation ToRepresentation(TypeInfo info); static Representation ToRepresentation(TypeInfo info);
......
...@@ -404,7 +404,7 @@ void LChunk::MarkEmptyBlocks() { ...@@ -404,7 +404,7 @@ void LChunk::MarkEmptyBlocks() {
} }
void LStoreNamed::PrintDataTo(StringStream* stream) { void LStoreNamedField::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream); object()->PrintTo(stream);
stream->Add("."); stream->Add(".");
stream->Add(*String::cast(*name())->ToCString()); stream->Add(*String::cast(*name())->ToCString());
...@@ -413,7 +413,25 @@ void LStoreNamed::PrintDataTo(StringStream* stream) { ...@@ -413,7 +413,25 @@ void LStoreNamed::PrintDataTo(StringStream* stream) {
} }
void LStoreKeyed::PrintDataTo(StringStream* stream) { void LStoreNamedGeneric::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
stream->Add(".");
stream->Add(*String::cast(*name())->ToCString());
stream->Add(" <- ");
value()->PrintTo(stream);
}
void LStoreKeyedFastElement::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
stream->Add("[");
key()->PrintTo(stream);
stream->Add("] <- ");
value()->PrintTo(stream);
}
void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream); object()->PrintTo(stream);
stream->Add("["); stream->Add("[");
key()->PrintTo(stream); key()->PrintTo(stream);
......
...@@ -42,8 +42,6 @@ class LCodeGen; ...@@ -42,8 +42,6 @@ class LCodeGen;
#define LITHIUM_ALL_INSTRUCTION_LIST(V) \ #define LITHIUM_ALL_INSTRUCTION_LIST(V) \
V(ControlInstruction) \ V(ControlInstruction) \
V(Call) \ V(Call) \
V(StoreKeyed) \
V(StoreNamed) \
LITHIUM_CONCRETE_INSTRUCTION_LIST(V) LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
...@@ -1581,34 +1579,23 @@ class LSmiUntag: public LTemplateInstruction<1, 1, 0> { ...@@ -1581,34 +1579,23 @@ class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
}; };
class LStoreNamed: public LTemplateInstruction<0, 2, 1> { class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
public: public:
LStoreNamed(LOperand* obj, LOperand* val) { LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp) {
inputs_[0] = obj; inputs_[0] = obj;
inputs_[1] = val; inputs_[1] = val;
temps_[0] = temp;
} }
DECLARE_INSTRUCTION(StoreNamed) DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
DECLARE_HYDROGEN_ACCESSOR(StoreNamed) DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
virtual void PrintDataTo(StringStream* stream); virtual void PrintDataTo(StringStream* stream);
LOperand* object() { return inputs_[0]; } LOperand* object() { return inputs_[0]; }
LOperand* value() { return inputs_[1]; } LOperand* value() { return inputs_[1]; }
Handle<Object> name() const { return hydrogen()->name(); }
};
class LStoreNamedField: public LStoreNamed {
public:
LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp)
: LStoreNamed(obj, val) {
temps_[0] = temp;
}
DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
Handle<Object> name() const { return hydrogen()->name(); }
bool is_in_object() { return hydrogen()->is_in_object(); } bool is_in_object() { return hydrogen()->is_in_object(); }
int offset() { return hydrogen()->offset(); } int offset() { return hydrogen()->offset(); }
bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); } bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); }
...@@ -1627,6 +1614,8 @@ class LStoreNamedGeneric: public LTemplateInstruction<0, 3, 0> { ...@@ -1627,6 +1614,8 @@ class LStoreNamedGeneric: public LTemplateInstruction<0, 3, 0> {
DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic") DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric) DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
virtual void PrintDataTo(StringStream* stream);
LOperand* context() { return inputs_[0]; } LOperand* context() { return inputs_[0]; }
LOperand* object() { return inputs_[1]; } LOperand* object() { return inputs_[1]; }
LOperand* value() { return inputs_[2]; } LOperand* value() { return inputs_[2]; }
...@@ -1634,15 +1623,17 @@ class LStoreNamedGeneric: public LTemplateInstruction<0, 3, 0> { ...@@ -1634,15 +1623,17 @@ class LStoreNamedGeneric: public LTemplateInstruction<0, 3, 0> {
}; };
class LStoreKeyed: public LTemplateInstruction<0, 3, 0> { class LStoreKeyedFastElement: public LTemplateInstruction<0, 3, 0> {
public: public:
LStoreKeyed(LOperand* obj, LOperand* key, LOperand* val) { LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) {
inputs_[0] = obj; inputs_[0] = obj;
inputs_[1] = key; inputs_[1] = key;
inputs_[2] = val; inputs_[2] = val;
} }
DECLARE_INSTRUCTION(StoreKeyed) DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
"store-keyed-fast-element")
DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
virtual void PrintDataTo(StringStream* stream); virtual void PrintDataTo(StringStream* stream);
...@@ -1652,17 +1643,6 @@ class LStoreKeyed: public LTemplateInstruction<0, 3, 0> { ...@@ -1652,17 +1643,6 @@ class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
}; };
class LStoreKeyedFastElement: public LStoreKeyed {
public:
LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val)
: LStoreKeyed(obj, key, val) {}
DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
"store-keyed-fast-element")
DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
};
class LStorePixelArrayElement: public LTemplateInstruction<0, 3, 1> { class LStorePixelArrayElement: public LTemplateInstruction<0, 3, 1> {
public: public:
LStorePixelArrayElement(LOperand* external_pointer, LStorePixelArrayElement(LOperand* external_pointer,
...@@ -1699,6 +1679,8 @@ class LStoreKeyedGeneric: public LTemplateInstruction<0, 4, 0> { ...@@ -1699,6 +1679,8 @@ class LStoreKeyedGeneric: public LTemplateInstruction<0, 4, 0> {
DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic") DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
virtual void PrintDataTo(StringStream* stream);
LOperand* context() { return inputs_[0]; } LOperand* context() { return inputs_[0]; }
LOperand* object() { return inputs_[1]; } LOperand* object() { return inputs_[1]; }
LOperand* key() { return inputs_[2]; } LOperand* key() { return inputs_[2]; }
......
...@@ -405,7 +405,7 @@ void LChunk::MarkEmptyBlocks() { ...@@ -405,7 +405,7 @@ void LChunk::MarkEmptyBlocks() {
} }
void LStoreNamed::PrintDataTo(StringStream* stream) { void LStoreNamedField::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream); object()->PrintTo(stream);
stream->Add("."); stream->Add(".");
stream->Add(*String::cast(*name())->ToCString()); stream->Add(*String::cast(*name())->ToCString());
...@@ -414,7 +414,25 @@ void LStoreNamed::PrintDataTo(StringStream* stream) { ...@@ -414,7 +414,25 @@ void LStoreNamed::PrintDataTo(StringStream* stream) {
} }
void LStoreKeyed::PrintDataTo(StringStream* stream) { void LStoreNamedGeneric::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
stream->Add(".");
stream->Add(*String::cast(*name())->ToCString());
stream->Add(" <- ");
value()->PrintTo(stream);
}
void LStoreKeyedFastElement::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
stream->Add("[");
key()->PrintTo(stream);
stream->Add("] <- ");
value()->PrintTo(stream);
}
void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream); object()->PrintTo(stream);
stream->Add("["); stream->Add("[");
key()->PrintTo(stream); key()->PrintTo(stream);
......
...@@ -42,8 +42,6 @@ class LCodeGen; ...@@ -42,8 +42,6 @@ class LCodeGen;
#define LITHIUM_ALL_INSTRUCTION_LIST(V) \ #define LITHIUM_ALL_INSTRUCTION_LIST(V) \
V(ControlInstruction) \ V(ControlInstruction) \
V(Call) \ V(Call) \
V(StoreKeyed) \
V(StoreNamed) \
LITHIUM_CONCRETE_INSTRUCTION_LIST(V) LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
...@@ -1491,34 +1489,23 @@ class LSmiUntag: public LTemplateInstruction<1, 1, 0> { ...@@ -1491,34 +1489,23 @@ class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
}; };
class LStoreNamed: public LTemplateInstruction<0, 2, 1> { class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
public: public:
LStoreNamed(LOperand* object, LOperand* value) { LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
inputs_[0] = object; inputs_[0] = object;
inputs_[1] = value; inputs_[1] = value;
temps_[0] = temp;
} }
DECLARE_INSTRUCTION(StoreNamed) DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
DECLARE_HYDROGEN_ACCESSOR(StoreNamed) DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
virtual void PrintDataTo(StringStream* stream); virtual void PrintDataTo(StringStream* stream);
LOperand* object() { return inputs_[0]; } LOperand* object() { return inputs_[0]; }
LOperand* value() { return inputs_[1]; } LOperand* value() { return inputs_[1]; }
Handle<Object> name() const { return hydrogen()->name(); }
};
class LStoreNamedField: public LStoreNamed {
public:
LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp)
: LStoreNamed(object, value) {
temps_[0] = temp;
}
DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
Handle<Object> name() const { return hydrogen()->name(); }
bool is_in_object() { return hydrogen()->is_in_object(); } bool is_in_object() { return hydrogen()->is_in_object(); }
int offset() { return hydrogen()->offset(); } int offset() { return hydrogen()->offset(); }
bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); } bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); }
...@@ -1526,25 +1513,35 @@ class LStoreNamedField: public LStoreNamed { ...@@ -1526,25 +1513,35 @@ class LStoreNamedField: public LStoreNamed {
}; };
class LStoreNamedGeneric: public LStoreNamed { class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
public: public:
LStoreNamedGeneric(LOperand* object, LOperand* value) LStoreNamedGeneric(LOperand* object, LOperand* value) {
: LStoreNamed(object, value) { } inputs_[0] = object;
inputs_[1] = value;
}
DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic") DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric) DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
virtual void PrintDataTo(StringStream* stream);
LOperand* object() { return inputs_[0]; }
LOperand* value() { return inputs_[1]; }
Handle<Object> name() const { return hydrogen()->name(); }
}; };
class LStoreKeyed: public LTemplateInstruction<0, 3, 0> { class LStoreKeyedFastElement: public LTemplateInstruction<0, 3, 0> {
public: public:
LStoreKeyed(LOperand* obj, LOperand* key, LOperand* val) { LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) {
inputs_[0] = obj; inputs_[0] = obj;
inputs_[1] = key; inputs_[1] = key;
inputs_[2] = val; inputs_[2] = val;
} }
DECLARE_INSTRUCTION(StoreKeyed) DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
"store-keyed-fast-element")
DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
virtual void PrintDataTo(StringStream* stream); virtual void PrintDataTo(StringStream* stream);
...@@ -1554,17 +1551,6 @@ class LStoreKeyed: public LTemplateInstruction<0, 3, 0> { ...@@ -1554,17 +1551,6 @@ class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
}; };
class LStoreKeyedFastElement: public LStoreKeyed {
public:
LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val)
: LStoreKeyed(obj, key, val) {}
DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
"store-keyed-fast-element")
DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
};
class LStorePixelArrayElement: public LTemplateInstruction<0, 3, 0> { class LStorePixelArrayElement: public LTemplateInstruction<0, 3, 0> {
public: public:
LStorePixelArrayElement(LOperand* external_pointer, LStorePixelArrayElement(LOperand* external_pointer,
...@@ -1585,12 +1571,21 @@ class LStorePixelArrayElement: public LTemplateInstruction<0, 3, 0> { ...@@ -1585,12 +1571,21 @@ class LStorePixelArrayElement: public LTemplateInstruction<0, 3, 0> {
}; };
class LStoreKeyedGeneric: public LStoreKeyed { class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
public: public:
LStoreKeyedGeneric(LOperand* object, LOperand* key, LOperand* value) LStoreKeyedGeneric(LOperand* object, LOperand* key, LOperand* value) {
: LStoreKeyed(object, key, value) { } inputs_[0] = object;
inputs_[1] = key;
inputs_[2] = value;
}
DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic") DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
virtual void PrintDataTo(StringStream* stream);
LOperand* object() { return inputs_[0]; }
LOperand* key() { return inputs_[1]; }
LOperand* value() { return inputs_[2]; }
}; };
......
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