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