Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 514 !(block()->IsReachable() || | 514 !(block()->IsReachable() || |
| 515 IsBlockEntry() || | 515 IsBlockEntry() || |
| 516 IsControlInstruction() || | 516 IsControlInstruction() || |
| 517 IsSimulate() || | 517 IsSimulate() || |
| 518 IsEnterInlined() || | 518 IsEnterInlined() || |
| 519 IsLeaveInlined()); | 519 IsLeaveInlined()); |
| 520 } | 520 } |
| 521 | 521 |
| 522 | 522 |
| 523 bool HValue::IsInteger32Constant() { | 523 bool HValue::IsInteger32Constant() { |
| 524 HValue* value_to_check = IsForceRepresentation() | 524 return IsConstant() && HConstant::cast(this)->HasInteger32Value(); |
| 525 ? HForceRepresentation::cast(this)->value() | |
| 526 : this; | |
| 527 return value_to_check->IsConstant() && | |
| 528 HConstant::cast(value_to_check)->HasInteger32Value(); | |
| 529 } | 525 } |
| 530 | 526 |
| 531 | 527 |
| 532 int32_t HValue::GetInteger32Constant() { | 528 int32_t HValue::GetInteger32Constant() { |
| 533 HValue* constant_value = IsForceRepresentation() | 529 return HConstant::cast(this)->Integer32Value(); |
| 534 ? HForceRepresentation::cast(this)->value() | |
| 535 : this; | |
| 536 return HConstant::cast(constant_value)->Integer32Value(); | |
| 537 } | 530 } |
| 538 | 531 |
| 539 | 532 |
| 540 bool HValue::EqualsInteger32Constant(int32_t value) { | 533 bool HValue::EqualsInteger32Constant(int32_t value) { |
| 541 return IsInteger32Constant() && GetInteger32Constant() == value; | 534 return IsInteger32Constant() && GetInteger32Constant() == value; |
| 542 } | 535 } |
| 543 | 536 |
| 544 | 537 |
| 545 void HValue::SetOperandAt(int index, HValue* value) { | 538 void HValue::SetOperandAt(int index, HValue* value) { |
| 546 RegisterUse(index, value); | 539 RegisterUse(index, value); |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1321 } | 1314 } |
| 1322 return this; | 1315 return this; |
| 1323 } | 1316 } |
| 1324 | 1317 |
| 1325 | 1318 |
| 1326 void HTypeof::PrintDataTo(StringStream* stream) { | 1319 void HTypeof::PrintDataTo(StringStream* stream) { |
| 1327 value()->PrintNameTo(stream); | 1320 value()->PrintNameTo(stream); |
| 1328 } | 1321 } |
| 1329 | 1322 |
| 1330 | 1323 |
| 1324 HInstruction* HForceRepresentation::New(Zone* zone, HValue* context, | |
| 1325 HValue* value, Representation required_representation) { | |
| 1326 if (FLAG_fold_constants && value->IsConstant()) { | |
| 1327 HConstant* c = HConstant::cast(value); | |
| 1328 if ((c->HasNumberValue())) { | |
|
mvstanton
2013/11/19 10:22:28
nit: remove extra parens
Igor Sheludko
2013/11/19 11:43:35
Done.
| |
| 1329 double double_res = c->DoubleValue(); | |
| 1330 if (TypeInfo::IsInt32Double(double_res)) { | |
| 1331 return HConstant::New(zone, context, | |
| 1332 static_cast<int32_t>(double_res), | |
| 1333 required_representation); | |
| 1334 } | |
| 1335 } | |
| 1336 } | |
| 1337 return new(zone) HForceRepresentation(value, required_representation); | |
| 1338 } | |
| 1339 | |
| 1340 | |
| 1331 void HForceRepresentation::PrintDataTo(StringStream* stream) { | 1341 void HForceRepresentation::PrintDataTo(StringStream* stream) { |
| 1332 stream->Add("%s ", representation().Mnemonic()); | 1342 stream->Add("%s ", representation().Mnemonic()); |
| 1333 value()->PrintNameTo(stream); | 1343 value()->PrintNameTo(stream); |
| 1334 } | 1344 } |
| 1335 | 1345 |
| 1336 | 1346 |
| 1337 void HChange::PrintDataTo(StringStream* stream) { | 1347 void HChange::PrintDataTo(StringStream* stream) { |
| 1338 HUnaryOperation::PrintDataTo(stream); | 1348 HUnaryOperation::PrintDataTo(stream); |
| 1339 stream->Add(" %s to %s", from().Mnemonic(), to().Mnemonic()); | 1349 stream->Add(" %s to %s", from().Mnemonic(), to().Mnemonic()); |
| 1340 | 1350 |
| (...skipping 3010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4351 break; | 4361 break; |
| 4352 case kExternalMemory: | 4362 case kExternalMemory: |
| 4353 stream->Add("[external-memory]"); | 4363 stream->Add("[external-memory]"); |
| 4354 break; | 4364 break; |
| 4355 } | 4365 } |
| 4356 | 4366 |
| 4357 stream->Add("@%d", offset()); | 4367 stream->Add("@%d", offset()); |
| 4358 } | 4368 } |
| 4359 | 4369 |
| 4360 } } // namespace v8::internal | 4370 } } // namespace v8::internal |
| OLD | NEW |