Commit e797e5a4 authored by danno@chromium.org's avatar danno@chromium.org

Fix crashes in debug output of generated stubs

R=jkummerow@chromium.org

Review URL: https://chromiumcodereview.appspot.com/11464027

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13201 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3f83e10f
......@@ -1031,8 +1031,10 @@ void HChange::PrintDataTo(StringStream* stream) {
void HJSArrayLength::PrintDataTo(StringStream* stream) {
value()->PrintNameTo(stream);
stream->Add(" ");
typecheck()->PrintNameTo(stream);
if (HasTypeCheck()) {
stream->Add(" ");
typecheck()->PrintNameTo(stream);
}
}
......@@ -1144,8 +1146,10 @@ void HCheckInstanceType::GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag) {
void HLoadElements::PrintDataTo(StringStream* stream) {
value()->PrintNameTo(stream);
stream->Add(" ");
typecheck()->PrintNameTo(stream);
if (HasTypeCheck()) {
stream->Add(" ");
typecheck()->PrintNameTo(stream);
}
}
......@@ -2023,12 +2027,16 @@ void HLoadKeyed::PrintDataTo(StringStream* stream) {
stream->Add("[");
key()->PrintNameTo(stream);
if (IsDehoisted()) {
stream->Add(" + %d] ", index_offset());
stream->Add(" + %d]", index_offset());
} else {
stream->Add("] ");
stream->Add("]");
}
if (HasDependency()) {
stream->Add(" ");
dependency()->PrintNameTo(stream);
}
dependency()->PrintNameTo(stream);
if (RequiresHoleCheck()) {
stream->Add(" check_hole");
}
......
......@@ -1937,7 +1937,7 @@ class HJSArrayLength: public HTemplateInstruction<2> {
// object. It is guaranteed to be 32 bit integer, but it can be
// represented as either a smi or heap number.
SetOperandAt(0, value);
SetOperandAt(1, typecheck);
SetOperandAt(1, typecheck != NULL ? typecheck : value);
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
SetGVNFlag(kDependsOnArrayLengths);
......@@ -1951,7 +1951,11 @@ class HJSArrayLength: public HTemplateInstruction<2> {
virtual void PrintDataTo(StringStream* stream);
HValue* value() { return OperandAt(0); }
HValue* typecheck() { return OperandAt(1); }
HValue* typecheck() {
ASSERT(HasTypeCheck());
return OperandAt(1);
}
bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); }
DECLARE_CONCRETE_INSTRUCTION(JSArrayLength)
......@@ -2152,14 +2156,18 @@ class HLoadElements: public HTemplateInstruction<2> {
public:
HLoadElements(HValue* value, HValue* typecheck) {
SetOperandAt(0, value);
SetOperandAt(1, typecheck);
SetOperandAt(1, typecheck != NULL ? typecheck : value);
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
SetGVNFlag(kDependsOnElementsPointer);
}
HValue* value() { return OperandAt(0); }
HValue* typecheck() { return OperandAt(1); }
HValue* typecheck() {
ASSERT(HasTypeCheck());
return OperandAt(1);
}
bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); }
virtual void PrintDataTo(StringStream* stream);
......@@ -4366,7 +4374,7 @@ class HLoadKeyed
SetOperandAt(0, obj);
SetOperandAt(1, key);
SetOperandAt(2, dependency);
SetOperandAt(2, dependency != NULL ? dependency : obj);
if (!is_external()) {
// I can detect the case between storing double (holey and fast) and
......@@ -4407,7 +4415,11 @@ class HLoadKeyed
}
HValue* elements() { return OperandAt(0); }
HValue* key() { return OperandAt(1); }
HValue* dependency() { return OperandAt(2); }
HValue* dependency() {
ASSERT(HasDependency());
return OperandAt(2);
}
bool HasDependency() const { return OperandAt(0) != OperandAt(2); }
uint32_t index_offset() { return IndexOffsetField::decode(bit_field_); }
void SetIndexOffset(uint32_t index_offset) {
bit_field_ = IndexOffsetField::update(bit_field_, index_offset);
......
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