| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 return false; | 248 return false; |
| 249 } | 249 } |
| 250 | 250 |
| 251 | 251 |
| 252 bool HValue::Equals(HValue* other) const { | 252 bool HValue::Equals(HValue* other) const { |
| 253 if (other->opcode() != opcode()) return false; | 253 if (other->opcode() != opcode()) return false; |
| 254 if (!other->representation().Equals(representation())) return false; | 254 if (!other->representation().Equals(representation())) return false; |
| 255 if (!other->type_.Equals(type_)) return false; | 255 if (!other->type_.Equals(type_)) return false; |
| 256 if (other->flags() != flags()) return false; |
| 256 if (OperandCount() != other->OperandCount()) return false; | 257 if (OperandCount() != other->OperandCount()) return false; |
| 257 for (int i = 0; i < OperandCount(); ++i) { | 258 for (int i = 0; i < OperandCount(); ++i) { |
| 258 if (OperandAt(i)->id() != other->OperandAt(i)->id()) return false; | 259 if (OperandAt(i)->id() != other->OperandAt(i)->id()) return false; |
| 259 } | 260 } |
| 260 bool result = DataEquals(other); | 261 bool result = DataEquals(other); |
| 261 ASSERT(!result || Hashcode() == other->Hashcode()); | 262 ASSERT(!result || Hashcode() == other->Hashcode()); |
| 262 return result; | 263 return result; |
| 263 } | 264 } |
| 264 | 265 |
| 265 | 266 |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 void HPhi::AddInput(HValue* value) { | 893 void HPhi::AddInput(HValue* value) { |
| 893 inputs_.Add(NULL); | 894 inputs_.Add(NULL); |
| 894 SetOperandAt(OperandCount() - 1, value); | 895 SetOperandAt(OperandCount() - 1, value); |
| 895 // Mark phis that may have 'arguments' directly or indirectly as an operand. | 896 // Mark phis that may have 'arguments' directly or indirectly as an operand. |
| 896 if (!CheckFlag(kIsArguments) && value->CheckFlag(kIsArguments)) { | 897 if (!CheckFlag(kIsArguments) && value->CheckFlag(kIsArguments)) { |
| 897 SetFlag(kIsArguments); | 898 SetFlag(kIsArguments); |
| 898 } | 899 } |
| 899 } | 900 } |
| 900 | 901 |
| 901 | 902 |
| 902 bool HPhi::HasReceiverOperand() { | |
| 903 for (int i = 0; i < OperandCount(); i++) { | |
| 904 if (OperandAt(i)->IsParameter() && | |
| 905 HParameter::cast(OperandAt(i))->index() == 0) { | |
| 906 return true; | |
| 907 } | |
| 908 } | |
| 909 return false; | |
| 910 } | |
| 911 | |
| 912 | |
| 913 HValue* HPhi::GetRedundantReplacement() const { | 903 HValue* HPhi::GetRedundantReplacement() const { |
| 914 HValue* candidate = NULL; | 904 HValue* candidate = NULL; |
| 915 int count = OperandCount(); | 905 int count = OperandCount(); |
| 916 int position = 0; | 906 int position = 0; |
| 917 while (position < count && candidate == NULL) { | 907 while (position < count && candidate == NULL) { |
| 918 HValue* current = OperandAt(position++); | 908 HValue* current = OperandAt(position++); |
| 919 if (current != this) candidate = current; | 909 if (current != this) candidate = current; |
| 920 } | 910 } |
| 921 while (position < count) { | 911 while (position < count) { |
| 922 HValue* current = OperandAt(position++); | 912 HValue* current = OperandAt(position++); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 } | 1175 } |
| 1186 | 1176 |
| 1187 | 1177 |
| 1188 void HStoreGlobal::PrintDataTo(StringStream* stream) const { | 1178 void HStoreGlobal::PrintDataTo(StringStream* stream) const { |
| 1189 stream->Add("[%p] = ", *cell()); | 1179 stream->Add("[%p] = ", *cell()); |
| 1190 value()->PrintNameTo(stream); | 1180 value()->PrintNameTo(stream); |
| 1191 } | 1181 } |
| 1192 | 1182 |
| 1193 | 1183 |
| 1194 void HLoadContextSlot::PrintDataTo(StringStream* stream) const { | 1184 void HLoadContextSlot::PrintDataTo(StringStream* stream) const { |
| 1195 stream->Add("(%d, %d)", context_chain_length(), slot_index()); | 1185 value()->PrintNameTo(stream); |
| 1186 stream->Add("[%d]", slot_index()); |
| 1187 } |
| 1188 |
| 1189 |
| 1190 void HStoreContextSlot::PrintDataTo(StringStream* stream) const { |
| 1191 context()->PrintNameTo(stream); |
| 1192 stream->Add("[%d] = ", slot_index()); |
| 1193 value()->PrintNameTo(stream); |
| 1196 } | 1194 } |
| 1197 | 1195 |
| 1198 | 1196 |
| 1199 // Implementation of type inference and type conversions. Calculates | 1197 // Implementation of type inference and type conversions. Calculates |
| 1200 // the inferred type of this instruction based on the input operands. | 1198 // the inferred type of this instruction based on the input operands. |
| 1201 | 1199 |
| 1202 HType HValue::CalculateInferredType() const { | 1200 HType HValue::CalculateInferredType() const { |
| 1203 return type_; | 1201 return type_; |
| 1204 } | 1202 } |
| 1205 | 1203 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1448 | 1446 |
| 1449 | 1447 |
| 1450 void HCheckPrototypeMaps::Verify() { | 1448 void HCheckPrototypeMaps::Verify() { |
| 1451 HInstruction::Verify(); | 1449 HInstruction::Verify(); |
| 1452 ASSERT(HasNoUses()); | 1450 ASSERT(HasNoUses()); |
| 1453 } | 1451 } |
| 1454 | 1452 |
| 1455 #endif | 1453 #endif |
| 1456 | 1454 |
| 1457 } } // namespace v8::internal | 1455 } } // namespace v8::internal |
| OLD | NEW |