Revision: 6258
Author: [email protected]
Date: Tue Jan 11 03:41:01 2011
Log: Remove duplicate members from some LIR instruction by using the HIR
accessors.
Remove unused LOperands from keyed-loads. We do not have multiple
representations
for load instructions anymore.
Correct number of output operands as for a couple of instructions form 1 to
0
because they do not produce a result (e.g. PushArgument)
Review URL: http://codereview.chromium.org/6158004
http://code.google.com/p/v8/source/detail?r=6258
Modified:
/branches/bleeding_edge/src/arm/lithium-arm.cc
/branches/bleeding_edge/src/arm/lithium-arm.h
/branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
/branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
/branches/bleeding_edge/src/ia32/lithium-ia32.cc
/branches/bleeding_edge/src/ia32/lithium-ia32.h
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc Mon Jan 10 04:24:19 2011
+++ /branches/bleeding_edge/src/arm/lithium-arm.cc Tue Jan 11 03:41:01 2011
@@ -1690,23 +1690,12 @@
LInstruction* LChunkBuilder::DoLoadKeyedFastElement(
HLoadKeyedFastElement* instr) {
- Representation r = instr->representation();
- LOperand* obj = UseRegisterAtStart(instr->object());
+ ASSERT(instr->representation().IsTagged());
ASSERT(instr->key()->representation().IsInteger32());
+ LOperand* obj = UseRegisterAtStart(instr->object());
LOperand* key = UseRegisterAtStart(instr->key());
- LOperand* load_result = NULL;
- // Double needs an extra temp, because the result is converted from heap
- // number to a double register.
- if (r.IsDouble()) load_result = TempRegister();
- LInstruction* result = new LLoadKeyedFastElement(obj,
- key,
- load_result);
- if (r.IsDouble()) {
- result = DefineAsRegister(result);
- } else {
- result = DefineSameAsFirst(result);
- }
- return AssignEnvironment(result);
+ LInstruction* result = new LLoadKeyedFastElement(obj, key);
+ return AssignEnvironment(DefineSameAsFirst(result));
}
@@ -1763,13 +1752,7 @@
? UseTempRegister(instr->value())
: UseRegister(instr->value());
- return new LStoreNamedField(obj,
- instr->name(),
- val,
- instr->is_in_object(),
- instr->offset(),
- needs_write_barrier,
- instr->transition());
+ return new LStoreNamedField(obj, val);
}
@@ -1777,7 +1760,7 @@
LOperand* obj = UseFixed(instr->object(), r1);
LOperand* val = UseFixed(instr->value(), r0);
- LInstruction* result = new LStoreNamedGeneric(obj, instr->name(), val);
+ LInstruction* result = new LStoreNamedGeneric(obj, val);
return MarkAsCall(result, instr);
}
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.h Mon Jan 10 03:31:21 2011
+++ /branches/bleeding_edge/src/arm/lithium-arm.h Tue Jan 11 03:41:01 2011
@@ -1242,21 +1242,14 @@
class LLoadKeyedFastElement: public LBinaryOperation {
public:
- LLoadKeyedFastElement(LOperand* elements,
- LOperand* key,
- LOperand* load_result)
- : LBinaryOperation(elements, key),
- load_result_(load_result) { }
+ LLoadKeyedFastElement(LOperand* elements, LOperand* key)
+ : LBinaryOperation(elements, key) { }
DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element")
DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement)
LOperand* elements() const { return left(); }
LOperand* key() const { return right(); }
- LOperand* load_result() const { return load_result_; }
-
- private:
- LOperand* load_result_;
};
@@ -1492,63 +1485,46 @@
class LStoreNamed: public LInstruction {
public:
- LStoreNamed(LOperand* obj, Handle<Object> name, LOperand* val)
- : object_(obj), name_(name), value_(val) { }
+ LStoreNamed(LOperand* obj, LOperand* val)
+ : object_(obj), value_(val) { }
DECLARE_INSTRUCTION(StoreNamed)
+ DECLARE_HYDROGEN_ACCESSOR(StoreNamed)
virtual void PrintDataTo(StringStream* stream) const;
LOperand* object() const { return object_; }
- Handle<Object> name() const { return name_; }
+ Handle<Object> name() const { return hydrogen()->name(); }
LOperand* value() const { return value_; }
private:
LOperand* object_;
- Handle<Object> name_;
LOperand* value_;
};
class LStoreNamedField: public LStoreNamed {
public:
- LStoreNamedField(LOperand* obj,
- Handle<Object> name,
- LOperand* val,
- bool in_object,
- int offset,
- bool needs_write_barrier,
- Handle<Map> transition)
- : LStoreNamed(obj, name, val),
- is_in_object_(in_object),
- offset_(offset),
- needs_write_barrier_(needs_write_barrier),
- transition_(transition) { }
+ LStoreNamedField(LOperand* obj, LOperand* val)
+ : LStoreNamed(obj, val) { }
DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
-
- bool is_in_object() { return is_in_object_; }
- int offset() { return offset_; }
- bool needs_write_barrier() { return needs_write_barrier_; }
- Handle<Map> transition() const { return transition_; }
- void set_transition(Handle<Map> map) { transition_ = map; }
-
- private:
- bool is_in_object_;
- int offset_;
- bool needs_write_barrier_;
- Handle<Map> transition_;
+ DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
+
+ bool is_in_object() { return hydrogen()->is_in_object(); }
+ int offset() { return hydrogen()->offset(); }
+ bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); }
+ Handle<Map> transition() { return hydrogen()->transition(); }
};
class LStoreNamedGeneric: public LStoreNamed {
public:
- LStoreNamedGeneric(LOperand* obj,
- Handle<Object> name,
- LOperand* val)
- : LStoreNamed(obj, name, val) { }
+ LStoreNamedGeneric(LOperand* obj, LOperand* val)
+ : LStoreNamed(obj, val) { }
DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
+ DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
};
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon Jan 10
04:24:19 2011
+++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Tue Jan 11
03:41:01 2011
@@ -1636,36 +1636,19 @@
void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
Register elements = ToRegister(instr->elements());
Register key = EmitLoadRegister(instr->key(), scratch0());
- Register result;
+ Register result = ToRegister(instr->result());
Register scratch = scratch0();
-
- if (instr->load_result() != NULL) {
- result = ToRegister(instr->load_result());
- } else {
- result = ToRegister(instr->result());
- ASSERT(result.is(elements));
- }
+ ASSERT(result.is(elements));
// Load the result.
__ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2));
__ ldr(result, FieldMemOperand(scratch, FixedArray::kHeaderSize));
- Representation r = instr->hydrogen()->representation();
- if (r.IsInteger32()) {
- // Untag and check for smi.
- __ SmiUntag(result);
- DeoptimizeIf(cs, instr->environment());
- } else if (r.IsDouble()) {
- EmitNumberUntagD(result,
- ToDoubleRegister(instr->result()),
- instr->environment());
- } else {
- // Check for the hole value.
- ASSERT(r.IsTagged());
- __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex);
- __ cmp(result, scratch);
- DeoptimizeIf(eq, instr->environment());
- }
+ // Check for the hole value.
+ ASSERT(r.IsTagged());
+ __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex);
+ __ cmp(result, scratch);
+ DeoptimizeIf(eq, instr->environment());
}
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Fri Jan 7
02:37:26 2011
+++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Tue Jan 11
03:41:01 2011
@@ -2009,32 +2009,15 @@
void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
Register elements = ToRegister(instr->elements());
Register key = ToRegister(instr->key());
- Register result;
- if (instr->load_result() != NULL) {
- result = ToRegister(instr->load_result());
- } else {
- result = ToRegister(instr->result());
- ASSERT(result.is(elements));
- }
+ Register result = ToRegister(instr->result());
+ ASSERT(result.is(elements));
// Load the result.
__ mov(result, FieldOperand(elements, key, times_4,
FixedArray::kHeaderSize));
- Representation r = instr->hydrogen()->representation();
- if (r.IsInteger32()) {
- // Untag and check for smi.
- __ SmiUntag(result);
- DeoptimizeIf(carry, instr->environment());
- } else if (r.IsDouble()) {
- EmitNumberUntagD(result,
- ToDoubleRegister(instr->result()),
- instr->environment());
- } else {
- // Check for the hole value.
- ASSERT(r.IsTagged());
- __ cmp(result, Factory::the_hole_value());
- DeoptimizeIf(equal, instr->environment());
- }
+ // Check for the hole value.
+ __ cmp(result, Factory::the_hole_value());
+ DeoptimizeIf(equal, instr->environment());
}
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Mon Jan 10 04:19:15
2011
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Tue Jan 11 03:41:01
2011
@@ -1674,8 +1674,9 @@
LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
- return DefineAsRegister(
- new LLoadNamedField(UseRegisterAtStart(instr->object())));
+ ASSERT(instr->representation().IsTagged());
+ LOperand* obj = UseRegisterAtStart(instr->object());
+ return DefineAsRegister(new LLoadNamedField(obj));
}
@@ -1702,21 +1703,12 @@
LInstruction* LChunkBuilder::DoLoadKeyedFastElement(
HLoadKeyedFastElement* instr) {
- Representation r = instr->representation();
- LOperand* obj = UseRegisterAtStart(instr->object());
+ ASSERT(instr->representation().IsTagged());
ASSERT(instr->key()->representation().IsInteger32());
+ LOperand* obj = UseRegisterAtStart(instr->object());
LOperand* key = UseRegisterAtStart(instr->key());
- LOperand* load_result = NULL;
- // Double needs an extra temp, because the result is converted from heap
- // number to a double register.
- if (r.IsDouble()) load_result = TempRegister();
- LLoadKeyedFastElement* load = new LLoadKeyedFastElement(obj,
- key,
- load_result);
- LInstruction* result = r.IsDouble()
- ? DefineAsRegister(load)
- : DefineSameAsFirst(load);
- return AssignEnvironment(result);
+ LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key);
+ return AssignEnvironment(DefineSameAsFirst(result));
}
@@ -1777,14 +1769,7 @@
LOperand* temp = (!instr->is_in_object() || needs_write_barrier)
? TempRegister() : NULL;
- return new LStoreNamedField(obj,
- instr->name(),
- val,
- instr->is_in_object(),
- instr->offset(),
- temp,
- needs_write_barrier,
- instr->transition());
+ return new LStoreNamedField(obj, val, temp);
}
@@ -1792,7 +1777,7 @@
LOperand* obj = UseFixed(instr->object(), edx);
LOperand* val = UseFixed(instr->value(), eax);
- LStoreNamedGeneric* result = new LStoreNamedGeneric(obj, instr->name(),
val);
+ LStoreNamedGeneric* result = new LStoreNamedGeneric(obj, val);
return MarkAsCall(result, instr);
}
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.h Tue Jan 11 03:33:52 2011
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.h Tue Jan 11 03:41:01 2011
@@ -1103,10 +1103,10 @@
};
-class LBranch: public LUnaryOperation<1> {
+class LBranch: public LUnaryOperation<0> {
public:
LBranch(LOperand* input, int true_block_id, int false_block_id)
- : LUnaryOperation<1>(input),
+ : LUnaryOperation<0>(input),
true_block_id_(true_block_id),
false_block_id_(false_block_id) { }
@@ -1125,9 +1125,9 @@
};
-class LCmpMapAndBranch: public LUnaryOperation<1> {
+class LCmpMapAndBranch: public LUnaryOperation<0> {
public:
- explicit LCmpMapAndBranch(LOperand* value) : LUnaryOperation<1>(value) {
}
+ explicit LCmpMapAndBranch(LOperand* value) : LUnaryOperation<0>(value) {
}
DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
DECLARE_HYDROGEN_ACCESSOR(CompareMapAndBranch)
@@ -1243,9 +1243,9 @@
};
-class LReturn: public LUnaryOperation<1> {
+class LReturn: public LUnaryOperation<0> {
public:
- explicit LReturn(LOperand* use) : LUnaryOperation<1>(use) { }
+ explicit LReturn(LOperand* use) : LUnaryOperation<0>(use) { }
DECLARE_CONCRETE_INSTRUCTION(Return, "return")
};
@@ -1298,21 +1298,14 @@
class LLoadKeyedFastElement: public LBinaryOperation {
public:
- LLoadKeyedFastElement(LOperand* elements,
- LOperand* key,
- LOperand* load_result)
- : LBinaryOperation(elements, key),
- load_result_(load_result) { }
+ LLoadKeyedFastElement(LOperand* elements, LOperand* key)
+ : LBinaryOperation(elements, key) { }
DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element")
DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement)
LOperand* elements() const { return left(); }
LOperand* key() const { return right(); }
- LOperand* load_result() const { return load_result_; }
-
- private:
- LOperand* load_result_;
};
@@ -1335,18 +1328,18 @@
};
-class LStoreGlobal: public LUnaryOperation<1> {
+class LStoreGlobal: public LUnaryOperation<0> {
public:
- explicit LStoreGlobal(LOperand* value) : LUnaryOperation<1>(value) {}
+ explicit LStoreGlobal(LOperand* value) : LUnaryOperation<0>(value) {}
DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store-global")
DECLARE_HYDROGEN_ACCESSOR(StoreGlobal)
};
-class LPushArgument: public LUnaryOperation<1> {
+class LPushArgument: public LUnaryOperation<0> {
public:
- explicit LPushArgument(LOperand* argument) :
LUnaryOperation<1>(argument) {}
+ explicit LPushArgument(LOperand* argument) :
LUnaryOperation<0>(argument) {}
DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
};
@@ -1546,67 +1539,49 @@
class LStoreNamed: public LTemplateInstruction<0> {
public:
- LStoreNamed(LOperand* obj, Handle<Object> name, LOperand* val)
- : object_(obj), name_(name), value_(val) { }
+ LStoreNamed(LOperand* obj, LOperand* val) : object_(obj), value_(val) { }
DECLARE_INSTRUCTION(StoreNamed)
+ DECLARE_HYDROGEN_ACCESSOR(StoreNamed)
virtual void PrintDataTo(StringStream* stream);
LOperand* object() const { return object_; }
- Handle<Object> name() const { return name_; }
+ Handle<Object> name() const { return hydrogen()->name(); }
LOperand* value() const { return value_; }
private:
LOperand* object_;
- Handle<Object> name_;
LOperand* value_;
};
class LStoreNamedField: public LStoreNamed {
public:
- LStoreNamedField(LOperand* obj,
- Handle<Object> name,
- LOperand* val,
- bool in_object,
- int offset,
- LOperand* temp,
- bool needs_write_barrier,
- Handle<Map> transition)
- : LStoreNamed(obj, name, val),
- is_in_object_(in_object),
- offset_(offset),
- temp_(temp),
- needs_write_barrier_(needs_write_barrier),
- transition_(transition) { }
+ LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp)
+ : LStoreNamed(obj, val), temp_(temp) { }
DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
-
- bool is_in_object() { return is_in_object_; }
- int offset() { return offset_; }
+ DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
+
+ bool is_in_object() { return hydrogen()->is_in_object(); }
+ int offset() { return hydrogen()->offset(); }
LOperand* temp() { return temp_; }
- bool needs_write_barrier() { return needs_write_barrier_; }
- Handle<Map> transition() const { return transition_; }
- void set_transition(Handle<Map> map) { transition_ = map; }
+ bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); }
+ Handle<Map> transition() const { return hydrogen()->transition(); }
private:
- bool is_in_object_;
- int offset_;
LOperand* temp_;
- bool needs_write_barrier_;
- Handle<Map> transition_;
};
class LStoreNamedGeneric: public LStoreNamed {
public:
- LStoreNamedGeneric(LOperand* obj,
- Handle<Object> name,
- LOperand* val)
- : LStoreNamed(obj, name, val) { }
+ LStoreNamedGeneric(LOperand* obj, LOperand* val)
+ : LStoreNamed(obj, val) { }
DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
+ DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
};
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev