Commit bacc626f authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

Fix HType handling for HConstant with external references.

We cannot use set_type() with HType::None() in the HConstant
constructor, since set_type() asserts that the new type is a
subtype of the previous one, but HType::None() is not a subtype
of HType::Tagged() which is the initial type set by the HValue
constructor.

This patch adds an optional type parameter to the HValue,
HInstruction and HTemplateInstruction constructors.

R=titzer@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15980 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d87296eb
......@@ -2741,7 +2741,8 @@ HConstant::HConstant(double double_value,
HConstant::HConstant(ExternalReference reference)
: has_smi_value_(false),
: HTemplateInstruction(HType::None()),
has_smi_value_(false),
has_int32_value_(false),
has_double_value_(false),
has_external_reference_value_(true),
......@@ -2750,7 +2751,6 @@ HConstant::HConstant(ExternalReference reference)
is_cell_(false),
boolean_value_(true),
external_reference_value_(reference) {
set_type(HType::None());
Initialize(Representation::External());
}
......
......@@ -873,12 +873,13 @@ class HValue: public ZoneObject {
HYDROGEN_ABSTRACT_INSTRUCTION_LIST(DECLARE_PREDICATE)
#undef DECLARE_PREDICATE
HValue() : block_(NULL),
id_(kNoNumber),
type_(HType::Tagged()),
use_list_(NULL),
range_(NULL),
flags_(0) {}
HValue(HType type = HType::Tagged())
: block_(NULL),
id_(kNoNumber),
type_(type),
use_list_(NULL),
range_(NULL),
flags_(0) {}
virtual ~HValue() {}
HBasicBlock* block() const { return block_; }
......@@ -1343,8 +1344,9 @@ class HInstruction: public HValue {
DECLARE_ABSTRACT_INSTRUCTION(Instruction)
protected:
HInstruction()
: next_(NULL),
HInstruction(HType type = HType::Tagged())
: HValue(type),
next_(NULL),
previous_(NULL),
position_(RelocInfo::kNoPosition) {
SetGVNFlag(kDependsOnOsrEntries);
......@@ -1375,6 +1377,8 @@ class HTemplateInstruction : public HInstruction {
HValue* OperandAt(int i) const { return inputs_[i]; }
protected:
HTemplateInstruction(HType type = HType::Tagged()) : HInstruction(type) {}
void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; }
private:
......
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